Commit 67e42fa4 authored by tianyiming's avatar tianyiming

一码通0629版本

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