Commit 185aa9c4 authored by tianyiming's avatar tianyiming

一码通重构 表单key提交

parent fef2a54e
...@@ -139,11 +139,35 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -139,11 +139,35 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
private static final String END_CODE = "0000"; private static final String END_CODE = "0000";
//判断行政区划查询街道 //判断行政区划查询街道
private static final String STREET_END_CODE = "00"; private static final String STREET_END_CODE = "00";
//一码通监督管理表单id // 一码通使用信息表单id
private static final String SUPERVISION_FROM_ID = "1627903532906602497"; private static final String use_info_form_id = "1627903393253056514";
// 一码通监督管理表单id
private static final String supervision_form_id = "1627903532906602497";
// 一码通设计制造表单页id
private static final String design_from_id = "1627897116087050241";
// 一码通检验检测表单页id
private static final String inspection_form_id = "1636282043618848769";
// 一码通施工信息表单页id
private static final String construction_form_id = "1636347672031948801";
// 一码通维保信息表单页id
private static final String maintenance_form_id = "1636347684057018369";
// 一码通注册登记表单页-电梯id
private static final String dt_register_from_id = "1637431088563384322";
// 一码通注册登记表单页-起重机械id
private static final String qzjx_register_from_id = "1635115308320583681";
// 一码通注册登记表单页-锅炉id
private static final String gl_register_from_id = "1631125178945662977";
// 一码通注册登记表单页-游乐设施id
private static final String ylss_register_from_id = "1631125167914643457";
// 一码通注册登记表单页-客运索道id
private static final String kysd_register_from_id = "1631125158229995521";
// 一码通注册登记表单页-压力管道id
private static final String ylgd_register_from_id = "1631125206695178241";
// 一码通注册登记表单页-压力容器id
private static final String ylrq_register_from_id = "1631125198260432897";
// 一码通注册登记表单页-厂车id
private static final String cc_register_from_id = "1631125079347720193";
//一码通使用信息表单id
private static final String USE_INFO_FROM_ID = "1627903393253056514";
//一码通码自动生成 //一码通码自动生成
final static String CREATE = "1"; final static String CREATE = "1";
...@@ -612,9 +636,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -612,9 +636,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
ResponseModel<Map<String, Map<String, Object>>> responseModel = idxFeignService.getFormRecordById(map); ResponseModel<Map<String, Map<String, Object>>> responseModel = idxFeignService.getFormRecordById(map);
Map<String, Map<String, Object>> result = responseModel.getResult(); Map<String, Map<String, Object>> result = responseModel.getResult();
if (!ObjectUtils.isEmpty(map.get(COPY_KEY))) { if (!ObjectUtils.isEmpty(map.get(COPY_KEY))) {
result.get(SUPERVISION_FROM_ID).remove("CLAIM_STATUS"); result.get(supervision_form_id).remove("CLAIM_STATUS");
result.get(SUPERVISION_FROM_ID).remove("CODE96333"); result.get(supervision_form_id).remove("CODE96333");
result.get(SUPERVISION_FROM_ID).remove("SUPERVISORY_CODE"); result.get(supervision_form_id).remove("SUPERVISORY_CODE");
} }
return result; return result;
} }
...@@ -1022,13 +1046,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1022,13 +1046,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
stopWatch3.start(); stopWatch3.start();
SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo(); SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo();
ResponseModel responseModel = new ResponseModel(); ResponseModel responseModel = new ResponseModel();
LinkedHashMap useInfoFrom = (LinkedHashMap) map.get(USE_INFO_FROM_ID); LinkedHashMap useInfoFrom = (LinkedHashMap) map.get(use_info_form_id);
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
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); LinkedHashMap supervisionMap = (LinkedHashMap) map.get(supervision_form_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"));
...@@ -1037,61 +1060,63 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1037,61 +1060,63 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//生成码 //生成码
Map<String, String> codeMap = new HashMap<>(); Map<String, String> codeMap = new HashMap<>();
if (EquipmentCategoryEnum.YRL.getName().equals(claimStatus)) { if (EquipmentCategoryEnum.YRL.getName().equals(claimStatus)) {
log.info("准备生成监管码或96333电梯识别码"); // log.info("准备生成监管码或96333电梯识别码");
String city = String.valueOf(superviseMap.get("city")); // String city = String.valueOf(superviseMap.get("city"));
String county = String.valueOf(superviseMap.get("county")); // String county = String.valueOf(superviseMap.get("county"));
String equCategory = String.valueOf(superviseMap.get("equCategory")); // String equCategory = String.valueOf(superviseMap.get("equCategory"));
String supervisionCode = String.valueOf(superviseMap.get("supervisionCode")); // String supervisionCode = String.valueOf(superviseMap.get("supervisionCode"));
EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy(); // EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy();
//生成码 // //生成码
//集群模式使用 // //集群模式使用
RLock lock = redissonClient.getLock(LOCK_KEY); // RLock lock = redissonClient.getLock(LOCK_KEY);
// lock.lock(); // 获取锁 //// lock.lock(); // 获取锁
// log.info("加锁成功"); //// log.info("加锁成功");
//// codeMap = categoryService.creatCode(city, county, equCategory, code96333, supervisionCode);
//// log.info("生成码成功");
//// lock.unlock(); // 释放锁
//// log.info("释放锁");
//// log.info("已生成对应监管码或96333电梯识别码");
// //单机模式使用
// boolean flag = false;
// if (lock.tryLock(3, 100, TimeUnit.SECONDS)) {
// codeMap = categoryService.creatCode(city, county, equCategory, code96333, supervisionCode); // codeMap = categoryService.creatCode(city, county, equCategory, code96333, supervisionCode);
// log.info("生成码成功"); // log.info("已生成对应监管码或96333电梯识别码");
// flag = true;
// }
// if(flag){
// lock.unlock(); // 释放锁 // lock.unlock(); // 释放锁
// log.info("释放锁"); // log.info("释放锁");
// log.info("已生成对应监管码或96333电梯识别码"); // }
//单机模式使用 // //删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
boolean flag = false; // map.remove("data");
if (lock.tryLock(3, 100, TimeUnit.SECONDS)) { // supervisionMap.put("CODE96333", codeMap.get("code96333"));
codeMap = categoryService.creatCode(city, county, equCategory, code96333, supervisionCode); // supervisionMap.put("SUPERVISORY_CODE", codeMap.get("superviseCode"));
log.info("已生成对应监管码或96333电梯识别码"); // map.put(supervision_form_id, supervisionMap);
flag = true; // stopWatch.stop();
} // if (log.isInfoEnabled()) {
if(flag){ // log.info("业务调用idx前耗时:{} 秒", stopWatch.getTotalTimeSeconds());
lock.unlock(); // 释放锁 // }
log.info("释放锁"); // StopWatch stopWatch1 = new StopWatch();
} // stopWatch1.start();
//删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
map.remove("data"); batchSubmit(map);
supervisionMap.put("CODE96333", codeMap.get("code96333"));
supervisionMap.put("SUPERVISORY_CODE", codeMap.get("superviseCode"));
map.put(SUPERVISION_FROM_ID, supervisionMap);
stopWatch.stop();
if (log.isInfoEnabled()) {
log.info("业务调用idx前耗时:{} 秒", stopWatch.getTotalTimeSeconds());
}
StopWatch stopWatch1 = new StopWatch();
stopWatch1.start();
//根据操作状态判断是调用新增还是修改接口 //根据操作状态判断是调用新增还是修改接口
responseModel = "save".equals(operateType) ? idxFeignService.batchSubmit( null, map) : // responseModel = "save".equals(operateType) ? batchSubmit(useInfoFrom) :
idxFeignService.batchUpdate(null, map); // idxFeignService.batchUpdate(null, map);
stopWatch1.stop(); // stopWatch1.stop();
if (log.isInfoEnabled()) { // if (log.isInfoEnabled()) {
log.info("业务调用idx耗时:{} 秒", stopWatch1.getTotalTimeSeconds()); // log.info("业务调用idx耗时:{} 秒", stopWatch1.getTotalTimeSeconds());
} // }
if (!ObjectUtils.isEmpty(responseModel) && "200".equals(String.valueOf(responseModel.getStatus()))) { // if (!ObjectUtils.isEmpty(responseModel) && "200".equals(String.valueOf(responseModel.getStatus()))) {
supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.YSY.getCode()); // supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.YSY.getCode());
} else { // } else {
equipmentCategoryMapper.updateIsNotEs(String.valueOf(supervisionMap.get("SUPERVISORY_CODE"))); // equipmentCategoryMapper.updateIsNotEs(String.valueOf(supervisionMap.get("SUPERVISORY_CODE")));
supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.BF.getCode()); // supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.BF.getCode());
} // }
} else if (EquipmentCategoryEnum.DRL.getName().equals(claimStatus)) { } else if (EquipmentCategoryEnum.DRL.getName().equals(claimStatus)) {
map.remove("data"); map.remove("data");
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_form_id, supervisionMap);
//根据操作状态判断是调用新增还是修改接口 //根据操作状态判断是调用新增还是修改接口
responseModel = "save".equals(operateType) ? idxFeignService.batchSubmit(null, map) : responseModel = "save".equals(operateType) ? idxFeignService.batchSubmit(null, map) :
idxFeignService.batchUpdate(null, map); idxFeignService.batchUpdate(null, map);
...@@ -1099,37 +1124,37 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1099,37 +1124,37 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
map.remove("data"); map.remove("data");
responseModel = idxFeignService.batchUpdate(null, map); responseModel = idxFeignService.batchUpdate(null, map);
} }
StopWatch stopWatch4 = new StopWatch(); // StopWatch stopWatch4 = new StopWatch();
stopWatch4.start(); // stopWatch4.start();
if (!ObjectUtils.isEmpty(responseModel) && "200".equals(String.valueOf(responseModel.getStatus()))) { // if (!ObjectUtils.isEmpty(responseModel) && "200".equals(String.valueOf(responseModel.getStatus()))) {
log.info("responseModel.getResult().toString()->>>>>>>>>>>>>> {}",responseModel.getResult()); // log.info("responseModel.getResult().toString()->>>>>>>>>>>>>> {}",responseModel.getResult());
checkEsData(String.valueOf(responseModel.getResult())); // checkEsData(String.valueOf(responseModel.getResult()));
} // }
stopWatch4.stop(); // stopWatch4.stop();
if (log.isInfoEnabled()) { // if (log.isInfoEnabled()) {
log.info("更新es耗时:{} 秒", stopWatch4.getTotalTimeSeconds()); // log.info("更新es耗时:{} 秒", stopWatch4.getTotalTimeSeconds());
} // }
stopWatch3.stop(); //// stopWatch3.stop();
if (log.isInfoEnabled()) { //// if (log.isInfoEnabled()) {
log.info("通用提交耗时:{} 秒", stopWatch3.getTotalTimeSeconds()); //// log.info("通用提交耗时:{} 秒", stopWatch3.getTotalTimeSeconds());
} //// }
StopWatch stopWatch5 = new StopWatch(); // StopWatch stopWatch5 = new StopWatch();
stopWatch5.start(); // stopWatch5.start();
ExecutorService threadPool = Executors.newCachedThreadPool(); // ExecutorService threadPool = Executors.newCachedThreadPool();
threadPool.submit(new Runnable() { // threadPool.submit(new Runnable() {
@Override // @Override
public void run() { // public void run() {
log.info("已生成对应监管码" + supervisionMap.get("SUPERVISORY_CODE")); // log.info("已生成对应监管码" + supervisionMap.get("SUPERVISORY_CODE"));
log.info("已生成对应96333电梯识别码" + supervisionMap.get("CODE96333")); // log.info("已生成对应96333电梯识别码" + supervisionMap.get("CODE96333"));
supervisoryCodeInfoMapper.update(supervisoryCodeInfo, new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisionMap.get("SUPERVISORY_CODE"))); // supervisoryCodeInfoMapper.update(supervisoryCodeInfo, new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisionMap.get("SUPERVISORY_CODE")));
log.info("unitCode-------->>>>>>>>>>{}", unitCode); // log.info("unitCode-------->>>>>>>>>>{}", unitCode);
updateEquipmentCategoryData(unitCode); // updateEquipmentCategoryData(unitCode);
} // }
}); // });
stopWatch5.stop(); // stopWatch5.stop();
if (log.isInfoEnabled()) { // if (log.isInfoEnabled()) {
log.info("异步操作耗时:{} 秒", stopWatch5.getTotalTimeSeconds()); // log.info("异步操作耗时:{} 秒", stopWatch5.getTotalTimeSeconds());
} // }
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
equipmentCategoryMapper.updateIsNotEs(String.valueOf(supervisionMap.get("SUPERVISORY_CODE"))); equipmentCategoryMapper.updateIsNotEs(String.valueOf(supervisionMap.get("SUPERVISORY_CODE")));
...@@ -1150,6 +1175,26 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1150,6 +1175,26 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return responseModel; return responseModel;
} }
@Autowired
IdxBizJgUseInfoServiceImpl idxBizJgUseInfoService;
private boolean batchSubmit(Map<String, Object> map) {
boolean flag = false ;
//使用UUID生成一个record,多表关联关系用
String record = UUID.randomUUID().toString();
LinkedHashMap useInfoFrom = (LinkedHashMap) map.get(use_info_form_id);
IdxBizJgUseInfo useInfo = JSON.parseObject(JSON.toJSONString(useInfoFrom), IdxBizJgUseInfo.class);
useInfo.setRecord(record);
Calendar calendar = Calendar.getInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
useInfo.setRecDate(calendar.getTime());
idxBizJgUseInfoService.save(useInfo);
System.out.println(useInfo);
return flag;
}
//分页查询所有数据 //分页查询所有数据
public Page<Map<String, Object>> getAll(Map<String, Object> map) { public Page<Map<String, Object>> getAll(Map<String, Object> map) {
......
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