Ver Fonte

Merge branch 'pre'

dzx há 1 ano atrás
pai
commit
7887da2e1a

+ 2 - 2
src/main/java/com/xjrsoft/module/courseTable/service/impl/CourseTableServiceImpl.java

@@ -222,7 +222,7 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
             if (dto.getWeek() == null) {
                 for (int i = 0; i < weeks; i++) {
                     LocalDateTime startDate = startDateTime.plusDays(i * 7).withHour(0).withMinute(0).withSecond(0).withNano(0);
-                    LocalDateTime endDate = startDateTime.plusDays((i + 1) * 6).withHour(23).withMinute(59).withSecond(59).withNano(9999);
+                    LocalDateTime endDate = startDate.plusDays(6).withHour(23).withMinute(59).withSecond(59).withNano(9999);
                     if (now.isAfter(startDate) && now.isBefore(endDate)) {
                         tableVo.setWeek("第" + (i + 1) + "周");
                     }
@@ -231,7 +231,7 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
                 }
             } else {
                 LocalDateTime startDate = startDateTime.plusDays((dto.getWeek() - 1) * 7).withHour(0).withMinute(0).withSecond(0).withNano(0);
-                LocalDateTime endDate = startDateTime.plusDays(dto.getWeek() * 6).withHour(23).withMinute(59).withSecond(59).withNano(9999);
+                LocalDateTime endDate = startDate.plusDays(6).withHour(23).withMinute(59).withSecond(59).withNano(9999);
                 dto.setStartDate(startDate);
                 dto.setEndDate(endDate);
                 tableVo.setWeek("第" + dto.getWeek() + "周");

+ 109 - 0
src/main/java/com/xjrsoft/module/job/HikvisionLeaveTask.java

@@ -0,0 +1,109 @@
+package com.xjrsoft.module.job;
+
+import cn.hutool.extra.spring.SpringUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.xjrsoft.module.hikvision.entity.HikvisionData;
+import com.xjrsoft.module.hikvision.mapper.HikvisionDataMapper;
+import com.xjrsoft.module.hikvision.util.ApiUtil;
+import com.xjrsoft.module.student.entity.StudentLeave;
+import com.xjrsoft.module.student.service.IStudentLeaveService;
+import com.xjrsoft.module.teacher.entity.WfTeacherleave;
+import com.xjrsoft.module.teacher.service.IWfTeacherleaveService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 请假结束之后,删除下发到海康的一卡通权限
+ * @author dzx
+ * @date 2024/5/8
+ */
+@Component
+@Slf4j
+public class HikvisionLeaveTask {
+
+    @Autowired
+    private IStudentLeaveService studentLeaveService;
+
+    @Autowired
+    private IWfTeacherleaveService teacherleaveService;
+
+    @Autowired
+    private HikvisionDataMapper hikvisionDataMapper;
+
+    @Scheduled(cron = "0 */15 * * * ?")
+    public void execute() {
+        doExecute();
+    }
+    public void doExecute() {
+        String active = SpringUtil.getActiveProfile();
+        if(!"prod".equals(active)){
+            log.info("非正式环境,无法执行数据推送");
+            return;
+        }
+
+        List<String> sourceIds = new ArrayList<>();
+        
+        List<StudentLeave> studentList = studentLeaveService.list(
+                new QueryWrapper<StudentLeave>().lambda()
+                        .isNotNull(StudentLeave::getHikvisionResult)
+                        .gt(StudentLeave::getEndDate, LocalDate.now())
+        );
+        for (StudentLeave studentLeave : studentList) {
+            sourceIds.add(studentLeave.getStudentUserId().toString());
+        }
+        
+        List<WfTeacherleave> teacherList = teacherleaveService.list(
+                new QueryWrapper<WfTeacherleave>().lambda()
+                        .isNotNull(WfTeacherleave::getHikvisionResult)
+                        .gt(WfTeacherleave::getLeaveEndTime, new Date())
+        );
+        for (WfTeacherleave teacherleave : teacherList) {
+            String[] split = teacherleave.getUserId().split(",");
+            sourceIds.addAll( Arrays.asList(split));
+        }
+
+        if(sourceIds.isEmpty()){
+            return;
+        }
+
+        List<HikvisionData> hikvisionData = hikvisionDataMapper.selectList(
+                new QueryWrapper<HikvisionData>().lambda()
+                        .in(HikvisionData::getSourceId, sourceIds)
+        );
+
+        ApiUtil apiUtil = new ApiUtil();
+        String apiPath = "/api/acps/v1/auth_config/delete";
+
+        JsonObject paramJson = new JsonObject();
+
+        JsonArray personDatas = new JsonArray();
+        JsonObject personData = new JsonObject();
+
+        JsonArray indexCodes = new JsonArray();
+        for (HikvisionData el : hikvisionData) {
+            indexCodes.add(el.getHikvisionId());
+        }
+        personData.addProperty("personDataType","personGroup");
+        personData.add("indexCodes", indexCodes);
+        personDatas.add(personData);
+        paramJson.add("personDatas", personDatas);
+
+        Map<String, String> header = new HashMap<>();
+        header.put("tagId", "deltoken");
+        //调用接口获取到返回内容,并将其存到数据库中
+        String result = apiUtil.doPost(apiPath, paramJson.toString(), null, header);
+        System.out.println(result);
+    }
+}

+ 14 - 1
src/main/java/com/xjrsoft/module/organization/controller/UserController.java

@@ -94,7 +94,11 @@ import com.xjrsoft.module.system.service.IFileService;
 import com.xjrsoft.module.teacher.entity.BaseTeacher;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import com.xjrsoft.module.workflow.constant.WorkflowConstant;
+import com.xjrsoft.module.workflow.entity.WorkflowCirculated;
+import com.xjrsoft.module.workflow.entity.WorkflowSchema;
+import com.xjrsoft.module.workflow.service.IWorkflowCirculatedService;
 import com.xjrsoft.module.workflow.service.IWorkflowExecuteService;
+import com.xjrsoft.module.workflow.vo.CirculatedTaskPageVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -160,6 +164,7 @@ public class UserController {
 
     private final IBaseStudentSchoolRollService baseStudentSchoolRollService;
     private final IWhitelistManagementService whitelistManagementService;
+    private final IWorkflowCirculatedService circulatedService;
 
     @GetMapping(value = "/list")
     @ApiOperation(value = "用户列表(不分页)")
@@ -429,7 +434,6 @@ public class UserController {
         List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery.orderByProcessInstanceStartTime().desc().list();
 
         //获取到所有流程id
-        List<String> processIds = historicProcessInstances.stream().map(HistoricProcessInstance::getId).collect(Collectors.toList());
         int myApplicationCount = 0;
         for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) {
             Long countByProcessId = workflowExecuteService.getCountByProcessId(historicProcessInstance.getId());
@@ -443,6 +447,15 @@ public class UserController {
         }
         pendingCountDto.setMyApplicationCount(myApplicationCount);
 
+        long circulatedCount = circulatedService.count(
+                MPJWrappers.<WorkflowCirculated>lambdaJoin()
+                        .eq(WorkflowCirculated::getCirculatedUserId, StpUtil.getLoginIdAsLong())
+                        .eq(WorkflowCirculated::getIsRead, 0)
+                        .select(WorkflowCirculated::getId)
+                        .leftJoin(User.class, User::getId, WorkflowCirculated::getStartUserId)
+                        .leftJoin(WorkflowSchema.class, WorkflowSchema::getId, WorkflowCirculated::getSchemaId)
+        );
+        pendingCountDto.setCirculatedCount(circulatedCount);
         return RT.ok(pendingCountDto);
     }
 

+ 6 - 0
src/main/java/com/xjrsoft/module/organization/vo/PendingCountDto.java

@@ -1,5 +1,6 @@
 package com.xjrsoft.module.organization.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -12,7 +13,12 @@ public class PendingCountDto implements Serializable {
     /**
      * 流程待办数量
      */
+    @ApiModelProperty("流程待办数量")
     private long wfPendingCount;
 
+    @ApiModelProperty("我的申请数量")
     private long myApplicationCount;
+
+    @ApiModelProperty("我的传阅数量")
+    private long circulatedCount;
 }

+ 17 - 10
src/main/java/com/xjrsoft/module/schedule/controller/ScheduleController.java

@@ -199,17 +199,24 @@ public class ScheduleController {
     public RT<String> preCheck(CourseTablePreCheckDto dto) throws Exception {
         if(dto.getPreCheckType() != null){
             if(dto.getPreCheckType() == 1){
-                CourseTable courseTable = courseTableService.getById(dto.getCourseId());
-                CourseTable swapCourseTable = courseTableService.getById(dto.getSwapCourseId());
-                JsonObject preCheck = getExtendPreCheck(dto, courseTable, swapCourseTable);
-                if(preCheck.get("code").getAsInt() != 0){
-                   return RT.error(preCheck.get("msg").getAsString());
+                for (int i = 0; i < dto.getCourseIds().size(); i ++){
+                    Long courseId = dto.getCourseIds().get(i);
+                    Long swapCourseId = dto.getSwapCourseIds().get(i);
+                    CourseTable courseTable = courseTableService.getById(courseId);
+                    CourseTable swapCourseTable = courseTableService.getById(swapCourseId);
+                    JsonObject preCheck = getExtendPreCheck(dto, courseTable, swapCourseTable);
+                    if(preCheck.get("code").getAsInt() != 0){
+                        return RT.error(preCheck.get("msg").getAsString());
+                    }
                 }
+
             }else if(dto.getPreCheckType() == 2){
-                CourseTable courseTable = courseTableService.getById(dto.getCourseId());
-                JsonObject jsonObject = substitutePreTestin(dto, courseTable);
-                if(jsonObject.get("code").getAsInt() != 0){
-                    return RT.error(jsonObject.get("msg").getAsString());
+                for (Long courseId : dto.getCourseIds()) {
+                    CourseTable courseTable = courseTableService.getById(courseId);
+                    JsonObject jsonObject = substitutePreTestin(dto, courseTable);
+                    if(jsonObject.get("code").getAsInt() != 0){
+                        return RT.error(jsonObject.get("msg").getAsString());
+                    }
                 }
             }
         }
@@ -331,7 +338,7 @@ public class ScheduleController {
         List<ScheduleWeekVo> result = new ArrayList<>();
         for (int i = 0; i < weeks; i++) {
             LocalDateTime startDate = startDateTime.plusDays(i * 7).withHour(0).withMinute(0).withSecond(0).withNano(0);
-            LocalDateTime endDate = startDateTime.plusDays((i + 1) * 6).withHour(23).withMinute(59).withSecond(59).withNano(9999);
+            LocalDateTime endDate = startDate.plusDays(6).withHour(23).withMinute(59).withSecond(59).withNano(9999);
             int week = i + 1;
             result.add(
                     new ScheduleWeekVo(){{

+ 3 - 2
src/main/java/com/xjrsoft/module/schedule/dto/CourseTablePreCheckDto.java

@@ -5,6 +5,7 @@ import lombok.Data;
 
 import java.io.Serializable;
 import java.time.LocalDateTime;
+import java.util.List;
 
 
 /**
@@ -22,10 +23,10 @@ public class CourseTablePreCheckDto implements Serializable {
     private Integer preCheckType;
 
     @ApiModelProperty("需要调课的课程id")
-    private Long courseId;
+    private List<Long> courseIds;
 
     @ApiModelProperty("被对调的课程id(调课时使用)")
-    private Long swapCourseId;
+    private List<Long> swapCourseIds;
 
     @ApiModelProperty("被对调的日期(调课时使用)")
     private LocalDateTime swapDate;