Browse Source

Merge branch 'pre'

dzx 6 months ago
parent
commit
64015d567d
24 changed files with 172 additions and 73 deletions
  1. 16 0
      src/main/java/com/xjrsoft/module/attendance/controller/AttendanceRuleCategoryController.java
  2. 65 49
      src/main/java/com/xjrsoft/module/attendance/controller/StatisticsController.java
  3. 1 0
      src/main/java/com/xjrsoft/module/attendance/controller/TeacherStatisticsController.java
  4. 3 0
      src/main/java/com/xjrsoft/module/attendance/dto/AddAttendanceRuleCategoryDto.java
  5. 3 0
      src/main/java/com/xjrsoft/module/attendance/dto/AttendanceRuleCategoryPageDto.java
  6. 3 0
      src/main/java/com/xjrsoft/module/attendance/dto/AttendanceStatisticDto.java
  7. 3 0
      src/main/java/com/xjrsoft/module/attendance/dto/TeacherDetailsDto.java
  8. 3 0
      src/main/java/com/xjrsoft/module/attendance/entity/AttendanceRuleCategory.java
  9. 4 0
      src/main/java/com/xjrsoft/module/attendance/mapper/TeacherAttendanceRecordMapper.java
  10. 5 0
      src/main/java/com/xjrsoft/module/attendance/service/ITeacherAttendanceRecordService.java
  11. 15 0
      src/main/java/com/xjrsoft/module/attendance/service/impl/AttendanceRuleCategoryServiceImpl.java
  12. 5 0
      src/main/java/com/xjrsoft/module/attendance/service/impl/TeacherAttendanceRecordServiceImpl.java
  13. 3 0
      src/main/java/com/xjrsoft/module/attendance/vo/AttendanceRuleCategoryPageVo.java
  14. 3 0
      src/main/java/com/xjrsoft/module/attendance/vo/AttendanceRuleCategoryVo.java
  15. 1 1
      src/main/java/com/xjrsoft/module/databoard/controller/DataboardController.java
  16. 2 2
      src/main/java/com/xjrsoft/module/databoard/controller/DatadetailController.java
  17. 1 5
      src/main/java/com/xjrsoft/module/job/AttendanceRecordTask.java
  18. 6 1
      src/main/java/com/xjrsoft/module/job/OfficialDocumentReceivedHandleTask.java
  19. 6 0
      src/main/java/com/xjrsoft/module/job/WfCourseAdjustTask.java
  20. 4 1
      src/main/java/com/xjrsoft/module/oa/service/impl/OfficialDocumentReceivedHandleServiceImpl.java
  21. 9 9
      src/main/java/com/xjrsoft/module/organization/service/impl/UserPostRelationServiceImpl.java
  22. 2 1
      src/main/java/com/xjrsoft/module/student/mapper/CadreDeptMapper.java
  23. 4 4
      src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentAssessmentInspectionServiceImpl.java
  24. 5 0
      src/main/resources/mapper/attendance/TeacherAttendanceRecordMapper.xml

+ 16 - 0
src/main/java/com/xjrsoft/module/attendance/controller/AttendanceRuleCategoryController.java

@@ -69,6 +69,22 @@ public class AttendanceRuleCategoryController {
         return RT.ok(pageOutput);
     }
 
+    @GetMapping(value = "/list")
+    @ApiOperation(value = "考勤规则列表(不分页)")
+    @SaCheckPermission("attendancerulecategory:detail")
+    @XjrLog(value = "考勤规则列表(不分页)")
+    public RT<List<AttendanceRuleCategoryPageVo>> list(@Valid AttendanceRuleCategoryPageDto dto) {
+
+        LambdaQueryWrapper<AttendanceRuleCategory> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper
+                .orderByDesc(AttendanceRuleCategory::getId)
+                .eq(dto.getRoleId() != null, AttendanceRuleCategory::getRoleId, dto.getRoleId())
+                .select(AttendanceRuleCategory.class, x -> VoToColumnUtil.fieldsToColumns(AttendanceRuleCategoryPageVo.class).contains(x.getProperty()));
+        List<AttendanceRuleCategory> page = attendanceRuleCategoryService.list(queryWrapper);
+        List<AttendanceRuleCategoryPageVo> pageOutput = BeanUtil.copyToList(page, AttendanceRuleCategoryPageVo.class);
+        return RT.ok(pageOutput);
+    }
+
     @GetMapping(value = "/info")
     @ApiOperation(value = "根据id查询考勤规则信息")
     @SaCheckPermission("attendancerulecategory:detail")

