Commit 185aa9c4 authored by tianyiming's avatar tianyiming

一码通重构 表单key提交

parent fef2a54e
......@@ -139,11 +139,35 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
private static final String END_CODE = "0000";
//判断行政区划查询街道
private static final String STREET_END_CODE = "00";
//一码通监督管理表单id
private static final String SUPERVISION_FROM_ID = "1627903532906602497";
// 一码通使用信息表单id
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";
......@@ -612,9 +636,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
ResponseModel<Map<String, Map<String, Object>>> responseModel = idxFeignService.getFormRecordById(map);
Map<String, Map<String, Object>> result = responseModel.getResult();
if (!ObjectUtils.isEmpty(map.get(COPY_KEY))) {
result.get(SUPERVISION_FROM_ID).remove("CLAIM_STATUS");
result.get(SUPERVISION_FROM_ID).remove("CODE96333");
result.get(SUPERVISION_FROM_ID).remove("SUPERVISORY_CODE");
result.get(supervision_form_id).remove("CLAIM_STATUS");
result.get(supervision_form_id).remove("CODE96333");
result.get(supervision_form_id).remove("SUPERVISORY_CODE");
}
return result;
}
......@@ -1022,13 +1046,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
stopWatch3.start();
SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo();
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();
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"));
LinkedHashMap supervisionMap = (LinkedHashMap) map.get(supervision_form_id);
try {
LinkedHashMap superviseMap = (LinkedHashMap) map.get("data");
String claimStatus = String.valueOf(superviseMap.get("claimStatus"));
......@@ -1037,61 +1060,63 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//生成码
Map<String, String> codeMap = new HashMap<>();
if (EquipmentCategoryEnum.YRL.getName().equals(claimStatus)) {
log.info("准备生成监管码或96333电梯识别码");
String city = String.valueOf(superviseMap.get("city"));
String county = String.valueOf(superviseMap.get("county"));
String equCategory = String.valueOf(superviseMap.get("equCategory"));
String supervisionCode = String.valueOf(superviseMap.get("supervisionCode"));
EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy();
//生成码
//集群模式使用
RLock lock = redissonClient.getLock(LOCK_KEY);
// lock.lock(); // 获取锁
// log.info("加锁成功");
// log.info("准备生成监管码或96333电梯识别码");
// String city = String.valueOf(superviseMap.get("city"));
// String county = String.valueOf(superviseMap.get("county"));
// String equCategory = String.valueOf(superviseMap.get("equCategory"));
// String supervisionCode = String.valueOf(superviseMap.get("supervisionCode"));
// EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy();
// //生成码
// //集群模式使用
// RLock lock = redissonClient.getLock(LOCK_KEY);
//// lock.lock(); // 获取锁
//// 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);
// log.info("生成码成功");
// log.info("已生成对应监管码或96333电梯识别码");
// flag = true;
// }
// if(flag){
// 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);
log.info("已生成对应监管码或96333电梯识别码");
flag = true;
}
if(flag){
lock.unlock(); // 释放锁
log.info("释放锁");
}
//删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
map.remove("data");
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();
// }
// //删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
// map.remove("data");
// supervisionMap.put("CODE96333", codeMap.get("code96333"));
// supervisionMap.put("SUPERVISORY_CODE", codeMap.get("superviseCode"));
// map.put(supervision_form_id, supervisionMap);
// stopWatch.stop();
// if (log.isInfoEnabled()) {
// log.info("业务调用idx前耗时:{} 秒", stopWatch.getTotalTimeSeconds());
// }
// StopWatch stopWatch1 = new StopWatch();
// stopWatch1.start();
batchSubmit(map);
//根据操作状态判断是调用新增还是修改接口
responseModel = "save".equals(operateType) ? idxFeignService.batchSubmit( null, map) :
idxFeignService.batchUpdate(null, map);
stopWatch1.stop();
if (log.isInfoEnabled()) {
log.info("业务调用idx耗时:{} 秒", stopWatch1.getTotalTimeSeconds());
}
if (!ObjectUtils.isEmpty(responseModel) && "200".equals(String.valueOf(responseModel.getStatus()))) {
supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.YSY.getCode());
} else {
equipmentCategoryMapper.updateIsNotEs(String.valueOf(supervisionMap.get("SUPERVISORY_CODE")));
supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.BF.getCode());
}
// responseModel = "save".equals(operateType) ? batchSubmit(useInfoFrom) :
// idxFeignService.batchUpdate(null, map);
// stopWatch1.stop();
// if (log.isInfoEnabled()) {
// log.info("业务调用idx耗时:{} 秒", stopWatch1.getTotalTimeSeconds());
// }
// if (!ObjectUtils.isEmpty(responseModel) && "200".equals(String.valueOf(responseModel.getStatus()))) {
// supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.YSY.getCode());
// } else {
// equipmentCategoryMapper.updateIsNotEs(String.valueOf(supervisionMap.get("SUPERVISORY_CODE")));
// supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.BF.getCode());
// }
} else if (EquipmentCategoryEnum.DRL.getName().equals(claimStatus)) {
map.remove("data");
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) :
idxFeignService.batchUpdate(null, map);
......@@ -1099,37 +1124,37 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
map.remove("data");
responseModel = idxFeignService.batchUpdate(null, map);
}
StopWatch stopWatch4 = new StopWatch();
stopWatch4.start();
if (!ObjectUtils.isEmpty(responseModel) && "200".equals(String.valueOf(responseModel.getStatus()))) {
log.info("responseModel.getResult().toString()->>>>>>>>>>>>>> {}",responseModel.getResult());
checkEsData(String.valueOf(responseModel.getResult()));
}
stopWatch4.stop();
if (log.isInfoEnabled()) {
log.info("更新es耗时:{} 秒", stopWatch4.getTotalTimeSeconds());
}
stopWatch3.stop();
if (log.isInfoEnabled()) {
log.info("通用提交耗时:{} 秒", stopWatch3.getTotalTimeSeconds());
}
StopWatch stopWatch5 = new StopWatch();
stopWatch5.start();
ExecutorService threadPool = Executors.newCachedThreadPool();
threadPool.submit(new Runnable() {
@Override
public void run() {
log.info("已生成对应监管码" + supervisionMap.get("SUPERVISORY_CODE"));
log.info("已生成对应96333电梯识别码" + supervisionMap.get("CODE96333"));
supervisoryCodeInfoMapper.update(supervisoryCodeInfo, new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisionMap.get("SUPERVISORY_CODE")));
log.info("unitCode-------->>>>>>>>>>{}", unitCode);
updateEquipmentCategoryData(unitCode);
}
});
stopWatch5.stop();
if (log.isInfoEnabled()) {
log.info("异步操作耗时:{} 秒", stopWatch5.getTotalTimeSeconds());
}
// StopWatch stopWatch4 = new StopWatch();
// stopWatch4.start();
// if (!ObjectUtils.isEmpty(responseModel) && "200".equals(String.valueOf(responseModel.getStatus()))) {
// log.info("responseModel.getResult().toString()->>>>>>>>>>>>>> {}",responseModel.getResult());
// checkEsData(String.valueOf(responseModel.getResult()));
// }
// stopWatch4.stop();
// if (log.isInfoEnabled()) {
// log.info("更新es耗时:{} 秒", stopWatch4.getTotalTimeSeconds());
// }
//// stopWatch3.stop();
//// if (log.isInfoEnabled()) {
//// log.info("通用提交耗时:{} 秒", stopWatch3.getTotalTimeSeconds());
//// }
// StopWatch stopWatch5 = new StopWatch();
// stopWatch5.start();
// ExecutorService threadPool = Executors.newCachedThreadPool();
// threadPool.submit(new Runnable() {
// @Override
// public void run() {
// log.info("已生成对应监管码" + supervisionMap.get("SUPERVISORY_CODE"));
// log.info("已生成对应96333电梯识别码" + supervisionMap.get("CODE96333"));
// supervisoryCodeInfoMapper.update(supervisoryCodeInfo, new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisionMap.get("SUPERVISORY_CODE")));
// log.info("unitCode-------->>>>>>>>>>{}", unitCode);
// updateEquipmentCategoryData(unitCode);
// }
// });
// stopWatch5.stop();
// if (log.isInfoEnabled()) {
// log.info("异步操作耗时:{} 秒", stopWatch5.getTotalTimeSeconds());
// }
} catch (Exception e) {
log.error(e.getMessage(), e);
equipmentCategoryMapper.updateIsNotEs(String.valueOf(supervisionMap.get("SUPERVISORY_CODE")));
......@@ -1150,6 +1175,26 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
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) {
......
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