|
@@ -3,6 +3,7 @@ package com.qunzhixinxi.hnqz.admin.controller;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.UpmsType;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
|
|
@@ -105,17 +106,25 @@ public class WmTaskSubmissionRuleController {
|
|
|
/**
|
|
|
* 更新启用的任务类型
|
|
|
*
|
|
|
- * @param rule 任务类型
|
|
|
+ * @param requestMap 请求参数
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@PostMapping("/update-task-type")
|
|
|
- public R<Boolean> updateEnableTaskType(@RequestBody WmTaskSubmissionPercentRule.PercentRule rule) {
|
|
|
+ public R<Boolean> updateEnableTaskType(@RequestBody Map<String, Object> requestMap) {
|
|
|
+ List<String> taskTypeIds = (List<String>) requestMap.get("taskTypeIds");
|
|
|
+ Integer deptId = (Integer) requestMap.get("deptId");
|
|
|
+ if (ArrayUtil.isEmpty(taskTypeIds) || deptId == null) {
|
|
|
+ return R.failed("必填参数为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ WmTaskSubmissionPercentRule.PercentRule rule = new WmTaskSubmissionPercentRule.PercentRule();
|
|
|
rule.setLimitPercent("");
|
|
|
rule.setStartScore(0);
|
|
|
- Integer deptId = SecurityUtils.getUser().getDeptId();
|
|
|
+ rule.setTaskTypeIds(taskTypeIds.toArray(new String[0]));
|
|
|
+ Integer currentDeptId = SecurityUtils.getUser().getDeptId();
|
|
|
|
|
|
List<WmTaskSubmissionPercentRule> rules = taskSubmissionPercentRuleService.list(Wrappers.<WmTaskSubmissionPercentRule>lambdaQuery()
|
|
|
- .eq(WmTaskSubmissionPercentRule::getDeptId, deptId)
|
|
|
+ .eq(WmTaskSubmissionPercentRule::getDeptId, currentDeptId)
|
|
|
.eq(WmTaskSubmissionPercentRule::getSubCategory, UpmsType.TaskSubCategory2.TASK_TYPE_CONFIG));
|
|
|
if (CollUtil.isEmpty(rules)) {
|
|
|
WmTaskSubmissionPercentRule percentRule = new WmTaskSubmissionPercentRule();
|
|
@@ -128,7 +137,7 @@ public class WmTaskSubmissionRuleController {
|
|
|
taskSubmissionPercentRuleService.update(Wrappers.<WmTaskSubmissionPercentRule>lambdaUpdate()
|
|
|
.eq(WmTaskSubmissionPercentRule::getDeptId, deptId)
|
|
|
.eq(WmTaskSubmissionPercentRule::getSubCategory, UpmsType.TaskSubCategory2.TASK_TYPE_CONFIG)
|
|
|
- .set(WmTaskSubmissionPercentRule::getRule, rule));
|
|
|
+ .set(WmTaskSubmissionPercentRule::getRule, JSONUtil.toJsonStr(rule)));
|
|
|
}
|
|
|
|
|
|
return R.ok(Boolean.TRUE);
|