Quellcode durchsuchen

Merge branch 'pre'

dzx vor 1 Jahr
Ursprung
Commit
0268616995
17 geänderte Dateien mit 496 neuen und 55 gelöschten Zeilen
  1. 13 1
      src/main/java/com/xjrsoft/module/outint/controller/TeacherOutInRecordController.java
  2. 28 0
      src/main/java/com/xjrsoft/module/outint/dto/SyncHikvsionDataDto.java
  3. 3 0
      src/main/java/com/xjrsoft/module/outint/service/ITeacherOutInRecordService.java
  4. 48 0
      src/main/java/com/xjrsoft/module/outint/service/impl/TeacherOutInRecordServiceImpl.java
  5. 26 1
      src/main/java/com/xjrsoft/module/personnel/controller/CarMessageApplyController.java
  6. 33 0
      src/main/java/com/xjrsoft/module/personnel/dto/UpdateCarMessageApplyEndTimeDto.java
  7. 3 3
      src/main/java/com/xjrsoft/module/student/controller/BaseStudentPunishmentInfoController.java
  8. 15 0
      src/main/java/com/xjrsoft/module/student/service/IBasePunishmentTypeService.java
  9. 19 0
      src/main/java/com/xjrsoft/module/student/service/impl/BasePunishmentTypeServiceImpl.java
  10. 12 1
      src/main/java/com/xjrsoft/module/teacher/controller/TeacherbaseManagerController.java
  11. 3 0
      src/main/java/com/xjrsoft/module/teacher/service/ITeacherbaseManagerService.java
  12. 192 0
      src/main/java/com/xjrsoft/module/teacher/service/impl/TeacherbaseManagerServiceImpl.java
  13. 45 9
      src/main/java/com/xjrsoft/module/textbook/dto/TextbookImportDto.java
  14. 7 0
      src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookServiceImpl.java
  15. 39 30
      src/main/resources/mapper/evaluate/EvaluateResultMapper.xml
  16. 4 4
      src/main/resources/mapper/student/BaseStudentPunishmentInfoMapper.xml
  17. 6 6
      src/main/resources/mapper/student/StudentHonorsMapper.xml

+ 13 - 1
src/main/java/com/xjrsoft/module/outint/controller/TeacherOutInRecordController.java

@@ -7,13 +7,17 @@ import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.yulichang.toolkit.MPJWrappers;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.LocalDateTimeUtil;
 import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.hikvision.util.ApiUtil;
 import com.xjrsoft.module.organization.entity.UserDeptRelation;
 import com.xjrsoft.module.outint.dto.AddTeacherOutInRecordDto;
+import com.xjrsoft.module.outint.dto.SyncHikvsionDataDto;
 import com.xjrsoft.module.outint.dto.TeacherOutInRecordPageDto;
 import com.xjrsoft.module.outint.dto.UpdateTeacherOutInRecordDto;
 import com.xjrsoft.module.outint.entity.StudentOutInRecord;
@@ -100,7 +104,7 @@ public class TeacherOutInRecordController {
     public RT<Boolean> add(@Valid @RequestBody AddTeacherOutInRecordDto dto){
         TeacherOutInRecord teacherOutInRecord = BeanUtil.toBean(dto, TeacherOutInRecord.class);
         boolean isSuccess = teacherOutInRecordService.save(teacherOutInRecord);
-    return RT.ok(isSuccess);
+        return RT.ok(isSuccess);
     }
 
     @PutMapping
@@ -118,7 +122,15 @@ public class TeacherOutInRecordController {
     @SaCheckPermission("teacheroutinrecord:delete")
     public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
         return RT.ok(teacherOutInRecordService.removeBatchByIds(ids));
+    }
+
+    @PostMapping("/sync-hikvision-data")
+    @ApiOperation(value = "同步教师出入记录")
+    @SaCheckPermission("teacheroutinrecord:add")
+    public RT<Boolean> syncHikvisionData(@Valid @RequestBody SyncHikvsionDataDto dto){
+
 
+        return RT.ok(teacherOutInRecordService.syncHikvisionData(dto));
     }
 
 }

+ 28 - 0
src/main/java/com/xjrsoft/module/outint/dto/SyncHikvsionDataDto.java

@@ -0,0 +1,28 @@
+package com.xjrsoft.module.outint.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+
+
+/**
+* @title: 教师出入记录
+* @Author dzx
+* @Date: 2024-05-14
+* @Version 1.0
+*/
+@Data
+public class SyncHikvsionDataDto{
+
+    private static final long serialVersionUID = 1L;
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty("同步开始时间")
+    private LocalDateTime startTime;
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty("同步截止时间")
+    private LocalDateTime endTime;
+}

+ 3 - 0
src/main/java/com/xjrsoft/module/outint/service/ITeacherOutInRecordService.java

@@ -1,6 +1,7 @@
 package com.xjrsoft.module.outint.service;
 
 import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.outint.dto.SyncHikvsionDataDto;
 import com.xjrsoft.module.outint.dto.TeacherOutInRecordDto;
 import com.xjrsoft.module.outint.entity.TeacherOutInRecord;
 import org.apache.ibatis.annotations.Param;
