代码优化

This commit is contained in:
guo 2023-12-02 15:45:28 +08:00
parent c483111f45
commit f3484de24e
32 changed files with 336 additions and 109 deletions

View File

@ -15,6 +15,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Objects;
/**
* 项目工程表拓展
*/
@Data
public class CityAndDistrictDeviceCountVo extends Engineering {
@ApiModelProperty("政务名称")

View File

@ -6,7 +6,9 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 单列图表y轴
*/
@Data
@AllArgsConstructor
@NoArgsConstructor

View File

@ -11,7 +11,7 @@ import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 多列图表
* 多列图表带总数
*/
@Data
public class MultiTrendVo {

View File

@ -13,6 +13,9 @@ import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 扇形图表带总数
*/
@Data
@AllArgsConstructor
@NoArgsConstructor

View File

@ -19,6 +19,13 @@ public class TrendVo {
private String x;
private String y;
/**
* 获取折线和柱形图列表
*
* @param list
* @param governmentMapper
* @return
*/
public static List<TrendVo> getTrendVosForGovernment(List<TrendVo> list, GovernmentMapper governmentMapper) {
Map<String, TrendVo> map = list.stream().collect(Collectors.toMap(TrendVo::getX, Function.identity(), (o1, o2) -> o1));
List<Government> myGovernments = governmentMapper.getMyUnderGovernments(SecurityUtil.getUser().getSn());

View File

@ -8,7 +8,7 @@ import com.zhgd.xmgl.modules.basicdata.dto.AppIndexDeviceDto;
import com.zhgd.xmgl.modules.basicdata.dto.AppIndexTopStatDto;
import com.zhgd.xmgl.modules.city.engineering.service.IEngineeringService;
import com.zhgd.xmgl.modules.city.worker.entity.WorkerInfo;
import com.zhgd.xmgl.modules.wisdom.service.ICompanyService;
import com.zhgd.xmgl.modules.city.company.service.ICompanyService;
import com.zhgd.xmgl.modules.city.monitor.service.IMonitorDevService;
import com.zhgd.xmgl.modules.city.monitor.service.IMonitorQuestionService;
import com.zhgd.xmgl.modules.city.worker.service.IWorkerInfoService;

View File

@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.modules.wisdom.entity.Company;
import com.zhgd.xmgl.modules.wisdom.service.ICompanyService;
import com.zhgd.xmgl.modules.city.company.entity.Company;
import com.zhgd.xmgl.modules.city.company.service.ICompanyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -7,8 +7,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.wisdom.entity.Company;
import com.zhgd.xmgl.modules.wisdom.service.ICompanyService;
import com.zhgd.xmgl.modules.city.company.entity.Company;
import com.zhgd.xmgl.modules.city.company.service.ICompanyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -8,7 +8,7 @@ import com.zhgd.xmgl.modules.basicdata.dto.AppIndexDeviceDto;
import com.zhgd.xmgl.modules.basicdata.dto.AppIndexTopStatDto;
import com.zhgd.xmgl.modules.city.engineering.service.IEngineeringService;
import com.zhgd.xmgl.modules.city.worker.entity.WorkerInfo;
import com.zhgd.xmgl.modules.wisdom.service.ICompanyService;
import com.zhgd.xmgl.modules.city.company.service.ICompanyService;
import com.zhgd.xmgl.modules.city.monitor.service.IMonitorDevService;
import com.zhgd.xmgl.modules.city.monitor.service.IMonitorQuestionService;
import com.zhgd.xmgl.modules.city.worker.service.IWorkerInfoService;

View File

@ -1,19 +1,15 @@
package com.zhgd.xmgl.modules.basicdata.controller.project;
package com.zhgd.xmgl.modules.city.company.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.Company;
import com.zhgd.xmgl.modules.wisdom.service.ICompanyService;
import com.zhgd.xmgl.security.SecurityUser;
import com.zhgd.xmgl.security.SecurityUtil;
import com.zhgd.xmgl.modules.city.company.entity.Company;
import com.zhgd.xmgl.modules.city.company.service.ICompanyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@ -42,7 +38,7 @@ import java.util.Map;
@RequestMapping("/project/company")
@Slf4j
@Api(tags = "参建单位管理")
public class CompanyController {
public class CompanyController {
@Autowired
private ICompanyService companyService;
@ -55,23 +51,20 @@ public class CompanyController {
@ApiOperation(value = "分页列表查询参建单位信息", notes = "分页列表查询参建单位信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "参建单位类型", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "companyName", value = "单位名称 ", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "companyName", value = "单位名称", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "enterpriseSn", value = "企业唯一标识", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "workerInfoId", value = "劳务人员id", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
})
})
@PostMapping(value = "/page")
public Result<IPage<Company>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
QueryWrapper<Company> wrapper = QueryGenerator.initPageQueryWrapper(Company.class, map);
if (StringUtils.isNotBlank(MapUtils.getString(map, ParamConstants.PROJECT_SN))) {
wrapper.lambda().eq(Company::getEngineeringSn, StrUtil.EMPTY);
}
Page<Company> page = PageUtil.getPage(map);
IPage<Company> pageList = companyService.page(page, wrapper);
return Result.success(pageList);
return Result.success(companyService.queryPageList(map));
}
/**
* 列表查询
*
* @return
*/
@OperLog(operModul = "参建单位管理", operType = "列表查询", operDesc = "列表查询参建单位信息")
@ -87,9 +80,9 @@ public class CompanyController {
}
/**
* 通过id查询
*
* @return
*/
@OperLog(operModul = "参建单位管理", operType = "查询", operDesc = "通过id查询参建单位信息")

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.wisdom.entity;
package com.zhgd.xmgl.modules.city.company.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

View File

@ -0,0 +1,24 @@
package com.zhgd.xmgl.modules.city.company.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.DataScope;
import com.zhgd.xmgl.modules.city.company.entity.Company;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @Description: 参建单位
* @author pengj
* @date 2023-03-13
* @version V1.0
*/
@Mapper
@DataScope
public interface CompanyMapper extends BaseMapper<Company> {
IPage<Company> queryPageList(Page<Company> page,@Param(Constants.WRAPPER) QueryWrapper<Company> wrapper);
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhgd.xmgl.modules.city.company.mapper.CompanyMapper">
<select id="queryPageList" resultType="com.zhgd.xmgl.modules.city.company.entity.Company">
select distinct c.*
from company c
left join engineering_main em on c.engineering_sn = em.engineering_sn
left join worker_info wi on wi.company_sn=c.company_sn
${ew.customSqlSegment}
</select>
</mapper>

View File

@ -1,8 +1,11 @@
package com.zhgd.xmgl.modules.wisdom.service;
package com.zhgd.xmgl.modules.city.company.service;
import com.zhgd.xmgl.modules.wisdom.entity.Company;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.xmgl.modules.city.company.entity.Company;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map;
/**
* @Description: 参建单位
* @author pengj
@ -12,4 +15,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
public interface ICompanyService extends IService<Company> {
boolean saveInfo(Company company);
IPage<Company> queryPageList(Map<String, Object> map);
}

View File

@ -0,0 +1,53 @@
package com.zhgd.xmgl.modules.city.company.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.city.company.entity.Company;
import com.zhgd.xmgl.modules.city.company.mapper.CompanyMapper;
import com.zhgd.xmgl.modules.city.company.service.ICompanyService;
import com.zhgd.xmgl.util.CommonUtil;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @Description: 参建单位
* @author pengj
* @date 2023-03-13
* @version V1.0
*/
@Service
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements ICompanyService {
@Override
public boolean saveInfo(Company company) {
company.setCompanySn(CommonUtil.getUUid());
return this.save(company);
}
@Override
public IPage<Company> queryPageList(Map<String, Object> map) {
QueryWrapper<Company> wrapper = QueryGenerator.initPageQueryWrapper(Company.class, map);
if (StringUtils.isNotBlank(MapUtils.getString(map, ParamConstants.PROJECT_SN))) {
wrapper.lambda().eq(Company::getEngineeringSn, StrUtil.EMPTY);
}
String enterpriseSn = MapUtils.getString(map, "enterpriseSn");
if (StrUtil.isNotBlank(enterpriseSn)) {
wrapper.eq("em.enterprise_sn", enterpriseSn);
}
String workerInfoId = MapUtils.getString(map, "workerInfoId");
if (StrUtil.isNotBlank(workerInfoId)) {
wrapper.eq("wi.id", workerInfoId);
}
Page<Company> page = PageUtil.getPage(map);
return baseMapper.queryPageList(page, wrapper);
}
}

View File

@ -115,12 +115,14 @@ public class DangerousEngineeringController {
@OperLog(operModul = "危大工程管理", operType = "统计", operDesc = "危大工程排名")
@ApiOperation(value = "危大工程排名", notes = "危大工程排名", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "dangerType", value = "是否超危0否1是", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "size", value = "查前面几条", paramType = "body", required = false, dataType = "Integer")
@ApiImplicitParam(name = "dangerType", value = "是否超危0否1是", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "size", value = "查前面几条", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "type", value = "排序类型1不同区域2公司", paramType = "body", required = true, dataType = "Integer"),
})
@PostMapping(value = "/countDangerousEngineeringRank")
public Result<List<SectorOneVo>> countDangerousEngineeringRank(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
return Result.success(dangerousEngineeringService.countDangerousEngineeringRank(paramMap));
}
}

View File

@ -17,6 +17,7 @@ import com.zhgd.xmgl.modules.basicdata.statistics.EngineeringStat;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.engineering.entity.EngineeringSingle;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.CountEngineeringVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringEveryDistrictAndStateVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringTrendProgressVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringTrendVo;
import com.zhgd.xmgl.modules.city.engineering.service.IEngineeringService;
@ -66,6 +67,8 @@ public class EngineeringController {
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer"),
@ApiImplicitParam(name = "newThisYear", value = "是否今年新增1是0否", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "endThisYear", value = "是否今年竣工合格1是0否", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "type", value = "1年度新建工程(项)2在建工程(项)3停工工程(项)4重点工程(项)5停开工", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "year", value = "年份", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "notMonitor", value = "未接入视频工程1未接入0已接入", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "engineeringCost_begin", value = "工程造价(万元)开始", paramType = "body", required = false, dataType = "Double"),
@ApiImplicitParam(name = "engineeringCost_end", value = "工程造价(万元)结束", paramType = "body", required = false, dataType = "Double"),
@ -76,10 +79,11 @@ public class EngineeringController {
@ApiImplicitParam(name = "designEntSn", value = "设计单位SN", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "supervisorEntSn", value = "监理单位SN", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "surveyEntSn", value = "勘察单位SN", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "idCard", value = "身份证号", paramType = "body", dataType = "String"),
})
@PostMapping(value = "/page")
public Result<IPage<Engineering>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
String alias = "engineering.";
String alias = "e.";
QueryWrapper<Engineering> wrapper = QueryGenerator.initPageQueryWrapper(Engineering.class, map, alias);
String buildEntSn = MapUtils.getString(map, "buildEntSn");
String opEntSn = MapUtils.getString(map, "opEntSn");
@ -92,7 +96,7 @@ public class EngineeringController {
if (Objects.equals(MapUtils.getInteger(map, "newThisYear"), 1)) {
wrapper.ge(alias + RefUtil.fieldNameUlc(Engineering::getStartTime), dateTime);
}
if (Objects.equals(MapUtils.getInteger(map, "endThisYear"), 1)) {
if (Objects.equals(MapUtils.getInteger(map, "endThisYear"), 1)) {
wrapper.ge(alias + RefUtil.fieldNameUlc(Engineering::getEndTime), dateTime);
}
String existsSql = "(\n" +
@ -119,8 +123,30 @@ public class EngineeringController {
if (StrUtil.isNotBlank(surveyEntSn)) {
wrapper.eq("em5.enterprise_sn", surveyEntSn);
}
String idCard = MapUtils.getString(map, "idCard");
if (StrUtil.isNotBlank(idCard)) {
wrapper.eq("wi.id_card", idCard);
}
Integer type = MapUtils.getInteger(map, "type");
String year = MapUtils.getString(map, "year");
if (StrUtil.isNotBlank(year)) {
wrapper.eq("date_format(e.create_time, '%Y')", year);
}
if (Objects.equals(type, 2)) {
wrapper.eq("e.state", 2);
} else if (Objects.equals(type, 3)) {
wrapper.and(w -> w.eq("e.state", 3).or().eq("e.state", 4));
} else if (Objects.equals(type, 4)) {
wrapper.eq("e.examine_state", 3);
wrapper.eq("e.is_important", 1);
} else if (Objects.equals(type, 5)) {
wrapper.and(w -> w.eq("e.state", 1).or().eq("e.state", 3).or().eq("e.state", 4));
}
IPage<Engineering> pageList = engineeringService.getPageList(page, wrapper, map);
if (StrUtil.isNotBlank(idCard)) {
pageList.getRecords().stream().sorted((o1, o2) -> o2.getEntryTime() != null ? o2.getEntryTime().compareTo(o1.getEntryTime()) : 1);
}
return Result.success(pageList);
}
@ -198,9 +224,10 @@ public class EngineeringController {
@OperLog(operModul = "工程管理", operType = "统计", operDesc = "统计工程")
@ApiOperation(value = "统计工程", notes = "统计工程", httpMethod = "POST")
@ApiImplicitParam(name = "year", value = "年份如2020", paramType = "body", required = false, dataType = "String")
@PostMapping(value = "/countEngineering")
public Result<CountEngineeringVo> countEngineering() {
return Result.success(engineeringService.countEngineering());
public Result<CountEngineeringVo> countEngineering(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
return Result.success(engineeringService.countEngineering(paramMap));
}
@OperLog(operModul = "工程管理", operType = "统计", operDesc = "统计工程进度")
@ -303,4 +330,15 @@ public class EngineeringController {
public Result<MultiTrendVo> countEngineeringEveryDistrictAndType() {
return Result.success(engineeringService.countEngineeringEveryDistrictAndType());
}
@OperLog(operModul = "工程管理", operType = "查询", operDesc = "统计工程每个区在建和停工数量")
@ApiOperation(value = "统计工程每个区在建和停工数量", notes = "统计工程每个区在建和停工数量", httpMethod = "POST")
@ApiImplicitParams({
})
@PostMapping(value = "/countEngineeringEveryDistrictAndState")
public Result<EngineeringEveryDistrictAndStateVo> countEngineeringEveryDistrictAndState() {
return Result.success(engineeringService.countEngineeringEveryDistrictAndState());
}
}

View File

@ -360,4 +360,7 @@ public class Engineering implements Serializable {
@TableField(exist = false)
private String surveyEnt;
@TableField(exist = false)
@ApiModelProperty(value = "入场时间")
private Date entryTime;
}

View File

@ -19,4 +19,11 @@ public class CountEngineeringVo {
private Double totalEngineeringLength;
@ApiModelProperty(value = "工程总面积(㎡)")
private Double totalEngineeringArea;
@ApiModelProperty(value = "年度新建工程(项)")
private Integer newYearConstructionCount;
@ApiModelProperty(value = "在建工程(项)")
private Integer constructionInProgressCount;
@ApiModelProperty(value = "停工工程(项)")
private Integer workStoppageCount;
}

View File

@ -0,0 +1,16 @@
package com.zhgd.xmgl.modules.city.engineering.entity.vo;
import com.zhgd.xmgl.base.entity.vo.SectorOneVo;
import com.zhgd.xmgl.base.entity.vo.TrendVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class EngineeringEveryDistrictAndStateVo {
@ApiModelProperty("新建")
private List<SectorOneVo> newBuilds;
@ApiModelProperty("停工")
private List<SectorOneVo> shutDowns;
}

View File

@ -27,4 +27,6 @@ public interface DangerousEngineeringMapper extends BaseMapper<DangerousEngineer
List<TrendVo> countDangerousEngineeringType(HashMap<String, Object> map);
List<SectorOneVo> countDangerousEngineeringRank(HashMap<String, Object> paramMap);
List<SectorOneVo> countDangerousEngineeringDistrictRank(HashMap<String, Object> paramMap);
}

View File

@ -14,6 +14,7 @@ import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -49,7 +50,7 @@ public interface EngineeringMapper extends BaseMapper<Engineering> {
Integer getCompletedThisYearCount();
Integer getKeyProjectCount();
Integer getKeyProjectCount(HashMap<String, Object> paramMap);
Double getTotalEngineeringArea();
@ -69,9 +70,15 @@ public interface EngineeringMapper extends BaseMapper<Engineering> {
List<TrendVo> countEngineeringDistrictCost(Map<String, Object> paramMap);
List<SectorOneVo> countEngineeringType();
List<SectorOneVo> countEngineeringType(HashMap<String, Object> paramMap);
List<Engineering> countEngineeringEveryDistrictAndType();
Page<Engineering> getPageList(Page page, @Param(Constants.WRAPPER) Wrapper<Engineering> wrapper, @Param("map") Map<String, Object> map);
Integer getNewYearConstructionCount(HashMap<String, Object> paramMap);
Integer getConstructionInProgressCount(HashMap<String, Object> paramMap);
Integer getWorkStoppageCount(HashMap<String, Object> paramMap);
}

View File

@ -41,4 +41,20 @@
</if>
group by g.government_sn
</select>
<select id="countDangerousEngineeringDistrictRank" resultType="com.zhgd.xmgl.base.entity.vo.SectorOneVo">
select c.enterprise_name name, count(de.id) count
from enterprise c
left join engineering_main em on c.enterprise_sn = em.enterprise_sn
left join dangerous_engineering de on (em.engineering_sn = de.engineering_sn and de.project_sn in
<foreach collection="projectSnList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
)
group by c.enterprise_sn
order by count desc
<if test="size != null and size != ''">
limit #{size}
</if>
</select>
</mapper>

View File

@ -101,6 +101,9 @@
from engineering
where examine_state = 3
and is_important = 1
<if test="year != null and year != ''">
and date_format(create_time,'%Y') = #{year}
</if>
</select>
<select id="getTotalEngineeringArea" resultType="java.lang.Double">
@ -226,6 +229,13 @@
<select id="countEngineeringType" resultType="com.zhgd.xmgl.base.entity.vo.SectorOneVo">
select engineering_type, count(*) count
from engineering
where 1=1
<if test="state != null">
and state = #{state}
</if>
<if test="stop != null">
and (state = 3 or state = 4)
</if>
group by engineering_type
</select>
@ -237,24 +247,55 @@
</select>
<select id="getPageList" resultType="com.zhgd.xmgl.modules.city.engineering.entity.Engineering">
select *,
e1.enterprise_name as buildEnt,
e2.enterprise_name as opEnt,
e3.enterprise_name as designEnt,
e4.enterprise_name as supervisorEnt,
e5.enterprise_name as surveyEnt
from engineering
left join engineering_main em1 on engineering.engineering_sn = em1.engineering_sn and em1.type = 1
select distinct e.*,
e1.enterprise_name as buildEnt,
e2.enterprise_name as opEnt,
e3.enterprise_name as designEnt,
e4.enterprise_name as supervisorEnt,
e5.enterprise_name as surveyEnt,
wi.entry_time
from engineering e
left join engineering_main em1 on e.engineering_sn = em1.engineering_sn and em1.type = 1
left join enterprise e1 on e1.enterprise_sn = em1.enterprise_sn
left join engineering_main em2 on engineering.engineering_sn = em2.engineering_sn and em2.type = 3
left join engineering_main em2 on e.engineering_sn = em2.engineering_sn and em2.type = 3
left join enterprise e2 on e2.enterprise_sn = em2.enterprise_sn
left join engineering_main em3 on engineering.engineering_sn = em3.engineering_sn and em3.type = 5
left join engineering_main em3 on e.engineering_sn = em3.engineering_sn and em3.type = 5
left join enterprise e3 on e3.enterprise_sn = em3.enterprise_sn
left join engineering_main em4 on engineering.engineering_sn = em4.engineering_sn and em4.type = 2
left join engineering_main em4 on e.engineering_sn = em4.engineering_sn and em4.type = 2
left join enterprise e4 on e4.enterprise_sn = em4.enterprise_sn
left join engineering_main em5 on engineering.engineering_sn = em5.engineering_sn and em5.type = 4
left join engineering_main em5 on e.engineering_sn = em5.engineering_sn and em5.type = 4
left join enterprise e5 on e5.enterprise_sn = em5.enterprise_sn
left join worker_info wi on wi.engineering_sn = e.engineering_sn
${ew.customSqlSegment}
</select>
<select id="getNewYearConstructionCount" resultType="java.lang.Integer">
select count(*) count
from engineering
where 1 = 1
<if test="year != null and year != ''">
and date_format(create_time, '%Y') = #{year}
</if>
</select>
<select id="getConstructionInProgressCount" resultType="java.lang.Integer">
select count(*) count
from engineering
where 1 = 1
and state = 2
<if test="year != null and year != ''">
and date_format(create_time, '%Y') = #{year}
</if>
</select>
<select id="getWorkStoppageCount" resultType="java.lang.Integer">
select count(*) count
from engineering
where 1 = 1
and (state = 3 or state = 4)
<if test="year != null and year != ''">
and date_format(create_time, '%Y') = #{year}
</if>
</select>
</mapper>

View File

@ -22,4 +22,6 @@ public interface IDangerousEngineeringService extends IService<DangerousEngineer
MultiTrendVo countDangerousEngineeringType();
List<SectorOneVo> countDangerousEngineeringRank(HashMap<String, Object> paramMap);
}

View File

@ -13,6 +13,7 @@ import com.zhgd.xmgl.modules.basicdata.statistics.EngineeringStat;
import com.zhgd.xmgl.modules.basicdata.vo.EngineeringVo;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.CountEngineeringVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringEveryDistrictAndStateVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringTrendProgressVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringTrendVo;
@ -62,7 +63,7 @@ public interface IEngineeringService extends IService<Engineering> {
List<EngineeringSingle> querySingle(Engineering engineering);
CountEngineeringVo countEngineering();
CountEngineeringVo countEngineering(HashMap<String, Object> paramMap);
List<SectorOneVo> countEngineeringState(HashMap<String, Object> paramMap);
@ -81,4 +82,7 @@ public interface IEngineeringService extends IService<Engineering> {
List<SectorOneVo> countEngineeringType();
MultiTrendVo countEngineeringEveryDistrictAndType();
EngineeringEveryDistrictAndStateVo countEngineeringEveryDistrictAndState();
}

View File

@ -1,8 +1,10 @@
package com.zhgd.xmgl.modules.city.engineering.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.xmgl.base.entity.vo.*;
import com.zhgd.xmgl.constant.CommonConstant;
import com.zhgd.xmgl.modules.basicdata.entity.SystemDictData;
import com.zhgd.xmgl.modules.basicdata.mapper.SystemDictDataMapper;
import com.zhgd.xmgl.modules.basicdata.service.ISystemDictDataService;
@ -11,6 +13,7 @@ import com.zhgd.xmgl.modules.city.engineering.mapper.DangerousEngineeringMapper;
import com.zhgd.xmgl.modules.city.engineering.service.IDangerousEngineeringService;
import com.zhgd.xmgl.modules.city.government.entity.Government;
import com.zhgd.xmgl.modules.city.government.mapper.GovernmentMapper;
import com.zhgd.xmgl.modules.city.project.mapper.ProjectMapper;
import com.zhgd.xmgl.security.SecurityUtil;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -19,6 +22,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@ -35,6 +39,8 @@ public class DangerousEngineeringServiceImpl extends ServiceImpl<DangerousEngine
SystemDictDataMapper systemDictDataMapper;
@Autowired
ISystemDictDataService systemDictDataService;
@Autowired
ProjectMapper projectMapper;
@Override
public MultiTrendVo countDangerousEngineeringDistrict() {
@ -74,13 +80,25 @@ public class DangerousEngineeringServiceImpl extends ServiceImpl<DangerousEngine
@Override
public List<SectorOneVo> countDangerousEngineeringRank(HashMap<String, Object> paramMap) {
Integer size = MapUtils.getInteger(paramMap, "size");
List<SectorOneVo> sectorOneVos = baseMapper.countDangerousEngineeringRank(paramMap);
List<SectorOneVo> sectorOneVosForGovernments = SectorOneVo.getSectorOneVosForGovernment(sectorOneVos, governmentMapper);
sectorOneVosForGovernments.sort((o1, o2) -> o2.getCount().compareTo(o1.getCount()));
if (size != null) {
sectorOneVosForGovernments = sectorOneVosForGovernments.stream().limit(size).collect(Collectors.toList());
Integer type = MapUtils.getInteger(paramMap, "type");
if (Objects.equals(type, 1)) {
Integer size = MapUtils.getInteger(paramMap, "size");
List<SectorOneVo> sectorOneVos = baseMapper.countDangerousEngineeringRank(paramMap);
List<SectorOneVo> sectorOneVosForGovernments = SectorOneVo.getSectorOneVosForGovernment(sectorOneVos, governmentMapper);
sectorOneVosForGovernments.sort((o1, o2) -> o2.getCount().compareTo(o1.getCount()));
if (size != null) {
sectorOneVosForGovernments = sectorOneVosForGovernments.stream().limit(size).collect(Collectors.toList());
}
return sectorOneVosForGovernments;
} else {
paramMap.put(CommonConstant.IGNORE_DATA_SCOPE,CommonConstant.IGNORE_DATA_SCOPE);
String sn = SecurityUtil.getUser().getSn();
List<String> projectSnList = projectMapper.getSnListForCity(sn);
if (CollUtil.isEmpty(projectSnList)) {
return null;
}
paramMap.put("projectSnList", projectSnList);
return baseMapper.countDangerousEngineeringDistrictRank(paramMap);
}
return sectorOneVosForGovernments;
}
}

View File

@ -33,6 +33,7 @@ import com.zhgd.xmgl.modules.city.engineering.entity.EngineeringMain;
import com.zhgd.xmgl.modules.city.engineering.entity.EngineeringMainPerson;
import com.zhgd.xmgl.modules.city.engineering.entity.EngineeringSingle;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.CountEngineeringVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringEveryDistrictAndStateVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringTrendProgressVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringTrendVo;
import com.zhgd.xmgl.modules.city.engineering.mapper.EngineeringMapper;
@ -96,7 +97,7 @@ public class EngineeringServiceImpl extends ServiceImpl<EngineeringMapper, Engin
@Override
public Page<Engineering> getPageList(Page page, Wrapper<Engineering> wrapper, Map<String, Object> map) {
Page<Engineering> pageList = baseMapper.getPageList(page, wrapper,map);
Page<Engineering> pageList = baseMapper.getPageList(page, wrapper, map);
List<SystemDictData> engineeringTypes = systemDictDataService.getByType(ParamEnum.SysDictType.ENGINEERING_TYPE.getValue());
List<SystemDictData> engineeringStates = systemDictDataService.getByType(ParamEnum.SysDictType.ENGINEERING_STATE.getValue());
pageList.getRecords().stream().forEach(s -> {
@ -285,15 +286,18 @@ public class EngineeringServiceImpl extends ServiceImpl<EngineeringMapper, Engin
}
@Override
public CountEngineeringVo countEngineering() {
public CountEngineeringVo countEngineering(HashMap<String, Object> paramMap) {
CountEngineeringVo vo = new CountEngineeringVo();
vo.setProjectUnderSupervisionCount(baseMapper.getProjectUnderSupervisionCount());
vo.setTotalProjectCost(baseMapper.getTotalProjectCost());
vo.setNewThisYearCount(baseMapper.getNewThisYearCount());
vo.setCompletedThisYearCount(baseMapper.getCompletedThisYearCount());
vo.setKeyProjectCount(baseMapper.getKeyProjectCount());
vo.setKeyProjectCount(baseMapper.getKeyProjectCount(paramMap));
vo.setTotalEngineeringArea(baseMapper.getTotalEngineeringArea());
vo.setTotalEngineeringLength(baseMapper.getTotalEngineeringLength());
vo.setNewYearConstructionCount(baseMapper.getNewYearConstructionCount(paramMap));
vo.setConstructionInProgressCount(baseMapper.getConstructionInProgressCount(paramMap));
vo.setWorkStoppageCount(baseMapper.getWorkStoppageCount(paramMap));
return vo;
}
@ -388,7 +392,8 @@ public class EngineeringServiceImpl extends ServiceImpl<EngineeringMapper, Engin
@Override
public List<SectorOneVo> countEngineeringType() {
List<SectorOneVo> list = baseMapper.countEngineeringType();
HashMap<String, Object> paramMap = new HashMap<>();
List<SectorOneVo> list = baseMapper.countEngineeringType(paramMap);
List<SectorOneVo> rtList = new ArrayList<>();
Map<Integer, SectorOneVo> map = list.stream().collect(Collectors.toMap(SectorOneVo::getEngineeringType, Function.identity()));
for (ParamEnum.EngineeringType type : ParamEnum.EngineeringType.values()) {
@ -425,6 +430,18 @@ public class EngineeringServiceImpl extends ServiceImpl<EngineeringMapper, Engin
return vo;
}
@Override
public EngineeringEveryDistrictAndStateVo countEngineeringEveryDistrictAndState() {
HashMap<String, Object> paramMap = new HashMap<>();
EngineeringEveryDistrictAndStateVo vo = new EngineeringEveryDistrictAndStateVo();
paramMap.put("state", 1);
vo.setNewBuilds(SectorOneVo.getSectorOneVosForGovernment(baseMapper.countEngineeringType(paramMap), governmentMapper));
paramMap.put("state", null);
paramMap.put("stop", true);
vo.setShutDowns(SectorOneVo.getSectorOneVosForGovernment(baseMapper.countEngineeringType(paramMap), governmentMapper));
return vo;
}
private List<String> getData(List<String> names, ParamEnum.EngineeringType type, List<Engineering> list) {
List<String> rtList = new ArrayList<>();
for (String name : names) {

View File

@ -1,18 +0,0 @@
package com.zhgd.xmgl.modules.wisdom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhgd.annotation.DataScope;
import com.zhgd.xmgl.modules.wisdom.entity.Company;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description: 参建单位
* @author pengj
* @date 2023-03-13
* @version V1.0
*/
@Mapper
@DataScope
public interface CompanyMapper extends BaseMapper<Company> {
}

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhgd.xmgl.modules.wisdom.mapper.CompanyMapper">
</mapper>

View File

@ -1,24 +0,0 @@
package com.zhgd.xmgl.modules.wisdom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.xmgl.modules.wisdom.entity.Company;
import com.zhgd.xmgl.modules.wisdom.mapper.CompanyMapper;
import com.zhgd.xmgl.modules.wisdom.service.ICompanyService;
import com.zhgd.xmgl.util.CommonUtil;
import org.springframework.stereotype.Service;
/**
* @Description: 参建单位
* @author pengj
* @date 2023-03-13
* @version V1.0
*/
@Service
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements ICompanyService {
@Override
public boolean saveInfo(Company company) {
company.setCompanySn(CommonUtil.getUUid());
return this.save(company);
}
}

View File

@ -44,7 +44,7 @@ spring.servlet.multipart.max-file-size=1024MB
spring.servlet.multipart.max-request-size=1024MB
spring.servlet.multipart.resolve-lazily=false
# mqtt服务器配置
mqtt.url=tcp://jxj.zhgdyun.com:1883
mqtt.host=tcp://jxj.zhgdyun.com:1883
mqtt.clientId=mqttx_babd9e97
mqtt.username=admin
mqtt.password=JXJ@admin