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.问题统计
......
...@@ -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