dzx 1 год назад
Родитель
Сommit
af426b1357
22 измененных файлов с 645 добавлено и 128 удалено
  1. 21 0
      src/main/java/com/xjrsoft/module/job/AttenDanceWarnNoticeTask.java
  2. 40 28
      src/main/java/com/xjrsoft/module/job/AttendanceMessageTask.java
  3. 1 1
      src/main/java/com/xjrsoft/module/material/entity/MaterialTaskAssign.java
  4. 66 40
      src/main/java/com/xjrsoft/module/material/service/impl/MaterialTaskServiceImpl.java
  5. 26 0
      src/main/java/com/xjrsoft/module/material/vo/MaterialTaskAssignUserVo.java
  6. 48 4
      src/main/java/com/xjrsoft/module/student/controller/BaseNewStudentController.java
  7. 6 0
      src/main/java/com/xjrsoft/module/student/dto/AddBaseNewStudentDto.java
  8. 8 0
      src/main/java/com/xjrsoft/module/student/entity/BaseNewStudent.java
  9. 8 0
      src/main/java/com/xjrsoft/module/student/service/IBaseNewStudentService.java
  10. 278 0
      src/main/java/com/xjrsoft/module/student/service/impl/BaseNewStudentServiceImpl.java
  11. 8 0
      src/main/java/com/xjrsoft/module/student/vo/BaseNewStudentPageVo.java
  12. 52 0
      src/main/java/com/xjrsoft/module/student/vo/BaseNewStudentScoreExcelVo.java
  13. 25 35
      src/main/java/com/xjrsoft/module/textbook/controller/TextbookController.java
  14. 5 3
      src/main/java/com/xjrsoft/module/textbook/controller/WfTextbookSubscriptionItemHistoryController.java
  15. 1 1
      src/main/java/com/xjrsoft/module/textbook/dto/TextbookImportDto.java
  16. 5 0
      src/main/java/com/xjrsoft/module/textbook/dto/WfTextbookSubscriptionItemHistoryPageDto.java
  17. 13 11
      src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookServiceImpl.java
  18. 5 1
      src/main/java/com/xjrsoft/module/textbook/service/impl/WfTextbookSubscriptionServiceImpl.java
  19. 15 0
      src/main/java/com/xjrsoft/module/textbook/vo/TextbookSubscriptionListVo.java
  20. 10 0
      src/main/java/com/xjrsoft/module/textbook/vo/WfTextbookSubscriptionItemHistoryPageVo.java
  21. 2 2
      src/main/java/com/xjrsoft/module/textbook/vo/WfTextbookSubscriptionItemVo.java
  22. 2 2
      src/main/resources/application.yml

+ 21 - 0
src/main/java/com/xjrsoft/module/job/AttenDanceWarnNoticeTask.java

@@ -12,6 +12,8 @@ import com.xjrsoft.module.attendance.entity.AttendanceUserRelation;
 import com.xjrsoft.module.attendance.mapper.AttendanceUserRelationMapper;
 import com.xjrsoft.module.attendance.service.IAttendanceRuleCategoryService;
 import com.xjrsoft.module.concat.service.IXjrUserService;
+import com.xjrsoft.module.holiday.entity.HolidayDate;
+import com.xjrsoft.module.holiday.service.IHolidayDateService;
 import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
 import com.xjrsoft.module.organization.service.IWeChatService;
 import com.xjrsoft.module.teacher.entity.XjrUser;
