夏文涛 2 years ago
parent
commit
97606f2891

+ 13 - 11
src/main/java/com/template/controller/ScheduleController.java

@@ -82,7 +82,7 @@ public class ScheduleController {
     //周一到周五早上七点执行:0 0 7 ? * MON-FRI
     //0 0 22 * * ?
     @Async
-    @Scheduled(cron = "0 */1 * * * ? ")
+    @Scheduled(cron = "0 0 22 * * ? ")
     @Transactional(rollbackFor = {Exception.class})
     public void autoDispatch() throws Exception {
 
@@ -193,16 +193,18 @@ public class ScheduleController {
                                         Optional<SmartAttendance> existData = attendanceList.stream().filter(e -> e.getUserId().equals(student.get().getId())
                                                 && e.getClassId().equals(student.get().getSchoolClass()) &&  StringUtils.hasText(item.getAttendTime()) && e.getAttendTime().equals(TimeExchange.StringToDate((TimeExchange.getDate() + " " + item.getAttendTime()), "yyyy-MM-dd HH:mm:ss"))).findFirst();
                                         if (!(existData != null && existData.isPresent())) {
-                                            SmartAttendance attendance = new SmartAttendance();
-                                            attendance.setUserId(student.get().getId());
-                                            attendance.setUserUid(item.getUserUid());
-                                            attendance.setClassId(student.get().getSchoolClass());
-                                            attendance.setClassUid(kResult.getResponseBody().getData().getClassUid());
-                                            attendance.setXwUserName(item.getUserName());
-                                            attendance.setXwStudentCode(item.getStudentCode());
-                                            attendance.setAttendTime(StringUtils.hasText(item.getAttendTime()) ? TimeExchange.StringToDate((TimeExchange.getDate() + " " + item.getAttendTime()), "yyyy-MM-dd HH:mm:ss") : new Date());
-                                            attendance.setStatus(item.getStatus());
-                                            attendances.add(attendance);
+                                            if(item.getStatus().intValue() != 6){//请假数据不通过考勤接口拿 因为考勤给的请假数据没有请假原因和请假时长
+                                                SmartAttendance attendance = new SmartAttendance();
+                                                attendance.setUserId(student.get().getId());
+                                                attendance.setUserUid(item.getUserUid());
+                                                attendance.setClassId(student.get().getSchoolClass());
+                                                attendance.setClassUid(kResult.getResponseBody().getData().getClassUid());
+                                                attendance.setXwUserName(item.getUserName());
+                                                attendance.setXwStudentCode(item.getStudentCode());
+                                                attendance.setAttendTime(StringUtils.hasText(item.getAttendTime()) ? TimeExchange.StringToDate((TimeExchange.getDate() + " " + item.getAttendTime()), "yyyy-MM-dd HH:mm:ss") : new Date());
+                                                attendance.setStatus(item.getStatus());
+                                                attendances.add(attendance);
+                                            }
                                         }
                                     }
                                 }

+ 31 - 9
src/main/java/com/template/controller/SmartDataSourceController.java

@@ -3,18 +3,20 @@ package com.template.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.pagehelper.PageInfo;
-import com.template.annotation.DESRespondSecret;
 import com.template.api.SmartDataSourceControllerAPI;
+import com.template.common.utils.AesUtils;
 import com.template.common.utils.CommonUtil;
 import com.template.common.utils.paramUtils;
 import com.template.model.pojo.SmartDataSource;
 import com.template.model.pojo.SmartDataSourceLog;
 import com.template.model.pojo.SmartDataTask;
+import com.template.model.pojo.SmartUser;
 import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
 import com.template.services.SmartDataSourceLogService;
 import com.template.services.SmartDataSourceService;
 import com.template.services.SmartDataTaskService;
+import com.template.services.SmartUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -33,8 +35,6 @@ import java.util.Map;
  * @since 2023-12-05
  */
 @RestController
-//返回参数加密注解
-@DESRespondSecret
 public class SmartDataSourceController implements SmartDataSourceControllerAPI {
 
     @Autowired
@@ -44,6 +44,9 @@ public class SmartDataSourceController implements SmartDataSourceControllerAPI {
     private SmartDataTaskService smartDataTaskService;
 
     @Autowired
+    private SmartUserService smartUserService;
+
+    @Autowired
     private SmartDataSourceLogService smartDataSourceLogService;
 
     /**
@@ -54,7 +57,6 @@ public class SmartDataSourceController implements SmartDataSourceControllerAPI {
      * @return
      */
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult insertSmartDataSource(SmartDataSource smartDataSource, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -65,6 +67,11 @@ public class SmartDataSourceController implements SmartDataSourceControllerAPI {
                 CommonUtil.generateLog("新增数据源|【数据交换中心】→【数据源管理】|新增【数据源】|create", httpServletRequest);
         Map<String, Object> result = smartDataSourceService.insertSmartDataSource(smartDataSource);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -73,6 +80,16 @@ public class SmartDataSourceController implements SmartDataSourceControllerAPI {
         }
     }
 
+    private String getName(HttpServletRequest httpServletRequest) {
+        String userHead = httpServletRequest.getHeader("User_head");
+        String userID = AesUtils.decrypt(userHead);
+        SmartUser operateData = smartUserService.getSmartById(Integer.valueOf(userID));
+        if (operateData == null) {
+            return "用户信息不合法,无法查看";
+        }
+        return operateData.getName();
+    }
+
     /**
      * 测试 数据源连接状态
      *
@@ -81,7 +98,6 @@ public class SmartDataSourceController implements SmartDataSourceControllerAPI {
      * @return
      */
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult vcoSmartDataSource(SmartDataSource smartDataSource, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -101,7 +117,6 @@ public class SmartDataSourceController implements SmartDataSourceControllerAPI {
      * @return
      */
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult updateSmartDataSourceById(SmartDataSource smartDataSource, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -113,6 +128,11 @@ public class SmartDataSourceController implements SmartDataSourceControllerAPI {
                 CommonUtil.generateLog("更新数据源|【数据交换中心】→【数据源管理】|更新【数据源】|update", httpServletRequest);
         Map<String, Object> result = smartDataSourceService.updateSmartDataSource(smartDataSource);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -130,7 +150,6 @@ public class SmartDataSourceController implements SmartDataSourceControllerAPI {
      * @return
      */
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult queryPageSmartDataSources(int currentPage, int pageCount, SmartDataSource smartDataSource) {
         PageInfo<SmartDataSource> result = smartDataSourceService.queryPageSmartDataSources(currentPage, pageCount, smartDataSource);
 
@@ -138,7 +157,6 @@ public class SmartDataSourceController implements SmartDataSourceControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult querySmartDataSourceById(int id) {
         SmartDataSource smartDataSource = smartDataSourceService.querySmartDataSourceById(id);
         return CommonResult.ok(smartDataSource);
@@ -146,7 +164,6 @@ public class SmartDataSourceController implements SmartDataSourceControllerAPI {
 
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult deleteSmartDataSourceById(int id, HttpServletRequest httpServletRequest) {
 
         SmartDataSource data = smartDataSourceService.getSmartById(id);
@@ -167,6 +184,11 @@ public class SmartDataSourceController implements SmartDataSourceControllerAPI {
                 CommonUtil.generateLog("删除数据源|【数据交换中心】→【数据源管理】|删除【数据源】|delete", httpServletRequest);
         int result = smartDataSourceService.deleteSmartDataSourceById(id);
         if (result > 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok("删除成功");

+ 85 - 28
src/main/java/com/template/controller/SmartDataTaskController.java

@@ -3,8 +3,8 @@ package com.template.controller;
 
 import com.alibaba.fastjson2.JSONObject;
 import com.github.pagehelper.PageInfo;
-import com.template.annotation.DESRespondSecret;
 import com.template.api.SmartDataTaskControllerAPI;
+import com.template.common.utils.AesUtils;
 import com.template.common.utils.CommonUtil;
 import com.template.common.utils.paramUtils;
 import com.template.model.pojo.*;
@@ -12,6 +12,7 @@ import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
 import com.template.services.SmartDataSourceLogService;
 import com.template.services.SmartDataTaskService;
+import com.template.services.SmartUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.RestController;
@@ -29,18 +30,18 @@ import java.util.Map;
  * @since 2023-12-05
  */
 @RestController
-//返回参数加密注解
-@DESRespondSecret
 public class SmartDataTaskController implements SmartDataTaskControllerAPI {
 
     @Autowired
     private SmartDataTaskService smartDataTaskService;
 
     @Autowired
+    private SmartUserService smartUserService;
+
+    @Autowired
     private SmartDataSourceLogService smartDataSourceLogService;
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult createJob(SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -51,6 +52,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
                 CommonUtil.generateLog("创建定时任务|【数据交换中心】→【数据源数据交换任务】|创建【定时任务】|create", httpServletRequest);
         Map<String, Object> result = smartDataTaskService.createJob(smartDataTask);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -60,7 +66,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult pauseJob(SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -71,6 +76,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
                 CommonUtil.generateLog("暂停定时任务|【数据交换中心】→【数据源数据交换任务】|暂停【定时任务】|pause", httpServletRequest);
         Map<String, Object> result = smartDataTaskService.pauseJob(smartDataTask);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -80,7 +90,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult resumeJob(SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -91,6 +100,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
                 CommonUtil.generateLog("恢复定时任务|【数据交换中心】→【数据源数据交换任务】|恢复【定时任务】|resume", httpServletRequest);
         Map<String, Object> result = smartDataTaskService.resumeJob(smartDataTask);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -100,7 +114,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult updateJob(SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -110,6 +123,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
                 CommonUtil.generateLog("更新定时任务|【数据交换中心】→【数据源数据交换任务】|更新【定时任务】|update", httpServletRequest);
         Map<String, Object> result = smartDataTaskService.updateJob(smartDataTask);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -119,7 +137,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult deleteJob(SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -130,6 +147,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
                 CommonUtil.generateLog("删除定时任务|【数据交换中心】→【数据源数据交换任务】|删除【定时任务】|delete", httpServletRequest);
         Map<String, Object> result = smartDataTaskService.deleteJob(smartDataTask);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -139,7 +161,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult runOnceJob(SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -150,6 +171,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
                 CommonUtil.generateLog("执行1次定时任务|【数据交换中心】→【数据源数据交换任务】|执行1次【定时任务】|runOnce", httpServletRequest);
         Map<String, Object> result = smartDataTaskService.runOnceJob(smartDataTask);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -174,7 +200,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
      * 同步策略
      */
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult getSyncPolicy() {
         Map<String, Object> result = smartDataTaskService.getSyncPolicy();
         if (Integer.parseInt((String) result.get("code")) == 0) {
@@ -188,7 +213,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
      * 交换方式
      */
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult getExchangeType() {
         Map<String, Object> result = smartDataTaskService.getExchangeType();
         if (Integer.parseInt((String) result.get("code")) == 0) {
@@ -212,7 +236,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult getTables(String json) {
         // 获取数据源id对应的数据源
         Map<String, Object> result = smartDataTaskService.getTables(json);
@@ -224,7 +247,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult getViews(String json) {
         // 获取数据源id对应的数据源
         Map<String, Object> result = smartDataTaskService.getViews(json);
@@ -243,7 +265,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
      * @return
      */
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult insertSmartDataTask1(SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -254,6 +275,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
                 CommonUtil.generateLog("新增数据源数据交换任务|【数据交换中心】→【数据源数据交换任务】|新增【任务-任务基本信息】|create", httpServletRequest);
         Map<String, Object> result = smartDataTaskService.insertSmartDataTask1(smartDataTask);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -263,7 +289,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult insertSmartDataTask2(JSONObject json, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -274,6 +299,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
                 CommonUtil.generateLog("新增数据源数据交换任务|【数据交换中心】→【数据源数据交换任务】|新增【任务-字段配置】|create", httpServletRequest);
         Map<String, Object> result = smartDataTaskService.insertSmartDataTask2(json);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -283,7 +313,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult insertSmartDataTask3(SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -294,6 +323,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
                 CommonUtil.generateLog("新增数据源数据交换任务|【数据交换中心】→【数据源数据交换任务】|新增【任务-定时信息】|create", httpServletRequest);
         Map<String, Object> result = smartDataTaskService.insertSmartDataTask3(smartDataTask);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -310,7 +344,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
      * @return
      */
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult updateSmartDataTaskById1(SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -322,6 +355,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
                 CommonUtil.generateLog("更新数据源数据交换任务|【数据交换中心】→【数据源数据交换任务】|编辑【任务-任务基本信息】|update", httpServletRequest);
         Map<String, Object> result = smartDataTaskService.updateSmartDataTaskById1(smartDataTask);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -331,7 +369,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult updateSmartDataTaskById2(JSONObject json, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -342,6 +379,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
                 CommonUtil.generateLog("更新数据源数据交换任务|【数据交换中心】→【数据源数据交换任务】|编辑【任务-字段配置】|update", httpServletRequest);
         Map<String, Object> result = smartDataTaskService.updateSmartDataTaskById2(json);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -351,7 +393,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult updateSmartDataTaskById3(SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -362,6 +403,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
                 CommonUtil.generateLog("更新数据源数据交换任务|【数据交换中心】→【数据源数据交换任务】|编辑【任务-定时信息】|update", httpServletRequest);
         Map<String, Object> result = smartDataTaskService.updateSmartDataTaskById3(smartDataTask);
         if (Integer.parseInt((String) result.get("code")) == 0) {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -379,7 +425,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
      * @return
      */
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult queryPageSmartDataTasks(int currentPage, int pageCount, SmartDataTask smartDataTask) {
         PageUtils<SmartDataTask> result = smartDataTaskService.queryPageSmartDataTasks(currentPage, pageCount, smartDataTask);
 
@@ -394,7 +439,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
      * @return
      */
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult deleteSmartDataTaskById(int id, int delMethod, HttpServletRequest httpServletRequest) {
 
         SmartDataTask smartDataTask = smartDataTaskService.getSmartById(id);
@@ -426,6 +470,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
         Map<String, Object> result = smartDataTaskService.deleteSmartDataTaskById(id, delMethod);
         if (result.get("code") == "0") {
             if (smartDataSourceLog != null) {
+                String creater_people = getName(httpServletRequest);
+                if (creater_people.equals("用户信息不合法,无法查看")) {
+                    return CommonResult.fail(creater_people);
+                }
+                smartDataSourceLog.setLogActionPeople(creater_people);
                 smartDataSourceLog.setLogActionStatus(1);
                 smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             }
@@ -435,6 +484,16 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
         }
     }
 
+    private String getName(HttpServletRequest httpServletRequest) {
+        String userHead = httpServletRequest.getHeader("User_head");
+        String userID = AesUtils.decrypt(userHead);
+        SmartUser operateData = smartUserService.getSmartById(Integer.valueOf(userID));
+        if (operateData == null) {
+            return "用户信息不合法,无法查看";
+        }
+        return operateData.getName();
+    }
+
     /**
      * 查询任务运行日志分页列表
      *
@@ -446,7 +505,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
      * @return 返回
      */
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult queryPageSmartDataTaskDebug(int currentPage, int pageCount, Integer eTaskId, String startTime, String endTime) {
         PageInfo<SmartDataTaskDebug> result = smartDataTaskService.queryPageSmartDataTaskDebug(currentPage, pageCount, eTaskId, startTime, endTime);
 
@@ -462,7 +520,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
      * @return 返回
      */
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult delSmartDataTaskDebugByIds(JSONObject json, HttpServletRequest httpServletRequest, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
@@ -473,6 +530,11 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
                 CommonUtil.generateLog("删除任务运行日志数据|【数据交换中心】→【任务运行日志】|删除【任务运行日志数据】|delete", httpServletRequest);
         Map<String, Object> result = smartDataTaskService.deleteSmartDataTaskDebugByIds(json);
         if (result.get("code") == "0") {
+            String creater_people = getName(httpServletRequest);
+            if (creater_people.equals("用户信息不合法,无法查看")) {
+                return CommonResult.fail(creater_people);
+            }
+            smartDataSourceLog.setLogActionPeople(creater_people);
             smartDataSourceLog.setLogActionStatus(1);
             smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
             return CommonResult.ok(result.get("msg"));
@@ -482,7 +544,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult queryPageSmartDataTaskLog(int currentPage, int pageCount, Integer eTaskId, String tkLogTaskName, Integer tkLogAutoManual,
                                                   Integer tkLogDsSourceId, Integer tkLogDsDestinationId,
                                                   Integer tkLogCostTime, Integer tkLogExeStatus, String startTime, String endTime) {
@@ -493,7 +554,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult queryAllTask() {
         List<SmartDataTask> result = smartDataTaskService.queryAllTask();
         if (result.size() > 0) {
@@ -502,9 +562,7 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
             return CommonResult.fail("没有任何任务");
         }
     }
-
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult queryTaskDebugSql() {
         List<SmartDataTaskSetDebugSql> result = smartDataTaskService.queryTaskDebugSql();
         if (result.size() > 0) {
@@ -515,7 +573,6 @@ public class SmartDataTaskController implements SmartDataTaskControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = true)
     public CommonResult queryTaskSetDebugSql(int tkId, int tkDebugSql) {
         int count = smartDataTaskService.queryTaskSetDebugSql(tkId, tkDebugSql);
         if (count > 0) {

+ 48 - 1
src/main/java/com/template/controller/SmartUserController.java

@@ -4295,7 +4295,54 @@ public class SmartUserController implements SmartUserControllerAPI {
 
             List<SmartIdentity> idnetitys = smartIdentityService.list(null);
 
+            List<Integer> userIds = result.getList().stream().map(UserVo::getId).collect(Collectors.toList());
+            List<UserSubjectVo> teachings = smartTeachingService.querySmartTeachings(userIds);
             for (UserVo data : result.getList()) {
+                //region 任课数据
+                List<UserSubjectVo> ownerTeachings = teachings.stream().filter(e -> e.getUserId().equals(data.getId())).collect(Collectors.toList());
+                if (ownerTeachings != null && ownerTeachings.size() > 0) {
+                    List<SubjectVo> subjectVos = new ArrayList<>();
+                    List<Integer> subjectIds = ownerTeachings.stream().map(UserSubjectVo::getSubjectId).distinct().collect(Collectors.toList());
+                    for (Integer subjectId : subjectIds) {
+                        List<UserSubjectVo> ownerSubjects = ownerTeachings.stream().filter(e -> e.getSubjectId().equals(subjectId)).collect(Collectors.toList());
+                        if (ownerSubjects != null && ownerSubjects.size() > 0) {
+                            SubjectVo sv = new SubjectVo();
+                            sv.setId(subjectId);
+                            sv.setName(ownerSubjects.get(0).getSubjectName());
+                            List<SubjectGradeVo> grades = new ArrayList<>();
+                            List<Integer> gradeIds = ownerSubjects.stream().map(UserSubjectVo::getGradeId).distinct().collect(Collectors.toList());
+                            List<SubjectClassVo> classes = new ArrayList<>();
+                            if (gradeIds != null && gradeIds.size() > 0) {
+                                for (Integer gradeId : gradeIds) {
+                                    String gradeStr = "";
+                                    Optional<UserSubjectVo> oGrade = ownerSubjects.stream().filter(e -> e.getGradeId().equals(gradeId)).findFirst();
+                                    if (oGrade != null && oGrade.isPresent()) {
+                                        gradeStr = oGrade.get().getGradeName();
+                                    }
+                                    SubjectGradeVo grade = new SubjectGradeVo();
+                                    grade.setId(gradeId);
+                                    grade.setName(gradeStr);
+                                    List<UserSubjectVo> classeSubjects = ownerSubjects.stream().filter(e -> e.getGradeId().equals(gradeId)).collect(Collectors.toList());
+                                    if (classeSubjects != null && classeSubjects.size() > 0) {
+                                        for (UserSubjectVo classSubject : classeSubjects) {
+                                            SubjectClassVo classData = new SubjectClassVo();
+                                            classData.setId(classSubject.getClassId());
+                                            classData.setName(classSubject.getClassName());
+                                            classes.add(classData);
+                                        }
+                                    }
+                                    grade.setClasses(classes);
+                                    grades.add(grade);
+                                }
+                            }
+                            sv.setGrades(grades);
+                            subjectVos.add(sv);
+                        }
+                    }
+                    data.setSubjectVos(subjectVos);
+                }
+                //endregion
+
                 data.setTimeGroupName(eGroupTime(data.getTimeGroupId()));
 
                 Optional<SmartIdentity> identityData = idnetitys.stream().filter(e -> e.getId().equals(data.getIdentityId())).findFirst();
@@ -5076,7 +5123,7 @@ public class SmartUserController implements SmartUserControllerAPI {
         }
 
         int result = smartUserService.deleteSmartUserByIds(ur.getUserIds());
-        if(result > 0){
+        if (result > 0) {
             smartTeachingService.deleteByUserIds(ur.getUserIds());
         }
 

+ 6 - 1
src/main/java/com/template/mapper/SmartTeachingMapper.java

@@ -2,8 +2,13 @@ package com.template.mapper;
 
 import com.template.model.pojo.SmartTeaching;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.template.model.pojo.SmartUser;
+import com.template.model.vo.UserSubjectVo;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * <p>
  * 应用管理 Mapper 接口
@@ -14,5 +19,5 @@ import org.springframework.stereotype.Repository;
  */
 @Repository
 public interface SmartTeachingMapper extends BaseMapper<SmartTeaching> {
-
+    List<UserSubjectVo> querySmartTeachings(@Param("userIds") List<Integer> userIds);
 }

+ 54 - 0
src/main/java/com/template/model/vo/UserSubjectVo.java

@@ -0,0 +1,54 @@
+package com.template.model.vo;
+
+import lombok.Data;
+
+/**
+ * @Author: binguo
+ * @Date: 2024/1/5 星期五 14:53
+ * @Description: com.template.model.vo
+ * @Version: 1.0
+ */
+@Data
+public class UserSubjectVo {
+
+    /**
+     * 数据ID
+     */
+    private Integer id;
+
+    /**
+     * 用户ID
+     */
+    private Integer userId;
+
+    /**
+     * 科目ID
+     */
+    private Integer subjectId;
+
+    /**
+     * 科目名称
+     */
+    private String subjectName;
+
+    /**
+     * 年级ID
+     */
+    private Integer gradeId;
+
+    /**
+     * 年级名称
+     */
+    private String gradeName;
+
+    /**
+     * 班级ID
+     */
+    private Integer classId;
+
+    /**
+     * 班级名称
+     */
+    private String className;
+
+}

+ 5 - 0
src/main/java/com/template/model/vo/UserVo.java

@@ -158,4 +158,9 @@ public class UserVo {
      */
     private String timeGroupName;
 
+    /**
+     * 任课数据
+     */
+    private List<SubjectVo> subjectVos;
+
 }

+ 6 - 0
src/main/java/com/template/services/SmartTeachingService.java

@@ -2,6 +2,8 @@ package com.template.services;
 
 import com.template.model.pojo.SmartTeaching;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.template.model.vo.UserSubjectVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -17,4 +19,8 @@ public interface SmartTeachingService extends IService<SmartTeaching> {
     int deleteByUserId(Integer userId);
 
     int deleteByUserIds(List<Integer> userIds);
+
+    List<SmartTeaching> queryByUserIds(List<Integer> userIds);
+
+    List<UserSubjectVo> querySmartTeachings(List<Integer> userIds);
 }

+ 14 - 0
src/main/java/com/template/services/impl/SmartTeachingServiceImpl.java

@@ -5,6 +5,7 @@ import com.template.mapper.SmartSubjectTemplateMapper;
 import com.template.model.evaluate.student.SmartSubjectTemplate;
 import com.template.model.pojo.SmartTeaching;
 import com.template.mapper.SmartTeachingMapper;
+import com.template.model.vo.UserSubjectVo;
 import com.template.services.SmartTeachingService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -41,4 +42,17 @@ public class SmartTeachingServiceImpl extends ServiceImpl<SmartTeachingMapper, S
         int result = smartTeachingMapper.delete(queryWrapper);
         return result;
     }
+
+    @Override
+    public List<SmartTeaching> queryByUserIds(List<Integer> userIds) {
+        QueryWrapper<SmartTeaching> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("user_id", userIds);
+        List<SmartTeaching> result = smartTeachingMapper.selectList(queryWrapper);
+        return result;
+    }
+
+    public List<UserSubjectVo> querySmartTeachings(List<Integer> userIds){
+        List<UserSubjectVo> result = smartTeachingMapper.querySmartTeachings(userIds);
+        return result;
+    }
 }