Commit ca423e6f authored by 刘林's avatar 刘林

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

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