Explorar el Código

fix: 大包只有自己发的才能查看大包下企业任务

lixuesong hace 1 año
padre
commit
6e638cdd72

+ 5 - 4
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/WmDeptTaskController.java

@@ -46,6 +46,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 /**
@@ -471,7 +472,7 @@ public class WmDeptTaskController {
         log.info("企业任务保存-企业通用-缓存:{}", params);
 
         String cacheKey = String.format("%s-%s-%s", CacheConstants.ENT_TASK_CACHE_KEY, "61", SecurityUtils.getUser().getId());
-        redisTemplate.opsForValue().set(cacheKey, JSONUtil.toJsonStr(params));
+        redisTemplate.opsForValue().set(cacheKey, JSONUtil.toJsonStr(params), 12, TimeUnit.HOURS);
 
         return R.ok();
     }
@@ -488,7 +489,7 @@ public class WmDeptTaskController {
         log.info("企业任务保存-医学会各级年会及卫星会-缓存:{}", params);
 
         String cacheKey = String.format("%s-%s-%s", CacheConstants.ENT_TASK_CACHE_KEY, "62", SecurityUtils.getUser().getId());
-        redisTemplate.opsForValue().set(cacheKey, JSONUtil.toJsonStr(params));
+        redisTemplate.opsForValue().set(cacheKey, JSONUtil.toJsonStr(params), 12, TimeUnit.HOURS);
 
         return R.ok();
     }
@@ -505,7 +506,7 @@ public class WmDeptTaskController {
         log.info("企业任务保存-专家共识巡讲会-缓存:{}", params);
 
         String cacheKey = String.format("%s-%s-%s", CacheConstants.ENT_TASK_CACHE_KEY, "63", SecurityUtils.getUser().getId());
-        redisTemplate.opsForValue().set(cacheKey, JSONUtil.toJsonStr(params));
+        redisTemplate.opsForValue().set(cacheKey, JSONUtil.toJsonStr(params), 12, TimeUnit.HOURS);
 
         return R.ok();
     }
@@ -523,7 +524,7 @@ public class WmDeptTaskController {
 		log.info("企业任务保存-缓存:taskTypeId={}, params={}", taskTypeId, paramsStr);
 
 		String cacheKey = String.format("%s-%s-%s", CacheConstants.ENT_TASK_CACHE_KEY, taskTypeId, SecurityUtils.getUser().getId());
-		redisTemplate.opsForValue().set(cacheKey, paramsStr);
+		redisTemplate.opsForValue().set(cacheKey, paramsStr, 12, TimeUnit.HOURS);
 
 		return R.ok();
 	}

+ 7 - 4
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/WmTaskController.java

@@ -209,10 +209,13 @@ public class WmTaskController {
 		List<WmScorePackage> wmScorePackageList = wmScorePackageService.selectLists(wmScorePackage);
 		List<WmTask> list = new ArrayList<>();
 		if (wmScorePackageList.size() > 0) {
-			WmTask wmTask3 = new WmTask();
-			wmTask3.setScorePackageId(wmScorePackage.getId());
-			List<WmTask> wmTaskList3 = wmTaskMapper.selectListByIds(wmTask3);
-			list.addAll(wmTaskList3);
+			if (StrUtil.equals(wmScorePackage.getSendPackageDeptId(), String.valueOf(SecurityUtils.getUser().getDeptId()))) {
+				// 大包只有自己发的才能查看大包下企业任务
+				WmTask wmTask3 = new WmTask();
+				wmTask3.setScorePackageId(wmScorePackage.getId());
+				List<WmTask> wmTaskList3 = wmTaskMapper.selectListByIds(wmTask3);
+				list.addAll(wmTaskList3);
+			}
 			List<String> ids2 = wmScorePackageList.stream().map(p -> p.getId()).collect(Collectors.toList());
 			for (String id : ids2) {
 				WmScorePackage wmScorePackage1 = new WmScorePackage();

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

@@ -86,7 +86,7 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
 		int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
 
 		// 校验企业任务类型
-		this.chectDeptTask(taskTypeId, params.getScore(), scorePackage);
+		this.checkDeptTask(taskTypeId, params.getScore(), scorePackage);
 
         // 保存taskContent
         WmTaskContent taskContent = new WmTaskContent();
@@ -138,7 +138,7 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
 		int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
 
 		// 校验企业任务类型
-		this.chectDeptTask(taskTypeId, score, scorePackage);
+		this.checkDeptTask(taskTypeId, score, scorePackage);
 
         // 保存taskContent
         WmTaskContent taskContent = new WmTaskContent();
@@ -197,7 +197,7 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
 		int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
 
 		// 校验企业任务类型
-		this.chectDeptTask(taskTypeId, score, scorePackage);
+		this.checkDeptTask(taskTypeId, score, scorePackage);
 
         // 保存taskContent
         WmTaskContent taskContent = new WmTaskContent();
@@ -274,7 +274,7 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
 		int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
 
 		// 校验企业任务类型
-		this.chectDeptTask(taskTypeId, score, scorePackage);
+		this.checkDeptTask(taskTypeId, score, scorePackage);
 
 		// 保存taskContent
 		WmTaskContent taskContent = new WmTaskContent();
@@ -332,7 +332,7 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
 		int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
 
 		// 校验企业任务类型
-		this.chectDeptTask(taskTypeId, score, scorePackage);
+		this.checkDeptTask(taskTypeId, score, scorePackage);
 
 		// 保存taskContent
 		WmTaskContent taskContent = new WmTaskContent();
@@ -386,7 +386,7 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
 		int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
 
 		// 校验企业任务类型
-		this.chectDeptTask(taskTypeId, score, scorePackage);
+		this.checkDeptTask(taskTypeId, score, scorePackage);
 
 		// 保存taskContent
 		WmTaskContent taskContent = new WmTaskContent();
@@ -444,7 +444,7 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
 		int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
 
 		// 校验企业任务类型
-		this.chectDeptTask(taskTypeId, score, scorePackage);
+		this.checkDeptTask(taskTypeId, score, scorePackage);
 
 		// 保存taskContent
 		WmTaskContent taskContent = new WmTaskContent();
@@ -504,7 +504,7 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
 		int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
 
 		// 校验企业任务类型
-		this.chectDeptTask(taskTypeId, score, scorePackage);
+		this.checkDeptTask(taskTypeId, score, scorePackage);
 
 		// 保存taskContent
 		WmTaskContent taskContent = new WmTaskContent();
@@ -624,7 +624,7 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
 	 * @param score        任务类型积分值
 	 * @param scorePackage 积分包
 	 */
-	private void chectDeptTask(String taskTypeId, int score, WmScorePackage scorePackage) {
+	private void checkDeptTask(String taskTypeId, int score, WmScorePackage scorePackage) {
 		// 查询任务类型启用状态
 		List<WmTaskSubmissionPercentRule> rules = wmTaskSubmissionPercentRuleService.list(Wrappers.<WmTaskSubmissionPercentRule>lambdaQuery()
 				.eq(WmTaskSubmissionPercentRule::getDeptId, SecurityUtils.getUser().getDeptId())
@@ -641,7 +641,7 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
 				.eq(WmScoreTaskType::getScoreId, scorePackage.getId())
 				.eq(WmScoreTaskType::getTaskTypeId, taskTypeId));
 		if (scoreTaskTypeCount <= 0) {
-			throw new RuntimeException("有效任务类型未启用该任务!");
+			throw new RuntimeException("积分包有效任务类型未启用该任务!");
 		}
 
 		Set<String> allPackageIds = new HashSet<>();