Переглянути джерело

优化益寿缘用户信息采集进度逻辑

cgp 1 тиждень тому
батько
коміт
347290d69e

+ 20 - 2
fs-service/src/main/java/com/fs/hisStore/service/impl/FsUserInformationCollectionServiceImpl.java

@@ -231,6 +231,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
      * @return 结果
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Long updateFsUserInformationCollection(FsUserInformationCollectionParam param)
     {
         if (param.getId() == null || param.getId() < 1) {
@@ -243,6 +244,23 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         if (collection.getUserConfirm() == 1 && collection.getUserConfirm2() == 0) {
             throw new CustomException("确认中,暂无法修改");
         }
+        //编辑用户信息采集信息时,同时新增采集进度数据(先中止再新增)
+        try {
+            //获取当前用户正在运行的信息采集进度
+            FsUserInformationCollectionSchedule schedule = scheduleMapper.selectCollectionScheduleRunningByCollectionId(collection.getId());
+            if (schedule != null){
+                log.info("用户信息采集进度未终止,进度id:{}",schedule.getId());
+                throw new CustomException("请先终止此用户信息的采集进度");
+            }
+            FsUserInformationCollection condition = getFsUserInformationCollection(param);
+            condition.setPackageId(param.getPackageId());
+            FsUserInformationCollectionSchedule fsUserInformationCollectionSchedule = assembleCreateSchedule(condition);
+            scheduleMapper.insertFsUserInformationCollectionSchedule(fsUserInformationCollectionSchedule);
+            log.info("编辑用户信息采集信息重新新增进度数据,信息采集数据id:{}",fsUserInformationCollectionSchedule.getCollectionId());
+        }catch (Exception e){
+            logger.error("新增用户信息采集进度数据失败",e);
+            throw new CustomException("新增用户信息采集进度数据失败");
+        }
         //清空订单号
         fsUserInformationCollectionMapper.collectionOderCodeNULL(param.getId());
         FsUserInformationCollection fsUserInformationCollection = getFsUserInformationCollection(param);
@@ -517,7 +535,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
             redisCache.deleteObject("doctorConfirm:" + collection.getId());
 
             //同步用户信息采集进度
-            FsUserInformationCollectionSchedule schedule = scheduleMapper.selectFsUserInformationCollectionScheduleByCollectionId(collection.getId());
+            FsUserInformationCollectionSchedule schedule = scheduleMapper.selectCollectionScheduleByCollectionId(collection.getId());
             if (schedule != null){
                 //"待用户二次确认"节点
                 schedule.setCurrentStep(PrescriptionTaskStepEnum.WAITING_SECOND_CONFIRM.getCode());
@@ -621,7 +639,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         map.setUserAdvice(param.getUserAdvice());
         //用户信息采集表id
         Long collectionId = collection.getId();
-        FsUserInformationCollectionSchedule schedule = scheduleMapper.selectFsUserInformationCollectionScheduleByCollectionId(collectionId);
+        FsUserInformationCollectionSchedule schedule = scheduleMapper.selectCollectionScheduleByCollectionId(collectionId);
         if (collection.getStatus() == 1) {
             //用户第一次确认添加医生消息
             DoctorMsg msg = new DoctorMsg();