From b854d8d7604329dcf99584d15f83ff02076d9e07 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: Thu, 01 Sep 2022 10:52:04 +0800
Subject: [PATCH] 假删除fix
---
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/ExamineMngController.java | 37 +++++++++++++++++++++++++++----------
1 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/ExamineMngController.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/ExamineMngController.java
index ecdb18c..cb150be 100644
--- a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/ExamineMngController.java
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/ExamineMngController.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.gkhy.safePlatform.commons.co.ContextCacheUser;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.utils.PageUtils;
@@ -10,14 +11,16 @@
import com.gkhy.safePlatform.targetDuty.model.dto.req.ExamineMngQueryCriteria;
import com.gkhy.safePlatform.targetDuty.model.dto.resp.ExamineMngDto;
import com.gkhy.safePlatform.targetDuty.service.ExamineMngService;
+import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
import java.sql.Timestamp;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.stream.Collectors;
+
/**
* 绩效考核管理-安全考核管理(ExamineMng)表控制层
@@ -45,7 +48,7 @@
PageUtils.checkCheck(pageQuery);
return this.examineMngService.queryAll(pageQuery);
}
-
+
/**
* 通过主键查询单条数据
@@ -66,7 +69,11 @@
* @return 修改结果
*/
@PostMapping(value = "/addOrUpdate")
- public ResultVO update(@RequestBody ExamineMng examineMng) {
+ public ResultVO update(Authentication authentication, @RequestBody ExamineMng examineMng) {
+ // 获取当前用户
+ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
+ examineMng.setExamineDepartmentId(currentUser.getDepId());
+ examineMng.setExaminePersonId(currentUser.getUid());
if (examineMng.getId() == null) {
return new ResultVO<>(ResultCodes.OK,examineMngService.save(examineMng));
} else {
@@ -81,11 +88,21 @@
* @param ids 主键结合
* @return 删除结果
*/
- @GetMapping(value = "/delete")
- public ResultVO delete(String ids) {
- List<String> idList = Arrays.stream(ids.split(","))
- .collect(Collectors.toList());
- this.examineMngService.removeByIds(idList);
+ @RequestMapping(value = "/delete",method = RequestMethod.POST)
+ public ResultVO delete(@RequestBody Long[] ids) {
+ if(ids == null){
+ return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL);
+ }
+ List<Long> idList = Arrays.asList(ids);
+
+ List<ExamineMng> delList = new ArrayList<>();
+ idList.forEach(f->{
+ ExamineMng info = new ExamineMng();
+ info.setDelFlag(1);
+ info.setId(f);
+ delList.add(info);
+ });
+ this.examineMngService.updateBatchById(delList);
return new ResultVO<>(ResultCodes.OK);
}
@@ -98,7 +115,7 @@
examineTemplateSaveOrUpdate.setExamineDate(new Timestamp(new java.util.Date().getTime()));
examineTemplateSaveOrUpdate.setExamineTotalNumber("3");
examineTemplateSaveOrUpdate.setMemo("4");
- examineTemplateSaveOrUpdate.setExaminePersonId("5");
+ examineTemplateSaveOrUpdate.setExaminePersonId(5L);
examineTemplateSaveOrUpdate.setBeExaminedPersonId("6");
examineTemplateSaveOrUpdate.setExamineDepartmentId(7L);
examineTemplateSaveOrUpdate.setBeExaminedDepartmentId(8L);
@@ -107,4 +124,4 @@
System.out.println(JSONObject.toJSONString(examineTemplateSaveOrUpdate));
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.2