Commit 60b47cbb authored by 刘林's avatar 刘林

fix(jg):设备在流程中添加日志

parent 505579ff
......@@ -42,7 +42,7 @@ public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck {
// 查询当前设备在流程中的申请单号列表
if (equipListOfUsed != null && equipListOfUsed.contains(record)) {
log.error("设备已被其他流程使用,不允许重复提交,设备ID:{}", record);
throw new BadRequest("设备已被其他流程使用,不允许重复提交,请联系管理员!");
throw new BadRequest("该设备已在当前业务流程中使用,不能重复提交,请刷新页面查看单据状态!");
}
setUsingData2Redis(record, companyCode, equipListOfUsed);
} catch (InterruptedException e) {
......
......@@ -232,8 +232,12 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
public List<JgVehicleInformation> save(String submit, JSONObject map) {
log.info("【车用气瓶-提交开始】submit={}, userId={}, carNumber={}, identificationCode={}",
submit, RequestContext.getExeUserId(), map.getString("carNumber"), map.getString("identificationCode"));
try {
if (SUBMIT_TYPE_FLOW.equals(submit)) {
log.info("【车用气瓶-提交类型】流程提交,userId={}, equipmentCount={}",
RequestContext.getExeUserId(), map.getJSONArray("equipmentLists").size());
//校验登记表字段是否有值
JSONArray useRegistrationFormFile = map.getJSONArray("useRegistrationFormFile");
// if (CollUtil.isEmpty(useRegistrationFormFile)) {
......@@ -242,6 +246,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
}
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())) + "", ReginParams.class);
CompanyBo company = reginParams.getCompany();
log.info("【车用气瓶-用户信息】userId={}, companyCode={}, companyType={}",
RequestContext.getExeUserId(), company.getCompanyCode(), company.getCompanyType());
JgVehicleInformationDto vehicleInfoDto = JSON.parseObject(JSON.toJSONString(map), JgVehicleInformationDto.class);
//新增使用登记表字段
......@@ -254,6 +260,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
vehicleInfoDto.setUseRegistrationFormUrl(String.valueOf(vehicle.get("useRegistrationFormUrl")));
}
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists");
log.info("【车用气瓶-设备信息】设备数量={}", equipmentLists != null ? equipmentLists.size() : 0);
if (SUBMIT_TYPE_FLOW.equals(submit)) {
// 不限制一个车只能使用一个充装介质的气瓶
......@@ -262,8 +269,10 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
}
// 检查设备是否已经在使用
// 个人主体的身份证(6600_620422199903010258) 特殊处理 只取_后的身份证号码
log.info("【车用气瓶-设备重复检查】开始检查设备是否在流程中,设备数量={}", equipmentLists.size());
this.repeatUsedEquipCheck(equipmentLists,
CompanyTypeEnum.INDIVIDUAL.getName().equals(company.getCompanyType()) ? company.getCompanyCode().split("_")[1] : company.getCompanyCode());
log.info("【车用气瓶-设备重复检查】检查完成,设备均可使用");
List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = idxBizJgInspectionDetectionInfoService.checkInspectionInfo(
equipmentLists.stream()
.map(v -> (String) v.get("record"))
......@@ -496,21 +505,29 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName(), JSON.parseArray(JSON.toJSONString(equipmentLists)), null, vehicleInformation.getSequenceNbr() + "");
return Collections.singletonList(vehicleInformation);
} catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e);
log.error("【车用气瓶-提交失败】userId={}, error={}", RequestContext.getExeUserId(), e.getMessage(), e);
this.rollBackForDelRedisData();
throw e;
} catch (Exception e) {
log.error(e.getMessage(), e);
log.error("【车用气瓶-提交异常】userId={}, error={}", RequestContext.getExeUserId(), e.getMessage(), e);
this.rollBackForDelRedisData();
throw new BadRequest("保存失败,请检查填写内容或联系管理员!");
} finally {
log.info("【车用气瓶-提交结束】userId={}", RequestContext.getExeUserId());
FlowingEquipRedisContext.clean();
}
}
private void repeatUsedEquipCheck(List<Map<String, Object>> equipList, String companyCode) {
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(DEFINITION_KEY)
.equipRepeatUsedCheck(String.valueOf(equipMap.get("record")), companyCode));
log.info("【车用气瓶-设备重复检查】开始检查{}个设备,companyCode={}", equipList.size(), companyCode);
equipList.forEach(equipMap -> {
String record = String.valueOf(equipMap.get("record"));
log.info("【车用气瓶-设备重复检查】检查设备record={}", record);
EquipUsedCheckStrategyContext.getUsedStrategy(DEFINITION_KEY)
.equipRepeatUsedCheck(record, companyCode);
log.info("【车用气瓶-设备重复检查】设备record={}检查通过", record);
});
log.info("【车用气瓶-设备重复检查】所有设备检查完成");
}
/**
......
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