@@ -17,4 +18,6 @@ import java.util.List;
 public interface ITeacherOutInRecordService extends MPJBaseService<TeacherOutInRecord> {
 
     List<TeacherOutInRecord> getListByParam(TeacherOutInRecordDto dto);
+
+    Boolean syncHikvisionData(SyncHikvsionDataDto dto);
 }

+ 48 - 0
src/main/java/com/xjrsoft/module/outint/service/impl/TeacherOutInRecordServiceImpl.java

@@ -1,13 +1,25 @@
 package com.xjrsoft.module.outint.service.impl;
 
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import com.xjrsoft.common.exception.MyException;
+import com.xjrsoft.module.hikvision.util.ApiUtil;
+import com.xjrsoft.module.hikvision.util.OutInRecordUtil;
+import com.xjrsoft.module.outint.dto.SyncHikvsionDataDto;
 import com.xjrsoft.module.outint.dto.TeacherOutInRecordDto;
 import com.xjrsoft.module.outint.entity.TeacherOutInRecord;
 import com.xjrsoft.module.outint.mapper.TeacherOutInRecordMapper;
 import com.xjrsoft.module.outint.service.ITeacherOutInRecordService;
+import com.xjrsoft.module.teacher.mapper.FaceImportMapper;
 import lombok.AllArgsConstructor;
+import me.zhyd.oauth.log.Log;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
 import java.util.List;
 
 /**
@@ -19,8 +31,44 @@ import java.util.List;
 @Service
 @AllArgsConstructor
 public class TeacherOutInRecordServiceImpl extends MPJBaseServiceImpl<TeacherOutInRecordMapper, TeacherOutInRecord> implements ITeacherOutInRecordService {
+
+    private final FaceImportMapper faceImportMapper;
+
     @Override
     public List<TeacherOutInRecord> getListByParam(TeacherOutInRecordDto dto) {
         return this.baseMapper.getListByParam(dto);
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean syncHikvisionData(SyncHikvsionDataDto dto) {
+        try {
+            Integer limit = 1;
+            Integer size = 1000;
+            ApiUtil apiUtil = new ApiUtil();
+            String apiPath = "/api/acs/v2/door/events";
+
+            JsonObject paramJson = new JsonObject();
+            JsonArray eventList = new JsonArray();
+            eventList.add(196893); // 只获取人脸通过的
+            paramJson.addProperty("pageNo", limit);
+            paramJson.addProperty("pageSize", size);
+            paramJson.add("eventTypes", eventList);
+
+            paramJson.addProperty("sort", "eventTime");
+            paramJson.addProperty("order", "desc");
+            paramJson.addProperty("startTime", dto.getStartTime().atOffset(ZoneOffset.ofHours(8)).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME));
+            paramJson.addProperty("endTime", dto.getEndTime().atOffset(ZoneOffset.ofHours(8)).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME));
+
+            String doPost = apiUtil.doPost(apiPath, paramJson.toString(), null);
+            JsonParser parser = new JsonParser();
+            JsonObject data = parser.parse(doPost).getAsJsonObject().get("data").getAsJsonObject();
+            JsonArray list = data.get("list").getAsJsonArray();
+            new OutInRecordUtil().InsertTeacherStudentRecords(list, faceImportMapper);
+        }catch (Exception e){
+            Log.error(e.getMessage(), e);
+            throw new MyException("同步报错,请联系管理员");
+        }
+        return true;
+    }
 }

+ 26 - 1
src/main/java/com/xjrsoft/module/personnel/controller/CarMessageApplyController.java

@@ -18,6 +18,7 @@ import com.xjrsoft.module.organization.entity.UserDeptRelation;
 import com.xjrsoft.module.personnel.dto.AddCarMessageApplyDto;
 import com.xjrsoft.module.personnel.dto.CarMessageApplyPageDto;
 import com.xjrsoft.module.personnel.dto.UpdateCarMessageApplyDto;
+import com.xjrsoft.module.personnel.dto.UpdateCarMessageApplyEndTimeDto;
 import com.xjrsoft.module.personnel.entity.CarMessageApply;
 import com.xjrsoft.module.personnel.service.ICarMessageApplyService;
 import com.xjrsoft.module.personnel.vo.CarMessageApplyPageVo;
@@ -37,6 +38,10 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -115,7 +120,7 @@ public class CarMessageApplyController {
     public RT<Boolean> add(@Valid @RequestBody AddCarMessageApplyDto dto){
         CarMessageApply carMessageApply = BeanUtil.toBean(dto, CarMessageApply.class);
         boolean isSuccess = carMessageApplyService.save(carMessageApply);
-    return RT.ok(isSuccess);
+        return RT.ok(isSuccess);
     }
 
     @PutMapping
@@ -147,4 +152,24 @@ public class CarMessageApplyController {
         return R.ok(true);
     }
 
+    @PostMapping("/update-end-time-batch")
+    @ApiOperation(value = "批量修改有效期")
+    @SaCheckPermission("carmessageapply:add")
+    public RT<Boolean> add(@Valid @RequestBody UpdateCarMessageApplyEndTimeDto dto){
+
+        List<CarMessageApply> list = carMessageApplyService.listByIds(dto.getIds());
+        for (CarMessageApply carMessageApply : list) {
+            ZonedDateTime zonedDateTime = dto.getEndTime().atStartOfDay(ZoneId.systemDefault());
+
+            // 将 ZonedDateTime 转换为 Instant
+            Instant instant = zonedDateTime.toInstant();
+
+            // 将 Instant 转换为 Date
+            Date date = Date.from(instant);
+            carMessageApply.setEndTime(date);
+        }
+        boolean updated = carMessageApplyService.updateBatchById(list);
+        return RT.ok(updated);
+    }
+
 }

+ 33 - 0
src/main/java/com/xjrsoft/module/personnel/dto/UpdateCarMessageApplyEndTimeDto.java

@@ -0,0 +1,33 @@
+package com.xjrsoft.module.personnel.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+import java.util.Date;
+import java.util.List;
+
+
+/**
+* @title: 车辆信息审核
+* @Author dzx
+* @Date: 2024-05-12
+* @Version 1.0
+*/
+@Data
+public class UpdateCarMessageApplyEndTimeDto{
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 主键
+    */
+    @ApiModelProperty("主键")
+    private List<Long> ids;
+
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @ApiModelProperty("有效期结束日期")
+    private LocalDate endTime;
+}

+ 3 - 3
src/main/java/com/xjrsoft/module/student/controller/BaseStudentPunishmentInfoController.java

@@ -12,6 +12,7 @@ import com.xjrsoft.module.student.dto.BaseStudentPunishmentInfoMobilePageDto;
 import com.xjrsoft.module.student.dto.BaseStudentPunishmentInfoPageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentPunishmentInfoDto;
 import com.xjrsoft.module.student.entity.BaseStudentPunishmentInfo;
+import com.xjrsoft.module.student.service.IBasePunishmentTypeService;
 import com.xjrsoft.module.student.service.IBaseStudentPunishmentInfoService;
 import com.xjrsoft.module.student.vo.BaseStudentPunishmentInfoDetailVo;
 import com.xjrsoft.module.student.vo.BaseStudentPunishmentInfoMobileDetailVo;
@@ -43,8 +44,7 @@ import java.util.List;
 @Api(value = "/student"  + "/basestudentpunishmentinfo",tags = "学生处分信息管理代码")
 @AllArgsConstructor
 public class BaseStudentPunishmentInfoController {
-
-
+    private final IBasePunishmentTypeService punishmentTypeService;
     private final IBaseStudentPunishmentInfoService baseStudentPunishmentInfoService;
 
     @GetMapping(value = "/page")
@@ -95,7 +95,7 @@ public class BaseStudentPunishmentInfoController {
     public RT<Boolean> add(@Valid @RequestBody AddBaseStudentPunishmentInfoDto dto){
         BaseStudentPunishmentInfo baseStudentPunishmentInfo = BeanUtil.toBean(dto, BaseStudentPunishmentInfo.class);
         boolean isSuccess = baseStudentPunishmentInfoService.add(baseStudentPunishmentInfo);
-    return RT.ok(isSuccess);
+        return RT.ok(isSuccess);
     }
 
     @PutMapping

+ 15 - 0
src/main/java/com/xjrsoft/module/student/service/IBasePunishmentTypeService.java

@@ -0,0 +1,15 @@
+package com.xjrsoft.module.student.service;
+
+import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.student.entity.BasePunishmentType;
+
+/**
+* @title: 学生处分类型管理
+* @Author dzx
+* @Date: 2023-11-15
+* @Version 1.0
+*/
+
+public interface IBasePunishmentTypeService extends MPJBaseService<BasePunishmentType> {
+
+}

+ 19 - 0
src/main/java/com/xjrsoft/module/student/service/impl/BasePunishmentTypeServiceImpl.java

@@ -0,0 +1,19 @@
+package com.xjrsoft.module.student.service.impl;
+
+import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.module.student.entity.BasePunishmentType;
+import com.xjrsoft.module.student.mapper.BasePunishmentTypeMapper;
+import com.xjrsoft.module.student.service.IBasePunishmentTypeService;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+/**
+* @title: 学生处分信息管理
+* @Author dzx
+* @Date: 2023-11-15
+* @Version 1.0
+*/
+@Service
+@AllArgsConstructor
+public class BasePunishmentTypeServiceImpl extends MPJBaseServiceImpl<BasePunishmentTypeMapper, BasePunishmentType> implements IBasePunishmentTypeService {
+}

+ 12 - 1
src/main/java/com/xjrsoft/module/teacher/controller/TeacherbaseManagerController.java

@@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.excel.EasyExcel;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -11,6 +12,7 @@ import com.github.yulichang.toolkit.MPJWrappers;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.enums.GenderDictionaryEnum;
 import com.xjrsoft.common.model.result.R;
+import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
@@ -40,9 +42,13 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.validation.Valid;
+import java.io.IOException;
+import java.text.ParseException;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -134,7 +140,6 @@ public class TeacherbaseManagerController {
     @SaCheckPermission("teacherbasemanager:add")
     public R add(@Valid @RequestBody AddXjrUserDto dto){
         return R.ok(teacherbaseManagerService.add(dto));
-
     }
 
     @PutMapping
@@ -154,7 +159,13 @@ public class TeacherbaseManagerController {
         DataUtil dataUtil = new DataUtil();
         dataUtil.deletePerson(ids);
         return R.ok(teacherbaseManagerService.delete(ids));
+    }
 
+    @PostMapping("/import")
+    @ApiOperation(value = "导入教职工信息")
+    public RT<Boolean> importData(@RequestParam("file") MultipartFile file) throws IOException, ParseException {
+        List<Map<Integer, Object>> excelDataList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(3).doReadSync();
+        return RT.ok(teacherbaseManagerService.importData(excelDataList));
     }
 
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/teacher/service/ITeacherbaseManagerService.java

@@ -6,6 +6,7 @@ import com.xjrsoft.module.teacher.dto.UpdateXjrUserDto;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 
 import java.util.List;
+import java.util.Map;
 
 /**
 * @title: service
@@ -38,4 +39,6 @@ public interface ITeacherbaseManagerService extends MPJBaseService<XjrUser> {
     * @return
     */
     Boolean delete(List<Long> ids);
+
+    Boolean importData( List<Map<Integer, Object>> excelDataList);
 }

+ 192 - 0
src/main/java/com/xjrsoft/module/teacher/service/impl/TeacherbaseManagerServiceImpl.java

@@ -5,22 +5,34 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.constant.GlobalConstant;
+import com.xjrsoft.common.enums.DeleteMark;
+import com.xjrsoft.common.enums.GenderDictionaryEnum;
 import com.xjrsoft.common.enums.RoleEnum;
 import com.xjrsoft.common.utils.RedisUtil;
+import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.config.CommonPropertiesConfig;
+import com.xjrsoft.module.courseTable.entity.ClassTime;
+import com.xjrsoft.module.organization.entity.Department;
+import com.xjrsoft.module.organization.entity.Post;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.entity.UserDeptRelation;
 import com.xjrsoft.module.organization.entity.UserPostRelation;
 import com.xjrsoft.module.organization.entity.UserRoleRelation;
 import com.xjrsoft.module.organization.mapper.UserDeptRelationMapper;
 import com.xjrsoft.module.organization.mapper.UserRoleRelationMapper;
+import com.xjrsoft.module.organization.service.IDepartmentService;
+import com.xjrsoft.module.organization.service.IPostService;
 import com.xjrsoft.module.organization.service.IUserDeptRelationService;
 import com.xjrsoft.module.organization.service.IUserPostRelationService;
 import com.xjrsoft.module.organization.service.IUserService;
+import com.xjrsoft.module.system.entity.DictionaryDetail;
+import com.xjrsoft.module.system.service.IDictionarydetailService;
 import com.xjrsoft.module.teacher.dto.AddXjrUserDto;
 import com.xjrsoft.module.teacher.dto.UpdateXjrUserDto;
 import com.xjrsoft.module.teacher.entity.BaseTeacher;
@@ -44,9 +56,11 @@ import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.stream.Collectors;
 
@@ -76,6 +90,11 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
     private final IUserService userService;
     private final CommonPropertiesConfig propertiesConfig;
     private final IUserPostRelationService userPostRelationService;
+    private final IDictionarydetailService dictionaryService;
+    private final IDepartmentService departmentService;
+    private final IPostService postService;
+
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean add(AddXjrUserDto dto) {
@@ -430,4 +449,177 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
 
         return true;
     }
+
+    /**
+     * 导入,根据第一个工号查询是否有相关信息
+     * 1、批量新增或者修改xjr_user、base_teacher、xjr_user_dept_relation、xjr_user_post_relation
+     * 2、更新redis里面的缓存
+     * @param excelDataList 导入的数据
+     * @return 成功
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean importData(List<Map<Integer, Object>> excelDataList) {
+        List<User> userList = userService.list(
+                new MPJLambdaWrapper<User>()
+                        .select(User::getId)
+                        .select(User.class, x -> VoToColumnUtil.fieldsToColumns(User.class).contains(x.getProperty()))
+                        .innerJoin(BaseTeacher.class, BaseTeacher::getUserId, User::getId)
+        );
+        Map<String, User> userMap = userList.stream().collect(Collectors.toMap(User::getUserName, x -> x));
+
+        List<BaseTeacher> teacherList = teacherbaseManagerBaseTeacherMapper.selectJoinList(BaseTeacher.class,
+                new MPJLambdaWrapper<BaseTeacher>()
+                        .select(BaseTeacher::getId)
+                        .select(BaseTeacher.class, x -> VoToColumnUtil.fieldsToColumns(BaseTeacher.class).contains(x.getProperty()))
+                        .innerJoin(User.class, User::getId, BaseTeacher::getUserId)
+        );
+        Map<Long, BaseTeacher> teacherMap = teacherList.stream().collect(Collectors.toMap(BaseTeacher::getUserId, x -> x));
+
+        List<Long> itemList = new ArrayList<>();
+        itemList.add(2023000000000000016L);
+        itemList.add(2023000000000000006L);
+
+        List<DictionaryDetail> dictionaryList = dictionaryService.list(
+                new QueryWrapper<DictionaryDetail>().lambda()
+                        .in(DictionaryDetail::getItemId, itemList)
+                        .eq(DictionaryDetail::getDeleteMark, DeleteMark.NODELETE.getCode())
+        );
+        Map<String, String> dictionaryMap = dictionaryList.stream().collect(Collectors.toMap(DictionaryDetail::getName, DictionaryDetail::getCode));
+
+        List<Department> departmentList = departmentService.list(
+                new QueryWrapper<Department>().lambda()
+                        .eq(Department::getDeleteMark, DeleteMark.NODELETE.getCode())
+        );
+        Map<String, Long> departmentMap = departmentList.stream().collect(Collectors.toMap(Department::getName, Department::getId));
+
+        List<Post> postList = postService.list(
+                new QueryWrapper<Post>().lambda()
+                        .eq(Post::getDeleteMark, DeleteMark.NODELETE.getCode())
+        );
+        Map<String, Long> postMap = postList.stream().collect(Collectors.toMap(Post::getName, Post::getId));
+
+        List<UserPostRelation> postRelations = userPostRelationService.list(
+                new MPJLambdaWrapper<UserPostRelation>()
+                        .select(UserPostRelation::getId)
+                        .select(UserPostRelation.class, x -> VoToColumnUtil.fieldsToColumns(UserPostRelation.class).contains(x.getProperty()))
+                        .innerJoin(User.class, User::getId, UserPostRelation::getUserId)
+                        .innerJoin(BaseTeacher.class, BaseTeacher::getUserId, User::getId)
+        );
+        Map<Long, List<Long>> userPostMap = postRelations.stream()
+                .collect(Collectors.groupingBy(UserPostRelation::getUserId, Collectors.mapping(UserPostRelation::getPostId, Collectors.toList())));
+
+        List<UserDeptRelation> deptRelations = userDeptRelationMapper.selectList(
+                new MPJLambdaWrapper<UserDeptRelation>()
+                        .select(UserDeptRelation::getId)
+                        .select(UserDeptRelation.class, x -> VoToColumnUtil.fieldsToColumns(UserDeptRelation.class).contains(x.getProperty()))
+                        .innerJoin(User.class, User::getId, UserDeptRelation::getUserId)
+                        .innerJoin(BaseTeacher.class, BaseTeacher::getUserId, User::getId)
+        );
+        Map<Long, List<Long>> userDeptMap = postRelations.stream()
+                .collect(Collectors.groupingBy(UserPostRelation::getUserId, Collectors.mapping(UserPostRelation::getPostId, Collectors.toList())));
+
+        List<User> updateUserList = new ArrayList<>();
+        List<BaseTeacher> updateTeacherList = new ArrayList<>();
+        List<UserDeptRelation> updateDeptList = new ArrayList<>();
+        List<UserPostRelation> updatePostList = new ArrayList<>();
+
+        for (Map<Integer, Object> rowData : excelDataList) {
+            String jobCode = rowData.get(0).toString();
+            if(userMap.containsKey(jobCode)){
+                User user = userMap.get(jobCode);
+                user.setName(rowData.get(1).toString());
+                user.setGender(GenderDictionaryEnum.getCode(rowData.get(2).toString()));
+                user.setCredentialType(dictionaryMap.get(rowData.get(3).toString()));
+                user.setCredentialNumber(rowData.get(4).toString());
+                user.setMobile(rowData.get(5).toString());
+                updateUserList.add(user);
+
+                BaseTeacher teacher = teacherMap.get(user.getId());
+                teacher.setEmployType(dictionaryMap.get(rowData.get(6).toString()));
+                updateTeacherList.add(teacher);
+
+                List<Long> deptIds = userDeptMap.get(user.getId());
+                if(deptIds == null || !deptIds.contains(departmentMap.get(rowData.get(7).toString()))){
+                    UserDeptRelation userDeptRelation = new UserDeptRelation();
+                    userDeptRelation.setDeptId(departmentMap.get(rowData.get(7).toString()));
+                    userDeptRelation.setUserId(user.getId());
+                    updateDeptList.add(userDeptRelation);
+                }
+
+                List<Long> postIds = userPostMap.get(user.getId());
+                if(postIds == null || !postIds.contains(postMap.get(rowData.get(8).toString()))){
+                    UserPostRelation postRelation = new UserPostRelation();
+                    postRelation.setPostId(postMap.get(rowData.get(8).toString()));
+                    postRelation.setUserId(user.getId());
+                    updatePostList.add(postRelation);
+                }
+
+                continue;
+            }
+            User user = new User();
+            user.setUserName(rowData.get(0).toString());
+            user.setPassword(BCrypt.hashpw(propertiesConfig.getDefaultPassword(), BCrypt.gensalt()));
+            user.setIsChangePassword(1);
+            user.setName(rowData.get(1).toString());
+            user.setGender(GenderDictionaryEnum.getCode(rowData.get(2).toString()));
+            user.setCredentialType(dictionaryMap.get(rowData.get(3).toString()));
+            user.setCredentialNumber(rowData.get(4).toString());
+            user.setMobile(rowData.get(5).toString());
+            user.setCreateDate(LocalDateTime.now());
+            userService.save(user);
+
+            BaseTeacher teacher = new BaseTeacher();
+            teacher.setEmployType(dictionaryMap.get(rowData.get(6).toString()));
+            teacher.setUserId(user.getId());
+            teacher.setCreateDate(LocalDateTime.now());
+            teacherbaseManagerBaseTeacherMapper.insert(teacher);
+
+            UserDeptRelation userDeptRelation = new UserDeptRelation();
+            userDeptRelation.setDeptId(departmentMap.get(rowData.get(7).toString()));
+            userDeptRelation.setUserId(user.getId());
+            userDeptRelationMapper.insert(userDeptRelation);
+
+            UserPostRelation postRelation = new UserPostRelation();
+            postRelation.setPostId(postMap.get(rowData.get(8).toString()));
+            postRelation.setUserId(user.getId());
+            userPostRelationService.save(postRelation);
+
+            UserRoleRelation roleRelation = new UserRoleRelation();
+            roleRelation.setUserId(user.getId());
+            roleRelation.setRoleId(RoleEnum.TEACHER.getCode());
+            userRoleRelationMapper.insert(roleRelation);
+        }
+
+        if(!updateUserList.isEmpty()){
+            userService.updateBatchById(updateUserList);
+        }
+        if(!updateDeptList.isEmpty()){
+            for (UserDeptRelation relation : updateDeptList) {
+                userDeptRelationMapper.insert(relation);
+            }
+        }
+        if(!updatePostList.isEmpty()){
+            userPostRelationService.saveBatch(updatePostList);
+        }
+        if(!updateTeacherList.isEmpty()){
+            for (BaseTeacher teacher : updateTeacherList) {
+                teacherbaseManagerBaseTeacherMapper.updateById(teacher);
+            }
+        }
+
+        List<User> list = userService.list();
+        redisUtil.set(GlobalConstant.USER_CACHE_KEY, list);
+
+        List<UserDeptRelation> deptRelationList = userDeptRelationMapper.selectList(Wrappers.lambdaQuery(UserDeptRelation.class));
+        redisUtil.set(GlobalConstant.USER_DEPT_RELATION_CACHE_KEY, deptRelationList);
+
+        List<UserRoleRelation> userRoleRelationList = userRoleRelationMapper.selectList(Wrappers.lambdaQuery(UserRoleRelation.class));
+        redisUtil.set(GlobalConstant.USER_ROLE_RELATION_CACHE_KEY, userRoleRelationList);
+
+        List<UserPostRelation> postRelationList = userPostRelationService.list(Wrappers.lambdaQuery(UserPostRelation.class));
+        redisUtil.set(GlobalConstant.USER_POST_RELATION_CACHE_KEY, postRelationList);
+
+        return true;
+    }
 }

+ 45 - 9
src/main/java/com/xjrsoft/module/textbook/dto/TextbookImportDto.java

@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
+import java.util.Date;
 
 @Data
 public class TextbookImportDto {
@@ -13,7 +14,7 @@ public class TextbookImportDto {
      * 国际标准刊号
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("书号(ISSN)")
+    @ExcelProperty("书号(ISSN)")
     @ApiModelProperty("国际标准刊号")
     private String issn;
     /**
@@ -34,7 +35,7 @@ public class TextbookImportDto {
      * 主编
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("作者(主编)")
+    @ExcelProperty("作者(主编)")
     @ApiModelProperty("主编")
     private String editorInChief;
     /**
@@ -48,49 +49,84 @@ public class TextbookImportDto {
      * 是否为规划教材
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("规划教材(是或否)")
+    @ExcelProperty("规划教材(是或否)")
     @ApiModelProperty("是否为规划教材")
     private String isTextbookPlanCn;
     /**
      * 使用类型(单位:学期)
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("使用类型(一学期~六学期)")
+    @ExcelProperty("使用时长(一学期~六学期)")
     @ApiModelProperty("使用类型(单位:学期)")
     private String useTypeCn;
     /**
      * 教材类型(xjr_dictionary_item[textbook_type])
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("类型(教材、辅材、作业本)")
+    @ExcelProperty("教材分类(教材、辅材、作业本)")
     @ApiModelProperty("教材类型-中文")
     private String textbookTypeCn;
     /**
      * 定价(元)
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("定价(元)")
+    @ExcelProperty("定价(元)")
     @ApiModelProperty("定价(元)")
     private BigDecimal price;
     /**
      * 折扣
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("折扣(折)")
+    @ExcelProperty("折扣(折)")
     @ApiModelProperty("折扣")
     private Double discount;
     /**
      * 学科组名称
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("学科组(必须是系统中已有的学科组名称)")
+    @ExcelProperty("学科组(必须是系统中已有的学科组名称)")
     @ApiModelProperty("学科组名称")
     private String groupName;
     /**
      * 课程
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("对应课程(必须是系统中已有的课程名称)")
+    @ExcelProperty("对应课程(必须是系统中已有的课程名称)")
     @ApiModelProperty("对应课程")
     private String courseName;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("是否为校企合作教材(是或否)")
+    @ApiModelProperty("是否校企合作开发教材")
+    private String isSecd;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("教材类型(纸质教材、数字教材、纸质与数字资源结合教材)")
+    @ApiModelProperty("教材类型")
+    private String textbookCategory;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("估价(元)")
+    @ApiModelProperty("估价(元)")
+    private BigDecimal appraisalPrice;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("出版日期")
+    @ApiModelProperty("出版日期")
+    private Date publishingDate;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("分类号")
+    @ApiModelProperty("分类号")
+    private String category;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("规划批次")
+    @ApiModelProperty("规划批次")
+    private String planBatch;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("编著作总数")
+    @ApiModelProperty("编著作总数")
+    private Integer workTotalCount;
 }

+ 7 - 0
src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookServiceImpl.java

@@ -943,6 +943,13 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                     .orElse("no");
             textbook.setIsTextbookPlan(isTextbookPlan);
 
+            String isSecd = textbookImportDto.getIsSecd();
+            Integer isSecdI = Optional.ofNullable(isSecd)
+                    .filter("是"::equals)
+                    .map(s -> 1)
+                    .orElse(0);
+            textbook.setIsSecd(isSecdI);
+
             // 处理教材类型映射
             String textbookTypeCn = textbookImportDto.getTextbookTypeCn();
             String textbookTypeCode = Optional.ofNullable(textbookTypeCn)

+ 39 - 30
src/main/resources/mapper/evaluate/EvaluateResultMapper.xml

@@ -141,16 +141,19 @@
             t1.object_id as objectId
         from evaluate_result t
                  left join evaluate_object t1 on t1.id = t.evaluated_object_id
-        where t.evaluate_item_id in
-        <foreach item="evaluateManageItemId" index="index" collection="evaluateManageItemIdList" open="(" close=")"
-                 separator=",">
-            #{evaluateManageItemId}
-        </foreach>
-          and t1.object_id in
-        <foreach item="evaluateObjectId" index="index" collection="evaluateObjectIdList" open="(" close=")"
-                 separator=",">
-            #{evaluateObjectId}
-        </foreach>
+        where 1 = 1
+        <if test="evaluateObjectIdList != null and evaluateObjectIdList.size() > 0">
+            and t.evaluate_item_id in
+            <foreach item="evaluateManageItemId" index="index" collection="evaluateManageItemIdList" open="(" close=")" separator=",">
+                #{evaluateManageItemId}
+            </foreach>
+        </if>
+        <if test="evaluateObjectIdList != null and evaluateObjectIdList.size() > 0">
+            and t1.object_id in
+            <foreach item="evaluateObjectId" index="index" collection="evaluateObjectIdList" open="(" close=")" separator=",">
+                #{evaluateObjectId}
+            </foreach>
+        </if>
         group by t1.object_id, t.evaluate_item_id;
     </select>
 
@@ -161,16 +164,19 @@
         from evaluate_result t
         left join evaluate_object t1 on t1.id = t.evaluated_object_id
         left join evaluate_manage_item t2 on t2.id = t.evaluate_item_id
-        where t.evaluate_item_id in
-        <foreach item="evaluateManageItemId" index="index" collection="evaluateManageItemIdList" open="(" close=")"
-                 separator=",">
-            #{evaluateManageItemId}
-        </foreach>
-        and t1.object_id in
-        <foreach item="evaluateObjectId" index="index" collection="evaluateObjectIdList" open="(" close=")"
-                 separator=",">
-            #{evaluateObjectId}
-        </foreach>
+        where 1 = 1
+        <if test="evaluateObjectIdList != null and evaluateObjectIdList.size() > 0">
+            and t.evaluate_item_id in
+            <foreach item="evaluateManageItemId" index="index" collection="evaluateManageItemIdList" open="(" close=")" separator=",">
+                #{evaluateManageItemId}
+            </foreach>
+        </if>
+        <if test="evaluateObjectIdList != null and evaluateObjectIdList.size() > 0">
+            and t1.object_id in
+            <foreach item="evaluateObjectId" index="index" collection="evaluateObjectIdList" open="(" close=")" separator=",">
+                #{evaluateObjectId}
+            </foreach>
+        </if>
         group by t1.object_id, t2.topic;
     </select>
 
@@ -179,16 +185,19 @@
         t1.object_id       as objectId
         from evaluate_result t
         left join evaluate_object t1 on t1.id = t.evaluated_object_id
-        where t.evaluate_item_id in
-        <foreach item="evaluateManageItemId" index="index" collection="evaluateManageItemIdList" open="(" close=")"
-                 separator=",">
-            #{evaluateManageItemId}
-        </foreach>
-        and t1.object_id in
-        <foreach item="evaluateObjectId" index="index" collection="evaluateObjectIdList" open="(" close=")"
-                 separator=",">
-            #{evaluateObjectId}
-        </foreach>
+        where 1 = 1
+        <if test="evaluateObjectIdList != null and evaluateObjectIdList.size() > 0">
+            and t.evaluate_item_id in
+            <foreach item="evaluateManageItemId" index="index" collection="evaluateManageItemIdList" open="(" close=")" separator=",">
+                #{evaluateManageItemId}
+            </foreach>
+        </if>
+        <if test="evaluateObjectIdList != null and evaluateObjectIdList.size() > 0">
+            and t1.object_id in
+            <foreach item="evaluateObjectId" index="index" collection="evaluateObjectIdList" open="(" close=")" separator=",">
+                #{evaluateObjectId}
+            </foreach>
+        </if>
         group by t1.object_id;
     </select>
 

+ 4 - 4
src/main/resources/mapper/student/BaseStudentPunishmentInfoMapper.xml

@@ -15,7 +15,10 @@
         t.push_message_object,
         t.reason
         FROM base_student_punishment_info t
-        INNER JOIN base_punishment_type t2 ON (t.delete_mark = 0
+        INNER JOIN base_punishment_type t2 ON (t2.id = t.punishment_type_id)
+        LEFT JOIN base_semester t1 ON (t1.id = t.base_semester_id)
+        LEFT JOIN base_class t3 ON (t3.id = t.class_id)
+        where t.delete_mark = 0
         <if test="dto.semesterId != null and dto.semesterId > 0">
             and t.base_semester_id = #{dto.semesterId}
         </if>
@@ -28,9 +31,6 @@
         <if test="dto.endTime != null and dto.endTime != ''">
             and t.end_time = #{dto.endTime}
         </if>
-            AND t2.id = t.punishment_type_id)
-        LEFT JOIN base_semester t1 ON (t1.id = t.base_semester_id)
-        LEFT JOIN base_class t3 ON (t3.id = t.class_id)
         ORDER BY t.id DESC;
     </select>
 

+ 6 - 6
src/main/resources/mapper/student/StudentHonorsMapper.xml

@@ -8,9 +8,9 @@
         SELECT t1.id,t1.sort_code,t2.name AS student_name,t1.student_id,t3.name AS honors_level,t4.name AS honors_type,
         t5.name AS honors_grade,t1.name, t1.award_date,t1.status,t1.file_id FROM student_honors t1
         LEFT JOIN xjr_user t2 ON t1.student_user_id = t2.id
-        LEFT JOIN xjr_dictionary_detail t3 ON t1.honors_level = t3.code AND t3.item_id = 1731576278748352514
-        LEFT JOIN xjr_dictionary_detail t4 ON t1.honors_type = t4.code AND t4.item_id = 1731577666295418881
-        LEFT JOIN xjr_dictionary_detail t5 ON t1.honors_grade = t5.code AND t5.item_id = 1731577201793028098
+        LEFT JOIN xjr_dictionary_detail t3 ON t1.honors_level = t3.code AND t3.item_id = 1731576278748352514 AND t3.delete_mark = 0
+        LEFT JOIN xjr_dictionary_detail t4 ON t1.honors_type = t4.code AND t4.item_id = 1731577666295418881 AND t4.delete_mark = 0
+        LEFT JOIN xjr_dictionary_detail t5 ON t1.honors_grade = t5.code AND t5.item_id = 1731577201793028098 AND t5.delete_mark = 0
         WHERE t1.delete_mark = 0
         <if test="dto.classIdList != null">
             and t1.class_id in
@@ -90,9 +90,9 @@
                  LEFT JOIN base_class t5 ON t1.class_id = t5.id
                  LEFT JOIN base_major_set t6 ON t3.major_set_id = t6.id
                  LEFT JOIN xjr_user t7 ON t1.applicant_user_id = t7.id
-                 LEFT JOIN xjr_dictionary_detail t8 ON t1.honors_level = t8.code AND t8.item_id = 1731576278748352514
-                 LEFT JOIN xjr_dictionary_detail t9 ON t1.honors_type = t9.code AND t9.item_id = 1731577666295418881
-                 LEFT JOIN xjr_dictionary_detail t10 ON t1.honors_grade = t10.code AND t10.item_id = 1731577201793028098
+                 LEFT JOIN xjr_dictionary_detail t8 ON t1.honors_level = t8.code AND t8.item_id = 1731576278748352514 AND t8.delete_mark = 0
+                 LEFT JOIN xjr_dictionary_detail t9 ON t1.honors_type = t9.code AND t9.item_id = 1731577666295418881 AND t9.delete_mark = 0
+                 LEFT JOIN xjr_dictionary_detail t10 ON t1.honors_grade = t10.code AND t10.item_id = 1731577201793028098 AND t10.delete_mark = 0
                  LEFT JOIN base_major_set t11 ON t1.major_set_id = t11.id
         WHERE t1.id = #{id}
           and t1.delete_mark = 0