Commit 9306cd4a authored by suhuiguang's avatar suhuiguang

1.三库建设大屏接口初稿开发

parent 463a150a
...@@ -32,6 +32,7 @@ public enum DPMapStatisticsItemEnum { ...@@ -32,6 +32,7 @@ public enum DPMapStatisticsItemEnum {
CONSTRUCTION_UNITS("安改维单位 (家)", "constructionUnits", ""), CONSTRUCTION_UNITS("安改维单位 (家)", "constructionUnits", ""),
USERS_UNITS("使用单位 (家)", "usersUnits", ""), USERS_UNITS("使用单位 (家)", "usersUnits", ""),
GAS_UNITS("充装单位 (家)", "gasUnits", ""), GAS_UNITS("充装单位 (家)", "gasUnits", ""),
DESIGN_UNITS("设计单位 (家)", "designUnits", ""),
OPERATORS("作业人员 (人)", "operators", ""), OPERATORS("作业人员 (人)", "operators", ""),
DEVICE_COUNT("已纳管设备数", "deviceCount", ""), DEVICE_COUNT("已纳管设备数", "deviceCount", ""),
PERSON_ISSUES_COUNT("个人问题数", "个人", ""), PERSON_ISSUES_COUNT("个人问题数", "个人", ""),
......
package com.yeejoin.amos.boot.module.statistics.api.dto;
import lombok.Data;
/**
* 详情-企业上线情况属性
*/
@Data
public class SkjsCompanyCountItemDto {
/**
* 区域-code
*/
private String regionCode;
/**
* 区域-name
*/
private String regionName;
/**
* 使用单位
*/
private String sydw;
/**
* 制造单位
*/
private String zzdw;
/**
* 安装维单位
*/
private String agwdw;
/**
* 充装单位
*/
private String czdw;
/**
* 检验检测机构
*/
private String jyjcjg;
/**
* 设计单位
*/
private String sjdw;
public void setDefaultValues() {
this.sydw = "";
this.zzdw = "";
this.agwdw = "";
this.czdw = "";
this.jyjcjg = "";
this.sjdw = "";
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.statistics.api.dto;
import lombok.Data;
@Data
public class SkjsCountItemDto {
/**
* 区域
*/
private String regionCode;
/**
* 台套
*/
private String oneSet;
/**
* 气瓶
*/
private String cylinder;
/**
* 管道长度(千米)
*/
private String pipeline;
/**
* 企业
*/
private String company;
/**
* 人员
*/
private String user;
public void setDefaultValues() {
this.oneSet = "0";
this.cylinder = "0";
this.pipeline = "0";
this.company = "0";
this.user = "0";
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.statistics.api.dto;
import lombok.Data;
/**
* 详情-设备上线情况属性
*/
@Data
public class SkjsEquipCountItemDto {
/**
* 区域-code
*/
private String regionCode;
/**
* 区域-name
*/
private String regionName;
/**
* 电梯
*/
private String dt;
/**
* 起重机械
*/
private String qzjx;
/**
* 客运索道
*/
private String kysd;
/**
* 大型游乐设施
*/
private String dxylss;
/**
* 厂车
*/
private String cc;
/**
* 锅炉
*/
private String gl;
/**
* 压力容器
*/
private String ylrq;
/**
* 压力管道
*/
private String ylgd;
/**
* 气瓶
*/
private String qp;
public void setDefaultValues() {
this.dt = "";
this.qzjx = "";
this.kysd = "";
this.dxylss = "";
this.cc = "";
this.gl = "";
this.ylrq = "";
this.ylgd = "";
this.qp = "";
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.statistics.api.dto;
import lombok.Data;
/**
* 详情-人员上线情况属性
*/
@Data
public class SkjsUserCountItemDto {
/**
* 区域-code
*/
private String regionCode;
/**
* 区域-name
*/
private String regionName;
/**
* 作业人员
*/
private String zyry;
/**
* 检验人员
*/
private String jyry;
/**
* 检测人员
*/
private String jcry;
/**
* 生产-主要负责人
*/
private String sczyfzr;
/**
* 生产-质量安全总监
*/
private String sczlaqzj;
/**
* 生产-质量安全员
*/
private String sczlaqy;
/**
* 使用-主要负责人
*/
private String syzyfzr;
/**
* 使用-安全总监
*/
private String syaqzj;
/**
* 使用-安全员
*/
private String syaqy;
public void setDefaultValues() {
this.zyry = "0";
this.jyry = "0";
this.jcry = "0";
this.sczyfzr = "0";
this.sczlaqzj = "0";
this.sczlaqy = "0";
this.syzyfzr = "0";
this.syaqzj = "0";
this.syaqy = "0";
}
}
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.statistics.api.mapper; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.statistics.api.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto; import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -44,4 +45,7 @@ public interface ZLStatisticsMapper { ...@@ -44,4 +45,7 @@ public interface ZLStatisticsMapper {
Integer count(); Integer count();
IPage<IdxBizJgOtherInfo> getEquipInfoPage(IPage<IdxBizJgOtherInfo> idxBizJgOtherInfoPage); IPage<IdxBizJgOtherInfo> getEquipInfoPage(IPage<IdxBizJgOtherInfo> idxBizJgOtherInfoPage);
List<CountDto> countUserByPostAndAreaCode(@Param("orgCode") String orgCode, @Param("regionCode") String regionCode);
} }
...@@ -160,6 +160,19 @@ ...@@ -160,6 +160,19 @@
<select id="getEquipInfoPage" resultType="com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo"> <select id="getEquipInfoPage" resultType="com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo">
select * from idx_biz_jg_other_info where INFORMATION_SITUATION NOTNULL select * from idx_biz_jg_other_info where INFORMATION_SITUATION NOTNULL
</select> </select>
<select id="countUserByPostAndAreaCode" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
count(1) as intValue,
concat_ws('|', bi.unit_type, tui.new_post) as keyStr
FROM
tzs_user_info tui,
tz_base_enterprise_info bi
WHERE
tui.unit_code = bi.use_code
and ((bi.supervise_org_code != '50' and bi.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (bi.supervise_org_code = '50' and bi.office_region LIKE CONCAT ('%', #{regionCode}, '%')))
and tui.is_delete=false
group by keyStr
</select>
</mapper> </mapper>
...@@ -608,4 +608,28 @@ public class JGDPStatisticsController { ...@@ -608,4 +608,28 @@ public class JGDPStatisticsController {
return ResponseHelper.buildResponse(statisticsService.getJgBusinessAllType(treeValue)); return ResponseHelper.buildResponse(statisticsService.getJgBusinessAllType(treeValue));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏总览-右侧-三库建设情况统计", notes = "大屏总览-右侧-三库建设情况统计")
@PostMapping(value = "/zl/skjs")
public ResponseModel<Map<String, Object>> queryBarChartDataForSkjs(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.queryBarChartDataForSkjs(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏总览-三库建设情况-详情", notes = "大屏总览-三库建设情况-详情")
@PostMapping(value = "/skjs/detail")
public ResponseModel<Map<String, Object>> querySkjsDetail(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.querySkjsDetail(dpFilterParamDto));
}
} }
...@@ -37,6 +37,14 @@ public class StCommonController extends BaseController { ...@@ -37,6 +37,14 @@ public class StCommonController extends BaseController {
return ResponseHelper.buildResponse(regionList); return ResponseHelper.buildResponse(regionList);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/3level/region-tree")
@ApiOperation(httpMethod = "GET", value = "获取用户regionCode", notes = "获取用户regionCode")
public ResponseModel<List<RegionModel>> getReginTree(@RequestParam(value = "regionCode") Integer regionCode) {
List<RegionModel> regionList = commonService.getRegionTree3Level(regionCode);
return ResponseHelper.buildResponse(regionList);
}
/** /**
* 获取设备类型 * 获取设备类型
* @return Map * @return Map
......
...@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service; ...@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.validation.constraints.NotBlank;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
...@@ -894,13 +895,13 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -894,13 +895,13 @@ public class AQZSDPStatisticsServiceImpl {
return new HashMap<>(); return new HashMap<>();
} }
// 1.气瓶数量统计 // 1.气瓶数量统计
long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,true); long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,true, true);
//1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 //1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true,true);
//2.压力管道长度统计 //2.压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true); stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true);
//3.单位数量统计 //3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, orgCode); this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode());
//4.人员数量统计 //4.人员数量统计
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode); this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
//5.问题数统计 //5.问题数统计
...@@ -923,12 +924,12 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -923,12 +924,12 @@ public class AQZSDPStatisticsServiceImpl {
} }
private void staticsCenterMapCountDataForCompany(Map<String, Object> result, String orgCode) { private void staticsCenterMapCountDataForCompany(Map<String, Object> result, String orgCode, String cityCode) {
if (orgCode == null) { if (orgCode == null) {
setDefaultCompanyCountData(result); setDefaultCompanyCountData(result);
return; return;
} }
List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode); List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, cityCode);
result.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE)).mapToInt(CountDto::getIntValue).sum()); result.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE)).mapToInt(CountDto::getIntValue).sum());
result.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)).mapToInt(CountDto::getIntValue).sum()); result.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)).mapToInt(CountDto::getIntValue).sum());
result.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE)).mapToInt(CountDto::getIntValue).sum()); result.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE)).mapToInt(CountDto::getIntValue).sum());
...@@ -989,13 +990,13 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -989,13 +990,13 @@ public class AQZSDPStatisticsServiceImpl {
return new HashMap<>(); return new HashMap<>();
} }
// 0. 气瓶数量统计 // 0. 气瓶数量统计
long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,true); long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,true, true);
// 1. 8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 // 1. 8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true,true);
// 2. 压力管道长度统计 // 2. 压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true); stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true);
// 3.单位数量统计 // 3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, orgCode); this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode());
// 4. 人员数量统计 // 4. 人员数量统计
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode); this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
// 5.问题统计 // 5.问题统计
......
...@@ -22,9 +22,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto; ...@@ -22,9 +22,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue; import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.LegendDataDto; import com.yeejoin.amos.boot.module.common.api.dto.LegendDataDto;
import com.yeejoin.amos.boot.module.common.api.enums.BusinessTypeEnum; import com.yeejoin.amos.boot.module.common.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.IssueMainBodyEnum; import com.yeejoin.amos.boot.module.common.api.enums.*;
import com.yeejoin.amos.boot.module.common.api.enums.JgBusinessTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.NoticBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipBizCountDto; import com.yeejoin.amos.boot.module.jg.api.dto.EquipBizCountDto;
import com.yeejoin.amos.boot.module.jg.api.dto.FourColorCountDataDto; import com.yeejoin.amos.boot.module.jg.api.dto.FourColorCountDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationManageDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationManageDto;
...@@ -35,6 +33,10 @@ import com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing; ...@@ -35,6 +33,10 @@ import com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing;
import com.yeejoin.amos.boot.module.jg.api.enums.*; import com.yeejoin.amos.boot.module.jg.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.*; import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils; import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.statistics.api.dto.SkjsCompanyCountItemDto;
import com.yeejoin.amos.boot.module.statistics.api.dto.SkjsCountItemDto;
import com.yeejoin.amos.boot.module.statistics.api.dto.SkjsEquipCountItemDto;
import com.yeejoin.amos.boot.module.statistics.api.dto.SkjsUserCountItemDto;
import com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderBusinessStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderBusinessStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.JGStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.JGStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper;
...@@ -129,6 +131,18 @@ public class JGDPStatisticsServiceImpl { ...@@ -129,6 +131,18 @@ public class JGDPStatisticsServiceImpl {
private final static String COMPANY_TYPE_FILLING = "充装单位"; private final static String COMPANY_TYPE_FILLING = "充装单位";
/** /**
* 单位类型-充装单位
*/
private final static String COMPANY_TYPE_DESIGN = "设计单位";
/**
* 检验检测机构-检验检测机构
*/
private final static String COMPANY_TYPE_JYJC = "检验检测机构";
/**
* 监管-中屏-地图行政区划code * 监管-中屏-地图行政区划code
*/ */
private final static String REGION_CODE = "regionCode"; private final static String REGION_CODE = "regionCode";
...@@ -411,13 +425,13 @@ public class JGDPStatisticsServiceImpl { ...@@ -411,13 +425,13 @@ public class JGDPStatisticsServiceImpl {
return setDefaultCount(result); return setDefaultCount(result);
} }
// 1.气瓶数量统计 // 1.气瓶数量统计
long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,true); long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode, true, true);
//1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 //1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode, true, true);
//2.压力管道长度统计 //2.压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true); stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true);
//3.单位数量统计 //3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, orgCode); this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode());
//4.人员数量统计 //4.人员数量统计
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode); this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
return result; return result;
...@@ -430,11 +444,11 @@ public class JGDPStatisticsServiceImpl { ...@@ -430,11 +444,11 @@ public class JGDPStatisticsServiceImpl {
return setDefaultCount(result); return setDefaultCount(result);
} }
// 1.气瓶数量统计 // 1.气瓶数量统计
long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,false); long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode, false, true);
//1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 //1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,false); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode, false, true);
//2.压力管道长度统计 //2.压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,false); stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, false);
return result; return result;
} }
...@@ -445,17 +459,17 @@ public class JGDPStatisticsServiceImpl { ...@@ -445,17 +459,17 @@ public class JGDPStatisticsServiceImpl {
return setDefaultCount(result); return setDefaultCount(result);
} }
// 0. 气瓶数量统计 // 0. 气瓶数量统计
long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,true); long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode, true, true);
// 1. 8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 // 1. 8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode, true, true);
// 2. 压力管道长度统计 // 2. 压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true); stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true);
// 3. 人员数量统计 // 3. 人员数量统计
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode); this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
return result; return result;
} }
private Map<String,Object> setDefaultCount(Map<String,Object> result){ private Map<String, Object> setDefaultCount(Map<String, Object> result) {
result.put(DPMapStatisticsItemEnum.LIFTING_MACHINERY.getCode(), 0); result.put(DPMapStatisticsItemEnum.LIFTING_MACHINERY.getCode(), 0);
result.put(DPMapStatisticsItemEnum.PRESSURE_VESSELS.getCode(), 0); result.put(DPMapStatisticsItemEnum.PRESSURE_VESSELS.getCode(), 0);
result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), 0); result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), 0);
...@@ -482,16 +496,33 @@ public class JGDPStatisticsServiceImpl { ...@@ -482,16 +496,33 @@ public class JGDPStatisticsServiceImpl {
result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), num); result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), num);
} }
private void staticsCenterMapCountDataForCompany(Map<String, Object> result, String orgCode) { private void staticsCenterMapCountDataForCompany(Map<String, Object> result, String orgCode, String cityCode) {
if (orgCode == null) { if (orgCode == null) {
setDefaultCompanyCountData(result); setDefaultCompanyCountData(result);
return; return;
} }
List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode); List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, cityCode);
result.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) || c.getKeyStr().contains(COMPANY_TYPE_PERSON)).mapToInt(CountDto::getIntValue).sum()); result.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) || c.getKeyStr().contains(COMPANY_TYPE_PERSON)).mapToInt(CountDto::getIntValue).sum());
result.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)).mapToInt(CountDto::getIntValue).sum()); result.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)).mapToInt(CountDto::getIntValue).sum());
result.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE)).mapToInt(CountDto::getIntValue).sum()); result.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE)).mapToInt(CountDto::getIntValue).sum());
result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum()); result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum());
result.put(DPMapStatisticsItemEnum.DESIGN_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_DESIGN)).mapToInt(CountDto::getIntValue).sum());
}
private void staticsCompanyForSkjs(SkjsCountItemDto countItemDto, String orgCode, String cityCode) {
List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, cityCode);
int u1 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) || c.getKeyStr().contains(COMPANY_TYPE_PERSON)).mapToInt(CountDto::getIntValue).sum();
int u2 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)).mapToInt(CountDto::getIntValue).sum();
int u3 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE)).mapToInt(CountDto::getIntValue).sum();
int u4 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum();
int u5 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_DESIGN)).mapToInt(CountDto::getIntValue).sum();
int u6 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_JYJC)).mapToInt(CountDto::getIntValue).sum();
countItemDto.setCompany(String.valueOf(u1 + u2 + u3 + u4 + u5 + u6));
}
private void staticsUserForSkjs(SkjsCountItemDto countItemDto, DPFilterParamDto dpFilterParamDto, String orgCode) {
Long num = userInfoMapper.countUserByPostAndAreaCode(orgCode, null, dpFilterParamDto.getCityCode());
countItemDto.setUser(String.valueOf(num));
} }
...@@ -515,24 +546,24 @@ public class JGDPStatisticsServiceImpl { ...@@ -515,24 +546,24 @@ public class JGDPStatisticsServiceImpl {
List<Object> scrappedDeviceList = new ArrayList(); List<Object> scrappedDeviceList = new ArrayList();
DateTimeFormatter sdf = DateTimeFormatter.ofPattern("yyyy-MM"); DateTimeFormatter sdf = DateTimeFormatter.ofPattern("yyyy-MM");
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode()); String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
List<Map<String,Object>> useRegisterCountList = businessStatisticsMapper.getUseRegisterCount(orgCode); List<Map<String, Object>> useRegisterCountList = businessStatisticsMapper.getUseRegisterCount(orgCode);
List<Map<String,Object>> scrappedDeviceCountList = scrapCancelMapper.getScrappedDeviceCount(dpFilterParamDto); List<Map<String, Object>> scrappedDeviceCountList = scrapCancelMapper.getScrappedDeviceCount(dpFilterParamDto);
Map<String,Object> useRegisterCount = new HashMap<>(); Map<String, Object> useRegisterCount = new HashMap<>();
Map<String,Object> scrappedDeviceCount = new HashMap<>(); Map<String, Object> scrappedDeviceCount = new HashMap<>();
if(CollectionUtils.isNotEmpty(useRegisterCountList)) { if (CollectionUtils.isNotEmpty(useRegisterCountList)) {
useRegisterCountList.forEach(item -> { useRegisterCountList.forEach(item -> {
useRegisterCount.put(item.get("time") + "", item.get("num")); useRegisterCount.put(item.get("time") + "", item.get("num"));
}); });
} }
if(CollectionUtils.isNotEmpty(scrappedDeviceCountList)) { if (CollectionUtils.isNotEmpty(scrappedDeviceCountList)) {
scrappedDeviceCountList.forEach(item -> { scrappedDeviceCountList.forEach(item -> {
scrappedDeviceCount.put(item.get("time") + "", item.get("num")); scrappedDeviceCount.put(item.get("time") + "", item.get("num"));
}); });
} }
for (int i = 2; i >= 0; i--) { for (int i = 2; i >= 0; i--) {
xDataList.add(today.minusMonths(i).format(sdf)); xDataList.add(today.minusMonths(i).format(sdf));
newDeviceList.add(null == useRegisterCount.get(today.minusMonths(i).format(sdf)) ? 0 : Integer.valueOf(useRegisterCount.get(today.minusMonths(i).format(sdf))+"")); newDeviceList.add(null == useRegisterCount.get(today.minusMonths(i).format(sdf)) ? 0 : Integer.valueOf(useRegisterCount.get(today.minusMonths(i).format(sdf)) + ""));
scrappedDeviceList.add(null == scrappedDeviceCount.get(today.minusMonths(i).format(sdf)) ? 0 : Integer.valueOf(scrappedDeviceCount.get(today.minusMonths(i).format(sdf))+"")); scrappedDeviceList.add(null == scrappedDeviceCount.get(today.minusMonths(i).format(sdf)) ? 0 : Integer.valueOf(scrappedDeviceCount.get(today.minusMonths(i).format(sdf)) + ""));
} }
result.put("xdata", xDataList); result.put("xdata", xDataList);
result.put("newDevice", newDeviceList); result.put("newDevice", newDeviceList);
...@@ -576,6 +607,8 @@ public class JGDPStatisticsServiceImpl { ...@@ -576,6 +607,8 @@ public class JGDPStatisticsServiceImpl {
m.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), 0); m.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), 0);
m.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), 0); m.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), 0);
m.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), 0); m.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), 0);
m.put(DPMapStatisticsItemEnum.DESIGN_UNITS.getCode(), 0);
} }
...@@ -637,10 +670,10 @@ public class JGDPStatisticsServiceImpl { ...@@ -637,10 +670,10 @@ public class JGDPStatisticsServiceImpl {
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")); boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
//已赋码 //已赋码
boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE")); boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE","null")); boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", "null"));
//状态为已认领 //状态为已认领
String[] status = {"草稿","已拒领","待认领"}; String[] status = {"草稿", "已拒领", "待认领"};
boolMust.mustNot(QueryBuilders.termsQuery("STATUS",Arrays.asList(status))); boolMust.mustNot(QueryBuilders.termsQuery("STATUS", Arrays.asList(status)));
// 设备状态过滤 // 设备状态过滤
boolMust.must(QueryBuilders.termsQuery("EQU_STATE", Arrays.asList(states))); boolMust.must(QueryBuilders.termsQuery("EQU_STATE", Arrays.asList(states)));
// 且8大类,目的去掉脏数据 // 且8大类,目的去掉脏数据
...@@ -668,7 +701,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -668,7 +701,7 @@ public class JGDPStatisticsServiceImpl {
List<String> typeList = new ArrayList<>(); List<String> typeList = new ArrayList<>();
typeList.add("维保超期"); typeList.add("维保超期");
typeList.add("检验超期"); typeList.add("检验超期");
num = safetyProblemTracingMapper.countByTypeListAndOrgCode(typeList,orgCode, IssueMainBodyEnum.EQUIPMENT.getCode()); num = safetyProblemTracingMapper.countByTypeListAndOrgCode(typeList, orgCode, IssueMainBodyEnum.EQUIPMENT.getCode());
return num; return num;
} }
...@@ -706,10 +739,10 @@ public class JGDPStatisticsServiceImpl { ...@@ -706,10 +739,10 @@ public class JGDPStatisticsServiceImpl {
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")); boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
//已赋码 //已赋码
boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE")); boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE","null")); boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", "null"));
//状态为已认领 //状态为已认领
String[] status = {"草稿","已拒领","待认领"}; String[] status = {"草稿", "已拒领", "待认领"};
boolMust.mustNot(QueryBuilders.termsQuery("STATUS",Arrays.asList(status))); boolMust.mustNot(QueryBuilders.termsQuery("STATUS", Arrays.asList(status)));
// 且下次检验日期大于等于当天 // 且下次检验日期大于等于当天
long currentDayTime = DateUtil.parse(DateUtil.today(), "yyy-MM-dd").getTime(); long currentDayTime = DateUtil.parse(DateUtil.today(), "yyy-MM-dd").getTime();
// 且查询 下次检验日期 <= 当前天+30天 极为临期 // 且查询 下次检验日期 <= 当前天+30天 极为临期
...@@ -747,10 +780,10 @@ public class JGDPStatisticsServiceImpl { ...@@ -747,10 +780,10 @@ public class JGDPStatisticsServiceImpl {
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")); boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
//已赋码 //已赋码
boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE")); boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE","null")); boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", "null"));
//状态为已认领 //状态为已认领
String[] status = {"草稿","已拒领","待认领"}; String[] status = {"草稿", "已拒领", "待认领"};
boolMust.mustNot(QueryBuilders.termsQuery("STATUS",Arrays.asList(status))); boolMust.mustNot(QueryBuilders.termsQuery("STATUS", Arrays.asList(status)));
// 查询下次检验日期小于当前天的设备,即为超期检验超期设备 // 查询下次检验日期小于当前天的设备,即为超期检验超期设备
long currentDayTime = DateUtil.parse(DateUtil.now(), "yyy-MM-dd").getTime(); long currentDayTime = DateUtil.parse(DateUtil.now(), "yyy-MM-dd").getTime();
boolMust.must(QueryBuilders.rangeQuery("NEXT_INSPECT_DATE").lt(currentDayTime)); boolMust.must(QueryBuilders.rangeQuery("NEXT_INSPECT_DATE").lt(currentDayTime));
...@@ -802,7 +835,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -802,7 +835,7 @@ public class JGDPStatisticsServiceImpl {
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode()); String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
List<String> typeList = new ArrayList<>(); List<String> typeList = new ArrayList<>();
typeList.add("许可超期"); typeList.add("许可超期");
num = safetyProblemTracingMapper.countByTypeListAndOrgCode(typeList,orgCode, IssueMainBodyEnum.COMPANY.getCode()); num = safetyProblemTracingMapper.countByTypeListAndOrgCode(typeList, orgCode, IssueMainBodyEnum.COMPANY.getCode());
return num; return num;
} }
...@@ -835,7 +868,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -835,7 +868,7 @@ public class JGDPStatisticsServiceImpl {
private CountDto getGreenStatusCompany(DPFilterParamDto dpFilterParamDto) { private CountDto getGreenStatusCompany(DPFilterParamDto dpFilterParamDto) {
CountDto countDto = new CountDto(); CountDto countDto = new CountDto();
countDto.setLongValue(this.countCompanyByOperatingStatus(dpFilterParamDto, "在业","开业", "迁入")); countDto.setLongValue(this.countCompanyByOperatingStatus(dpFilterParamDto, "在业", "开业", "迁入"));
countDto.setLabel("正常在业、开业、迁入"); countDto.setLabel("正常在业、开业、迁入");
return countDto; return countDto;
} }
...@@ -845,7 +878,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -845,7 +878,7 @@ public class JGDPStatisticsServiceImpl {
if (orgCode == null) { if (orgCode == null) {
return 0L; return 0L;
} }
return enterpriseInfoMapper.countByOperatingStatusAndOrgCode(orgCode,Arrays.stream(operatingStatus).collect(Collectors.toList()), dpFilterParamDto.getCityCode()); return enterpriseInfoMapper.countByOperatingStatusAndOrgCode(orgCode, Arrays.stream(operatingStatus).collect(Collectors.toList()), dpFilterParamDto.getCityCode());
} }
private Map<String, CountDto> countUserNum(DPFilterParamDto dpFilterParamDto) { private Map<String, CountDto> countUserNum(DPFilterParamDto dpFilterParamDto) {
...@@ -871,7 +904,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -871,7 +904,7 @@ public class JGDPStatisticsServiceImpl {
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode()); String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
List<String> typeList = new ArrayList<>(); List<String> typeList = new ArrayList<>();
typeList.add("资质超期"); typeList.add("资质超期");
num = safetyProblemTracingMapper.countByTypeListAndOrgCode(typeList,orgCode, IssueMainBodyEnum.PERSON.getCode()); num = safetyProblemTracingMapper.countByTypeListAndOrgCode(typeList, orgCode, IssueMainBodyEnum.PERSON.getCode());
countDto.setLongValue(num); countDto.setLongValue(num);
return countDto; return countDto;
} }
...@@ -903,7 +936,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -903,7 +936,7 @@ public class JGDPStatisticsServiceImpl {
for (int i = 0; i < everyInFlow.size(); i++) { for (int i = 0; i < everyInFlow.size(); i++) {
Long flowIng = everyInFlow.get(i); Long flowIng = everyInFlow.get(i);
Long finished = everyFinished.get(i); Long finished = everyFinished.get(i);
allArray.add(flowIng+finished); allArray.add(flowIng + finished);
} }
return allArray; return allArray;
} }
...@@ -981,10 +1014,10 @@ public class JGDPStatisticsServiceImpl { ...@@ -981,10 +1014,10 @@ public class JGDPStatisticsServiceImpl {
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")); boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
//已赋码 //已赋码
boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE")); boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE","null")); boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", "null"));
//状态为已认领 //状态为已认领
String[] status = {"草稿","已拒领","待认领"}; String[] status = {"草稿", "已拒领", "待认领"};
boolMust.mustNot(QueryBuilders.termsQuery("STATUS",Arrays.asList(status))); boolMust.mustNot(QueryBuilders.termsQuery("STATUS", Arrays.asList(status)));
// 且8大类,目的去掉脏数据 // 且8大类,目的去掉脏数据
boolMust.must(QueryBuilders.termsQuery("EQU_LIST_CODE", StCommonServiceImpl.getEquipmentCategory().stream().map(EquipmentCategoryDto::getCode).collect(Collectors.toList()))); boolMust.must(QueryBuilders.termsQuery("EQU_LIST_CODE", StCommonServiceImpl.getEquipmentCategory().stream().map(EquipmentCategoryDto::getCode).collect(Collectors.toList())));
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
...@@ -1029,35 +1062,35 @@ public class JGDPStatisticsServiceImpl { ...@@ -1029,35 +1062,35 @@ public class JGDPStatisticsServiceImpl {
//停用 //停用
List<Map> stopList = useRegistrationMapper.stopStateCount(orgCode); List<Map> stopList = useRegistrationMapper.stopStateCount(orgCode);
//注销 //注销
List<Map> cancelList = useRegistrationMapper.cancelStateCount(orgCode,1); List<Map> cancelList = useRegistrationMapper.cancelStateCount(orgCode, 1);
//报废 //报废
List<Map> scrapList = useRegistrationMapper.cancelStateCount(orgCode,2); List<Map> scrapList = useRegistrationMapper.cancelStateCount(orgCode, 2);
Map<String, Long> stopMap = new HashMap<>(); Map<String, Long> stopMap = new HashMap<>();
Map<String, Long> cancelMap = new HashMap<>(); Map<String, Long> cancelMap = new HashMap<>();
Map<String, Long> scrapMap = new HashMap<>(); Map<String, Long> scrapMap = new HashMap<>();
for(int i = 0; i < stopList.size(); i++){ for (int i = 0; i < stopList.size(); i++) {
if("2000".equals(stopList.get(i).get("equList")) && "2300".equals(stopList.get(i).get("equCategory"))){ if ("2000".equals(stopList.get(i).get("equList")) && "2300".equals(stopList.get(i).get("equCategory"))) {
stopMap.put(stopList.get(i).get("equCategory")+"",stopMap.getOrDefault("equCategory",0L)+(Long) stopList.get(i).get("count")); stopMap.put(stopList.get(i).get("equCategory") + "", stopMap.getOrDefault("equCategory", 0L) + (Long) stopList.get(i).get("count"));
}else { } else {
stopMap.put(stopList.get(i).get("equList")+"",stopMap.getOrDefault("equList",0L)+(Long) stopList.get(i).get("count")); stopMap.put(stopList.get(i).get("equList") + "", stopMap.getOrDefault("equList", 0L) + (Long) stopList.get(i).get("count"));
} }
} }
for(int i = 0; i < cancelList.size(); i++){ for (int i = 0; i < cancelList.size(); i++) {
if("2000".equals(cancelList.get(i).get("equList")) && "2300".equals(cancelList.get(i).get("equCategory"))){ if ("2000".equals(cancelList.get(i).get("equList")) && "2300".equals(cancelList.get(i).get("equCategory"))) {
cancelMap.put(cancelList.get(i).get("equCategory")+"",cancelMap.getOrDefault("equCategory",0L)+(Long) cancelList.get(i).get("count")); cancelMap.put(cancelList.get(i).get("equCategory") + "", cancelMap.getOrDefault("equCategory", 0L) + (Long) cancelList.get(i).get("count"));
}else { } else {
cancelMap.put(cancelList.get(i).get("equList")+"",cancelMap.getOrDefault("equCategory",0L)+(Long) cancelList.get(i).get("count")); cancelMap.put(cancelList.get(i).get("equList") + "", cancelMap.getOrDefault("equCategory", 0L) + (Long) cancelList.get(i).get("count"));
} }
} }
for(int i = 0; i < scrapList.size(); i++){ for (int i = 0; i < scrapList.size(); i++) {
if("2000".equals(scrapList.get(i).get("equList")) && "2300".equals(scrapList.get(i).get("equCategory"))){ if ("2000".equals(scrapList.get(i).get("equList")) && "2300".equals(scrapList.get(i).get("equCategory"))) {
scrapMap.put(scrapList.get(i).get("equCategory")+"",scrapMap.getOrDefault("equCategory",0L)+(Long) scrapList.get(i).get("count")); scrapMap.put(scrapList.get(i).get("equCategory") + "", scrapMap.getOrDefault("equCategory", 0L) + (Long) scrapList.get(i).get("count"));
}else { } else {
scrapMap.put(scrapList.get(i).get("equList")+"",scrapMap.getOrDefault("equCategory",0L)+(Long) scrapList.get(i).get("count")); scrapMap.put(scrapList.get(i).get("equList") + "", scrapMap.getOrDefault("equCategory", 0L) + (Long) scrapList.get(i).get("count"));
} }
} }
...@@ -1175,9 +1208,9 @@ public class JGDPStatisticsServiceImpl { ...@@ -1175,9 +1208,9 @@ public class JGDPStatisticsServiceImpl {
regionModels.forEach(r -> { regionModels.forEach(r -> {
xData.add(r.getRegionName()); xData.add(r.getRegionName());
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString()); String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
if(!ValidationUtil.isEmpty(orgCode)) { if (!ValidationUtil.isEmpty(orgCode)) {
yData.add(this.avgAndSumDealDate(countDtos.stream().filter(c -> c.getKeyStr().contains(orgCode)).collect(Collectors.toList()))); yData.add(this.avgAndSumDealDate(countDtos.stream().filter(c -> c.getKeyStr().contains(orgCode)).collect(Collectors.toList())));
}else{ } else {
yData.add("0"); yData.add("0");
} }
}); });
...@@ -1189,7 +1222,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -1189,7 +1222,7 @@ public class JGDPStatisticsServiceImpl {
private String avgAndSumDealDate(List<CountDto> collect) { private String avgAndSumDealDate(List<CountDto> collect) {
BigDecimal sum = collect.stream().map(c -> new BigDecimal(c.getStrValue())).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal sum = collect.stream().map(c -> new BigDecimal(c.getStrValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
if(collect.isEmpty()){ if (collect.isEmpty()) {
return "0"; return "0";
} }
return sum.divide(BigDecimal.valueOf(collect.size()), 1, RoundingMode.HALF_UP).toPlainString(); return sum.divide(BigDecimal.valueOf(collect.size()), 1, RoundingMode.HALF_UP).toPlainString();
...@@ -1535,10 +1568,10 @@ public class JGDPStatisticsServiceImpl { ...@@ -1535,10 +1568,10 @@ public class JGDPStatisticsServiceImpl {
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")); boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
//已赋码 //已赋码
boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE")); boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE","null")); boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", "null"));
//状态为已认领 //状态为已认领
String[] status = {"草稿","已拒领","待认领"}; String[] status = {"草稿", "已拒领", "待认领"};
boolMust.mustNot(QueryBuilders.termsQuery("STATUS",Arrays.asList(status))); boolMust.mustNot(QueryBuilders.termsQuery("STATUS", Arrays.asList(status)));
// 且8大类,目的去掉脏数据 // 且8大类,目的去掉脏数据
boolMust.must(QueryBuilders.termsQuery("EQU_LIST_CODE", StCommonServiceImpl.getEquipmentCategory().stream().map(EquipmentCategoryDto::getCode).collect(Collectors.toList()))); boolMust.must(QueryBuilders.termsQuery("EQU_LIST_CODE", StCommonServiceImpl.getEquipmentCategory().stream().map(EquipmentCategoryDto::getCode).collect(Collectors.toList())));
request.query(boolMust); request.query(boolMust);
...@@ -1608,7 +1641,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -1608,7 +1641,7 @@ public class JGDPStatisticsServiceImpl {
+ Integer.valueOf(vehicleCountMap.getOrDefault(LocalDate.now().minusMonths(i).format(DateTimeFormatter.ofPattern("yyyy-MM")), 0) + "")); + Integer.valueOf(vehicleCountMap.getOrDefault(LocalDate.now().minusMonths(i).format(DateTimeFormatter.ofPattern("yyyy-MM")), 0) + ""));
} }
} else if("lastYear".equals(dpFilterParamDto.getSearchType())){ } else if ("lastYear".equals(dpFilterParamDto.getSearchType())) {
List<Map<String, Object>> useCountList = jgStatisticsMapper.newRegEquCountByLastYear(dpFilterParamDto.getCityCode()); List<Map<String, Object>> useCountList = jgStatisticsMapper.newRegEquCountByLastYear(dpFilterParamDto.getCityCode());
List<Map<String, Object>> vehicleCountList = jgStatisticsMapper.newVehicleEquCountByLastYear(dpFilterParamDto.getCityCode()); List<Map<String, Object>> vehicleCountList = jgStatisticsMapper.newVehicleEquCountByLastYear(dpFilterParamDto.getCityCode());
for (int i = 0; i < useCountList.size(); i++) { for (int i = 0; i < useCountList.size(); i++) {
...@@ -1619,8 +1652,8 @@ public class JGDPStatisticsServiceImpl { ...@@ -1619,8 +1652,8 @@ public class JGDPStatisticsServiceImpl {
} }
int lastYear = LocalDate.now().getYear() - 1; int lastYear = LocalDate.now().getYear() - 1;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
for(int i=12;i>=1;i--){ for (int i = 12; i >= 1; i--) {
String time = LocalDate.of(lastYear,i,1).format(formatter); String time = LocalDate.of(lastYear, i, 1).format(formatter);
xDataList.add(time); xDataList.add(time);
newRegisterEq.add(Integer.valueOf(useCountMap.getOrDefault(time, 0) + "") newRegisterEq.add(Integer.valueOf(useCountMap.getOrDefault(time, 0) + "")
+ Integer.valueOf(vehicleCountMap.getOrDefault(time, 0) + "")); + Integer.valueOf(vehicleCountMap.getOrDefault(time, 0) + ""));
...@@ -1707,11 +1740,11 @@ public class JGDPStatisticsServiceImpl { ...@@ -1707,11 +1740,11 @@ public class JGDPStatisticsServiceImpl {
return new HashMap<>(); return new HashMap<>();
} }
// 0.气瓶数量统计 // 0.气瓶数量统计
long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,true); long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode, true, true);
// 1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 // 1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode, true, true);
// 2.压力管道长度统计 // 2.压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true); stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true);
// 3.已纳管设备总数 // 3.已纳管设备总数
this.staticsCenterMapCountDataForEquipIsManage(result); this.staticsCenterMapCountDataForEquipIsManage(result);
// 4.登记证总数 // 4.登记证总数
...@@ -1792,36 +1825,36 @@ public class JGDPStatisticsServiceImpl { ...@@ -1792,36 +1825,36 @@ public class JGDPStatisticsServiceImpl {
public Map<String, Object> noticeCountTopChart(DPFilterParamForDetailDto dpFilterParamForDetailDto) { public Map<String, Object> noticeCountTopChart(DPFilterParamForDetailDto dpFilterParamForDetailDto) {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamForDetailDto.getCityCode()); List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamForDetailDto.getCityCode());
List<Map<String,Object>> result = regionModels.parallelStream().map(r -> { List<Map<String, Object>> result = regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode()+""); String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode() + "");
DPFilterParamForDetailDto dpFilterParamForDetailDtoForSearch = new DPFilterParamForDetailDto(); DPFilterParamForDetailDto dpFilterParamForDetailDtoForSearch = new DPFilterParamForDetailDto();
dpFilterParamForDetailDtoForSearch.setOrgCode(orgCode); dpFilterParamForDetailDtoForSearch.setOrgCode(orgCode);
dpFilterParamForDetailDtoForSearch.setCityCode(r.getRegionCode()+""); dpFilterParamForDetailDtoForSearch.setCityCode(r.getRegionCode() + "");
Map<String, Object> itemResult = new HashMap<>(); Map<String, Object> itemResult = new HashMap<>();
itemResult.put("xdata",r.getRegionName()); itemResult.put("xdata", r.getRegionName());
getNoticeCountTopChart(itemResult,dpFilterParamForDetailDtoForSearch); getNoticeCountTopChart(itemResult, dpFilterParamForDetailDtoForSearch);
return itemResult; return itemResult;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
Map<String,Object> returnMap = new HashMap<>(); Map<String, Object> returnMap = new HashMap<>();
List<Map<String,Object>> legendData = new ArrayList<>(); List<Map<String, Object>> legendData = new ArrayList<>();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("dataKey","count"); map.put("dataKey", "count");
map.put("value","施工数量"); map.put("value", "施工数量");
map.put("chartType","bar"); map.put("chartType", "bar");
legendData.add(map); legendData.add(map);
returnMap.put("legendData",legendData); returnMap.put("legendData", legendData);
List xdata = new ArrayList(); List xdata = new ArrayList();
List count = new ArrayList(); List count = new ArrayList();
for(int i = 0;i<result.size();i++){ for (int i = 0; i < result.size(); i++) {
xdata.add(result.get(i).get("xdata")); xdata.add(result.get(i).get("xdata"));
count.add(result.get(i).get("count") == null ? "0" : result.get(i).get("count")); count.add(result.get(i).get("count") == null ? "0" : result.get(i).get("count"));
} }
returnMap.put("xdata",xdata); returnMap.put("xdata", xdata);
returnMap.put("count",count); returnMap.put("count", count);
return returnMap; return returnMap;
} }
...@@ -1829,12 +1862,12 @@ public class JGDPStatisticsServiceImpl { ...@@ -1829,12 +1862,12 @@ public class JGDPStatisticsServiceImpl {
public Page<Map<String, Object>> noticeCountTopPage(Page<Map<String, Object>> page, DPFilterParamForDetailDto dpFilterParamForDetailDto) { public Page<Map<String, Object>> noticeCountTopPage(Page<Map<String, Object>> page, DPFilterParamForDetailDto dpFilterParamForDetailDto) {
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamForDetailDto.getCityCode()); String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamForDetailDto.getCityCode());
dpFilterParamForDetailDto.setOrgCode(orgCode); dpFilterParamForDetailDto.setOrgCode(orgCode);
Page<Map<String, Object>> returnPage = jgStatisticsMapper.noticeCountTopPageNew(page,dpFilterParamForDetailDto); Page<Map<String, Object>> returnPage = jgStatisticsMapper.noticeCountTopPageNew(page, dpFilterParamForDetailDto);
List<String> unitCodeList = new ArrayList<>(); List<String> unitCodeList = new ArrayList<>();
for (int i = 0; i < returnPage.getRecords().size(); i++){ for (int i = 0; i < returnPage.getRecords().size(); i++) {
unitCodeList.add(returnPage.getRecords().get(i).get("useUnitCode").toString()); unitCodeList.add(returnPage.getRecords().get(i).get("useUnitCode").toString());
} }
if (CollectionUtils.isEmpty(unitCodeList)){ if (CollectionUtils.isEmpty(unitCodeList)) {
return page; return page;
} }
returnPage.setRecords(jgStatisticsMapper.noticeCountTopPageByUseUnitCode(unitCodeList, dpFilterParamForDetailDto)); returnPage.setRecords(jgStatisticsMapper.noticeCountTopPageByUseUnitCode(unitCodeList, dpFilterParamForDetailDto));
...@@ -1843,73 +1876,73 @@ public class JGDPStatisticsServiceImpl { ...@@ -1843,73 +1876,73 @@ public class JGDPStatisticsServiceImpl {
public List<Map<String, Object>> noticeCountTopType(DPFilterParamForDetailDto dpFilterParamForDetailDto) { public List<Map<String, Object>> noticeCountTopType(DPFilterParamForDetailDto dpFilterParamForDetailDto) {
List<Map<String, Object>> enumList = new ArrayList<>(); List<Map<String, Object>> enumList = new ArrayList<>();
Map<String,Object> enumMap = new HashMap<>(); Map<String, Object> enumMap = new HashMap<>();
enumMap.put("title","安装改造维修单位"); enumMap.put("title", "安装改造维修单位");
enumMap.put("value","安装改造维修单位"); enumMap.put("value", "安装改造维修单位");
enumList.add(enumMap); enumList.add(enumMap);
List<Map<String,Object>> result = new ArrayList<>(); List<Map<String, Object>> result = new ArrayList<>();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("title","业务类型"); map.put("title", "业务类型");
map.put("value","0"); map.put("value", "0");
map.put("children",enumList); map.put("children", enumList);
result.add(map); result.add(map);
return result; return result;
} }
private void getNoticeCountTopChart(Map<String, Object> itemResult, DPFilterParamForDetailDto dpFilterParamForDetailDto) { private void getNoticeCountTopChart(Map<String, Object> itemResult, DPFilterParamForDetailDto dpFilterParamForDetailDto) {
Long count = jgStatisticsMapper.getNoticeCountTopChart(dpFilterParamForDetailDto); Long count = jgStatisticsMapper.getNoticeCountTopChart(dpFilterParamForDetailDto);
itemResult.put("count",count); itemResult.put("count", count);
} }
private List<Long> countBizFinishedNumForDetail(DPFilterParamDto dpFilterParamDto,String businessType) { private List<Long> countBizFinishedNumForDetail(DPFilterParamDto dpFilterParamDto, String businessType) {
// 1.统计各业务办理量注意要和x轴顺序一致 // 1.统计各业务办理量注意要和x轴顺序一致
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode()); String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
// 省、市、区县为按照行政区划进行编码的,公司的code为行政区划编码 // 省、市、区县为按照行政区划进行编码的,公司的code为行政区划编码
if (orgCode == null) { if (orgCode == null) {
return Arrays.asList(0L, 0L, 0L, 0L, 0L, 0L); return Arrays.asList(0L, 0L, 0L, 0L, 0L, 0L);
} }
if(BusinessTypeEnum.AZGZ.getCode().equals(businessType)){ if (BusinessTypeEnum.AZGZ.getCode().equals(businessType)) {
return commonMapper.countBizFinishedNumForDPAZGZ(orgCode, dpFilterParamDto); return commonMapper.countBizFinishedNumForDPAZGZ(orgCode, dpFilterParamDto);
}else if(BusinessTypeEnum.JDJY.getCode().equals(businessType)){ } else if (BusinessTypeEnum.JDJY.getCode().equals(businessType)) {
return commonMapper.countBizFinishedNumForDPJDJY(orgCode, dpFilterParamDto); return commonMapper.countBizFinishedNumForDPJDJY(orgCode, dpFilterParamDto);
}else if(BusinessTypeEnum.SYDJ.getCode().equals(businessType)){ } else if (BusinessTypeEnum.SYDJ.getCode().equals(businessType)) {
return commonMapper.countBizFinishedNumForDPSYDJ(orgCode, dpFilterParamDto); return commonMapper.countBizFinishedNumForDPSYDJ(orgCode, dpFilterParamDto);
}else if(BusinessTypeEnum.DQJY.getCode().equals(businessType)){ } else if (BusinessTypeEnum.DQJY.getCode().equals(businessType)) {
return commonMapper.countBizFinishedNumForDPDQJY(orgCode, dpFilterParamDto); return commonMapper.countBizFinishedNumForDPDQJY(orgCode, dpFilterParamDto);
}else if(BusinessTypeEnum.BGDJ.getCode().equals(businessType)){ } else if (BusinessTypeEnum.BGDJ.getCode().equals(businessType)) {
return commonMapper.countBizFinishedNumForDPBGDJ(orgCode, dpFilterParamDto); return commonMapper.countBizFinishedNumForDPBGDJ(orgCode, dpFilterParamDto);
}else if(BusinessTypeEnum.ZXBX.getCode().equals(businessType)){ } else if (BusinessTypeEnum.ZXBX.getCode().equals(businessType)) {
return commonMapper.countBizFinishedNumForDPZXBX(orgCode, dpFilterParamDto); return commonMapper.countBizFinishedNumForDPZXBX(orgCode, dpFilterParamDto);
}else { } else {
return commonMapper.countBizFinishedNumForDP(orgCode, dpFilterParamDto); return commonMapper.countBizFinishedNumForDP(orgCode, dpFilterParamDto);
} }
} }
private List<Long> countBizDataInFlowingForDetail(DPFilterParamDto dpFilterParamDto,String businessType) { private List<Long> countBizDataInFlowingForDetail(DPFilterParamDto dpFilterParamDto, String businessType) {
// 1.统计各业务办理量注意要和x轴顺序一致 // 1.统计各业务办理量注意要和x轴顺序一致
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode()); String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
// 省、市、区县为按照行政区划进行编码的,公司的code为行政区划编码 // 省、市、区县为按照行政区划进行编码的,公司的code为行政区划编码
if (orgCode == null) { if (orgCode == null) {
return Arrays.asList(0L, 0L, 0L, 0L, 0L, 0L); return Arrays.asList(0L, 0L, 0L, 0L, 0L, 0L);
} }
if(BusinessTypeEnum.AZGZ.getCode().equals(businessType)){ if (BusinessTypeEnum.AZGZ.getCode().equals(businessType)) {
return commonMapper.countAllInFlowingForDPNoFinishedBizDataAZGZ(orgCode, dpFilterParamDto); return commonMapper.countAllInFlowingForDPNoFinishedBizDataAZGZ(orgCode, dpFilterParamDto);
}else if(BusinessTypeEnum.JDJY.getCode().equals(businessType)){ } else if (BusinessTypeEnum.JDJY.getCode().equals(businessType)) {
return commonMapper.countAllInFlowingForDPNoFinishedBizDataJDJY(orgCode, dpFilterParamDto); return commonMapper.countAllInFlowingForDPNoFinishedBizDataJDJY(orgCode, dpFilterParamDto);
}else if(BusinessTypeEnum.SYDJ.getCode().equals(businessType)){ } else if (BusinessTypeEnum.SYDJ.getCode().equals(businessType)) {
return commonMapper.countAllInFlowingForDPNoFinishedBizDataSYDJ(orgCode, dpFilterParamDto); return commonMapper.countAllInFlowingForDPNoFinishedBizDataSYDJ(orgCode, dpFilterParamDto);
}else if(BusinessTypeEnum.DQJY.getCode().equals(businessType)){ } else if (BusinessTypeEnum.DQJY.getCode().equals(businessType)) {
return commonMapper.countAllInFlowingForDPNoFinishedBizDataDQJY(orgCode, dpFilterParamDto); return commonMapper.countAllInFlowingForDPNoFinishedBizDataDQJY(orgCode, dpFilterParamDto);
}else if(BusinessTypeEnum.BGDJ.getCode().equals(businessType)){ } else if (BusinessTypeEnum.BGDJ.getCode().equals(businessType)) {
return commonMapper.countAllInFlowingForDPNoFinishedBizDataBGDJ(orgCode, dpFilterParamDto); return commonMapper.countAllInFlowingForDPNoFinishedBizDataBGDJ(orgCode, dpFilterParamDto);
}else if(BusinessTypeEnum.ZXBX.getCode().equals(businessType)){ } else if (BusinessTypeEnum.ZXBX.getCode().equals(businessType)) {
return commonMapper.countAllInFlowingForDPNoFinishedBizDataZXBX(orgCode, dpFilterParamDto); return commonMapper.countAllInFlowingForDPNoFinishedBizDataZXBX(orgCode, dpFilterParamDto);
}else { } else {
return commonMapper.countAllInFlowingForDPNoFinishedBizData(orgCode, dpFilterParamDto); return commonMapper.countAllInFlowingForDPNoFinishedBizData(orgCode, dpFilterParamDto);
} }
} }
public Map<String,Object> queryBizCycleDataDetail(DPFilterParamForDetailDto dpFilterParamForDetailDto) { public Map<String, Object> queryBizCycleDataDetail(DPFilterParamForDetailDto dpFilterParamForDetailDto) {
//查询子区域 //查询子区域
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamForDetailDto.getCityCode()); List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamForDetailDto.getCityCode());
...@@ -1937,47 +1970,47 @@ public class JGDPStatisticsServiceImpl { ...@@ -1937,47 +1970,47 @@ public class JGDPStatisticsServiceImpl {
return itemResult; return itemResult;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
Map<String,Object> returnMap = new HashMap<>(); Map<String, Object> returnMap = new HashMap<>();
List<Map<String,Object>> legendData = new ArrayList<>(); List<Map<String, Object>> legendData = new ArrayList<>();
for(int i = 0;i<2; i++){ for (int i = 0; i < 2; i++) {
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if(i == 0){ if (i == 0) {
map.put("dataKey","finishedNum"); map.put("dataKey", "finishedNum");
map.put("value","总数"); map.put("value", "总数");
map.put("chartType","bar"); map.put("chartType", "bar");
}else{ } else {
map.put("dataKey","percentData"); map.put("dataKey", "percentData");
map.put("value","完结率"); map.put("value", "完结率");
map.put("chartType","line"); map.put("chartType", "line");
} }
legendData.add(map); legendData.add(map);
} }
returnMap.put("legendData",legendData); returnMap.put("legendData", legendData);
List xdata = new ArrayList(); List xdata = new ArrayList();
List finishedNum = new ArrayList(); List finishedNum = new ArrayList();
List percentData = new ArrayList(); List percentData = new ArrayList();
for(int i = 0;i<result.size();i++){ for (int i = 0; i < result.size(); i++) {
xdata.add(result.get(i).get("xdata")); xdata.add(result.get(i).get("xdata"));
finishedNum.add(result.get(i).get("finishedNum")); finishedNum.add(result.get(i).get("finishedNum"));
percentData.add(result.get(i).get("percentData")); percentData.add(result.get(i).get("percentData"));
} }
returnMap.put("xdata",xdata); returnMap.put("xdata", xdata);
returnMap.put("finishedNum",finishedNum); returnMap.put("finishedNum", finishedNum);
returnMap.put("percentData",percentData); returnMap.put("percentData", percentData);
return returnMap; return returnMap;
} }
public List<Map<String,Object>> getBusinessType(DPFilterParamForDetailDto dpFilterParamDto) { public List<Map<String, Object>> getBusinessType(DPFilterParamForDetailDto dpFilterParamDto) {
List<HashMap<String, Object>> enumList = BusinessTypeEnum.getEnumList(); List<HashMap<String, Object>> enumList = BusinessTypeEnum.getEnumList();
List<Map<String,Object>> result = new ArrayList<>(); List<Map<String, Object>> result = new ArrayList<>();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("title","业务类型"); map.put("title", "业务类型");
map.put("value","0"); map.put("value", "0");
map.put("children",enumList); map.put("children", enumList);
result.add(map); result.add(map);
return result; return result;
} }
...@@ -1993,31 +2026,31 @@ public class JGDPStatisticsServiceImpl { ...@@ -1993,31 +2026,31 @@ public class JGDPStatisticsServiceImpl {
filterParamDto.setBeginDate(dpFilterParamForDetailDto.getTimeSearchOne().getBeginDate()); filterParamDto.setBeginDate(dpFilterParamForDetailDto.getTimeSearchOne().getBeginDate());
filterParamDto.setEndDate(dpFilterParamForDetailDto.getTimeSearchOne().getEndDate()); filterParamDto.setEndDate(dpFilterParamForDetailDto.getTimeSearchOne().getEndDate());
} }
if(BusinessTypeEnum.AZGZ.getCode().equals(dpFilterParamForDetailDto.getTreeValue())){ if (BusinessTypeEnum.AZGZ.getCode().equals(dpFilterParamForDetailDto.getTreeValue())) {
maps = commonMapper.countBizFinishedNumForDPListAZGZ(page, orgCode, filterParamDto); maps = commonMapper.countBizFinishedNumForDPListAZGZ(page, orgCode, filterParamDto);
}else if(BusinessTypeEnum.JDJY.getCode().equals(dpFilterParamForDetailDto.getTreeValue())){ } else if (BusinessTypeEnum.JDJY.getCode().equals(dpFilterParamForDetailDto.getTreeValue())) {
maps = commonMapper.countBizFinishedNumForDPListJDJY(page, orgCode, filterParamDto); maps = commonMapper.countBizFinishedNumForDPListJDJY(page, orgCode, filterParamDto);
}else if(BusinessTypeEnum.SYDJ.getCode().equals(dpFilterParamForDetailDto.getTreeValue())){ } else if (BusinessTypeEnum.SYDJ.getCode().equals(dpFilterParamForDetailDto.getTreeValue())) {
maps = commonMapper.countBizFinishedNumForDPListSYDJ(page, orgCode, filterParamDto); maps = commonMapper.countBizFinishedNumForDPListSYDJ(page, orgCode, filterParamDto);
}else if(BusinessTypeEnum.DQJY.getCode().equals(dpFilterParamForDetailDto.getTreeValue())){ } else if (BusinessTypeEnum.DQJY.getCode().equals(dpFilterParamForDetailDto.getTreeValue())) {
maps = commonMapper.countBizFinishedNumForDPListDQJY(page, orgCode, filterParamDto); maps = commonMapper.countBizFinishedNumForDPListDQJY(page, orgCode, filterParamDto);
}else if(BusinessTypeEnum.BGDJ.getCode().equals(dpFilterParamForDetailDto.getTreeValue())){ } else if (BusinessTypeEnum.BGDJ.getCode().equals(dpFilterParamForDetailDto.getTreeValue())) {
maps = commonMapper.countBizFinishedNumForDPListBGDJ(page, orgCode, filterParamDto); maps = commonMapper.countBizFinishedNumForDPListBGDJ(page, orgCode, filterParamDto);
}else if(BusinessTypeEnum.ZXBX.getCode().equals(dpFilterParamForDetailDto.getTreeValue())){ } else if (BusinessTypeEnum.ZXBX.getCode().equals(dpFilterParamForDetailDto.getTreeValue())) {
maps = commonMapper.countBizFinishedNumForDPListZXBX(page, orgCode, filterParamDto); maps = commonMapper.countBizFinishedNumForDPListZXBX(page, orgCode, filterParamDto);
}else { } else {
maps = commonMapper.countBizFinishedNumForDPList(page, orgCode, filterParamDto); maps = commonMapper.countBizFinishedNumForDPList(page, orgCode, filterParamDto);
} }
return maps; return maps;
} }
public List<Map<String,Object>> noticeListBusinessType(DPFilterParamForDetailDto dpFilterParamDto) { public List<Map<String, Object>> noticeListBusinessType(DPFilterParamForDetailDto dpFilterParamDto) {
List<HashMap<String, Object>> enumList = NoticBusinessTypeEnum.getEnumList(); List<HashMap<String, Object>> enumList = NoticBusinessTypeEnum.getEnumList();
List<Map<String,Object>> result = new ArrayList<>(); List<Map<String, Object>> result = new ArrayList<>();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("title","业务类型"); map.put("title", "业务类型");
map.put("value","0"); map.put("value", "0");
map.put("children",enumList); map.put("children", enumList);
result.add(map); result.add(map);
return result; return result;
} }
...@@ -2028,16 +2061,16 @@ public class JGDPStatisticsServiceImpl { ...@@ -2028,16 +2061,16 @@ public class JGDPStatisticsServiceImpl {
return new Page<>(); return new Page<>();
} }
String time = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); String time = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
if(NoticBusinessTypeEnum.AZ.getCode().equals(dpFilterParamDto.getTreeValue())){ if (NoticBusinessTypeEnum.AZ.getCode().equals(dpFilterParamDto.getTreeValue())) {
return jgStatisticsMapper.selectAZNoticeDetailList(page,orgCode, time, dpFilterParamDto); return jgStatisticsMapper.selectAZNoticeDetailList(page, orgCode, time, dpFilterParamDto);
}else if(NoticBusinessTypeEnum.WX.getCode().equals(dpFilterParamDto.getTreeValue())){ } else if (NoticBusinessTypeEnum.WX.getCode().equals(dpFilterParamDto.getTreeValue())) {
return jgStatisticsMapper.selectWXNoticeDetailList(page,orgCode, time, dpFilterParamDto); return jgStatisticsMapper.selectWXNoticeDetailList(page, orgCode, time, dpFilterParamDto);
}else if(NoticBusinessTypeEnum.GZ.getCode().equals(dpFilterParamDto.getTreeValue())){ } else if (NoticBusinessTypeEnum.GZ.getCode().equals(dpFilterParamDto.getTreeValue())) {
return jgStatisticsMapper.selectGZNoticeDetailList(page,orgCode, time, dpFilterParamDto); return jgStatisticsMapper.selectGZNoticeDetailList(page, orgCode, time, dpFilterParamDto);
}else if(NoticBusinessTypeEnum.YZ.getCode().equals(dpFilterParamDto.getTreeValue())){ } else if (NoticBusinessTypeEnum.YZ.getCode().equals(dpFilterParamDto.getTreeValue())) {
return jgStatisticsMapper.selectYZNoticeDetailList(page,orgCode, time, dpFilterParamDto); return jgStatisticsMapper.selectYZNoticeDetailList(page, orgCode, time, dpFilterParamDto);
}else { } else {
return jgStatisticsMapper.selectNoticeDetailList(page,orgCode, time, dpFilterParamDto); return jgStatisticsMapper.selectNoticeDetailList(page, orgCode, time, dpFilterParamDto);
} }
} }
...@@ -2147,24 +2180,24 @@ public class JGDPStatisticsServiceImpl { ...@@ -2147,24 +2180,24 @@ public class JGDPStatisticsServiceImpl {
String param = QueryParser.escape(map.getString(IS_INTO_MANAGEMENT)); String param = QueryParser.escape(map.getString(IS_INTO_MANAGEMENT));
pBuilder.must(QueryBuilders.matchQuery(IS_INTO_MANAGEMENT, param)); pBuilder.must(QueryBuilders.matchQuery(IS_INTO_MANAGEMENT, param));
boolMust.must(pBuilder); boolMust.must(pBuilder);
} else{ } else {
if("1".equals(map.getString("IS_SUPERVISORY"))){ if ("1".equals(map.getString("IS_SUPERVISORY"))) {
//已赋码 //已赋码
boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE")); boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE","null")); boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", "null"));
//状态为已认领 //状态为已认领
String[] status = {"草稿","已拒领","待认领"}; String[] status = {"草稿", "已拒领", "待认领"};
boolMust.mustNot(QueryBuilders.termsQuery("STATUS",Arrays.asList(status))); boolMust.mustNot(QueryBuilders.termsQuery("STATUS", Arrays.asList(status)));
}else if("2".equals(map.getString("IS_SUPERVISORY"))){ } else if ("2".equals(map.getString("IS_SUPERVISORY"))) {
//未赋码 //未赋码
boolMust.mustNot(QueryBuilders.existsQuery("SUPERVISORY_CODE")); boolMust.mustNot(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
//状态为已认领 //状态为已认领
String[] status = {"草稿","已拒领","待认领"}; String[] status = {"草稿", "已拒领", "待认领"};
boolMust.mustNot(QueryBuilders.termsQuery("STATUS",Arrays.asList(status))); boolMust.mustNot(QueryBuilders.termsQuery("STATUS", Arrays.asList(status)));
}else{ } else {
//状态为已认领 //状态为已认领
String[] status = {"草稿","已拒领","待认领"}; String[] status = {"草稿", "已拒领", "待认领"};
boolMust.mustNot(QueryBuilders.termsQuery("STATUS",Arrays.asList(status))); boolMust.mustNot(QueryBuilders.termsQuery("STATUS", Arrays.asList(status)));
} }
} }
...@@ -2582,17 +2615,17 @@ public class JGDPStatisticsServiceImpl { ...@@ -2582,17 +2615,17 @@ public class JGDPStatisticsServiceImpl {
if (!ValidationUtil.isEmpty(useInfo.getProvince()) && !ValidationUtil.isEmpty(useInfo.getProvinceName())) { if (!ValidationUtil.isEmpty(useInfo.getProvince()) && !ValidationUtil.isEmpty(useInfo.getProvinceName())) {
province = useInfo.getProvince() + "_" + useInfo.getProvinceName(); province = useInfo.getProvince() + "_" + useInfo.getProvinceName();
fullAddress += useInfo.getProvinceName(); fullAddress += useInfo.getProvinceName();
fullArea += useInfo.getProvinceName()+"/"; fullArea += useInfo.getProvinceName() + "/";
} }
if (!ValidationUtil.isEmpty(useInfo.getCity()) && !ValidationUtil.isEmpty(useInfo.getCityName())) { if (!ValidationUtil.isEmpty(useInfo.getCity()) && !ValidationUtil.isEmpty(useInfo.getCityName())) {
city = useInfo.getCity() + "_" + useInfo.getCityName(); city = useInfo.getCity() + "_" + useInfo.getCityName();
fullAddress += useInfo.getCityName(); fullAddress += useInfo.getCityName();
fullArea += useInfo.getCityName()+"/"; fullArea += useInfo.getCityName() + "/";
} }
if (!ValidationUtil.isEmpty(useInfo.getCounty()) && !ValidationUtil.isEmpty(useInfo.getCountyName())) { if (!ValidationUtil.isEmpty(useInfo.getCounty()) && !ValidationUtil.isEmpty(useInfo.getCountyName())) {
county = useInfo.getCounty() + "_" + useInfo.getCountyName(); county = useInfo.getCounty() + "_" + useInfo.getCountyName();
fullAddress += useInfo.getCountyName(); fullAddress += useInfo.getCountyName();
fullArea += useInfo.getCountyName()+"/"; fullArea += useInfo.getCountyName() + "/";
} }
if (!ValidationUtil.isEmpty(useInfo.getFactoryUseSiteStreet()) && !ValidationUtil.isEmpty(useInfo.getStreetName())) { if (!ValidationUtil.isEmpty(useInfo.getFactoryUseSiteStreet()) && !ValidationUtil.isEmpty(useInfo.getStreetName())) {
street = useInfo.getFactoryUseSiteStreet() + "_" + useInfo.getStreetName(); street = useInfo.getFactoryUseSiteStreet() + "_" + useInfo.getStreetName();
...@@ -2621,8 +2654,8 @@ public class JGDPStatisticsServiceImpl { ...@@ -2621,8 +2654,8 @@ public class JGDPStatisticsServiceImpl {
if (!ValidationUtil.isEmpty(fullAddress)) { if (!ValidationUtil.isEmpty(fullAddress)) {
useInfoMap.put("fullAddress", fullAddress); useInfoMap.put("fullAddress", fullAddress);
} }
if(!ValidationUtil.isEmpty(fullArea)){ if (!ValidationUtil.isEmpty(fullArea)) {
useInfoMap.put("FULLAREA", fullArea.substring(0,fullArea.length()-1)); useInfoMap.put("FULLAREA", fullArea.substring(0, fullArea.length() - 1));
} }
useInfoMap.put("useinfoSeq", useInfo.getSequenceNbr()); useInfoMap.put("useinfoSeq", useInfo.getSequenceNbr());
if (!ValidationUtil.isEmpty(useInfo.getLongitudeLatitude())) { if (!ValidationUtil.isEmpty(useInfo.getLongitudeLatitude())) {
...@@ -2650,8 +2683,8 @@ public class JGDPStatisticsServiceImpl { ...@@ -2650,8 +2683,8 @@ public class JGDPStatisticsServiceImpl {
if (!ValidationUtil.isEmpty(fullAddress)) { if (!ValidationUtil.isEmpty(fullAddress)) {
useInfoMap.put("FULLADDRESS", fullAddress); useInfoMap.put("FULLADDRESS", fullAddress);
} }
if(!ValidationUtil.isEmpty(fullArea)){ if (!ValidationUtil.isEmpty(fullArea)) {
useInfoMap.put("FULLAREA", fullArea.substring(0,fullArea.length()-1)); useInfoMap.put("FULLAREA", fullArea.substring(0, fullArea.length() - 1));
} }
useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr()); useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr());
useInfoMap.put("USE_PLACE", useInfo.getUsePlace()); useInfoMap.put("USE_PLACE", useInfo.getUsePlace());
...@@ -2884,7 +2917,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -2884,7 +2917,7 @@ public class JGDPStatisticsServiceImpl {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
objMap.put("accountType", reginParams.getCompany().getCompanyType()); objMap.put("accountType", reginParams.getCompany().getCompanyType());
// 登记日期 // 登记日期
if(!ValidationUtil.isEmpty(registerInfo.getUseOrgCode())){ if (!ValidationUtil.isEmpty(registerInfo.getUseOrgCode())) {
Optional<JgUseRegistrationManage> firstRecord = jgUseRegistrationManageMapper.selectList(new QueryWrapper<JgUseRegistrationManage>().lambda() Optional<JgUseRegistrationManage> firstRecord = jgUseRegistrationManageMapper.selectList(new QueryWrapper<JgUseRegistrationManage>().lambda()
.eq(JgUseRegistrationManage::getUseRegistrationCode, registerInfo.getUseOrgCode()) .eq(JgUseRegistrationManage::getUseRegistrationCode, registerInfo.getUseOrgCode())
.eq(JgUseRegistrationManage::getIsDelete, 0) .eq(JgUseRegistrationManage::getIsDelete, 0)
...@@ -2904,10 +2937,11 @@ public class JGDPStatisticsServiceImpl { ...@@ -2904,10 +2937,11 @@ public class JGDPStatisticsServiceImpl {
public IdxBizJgConstructionInfo queryConstructionNewestDetailByRecord(String record) { public IdxBizJgConstructionInfo queryConstructionNewestDetailByRecord(String record) {
IdxBizJgConstructionInfo result = new IdxBizJgConstructionInfo(); IdxBizJgConstructionInfo result = new IdxBizJgConstructionInfo();
QueryWrapper<IdxBizJgConstructionInfo> queryWrapper = new QueryWrapper<>(); QueryWrapper<IdxBizJgConstructionInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(IdxBizJgConstructionInfo::getRecord,record).orderByDesc(IdxBizJgConstructionInfo::getUscDate); queryWrapper.lambda().eq(IdxBizJgConstructionInfo::getRecord, record).orderByDesc(IdxBizJgConstructionInfo::getUscDate);
List<IdxBizJgConstructionInfo> constructionInfoList = idxBizJgConstructionInfoMapper.selectList(queryWrapper); List<IdxBizJgConstructionInfo> constructionInfoList = idxBizJgConstructionInfoMapper.selectList(queryWrapper);
if(!ValidationUtil.isEmpty(constructionInfoList)){ if (!ValidationUtil.isEmpty(constructionInfoList)) {
BeanUtils.copyProperties(constructionInfoList.get(0),result);; BeanUtils.copyProperties(constructionInfoList.get(0), result);
;
} }
return result; return result;
} }
...@@ -2916,10 +2950,10 @@ public class JGDPStatisticsServiceImpl { ...@@ -2916,10 +2950,10 @@ public class JGDPStatisticsServiceImpl {
public IdxBizJgMaintenanceRecordInfo queryMaintenanceNewestDetailByRecord(String record) { public IdxBizJgMaintenanceRecordInfo queryMaintenanceNewestDetailByRecord(String record) {
IdxBizJgMaintenanceRecordInfo result = new IdxBizJgMaintenanceRecordInfo(); IdxBizJgMaintenanceRecordInfo result = new IdxBizJgMaintenanceRecordInfo();
QueryWrapper<IdxBizJgMaintenanceRecordInfo> queryWrapper = new QueryWrapper<>(); QueryWrapper<IdxBizJgMaintenanceRecordInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(IdxBizJgMaintenanceRecordInfo::getRecord,record).orderByDesc(IdxBizJgMaintenanceRecordInfo::getInformEnd); queryWrapper.lambda().eq(IdxBizJgMaintenanceRecordInfo::getRecord, record).orderByDesc(IdxBizJgMaintenanceRecordInfo::getInformEnd);
List<IdxBizJgMaintenanceRecordInfo> maintenanceRecordInfoList = idxBizJgMaintenanceRecordInfoMapper.selectList(queryWrapper); List<IdxBizJgMaintenanceRecordInfo> maintenanceRecordInfoList = idxBizJgMaintenanceRecordInfoMapper.selectList(queryWrapper);
if(!ValidationUtil.isEmpty(maintenanceRecordInfoList)){ if (!ValidationUtil.isEmpty(maintenanceRecordInfoList)) {
BeanUtils.copyProperties(maintenanceRecordInfoList.get(0),result); BeanUtils.copyProperties(maintenanceRecordInfoList.get(0), result);
} }
return result; return result;
} }
...@@ -2928,7 +2962,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -2928,7 +2962,7 @@ public class JGDPStatisticsServiceImpl {
public IdxBizJgInspectionDetectionInfo queryInspectionNewestDetailByRecord(String record) { public IdxBizJgInspectionDetectionInfo queryInspectionNewestDetailByRecord(String record) {
IdxBizJgInspectionDetectionInfo result = new IdxBizJgInspectionDetectionInfo(); IdxBizJgInspectionDetectionInfo result = new IdxBizJgInspectionDetectionInfo();
QueryWrapper<IdxBizJgInspectionDetectionInfo> queryWrapper = new QueryWrapper<>(); QueryWrapper<IdxBizJgInspectionDetectionInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(IdxBizJgInspectionDetectionInfo::getRecord,record).orderByDesc(IdxBizJgInspectionDetectionInfo::getInspectDate); queryWrapper.lambda().eq(IdxBizJgInspectionDetectionInfo::getRecord, record).orderByDesc(IdxBizJgInspectionDetectionInfo::getInspectDate);
List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = idxBizJgInspectionDetectionInfoMapper.selectList(queryWrapper); List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = idxBizJgInspectionDetectionInfoMapper.selectList(queryWrapper);
if (!ValidationUtil.isEmpty(inspectionDetectionInfoList)) { if (!ValidationUtil.isEmpty(inspectionDetectionInfoList)) {
BeanUtils.copyProperties(inspectionDetectionInfoList.get(0), result); BeanUtils.copyProperties(inspectionDetectionInfoList.get(0), result);
...@@ -3234,13 +3268,13 @@ public class JGDPStatisticsServiceImpl { ...@@ -3234,13 +3268,13 @@ public class JGDPStatisticsServiceImpl {
public List<IdxBizJgProtectionDevices> queryProtectionListByRecord(String record) { public List<IdxBizJgProtectionDevices> queryProtectionListByRecord(String record) {
QueryWrapper<IdxBizJgProtectionDevices> queryWrapper = new QueryWrapper<>(); QueryWrapper<IdxBizJgProtectionDevices> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(IdxBizJgProtectionDevices::getRecord,record).orderByDesc(IdxBizJgProtectionDevices::getRecDate); queryWrapper.lambda().eq(IdxBizJgProtectionDevices::getRecord, record).orderByDesc(IdxBizJgProtectionDevices::getRecDate);
return idxBizJgProtectionDevicesMapper.selectList(queryWrapper); return idxBizJgProtectionDevicesMapper.selectList(queryWrapper);
} }
public List<IdxBizJgMainParts> queryMainPartsListByRecord(String record) { public List<IdxBizJgMainParts> queryMainPartsListByRecord(String record) {
QueryWrapper<IdxBizJgMainParts> queryWrapper = new QueryWrapper<>(); QueryWrapper<IdxBizJgMainParts> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(IdxBizJgMainParts::getRecord,record).orderByDesc(IdxBizJgMainParts::getRecDate); queryWrapper.lambda().eq(IdxBizJgMainParts::getRecord, record).orderByDesc(IdxBizJgMainParts::getRecDate);
return idxBizJgMainPartsMapper.selectList(queryWrapper); return idxBizJgMainPartsMapper.selectList(queryWrapper);
} }
...@@ -3329,7 +3363,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -3329,7 +3363,7 @@ public class JGDPStatisticsServiceImpl {
Object o = objectMap.get(f.getKey()); Object o = objectMap.get(f.getKey());
if (!ObjectUtils.isEmpty(o)) { if (!ObjectUtils.isEmpty(o)) {
f.setValue(o.toString()); f.setValue(o.toString());
if ("auditPassDate".equals(f.getKey())){ if ("auditPassDate".equals(f.getKey())) {
f.setValue(simpleDateFormat.format(jgUseRegistrationManage.getAuditPassDate())); f.setValue(simpleDateFormat.format(jgUseRegistrationManage.getAuditPassDate()));
} }
} }
...@@ -3375,19 +3409,19 @@ public class JGDPStatisticsServiceImpl { ...@@ -3375,19 +3409,19 @@ public class JGDPStatisticsServiceImpl {
* @return * @return
*/ */
public Page<JSONObject> certificateEquList(int current, int size, String sequenceNbr) { public Page<JSONObject> certificateEquList(int current, int size, String sequenceNbr) {
return queryEquForPageByCertificateSeqList("",Collections.singletonList(Long.parseLong(sequenceNbr)), current, size); return queryEquForPageByCertificateSeqList("", Collections.singletonList(Long.parseLong(sequenceNbr)), current, size);
} }
/** /**
* 根据证的sequenceNbr集合,批量查询证下面的所有设备 * 根据证的sequenceNbr集合,批量查询证下面的所有设备
* *
* @param enableType 启用停用业务使用 - 过滤设备状态 (1:在用 2:停用) 对应枚举:EquimentEnum * @param enableType 启用停用业务使用 - 过滤设备状态 (1:在用 2:停用) 对应枚举:EquimentEnum
* @param sequenceNbrList 证的sequenceNbr集合 * @param sequenceNbrList 证的sequenceNbr集合
* @param current 分页-当前页 * @param current 分页-当前页
* @param size 分页-分页数 * @param size 分页-分页数
* @return 查询结果 * @return 查询结果
*/ */
public Page<JSONObject> queryEquForPageByCertificateSeqList(String enableType,List<Long> sequenceNbrList, int current, int size) { public Page<JSONObject> queryEquForPageByCertificateSeqList(String enableType, List<Long> sequenceNbrList, int current, int size) {
List<JgUseRegistrationManage> jgUseRegistrationManageList = jgUseRegistrationManageMapper.selectList(new LambdaQueryWrapper<JgUseRegistrationManage>() List<JgUseRegistrationManage> jgUseRegistrationManageList = jgUseRegistrationManageMapper.selectList(new LambdaQueryWrapper<JgUseRegistrationManage>()
.in(JgUseRegistrationManage::getSequenceNbr, sequenceNbrList) .in(JgUseRegistrationManage::getSequenceNbr, sequenceNbrList)
.eq(JgUseRegistrationManage::getIsDelete, 0)); .eq(JgUseRegistrationManage::getIsDelete, 0));
...@@ -3442,24 +3476,24 @@ public class JGDPStatisticsServiceImpl { ...@@ -3442,24 +3476,24 @@ public class JGDPStatisticsServiceImpl {
public Page<SafetyProblemTracingDto> getProblemRecords(Page<SafetyProblemTracingDto> page, SafetyProblemTracingDto problemModel) { public Page<SafetyProblemTracingDto> getProblemRecords(Page<SafetyProblemTracingDto> page, SafetyProblemTracingDto problemModel) {
String orgCode = stCommonService.getAndSetOrgCode(problemModel.getCityCode()); String orgCode = stCommonService.getAndSetOrgCode(problemModel.getCityCode());
if (com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(orgCode)){ if (com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(orgCode)) {
return new Page<>(); return new Page<>();
} }
// 默认登录监管单位orgcode过滤 // 默认登录监管单位orgcode过滤
problemModel.setGoverningBodyOrgCode(orgCode); problemModel.setGoverningBodyOrgCode(orgCode);
if (!ObjectUtils.isEmpty(problemModel.getGoverningBodyOrgCode())){ if (!ObjectUtils.isEmpty(problemModel.getGoverningBodyOrgCode())) {
// 筛选条件起效 // 筛选条件起效
problemModel.setGoverningBodyOrgCode(problemModel.getGoverningBodyOrgCode()); problemModel.setGoverningBodyOrgCode(problemModel.getGoverningBodyOrgCode());
} }
// 使用orgCode过滤 // 使用orgCode过滤
// 将单位类型从code转化为value // 将单位类型从code转化为value
if (!ValidationUtil.isEmpty(problemModel.getPrincipalUnitType())){ if (!ValidationUtil.isEmpty(problemModel.getPrincipalUnitType())) {
Collection<DataDictionary> unitTypeList = iDataDictionaryService.list(new QueryWrapper<DataDictionary>() Collection<DataDictionary> unitTypeList = iDataDictionaryService.list(new QueryWrapper<DataDictionary>()
.eq("type", "UNIT_TYPE_NEW") .eq("type", "UNIT_TYPE_NEW")
.eq("is_delete", false) .eq("is_delete", false)
.orderByAsc("sort_num")); .orderByAsc("sort_num"));
Map<String, String> unitTypeMap = unitTypeList.stream().collect(Collectors.toMap(DataDictionary::getCode, DataDictionary::getName)); Map<String, String> unitTypeMap = unitTypeList.stream().collect(Collectors.toMap(DataDictionary::getCode, DataDictionary::getName));
problemModel.setPrincipalUnitType(unitTypeMap.getOrDefault(problemModel.getPrincipalUnitType(),null)); problemModel.setPrincipalUnitType(unitTypeMap.getOrDefault(problemModel.getPrincipalUnitType(), null));
} }
return safetyProblemTracingMapper.queryForSafetyProblemTracingPage(page, problemModel); return safetyProblemTracingMapper.queryForSafetyProblemTracingPage(page, problemModel);
} }
...@@ -3471,13 +3505,13 @@ public class JGDPStatisticsServiceImpl { ...@@ -3471,13 +3505,13 @@ public class JGDPStatisticsServiceImpl {
public Map<String, Object> getProblemChart(SafetyProblemTracingDto problemModel) { public Map<String, Object> getProblemChart(SafetyProblemTracingDto problemModel) {
String orgCode = stCommonService.getAndSetOrgCode(problemModel.getCityCode()); String orgCode = stCommonService.getAndSetOrgCode(problemModel.getCityCode());
if (ObjectUtils.isEmpty(orgCode)){ if (ObjectUtils.isEmpty(orgCode)) {
return new HashMap<>(); return new HashMap<>();
} }
Map<String,Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
String sourceTypeCode = "all".equals(problemModel.getSourceTypeCode()) ? null : problemModel.getSourceTypeCode(); String sourceTypeCode = "all".equals(problemModel.getSourceTypeCode()) ? null : problemModel.getSourceTypeCode();
List<String> xdata = safetyProblemTracingMapper.getBusinessType(sourceTypeCode,orgCode); List<String> xdata = safetyProblemTracingMapper.getBusinessType(sourceTypeCode, orgCode);
if(ObjectUtils.isEmpty(xdata)){ if (ObjectUtils.isEmpty(xdata)) {
return resultMap; return resultMap;
} }
List<Map<String, Object>> countMap = safetyProblemTracingMapper.getBusinessCount(sourceTypeCode, orgCode); List<Map<String, Object>> countMap = safetyProblemTracingMapper.getBusinessCount(sourceTypeCode, orgCode);
...@@ -3500,7 +3534,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -3500,7 +3534,7 @@ public class JGDPStatisticsServiceImpl {
BigDecimal percent = (new BigDecimal(Double.valueOf(green) * 100).divide(new BigDecimal(problemSum.doubleValue()), 2, RoundingMode.HALF_UP)); BigDecimal percent = (new BigDecimal(Double.valueOf(green) * 100).divide(new BigDecimal(problemSum.doubleValue()), 2, RoundingMode.HALF_UP));
stationRates.add(percent.toString()); stationRates.add(percent.toString());
}); });
Set<Map<String,String>> legendData = new HashSet<>(); Set<Map<String, String>> legendData = new HashSet<>();
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
if (i == 0) { if (i == 0) {
...@@ -3586,4 +3620,269 @@ public class JGDPStatisticsServiceImpl { ...@@ -3586,4 +3620,269 @@ public class JGDPStatisticsServiceImpl {
Map<String, List<Map<String, Object>>> resourceJson = JsonUtils.getResourceJson(allBusinessType); Map<String, List<Map<String, Object>>> resourceJson = JsonUtils.getResourceJson(allBusinessType);
return resourceJson.get(treeValue); return resourceJson.get(treeValue);
} }
public Map<String, Object> queryBarChartDataForSkjs(DPFilterParamDto dpFilterParamDto) {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParentAndNoAccessIf3Level(dpFilterParamDto);
String orgCodeP = stCommonService.getAndSetOrgCode(dpFilterParamDto);
List<LegendDataDto> legendDataDtos = this.buildLegendDataListForSkjs();
// 2.按照前端约定格式返回数据
Map<String, Object> result = new HashMap<>();
//2.1 图列数据构造
result.put("legendData", legendDataDtos);
if (orgCodeP == null) {
return result;
}
List<String> xData = new ArrayList<>();
// 2.2 Y轴数据构造 定义5个图列 再查询各自数据
List<String> oneSetYData = new ArrayList<>();
List<String> cylinderYData = new ArrayList<>();
List<String> pipelineYData = new ArrayList<>();
List<String> companyYData = new ArrayList<>();
List<String> userYData = new ArrayList<>();
Map<String, SkjsCountItemDto> countItemMap = regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
SkjsCountItemDto countItemDto = new SkjsCountItemDto();
countItemDto.setRegionCode(r.getRegionCode().toString());
if (!ValidationUtil.isEmpty(orgCode)) {
Map<String, Object> data = new HashMap<>();
// 查询各自统计数据作为Y轴数据
// 0. 气瓶数量统计
long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(data, orgCode, false, false);
countItemDto.setCylinder(String.valueOf(cylinderNum));
// 1. 设备数量统计
long oneSetNum = stCommonService.staticsCenterMapCountDataForEquip(data, cylinderNum, orgCode, true, false);
countItemDto.setOneSet(String.valueOf(oneSetNum));
// 2. 压力管道长度统计
countItemDto.setPipeline(stCommonService.staticsCenterMapCountDataForPipeline(data, orgCode, true));
// 3.单位数量统计
this.staticsCompanyForSkjs(countItemDto, orgCode, dpFilterParamDto.getCityCode());
// 4. 人员数量统计
this.staticsUserForSkjs(countItemDto, dpFilterParamDto, orgCode);
} else {
countItemDto.setDefaultValues();
}
return countItemDto;
}).collect(Collectors.toMap(SkjsCountItemDto::getRegionCode, Function.identity()));
regionModels.forEach(r -> {
xData.add(r.getRegionName());
SkjsCountItemDto countItemDto = countItemMap.get(r.getRegionCode().toString());
oneSetYData.add(countItemDto.getOneSet());
cylinderYData.add(countItemDto.getCylinder());
pipelineYData.add(countItemDto.getPipeline());
companyYData.add(countItemDto.getCompany());
userYData.add(countItemDto.getUser());
});
//2.3 x轴数据构造
result.put("oneSet", oneSetYData);
result.put("cylinder", cylinderYData);
result.put("pipeline", pipelineYData);
result.put("company", companyYData);
result.put("user", userYData);
result.put("xdata", xData);
return result;
}
private List<LegendDataDto> buildLegendDataListForSkjs() {
List<LegendDataDto> legendDataDtos = new ArrayList<>();
legendDataDtos.add(LegendDataDto.builder().dataKey("oneSet").value("设备(台套)").build());
legendDataDtos.add(LegendDataDto.builder().dataKey("cylinder").value("气瓶(个)").build());
legendDataDtos.add(LegendDataDto.builder().dataKey("pipeline").value("压力管道(千米)").build());
legendDataDtos.add(LegendDataDto.builder().dataKey("company").value("企业").build());
legendDataDtos.add(LegendDataDto.builder().dataKey("user").value("人员").build());
return legendDataDtos;
}
public Map<String, Object> querySkjsDetail(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>();
// 设备上线情况
result.put("equipOnLineInfo", this.getEquipOnLineInfo(dpFilterParamDto));
// 企业上线情况
result.put("companyOnLineInfo", this.getCompanyOnLineInfo(dpFilterParamDto));
// 人员上线情况
result.put("userOnLineInfo", this.getUserOnLineInfo(dpFilterParamDto));
return result;
}
private Object getEquipOnLineInfo(DPFilterParamDto dpFilterParamDto) {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParentAndNoAccessIf3Level(dpFilterParamDto);
String orgCodeP = stCommonService.getAndSetOrgCode(dpFilterParamDto);
if (orgCodeP == null) {
return new ArrayList<>();
}
Map<String, SkjsEquipCountItemDto> countItemMap = regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
SkjsEquipCountItemDto countItemDto = new SkjsEquipCountItemDto();
countItemDto.setRegionCode(r.getRegionCode().toString());
countItemDto.setRegionCode(r.getRegionCode().toString());
countItemDto.setRegionName(r.getRegionName());
if (!ValidationUtil.isEmpty(orgCode)) {
Map<String, Object> data = new HashMap<>();
// 0. 气瓶数量统计
long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(data, orgCode, false, false);
countItemDto.setQp(String.valueOf(cylinderNum));
// 1. 设备数量统计-台套
stCommonService.staticsCenterMapCountDataForEquip(data, cylinderNum, orgCode, true, false);
countItemDto.setDt(String.valueOf(data.get(DPMapStatisticsItemEnum.ELEVATORS.getCode())));
countItemDto.setQzjx(String.valueOf(data.get(DPMapStatisticsItemEnum.LIFTING_MACHINERY.getCode())));
countItemDto.setKysd(String.valueOf(data.get(DPMapStatisticsItemEnum.PASSENGER_ROPEWAYS.getCode())));
countItemDto.setDxylss(String.valueOf(data.get(DPMapStatisticsItemEnum.LARGE_AMUSEMENT_FACILITIES.getCode())));
countItemDto.setCc(String.valueOf(data.get(DPMapStatisticsItemEnum.ON_SITE_MOTOR_VEHICLES.getCode())));
countItemDto.setGl(String.valueOf(data.get(DPMapStatisticsItemEnum.BOILERS.getCode())));
countItemDto.setYlrq(String.valueOf(data.get(DPMapStatisticsItemEnum.PRESSURE_VESSELS.getCode())));
// 2. 压力管道长度统计
countItemDto.setYlgd(stCommonService.staticsCenterMapCountDataForPipeline(data, orgCode, true));
} else {
countItemDto.setDefaultValues();
}
return countItemDto;
}).collect(Collectors.toMap(SkjsEquipCountItemDto::getRegionCode, Function.identity()));
List<SkjsEquipCountItemDto> countItemDtos = regionModels.stream().map(r -> countItemMap.get(r.getRegionCode().toString())).collect(Collectors.toList());
this.setEquipSummaryRow(countItemDtos);
return countItemDtos;
}
private Object getCompanyOnLineInfo(DPFilterParamDto dpFilterParamDto) {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParentAndNoAccessIf3Level(dpFilterParamDto);
String orgCodeP = stCommonService.getAndSetOrgCode(dpFilterParamDto);
if (orgCodeP == null) {
return new ArrayList<>();
}
Map<String, SkjsCompanyCountItemDto> companyCountItemDtoMap = regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
SkjsCompanyCountItemDto companyCountItemDto = new SkjsCompanyCountItemDto();
companyCountItemDto.setRegionCode(r.getRegionCode().toString());
companyCountItemDto.setRegionName(r.getRegionName());
if (StringUtils.isNotEmpty(orgCode)) {
List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, r.getRegionCode() + "");
int u1 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) || c.getKeyStr().contains(COMPANY_TYPE_PERSON)).mapToInt(CountDto::getIntValue).sum();
int u2 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)).mapToInt(CountDto::getIntValue).sum();
int u3 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE)).mapToInt(CountDto::getIntValue).sum();
int u4 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum();
int u5 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_DESIGN)).mapToInt(CountDto::getIntValue).sum();
int u6 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_JYJC)).mapToInt(CountDto::getIntValue).sum();
companyCountItemDto.setSydw(String.valueOf(u1));
companyCountItemDto.setZzdw(String.valueOf(u3));
companyCountItemDto.setAgwdw(String.valueOf(u2));
companyCountItemDto.setCzdw(String.valueOf(u4));
companyCountItemDto.setJyjcjg(String.valueOf(u6));
companyCountItemDto.setSjdw(String.valueOf(u5));
} else {
companyCountItemDto.setDefaultValues();
}
return companyCountItemDto;
}).collect(Collectors.toMap(SkjsCompanyCountItemDto::getRegionCode, Function.identity()));
List<SkjsCompanyCountItemDto> countItemDtos = regionModels.stream().map(r -> companyCountItemDtoMap.get(r.getRegionCode().toString())).collect(Collectors.toList());
this.setCompanySummaryRow(countItemDtos);
return countItemDtos;
}
private Object getUserOnLineInfo(DPFilterParamDto dpFilterParamDto) {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParentAndNoAccessIf3Level(dpFilterParamDto);
String orgCodeP = stCommonService.getAndSetOrgCode(dpFilterParamDto);
if (orgCodeP == null) {
return new ArrayList<>();
}
Map<String, SkjsUserCountItemDto> userCountItemDtoMap = regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
SkjsUserCountItemDto userCountItemDto = new SkjsUserCountItemDto();
userCountItemDto.setRegionCode(r.getRegionCode().toString());
userCountItemDto.setRegionName(r.getRegionName());
if (StringUtils.isNotEmpty(orgCode)) {
List<CountDto> countDtos = zlStatisticsMapper.countUserByPostAndAreaCode(orgCode, r.getRegionCode().toString());
int zyry = countDtos.stream().filter(c -> c.getKeyStr().contains(UserPostEnum.ZYRY.getCode())).mapToInt(CountDto::getIntValue).sum();
int jyry = countDtos.stream().filter(c -> c.getKeyStr().contains(UserPostEnum.ZJRY.getCode())).mapToInt(CountDto::getIntValue).sum();
int jcyr = countDtos.stream().filter(c -> c.getKeyStr().contains(UserPostEnum.JCRY.getCode())).mapToInt(CountDto::getIntValue).sum();
// 生产[设计单位、安改维、制造单位]-主要负责人
int sczyfzr = countDtos.stream().filter(c -> (c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE) || c.getKeyStr().contains(COMPANY_TYPE_DESIGN) || c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)) && c.getKeyStr().contains(UserPostEnum.ZYFZR.getCode())).mapToInt(CountDto::getIntValue).sum();
// 生产[设计单位、安改维、制造单位]-质量安全总监
int sczlaqzj = countDtos.stream().filter(c -> (c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE) || c.getKeyStr().contains(COMPANY_TYPE_DESIGN) || c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)) && c.getKeyStr().contains(UserPostEnum.ZLAQZJ.getCode())).mapToInt(CountDto::getIntValue).sum();
// 生产[设计单位、安改维、制造单位]-质量安全员
int sczlaqy = countDtos.stream().filter(c -> (c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE) || c.getKeyStr().contains(COMPANY_TYPE_DESIGN) || c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)) && c.getKeyStr().contains(UserPostEnum.ZLAQY.getCode())).mapToInt(CountDto::getIntValue).sum();
// 使用单位-主要负责人
int syzyfzr = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) && c.getKeyStr().contains(UserPostEnum.ZLAQY.getCode())).mapToInt(CountDto::getIntValue).sum();
// 使用单位-安全总监
int syaqzj = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) && c.getKeyStr().contains(UserPostEnum.AQZJ.getCode())).mapToInt(CountDto::getIntValue).sum();
// 使用单位-安全员
int syaqy = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) && c.getKeyStr().contains(UserPostEnum.AQY.getCode())).mapToInt(CountDto::getIntValue).sum();
userCountItemDto.setZyry(String.valueOf(zyry));
userCountItemDto.setJyry(String.valueOf(jyry));
userCountItemDto.setJcry(String.valueOf(jcyr));
userCountItemDto.setSczyfzr(String.valueOf(sczyfzr));
userCountItemDto.setSczlaqzj(String.valueOf(sczlaqzj));
userCountItemDto.setSczlaqy(String.valueOf(sczlaqy));
userCountItemDto.setSyzyfzr(String.valueOf(syzyfzr));
userCountItemDto.setSyaqzj(String.valueOf(syaqzj));
userCountItemDto.setSyaqy(String.valueOf(syaqy));
} else {
userCountItemDto.setDefaultValues();
}
return userCountItemDto;
}).collect(Collectors.toMap(SkjsUserCountItemDto::getRegionCode, Function.identity()));
List<SkjsUserCountItemDto> userCountItemDtos = regionModels.stream().map(r -> userCountItemDtoMap.get(r.getRegionCode().toString())).collect(Collectors.toList());
this.setUserSummaryRow(userCountItemDtos);
return userCountItemDtos;
}
private void setUserSummaryRow(List<SkjsUserCountItemDto> userCountItemDtos) {
SkjsUserCountItemDto summary = new SkjsUserCountItemDto();
summary.setRegionCode("summary");
summary.setRegionName("合计");
summary.setZyry(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getZyry())).sum()));
summary.setJyry(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getJyry())).sum()));
summary.setJcry(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getJcry())).sum()));
summary.setSczyfzr(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSczyfzr())).sum()));
summary.setSczlaqzj(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSczlaqzj())).sum()));
summary.setSczlaqy(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSczlaqy())).sum()));
summary.setSyzyfzr(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSyzyfzr())).sum()));
summary.setSyaqzj(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSyaqzj())).sum()));
summary.setSyaqy(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSyaqy())).sum()));
userCountItemDtos.add(summary);
}
private void setCompanySummaryRow(List<SkjsCompanyCountItemDto> companyCountItemDtos) {
SkjsCompanyCountItemDto summary = new SkjsCompanyCountItemDto();
summary.setRegionCode("summary");
summary.setRegionName("合计");
summary.setSydw(String.valueOf(companyCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSydw())).sum()));
summary.setZzdw(String.valueOf(companyCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getZzdw())).sum()));
summary.setAgwdw(String.valueOf(companyCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getAgwdw())).sum()));
summary.setCzdw(String.valueOf(companyCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getCzdw())).sum()));
summary.setJyjcjg(String.valueOf(companyCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getJyjcjg())).sum()));
summary.setSjdw(String.valueOf(companyCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSjdw())).sum()));
companyCountItemDtos.add(summary);
}
private void setEquipSummaryRow(List<SkjsEquipCountItemDto> equipCountItemDtos) {
SkjsEquipCountItemDto summary = new SkjsEquipCountItemDto();
summary.setRegionCode("summary");
summary.setRegionName("合计");
summary.setDt(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getDt())).sum()));
summary.setQzjx(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getQzjx())).sum()));
summary.setKysd(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getKysd())).sum()));
summary.setDxylss(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getDxylss())).sum()));
summary.setCc(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getCc())).sum()));
summary.setGl(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getGl())).sum()));
summary.setYlrq(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getYlrq())).sum()));
summary.setYlgd(sumWithValidation(equipCountItemDtos));
summary.setQp(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getQp())).sum()));
equipCountItemDtos.add(summary);
}
public String sumWithValidation(List<SkjsEquipCountItemDto> list) {
return list.stream()
.filter(Objects::nonNull)
.map(item -> {
try {
return new BigDecimal(item.getYlgd());
} catch (NumberFormatException e) {
log.warn("Invalid number in item {}", item);
return BigDecimal.ZERO;
}
})
.reduce(BigDecimal.ZERO, BigDecimal::add).setScale(3, RoundingMode.HALF_UP).toPlainString();
}
} }
...@@ -537,9 +537,9 @@ public class JYJCDPStatisticsServiceImpl { ...@@ -537,9 +537,9 @@ public class JYJCDPStatisticsServiceImpl {
return result; return result;
} }
// 1.气瓶统计 // 1.气瓶统计
long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,true); long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(result, orgCode,true, true);
// 2.8大类统计 // 2.8大类统计
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true,true);
// 3.压力管道统计 // 3.压力管道统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true); stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true);
// 4.报检数量统计 // 4.报检数量统计
......
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl; package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
...@@ -19,6 +20,7 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipTechParamPipelineMapper; ...@@ -19,6 +20,7 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipTechParamPipelineMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
...@@ -40,6 +42,7 @@ import java.math.RoundingMode; ...@@ -40,6 +42,7 @@ import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -106,16 +109,23 @@ public class StCommonServiceImpl { ...@@ -106,16 +109,23 @@ public class StCommonServiceImpl {
private void initReginCode() { private void initReginCode() {
Collection<RegionModel> result = Systemctl.regionClient.queryForTree(null).getResult(); Collection<RegionModel> result = Systemctl.regionClient.queryForTree(null).getResult();
result.forEach(r -> { result.forEach(r -> {
regionModels.add(r); RegionModel regionModel = new RegionModel();
BeanUtil.copyProperties(r, regionModel);
regionModel.setChildren(null);
regionModels.add(regionModel);
this.loopSetChildRegin(regionModels, r.getChildren()); this.loopSetChildRegin(regionModels, r.getChildren());
}); });
regionCodeRegionMap = regionModels.stream().collect(Collectors.toMap(RegionModel::getRegionCode, Function.identity(), (k1, k2) -> k2)); regionCodeRegionMap = regionModels.stream().collect(Collectors.toMap(RegionModel::getRegionCode, Function.identity(), (k1, k2) -> k2));
} }
private void loopSetChildRegin(List<RegionModel> regionModels, Collection<RegionModel> children) { private void loopSetChildRegin(List<RegionModel> regionModels, Collection<RegionModel> children) {
if (children != null && children.size() > 0) { if (children != null && !children.isEmpty()) {
children.forEach(c -> { children.forEach(c -> {
regionModels.add(c); RegionModel regionModel = new RegionModel();
BeanUtil.copyProperties(c, regionModel);
regionModel.setChildren(null);
regionModels.add(regionModel);
this.loopSetChildRegin(regionModels, c.getChildren()); this.loopSetChildRegin(regionModels, c.getChildren());
}); });
} }
...@@ -202,7 +212,7 @@ public class StCommonServiceImpl { ...@@ -202,7 +212,7 @@ public class StCommonServiceImpl {
return regionList.stream().map(RegionModel::getRegionName).collect(Collectors.toList()); return regionList.stream().map(RegionModel::getRegionName).collect(Collectors.toList());
} }
public long staticsCenterMapCountDataForCylinder(Map<String, Object> result, String orgCode,Boolean supervisoryFlag) { public long staticsCenterMapCountDataForCylinder(Map<String, Object> result, String orgCode,Boolean supervisoryFlag, Boolean isMatchSupervisoryCode) {
long num = 0; long num = 0;
CountRequest request = new CountRequest(); CountRequest request = new CountRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
...@@ -211,12 +221,14 @@ public class StCommonServiceImpl { ...@@ -211,12 +221,14 @@ public class StCommonServiceImpl {
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")); boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
// 设备类别精确查询气瓶 // 设备类别精确查询气瓶
boolMust.must(QueryBuilders.termQuery("EQU_CATEGORY_CODE", EQU_CATEGORY_CYLINDER)); boolMust.must(QueryBuilders.termQuery("EQU_CATEGORY_CODE", EQU_CATEGORY_CYLINDER));
if(supervisoryFlag) { if(isMatchSupervisoryCode){
//已赋码 if(supervisoryFlag) {
boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE")); //已赋码
boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", "null")); boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
}else{ boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", "null"));
boolMust.mustNot(QueryBuilders.existsQuery("SUPERVISORY_CODE")); }else{
boolMust.mustNot(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
}
} }
//状态为已认领 //状态为已认领
String[] status = {"草稿","已拒领","待认领"}; String[] status = {"草稿","已拒领","待认领"};
...@@ -232,18 +244,21 @@ public class StCommonServiceImpl { ...@@ -232,18 +244,21 @@ public class StCommonServiceImpl {
return num; return num;
} }
public void staticsCenterMapCountDataForEquip(Map<String, Object> result, long cylinderNum, String orgCode,Boolean supervisoryFlag) {
public long staticsCenterMapCountDataForEquip(Map<String, Object> result, long cylinderNum, String orgCode,Boolean supervisoryFlag, Boolean isMatchSupervisoryCode) {
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 按照管辖机构区域信息模糊查询 // 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")); boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
if(supervisoryFlag) { if(isMatchSupervisoryCode){
//已赋码 if(supervisoryFlag) {
boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE")); //已赋码
boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", "null")); boolMust.must(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
}else{ boolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", "null"));
boolMust.mustNot(QueryBuilders.existsQuery("SUPERVISORY_CODE")); }else{
boolMust.mustNot(QueryBuilders.existsQuery("SUPERVISORY_CODE"));
}
} }
//状态为已认领 //状态为已认领
String[] status = {"草稿","已拒领","待认领"}; String[] status = {"草稿","已拒领","待认领"};
...@@ -282,6 +297,7 @@ public class StCommonServiceImpl { ...@@ -282,6 +297,7 @@ public class StCommonServiceImpl {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
result.remove(DPMapStatisticsItemEnum.PRESSURE_PIPELINES.getCategory()); result.remove(DPMapStatisticsItemEnum.PRESSURE_PIPELINES.getCategory());
return (long)result.getOrDefault(DPMapStatisticsItemEnum.TOTAL.getCode(), 0L);
} }
private String castCategoryCode2WebCode(String category) { private String castCategoryCode2WebCode(String category) {
...@@ -289,7 +305,7 @@ public class StCommonServiceImpl { ...@@ -289,7 +305,7 @@ public class StCommonServiceImpl {
return itemEnum.getCode(); return itemEnum.getCode();
} }
public void staticsCenterMapCountDataForPipeline(Map<String, Object> result, String orgCode,Boolean supervisoryFlag) { public String staticsCenterMapCountDataForPipeline(Map<String, Object> result, String orgCode,Boolean supervisoryFlag) {
String length = techParamsPipelineMapper.sumPipeLengthByOrgCode(orgCode, supervisoryFlag); String length = techParamsPipelineMapper.sumPipeLengthByOrgCode(orgCode, supervisoryFlag);
BigDecimal lengthDecimal = new BigDecimal(length); BigDecimal lengthDecimal = new BigDecimal(length);
if (lengthDecimal.compareTo(BigDecimal.ZERO) > 0) { if (lengthDecimal.compareTo(BigDecimal.ZERO) > 0) {
...@@ -297,6 +313,7 @@ public class StCommonServiceImpl { ...@@ -297,6 +313,7 @@ public class StCommonServiceImpl {
length = lengthDecimal.divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP).toPlainString(); length = lengthDecimal.divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP).toPlainString();
} }
result.put(DPMapStatisticsItemEnum.PRESSURE_PIPELINES.getCode(), length); result.put(DPMapStatisticsItemEnum.PRESSURE_PIPELINES.getCode(), length);
return length;
} }
public CountDto getRedStatusCompany(DPFilterParamDto dpFilterParamDto) { public CountDto getRedStatusCompany(DPFilterParamDto dpFilterParamDto) {
...@@ -358,4 +375,32 @@ public class StCommonServiceImpl { ...@@ -358,4 +375,32 @@ public class StCommonServiceImpl {
.collect(Collectors.toList()); .collect(Collectors.toList());
return new EquCategoryVo("全部设备",null, children); return new EquCategoryVo("全部设备",null, children);
} }
public List<RegionModel> getRegionTree3Level(Integer regionCode) {
return buildTree(regionModels.stream().filter(r-> Integer.parseInt(StringUtils.trim(r.getLevel())) <=3).collect(Collectors.toList()), r->r.getRegionCode().equals(regionCode));
}
public List<RegionModel> buildTree(List<RegionModel> regions,
Predicate<RegionModel> rootCondition) {
// 防御性拷贝避免修改原始数据
List<RegionModel> copyRegions = new ArrayList<>(regions);
// 构建快速索引: parentCode -> 子节点列表
Map<Integer, List<RegionModel>> parentCodeMap = copyRegions.stream()
.collect(Collectors.groupingBy(RegionModel::getParentRegionCode));
// 递归构建子树
return copyRegions.stream()
.filter(rootCondition) // 过滤根节点
.peek(root -> buildSubtree(root, parentCodeMap)) // 完善子树结构
.collect(Collectors.toList());
}
private void buildSubtree(RegionModel parent,
Map<Integer, List<RegionModel>> parentCodeMap) {
List<RegionModel> children = parentCodeMap.get(parent.getRegionCode());
if (children != null) {
// 确保children集合可修改
parent.setChildren(new ArrayList<>(children));
// 递归处理子节点
children.forEach(child -> buildSubtree(child, parentCodeMap));
}
}
} }
...@@ -78,7 +78,7 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI ...@@ -78,7 +78,7 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
*/ */
TzBaseEnterpriseInfo selectBySeq(Long sequenceNbr); TzBaseEnterpriseInfo selectBySeq(Long sequenceNbr);
List<CountDto> countByUnitTypeAndOrgCode(@Param("orgCode") String orgCode); List<CountDto> countByUnitTypeAndOrgCode(@Param("orgCode") String orgCode,@Param("cityCode") String cityCode);
List<CountDto> countByUnitTypeAndOrgCodeNoParam(); List<CountDto> countByUnitTypeAndOrgCodeNoParam();
......
...@@ -298,8 +298,8 @@ ...@@ -298,8 +298,8 @@
FROM FROM
"tz_base_enterprise_info" a "tz_base_enterprise_info" a
where where
a.supervise_org_code like concat(#{orgCode},'%') ((a.supervise_org_code != '50' and a.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (a.supervise_org_code = '50' and a.office_region LIKE CONCAT ('%', #{cityCode}, '%')))
group by a.unit_type group by a.unit_type
</select> </select>
<select id="countByUnitTypeAndOrgCodeNoParam" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto"> <select id="countByUnitTypeAndOrgCodeNoParam" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT SELECT
......
...@@ -56,7 +56,9 @@ ...@@ -56,7 +56,9 @@
tz_base_enterprise_info bi tz_base_enterprise_info bi
WHERE WHERE
tui.unit_code = bi.use_code tui.unit_code = bi.use_code
and tui.new_post LIKE concat ('%', #{post}, '%') <if test="post != '' and post != null">
and tui.new_post LIKE concat ('%', #{post}, '%')
</if>
and ((bi.supervise_org_code != '50' and bi.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (bi.supervise_org_code = '50' and bi.office_region LIKE CONCAT ('%', #{regionCode}, '%'))) and ((bi.supervise_org_code != '50' and bi.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (bi.supervise_org_code = '50' and bi.office_region LIKE CONCAT ('%', #{regionCode}, '%')))
and tui.is_delete=false and tui.is_delete=false
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment