Commit c3ad2420 authored by 韩桐桐's avatar 韩桐桐

Bug-28712:设备移交,使用单位多次移交给安装单位显示设备已被其他流程使用,不允许重复提交

parent 5ce52eef
......@@ -26,7 +26,9 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgEquipTransferService;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.EquipTransferVo;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
import com.yeejoin.amos.boot.module.jg.biz.edit.permission.FillingEditPermForCurrentUser;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis;
......@@ -116,14 +118,13 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
@GlobalTransactional(rollbackFor = Exception.class)
public List<JgEquipTransfer> saveTransfer(String submitType, JSONObject jsonObjectMap, ReginParams reginParams) {
JgEquipTransferDto model = JSON.parseObject(JSONObject.toJSONString(jsonObjectMap), JgEquipTransferDto.class);
convertField(model);
String equListCode = model.getEquList();
List<Map<String, Object>> deviceList = model.getDeviceList();
if (CollectionUtils.isEmpty(deviceList)) {
throw new BadRequest("请选择设备!");
}
try{
if (SUBMIT_TYPE_FLOW.equals(submitType)) {// 放在最后面防止前面有异常
// 如果是提交,用于校验设备是否已经在流程中,如果不在标记设备已经在流程中
CompanyBo company = reginParams.getCompany();
......@@ -148,7 +149,6 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
this.handleResponseModel(listResponseModel, "告知单获取失败: ");
List<String> applyNoList = listResponseModel.getResult();
this.handleApplyNoList(applyNoList);
//启动工作流
List<WorkflowResultDto> workflowResultList = this.startWorkFlow(model.getInstallUnitCreditCode(), submitType, deviceList);
......@@ -250,6 +250,24 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
// 创建历史数据
this.saveOrUpdateHisDataBatch(equListCode, transferList, jgEquipTransferEqList);
return transferList;
} catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw e;
} catch (Exception e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw new BadRequest("保存失败!");
} finally {
FlowingEquipRedisContext.clean();
}
}
private void rollBackForDelRedisData() {
FlowingEquipRedisContext.getContext().forEach(e -> {
EquipUsedCheckStrategyContext.getUsedStrategy(EQUIP_TRANSFER_PROCESS_KEY)
.delDataForCheckWithKey(e.getData(), e.getRedisKey());
});
}
/**
......
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