+ 65 - 49
src/main/java/com/xjrsoft/module/attendance/controller/StatisticsController.java

@@ -19,6 +19,7 @@ import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.attendance.dto.AttendanceStatisticDto;
 import com.xjrsoft.module.attendance.dto.TeacherDetailsDto;
 import com.xjrsoft.module.attendance.entity.AttendanceRuleCategory;
+import com.xjrsoft.module.attendance.entity.AttendanceUserRelation;
 import com.xjrsoft.module.attendance.service.IAttendanceRuleCategoryService;
 import com.xjrsoft.module.attendance.service.ITeacherAttendanceRecordService;
 import com.xjrsoft.module.attendance.vo.TeacherStatisticsPageVo;
@@ -81,15 +82,30 @@ public class StatisticsController {
     @GetMapping(value = "/teacher-statistics")
     @ApiOperation(value = "教职工考勤统计")
     @SaCheckPermission("statistics:detail")
-    @XjrLog(value = "", saveResponseData = true)
+    @XjrLog(value = "教职工考勤统计", saveResponseData = true)
     public RT<TeacherStatisticsVo> teacherStatistics(@Valid AttendanceStatisticDto dto) {
         TeacherStatisticsVo statisticsVo = new TeacherStatisticsVo();
+
+        if(dto.getRuleCategoryId() == null){
+            AttendanceRuleCategory ruleCategory = ruleCategoryService.getOne(
+                    new QueryWrapper<AttendanceRuleCategory>().lambda()
+                            .eq(AttendanceRuleCategory::getIsDefaultShow, 1)
+                            .eq(AttendanceRuleCategory::getRoleId, 2)
+            );
+            if(ruleCategory != null){
+                dto.setRuleCategoryId(ruleCategory.getId());
+            }
+
+        }
+
         //查询总人数
         MPJLambdaWrapper<XjrUser> queryWrapper = MPJWrappers.<XjrUser>lambdaJoin()
-                .disableSubLogicDel()
+                .disableLogicDel()
                 .eq(ObjectUtil.isNotNull(dto.getDeptId()), UserDeptRelation::getDeptId, dto.getDeptId())
+                .eq(AttendanceUserRelation::getAttendanceRuleCategoryId, dto.getRuleCategoryId())
                 .innerJoin(BaseTeacher.class, BaseTeacher::getUserId, XjrUser::getId)
-                .innerJoin(UserDeptRelation.class, UserDeptRelation::getUserId, XjrUser::getId);
+                .innerJoin(UserDeptRelation.class, UserDeptRelation::getUserId, XjrUser::getId)
+                .innerJoin(AttendanceUserRelation.class, AttendanceUserRelation::getUserId, XjrUser::getId);
         long allCount = xjrUserService.count(queryWrapper);
         statisticsVo.setAllCount(allCount);
 
@@ -127,52 +143,52 @@ public class StatisticsController {
         statisticsVo.setLeaveCount(leaveCount);
         statisticsVo.setAbsenteeismCount(absenteeismCount);
 
-        //查询不需要考勤的人
-        List<AttendanceRuleCategory> ruleCategories = ruleCategoryService.list(
-                new QueryWrapper<AttendanceRuleCategory>().lambda()
-                        .eq(AttendanceRuleCategory::getDeleteMark, DeleteMark.NODELETE.getCode())
-                        .eq(AttendanceRuleCategory::getRoleId, 2)
-                        .le(AttendanceRuleCategory::getStartDate, LocalDate.now())
-                        .ge(AttendanceRuleCategory::getEndDate, LocalDate.now())
-        );
-        if(!ruleCategories.isEmpty()){
-            //查询所有需要考勤的人
-            BaseTeacherPageDto teacherPageDto = new BaseTeacherPageDto();
-            List<Long> userIds = new ArrayList<>();
-            List<Long> deptIds = new ArrayList<>();
-            for (AttendanceRuleCategory ruleCategory : ruleCategories) {
-                JsonArray userRelation = new JsonParser().parse(ruleCategory.getUserRelation()).getAsJsonArray();
-
-                for (JsonElement jsonElement : userRelation) {
-                    JsonObject jsonObject = jsonElement.getAsJsonObject();
-                    if(jsonObject.get("deptId") != null && !jsonObject.get("deptId").isJsonNull()){
-                        deptIds.add(jsonObject.get("deptId").getAsLong());
-                    }
-                    if(jsonObject.get("userId") != null && !jsonObject.get("userId").isJsonNull()){
-                        userIds.add(jsonObject.get("userId").getAsLong());
-                    }
-                }
-            }
-            teacherPageDto.setDeptIds(deptIds);
-            List<XjrUserPageVo> attendanceTeacherList = teacherbaseManagerService.getList(teacherPageDto);
-
-            teacherPageDto = new BaseTeacherPageDto();
-            teacherPageDto.setUserIds(userIds);
-            attendanceTeacherList.addAll(teacherbaseManagerService.getList(teacherPageDto));
-            //将所有需要考勤的人的id存入set集合
-            Set<String> attendanceUserIdSet = attendanceTeacherList.stream().map(XjrUserPageVo::getId).collect(Collectors.toSet());
-
-            //查询所有人
-            teacherPageDto = new BaseTeacherPageDto();
-            if(dto.getDeptId() != null){
-                List<Long> dtoDeptIds = new ArrayList<>();
-                dtoDeptIds.add(dto.getDeptId());
-                teacherPageDto.setDeptIds(dtoDeptIds);
-            }
-
-            List<XjrUserPageVo> allTeacherList = teacherbaseManagerService.getList(teacherPageDto);
-            statisticsVo.setNotAttendanceCount(allTeacherList.stream().filter(x -> !attendanceUserIdSet.contains(x.getId())).collect(Collectors.toList()).size());
-        }
+//        //查询不需要考勤的人
+//        List<AttendanceRuleCategory> ruleCategories = ruleCategoryService.list(
+//                new QueryWrapper<AttendanceRuleCategory>().lambda()
+//                        .eq(AttendanceRuleCategory::getDeleteMark, DeleteMark.NODELETE.getCode())
+//                        .eq(AttendanceRuleCategory::getRoleId, 2)
+//                        .le(AttendanceRuleCategory::getStartDate, LocalDate.now())
+//                        .ge(AttendanceRuleCategory::getEndDate, LocalDate.now())
+//        );
+//        if(!ruleCategories.isEmpty()){
+//            //查询所有需要考勤的人
+//            BaseTeacherPageDto teacherPageDto = new BaseTeacherPageDto();
+//            List<Long> userIds = new ArrayList<>();
+//            List<Long> deptIds = new ArrayList<>();
+//            for (AttendanceRuleCategory ruleCategory : ruleCategories) {
+//                JsonArray userRelation = new JsonParser().parse(ruleCategory.getUserRelation()).getAsJsonArray();
+//
+//                for (JsonElement jsonElement : userRelation) {
+//                    JsonObject jsonObject = jsonElement.getAsJsonObject();
+//                    if(jsonObject.get("deptId") != null && !jsonObject.get("deptId").isJsonNull()){
+//                        deptIds.add(jsonObject.get("deptId").getAsLong());
+//                    }
+//                    if(jsonObject.get("userId") != null && !jsonObject.get("userId").isJsonNull()){
+//                        userIds.add(jsonObject.get("userId").getAsLong());
+//                    }
+//                }
+//            }
+//            teacherPageDto.setDeptIds(deptIds);
+//            List<XjrUserPageVo> attendanceTeacherList = teacherbaseManagerService.getList(teacherPageDto);
+//
+//            teacherPageDto = new BaseTeacherPageDto();
+//            teacherPageDto.setUserIds(userIds);
+//            attendanceTeacherList.addAll(teacherbaseManagerService.getList(teacherPageDto));
+//            //将所有需要考勤的人的id存入set集合
+//            Set<String> attendanceUserIdSet = attendanceTeacherList.stream().map(XjrUserPageVo::getId).collect(Collectors.toSet());
+//
+//            //查询所有人
+//            teacherPageDto = new BaseTeacherPageDto();
+//            if(dto.getDeptId() != null){
+//                List<Long> dtoDeptIds = new ArrayList<>();
+//                dtoDeptIds.add(dto.getDeptId());
+//                teacherPageDto.setDeptIds(dtoDeptIds);
+//            }
+//
+//            List<XjrUserPageVo> allTeacherList = teacherbaseManagerService.getList(teacherPageDto);
+//            statisticsVo.setNotAttendanceCount(allTeacherList.stream().filter(x -> !attendanceUserIdSet.contains(x.getId())).collect(Collectors.toList()).size());
+//        }
 
 
         //计算出勤率

+ 1 - 0
src/main/java/com/xjrsoft/module/attendance/controller/TeacherStatisticsController.java

@@ -92,6 +92,7 @@ public class TeacherStatisticsController {
                             " WHERE t1.delete_mark = 0 AND t2.user_id = t.id) as dept_name")
                     .eq(ObjectUtil.isNotNull(dto.getDeptId()), UserDeptRelation::getDeptId, dto.getDeptId())
                     .eq(StrUtil.isNotEmpty(dto.getAttendanceMode()), AttendanceUserRelation::getAttendanceMode, dto.getAttendanceMode())
+                    .eq(ObjectUtil.isNotNull(dto.getRuleCategoryId()), AttendanceUserRelation::getAttendanceRuleCategoryId, dto.getRuleCategoryId())
                     .like(StrUtil.isNotEmpty(dto.getCarNumber()), AttendanceUserRelation::getCarNumber, dto.getCarNumber())
                     .like(StrUtil.isNotEmpty(dto.getName()), User::getName, dto.getName())
                     .selectAs(User::getName, TeacherStatisticsPageVo::getTeacherName)

+ 3 - 0
src/main/java/com/xjrsoft/module/attendance/dto/AddAttendanceRuleCategoryDto.java

@@ -74,4 +74,7 @@ public class AddAttendanceRuleCategoryDto implements Serializable {
 
     @ApiModelProperty("非考勤周期是否允许进出(1:是 0:否)")
     private Integer notCycleIsInOut;
+
+    @ApiModelProperty("是否默认显示(1:是 0:否)")
+    private Integer isDefaultShow;
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/attendance/dto/AttendanceRuleCategoryPageDto.java

@@ -1,6 +1,7 @@
 package com.xjrsoft.module.attendance.dto;
 
 import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -15,5 +16,7 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = false)
 public class AttendanceRuleCategoryPageDto extends PageInput {
 
+    @ApiModelProperty("被考勤角色(xjr_role)")
+    private Long roleId;
 
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/attendance/dto/AttendanceStatisticDto.java

@@ -29,4 +29,7 @@ public class AttendanceStatisticDto extends PageInput {
 
     @ApiModelProperty("部门id")
     private Long deptId;
+
+    @ApiModelProperty("考勤规则id")
+    private Long ruleCategoryId;
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/attendance/dto/TeacherDetailsDto.java

@@ -32,4 +32,7 @@ public class TeacherDetailsDto extends PageInput {
 
     @ApiModelProperty("车牌号")
     private String carNumber;
+
+    @ApiModelProperty("考勤规则id")
+    private Long ruleCategoryId;
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/attendance/entity/AttendanceRuleCategory.java

@@ -125,4 +125,7 @@ public class AttendanceRuleCategory implements Serializable {
     @ApiModelProperty("非考勤周期是否允许进出(1:是 0:否)")
     private Integer notCycleIsInOut;
 
+    @ApiModelProperty("是否默认显示(1:是 0:否)")
+    private Integer isDefaultShow;
+
 }

+ 4 - 0
src/main/java/com/xjrsoft/module/attendance/mapper/TeacherAttendanceRecordMapper.java

@@ -6,6 +6,7 @@ import com.xjrsoft.module.attendance.dto.TeacherDetailsDto;
 import com.xjrsoft.module.attendance.entity.TeacherAttendanceRecord;
 import com.xjrsoft.module.attendance.vo.TeacherStatisticsPageVo;
 import com.xjrsoft.module.teacher.entity.WfTeacherleave;
+import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -25,4 +26,7 @@ public interface TeacherAttendanceRecordMapper extends MPJBaseMapper<TeacherAtte
 
 
     List<TeacherAttendanceRecord> getLeaveList(@Param("dto") WfTeacherleave dto);
+
+    @Delete("delete from teacher_attendance_record where time_interval = #{timePeriod} and attendance_date = '#{attendanceDate}'")
+    Boolean deleteRecord(@Param("timePeriod") Integer timePeriod, @Param("attendanceDate") String attendanceDate);
 }

+ 5 - 0
src/main/java/com/xjrsoft/module/attendance/service/ITeacherAttendanceRecordService.java

@@ -6,7 +6,10 @@ import com.xjrsoft.module.attendance.dto.ResetTeacherAttendanceRecordDto;
 import com.xjrsoft.module.attendance.dto.TeacherDetailsDto;
 import com.xjrsoft.module.attendance.entity.TeacherAttendanceRecord;
 import com.xjrsoft.module.attendance.vo.TeacherStatisticsPageVo;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Param;
 
+import java.time.LocalDateTime;
 import java.util.List;
 
 /**
@@ -23,4 +26,6 @@ public interface ITeacherAttendanceRecordService extends MPJBaseService<TeacherA
     List<TeacherStatisticsPageVo> getList(TeacherDetailsDto dto);
 
     Boolean resetData(ResetTeacherAttendanceRecordDto dto);
+
+    Boolean deleteRecord(Integer timePeriod, String attendanceDate);
 }

+ 15 - 0
src/main/java/com/xjrsoft/module/attendance/service/impl/AttendanceRuleCategoryServiceImpl.java

@@ -57,6 +57,13 @@ public class AttendanceRuleCategoryServiceImpl extends MPJBaseServiceImpl<Attend
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean add(AddAttendanceRuleCategoryDto dto) {
+        List<AttendanceRuleCategory> defaultShowRuleCategories = this.list(
+                new QueryWrapper<AttendanceRuleCategory>().lambda()
+                        .eq(AttendanceRuleCategory::getIsDefaultShow, 1)
+        );
+        if(!defaultShowRuleCategories.isEmpty()){
+            throw new MyException("已存在一个默认显示的规则,无法再次添加");
+        }
         AttendanceRuleCategory attendanceRuleCategory = BeanUtil.toBean(dto, AttendanceRuleCategory.class);
         attendanceRuleCategory.setUserRelation(JsonUtil.toJsonString(dto.getAttendanceUserRelationList()));
 
@@ -209,6 +216,14 @@ public class AttendanceRuleCategoryServiceImpl extends MPJBaseServiceImpl<Attend
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean update(UpdateAttendanceRuleCategoryDto dto) {
+        List<AttendanceRuleCategory> defaultShowRuleCategories = this.list(
+                new QueryWrapper<AttendanceRuleCategory>().lambda()
+                        .eq(AttendanceRuleCategory::getIsDefaultShow, 1)
+                        .ne(AttendanceRuleCategory::getId, dto.getId())
+        );
+        if(!defaultShowRuleCategories.isEmpty()){
+            throw new MyException("已存在一个默认显示的规则,无法再次添加");
+        }
         AttendanceRuleCategory attendanceRuleCategory = BeanUtil.toBean(dto, AttendanceRuleCategory.class);
         attendanceRuleCategory.setUserRelation(JsonUtil.toJsonString(dto.getAttendanceUserRelationList()));
         if (attendanceRuleCategory.getAttendanceRange() == 1) {

+ 5 - 0
src/main/java/com/xjrsoft/module/attendance/service/impl/TeacherAttendanceRecordServiceImpl.java

@@ -71,4 +71,9 @@ public class TeacherAttendanceRecordServiceImpl extends MPJBaseServiceImpl<Teach
         }
         return true;
     }
+
+    @Override
+    public Boolean deleteRecord(Integer timePeriod, String attendanceDate) {
+        return this.baseMapper.deleteRecord(timePeriod, attendanceDate);
+    }
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/attendance/vo/AttendanceRuleCategoryPageVo.java

@@ -93,4 +93,7 @@ public class AttendanceRuleCategoryPageVo {
     @ApiModelProperty("非考勤周期是否允许进出(1:是 0:否)")
     private Integer notCycleIsInOut;
 
+    @ApiModelProperty("是否默认显示(1:是 0:否)")
+    private Integer isDefaultShow;
+
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/attendance/vo/AttendanceRuleCategoryVo.java

@@ -76,4 +76,7 @@ public class AttendanceRuleCategoryVo {
     @ApiModelProperty("attendanceUserRelation子表")
     private List<AddAttendanceUserRelationDto> attendanceUserRelationList;
 
+    @ApiModelProperty("是否默认显示(1:是 0:否)")
+    private Integer isDefaultShow;
+
 }

+ 1 - 1
src/main/java/com/xjrsoft/module/databoard/controller/DataboardController.java

@@ -328,7 +328,7 @@ public class DataboardController {
         list = SqlRunnerAdapter.db().selectList(sql);
         for (Map<String, Object> objectMap : list) {
             if (objectMap.get("gender") != null && GenderDictionaryEnum.FEMALE.getCode().equals(objectMap.get("gender").toString())) {
-                result.setInfectionFemaleCount(Integer.parseInt(objectMap.get("a_count").toString()));
+                result.setPsychologicalFemaleCount(Integer.parseInt(objectMap.get("a_count").toString()));
             }
             if (objectMap.get("gender") != null && GenderDictionaryEnum.MALE.getCode().equals(objectMap.get("gender").toString())) {
                 result.setPsychologicalMaleCount(Integer.parseInt(objectMap.get("a_count").toString()));

+ 2 - 2
src/main/java/com/xjrsoft/module/databoard/controller/DatadetailController.java

@@ -196,7 +196,7 @@ public class DatadetailController {
     @SaCheckPermission("datadetail:detail")
     @XjrLog(value = "学生健康统计", saveResponseData = true)
     public RT<HealthStatisticsDetailVo> healthStatistics(@Valid StatisticsDetailDto dto) {
-        String sql = "SELECT t1.gender,COUNT(t1.*) AS a_count FROM student_infection t1" +
+        String sql = "SELECT t1.gender,COUNT(t1.id) AS a_count FROM student_infection t1" +
                 " INNER JOIN xjr_workflow_form_relation t2 ON t1.id = t2.form_key_value" +
                 " WHERE t2.current_state = 'COMPLETED' GROUP BY t1.gender";
         List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
@@ -210,7 +210,7 @@ public class DatadetailController {
             }
         }
 
-        sql = "SELECT t1.gender,COUNT(t1.*) AS a_count FROM student_psychological t1" +
+        sql = "SELECT t1.gender,COUNT(t1.id) AS a_count FROM student_psychological t1" +
                 " INNER JOIN xjr_workflow_form_relation t2 ON t1.id = t2.form_key_value" +
                 " WHERE t2.current_state = 'COMPLETED' GROUP BY t1.gender";
         list = SqlRunnerAdapter.db().selectList(sql);

+ 1 - 5
src/main/java/com/xjrsoft/module/job/AttendanceRecordTask.java

@@ -464,11 +464,7 @@ public class AttendanceRecordTask {
         }
 
         if (!insertList.isEmpty()) {
-            recordService.remove(
-                    new QueryWrapper<TeacherAttendanceRecord>().lambda()
-                            .eq(TeacherAttendanceRecord::getAttendanceDate, startDateTime.toLocalDate())
-                            .eq(TeacherAttendanceRecord::getTimeInterval, timePeriod)
-            );
+            recordService.deleteRecord(timePeriod, startDateTime.toLocalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
             recordService.saveBatch(insertList);
         }
     }

+ 6 - 1
src/main/java/com/xjrsoft/module/job/OfficialDocumentReceivedHandleTask.java

@@ -1,11 +1,13 @@
 package com.xjrsoft.module.job;
 
+import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.EnabledMark;
 import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.config.CommonPropertiesConfig;
 import com.xjrsoft.module.oa.entity.OfficialDocumentReceived;
 import com.xjrsoft.module.oa.entity.OfficialDocumentReceivedHandle;
 import com.xjrsoft.module.oa.service.IOfficialDocumentReceivedHandleService;
@@ -66,6 +68,9 @@ public class OfficialDocumentReceivedHandleTask {
     @Autowired
     private IWeChatService weChatService;
 
+    @Autowired
+    private CommonPropertiesConfig commonPropertiesConfig;
+
     @Async
     @Scheduled(cron = "00 0/60 * * * ?")
     public void execute() {
@@ -110,7 +115,7 @@ public class OfficialDocumentReceivedHandleTask {
                 WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
                 weChatSendMessageDto.setUserId(user.getOpenId());
                 weChatSendMessageDto.setTemplateId("qmpXORPM1Cocqn503Qa4On6BJhR92UZ00eod2-6IcGo");
-                //weChatSendMessageDto.setUrl(StrUtil.format("{}/pages/message/notice/detail?id={}", commonPropertiesConfig.getDomainApp(), id));
+                weChatSendMessageDto.setUrl(StrUtil.format("{}/pages/undertake/detail?id={}", commonPropertiesConfig.getDomainApp(), received.getId()));
                 weChatSendMessageDto.setMsgId(handle.getId().toString());
                 JSONObject data = new JSONObject();
 

+ 6 - 0
src/main/java/com/xjrsoft/module/job/WfCourseAdjustTask.java

@@ -1,5 +1,6 @@
 package com.xjrsoft.module.job;
 
+import cn.hutool.extra.spring.SpringUtil;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.EnabledMark;
@@ -37,6 +38,11 @@ public class WfCourseAdjustTask {
     @Async
     @Scheduled(cron = "0 */10 * * * ?")
     public void execute() {
+        String active = SpringUtil.getActiveProfile();
+        if (!"prod".equals(active)) {
+            log.info("非正式环境,无法执行数据推送");
+            return;
+        }
         List<WfCourseAdjust> list = wfCourseAdjustService.list(
                 new MPJLambdaWrapper<WfCourseAdjust>()
                         .select(WfCourseAdjust::getId)

+ 4 - 1
src/main/java/com/xjrsoft/module/oa/service/impl/OfficialDocumentReceivedHandleServiceImpl.java

@@ -3,10 +3,12 @@ package com.xjrsoft.module.oa.service.impl;
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.config.CommonPropertiesConfig;
 import com.xjrsoft.module.oa.dto.AddOfficialDocumentReceivedHandleAlertSetDto;
 import com.xjrsoft.module.oa.dto.AddOfficialDocumentReceivedHandleDto;
 import com.xjrsoft.module.oa.dto.OfficialDocumentReceivedHandlePageDto;
@@ -40,6 +42,7 @@ public class OfficialDocumentReceivedHandleServiceImpl extends MPJBaseServiceImp
     private final OfficialDocumentReceivedMapper documentReceivedMapper;
     private final IWeChatService weChatService;
     private final UserMapper userMapper;
+    private final CommonPropertiesConfig commonPropertiesConfig;
 
     @Override
     public Page<OfficialDocumentReceivedHandlePageVo> getPage(Page<OfficialDocumentReceivedHandlePageVo> page, OfficialDocumentReceivedHandlePageDto dto) {
@@ -106,7 +109,7 @@ public class OfficialDocumentReceivedHandleServiceImpl extends MPJBaseServiceImp
             WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
             weChatSendMessageDto.setUserId(user.getOpenId());
             weChatSendMessageDto.setTemplateId("qmpXORPM1Cocqn503Qa4On6BJhR92UZ00eod2-6IcGo");
-            //weChatSendMessageDto.setUrl(StrUtil.format("{}/pages/message/notice/detail?id={}", commonPropertiesConfig.getDomainApp(), id));
+            weChatSendMessageDto.setUrl(StrUtil.format("{}/pages/undertake/detail?id={}", commonPropertiesConfig.getDomainApp(), handle.getOfficialDocumentReceivedId()));
             weChatSendMessageDto.setMsgId(IdUtil.getSnowflakeNextIdStr());
             JSONObject data = new JSONObject();
 

+ 9 - 9
src/main/java/com/xjrsoft/module/organization/service/impl/UserPostRelationServiceImpl.java

@@ -87,15 +87,15 @@ public class UserPostRelationServiceImpl extends ServiceImpl<UserPostRelationMap
         List<Long> containList = list.stream().map(UserDeptRelation::getUserId).filter(u -> finalUserIds.contains(u)).collect(Collectors.toList());
         //拿userIds和userIdList的差集
         List<Long> subtractList = (List<Long>) CollectionUtil.subtract(userIds, containList);
-        if (subtractList.size() > 0) {
-            for (Long userId : subtractList) {
-                UserDeptRelation userDeptRelation = new UserDeptRelation();
-                userDeptRelation.setUserId(userId);
-                userDeptRelation.setDeptId(deptId);
-                userDeptRelationList.add(userDeptRelation);
-            }
-            userDeptRelationService.saveBatch(userDeptRelationList);
-        }
+//        if (!subtractList.isEmpty()) {
+//            for (Long userId : subtractList) {
+//                UserDeptRelation userDeptRelation = new UserDeptRelation();
+//                userDeptRelation.setUserId(userId);
+//                userDeptRelation.setDeptId(deptId);
+//                userDeptRelationList.add(userDeptRelation);
+//            }
+//            userDeptRelationService.saveBatch(userDeptRelationList);
+//        }
 
         List<Long> finalUserIds1 = userIds;
         finalUserIds1.addAll(userIdList);

+ 2 - 1
src/main/java/com/xjrsoft/module/student/mapper/CadreDeptMapper.java

@@ -5,6 +5,7 @@ import com.xjrsoft.module.student.dto.CadreDeptTreeDto;
 import com.xjrsoft.module.student.entity.CadreDept;
 import com.xjrsoft.module.student.vo.CadreDeptTreeVo;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -16,5 +17,5 @@ import java.util.List;
  */
 @Mapper
 public interface CadreDeptMapper extends MPJBaseMapper<CadreDept> {
-    List<CadreDeptTreeVo> getCadreDeptTree(CadreDeptTreeDto dto);
+    List<CadreDeptTreeVo> getCadreDeptTree(@Param("dto") CadreDeptTreeDto dto);
 }

+ 4 - 4
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentAssessmentInspectionServiceImpl.java

@@ -241,11 +241,11 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
                         .selectAs(XjrUser::getName, CalssQuantitativeAssessmentPageVo::getHeadTeacherName)
                         .selectAs(BaseClass::getId, CalssQuantitativeAssessmentPageVo::getClassId)
                         .selectAs(BaseClass::getName, CalssQuantitativeAssessmentPageVo::getClassName)
-                        .select("SELECT COUNT(DISTINCT(a1.id)) as student_num FROM xjr_user a1" +
+                        .select("(SELECT COUNT(DISTINCT(a1.id)) FROM xjr_user a1" +
                                 " LEFT JOIN base_student_school_roll a2 ON a1.id = a2.user_id" +
                                 " WHERE a1.delete_mark = 0 AND a2.delete_mark = 0" +
                                 " AND a2.class_id = t1.id" +
-                                " AND a2.archives_status = 'FB2901' ")
+                                " AND a2.archives_status = 'FB2901') as student_num")
                         .selectAs(BaseClass::getIsGraduate, CalssQuantitativeAssessmentPageVo::getClassStatus)
                         .leftJoin(XjrUser.class, XjrUser::getId, BaseClass::getTeacherId)
                         .eq(dto.getGradeId() != null, BaseClass::getGradeId, dto.getGradeId())
@@ -450,11 +450,11 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
                 .selectAs(XjrUser::getName, CalssQuantitativeAssessmentPageVo::getHeadTeacherName)
                 .selectAs(BaseClass::getId, CalssQuantitativeAssessmentPageVo::getClassId)
                 .selectAs(BaseClass::getName, CalssQuantitativeAssessmentPageVo::getClassName)
-                .select("SELECT COUNT(DISTINCT(a1.id)) as student_num FROM xjr_user a1" +
+                .select("(SELECT COUNT(DISTINCT(a1.id)) FROM xjr_user a1" +
                         " LEFT JOIN base_student_school_roll a2 ON a1.id = a2.user_id" +
                         " WHERE a1.delete_mark = 0 AND a2.delete_mark = 0" +
                         " AND a2.class_id = t1.id" +
-                        " AND a2.archives_status = 'FB2901' ")
+                        " AND a2.archives_status = 'FB2901') as student_num")
                 .selectAs(BaseClass::getIsGraduate, CalssQuantitativeAssessmentPageVo::getClassStatus)
                 .leftJoin(XjrUser.class, XjrUser::getId, BaseClass::getTeacherId)
                 .eq(dto.getGradeId() != null, BaseClass::getGradeId, dto.getGradeId())

+ 5 - 0
src/main/resources/mapper/attendance/TeacherAttendanceRecordMapper.xml

@@ -12,12 +12,17 @@
             inner join xjr_user_dept_relation t3 on t2.id = t3.user_id
             and t3.dept_id = #{dto.deptId}
         </if>
+        INNER JOIN attendance_user_relation t4 ON t1.user_id = t4.user_id
         WHERE t1.delete_mark = 0
+          and t4.delete_mark = 0
         AND t1.attendance_date = #{dto.date}
         AND t1.time_interval = #{dto.timePeriod}
         <if test="dto.name != null and dto.name != ''">
             and t2.name like concat('%', #{dto.name},'%')
         </if>
+        <if test="dto.ruleCategoryId != null">
+            and t4.attendance_rule_category_id = #{dto.ruleCategoryId}
+        </if>
         <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
             and t2.credential_number like concat('%', #{dto.credentialNumber},'%')
         </if>