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

fix: 任务审核task表加version字段

lixuesong 1 рік тому
батько
коміт
9db3afcf7d

+ 2 - 0
db/v2.0/20240423.sql

@@ -0,0 +1,2 @@
+alter table wm_task
+    add version int default 0 not null comment '乐观锁';

+ 1 - 1
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/WmTaskService.java

@@ -227,7 +227,7 @@ public interface WmTaskService extends IService<WmTask> {
 	 * @param taskStatus 审核状态
 	 * @param taskStatusInfo 审批说明
 	 */
-	void task15_30_16_18(WmTask task, String taskStatus, String taskStatusInfo);
+	String task15_30_16_18(WmTask task, String taskStatus, String taskStatusInfo);
 
 	/**
 	 * 更新调查信息数据(只入库调查信息数据,不更新任务和积分包数据,用于手动处理)

+ 15 - 10
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/WmTaskServiceImpl.java

@@ -2573,10 +2573,11 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
 		}
 
 		// STEP4: 如果是源头积分包,则判断是否审核入库调查信息
+		String compareResult = null;
 		if (StringUtils.isBlank(wmScorePackage.getRelationScoreId())) {
 			if (StrUtil.equals(taskStatus, TaskStatusEnum.APPROVED.val())) {
 				// 复审通过,才操作
-				this.task15_30_16_18(queryTask, taskStatus, taskStatusInfo);
+				compareResult = this.task15_30_16_18(queryTask, taskStatus, taskStatusInfo);
 			}
 		}
 
@@ -2592,7 +2593,8 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
 				.set(WmTask::getUpdateTime, now)
 				.set(WmTask::getUpdateUser, operatorId)
 				.set(WmTask::getApprovalUserId, operatorId)
-				.set(WmTask::getApprovalTime, now);
+				.set(WmTask::getApprovalTime, now)
+				.set(StrUtil.isNotBlank(compareResult), WmTask::getCompareResult, compareResult);
 		log.info("task更新参数:条件id={},updateTime={},updateUser={},更新项taskStatus={},realFlag={},taskStatusInfo={},updateTime={},updateUser={}",
 				id, queryTask.getUpdateTime(), queryTask.getUpdateUser(), taskStatus, "0", taskStatusInfo, now, operatorId);
 		boolean taskUpdate = this.update(taskUpdateWrapper);
@@ -2718,8 +2720,9 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
 			}
 
 			// STEP4: 如果是源头积分包,则判断是否审核入库调查信息
+			String compareResult = null;
 			if (StringUtils.isBlank(wmScorePackage.getRelationScoreId())) {
-				this.task15_30_16_18(queryTask, taskStatus, taskStatusInfo);
+				compareResult = this.task15_30_16_18(queryTask, taskStatus, taskStatusInfo);
 			}
 
 			// STEP1:更新task状态
@@ -2733,7 +2736,8 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
 					.set(WmTask::getUpdateTime, now)
 					.set(WmTask::getUpdateUser, operatorId)
 					.set(WmTask::getApprovalUserId, operatorId)
-					.set(WmTask::getApprovalTime, now);
+					.set(WmTask::getApprovalTime, now)
+					.set(StrUtil.isNotBlank(compareResult), WmTask::getCompareResult, compareResult);
 			log.info("task更新参数:条件id={},updateTime={},updateUser={},更新项taskStatus={},realFlag={},taskStatusInfo={},updateTime={},updateUser={}",
 					id, queryTask.getUpdateTime(), queryTask.getUpdateUser(), taskStatus, "0", taskStatusInfo, now, operatorId);
 			boolean taskUpdate = this.update(taskUpdateWrapper);
@@ -2741,11 +2745,6 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
 				throw new RuntimeException("操作失败,请重试");
 			}
 
-			// STEP4: 如果是源头积分包,则判断是否审核入库调查信息
-			if (StringUtils.isBlank(wmScorePackage.getRelationScoreId())) {
-				this.task15_30_16_18(queryTask, taskStatus, taskStatusInfo);
-			}
-
 			// 移除图片缓存
 			this.removePicCache(queryTask);
 		});
@@ -2829,8 +2828,9 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
 	 * @param taskStatus 审核状态
 	 * @param taskStatusInfo 审批说明
 	 */
-	public void task15_30_16_18(WmTask task, String taskStatus, String taskStatusInfo) {
+	public String task15_30_16_18(WmTask task, String taskStatus, String taskStatusInfo) {
 
+		String compareResult = null;
 		// 调查信息审核(15、30-医院 16-商业公司 18-药店)
 		String approvalOpinion = taskStatus.equals(TaskStatusEnum.APPROVED.val()) ? "1" : "2";
 		if ("15".equals(task.getTaskTypeId()) || "30".equals(task.getTaskTypeId())) {
@@ -2839,6 +2839,7 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
 			Map<String, String> paramMap = BeanUtil.toBean(data.get("newinfo"), Map.class);
 			paramMap.put("approvalInfo", taskStatusInfo);
 			paramMap.put("approvalOpinion", approvalOpinion);
+			compareResult = _wmTask.getCompareResult();
 			paramMap.put("compareResult", _wmTask.getCompareResult());
 			paramMap.put("taskId", task.getId());
 			log.info("更新调查信息数据hospital:{}", paramMap);
@@ -2849,6 +2850,7 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
 			Map<String, String> paramMap = BeanUtil.toBean(data.get("newinfo"), Map.class);
 			paramMap.put("approvalInfo", taskStatusInfo);
 			paramMap.put("approvalOpinion", approvalOpinion);
+			compareResult = _wmTask.getCompareResult();
 			paramMap.put("compareResult", _wmTask.getCompareResult());
 			paramMap.put("taskId", task.getId());
 			log.info("更新调查信息数据distribution:{}", paramMap);
@@ -2861,11 +2863,14 @@ public class WmTaskServiceImpl extends ServiceImpl<WmTaskMapper, WmTask> impleme
 			paramMap.put("infoId", info.getId());
 			paramMap.put("approvalInfo", taskStatusInfo);
 			paramMap.put("approvalOpinion", approvalOpinion);
+			compareResult = _wmTask.getCompareResult();
 			paramMap.put("compareResult", _wmTask.getCompareResult());
 			paramMap.put("taskId", task.getId());
 			log.info("更新调查信息数据pharmacy:{}", paramMap);
 			wmDaPharmacyService.updateByapproval(paramMap);
 		}
+
+		return compareResult;
 	}
 
 	/**