Commit 67e42fa4 authored by tianyiming's avatar tianyiming

一码通0629版本

parent fe6841ae
...@@ -12,6 +12,11 @@ public class UseUnitCreditCodeCategoryDto { ...@@ -12,6 +12,11 @@ public class UseUnitCreditCodeCategoryDto {
* 使用单位编码 * 使用单位编码
*/ */
private String useUnitCreditCode; private String useUnitCreditCode;
/**
* 管辖机构编码
*/
private String orgBranchCode;
/** /**
* 状态 * 状态
*/ */
......
...@@ -37,7 +37,7 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> { ...@@ -37,7 +37,7 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
Map<String, Object> getCategoryAndDefineByRecord(@Param("record") String record); Map<String, Object> getCategoryAndDefineByRecord(@Param("record") String record);
List<Map<String, Object>> getAllUnit(@Param("unitCodes")List<String> unitCodes); List<Map<String, Object>> getAllUnit(@Param("unitCodes")List<String> unitCodes,@Param("orgBranchCodes")List<String> orgBranchCodes);
List<Map<String, Object>> getCategoryData(String level, String orgCode, String companyCode); List<Map<String, Object>> getCategoryData(String level, String orgCode, String companyCode);
......
...@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.SuperviseInfo; ...@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.SuperviseInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 特种设备基本信息-监督管理信息 Mapper 接口 * 特种设备基本信息-监督管理信息 Mapper 接口
...@@ -16,7 +17,7 @@ public interface SuperviseInfoMapper extends BaseMapper<SuperviseInfo> { ...@@ -16,7 +17,7 @@ public interface SuperviseInfoMapper extends BaseMapper<SuperviseInfo> {
void updateRecordBatch(@Param("recordList") List<String> recordList); void updateRecordBatch(@Param("recordList") List<String> recordList);
List<String> selectUnitCodeList(@Param("records") List<String> records); List<Map<String,Object>> selectUnitCodeList(@Param("records") List<String> records);
List<String> selectSuperviseCodeList(@Param("records") List<String> records); List<String> selectSuperviseCodeList(@Param("records") List<String> records);
void deleteDataAll(@Param("records") List<String> records); void deleteDataAll(@Param("records") List<String> records);
......
...@@ -129,22 +129,27 @@ ...@@ -129,22 +129,27 @@
<select id="getAllUnit" resultType="java.util.Map"> <select id="getAllUnit" resultType="java.util.Map">
SELECT SELECT
DISTINCT (USE_UNIT_CREDIT_CODE) use_code, ibjui.USE_UNIT_CREDIT_CODE use_code,
ifnull(ORG_BRANCH_CODE,50) supervise_org_code ibjsi.ORG_BRANCH_CODE supervise_org_code
FROM FROM
idx_biz_jg_use_info ibjui idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjui."RECORD" = ibjsi."RECORD" LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjui."RECORD" = ibjsi."RECORD"
WHERE WHERE
USE_UNIT_CREDIT_CODE <![CDATA[ <> ]]> '' ibjui.USE_UNIT_CREDIT_CODE <![CDATA[ <> ]]> ''
AND (lengthb(USE_UNIT_CREDIT_CODE)= 15 or lengthb(USE_UNIT_CREDIT_CODE)= 18) AND (lengthb(ibjui.USE_UNIT_CREDIT_CODE)= 15 or lengthb(ibjui.USE_UNIT_CREDIT_CODE)= 18)
<if test="unitCodes !=null and unitCodes.size>0"> <if test="unitCodes !=null and unitCodes.size>0">
and USE_UNIT_CREDIT_CODE in and ibjui.USE_UNIT_CREDIT_CODE in
<foreach collection="unitCodes" separator="," item="unitCode" open="(" close=")"> <foreach collection="unitCodes" separator="," item="unitCode" open="(" close=")">
#{unitCode} #{unitCode}
</foreach> </foreach>
</if> </if>
GROUP BY use_code <if test="orgBranchCodes !=null and orgBranchCodes.size>0">
ORDER BY use_code and ibjsi.ORG_BRANCH_CODE in
<foreach collection="orgBranchCodes" separator="," item="orgBranchCode" open="(" close=")">
#{orgBranchCode}
</foreach>
</if>
GROUP BY use_code,supervise_org_code
</select> </select>
<select id="getCategoryData" resultType="java.util.Map"> <select id="getCategoryData" resultType="java.util.Map">
...@@ -301,6 +306,7 @@ ...@@ -301,6 +306,7 @@
<select id="useUnitCreditCodeCategoryCount" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.UseUnitCreditCodeCategoryDto"> <select id="useUnitCreditCodeCategoryCount" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.UseUnitCreditCodeCategoryDto">
SELECT SELECT
ibjsi."ORG_BRANCH_CODE",
ibjui."USE_UNIT_CREDIT_CODE", ibjui."USE_UNIT_CREDIT_CODE",
ibjoi."CLAIM_STATUS", ibjoi."CLAIM_STATUS",
ibjri."EQU_LIST", ibjri."EQU_LIST",
...@@ -309,11 +315,11 @@ ...@@ -309,11 +315,11 @@
idx_biz_jg_use_info ibjui idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_register_info ibjri ON ibjui.RECORD = ibjri.RECORD LEFT JOIN idx_biz_jg_register_info ibjri ON ibjui.RECORD = ibjri.RECORD
LEFT JOIN idx_biz_jg_other_info ibjoi ON ibjui.RECORD = ibjoi.RECORD LEFT JOIN idx_biz_jg_other_info ibjoi ON ibjui.RECORD = ibjoi.RECORD
LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjsi."RECORD" = ibjui."RECORD"
where where
ibjoi."CLAIM_STATUS" <![CDATA[ <> ]]> '' ibjoi."CLAIM_STATUS" <![CDATA[ <> ]]> ''
and ibjui."USE_UNIT_CREDIT_CODE" <![CDATA[ <> ]]> '' and ibjui."USE_UNIT_CREDIT_CODE" <![CDATA[ <> ]]> ''
and ibjri."EQU_LIST" <![CDATA[ <> ]]> '' and ibjri."EQU_LIST" <![CDATA[ <> ]]> ''
GROUP BY ibjui."USE_UNIT_CREDIT_CODE", ibjoi."CLAIM_STATUS",ibjri."EQU_LIST" GROUP BY ibjui."USE_UNIT_CREDIT_CODE",ibjsi."ORG_BRANCH_CODE", ibjoi."CLAIM_STATUS",ibjri."EQU_LIST"
ORDER BY ibjui."USE_UNIT_CREDIT_CODE"
</select> </select>
</mapper> </mapper>
...@@ -9,15 +9,18 @@ ...@@ -9,15 +9,18 @@
</foreach> </foreach>
</update> </update>
<select id="selectUnitCodeList" resultType="java.lang.String"> <select id="selectUnitCodeList" resultType="java.util.Map">
SELECT SELECT
DISTINCT ( USE_UNIT_CREDIT_CODE ) unitCode ui."USE_UNIT_CREDIT_CODE" unitCode,
si."ORG_BRANCH_CODE" orgBranchCode
FROM FROM
idx_biz_jg_use_info ui idx_biz_jg_use_info ui
left join idx_biz_jg_supervision_info si ON ui."RECORD" = si."RECORD"
WHERE ui."RECORD" in WHERE ui."RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=")"> <foreach collection="records" separator="," item="record" open="(" close=")">
#{record} #{record}
</foreach> </foreach>
GROUP BY unitCode,orgBranchCode
</select> </select>
<select id="selectSuperviseCodeList" resultType="java.lang.String"> <select id="selectSuperviseCodeList" resultType="java.lang.String">
......
...@@ -164,6 +164,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -164,6 +164,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
private static String USE_CODE = "use_code"; private static String USE_CODE = "use_code";
private static String ORG_BRANCH_CODE = "supervise_org_code";
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -497,6 +499,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -497,6 +499,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
categoryOtherInfo = categoryOtherInfoMapper.selectElevatorCode(prefix, EquipmentCategoryEnum.WSY.getCode()); categoryOtherInfo = categoryOtherInfoMapper.selectElevatorCode(prefix, EquipmentCategoryEnum.WSY.getCode());
//如果存在未使用的电梯码则启用未使用的否则创建 //如果存在未使用的电梯码则启用未使用的否则创建
String elevator = ObjectUtils.isEmpty(categoryOtherInfo) ? createElevatorCode(city, county) : categoryOtherInfo.getCode(); String elevator = ObjectUtils.isEmpty(categoryOtherInfo) ? createElevatorCode(city, county) : categoryOtherInfo.getCode();
if(!ObjectUtils.isEmpty(categoryOtherInfo)){
supervisoryCodeInfoMapper.delete(new QueryWrapper<SupervisoryCodeInfo>().eq("code96333",categoryOtherInfo.getCode()));
}
elevatorCode.append(elevator); elevatorCode.append(elevator);
resultMap.put("creatStatus",CREATE); resultMap.put("creatStatus",CREATE);
} else { } else {
...@@ -831,15 +836,15 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -831,15 +836,15 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
log.info("初始化一码通总览数据开始"); log.info("初始化一码通总览数据开始");
} }
equipmentCategoryDataService.remove(new QueryWrapper<>()); equipmentCategoryDataService.remove(new QueryWrapper<>());
getCategoryData(null); getCategoryData(null,null);
} }
private List<EquipmentCategoryData> getCategoryData(List<String> unitCodes) { private List<EquipmentCategoryData> getCategoryData(List<String> unitCodes,List<String> orgBranchCodes) {
StopWatch stopWatch = new StopWatch(); StopWatch stopWatch = new StopWatch();
stopWatch.start(); stopWatch.start();
List<EquipmentCategoryData> list = new ArrayList<>(); List<EquipmentCategoryData> list = new ArrayList<>();
// 查询所有单位 // 查询所有单位
List<Map<String, Object>> allUnitList = equipmentCategoryMapper.getAllUnit(unitCodes); List<Map<String, Object>> allUnitList = equipmentCategoryMapper.getAllUnit(unitCodes,orgBranchCodes);
// 统计查询不同单位、不同装备定义、不同状态下的设备数量 // 统计查询不同单位、不同装备定义、不同状态下的设备数量
List<UseUnitCreditCodeCategoryDto> equipCountList = equipmentCategoryMapper.useUnitCreditCodeCategoryCount(); List<UseUnitCreditCodeCategoryDto> equipCountList = equipmentCategoryMapper.useUnitCreditCodeCategoryCount();
// 查询8大类设备定义 // 查询8大类设备定义
...@@ -854,6 +859,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -854,6 +859,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
equipmentCategoryData.setUnitCode(map.get(USE_CODE).toString()); equipmentCategoryData.setUnitCode(map.get(USE_CODE).toString());
// 指定单位的设备统计信息 // 指定单位的设备统计信息
List<UseUnitCreditCodeCategoryDto> unitEquipCountList = equipCountList.stream().filter(r->r.getUseUnitCreditCode().equals(map.get(USE_CODE).toString())).collect(Collectors.toList()); List<UseUnitCreditCodeCategoryDto> unitEquipCountList = equipCountList.stream().filter(r->r.getUseUnitCreditCode().equals(map.get(USE_CODE).toString())).collect(Collectors.toList());
unitEquipCountList = unitEquipCountList.stream().filter(r->r.getOrgBranchCode().equals(map.get(ORG_BRANCH_CODE).toString())).collect(Collectors.toList());
for (EquipmentCategory category : equipmentCategories) { for (EquipmentCategory category : equipmentCategories) {
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("waitClaim", unitEquipCountList.stream().filter(r->r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.DRL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum()); data.put("waitClaim", unitEquipCountList.stream().filter(r->r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.DRL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum());
...@@ -869,7 +875,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -869,7 +875,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} else { } else {
for (EquipmentCategoryData equipmentCategoryData : list) { for (EquipmentCategoryData equipmentCategoryData : list) {
equipmentCategoryDataService.update(equipmentCategoryData, equipmentCategoryDataService.update(equipmentCategoryData,
new QueryWrapper<EquipmentCategoryData>().eq("unit_code", equipmentCategoryData.getUnitCode())); new QueryWrapper<EquipmentCategoryData>().eq("unit_code", equipmentCategoryData.getUnitCode()).eq("org_branch_code",equipmentCategoryData.getOrgBranchCode()));
} }
} }
stopWatch.stop(); stopWatch.stop();
...@@ -920,10 +926,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -920,10 +926,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
private EquipmentCategoryData updateEquipmentCategoryData(String unitCode) { private EquipmentCategoryData updateEquipmentCategoryData(String unitCode,String orgBranchCode) {
List<String> unitCodeList = new ArrayList<>(); List<String> unitCodeList = new ArrayList<>();
unitCodeList.add(unitCode); unitCodeList.add(unitCode);
List<EquipmentCategoryData> equipmentCategoryData = getCategoryData(unitCodeList); List<String> orgBranchCodeList = new ArrayList<>();
orgBranchCodeList.add(orgBranchCode);
List<EquipmentCategoryData> equipmentCategoryData = getCategoryData(unitCodeList,orgBranchCodeList);
return equipmentCategoryData.get(0); return equipmentCategoryData.get(0);
} }
...@@ -949,7 +957,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -949,7 +957,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
//删除监管码表数据 //删除监管码表数据
List<String> superviseCodeList = superviseInfoMapper.selectSuperviseCodeList(records); List<String> superviseCodeList = superviseInfoMapper.selectSuperviseCodeList(records);
List<String> unitCodeList = superviseInfoMapper.selectUnitCodeList(records); List<Map<String, Object>> unitCodeAndOrgBranchCodeList = superviseInfoMapper.selectUnitCodeList(records);
List<String> unitCodeList = new ArrayList<>();
List<String> orgBranchCodeList = new ArrayList<>();
for (Map<String, Object> objectMap : unitCodeAndOrgBranchCodeList) {
unitCodeList.add(String.valueOf(objectMap.get("unitCode")));
orgBranchCodeList.add(String.valueOf(objectMap.get("orgBranchCode")));
}
if(!ObjectUtils.isEmpty(superviseCodeList)){ if(!ObjectUtils.isEmpty(superviseCodeList)){
supervisoryCodeInfoMapper.updateStatus(superviseCodeList); supervisoryCodeInfoMapper.updateStatus(superviseCodeList);
} }
...@@ -958,7 +973,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -958,7 +973,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
superviseInfoMapper.deleteDataAll(records); superviseInfoMapper.deleteDataAll(records);
// 根据统一信用代码更新总览表 // 根据统一信用代码更新总览表
if(!ObjectUtils.isEmpty(unitCodeList)){ if(!ObjectUtils.isEmpty(unitCodeList)){
getCategoryData(unitCodeList); getCategoryData(unitCodeList,orgBranchCodeList);
} }
//删除es中的数据 //删除es中的数据
esEquipmentCategory.deleteAll(list); esEquipmentCategory.deleteAll(list);
...@@ -977,6 +992,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -977,6 +992,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
useInfoFrom.put("REC_DATE", dateFormat.format(calendar.getTime())); useInfoFrom.put("REC_DATE", dateFormat.format(calendar.getTime()));
String unitCode = String.valueOf(useInfoFrom.get("USE_UNIT_CREDIT_CODE")); String unitCode = String.valueOf(useInfoFrom.get("USE_UNIT_CREDIT_CODE"));
LinkedHashMap supervisionMap = (LinkedHashMap) map.get(SUPERVISION_FROM_ID);
String orgBranchCode = String.valueOf(supervisionMap.get("ORG_BRANCH_CODE"));
try { try {
LinkedHashMap superviseMap = (LinkedHashMap) map.get("data"); LinkedHashMap superviseMap = (LinkedHashMap) map.get("data");
String claimStatus = String.valueOf(superviseMap.get("claimStatus")); String claimStatus = String.valueOf(superviseMap.get("claimStatus"));
...@@ -995,7 +1012,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -995,7 +1012,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
log.info("已生成对应监管码或96333电梯识别码"); log.info("已生成对应监管码或96333电梯识别码");
//删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据 //删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
map.remove("data"); map.remove("data");
LinkedHashMap supervisionMap = (LinkedHashMap) map.get(SUPERVISION_FROM_ID);
supervisionMap.put("CODE96333", codeMap.get("code96333")); supervisionMap.put("CODE96333", codeMap.get("code96333"));
supervisionMap.put("SUPERVISORY_CODE", codeMap.get("superviseCode")); supervisionMap.put("SUPERVISORY_CODE", codeMap.get("superviseCode"));
map.put(SUPERVISION_FROM_ID, supervisionMap); map.put(SUPERVISION_FROM_ID, supervisionMap);
...@@ -1009,7 +1025,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1009,7 +1025,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
} else if (EquipmentCategoryEnum.DRL.getName().equals(claimStatus)) { } else if (EquipmentCategoryEnum.DRL.getName().equals(claimStatus)) {
map.remove("data"); map.remove("data");
LinkedHashMap supervisionMap = (LinkedHashMap) map.get(SUPERVISION_FROM_ID);
supervisionMap.put("CODE96333", "null".equals(code96333) ? null : code96333); supervisionMap.put("CODE96333", "null".equals(code96333) ? null : code96333);
map.put(SUPERVISION_FROM_ID, supervisionMap); map.put(SUPERVISION_FROM_ID, supervisionMap);
//根据操作状态判断是调用新增还是修改接口 //根据操作状态判断是调用新增还是修改接口
...@@ -1033,7 +1048,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1033,7 +1048,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
response.setStatus(HttpStatus.BAD_REQUEST.value()); response.setStatus(HttpStatus.BAD_REQUEST.value());
return response; return response;
} finally { } finally {
updateEquipmentCategoryData(unitCode); updateEquipmentCategoryData(unitCode,orgBranchCode);
supervisoryCodeInfoMapper.update(supervisoryCodeInfo,new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",supervisoryCodeInfo.getSupervisoryCode())); supervisoryCodeInfoMapper.update(supervisoryCodeInfo,new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",supervisoryCodeInfo.getSupervisoryCode()));
} }
return responseModel; return responseModel;
......
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