@@ -55,6 +57,9 @@ public class AttenDanceWarnNoticeTask {
     @Autowired
     private WeChatUtil weChatUtil;
 
+    @Autowired
+    private IHolidayDateService holidayDateService;
+
     @Scheduled(cron = "0 */1 * * * ?")
     public void RefreshConnectionPool() {
         String active = SpringUtil.getActiveProfile();
@@ -95,6 +100,22 @@ public class AttenDanceWarnNoticeTask {
             return;
         }
 
+        HolidayDate holidayDate = holidayDateService.getOne(
+                new QueryWrapper<HolidayDate>().lambda()
+                        .eq(HolidayDate::getDate, now.toLocalDate())
+        );
+        //查询到了数据,且当天不是“普通工作日”或“需要补班的工作日”
+        if(holidayDate != null && holidayDate.getWay() != null && holidayDate.getWay() != 0 && holidayDate.getWay() != 2){
+            log.info("非工作日,不需要提醒");
+            return;
+        }
+        //未查询到数据
+        String dayOfWeek = now.getDayOfWeek().name();
+        if(holidayDate == null || "SUNDAY".equals(dayOfWeek) || "SATURDAY".equals(dayOfWeek)){
+            log.info("非工作日,不需要提醒");
+            return;
+        }
+
         //获取最近的时间
         LocalDateTime recentlyTime = getRecentlyTime(ruleDetailsList, now);
         long minute = Math.abs(ChronoUnit.MINUTES.between(now, recentlyTime));

+ 40 - 28
src/main/java/com/xjrsoft/module/job/AttendanceMessageTask.java

@@ -2,10 +2,12 @@ package com.xjrsoft.module.job;
 
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.db.Entity;
 import cn.hutool.extra.spring.SpringUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.common.utils.WeChatUtil;
 import com.xjrsoft.config.CommonPropertiesConfig;
@@ -25,8 +27,6 @@ import com.xjrsoft.module.outint.entity.TeacherOutInRecord;
 import com.xjrsoft.module.outint.service.IStudentOutInRecordService;
 import com.xjrsoft.module.outint.service.ITeacherOutInRecordService;
 import com.xjrsoft.module.student.entity.BaseStudent;
-import com.xjrsoft.module.system.entity.WechatMessageLog;
-import com.xjrsoft.module.system.service.IWechatMessageLogService;
 import com.xjrsoft.module.teacher.entity.BaseTeacher;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import lombok.extern.slf4j.Slf4j;
@@ -81,9 +81,6 @@ public class AttendanceMessageTask {
     @Autowired
     private WeChatUtil weChatUtil;
 
-    @Autowired
-    private IWechatMessageLogService wechatMessageLogService;
-
     @Scheduled(cron = "0 */1 * * * ?")
     public void RefreshConnectionPool() {
         String active = SpringUtil.getActiveProfile();
@@ -100,10 +97,17 @@ public class AttendanceMessageTask {
             new QueryWrapper<HolidayDate>().lambda()
             .eq(HolidayDate::getDate, now.toLocalDate())
         );
+        //查询到了数据,且当天不是“普通工作日”或“需要补班的工作日”
         if(holidayDate != null && holidayDate.getWay() != null && holidayDate.getWay() != 0 && holidayDate.getWay() != 2){
             log.info("非工作日,不需要提醒");
             return;
         }
+        //未查询到数据
+        String dayOfWeek = now.getDayOfWeek().name();
+        if(holidayDate == null || "SUNDAY".equals(dayOfWeek) || "SATURDAY".equals(dayOfWeek)){
+            log.info("非工作日,不需要提醒");
+//            return;
+        }
         //查询今天的考勤规则
         List<AttendanceRuleDetails> ruleDetails = ruleCategoryService.getTodayRules();
         List<AttendanceMessageSet> list = messageSetService.list();
@@ -127,7 +131,8 @@ public class AttendanceMessageTask {
         Set<Integer> roleTypes = list.stream().map(AttendanceMessageSet::getRoleType).collect(Collectors.toSet());
 
         //查询需要通知的人
-
+        String table = "wechat_message_log";
+        boolean isInsert = true;
         for (AttendanceMessageSet messageSet : list) {
             LocalDateTime recentlyTime = null;
             String characterKey = "character_string18";
@@ -137,41 +142,43 @@ public class AttendanceMessageTask {
                 characterKey = "character_string18";
                 //获取最近的时间
                 recentlyTime = getRecentlyTime(ruleDetails, now);
-                long seconds = Math.abs(ChronoUnit.SECONDS.between(now, recentlyTime));
-                if(seconds >= 60){
+                if(recentlyTime.getHour() != now.getHour() || (recentlyTime.getHour() == now.getHour() && recentlyTime.getMinute() != now.getMinute())){
                     log.info("未到时间,不进行推送");
+                    isInsert = false;
                     continue;
                 }
-                long count = wechatMessageLogService.count(
-                        new QueryWrapper<WechatMessageLog>().lambda()
-                                .eq(WechatMessageLog::getSendTime, recentlyTime)
-                                .eq(WechatMessageLog::getTemplateId, wechatTemplate)
-                );
+                Entity entity = Entity.create(table);
+                entity.set("send_time", recentlyTime);
+                entity.set("template_id", wechatTemplate);
+                String sql = "SELECT COUNT(*) FROM wechat_message_log WHERE delete_mark = 0 AND template_id = '" + wechatTemplate
+                        + "' AND send_time = '" + recentlyTime.format(formatter) + "'";
+                long count = SqlRunnerAdapter.db().selectCount(sql);
                 if(count > 0){//已经推送过,不再进行推送
                     log.info("已推送过,不进行推送");
+                    isInsert = false;
                     continue;
                 }
             }else if(messageSet.getMessageCategory() != null && messageSet.getMessageCategory() == 3){
                 wechatTemplate = weChatUtil.getAttendanceMsgAbsenceTemplate();
                 recentlyTime = getRecentlyOverTime(ruleDetails, now);
                 characterKey = "character_string36";
-                long seconds = Math.abs(ChronoUnit.SECONDS.between(now, recentlyTime));
-                if(seconds >= 60){
+                if(recentlyTime.getHour() != now.getHour() || (recentlyTime.getHour() == now.getHour() && recentlyTime.getMinute() != now.getMinute())){
                     log.info("未到时间,不进行推送");
+                    isInsert = false;
                     continue;
                 }
-                long count = wechatMessageLogService.count(
-                        new QueryWrapper<WechatMessageLog>().lambda()
-                                .eq(WechatMessageLog::getSendTime, recentlyTime)
-                                .eq(WechatMessageLog::getTemplateId, wechatTemplate)
-                );
+                String sql = "SELECT COUNT(*) FROM wechat_message_log WHERE delete_mark = 0 AND template_id = '" + wechatTemplate
+                        + "' AND send_time = '" + recentlyTime.format(formatter) + "'";
+                long count = SqlRunnerAdapter.db().selectCount(sql);
                 if(count > 0){//已经推送过,不再进行推送
                     log.info("已推送过,不进行推送");
+                    isInsert = false;
                     continue;
                 }
             }
 
             if(!messageSet.getTimePeriod().contains(timePeriod + "")){
+                isInsert = false;
                 continue;
             }
 
@@ -187,9 +194,11 @@ public class AttendanceMessageTask {
 
             //没有需要通知的,直接跳过
             if(userList.isEmpty()){
+                isInsert = false;
                 continue;
             }
             if(recentlyTime == null){
+                isInsert = false;
                 continue;
             }
 
@@ -242,7 +251,7 @@ public class AttendanceMessageTask {
                 for (XjrUser xjrUser : userList) {
                     weChatSendMessageDto.setMsgId(IdUtil.getSnowflakeNextId() + "");
                     weChatSendMessageDto.setUserId(xjrUser.getOpenId());
-                    weChatService.sendTemplateMessage(weChatSendMessageDto);
+                    //weChatService.sendTemplateMessage(weChatSendMessageDto);
                 }
             }else if(messageSet.getRoleType() != null && messageSet.getRoleType() == 2){
                 //教师总人数
@@ -287,17 +296,20 @@ public class AttendanceMessageTask {
                 for (XjrUser xjrUser : userList) {
                     weChatSendMessageDto.setMsgId(IdUtil.getSnowflakeNextId() + "");
                     weChatSendMessageDto.setUserId(xjrUser.getOpenId());
-                    weChatService.sendTemplateMessage(weChatSendMessageDto);
+                    //weChatService.sendTemplateMessage(weChatSendMessageDto);
                 }
+                isInsert = true;
             }
 
-            WechatMessageLog messageLog = new WechatMessageLog();
-            messageLog.setTemplateId(wechatTemplate);
-            messageLog.setSendTime(recentlyTime);
+            if(isInsert){
+                Entity entity = Entity.create(table);
+                entity.set("content", "消息推送人数:" + userCount);
+                entity.set("create_date", LocalDateTime.now());
+                entity.set("template_id", wechatTemplate);
+                entity.set("send_time", recentlyTime);
+                SqlRunnerAdapter.db().dynamicInsert(table, entity);
+            }
 
-            messageLog.setCreateDate(new Date());
-            messageLog.setContent("消息推送人数:" + userCount);
-            wechatMessageLogService.save(messageLog);
         }
     }
 

+ 1 - 1
src/main/java/com/xjrsoft/module/material/entity/MaterialTaskAssign.java

@@ -82,7 +82,7 @@ public class MaterialTaskAssign implements Serializable {
     /**
     * 用户类型 1=孝职工 2=学生
     */
-    @ApiModelProperty("用户类型 1=职工 2=学生")
+    @ApiModelProperty("用户类型 1=职工 2=学生")
     private Integer userType;
     /**
     * 学号/工号

+ 66 - 40
src/main/java/com/xjrsoft/module/material/service/impl/MaterialTaskServiceImpl.java

@@ -33,12 +33,14 @@ import com.xjrsoft.module.material.mapper.MaterialTaskMapper;
 import com.xjrsoft.module.material.service.IMaterialTaskService;
 import com.xjrsoft.module.material.service.IMaterialTypeService;
 import com.xjrsoft.module.material.vo.MaterialTaskAssignListVo;
+import com.xjrsoft.module.material.vo.MaterialTaskAssignUserVo;
 import com.xjrsoft.module.material.vo.MaterialTaskVo;
 import com.xjrsoft.module.material.vo.MaterialTypeVo;
 import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
 import com.xjrsoft.module.organization.entity.Department;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.entity.UserDeptRelation;
+import com.xjrsoft.module.organization.entity.UserRoleRelation;
 import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.organization.service.IWeChatService;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
@@ -50,8 +52,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDate;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 
@@ -74,33 +75,28 @@ public class MaterialTaskServiceImpl extends MPJBaseServiceImpl<MaterialTaskMapp
     private final IXjrUserService xjrUserService;
     private final IFormExecuteService formExecuteService;
 
-    private final CommonPropertiesConfig commonPropertiesConfig;
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Long add(AddMaterialTaskDto dto) {
         MaterialTask materialTask = BeanUtil.toBean(dto, MaterialTask.class);
-        //新增任务
-        materialTask.setStatus(2);
-        if(dto.getUserList() != null && !dto.getUserList().isEmpty()){
-            materialTask.setAssignPerson(dto.getUserList().size());
-        }
-        materialTaskMaterialTaskMapper.insert(materialTask);
 
-        //新增任务人
+        //梳理提交人
+        Map<Long, MaterialTaskAssign> materialTaskAssignMap = new HashMap<>();
         for (MaterialAssignUserDto materialAssignUserDto : dto.getUserList()){
             if(materialAssignUserDto.getUserType() == 1){
                 List<XjrUserVo> xjrUserVos = xjrUserService.selectJoinList(XjrUserVo.class,
-                    new MPJLambdaWrapper<XjrUser>()
-                    .leftJoin(UserDeptRelation.class, UserDeptRelation::getUserId, XjrUser::getId)
-                    .eq(UserDeptRelation::getDeptId, materialAssignUserDto.getUserId())
-                    .eq(XjrUser::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        new MPJLambdaWrapper<XjrUser>()
+                                .leftJoin(UserDeptRelation.class, UserDeptRelation::getUserId, XjrUser::getId)
+                                .leftJoin(UserRoleRelation.class, UserRoleRelation::getUserId, XjrUser::getId)
+                                .eq(UserDeptRelation::getDeptId, materialAssignUserDto.getUserId())
+                                .eq(UserRoleRelation::getRoleId, 2)
+                                .eq(XjrUser::getDeleteMark, DeleteMark.NODELETE.getCode())
                 );
                 for (XjrUserVo xjrUserVo : xjrUserVos) {
-                    materialTaskMaterialTaskAssignMapper.insert(new MaterialTaskAssign(){{
-                        setMaterialTaskId(materialTask.getId());
+                    materialTaskAssignMap.put(xjrUserVo.getId(), new MaterialTaskAssign(){{
                         setUserId(xjrUserVo.getId());
-                        setUserType(materialAssignUserDto.getUserType());
-                        setUserNumber(xjrUserVo.getName());
+                        setUserType(1);
+                        setUserNumber(xjrUserVo.getUserName());
                         setStatus(1);
                         setExecutiveStatus(1);
                         setSendMessage(dto.getSendMessage());
@@ -108,35 +104,60 @@ public class MaterialTaskServiceImpl extends MPJBaseServiceImpl<MaterialTaskMapp
                 }
             }else if(materialAssignUserDto.getUserType() == 2){
                 List<XjrUserVo> xjrUserVos = xjrUserService.selectJoinList(XjrUserVo.class,
-                    new MPJLambdaWrapper<XjrUser>()
-                    .leftJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, XjrUser::getId)
-                    .eq(BaseStudentSchoolRoll::getClassId, materialAssignUserDto.getUserId())
-                    .eq(XjrUser::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        new MPJLambdaWrapper<XjrUser>()
+                                .leftJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, XjrUser::getId)
+                                .eq(BaseStudentSchoolRoll::getClassId, materialAssignUserDto.getUserId())
+                                .eq(XjrUser::getDeleteMark, DeleteMark.NODELETE.getCode())
                 );
                 for (XjrUserVo xjrUserVo : xjrUserVos) {
-                    materialTaskMaterialTaskAssignMapper.insert(new MaterialTaskAssign(){{
-                        setMaterialTaskId(materialTask.getId());
+                    materialTaskAssignMap.put(xjrUserVo.getId(), new MaterialTaskAssign(){{
                         setUserId(xjrUserVo.getId());
-                        setUserType(materialAssignUserDto.getUserType());
-                        setUserNumber(xjrUserVo.getName());
+                        setUserType(2);
+                        setUserNumber(xjrUserVo.getUserName());
                         setStatus(1);
                         setExecutiveStatus(1);
                         setSendMessage(dto.getSendMessage());
                     }});
                 }
             }else if(materialAssignUserDto.getUserType() == 3){
-                materialTaskMaterialTaskAssignMapper.insert(new MaterialTaskAssign(){{
-                    setMaterialTaskId(materialTask.getId());
-                    setUserId(materialAssignUserDto.getUserId());
-                    setUserType(materialAssignUserDto.getUserType());
-                    setUserNumber(materialAssignUserDto.getUserNumber());
-                    setStatus(1);
-                    setExecutiveStatus(1);
-                    setSendMessage(dto.getSendMessage());
-                }});
+                List<MaterialTaskAssignUserVo> materialTaskAssignUserVoList = xjrUserService.selectJoinList(MaterialTaskAssignUserVo.class,
+                        new MPJLambdaWrapper<XjrUser>()
+                                .select(XjrUser::getId)
+                                .selectAs(XjrUser::getUserName, MaterialTaskAssignUserVo::getUserName)
+                                .selectAs(UserRoleRelation::getRoleId, MaterialTaskAssignUserVo::getRoleId)
+                                .leftJoin(UserRoleRelation.class, UserRoleRelation::getUserId, XjrUser::getId)
+                                .eq(XjrUser::getId, materialAssignUserDto.getUserId())
+                                .eq(XjrUser::getDeleteMark, DeleteMark.NODELETE.getCode())
+                );
+                if(materialTaskAssignUserVoList != null && !materialTaskAssignUserVoList.isEmpty()){
+                    MaterialTaskAssignUserVo materialTaskAssignUserVo = materialTaskAssignUserVoList.get(0);
+                    materialTaskAssignMap.put(materialTaskAssignUserVo.getId(), new MaterialTaskAssign(){{
+                        setUserId(materialAssignUserDto.getUserId());
+                        setUserType(materialTaskAssignUserVo.getRoleId() == 3 ? 2 : 1);
+                        setUserNumber(materialTaskAssignUserVo.getUserName());
+                        setStatus(1);
+                        setExecutiveStatus(1);
+                        setSendMessage(dto.getSendMessage());
+                    }});
+                }
             }
         }
 
+        List<MaterialTaskAssign> materialTaskAssignList = new ArrayList<>(materialTaskAssignMap.values());
+
+        //新增任务
+        materialTask.setStatus(2);
+        if(dto.getUserList() != null && !dto.getUserList().isEmpty()){
+            materialTask.setAssignPerson(materialTaskAssignList.size());
+        }
+        materialTaskMaterialTaskMapper.insert(materialTask);
+
+        //新增任务人
+        for(MaterialTaskAssign materialTaskAssign : materialTaskAssignList){
+            materialTaskAssign.setMaterialTaskId(materialTask.getId());
+            materialTaskMaterialTaskAssignMapper.insert(materialTaskAssign);
+        }
+
 //        materialTaskMaterialTaskMapper.insert(materialTask);
 //        if (materialTask.getMaterialTaskAssignList() != null && materialTask.getMaterialTaskAssignList().size() > 0) {
 //            for (MaterialTaskAssign materialTaskAssign : materialTask.getMaterialTaskAssignList()) {
@@ -408,21 +429,26 @@ public class MaterialTaskServiceImpl extends MPJBaseServiceImpl<MaterialTaskMapp
 
         MPJLambdaWrapper<MaterialTaskAssign> queryWrapper = new MPJLambdaWrapper<>();
         queryWrapper
+                .disableSubLogicDel()
                 .distinct()
-                .like(dto.getName() != null && !dto.getName().equals(""), XjrUser::getName, dto.getName())
-                .eq(MaterialTaskAssign::getMaterialTaskId, dto.getMaterialTaskId())
-                .eq(dto.getState() != null, MaterialTaskAssign::getStatus, dto.getState())
                 .select(MaterialTaskAssign::getId)
-                .selectAs(XjrUser::getName, MaterialTaskAssignListVo::getName)
                 .selectAs(MaterialTaskAppendix::getFileId, MaterialTaskAssignListVo::getFolderId)
                 .selectAs(MaterialTaskAppendix::getFileId, MaterialTaskAssignListVo::getFormReleaseId)
-                .select(MaterialTask::getMaterialCategory)
+                .selectAs(MaterialTask::getMaterialCategory, MaterialTaskAssignListVo::getMaterialCategory)
+                .select(XjrUser.class, x -> VoToColumnUtil.fieldsToColumns(MaterialTaskAssignListVo.class).contains(x.getProperty()))
                 .select(MaterialTaskAssign.class, x -> VoToColumnUtil.fieldsToColumns(MaterialTaskAssignListVo.class).contains(x.getProperty()))
                 .innerJoin(XjrUser.class, XjrUser::getId, MaterialTaskAssign::getUserId, ext -> ext.selectAs(XjrUser::getUserName, MaterialTaskAssignListVo::getUserName))
                 .leftJoin(UserDeptRelation.class, UserDeptRelation::getUserId, MaterialTypeAssign::getUserId)
                 .leftJoin(Department.class, Department::getId, UserDeptRelation::getDeptId, ext -> ext.selectAs(Department::getName, MaterialTaskAssignListVo::getDeptName))
                 .leftJoin(MaterialTask.class, MaterialTask::getId, MaterialTaskAssign::getMaterialTaskId)
                 .leftJoin(MaterialTaskAppendix.class, MaterialTaskAppendix::getMaterialTaskId, MaterialTaskAssign::getId)
+                .like(dto.getName() != null && !"".equals(dto.getName()), XjrUser::getName, dto.getName())
+                .eq(MaterialTaskAssign::getMaterialTaskId, dto.getMaterialTaskId())
+                .eq(dto.getState() != null, MaterialTaskAssign::getStatus, dto.getState())
+                .eq(XjrUser::getDeleteMark, DeleteMark.NODELETE.getCode())
+                .eq(Department::getDeleteMark, DeleteMark.NODELETE.getCode())
+                .eq(MaterialTask::getDeleteMark, DeleteMark.NODELETE.getCode())
+                .eq(MaterialTaskAssign::getDeleteMark, DeleteMark.NODELETE.getCode())
 //                .select("(\n" +
 //                        "SELECT id FROM xjr_file WHERE id IN (\n" +
 //                        "SELECT file_id FROM material_task_appendix WHERE material_task_id = t.id\n" +

+ 26 - 0
src/main/java/com/xjrsoft/module/material/vo/MaterialTaskAssignUserVo.java

@@ -0,0 +1,26 @@
+package com.xjrsoft.module.material.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+@Data
+public class MaterialTaskAssignUserVo {
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Long id;
+    /**
+    * 姓名
+    */
+    @ApiModelProperty("")
+    private String userName;
+    /**
+     *
+     */
+    @ApiModelProperty("")
+    private Long roleId;
+
+}

+ 48 - 4
src/main/java/com/xjrsoft/module/student/controller/BaseNewStudentController.java

@@ -2,8 +2,9 @@ package com.xjrsoft.module.student.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.bean.BeanUtil;
-import com.alibaba.excel.EasyExcel;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+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;
@@ -13,6 +14,7 @@ import com.xjrsoft.module.student.dto.UpdateBaseNewStudentDto;
 import com.xjrsoft.module.student.entity.BaseNewStudent;
 import com.xjrsoft.module.student.service.IBaseNewStudentService;
 import com.xjrsoft.module.student.vo.BaseNewStudentPageVo;
+import com.xjrsoft.module.student.vo.BaseNewStudentScoreExcelVo;
 import com.xjrsoft.module.student.vo.BaseNewStudentTreeVo;
 import com.xjrsoft.module.student.vo.BaseNewStudentVo;
 import com.xjrsoft.module.student.vo.EnrollmentPlanGradeVo;
@@ -33,7 +35,9 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.validation.Valid;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
 * @title: 新生维护信息
@@ -133,9 +137,49 @@ public class BaseNewStudentController {
     }
     @PostMapping("/import")
     @ApiOperation(value = "导入")
-    public RT<Boolean> importData(@RequestParam MultipartFile file) throws IOException {
-        List<BaseNewStudentPageVo> savedDataList = EasyExcel.read(file.getInputStream()).head(BaseNewStudentPageVo.class).sheet().doReadSync();
-        Boolean result = baseNewStudentService.saveBatch(BeanUtil.copyToList(savedDataList, BaseNewStudent.class));
+    public RT<List<Map<String, String>>> importData(@RequestParam Long treeId, @RequestParam MultipartFile file) throws IOException {
+        List<Map<Integer, Object>> errorList = baseNewStudentService.importData(treeId, file);
+        List<Map<String, String>> result = new ArrayList<>();
+
+        for (Map<Integer, Object> objectMap : errorList) {
+            Map<String, String> object = new HashMap<>();
+            object.put("毕业学校", objectMap.get(0)==null?"":objectMap.get(0).toString());
+            object.put("学生姓名", objectMap.get(1)==null?"":objectMap.get(1).toString());
+            object.put("性别", objectMap.get(2)==null?"":objectMap.get(2).toString());
+            object.put("身份证号", objectMap.get(3)==null?"":objectMap.get(3).toString());
+            object.put("身高(cm)", objectMap.get(4)==null?"":objectMap.get(4).toString());
+            object.put("体重(kg)", objectMap.get(5)==null?"":objectMap.get(5).toString());
+            object.put("毕业班级", objectMap.get(6)==null?"":objectMap.get(6).toString());
+            object.put("学生来源", objectMap.get(7)==null?"":objectMap.get(7).toString());
+            object.put("住宿类型", objectMap.get(8)==null?"":objectMap.get(8).toString());
+            object.put("手机号", objectMap.get(9)==null?"":objectMap.get(9).toString());
+            object.put("第一志愿", objectMap.get(10)==null?"":objectMap.get(10).toString());
+            object.put("第二志愿", objectMap.get(11)==null?"":objectMap.get(11).toString());
+            object.put("是否可调配", objectMap.get(12)==null?"":objectMap.get(12).toString());
+            object.put("家庭电话", objectMap.get(13)==null?"":objectMap.get(13).toString());
+            object.put("家庭地址", objectMap.get(14)==null?"":objectMap.get(14).toString());
+            object.put("错误信息", objectMap.get(15)==null?"":objectMap.get(15).toString());
+            result.add(object);
+        }
+        return RT.ok(result);
+    }
+
+    @PostMapping("/score-import")
+    @ApiOperation(value = "成绩导入")
+    public RT<List<Map<String, String>>> scoreImport(@RequestParam MultipartFile file) throws IOException {
+        List<BaseNewStudentScoreExcelVo> errorList = baseNewStudentService.scoreImport(file);
+        List<Map<String, String>> result = new ArrayList<>();
+
+        for (BaseNewStudentScoreExcelVo objectMap : errorList) {
+            Map<String, String> object = new HashMap<>();
+            object.put("毕业学校", objectMap.getGraduateSchool());
+            object.put("姓名", objectMap.getName());
+            object.put("性别", objectMap.getGender());
+            object.put("班级", objectMap.getGraduateClass());
+            object.put("总成绩", objectMap.getScore().intValue() + "");
+            object.put("错误信息", "未能查询到该学生");
+            result.add(object);
+        }
         return RT.ok(result);
     }
 

+ 6 - 0
src/main/java/com/xjrsoft/module/student/dto/AddBaseNewStudentDto.java

@@ -100,4 +100,10 @@ public class AddBaseNewStudentDto implements Serializable {
 
     @ApiModelProperty("招生计划id(enrollment_plan)")
     private Long enrollmentPlanId;
+
+    @ApiModelProperty("家庭电话")
+    private String familyMobile;
+
+    @ApiModelProperty("家庭地址")
+    private String familyAddress;
 }

+ 8 - 0
src/main/java/com/xjrsoft/module/student/entity/BaseNewStudent.java

@@ -158,4 +158,12 @@ public class BaseNewStudent implements Serializable {
 
     @ApiModelProperty("家庭地址")
     private String familyAddress;
+
+    @ApiModelProperty("第一志愿id")
+    private Long firstAmbitionId;
+    /**
+     * 第二志愿
+     */
+    @ApiModelProperty("第二志愿")
+    private Long secondAmbitionId;
 }

+ 8 - 0
src/main/java/com/xjrsoft/module/student/service/IBaseNewStudentService.java

@@ -5,10 +5,14 @@ import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
 import com.xjrsoft.module.student.entity.BaseNewStudent;
 import com.xjrsoft.module.student.vo.BaseNewStudentPageVo;
+import com.xjrsoft.module.student.vo.BaseNewStudentScoreExcelVo;
 import com.xjrsoft.module.student.vo.EnrollmentPlanGradeVo;
 import com.xjrsoft.module.student.vo.EnrollmentPlanTreeVo;
+import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
 import java.util.List;
+import java.util.Map;
 
 /**
 * @title: 新生维护信息
@@ -25,4 +29,8 @@ public interface IBaseNewStudentService extends MPJBaseService<BaseNewStudent> {
     List<EnrollmentPlanTreeVo> getEnrollmentPlanList();
 
     List<EnrollmentPlanGradeVo> getGradeList();
+
+    List<Map<Integer, Object>> importData(Long treeId, MultipartFile file) throws IOException;
+
+    List<BaseNewStudentScoreExcelVo> scoreImport(MultipartFile file) throws IOException;
 }

+ 278 - 0
src/main/java/com/xjrsoft/module/student/service/impl/BaseNewStudentServiceImpl.java

@@ -1,18 +1,40 @@
 package com.xjrsoft.module.student.service.impl;
 
+import cn.dev33.satoken.stp.StpUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.excel.EasyExcel;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.enums.YesOrNoEnum;
+import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.base.entity.BaseMajorSet;
+import com.xjrsoft.module.base.service.IBaseMajorSetService;
+import com.xjrsoft.module.base.vo.BaseClassCoursePageVo;
 import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
 import com.xjrsoft.module.student.entity.BaseNewStudent;
 import com.xjrsoft.module.student.mapper.BaseNewStudentMapper;
 import com.xjrsoft.module.student.service.IBaseNewStudentService;
 import com.xjrsoft.module.student.vo.BaseNewStudentPageVo;
+import com.xjrsoft.module.student.vo.BaseNewStudentScoreExcelVo;
 import com.xjrsoft.module.student.vo.EnrollmentPlanGradeVo;
 import com.xjrsoft.module.student.vo.EnrollmentPlanTreeVo;
+import com.xjrsoft.module.system.entity.DictionaryDetail;
+import com.xjrsoft.module.system.entity.DictionaryItem;
+import com.xjrsoft.module.system.mapper.DictionarydetailMapper;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
 * @title: 新生维护信息
@@ -23,6 +45,9 @@ import java.util.List;
 @Service
 @AllArgsConstructor
 public class BaseNewStudentServiceImpl extends MPJBaseServiceImpl<BaseNewStudentMapper, BaseNewStudent> implements IBaseNewStudentService {
+
+    private final DictionarydetailMapper dictionarydetailMapper;
+    private final IBaseMajorSetService majorSetService;
     @Override
     public Page<BaseNewStudentPageVo> getPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto) {
         return this.baseMapper.getPage(page, dto);
@@ -37,4 +62,257 @@ public class BaseNewStudentServiceImpl extends MPJBaseServiceImpl<BaseNewStudent
     public List<EnrollmentPlanGradeVo> getGradeList() {
         return this.baseMapper.getGradeList();
     }
+
+    /**
+     * 导入数据
+     * @param file 上传的文件
+     * @return 未成功导入的数据
+     */
+    @Override
+    public List<Map<Integer, Object>> importData(Long treeId, MultipartFile file) throws IOException {
+        List<Map<Integer, Object>> excelDataList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(3).doReadSync();
+
+        //查询字典数据
+        List<String> codeList = new ArrayList<>();
+        codeList.add("gender");
+        codeList.add("student_type");
+        codeList.add("stduy_status");
+
+        List<DictionaryDetail> detailList = dictionarydetailMapper.selectJoinList(DictionaryDetail.class,
+                new MPJLambdaWrapper<DictionaryDetail>()
+                        .select(DictionaryDetail.class, x -> VoToColumnUtil.fieldsToColumns(DictionaryDetail.class).contains(x.getProperty()))
+                        .leftJoin(DictionaryItem.class, DictionaryItem::getId, DictionaryDetail::getItemId)
+                        .in(DictionaryItem::getCode, codeList)
+        );
+        Map<String, String> dictMap = new HashMap<>();
+        for (DictionaryDetail detail : detailList) {
+            dictMap.put(detail.getName(), detail.getCode());
+        }
+
+        //查询专业数据
+        Map<String, Long> majorSetMap = majorSetService.list().stream().collect(Collectors.toMap(BaseMajorSet::getName, BaseMajorSet::getId));
+        
+        //查询已有的学生数据
+        List<BaseNewStudent> baseNewStudents = this.baseMapper.selectList(
+                new QueryWrapper<BaseNewStudent>().lambda()
+                        .eq(BaseNewStudent::getEnrollmentPlanId, treeId)
+        );
+        Map<String, BaseNewStudent> exeistStudent = baseNewStudents.stream().collect(Collectors.toMap(BaseNewStudent::getCredentialNumber, x -> x));
+
+        List<BaseNewStudent> dataList = new ArrayList<>();
+        List<BaseNewStudent> updateList = new ArrayList<>();
+        List<Map<Integer, Object>> errorList = new ArrayList<>();
+        Date createDate = new Date();
+        for (Map<Integer, Object> objectMap : excelDataList) {
+
+            //1、验证数据
+            if(checkData(objectMap, dictMap, majorSetMap) != null){
+                errorList.add(objectMap);
+                continue;
+            }
+            BaseNewStudent student = exeistStudent.get(objectMap.get(3).toString());
+            if(student != null && student.getStatus() == 1){
+                objectMap.put(15, "该学生已分班并已经同步到学生基本信息,无法导入");
+                errorList.add(objectMap);
+                continue;
+            }
+            if(student != null && student.getStatus() == 0){
+                student.setGraduateSchool(objectMap.get(0).toString());
+                student.setName(objectMap.get(1).toString());
+                student.setGender(dictMap.get(objectMap.get(2).toString()));
+                student.setCredentialNumber(objectMap.get(3).toString());
+                student.setHeight(BigDecimal.valueOf(Double.parseDouble(objectMap.get(4).toString())));
+                student.setWeight(BigDecimal.valueOf(Double.parseDouble(objectMap.get(5).toString())));
+                if(objectMap.get(6) != null){
+                    student.setGraduateClass(objectMap.get(6).toString());
+                }
+
+                student.setSource(dictMap.get(objectMap.get(7).toString()));
+                student.setStduyStatus(dictMap.get(objectMap.get(8).toString()));
+                student.setMobile(objectMap.get(9).toString());
+                student.setFirstAmbition(objectMap.get(10).toString());
+                student.setFirstAmbitionId(majorSetMap.get(objectMap.get(10).toString()));
+                student.setSecondAmbition(objectMap.get(11).toString());
+                student.setSecondAmbitionId(majorSetMap.get(objectMap.get(11).toString()));
+                student.setIsAdjust(YesOrNoEnum.getCode(objectMap.get(12).toString()));
+                if(objectMap.get(13) != null){
+                    student.setFamilyMobile(objectMap.get(13).toString());
+                }
+                if(objectMap.get(14) != null){
+                    student.setFamilyAddress(objectMap.get(14).toString());
+                }
+                updateList.add(student);
+                continue;
+            }
+
+            dataList.add(
+                new BaseNewStudent(){{
+                    setCreateDate(createDate);
+                    setCreateUserId(StpUtil.getLoginIdAsLong());
+                    setGraduateSchool(objectMap.get(0).toString());
+                    setName(objectMap.get(1).toString());
+                    setGender(dictMap.get(objectMap.get(2).toString()));
+                    setCredentialNumber(objectMap.get(3).toString());
+                    setHeight(BigDecimal.valueOf(Double.parseDouble(objectMap.get(4).toString())));
+                    setWeight(BigDecimal.valueOf(Double.parseDouble(objectMap.get(5).toString())));
+                    if(objectMap.get(6) != null){
+                        setGraduateClass(objectMap.get(6).toString());
+                    }
+
+                    setSource(dictMap.get(objectMap.get(7).toString()));
+                    setStduyStatus(dictMap.get(objectMap.get(8).toString()));
+                    setMobile(objectMap.get(9).toString());
+                    setFirstAmbition(objectMap.get(10).toString());
+                    setFirstAmbitionId(majorSetMap.get(objectMap.get(10).toString()));
+                    setSecondAmbition(objectMap.get(11).toString());
+                    setSecondAmbitionId(majorSetMap.get(objectMap.get(11).toString()));
+                    setIsAdjust(YesOrNoEnum.getCode(objectMap.get(12).toString()));
+                    if(objectMap.get(13) != null){
+                        setFamilyMobile(objectMap.get(13).toString());
+                    }
+                    if(objectMap.get(14) != null){
+                        setFamilyAddress(objectMap.get(14).toString());
+                    }
+                    setEnrollmentPlanId(treeId);
+                    setStatus(0);
+                }}
+            );
+        }
+        if(!dataList.isEmpty()){
+            this.saveBatch(dataList);
+        }
+
+        if(!updateList.isEmpty()){
+            this.updateBatchById(updateList);
+        }
+
+        return errorList;
+    }
+
+    @Override
+    public List<BaseNewStudentScoreExcelVo> scoreImport(MultipartFile file) throws IOException {
+        List<DictionaryDetail> detailList = dictionarydetailMapper.selectJoinList(DictionaryDetail.class,
+                new MPJLambdaWrapper<DictionaryDetail>()
+                        .select(DictionaryDetail.class, x -> VoToColumnUtil.fieldsToColumns(DictionaryDetail.class).contains(x.getProperty()))
+                        .leftJoin(DictionaryItem.class, DictionaryItem::getId, DictionaryDetail::getItemId)
+                        .eq(DictionaryItem::getCode, "gender")
+        );
+        Map<String, String> genderMap = detailList.stream().collect(Collectors.toMap(DictionaryDetail::getName, DictionaryDetail::getCode));
+
+        List<BaseNewStudentScoreExcelVo> excelDataList = EasyExcel.read(file.getInputStream()).headRowNumber(2).head(BaseNewStudentScoreExcelVo.class).sheet().doReadSync();
+        List<BaseNewStudentScoreExcelVo> errorList = new ArrayList<>();
+        List<BaseNewStudent> updateList = new ArrayList<>();
+        for (BaseNewStudentScoreExcelVo el : excelDataList) {
+            BaseNewStudent student = this.baseMapper.selectOne(
+                    new QueryWrapper<BaseNewStudent>().lambda()
+                            .eq(BaseNewStudent::getGender, genderMap.get(el.getGender()))
+                            .eq(BaseNewStudent::getGraduateSchool, el.getGraduateSchool())
+                            .eq(BaseNewStudent::getGraduateClass, el.getGraduateClass())
+                            .eq(BaseNewStudent::getName, el.getName())
+            );
+            if(student == null){
+                errorList.add(el);
+                continue;
+            }
+            student.setScore(el.getScore());
+            updateList.add(student);
+        }
+        if(!updateList.isEmpty()){
+            this.updateBatchById(updateList);
+        }
+
+        return errorList;
+    }
+
+    /**
+     * 检查必填字段是否为空
+     */
+    Map<Integer, Object> checkData(Map<Integer, Object> objectMap, Map<String, String> dictMap, Map<String, Long> majorSetMap){
+        //验证哪些列是空
+        List<Integer> emptyColumn = new ArrayList<>();
+        List<String> errorMsg = new ArrayList<>();
+        if(objectMap.get(0) == null || "".equals(objectMap.get(0).toString())){
+            emptyColumn.add(0);
+        }
+        if(objectMap.get(1) == null || "".equals(objectMap.get(1).toString())){
+            emptyColumn.add(1);
+        }
+        if(objectMap.get(2) == null || "".equals(objectMap.get(2).toString())){
+            emptyColumn.add(2);
+        }else{
+            if(dictMap.get(objectMap.get(2).toString()) == null){
+                errorMsg.add("性别不正确");
+            }
+        }
+        if(objectMap.get(3) == null || "".equals(objectMap.get(3).toString())){
+            emptyColumn.add(3);
+        }
+        if(objectMap.get(4) == null || "".equals(objectMap.get(4).toString())){
+            emptyColumn.add(4);
+        }else{
+            if(objectMap.get(4) instanceof Integer){
+                errorMsg.add("身高请只填写数字");
+            }
+        }
+        if(objectMap.get(5) == null || "".equals(objectMap.get(5).toString())){
+            emptyColumn.add(5);
+        }else{
+            if(objectMap.get(5) instanceof Integer){
+                errorMsg.add("体重请只填写数字");
+            }
+        }
+
+        if(objectMap.get(7) == null || "".equals(objectMap.get(7).toString())){
+            emptyColumn.add(7);
+        }else{
+            if(dictMap.get(objectMap.get(8).toString()) == null){
+                errorMsg.add("学生来源填写不正确");
+            }
+        }
+        if(objectMap.get(8) == null || "".equals(objectMap.get(8).toString())){
+            emptyColumn.add(8);
+        }else{
+            if(dictMap.get(objectMap.get(8).toString()) == null){
+                errorMsg.add("住宿类型填写不正确");
+            }
+        }
+        if(objectMap.get(9) == null || "".equals(objectMap.get(9).toString())){
+            emptyColumn.add(9);
+        }
+        if(objectMap.get(10) == null || "".equals(objectMap.get(10).toString())){
+            emptyColumn.add(10);
+        }else{
+            if(majorSetMap.get(objectMap.get(10).toString()) == null){
+                errorMsg.add("第一志愿填写不正确");
+            }
+        }
+        if(objectMap.get(11) == null || "".equals(objectMap.get(11).toString())){
+            emptyColumn.add(11);
+        }else{
+            if(majorSetMap.get(objectMap.get(11).toString()) == null){
+                errorMsg.add("第二志愿填写不正确");
+            }
+        }
+        if(objectMap.get(12) == null || "".equals(objectMap.get(12).toString())){
+            emptyColumn.add(12);
+        }else{
+            if(!"是".equals(objectMap.get(12).toString()) && !"否".equals(objectMap.get(12).toString()) ){
+                errorMsg.add("是否可调配请只填写“是”或“否”");
+            }
+        }
+        String msg = "";
+        if(!errorMsg.isEmpty()){
+            msg += errorMsg.toString().replace("]", "").replace("[", "");
+        }
+        if(!emptyColumn.isEmpty()){
+            msg += "以下列不能为空:" + emptyColumn.toString().replace("]", "").replace("[", "") + ";";
+        }
+
+        if(StrUtil.isNotEmpty(msg)){
+            objectMap.put(15, msg);
+            return objectMap;
+        }
+
+        return null;
+    }
 }

+ 8 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseNewStudentPageVo.java

@@ -141,4 +141,12 @@ public class BaseNewStudentPageVo {
     @ApiModelProperty("是否可调配(0:否,1:是)")
     private Integer isAdjust;
 
+    @ExcelProperty("家庭电话")
+    @ApiModelProperty("家庭电话")
+    private String familyMobile;
+
+    @ExcelProperty("家庭地址")
+    @ApiModelProperty("家庭地址")
+    private String familyAddress;
+
 }

+ 52 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseNewStudentScoreExcelVo.java

@@ -0,0 +1,52 @@
+package com.xjrsoft.module.student.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+* @title: 新生维护信息分页列表出参
+* @Author dzx
+* @Date: 2024-06-27
+* @Version 1.0
+*/
+@Data
+public class BaseNewStudentScoreExcelVo {
+
+    /**
+    * 毕业学校
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("毕业学校")
+    @ApiModelProperty("毕业学校")
+    private String graduateSchool;
+    /**
+    * 学生姓名
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("姓名")
+    @ApiModelProperty("姓名")
+    private String name;
+    /**
+    * 性别
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("性别")
+    @ApiModelProperty("性别")
+    private String gender;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("总成绩")
+    @ApiModelProperty("总成绩")
+    private BigDecimal score;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("班级")
+    @ApiModelProperty("班级")
+    private String graduateClass;
+
+
+}

+ 25 - 35
src/main/java/com/xjrsoft/module/textbook/controller/TextbookController.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.TextbookTypeEnum;
 import com.xjrsoft.common.model.result.R;
 import com.xjrsoft.common.model.result.RT;
@@ -16,45 +17,20 @@ import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseClassCourse;
 import com.xjrsoft.module.base.entity.BaseCourseSubject;
-import com.xjrsoft.module.base.entity.BaseSemester;
-import com.xjrsoft.module.base.service.IBaseSemesterService;
 import com.xjrsoft.module.student.entity.BaseClassMajorSet;
-import com.xjrsoft.module.textbook.dto.AddTextbookDto;
-import com.xjrsoft.module.textbook.dto.AddTextbookWarehouseRecordDto;
-import com.xjrsoft.module.textbook.dto.TextbookClaimExportQueryDto;
-import com.xjrsoft.module.textbook.dto.TextbookConsumptionPageDto;
-import com.xjrsoft.module.textbook.dto.TextbookPageDto;
-import com.xjrsoft.module.textbook.dto.TextbookStandingExportQuerytDto;
-import com.xjrsoft.module.textbook.dto.TextbookSubscriptionExportQueryDto;
-import com.xjrsoft.module.textbook.dto.TextbookSubscriptionListDto;
-import com.xjrsoft.module.textbook.dto.UpdateTextbookDto;
+import com.xjrsoft.module.student.service.IBaseClassMajorSetService;
+import com.xjrsoft.module.textbook.dto.*;
 import com.xjrsoft.module.textbook.entity.Textbook;
 import com.xjrsoft.module.textbook.entity.TextbookClassRelation;
 import com.xjrsoft.module.textbook.entity.TextbookStudentClaim;
 import com.xjrsoft.module.textbook.service.ITextbookService;
 import com.xjrsoft.module.textbook.service.ITextbookStudentClaimService;
-import com.xjrsoft.module.textbook.vo.TextbookConsumptionPageVo;
-import com.xjrsoft.module.textbook.vo.TextbookIssueRecordListVo;
-import com.xjrsoft.module.textbook.vo.TextbookPageVo;
-import com.xjrsoft.module.textbook.vo.TextbookStandingExportQueryVo;
-import com.xjrsoft.module.textbook.vo.TextbookSubscriptionExportQueryVo;
-import com.xjrsoft.module.textbook.vo.TextbookSubscriptionListVo;
-import com.xjrsoft.module.textbook.vo.TextbookSubscriptionRecordVo;
-import com.xjrsoft.module.textbook.vo.TextbookVo;
-import com.xjrsoft.module.textbook.vo.TextbookWarehouseRecordListVo;
-import com.xjrsoft.module.textbook.vo.WfTextbookClaimListVo;
+import com.xjrsoft.module.textbook.vo.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-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.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.validation.Valid;
@@ -79,10 +55,11 @@ public class TextbookController {
 
     private final ITextbookService textbookService;
 
-    private final IBaseSemesterService baseSemesterService;
-
     private final ITextbookStudentClaimService textbookStudentClaimService;
 
+
+    private final IBaseClassMajorSetService baseClassMajorSetService;
+
     @GetMapping(value = "/page")
     @ApiOperation(value="教材管理列表(分页)")
     @SaCheckPermission("textbook:detail")
@@ -107,21 +84,34 @@ public class TextbookController {
                 .select(Textbook::getId)
                 .selectAs(Textbook::getId,TextbookSubscriptionListVo::getTextbookId)
                 .selectAs(BaseCourseSubject::getName, TextbookSubscriptionListVo::getCourseName)
-                .selectSum(BaseClassMajorSet::getTotalStudent, TextbookSubscriptionListVo::getStudentSubscriptionNumber)
                 .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(TextbookSubscriptionListVo.class).contains(x.getProperty()))
                 .leftJoin(BaseClassCourse.class, BaseClassCourse::getCourseId, Textbook::getCourseSubjectId)
-                .leftJoin(BaseClassMajorSet.class, BaseClassMajorSet::getClassId, BaseClassCourse::getClassId)
                 .leftJoin(BaseCourseSubject.class, BaseCourseSubject::getId, Textbook::getCourseSubjectId)
                 .eq(dto.getBaseSemesterId() != null && dto.getBaseSemesterId() > 0, BaseClassCourse::getBaseSemesterId, dto.getBaseSemesterId())
                 .in(!classIdList.isEmpty(),BaseClassCourse::getClassId, classIdList)
                 .groupBy(Textbook::getId)
         ;
         IPage<TextbookSubscriptionListVo> page = textbookService.selectJoinListPage(ConventPage.getPage(dto),TextbookSubscriptionListVo.class,textbookMPJLambdaWrapper);
+
+        //获取所有班级的总人数
+        LambdaQueryWrapper<BaseClassMajorSet> baseClassMajorSetLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        baseClassMajorSetLambdaQueryWrapper
+                .in(!classIdList.isEmpty(), BaseClassMajorSet::getClassId, classIdList)
+                .eq(BaseClassMajorSet::getDeleteMark, DeleteMark.NODELETE.getCode())
+                ;
+        List<BaseClassMajorSet> baseClassMajorSetList = baseClassMajorSetService.list(baseClassMajorSetLambdaQueryWrapper);
+
+        int studentSubscriptionNumber = 0;
+        for (BaseClassMajorSet baseClassMajorSet : baseClassMajorSetList){
+            studentSubscriptionNumber += baseClassMajorSet.getTotalStudent();
+        }
+
         for(TextbookSubscriptionListVo t : page.getRecords()){
             t.setClassIds(dto.getClassIds());
-            if(t.getTextbookType() != null && !t.getTextbookType().equals("")){
+            if(t.getTextbookType() != null && !("").equals(t.getTextbookType())){
                 t.setTextbookTypeCn(TextbookTypeEnum.getValue(t.getTextbookType()));
             }
+            t.setStudentSubscriptionNumber(studentSubscriptionNumber);
         }
         PageOutput<TextbookSubscriptionListVo> pageOutput = ConventPage.getPageOutput(page, TextbookSubscriptionListVo.class);
         return RT.ok(pageOutput);
@@ -155,7 +145,7 @@ public class TextbookController {
     @GetMapping(value = "/List-subscription")
     @ApiOperation(value="教材管理列表(不分页,教材征订用)")
     @SaCheckPermission("textbook:detail")
-    public RT<List<TextbookSubscriptionListVo>> ListSubscription(@Valid TextbookSubscriptionListDto dto){
+    public RT<List<TextbookSubscriptionListVo>> listSubscription(@Valid TextbookSubscriptionListDto dto){
         List<String> classIdList = new ArrayList<>();
         if(dto.getClassIds() != null && !dto.getClassIds().equals("")){
             String[] classIdArr =  dto.getClassIds().split(",");

+ 5 - 3
src/main/java/com/xjrsoft/module/textbook/controller/WfTextbookSubscriptionItemHistoryController.java

@@ -9,6 +9,7 @@ import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseCourseSubject;
+import com.xjrsoft.module.system.entity.DictionaryDetail;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import com.xjrsoft.module.textbook.dto.AddWfTextbookSubscriptionItemHistoryDto;
 import com.xjrsoft.module.textbook.dto.UpdateWfTextbookSubscriptionItemHistoryDto;
@@ -51,15 +52,16 @@ public class WfTextbookSubscriptionItemHistoryController {
                 .select(WfTextbookSubscriptionItemHistory::getId)
                 .selectAs(BaseCourseSubject::getName, WfTextbookSubscriptionItemHistoryPageVo::getCourseName)
                 .selectAs(XjrUser::getName, WfTextbookSubscriptionItemHistoryPageVo::getCreateUserIdCn)
-                .select(WfTextbookSubscriptionItemHistory.class, x -> VoToColumnUtil.fieldsToColumns(WfTextbookSubscriptionItemHistoryPageVo.class).contains(x.getProperty()))
                 .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(WfTextbookSubscriptionItemHistoryPageVo.class).contains(x.getProperty()))
+                .select(WfTextbookSubscriptionItemHistory.class, x -> VoToColumnUtil.fieldsToColumns(WfTextbookSubscriptionItemHistoryPageVo.class).contains(x.getProperty()))
                 .leftJoin(Textbook.class, Textbook::getId, WfTextbookSubscriptionItemHistory::getTextbookId)
-//                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
-//                        ext -> ext.selectAs(DictionaryDetail::getName, WfTextbookSubscriptionItemHistoryPageVo::getTextbookTypeCn))
+                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
+                        ext -> ext.selectAs(DictionaryDetail::getName, WfTextbookSubscriptionItemHistoryPageVo::getTextbookTypeCn))
                 .leftJoin(BaseCourseSubject.class, BaseCourseSubject::getId, Textbook::getCourseSubjectId)
                 .leftJoin(XjrUser.class, XjrUser::getId, WfTextbookSubscriptionItemHistory::getCreateUserId)
                 .eq(dto.getWfTextbookSubscriptionItemId() != null && dto.getWfTextbookSubscriptionItemId() > 0, WfTextbookSubscriptionItemHistory::getWfTextbookSubscriptionItemId, dto.getWfTextbookSubscriptionItemId())
                 .eq(dto.getWfTextbookSubscriptionId() != null && dto.getWfTextbookSubscriptionId() > 0, WfTextbookSubscriptionItemHistory::getWfTextbookSubscriptionId, dto.getWfTextbookSubscriptionId())
+                .eq(dto.getTextbookType() != null && !dto.getTextbookType().isEmpty(), Textbook::getTextbookType, dto.getTextbookType())
                 .like(dto.getBookName() != null && !dto.getBookName().isEmpty(), Textbook::getBookName, dto.getBookName())
                 .like(dto.getCourseSubjectIdCn() != null && !dto.getCourseSubjectIdCn().isEmpty(), BaseCourseSubject::getName, dto.getCourseSubjectIdCn())
                 .orderByAsc("t.wf_textbook_subscription_item_id, t.history_version")

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

@@ -62,7 +62,7 @@ public class TextbookImportDto {
      * 教材类型(xjr_dictionary_item[textbook_type])
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("类型(教材、辅、作业本)")
+    @ExcelProperty("类型(教材、辅、作业本)")
     @ApiModelProperty("教材类型-中文")
     private String textbookTypeCn;
     /**

+ 5 - 0
src/main/java/com/xjrsoft/module/textbook/dto/WfTextbookSubscriptionItemHistoryPageDto.java

@@ -41,4 +41,9 @@ public class WfTextbookSubscriptionItemHistoryPageDto extends PageInput {
      */
     @ApiModelProperty("课程编号(base_course_subject)")
     private String courseSubjectIdCn;
+    /**
+     * 教材类型(xjr_dictionary_item[textbook_type])
+     */
+    @ApiModelProperty("教材类型(xjr_dictionary_item[textbook_type])")
+    private String textbookType;
 }

+ 13 - 11
src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookServiceImpl.java

@@ -99,6 +99,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
         BeanUtils.copyProperties(textbook, textbookCoreAttribute);
         textbookCoreAttributeMapper.insert(textbookCoreAttribute);
         textbook.setTextbookCoreAttributeId(textbookCoreAttribute.getId());
+        textbook.setSubtotal(textbook.getPrice().multiply(BigDecimal.valueOf(textbook.getDiscount()/10)));
         textbookTextbookMapper.insert(textbook);
         for (TextbookClassRelation textbookClassRelation : textbook.getTextbookClassRelationList()) {
             textbookClassRelation.setTextbookId(textbook.getId());
@@ -766,7 +767,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
             }});
             //sheet的表头合并策略
             ExcelFillCellMergePrevColUtil sheetHeadColumn = new ExcelFillCellMergePrevColUtil();
-            sheetHeadColumn.add(rowIndex, 0, 9);
+            sheetHeadColumn.add(rowIndex, 0, 12);
             //这是一个sheet表头的table
             WriteTable writeSheetHeadTable = EasyExcel.writerTable(tableIndex).needHead(Boolean.TRUE).head(sheetHeadList).registerWriteHandler(sheetHeadColumn).build();
             excelWriter.write(new ArrayList<>(), writeSheet, writeSheetHeadTable);
@@ -947,6 +948,9 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
             //处理使用类型
             textbook.setUseType(UseSemesterTypeEnum.getCode(textbookImportDto.getUseTypeCn()));
 
+            //处理小计
+            textbook.setSubtotal(textbook.getPrice().multiply(BigDecimal.valueOf(textbook.getDiscount()/10)));
+
             // 判断导入的教材是否已经存在,根据教材的 ISBN 码和使用的学期判断
             LambdaQueryWrapper<Textbook> textbookLambdaQueryWrapper = new LambdaQueryWrapper<>();
             textbookLambdaQueryWrapper
@@ -992,26 +996,26 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
             throw new MyException("入库失败,该教材不存在");
         }
 
-        BigDecimal price = ObjectUtil.isNull(dto.getPrice()) ? new BigDecimal(0) : dto.getPrice();
-        Double discount = ObjectUtil.isNull(dto.getDiscount()) ? 10 : dto.getDiscount();
-        BigDecimal subtotal = price.multiply(new BigDecimal(discount / 10));
+//        BigDecimal price = ObjectUtil.isNull(dto.getPrice()) ? new BigDecimal(0) : dto.getPrice();
+//        double discount = ObjectUtil.isNull(dto.getDiscount()) ? 10 : dto.getDiscount();
+//        BigDecimal subtotal = price.multiply(new BigDecimal(discount / 10));
         //更新总的库存数量
         this.updateById(new Textbook() {
             {
                 setId(textbook.getId());
                 Integer oldStock = ObjectUtil.isNull(textbook.getStock()) ? 0 : textbook.getStock();
                 setStock(oldStock + (ObjectUtil.isNull(dto.getWarehouseNumber()) ? 0 : dto.getWarehouseNumber()));
-                setPrice(price);
-                setDiscount(discount);
-                setSubtotal(subtotal);
+//                setPrice(price);
+//                setDiscount(discount);
+//                setSubtotal(subtotal);
                 setModifyDate(new Date());
             }
         });
         //添加入库记录
         TextbookWarehouseRecord textbookWarehouseRecord = BeanUtil.toBean(dto, TextbookWarehouseRecord.class);
         textbookWarehouseRecord.setWarehouseMode(WarehouseModeEnum.WmManual.getCode());
-        textbookWarehouseRecord.setDiscount(discount);
-        textbookWarehouseRecord.setSubtotal(subtotal);
+        textbookWarehouseRecord.setDiscount(textbook.getDiscount());
+        textbookWarehouseRecord.setSubtotal(textbook.getSubtotal());
         textbookWarehouseRecord.setCreateDate(new Date());
         QueryWrapper<TextbookWarehouseRecord> queryWrapperSortcode = new QueryWrapper<>();
         queryWrapperSortcode.select("IFNULL(MAX(sort_code),0) as sortCode");
@@ -1021,6 +1025,4 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
 
         return true;
     }
-
-
 }

+ 5 - 1
src/main/java/com/xjrsoft/module/textbook/service/impl/WfTextbookSubscriptionServiceImpl.java

@@ -204,8 +204,8 @@ public class WfTextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<WfText
         mpjLambdaWrapper
                 .select(WfTextbookSubscriptionItem::getId)
                 .selectAs(BaseCourseSubject::getName, WfTextbookSubscriptionItemVo::getCourseSubjectIdCn)
-                .select(WfTextbookSubscriptionItem.class, x -> VoToColumnUtil.fieldsToColumns(WfTextbookSubscriptionItemVo.class).contains(x.getProperty()))
                 .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(WfTextbookSubscriptionItemVo.class).contains(x.getProperty()))
+                .select(WfTextbookSubscriptionItem.class, x -> VoToColumnUtil.fieldsToColumns(WfTextbookSubscriptionItemVo.class).contains(x.getProperty()))
                 .leftJoin(Textbook.class, Textbook::getId, WfTextbookSubscriptionItem::getTextbookId)
                 .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
                         ext -> ext.selectAs(DictionaryDetail::getName, WfTextbookSubscriptionItemVo::getTextbookTypeCn))
@@ -246,15 +246,19 @@ public class WfTextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<WfText
         int stuSum = 0;
         int teaSum = 0;
         for (WfTextbookSubscriptionItemVo w : itemList) {
+            int sum = 0;
             if (!classIdList.isEmpty()) {
                 w.setClassNum(classIdList.size());
             }
             if (w.getStudentSubscriptionNumber() != null) {
                 stuSum += w.getStudentSubscriptionNumber();
+                sum += w.getStudentSubscriptionNumber();
             }
             if (w.getTeacherSubscriptionNumber() != null) {
                 teaSum += w.getTeacherSubscriptionNumber();
+                sum += w.getTeacherSubscriptionNumber();
             }
+            w.setSumNumber(sum);
         }
 
         wfTextbookSubscriptionVo.setClassIdsCn(sb.toString());

+ 15 - 0
src/main/java/com/xjrsoft/module/textbook/vo/TextbookSubscriptionListVo.java

@@ -39,6 +39,21 @@ public class TextbookSubscriptionListVo {
     */
     @ApiModelProperty("书名")
     private String bookName;
+    /**
+     * 国际标准刊号
+     */
+    @ApiModelProperty("国际标准刊号")
+    private String issn;
+    /**
+     * 主编
+     */
+    @ApiModelProperty("主编")
+    private String editorInChief;
+    /**
+     * 版本
+     */
+    @ApiModelProperty("版本")
+    private String version;
     /**
     * 出版社
     */

+ 10 - 0
src/main/java/com/xjrsoft/module/textbook/vo/WfTextbookSubscriptionItemHistoryPageVo.java

@@ -80,6 +80,16 @@ public class WfTextbookSubscriptionItemHistoryPageVo {
     */
     @ApiModelProperty("主编")
     private String editorInChief;
+    /**
+     * 教材类型(xjr_dictionary_item[textbook_type])
+     */
+    @ApiModelProperty("教材类型(xjr_dictionary_item[textbook_type])")
+    private String textbookType;
+    /**
+     * 教材类型(xjr_dictionary_item[textbook_type])
+     */
+    @ApiModelProperty("教材类型(xjr_dictionary_item[textbook_type])")
+    private String textbookTypeCn;
     /**
     * 估价(元)
     */

+ 2 - 2
src/main/java/com/xjrsoft/module/textbook/vo/WfTextbookSubscriptionItemVo.java

@@ -117,8 +117,8 @@ public class WfTextbookSubscriptionItemVo {
     /**
     * 教师教参用书征订数量
     */
-    @ApiModelProperty("教师教参用书征订数量")
-    private Integer teacherReferenceNumber;
+    @ApiModelProperty("征订数量")
+    private Integer sumNumber;
     /**
     * 是否有配套教学资源(xjr_dictionary_item[judgment_method_1])
     */

+ 2 - 2
src/main/resources/application.yml

@@ -126,8 +126,8 @@ mybatis-plus:
     cache-enabled: false
     call-setters-on-nulls: true
     jdbc-type-for-null: 'null'
-    log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
-#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+#    log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 
 camunda:
   bpm: