|
@@ -80,6 +80,12 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
@Value("${db.name}")
|
|
|
String databaseName;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TBDeviceInOutService tbDeviceInOutService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TFFlowLogService tfFlowLogService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询动态sop表名是否存在
|
|
|
*
|
|
@@ -309,8 +315,12 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
flowApproveParam.setFormProperties(JacksonUtil.parseJson(flowTaskResult));
|
|
|
}
|
|
|
|
|
|
+ CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tfCustomFlowEntity.getCode(), tfCustomFlowEntity.getCrmNo());
|
|
|
+ Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
+
|
|
|
Map<String, Object> map = activitiService.taskApprove(flowApproveParam);
|
|
|
if (flowApproveParam.getApprove() != FlowApprovePassEnum.DRAFT) {
|
|
|
+ map.put(SystemConstant.CRM_INFO, crmProjectResult);
|
|
|
tbSopInfoService.saveJobRemind(map);
|
|
|
}
|
|
|
TFFlowApprove tfFlowApprove = (TFFlowApprove) map.get(SystemConstant.FLOW_APPROVE);
|
|
@@ -634,6 +644,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
|
|
|
Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(flowDeploymentId, approve, approveUserIds, crmNo, formProperties));
|
|
|
if (approve != FlowApprovePassEnum.DRAFT) {
|
|
|
+ map.put(SystemConstant.CRM_INFO, crmProjectResult);
|
|
|
tbSopInfoService.saveJobRemind(map);
|
|
|
}
|
|
|
|
|
@@ -660,7 +671,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void saveJobRemind(Map<String, Object> map) {
|
|
|
+ public void saveJobRemind(Map<String, Object> map) throws InterruptedException {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
TFCustomFlow tfCustomFlow = (TFCustomFlow) map.get(SystemConstant.FLOW_CUSTOM);
|
|
|
Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
@@ -686,6 +697,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 3) {//内审
|
|
|
processLimitedTime = tfFlowApprove.getUpdateTime();
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 5) {//扫描准备
|
|
|
+ tbSopInfoService.sopDeviceInOutSave(map, 4);
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
processLimitedTime = this.getProcessLimitedTime(flowTaskResult, SystemConstant.SCAN_START_TIME);
|
|
|
execField = SystemConstant.SCAN_START_TIME;
|
|
@@ -718,6 +730,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
processLimitedTime = this.getProcessLimitedTime(flowTaskResult, SystemConstant.ENV_DEPLOYMENT_TIME);
|
|
|
execField = SystemConstant.ENV_DEPLOYMENT_TIME;
|
|
|
} else if (tfFlowApprove.getSetup().intValue() == 6) {//扫描准备
|
|
|
+ tbSopInfoService.sopDeviceInOutSave(map, 5);
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
processLimitedTime = this.getProcessLimitedTime(flowTaskResult, SystemConstant.SCAN_START_TIME);
|
|
|
execField = SystemConstant.SCAN_START_TIME;
|
|
@@ -757,6 +770,54 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
tsJobRemindService.saveJobRemind(tsJobRemindList);
|
|
|
}
|
|
|
}
|
|
|
+ } else if (tfFlowApprove.getStatus() == FlowStatusEnum.FINISH) {
|
|
|
+ if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW) {//教务处sop
|
|
|
+ tbSopInfoService.sopDeviceInOutSave(map, 10);
|
|
|
+ } else if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {//研究生sop
|
|
|
+ tbSopInfoService.sopDeviceInOutSave(map, 11);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * sop保存设备信息
|
|
|
+ *
|
|
|
+ * @param map
|
|
|
+ * @param setup
|
|
|
+ * @throws InterruptedException
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public void sopDeviceInOutSave(Map<String, Object> map, Integer setup) throws InterruptedException {
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.FLOW_ENTITY);
|
|
|
+ Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
|
|
|
+
|
|
|
+ FlowTaskResult flowTaskResultDeviceTable = this.getFormProperties(tfCustomFlowEntity, setup);
|
|
|
+ if (Objects.nonNull(flowTaskResultDeviceTable)) {
|
|
|
+ CrmProjectResult crmProjectResult = (CrmProjectResult) map.get(SystemConstant.CRM_INFO);
|
|
|
+ List<FlowFormWidgetResult> flowFormWidgetResultList = flowTaskResultDeviceTable.getFormProperty();
|
|
|
+ List<DeviceInOutForm> deviceInOutFormList = new ArrayList<>();
|
|
|
+ InOutTypeEnum type = null;
|
|
|
+ Long deviceInOutTime = null;
|
|
|
+ for (FlowFormWidgetResult f : flowFormWidgetResultList) {
|
|
|
+ if (f.getFormId().contains(SystemConstant.DEVICE_OUT_TIME) || f.getFormId().contains(SystemConstant.DEVICE_IN_TIME)) {
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
+ String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
+ deviceInOutTime = Long.parseLong(value);
|
|
|
+ type = f.getFormId().contains(SystemConstant.DEVICE_OUT_TIME) ? InOutTypeEnum.OUT : InOutTypeEnum.IN;
|
|
|
+ } else if (f.getFormId().contains(SystemConstant.DEVICE_OUT_TABLE) || f.getFormId().contains(SystemConstant.DEVICE_IN_TABLE)) {
|
|
|
+ if (Objects.isNull(type)) {
|
|
|
+ type = f.getFormId().contains(SystemConstant.DEVICE_OUT_TABLE) ? InOutTypeEnum.OUT : InOutTypeEnum.IN;
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
+ JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ deviceInOutFormList.add(GsonUtil.fromJson(GsonUtil.toJson(jsonArray.getJSONObject(i)), DeviceInOutForm.class));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tbDeviceInOutService.deviceInOutSubmit(new DeviceInOutSubmitParam(crmProjectResult.getServiceUnitId(),
|
|
|
+ tfCustomFlowEntity.getCrmNo(), tfCustomFlowEntity.getCode(), deviceInOutTime, type, deviceInOutFormList));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -767,7 +828,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public FlowResult sopEdit(Long id) {
|
|
|
+ public FlowResult sopEdit(Long id) throws InterruptedException {
|
|
|
Optional.ofNullable(id).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("sopId不能为空"));
|
|
|
TBSopInfo tbSopInfo = this.getById(id);
|
|
|
Optional.ofNullable(tbSopInfo).orElseThrow(() -> ExceptionResultEnum.SOP_INFO_NO_DATA.exception());
|
|
@@ -778,10 +839,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
|
|
|
Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
|
|
|
|
|
|
-// if (tfFlowApprove.getStatus() == FlowStatusEnum.FINISH || tfFlowApprove.getStatus() == FlowStatusEnum.END) {
|
|
|
-// throw ExceptionResultEnum.ERROR.exception("已结束的流程不允许修改");
|
|
|
-// }
|
|
|
-
|
|
|
FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
|
|
|
FlowResult flowResultNew = new FlowResult();
|
|
|
BeanUtils.copyProperties(flowResult, flowResultNew);
|
|
@@ -819,7 +876,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Boolean sopSave(SopSaveParam sopSaveParam) {
|
|
|
+ public Boolean sopSave(SopSaveParam sopSaveParam) throws InterruptedException {
|
|
|
TBSopInfo tbSopInfo = this.getById(sopSaveParam.getId());
|
|
|
Optional.ofNullable(tbSopInfo).orElseThrow(() -> ExceptionResultEnum.SOP_INFO_NO_DATA.exception());
|
|
|
|
|
@@ -829,14 +886,30 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
|
|
|
Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
|
|
|
|
|
|
- if (tfFlowApprove.getStatus() == FlowStatusEnum.FINISH || tfFlowApprove.getStatus() == FlowStatusEnum.END) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("已结束的流程不允许修改");
|
|
|
- }
|
|
|
+// if (tfFlowApprove.getStatus() == FlowStatusEnum.FINISH || tfFlowApprove.getStatus() == FlowStatusEnum.END) {
|
|
|
+// throw ExceptionResultEnum.ERROR.exception("已结束的流程不允许修改");
|
|
|
+// }
|
|
|
|
|
|
TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
|
|
|
Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
|
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ if (tfFlowApprove.getStatus() != FlowStatusEnum.FINISH && tfFlowApprove.getStatus() != FlowStatusEnum.END) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tfCustomFlowEntity.getCode(), tfCustomFlowEntity.getCrmNo());
|
|
|
+ Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
+
|
|
|
+ TFFlowLog tfFlowLog = tfFlowLogService.getOne(new QueryWrapper<TFFlowLog>().lambda().eq(TFFlowLog::getFlowId, tfCustomFlowEntity.getFlowId()).last(" order by create_time limit 1 "));
|
|
|
+ Optional.ofNullable(tfFlowLog).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_LOG_NO_DATA.exception());
|
|
|
+
|
|
|
+ map.put(SystemConstant.FLOW_CUSTOM, tfCustomFlow);
|
|
|
+ map.put(SystemConstant.FLOW_ENTITY, tfCustomFlowEntity);
|
|
|
+ map.put(SystemConstant.FLOW_APPROVE, tfFlowApprove);
|
|
|
+ map.put(SystemConstant.FLOW_APPROVE_LOG, tfFlowLog);
|
|
|
+ map.put(SystemConstant.CRM_INFO, crmProjectResult);
|
|
|
+ tbSopInfoService.saveJobRemind(map);
|
|
|
+ }
|
|
|
+
|
|
|
FlowResult flowResultParam = JSONObject.parseObject(sopSaveParam.getFormProperties(), FlowResult.class);
|
|
|
LinkedHashMap<String, FlowTaskResult> setupParamMap = flowResultParam.getSetupMap();
|
|
|
for (Map.Entry<String, FlowTaskResult> entry : setupParamMap.entrySet()) {
|