Commit ca423e6f authored by 刘林's avatar 刘林

fix(JG):四个告知添加状态校验

parent 87e02122
...@@ -1437,4 +1437,16 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1437,4 +1437,16 @@ public class CommonServiceImpl implements ICommonService {
} }
return null; return null;
} }
/**
* 检查实际状态是否不等于期望状态
* @param latestStatus 业务最新状态
*/
public void checkExpectedStatus(String latestStatus){
String expectedStatus = String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode());
// 检查实际状态是否不等于期望状态
if (!expectedStatus.equals(latestStatus)) {
throw new BadRequest("当前业务状态已更新,请返回工作台后重新打开!");
}
}
} }
\ No newline at end of file
...@@ -780,11 +780,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -780,11 +780,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@Transactional @Transactional
public void cancel(JgInstallationNoticeDto noticeDto) { public void cancel(JgInstallationNoticeDto noticeDto) {
JgInstallationNotice jgInstallationNotice = this.baseMapper.selectById(noticeDto.getSequenceNbr()); JgInstallationNotice jgInstallationNotice = this.baseMapper.selectById(noticeDto.getSequenceNbr());
String expectedStatus = String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode());
// 检查实际状态是否不等于期望状态 // 检查实际状态是否不等于期望状态
if (!expectedStatus.equals(jgInstallationNotice.getNoticeStatus())) { commonService.checkExpectedStatus(jgInstallationNotice.getNoticeStatus());
throw new BadRequest("当前业务状态不是待处理状态,请重新打开页面后操作!");
}
ProcessTaskDTO processTaskDTO = iCmWorkflowService.rollBack(jgInstallationNotice.getInstanceId()); ProcessTaskDTO processTaskDTO = iCmWorkflowService.rollBack(jgInstallationNotice.getInstanceId());
// 提取节点等信息 // 提取节点等信息
...@@ -810,9 +807,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -810,9 +807,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
public void accept(JgInstallationNoticeDto dto,String op) { public void accept(JgInstallationNoticeDto dto,String op) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
JgInstallationNotice jgInstallationNotice = this.getById(dto.getSequenceNbr()); JgInstallationNotice jgInstallationNotice = this.getById(dto.getSequenceNbr());
// 检查实际状态是否不等于期望状态
commonService.checkExpectedStatus(jgInstallationNotice.getNoticeStatus());
jgInstallationNotice.setProcessAdvice(dto.getProcessAdvice()); jgInstallationNotice.setProcessAdvice(dto.getProcessAdvice());
// 组装设备注册代码 // 组装设备注册代码
StringBuffer stringBuffer = new StringBuffer(); StringBuilder stringBuffer = new StringBuilder();
String ym = null; String ym = null;
try { try {
ym = DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM); ym = DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM);
......
...@@ -676,11 +676,8 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -676,11 +676,8 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
public void cancel(JgMaintainNoticeDto noticeDto) { public void cancel(JgMaintainNoticeDto noticeDto) {
JgMaintainNotice jgMaintainNotice = this.baseMapper.selectById(noticeDto.getSequenceNbr()); JgMaintainNotice jgMaintainNotice = this.baseMapper.selectById(noticeDto.getSequenceNbr());
String expectedStatus = String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode());
// 检查实际状态是否不等于期望状态 // 检查实际状态是否不等于期望状态
if (!expectedStatus.equals(jgMaintainNotice.getNoticeStatus())) { commonService.checkExpectedStatus(jgMaintainNotice.getNoticeStatus());
throw new BadRequest("当前业务状态不是待处理状态,请重新打开页面后操作!");
}
ProcessTaskDTO processTaskDTO = cmWorkflowService.rollBack(jgMaintainNotice.getInstanceId()); ProcessTaskDTO processTaskDTO = cmWorkflowService.rollBack(jgMaintainNotice.getInstanceId());
// 提取节点等信息 // 提取节点等信息
WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0); WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
...@@ -704,8 +701,12 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -704,8 +701,12 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@Transactional @Transactional
public void accept(JgMaintainNoticeDto dto, String op, String opinion) { public void accept(JgMaintainNoticeDto dto, String op, String opinion) {
JgMaintainNotice jgMaintainNotice = this.jgMaintainNoticeMapper.selectById(dto.getSequenceNbr()); JgMaintainNotice jgMaintainNotice = this.jgMaintainNoticeMapper.selectById(dto.getSequenceNbr());
// 检查实际状态是否不等于期望状态
commonService.checkExpectedStatus(jgMaintainNotice.getNoticeStatus());
// 组装设备注册代码 // 组装设备注册代码
StringBuffer stringBuffer = new StringBuffer(); StringBuilder stringBuffer = new StringBuilder();
String ym = null; String ym = null;
try { try {
ym = DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM); ym = DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM);
......
...@@ -639,11 +639,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -639,11 +639,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
JgReformNotice notice = baseMapper.selectById(noticeDto.getSequenceNbr()); JgReformNotice notice = baseMapper.selectById(noticeDto.getSequenceNbr());
if (notice != null) { if (notice != null) {
String expectedStatus = String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode());
// 检查实际状态是否不等于期望状态 // 检查实际状态是否不等于期望状态
if (!expectedStatus.equals(notice.getNoticeStatus())) { commonService.checkExpectedStatus(notice.getNoticeStatus());
throw new BadRequest("当前业务状态不是待处理状态,请重新打开页面后操作!");
}
// 回滚工作流 // 回滚工作流
ProcessTaskDTO processTaskDTO = cmWorkflowService.rollBack(noticeDto.getInstanceId()); ProcessTaskDTO processTaskDTO = cmWorkflowService.rollBack(noticeDto.getInstanceId());
WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0); WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
...@@ -672,6 +669,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -672,6 +669,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
public void accept(JgReformNoticeDto dto, String op) { public void accept(JgReformNoticeDto dto, String op) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
JgReformNotice jgReformNotice = baseMapper.selectById(dto.getSequenceNbr()); JgReformNotice jgReformNotice = baseMapper.selectById(dto.getSequenceNbr());
// 检查实际状态是否不等于期望状态
commonService.checkExpectedStatus(jgReformNotice.getNoticeStatus());
jgReformNotice.setCreateUserCompanyName(reginParams.getCompany().getCompanyName()); jgReformNotice.setCreateUserCompanyName(reginParams.getCompany().getCompanyName());
// 组装设备注册代码 // 组装设备注册代码
StringBuilder stringBuffer = new StringBuilder(); StringBuilder stringBuffer = new StringBuilder();
......
...@@ -45,7 +45,6 @@ import org.springframework.util.StringUtils; ...@@ -45,7 +45,6 @@ import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.ParseException; import java.text.ParseException;
import java.util.*; import java.util.*;
...@@ -69,15 +68,9 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -69,15 +68,9 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
@Autowired @Autowired
JgTransferNoticeEqMapper jgTransferNoticeEqMapper; JgTransferNoticeEqMapper jgTransferNoticeEqMapper;
@Autowired @Autowired
private JgTransferNoticeMapper jgTransferNoticeMapper;
@Autowired
RegistrationInfoMapper tzsJgRegistrationInfoMapper; RegistrationInfoMapper tzsJgRegistrationInfoMapper;
@Autowired @Autowired
IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoService; IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoService;
@Autowired
private CommonServiceImpl commonService;
@Autowired @Autowired
OtherInfoMapper tzsJgOtherInfoMapper; OtherInfoMapper tzsJgOtherInfoMapper;
@Autowired @Autowired
...@@ -86,19 +79,18 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -86,19 +79,18 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
SupervisoryCodeInfoMapper supervisoryCodeInfoMapper; SupervisoryCodeInfoMapper supervisoryCodeInfoMapper;
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired @Autowired
JgUseRegistrationMapper jgUseRegistrationMapper; JgUseRegistrationMapper jgUseRegistrationMapper;
@Autowired @Autowired
ICmWorkflowService iCmWorkflowService; ICmWorkflowService iCmWorkflowService;
@Autowired @Autowired
IdxBizJgUseInfoMapper idxBizJgUseInfoMapper; IdxBizJgUseInfoMapper idxBizJgUseInfoMapper;
@Autowired @Autowired
JgInstallationNoticeServiceImpl jgInstallationNoticeService; JgInstallationNoticeServiceImpl jgInstallationNoticeService;
@Autowired
private JgTransferNoticeMapper jgTransferNoticeMapper;
@Autowired
private CommonServiceImpl commonService;
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
...@@ -126,7 +118,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -126,7 +118,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
transferNotice.put("constructionManagerId", notice.getConstructionManagerId() + "_" + notice.getConstructionManager()); transferNotice.put("constructionManagerId", notice.getConstructionManagerId() + "_" + notice.getConstructionManager());
} }
String[] fields = {"productPhoto", "designDoc", "designStandard", "factoryStandard", String[] fields = {"productPhoto", "designDoc", "designStandard", "factoryStandard",
"productQualityYieldProve", "insUseMaintainExplain", "inspectReport","otherAccessories", "productQualityYieldProve", "insUseMaintainExplain", "inspectReport", "otherAccessories",
"proxyStatementAttachment", "installContractAttachment", "powerOfAttorney", "constructionContract"}; "proxyStatementAttachment", "installContractAttachment", "powerOfAttorney", "constructionContract"};
// 设备信息 // 设备信息
List<Map<String, Object>> equipmentInfos = jgTransferNoticeMapper.queryEquipInformation(sequenceNbr); List<Map<String, Object>> equipmentInfos = jgTransferNoticeMapper.queryEquipInformation(sequenceNbr);
...@@ -613,30 +605,29 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -613,30 +605,29 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
@Transactional @Transactional
public void cancel(JgTransferNoticeDto noticeDto) { public void cancel(JgTransferNoticeDto noticeDto) {
JgTransferNotice jgInstallationNotice = this.baseMapper.selectById(noticeDto.getSequenceNbr()); JgTransferNotice jgInstallationNotice = this.baseMapper.selectById(noticeDto.getSequenceNbr());
String expectedStatus = String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()); if (jgInstallationNotice != null) {
// 检查实际状态是否不等于期望状态 //检查实际状态是否不是待受理状态
if (!expectedStatus.equals(jgInstallationNotice.getNoticeStatus())) { commonService.checkExpectedStatus(jgInstallationNotice.getNoticeStatus());
throw new BadRequest("当前业务状态不是待处理状态,请重新打开页面后操作!");
ProcessTaskDTO processTaskDTO = iCmWorkflowService.rollBack(jgInstallationNotice.getInstanceId());
// 提取节点等信息
WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
jgInstallationNotice.setPromoter("");
jgInstallationNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds());
jgInstallationNotice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.ROLLBACK.getCode()));
jgInstallationNotice.setNextTaskId(workflowResultDto.getNextTaskId());
jgTransferNoticeMapper.updateById(jgInstallationNotice);
TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtils.copyProperties(jgInstallationNotice, taskMessageDto);
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(taskMessageDto));
jsonObject.put("taskType", BusinessTypeEnum.JG_ADVICE_REMOVAL.getCode());
jsonObject.put("nextExecuteUser", jgInstallationNotice.getNextExecuteIds());
jsonObject.put("flowStatusLabel", FlowStatusEnum.ROLLBACK.getName());
jsonObject.put("flowStatus", FlowStatusEnum.ROLLBACK.getCode());
jsonObject.put("nextTaskId", jgInstallationNotice.getNextTaskId());
commonService.rollbackTask(jgInstallationNotice.getInstanceId(), jsonObject);
} }
ProcessTaskDTO processTaskDTO = iCmWorkflowService.rollBack(jgInstallationNotice.getInstanceId());
// 提取节点等信息
WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
jgInstallationNotice.setPromoter("");
jgInstallationNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds());
jgInstallationNotice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.ROLLBACK.getCode()));
jgInstallationNotice.setNextTaskId(workflowResultDto.getNextTaskId());
jgTransferNoticeMapper.updateById(jgInstallationNotice);
TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtils.copyProperties(jgInstallationNotice, taskMessageDto);
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(taskMessageDto));
jsonObject.put("taskType", BusinessTypeEnum.JG_ADVICE_REMOVAL.getCode());
jsonObject.put("nextExecuteUser", jgInstallationNotice.getNextExecuteIds());
jsonObject.put("flowStatusLabel", FlowStatusEnum.ROLLBACK.getName());
jsonObject.put("flowStatus", FlowStatusEnum.ROLLBACK.getCode());
jsonObject.put("nextTaskId", jgInstallationNotice.getNextTaskId());
commonService.rollbackTask(jgInstallationNotice.getInstanceId(), jsonObject);
} }
@Transactional @Transactional
...@@ -644,8 +635,12 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -644,8 +635,12 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
JgTransferNotice jgTransferNotice = this.jgTransferNoticeMapper.selectById(dto.getSequenceNbr()); JgTransferNotice jgTransferNotice = this.jgTransferNoticeMapper.selectById(dto.getSequenceNbr());
// 检查实际状态是否不等于期望状态
commonService.checkExpectedStatus(jgTransferNotice.getNoticeStatus());
// 组装设备注册代码 // 组装设备注册代码
StringBuffer stringBuffer = new StringBuffer(); StringBuilder stringBuffer = new StringBuilder();
String ym = null; String ym = null;
try { try {
ym = DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM); ym = DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM);
...@@ -668,7 +663,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -668,7 +663,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2); RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
stringBuffer.append(tzsJgRegistrationInfo.getEquCategory()).append(jgTransferNotice.getReceiveCompanyCode()).append(ym); stringBuffer.append(tzsJgRegistrationInfo.getEquCategory()).append(jgTransferNotice.getReceiveCompanyCode()).append(ym);
String equCode = stringBuffer.toString(); String equCode = stringBuffer.toString();
ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(equCode); ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(equCode);
String deviceRegistrationCode = responseModel.getResult(); String deviceRegistrationCode = responseModel.getResult();
jgTransferNotice.setInformNumber(deviceRegistrationCode); jgTransferNotice.setInformNumber(deviceRegistrationCode);
...@@ -678,10 +673,10 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -678,10 +673,10 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
jgTransferNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode())); jgTransferNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()));
Map<String,Object> map1 =new HashMap<>(); Map<String, Object> map1 = new HashMap<>();
Map<String,Map<String,Object>> objMap = new HashMap<>(); Map<String, Map<String, Object>> objMap = new HashMap<>();
map1.put("USE_PLACE",String.format("%s/%s/%s", jgTransferNotice.getProvinceName(), jgTransferNotice.getCityName(), jgTransferNotice.getCounty())); map1.put("USE_PLACE", String.format("%s/%s/%s", jgTransferNotice.getProvinceName(), jgTransferNotice.getCityName(), jgTransferNotice.getCounty()));
map1.put("ADDRESS",String.format("%s/%s", jgTransferNotice.getStreetName(), jgTransferNotice.getAddress())); map1.put("ADDRESS", String.format("%s/%s", jgTransferNotice.getStreetName(), jgTransferNotice.getAddress()));
objMap.put(jgTransferNoticeEq.getEquId(), map1); objMap.put(jgTransferNoticeEq.getEquId(), map1);
tzsServiceFeignClient.commonUpdateEsDataByIds(objMap); tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
......
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