|
@@ -22,6 +22,7 @@ import com.qunzhixinxi.hnqz.common.core.constant.enums.CommonFlag;
|
|
|
import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
|
import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -38,6 +39,7 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -57,6 +59,7 @@ public class WmTaskSubmissionRuleController {
|
|
|
private final WmTaskTypeSubCate2Service wmTaskTypeSubCate2Service;
|
|
|
private final WmTaskSubmissionPercentRuleService taskSubmissionPercentRuleService;
|
|
|
private final WmTaskTypeService wmTaskTypeService;
|
|
|
+ private final RedisTemplate<String, Object> redisTemplate;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -159,6 +162,14 @@ public class WmTaskSubmissionRuleController {
|
|
|
*/
|
|
|
@GetMapping("/list-task-type-ids")
|
|
|
public R<?> listTaskTypeIds(@RequestParam(value = "deptId") Integer deptId) {
|
|
|
+
|
|
|
+ String cacheKey = "task:type:" + deptId;
|
|
|
+ Object o = redisTemplate.opsForValue().get(cacheKey);
|
|
|
+
|
|
|
+ if (o != null){
|
|
|
+ return R.ok((String[])o);
|
|
|
+ }
|
|
|
+
|
|
|
// 查询任务类型启用状态
|
|
|
List<WmTaskSubmissionPercentRule> rules = taskSubmissionPercentRuleService.list(Wrappers.<WmTaskSubmissionPercentRule>lambdaQuery()
|
|
|
.eq(WmTaskSubmissionPercentRule::getDeptId, deptId)
|
|
@@ -166,6 +177,7 @@ public class WmTaskSubmissionRuleController {
|
|
|
String[] taskTypeIds;
|
|
|
if (CollUtil.isNotEmpty(rules)) {
|
|
|
taskTypeIds = rules.get(0).getRule().getTaskTypeIds();
|
|
|
+ redisTemplate.opsForValue().set(cacheKey, taskTypeIds, 30, TimeUnit.DAYS);
|
|
|
} else {
|
|
|
taskTypeIds = new String[0];
|
|
|
}
|