Browse Source

Merge remote-tracking branch 'origin/dev' into dev

fanxp 2 months ago
parent
commit
713eb4bf38

+ 10 - 0
src/main/java/com/xjrsoft/module/activity/controller/ActivityInfoController.java

@@ -89,6 +89,16 @@ public class ActivityInfoController {
         return RT.ok(pageOutput);
     }
 
+    @GetMapping(value = "/today-schedule")
+    @ApiOperation(value="今日安排(分页)")
+    @SaCheckPermission("activityinfo:detail")
+    public RT<PageOutput<ActivityInfoPageVo>> todaySchedule(@Valid ActivityInfoPageDto dto){
+
+        Page<ActivityInfoPageVo> page = activityInfoService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        PageOutput<ActivityInfoPageVo> pageOutput = ConventPage.getPageOutput(page, ActivityInfoPageVo.class);
+        return RT.ok(pageOutput);
+    }
+
     @GetMapping(value = "/info")
     @ApiOperation(value="根据id查询活动信息信息")
     @SaCheckPermission("activityinfo:detail")

+ 2 - 2
src/main/java/com/xjrsoft/module/activity/vo/ActivityInfoPageVo.java

@@ -99,9 +99,9 @@ public class ActivityInfoPageVo {
     @ApiModelProperty("合作企业")
     private Long enterpriseId;
     /**
-    * 1:校企合作活动 2:赛事活动
+    * 1:校企合作活动 2:赛事活动 3:社团活动 4:思政德育活动 5:教研培训 6:党建活动
     */
-    @ApiModelProperty("1:校企合作活动 2:赛事活动")
+    @ApiModelProperty("1:校企合作活动 2:赛事活动 3:社团活动 4:思政德育活动 5:教研培训 6:党建活动 7:课表数据 8:会议")
     private Integer category;
 
     @ApiModelProperty("合作企业名称")

+ 120 - 0
src/main/java/com/xjrsoft/module/activity/vo/ActivityInfoTodayVo.java

@@ -0,0 +1,120 @@
+package com.xjrsoft.module.activity.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+* @title: 活动信息分页列表出参
+* @Author dzx
+* @Date: 2024-07-19
+* @Version 1.0
+*/
+@Data
+public class ActivityInfoTodayVo {
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private String id;
+    /**
+    * 赛事名称
+    */
+    @ApiModelProperty("活动名称")
+    private String name;
+    /**
+    * 活动地点
+    */
+    @ApiModelProperty("活动地点")
+    private String place;
+    /**
+    * 活动开始时间
+    */
+    @ApiModelProperty("开始时间")
+    private String startDate;
+    /**
+    * 活动结束时间
+    */
+    @ApiModelProperty("结束时间")
+    private String endDate;
+    /**
+    * 活动类型(xjr_dictionary_detail[match_activity_type])
+    */
+    @ApiModelProperty("活动类型(xjr_dictionary_detail[match_activity_type])")
+    private String type;
+
+    @ApiModelProperty("活动类型-中文")
+    private String typeCn;
+    /**
+    * 组织部门(xjr_department)
+    */
+    @ApiModelProperty("组织部门(xjr_department)")
+    private Long orgId;
+
+    @ApiModelProperty("组织部门名称")
+    private String orgCn;
+    /**
+    * 报名结束时间
+    */
+    @ApiModelProperty("报名结束时间")
+    private Date enrollEndTime;
+    /**
+    * 活动负责人
+    */
+    @ApiModelProperty("活动负责人")
+    private String dutyPerson;
+    /**
+    * 活动负责人电话
+    */
+    @ApiModelProperty("活动负责人电话")
+    private String dutyPersonMobile;
+    /**
+    * 封面图片
+    */
+    @ApiModelProperty("封面图片")
+    private String coverFileId;
+
+    @ApiModelProperty("封面图片地址")
+    private String coverFileUrl;
+    /**
+    * 报名范围
+    */
+    @ApiModelProperty("报名范围")
+    private String enrollRange;
+    /**
+    * 状态(0:未发布 1:报名中 2:报名结束 3:活动结束)
+    */
+    @ApiModelProperty("状态(0:未发布 1:报名中 2:报名结束 3:活动结束)")
+    private Integer status;
+    /**
+    * 活动内容
+    */
+    @ApiModelProperty("活动内容")
+    private String content;
+    /**
+    * 合作企业
+    */
+    @ApiModelProperty("合作企业")
+    private Long enterpriseId;
+    /**
+    * 1:校企合作活动 2:赛事活动 3:社团活动 4:思政德育活动 5:教研培训 6:党建活动
+    */
+    @ApiModelProperty("1:校企合作活动 2:赛事活动 3:社团活动 4:思政德育活动 5:教研培训 6:党建活动 7:课表数据 8:会议")
+    private Integer category;
+
+    @ApiModelProperty("合作企业名称")
+    private String enterpriseName;
+
+    @ApiModelProperty("报名人数")
+    private Integer enrollCount;
+
+
+    @ApiModelProperty("是否已报名(1:是 0:否)")
+    private Integer isEnroll;
+
+    @ApiModelProperty("参与状态(0:待确认 1:未参与 2:已参与)")
+    private Integer enrollStatus;
+
+}

+ 18 - 2
src/main/java/com/xjrsoft/module/base/controller/BaseClassDynamicsController.java

@@ -20,7 +20,11 @@ import com.xjrsoft.module.base.service.IBaseClassDynamicsService;
 import com.xjrsoft.module.base.service.IBaseUserStudentService;
 import com.xjrsoft.module.base.vo.BaseClassDynamicsPageVo;
 import com.xjrsoft.module.base.vo.BaseClassDynamicsVo;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
+import com.xjrsoft.module.system.entity.File;
+import com.xjrsoft.module.system.service.IFileService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -37,7 +41,6 @@ import javax.validation.Valid;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.stream.Collectors;
 
 /**
 * @title: 班级动态表
@@ -55,6 +58,8 @@ public class BaseClassDynamicsController {
     private final IBaseClassDynamicsService baseClassDynamicsService;
     private final IBaseStudentSchoolRollService rollService;
     private final IBaseUserStudentService userStudentService;
+    private final IUserService userService;
+    private final IFileService fileService;
 
     @GetMapping(value = "/page")
     @ApiOperation(value="班级动态表列表(分页)")
@@ -112,7 +117,18 @@ public class BaseClassDynamicsController {
         if (baseClassDynamics == null) {
            return RT.error("找不到此数据!");
         }
-        return RT.ok(BeanUtil.toBean(baseClassDynamics, BaseClassDynamicsVo.class));
+        BaseClassDynamicsVo dynamicsVo = BeanUtil.toBean(baseClassDynamics, BaseClassDynamicsVo.class);
+        User user = userService.getById(baseClassDynamics.getCreateUserId());
+        dynamicsVo.setCreateUserName(user.getName());
+
+        if(dynamicsVo.getFolderId() != null){
+            File file = fileService.getOne(new QueryWrapper<File>().lambda().eq(File::getFolderId, dynamicsVo.getFolderId()));
+            if(file != null){
+                dynamicsVo.setFileUrl(file.getFileUrl());
+            }
+        }
+
+        return RT.ok(dynamicsVo);
     }
 
 

+ 6 - 0
src/main/java/com/xjrsoft/module/base/vo/BaseClassDynamicsVo.java

@@ -48,4 +48,10 @@ public class BaseClassDynamicsVo {
     @ApiModelProperty("发布时间")
     private Date createDate;
 
+    @ApiModelProperty("发布人")
+    private String createUserName;
+
+    @ApiModelProperty("发布人")
+    private String fileUrl;
+
 }

+ 46 - 1
src/main/java/com/xjrsoft/module/evaluate/service/impl/EvaluateManageServiceImpl.java

@@ -2,10 +2,14 @@ package com.xjrsoft.module.evaluate.service.impl;
 
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.IdUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 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.DeleteMark;
 import com.xjrsoft.common.enums.EvaluateTypeEnum;
 import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.module.evaluate.dto.DrillEvaluateClassListDto;
@@ -33,6 +37,10 @@ import com.xjrsoft.module.evaluate.vo.EvaluateManageScoreVo;
 import com.xjrsoft.module.evaluate.vo.EvaluateWriteVo;
 import com.xjrsoft.module.evaluate.vo.MobileIndexPageVo;
 import com.xjrsoft.module.evaluate.vo.MobileResultPageVo;
+import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.organization.service.IUserService;
+import com.xjrsoft.module.organization.service.IWeChatService;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -42,6 +50,8 @@ import javax.script.ScriptEngineManager;
 import javax.script.ScriptException;
 import java.text.DecimalFormat;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -64,7 +74,8 @@ public class EvaluateManageServiceImpl extends MPJBaseServiceImpl<EvaluateManage
     private final EvaluateExecuterMapper evaluateExecuterMapper;
     private final EvaluateItemMapper evaluateItemMapper;
     private final EvaluateManageItemMapper evaluateManageItemMapper;
-
+    private final IUserService userService;
+    private final IWeChatService weChatService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -138,6 +149,40 @@ public class EvaluateManageServiceImpl extends MPJBaseServiceImpl<EvaluateManage
         evaluateManage.setModifyUserId(StpUtil.getLoginIdAsLong());
 
         evaluateManageMapper.updateById(evaluateManage);
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        String time17 = LocalDateTime.now().format(formatter);
+        // 查询参加答题的用户进行微信消息通知
+        List<User> list = userService.list(
+                new MPJLambdaWrapper<User>()
+                        .innerJoin(EvaluateExecuter.class, EvaluateExecuter::getEvaluateObjectId, User::getId)
+                        .eq(EvaluateExecuter::getEvaluateManageId, evaluateManage.getId())
+                        .eq(EvaluateExecuter::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .ne(User::getOpenId, "")
+                        .isNotNull(User::getOpenId)
+        );
+        User releaseUser = userService.getById(StpUtil.getLoginIdAsLong());
+        for (User user : list) {
+            WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
+            weChatSendMessageDto.setUserId(user.getOpenId());
+            weChatSendMessageDto.setTemplateId("qmpXORPM1Cocqn503Qa4On6BJhR92UZ00eod2-6IcGo");
+            weChatSendMessageDto.setMsgId(IdUtil.getSnowflakeNextId() + "");
+            JSONObject paramJson = new JSONObject();
+
+            JSONObject thing23 = new JSONObject();
+            thing23.put("value", evaluateManage.getName());
+            paramJson.put("thing23", thing23);
+
+            JSONObject thing29 = new JSONObject();
+            thing29.put("value", releaseUser.getName());
+            paramJson.put("thing29", thing29);
+
+            JSONObject time17Json = new JSONObject();
+            time17Json.put("value", time17);
+            paramJson.put("time17", time17Json);
+
+            weChatSendMessageDto.setContent(paramJson);
+            weChatService.sendTemplateMessage(weChatSendMessageDto);
+        }
         return true;
     }
 

+ 38 - 4
src/main/java/com/xjrsoft/module/job/JianyuekbScheduleTask.java

@@ -1,11 +1,14 @@
 package com.xjrsoft.module.job;
 
 import cn.hutool.extra.spring.SpringUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.gson.JsonArray;
 import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
-import com.xjrsoft.module.schedule.entity.CourseReceiveMsg;
+import com.xjrsoft.module.base.entity.BaseClass;
+import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.schedule.util.DataUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
@@ -17,6 +20,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 
 /**
@@ -26,6 +30,9 @@ import java.util.Set;
 @Component
 @Slf4j
 public class JianyuekbScheduleTask {
+    @Autowired
+    private IBaseClassService classService;
+
     @Scheduled(cron = "0 */10 * * * ?")
     public void execute() throws Exception {
         RefreshConnectionPool();
@@ -37,18 +44,45 @@ public class JianyuekbScheduleTask {
             return;
         }
         String sql = "SELECT * FROM course_receive_msg WHERE delete_mark = 0 AND is_callback IS NULL";
-        List<Map<String, Object>> receiveMsgs = SqlRunnerAdapter.db().selectList(sql, CourseReceiveMsg.class);
+        List<Map<String, Object>> receiveMsgs = SqlRunnerAdapter.db().selectList(sql);
         JsonArray allScheduleInfo = new JsonArray();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         DataUtil dataUtil = new DataUtil();
+        //查询出传入排课系统的年级和班级
+        List<String> eduYearSerialNo1 = receiveMsgs.stream().map(x -> "'" + x.get("edu_year_serial_no").toString() + "'").collect(Collectors.toList());
+
+        //查询出传入排课系统的年级和班级
+        sql = "SELECT * FROM jianyue_data WHERE source_id IS NOT NULL AND jianyue_id != ''" +
+                " and table_name = 'base_grade'" +
+                " and jianyue_id in (" + eduYearSerialNo1.toString().replace("[","").replace("]","") + ")";
+        List<Map<String, Object>> jianyueData = SqlRunnerAdapter.db().selectList(sql);
+        Map<String, List<Long>> gradeClassMaps = new HashMap<>();//存入对应年级的所有班级id
+        for (Map<String, Object> el : jianyueData) {
+            String gradeId = el.get("source_id").toString();
+            if(gradeId.contains("_")){
+                gradeId = el.get("source_id").toString().split("_")[1];
+            }
+            List<BaseClass> classList = classService.list(new QueryWrapper<BaseClass>().lambda().eq(BaseClass::getGradeId, gradeId));
+            List<Long> classIds = classList.stream().map(BaseClass::getId).collect(Collectors.toList());
+
+            gradeClassMaps.put(el.get("jianyue_id").toString(), classIds);
+        }
+
         for (Map<String, Object> receiveMsg : receiveMsgs) {
             String updSql = "update course_receive_msg set is_callback = 0 where id = " + receiveMsg.get("id").toString();
             SqlRunnerAdapter.db().update(updSql);
 
             String eduYearSerialNo = receiveMsg.get("edu_year_serial_no").toString();
+            String startDateStr = receiveMsg.get("start_date").toString();
+            String endDateStr = receiveMsg.get("end_date").toString();
+            //删除课表信息
+            String delSql = "delete from course_table where schedule_date between '" + startDateStr + "'" +
+                    " and '" + endDateStr + "'" +
+                    " and class_id in (" + gradeClassMaps.get(eduYearSerialNo).toString().replace("[","").replace("]","")+ ")";
+            SqlRunnerAdapter.db().delete(delSql);
 
-            LocalDate startDateObj = LocalDate.parse(receiveMsg.get("start_date").toString());
-            LocalDate endDateObj = LocalDate.parse(receiveMsg.get("end_date").toString());
+            LocalDate startDateObj = LocalDate.parse(startDateStr);
+            LocalDate endDateObj = LocalDate.parse(endDateStr);
             long between = ChronoUnit.DAYS.between(startDateObj, endDateObj);
             int times = Integer.parseInt(((between / 7) + 1) + "");
 

+ 1 - 1
src/main/java/com/xjrsoft/module/schedule/util/DataUtil.java

@@ -669,7 +669,7 @@ public class DataUtil {
                 String updSql = "update course_table set teacher_serial_no = '" + teacher_serial_no + "'" +
                         ", teacher_id = " + teacherId
                         + ", teacher_name = '" + teacherName + "', modify_date = now()" +
-                        " ,course_id = " + courseClassId +
+                        " ,course_id = " + courseClassId + ", course_name = '" + courseClassName + "'" +
                         " where schedule_date = '" + scheduleDate + "'and class_id = " + classId + " and time_number = " + timeNumber + ";";
                 updateSqlList.add(updSql);
                 continue;

+ 0 - 1
src/main/java/com/xjrsoft/module/textbook/controller/TextbookStudentClaimController.java

@@ -62,7 +62,6 @@ public class TextbookStudentClaimController {
     @ApiOperation(value="学生教材认领记录列表(分页)")
     @SaCheckPermission("textbookstudentclaim:detail")
     public RT<PageOutput<TextbookStudentClaimPageVo>> page(@Valid TextbookStudentClaimPageDto dto){
-        long userId = StpUtil.getLoginIdAsLong();
         LambdaQueryWrapper<TextbookStudentClaim> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper
                 .orderByDesc(TextbookStudentClaim::getId)

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

@@ -5,7 +5,7 @@ server:
 spring:
   # 环 io境 dev|pre|prod
   profiles:
-    active: dev
+    active: pre
   # jackson时间格式化
   jackson:
     time-zone: GMT+8

+ 55 - 0
src/main/resources/mapper/activity/ActivityInfoMapper.xml

@@ -84,4 +84,59 @@
         participant_teacher_name LIKE CONCAT('%',#{dto.loginUserId},'%') OR participant_student_name LIKE CONCAT('%',#{dto.loginUserId},'%')
         )
     </select>
+    <select id="getTodaySchedule" parameterType="com.xjrsoft.module.activity.dto.ActivityInfoPageDto" resultType="com.xjrsoft.module.activity.vo.ActivityInfoPageVo">
+        SELECT t1.id,t1.name,t1.place,t1.start_date,t1.end_date,
+        t1.type, t4.name AS org_name, t1.enroll_end_time, t1.cover_file_id,
+        t1.status,t1.content,t1.category,t5.status AS enroll_status,t2.name as type_cn, 1 as is_enroll FROM activity_info t1
+        LEFT JOIN xjr_dictionary_detail t2 ON t1.type = t2.code
+        LEFT JOIN company_coop t3 ON t1.enterprise_id = t3.id
+        LEFT JOIN xjr_department t4 ON t1.org_id = t4.id
+        LEFT JOIN activity_enroll t5 ON t1.id = t5.activity_info_id
+        WHERE t1.delete_mark = 0 AND t5.user_id = #{dto.loginUserId}
+        <if test="dto.category != null">
+            and t1.category = #{dto.category}
+        </if>
+        <if test="dto.isEffective != null and dto.isEffective == 1">
+            and (t1.status = 1 or t1.status = 2) and NOW() between t1.start_date and t1.end_date
+        </if>
+        UNION
+        SELECT a1.id, a1.club_activities_name AS NAME,a1.activity_location AS place,a1.start_time AS start_date,a1.end_time AS end_date,
+        NULL AS TYPE,NULL AS org_name,NULL AS enroll_end_time,NULL AS cover_file_id,1 AS STATUS,
+        a1.club_activities_content AS content,3 AS category,2 AS enroll_status,
+        a1.activity_type AS type_cn, 1 AS is_enroll
+        FROM club_activities a1 WHERE a1.delete_mark = 0 AND a1.student_id IN
+        (SELECT credential_number FROM xjr_user WHERE id = #{dto.loginUserId})
+        UNION
+        SELECT a2.id, a2.moral_event_name AS NAME,a2.event_address AS place,
+        a2.event_start_time AS start_date,a2.event_end_time AS end_date,NULL AS TYPE,NULL AS org_name,NULL AS enroll_end_time,
+        NULL AS cover_file_id,1 AS status,
+        a2.event_content AS content,4 AS category,2 AS enroll_status
+        , a2.event_type AS type_cn, 1 as is_enroll
+        FROM moral_event a2 WHERE a2.delete_mark = 0 AND
+        (a2.attend_teacher like concat('%',#{dto.loginUserId},'%') OR FIND_IN_SET((
+        SELECT class_id FROM base_student_school_roll WHERE user_id = #{dto.loginUserId}
+        ),a2.attend_class) > 0
+        )
+        UNION
+        SELECT a3.id,a3.training_name AS NAME,a3.training_address AS place,a3.start_time AS start_date, a3.end_time AS end_date,
+        NULL AS TYPE,NULL AS org_name,NULL AS enroll_end_time,NULL AS cover_file_id, STATUS,
+        a3.training_topic AS content,5 AS category,2 AS enroll_status,  NULL AS type_cn, 1 as is_enroll FROM wf_teacher_training a3
+        INNER JOIN wf_teacher_training_participant a4 ON a3.id = a4.wf_teacher_training_id
+        WHERE a3.delete_mark = 0 AND a4.participant_id = #{dto.loginUserId}
+        UNION
+        SELECT id,party_tissue_name AS NAME,event_address AS place,event_start_time AS start_date, event_end_time AS end_date,event_type AS TYPE,
+        NULL AS org_name,NULL AS enroll_end_time,NULL AS cover_file_id,1 AS STATUS, event_content AS content, 6 AS category,
+        2 AS enroll_status, NULL AS type_cn, 1 as is_enroll FROM party_build_event
+        WHERE delete_mark = 0 AND (
+        participant_teacher_name LIKE CONCAT('%',#{dto.loginUserId},'%') OR participant_student_name LIKE CONCAT('%',#{dto.loginUserId},'%')
+        )
+
+        UNION
+        SELECT id,party_tissue_name AS NAME,event_address AS place,event_start_time AS start_date, event_end_time AS end_date,event_type AS TYPE,
+        NULL AS org_name,NULL AS enroll_end_time,NULL AS cover_file_id,1 AS STATUS, event_content AS content, 6 AS category,
+        2 AS enroll_status, NULL AS type_cn, 1 as is_enroll FROM party_build_event
+        WHERE delete_mark = 0 AND (
+        participant_teacher_name LIKE CONCAT('%',#{dto.loginUserId},'%') OR participant_student_name LIKE CONCAT('%',#{dto.loginUserId},'%')
+        )
+    </select>
 </mapper>

+ 75 - 0
src/main/resources/sqlScript/20240822_sql.sql

@@ -0,0 +1,75 @@
+ALTER TABLE `whitelist_management`   
+  ADD COLUMN `is_temporary` INT DEFAULT 0  NULL   COMMENT '是否临时性的(1:是 0:否)' AFTER `phone`,
+  ADD COLUMN `start_time` DATE NULL   COMMENT '临时使用开始时间' AFTER `is_temporary`,
+  ADD COLUMN `end_time` DATE NULL   COMMENT '临时使用结束时间' AFTER `start_time`;
+  
+ALTER TABLE `teaching_quality_evaluation`   
+  CHANGE `course_code` `course_code` VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL   COMMENT '课程编号',
+  CHANGE `course_type` `course_type` VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL   COMMENT '课程分类';
+
+DROP TABLE IF EXISTS `wf_overtime_long`;
+CREATE TABLE `wf_overtime_long`  (
+  `id` BIGINT NOT NULL,
+  `user_id` LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '申请人',
+  `overtime_department` VARCHAR(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '加班部门',
+  `overtime_start_time` DATETIME NULL DEFAULT NULL COMMENT '加班开始时间',
+  `overtime_end_time` DATETIME NULL DEFAULT NULL COMMENT '加班结束时间',
+  `overtime_template` LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '加班明细模板',
+  `supporting_materials` LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '加班明细附件',
+  `leader_in_charge` LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '分管领导',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = INNODB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '加班申请(长)' ROW_FORMAT = DYNAMIC; 
+
+
+DROP TABLE IF EXISTS `student_report_record`;
+CREATE TABLE `student_report_record`  (
+  `id` BIGINT NOT NULL,
+  `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
+  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
+  `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人',
+  `modify_date` DATETIME DEFAULT NULL COMMENT '修改日期',
+  `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
+  `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
+  `user_id` BIGINT DEFAULT NULL COMMENT '学生id',
+  `report_time` DATETIME DEFAULT NULL COMMENT '报到时间',
+  `base_semester_id` BIGINT DEFAULT NULL COMMENT '所属学期',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = INNODB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '学生报到记录表'; 
+
+
+ALTER TABLE  `base_new_student`   
+  ADD COLUMN `delete_reason` VARCHAR(300) NULL   COMMENT '删除原因(用于新生删除功能)' AFTER `second_ambition_id`;
+
+ALTER TABLE `material_task_appendix`   
+  CHANGE `material_task_id` `material_task_id` BIGINT NULL   COMMENT '材料提交任务分配(material_task_assign)';
+
+ALTER TABLE `course_table`   
+  CHANGE `create_date` `create_date` DATETIME NULL   COMMENT '创建时间',
+  CHANGE `modify_date` `modify_date` DATETIME NULL   COMMENT '修改时间';
+
+
+DROP TABLE IF EXISTS `base_class_dynamics`;
+CREATE TABLE `base_class_dynamics`  (
+  `id` BIGINT NOT NULL,
+  `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
+  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
+  `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人',
+  `modify_date` DATETIME DEFAULT NULL COMMENT '修改日期',
+  `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
+  `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
+  `class_id` BIGINT DEFAULT NULL COMMENT '班级id',
+  `title` VARCHAR(200) DEFAULT NULL COMMENT '标题',
+  `role_type` VARCHAR(50) DEFAULT NULL COMMENT '发送范围(学生、家长)',
+  `content` VARCHAR(1000) DEFAULT NULL COMMENT '内容',
+  `folder_id` BIGINT DEFAULT NULL COMMENT '附件',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = INNODB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '班级动态表'; 
+
+-- 2024年9月5日
+ALTER TABLE xjr_workflow_record ADD workflow_approve_type INT NOT NULL DEFAULT 4 COMMENT '工作流审批类型';
+
+ALTER TABLE xjr_workflow_form_relation ADD current_state VARCHAR(50) COMMENT '当前状态 STATE_ACTIVE-正在运行的流程实例,STATE_SUSPENDED-挂起的流程实例,STATE_COMPLETED-通过正常结束事件完成,STATE_EXTERNALLY_TERMINATED-外部终止,例如通过REST API终止,STATEINTERNALY_TERMINATED-内部终止,例如通过终止边界事件';
+
+ALTER TABLE xjr_workflow_form_relation ADD start_time DATETIME COMMENT '开始时间';
+
+ALTER TABLE xjr_workflow_form_relation ADD end_time DATETIME COMMENT '结束时间';

+ 97 - 1
src/test/java/com/xjrsoft/module/job/JianyuekbBaseDataTaskTest.java

@@ -383,7 +383,8 @@ class JianyuekbBaseDataTaskTest {
         DataUtil dataUtil = new DataUtil();
         String currenSemeter = dataUtil.getCurrenSemeter();
 
-        for (BaseClass baseClass : classMap2.values()) {
+        for (String jianyueId : classMap2.keySet()) {
+            BaseClass baseClass = classMap2.get(jianyueId);
             if(baseClass == null){
                 continue;
             }
@@ -577,4 +578,99 @@ class JianyuekbBaseDataTaskTest {
         }
         dataUtil.insertRecord("base_class", idMap);
     }
+
+
+    @Test
+    void updateClassBySemester() throws Exception {
+        DataUtil dataUtil = new DataUtil();
+        String currenSemeter = dataUtil.getCurrenSemeter();
+
+        long timestamp = System.currentTimeMillis();
+        //生成签名
+        String sign = ScheduleUtil.createSign(timestamp);
+        JsonArray semesterSerialNos = new JsonArray();
+        semesterSerialNos.add(currenSemeter);
+        JsonObject paramJson = new JsonObject();
+        paramJson.add("semesterSerialNos", semesterSerialNos);
+        paramJson.addProperty("pageSize", 200);
+        paramJson.addProperty("pageIndex", 1);
+        String url= ScheduleUtil.apiUrl + "Class/page";
+        String doPost = ScheduleUtil.doPost(url, paramJson.toString(), sign, timestamp);
+
+
+        JsonParser parser = new JsonParser();
+        JsonObject jsonObject = parser.parse(doPost).getAsJsonObject();
+        JsonArray jsonArray = jsonObject.get("data").getAsJsonObject().get("dataList").getAsJsonArray();
+        List<String> jianyueIds  = new ArrayList<>();
+        for (JsonElement jsonElement : jsonArray) {
+            JsonObject object = jsonElement.getAsJsonObject();
+            jianyueIds.add("'" + object.get("serialNo").getAsString() + "'");
+        }
+
+        DataSource datasource = DatasourceUtil.getDataSource(GlobalConstant.DEFAULT_DATASOURCE_KEY);
+        Db use = Db.use(datasource);
+        String sql = "SELECT * FROM jianyue_data WHERE table_name = 'base_class' and jianyue_id in (" + jianyueIds.toString().replace("[","").replace("]","") + ")";
+        List<JianyueData> classList = use.query(sql, JianyueData.class);
+        Map<String, String> classJianyueSourceMap = new HashMap<>();
+        for (JianyueData jianyueData : classList) {
+            classJianyueSourceMap.put(jianyueData.getJianyueId(), jianyueData.getSourceId());
+        }
+
+        url  = ScheduleUtil.apiUrl + "class/update";
+        paramJson = new JsonObject();
+        paramJson.addProperty("pageSize", 200);
+        paramJson.addProperty("pageIndex", 1);
+
+        timestamp = System.currentTimeMillis();
+        //生成签名
+        sign = ScheduleUtil.createSign(timestamp);
+
+        doPost = ScheduleUtil.doPost(url, paramJson.toString(), sign, timestamp);
+
+        sql = "SELECT * FROM base_class WHERE delete_mark = 0 and is_graduate = 1";
+        List<BaseClass> dataList = use.query(sql, BaseClass.class);
+        Map<String, BaseClass> classMap = new HashMap<>();
+        for (BaseClass baseClass : dataList) {
+            classMap.put(baseClass.getId().toString(), baseClass);
+        }
+
+        sql = "SELECT * FROM jianyue_data WHERE table_name = 'base_classroom'";
+        List<JianyueData> classroomList = use.query(sql, JianyueData.class);
+        Map<String, String> classroomMap = new HashMap<>();
+        for (JianyueData jianyueData : classroomList) {
+            classroomMap.put(jianyueData.getSourceId(), jianyueData.getJianyueId());
+        }
+
+        sql = "SELECT * FROM jianyue_data WHERE table_name = 'base_teacher'";
+        List<JianyueData> teacherList = use.query(sql, JianyueData.class);
+        Map<String, String> teacherMap = new HashMap<>();
+        for (JianyueData jianyueData : teacherList) {
+            teacherMap.put(jianyueData.getSourceId(), jianyueData.getJianyueId());
+        }
+
+        url  = ScheduleUtil.apiUrl + "class/update";
+
+
+        for (String jianyueId : classJianyueSourceMap.keySet()) {
+            BaseClass baseClass = classMap.get(classJianyueSourceMap.get(jianyueId));
+            if(baseClass == null){
+                continue;
+            }
+            paramJson = new JsonObject();
+            paramJson.addProperty("name", baseClass.getName());
+
+            paramJson.addProperty("semesterSerialNo", currenSemeter);
+            paramJson.addProperty("extendId", baseClass.getId());
+            paramJson.addProperty("classRoomSerialNo", classroomMap.get(baseClass.getClassroomId().toString()));
+            paramJson.addProperty("serialNo", jianyueId);
+            paramJson.addProperty("teacherSerialNo", teacherMap.get(baseClass.getTeacherId().toString()));
+
+            timestamp = System.currentTimeMillis();
+            //生成签名
+            sign = ScheduleUtil.createSign(timestamp);
+            String result = ScheduleUtil.doPost(url, paramJson.toString(), sign, timestamp);
+
+            System.out.println(baseClass.getName() + " -> " + result);
+        }
+    }
 }

+ 88 - 22
src/test/java/com/xjrsoft/module/job/JianyuekbScheduleTaskTest.java

@@ -2,18 +2,22 @@ package com.xjrsoft.module.job;
 
 import cn.hutool.db.Entity;
 import cn.hutool.extra.spring.SpringUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
 import com.xjrsoft.XjrSoftApplication;
 import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
+import com.xjrsoft.module.base.entity.BaseClass;
+import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.schedule.entity.CourseReceiveMsg;
 import com.xjrsoft.module.schedule.util.DataUtil;
 import com.xjrsoft.module.schedule.util.ScheduleUtil;
 import org.camunda.bpm.engine.impl.util.JsonUtil;
 import org.junit.jupiter.api.Test;
 import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
@@ -28,6 +32,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * @author dzx
@@ -37,26 +42,49 @@ import java.util.Set;
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = XjrSoftApplication.class)
 class JianyuekbScheduleTaskTest {
-
+    @Autowired
+    private IBaseClassService classService;
     @Test
     public void RefreshConnectionPool() throws Exception {
         String active = SpringUtil.getActiveProfile();
-        if(!"prod".equals(active)){
-            return;
-        }
-        String sql = "SELECT * FROM course_receive_msg WHERE delete_mark = 0 AND id in (1821034023531098114,1821034021123567617)";
+        String sql = "SELECT * FROM course_receive_msg WHERE delete_mark = 0 AND is_callback IS NULL";
         List<Map<String, Object>> receiveMsgs = SqlRunnerAdapter.db().selectList(sql, CourseReceiveMsg.class);
         JsonArray allScheduleInfo = new JsonArray();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         DataUtil dataUtil = new DataUtil();
+
+        List<String> eduYearSerialNo1 = receiveMsgs.stream().map(x -> "'" + x.get("edu_year_serial_no").toString() + "'").collect(Collectors.toList());
+
+        //查询出传入排课系统的年级和班级
+        sql = "SELECT * FROM jianyue_data WHERE source_id IS NOT NULL AND jianyue_id != ''" +
+                " and table_name = 'base_grade'" +
+                " and jianyue_id in (" + eduYearSerialNo1.toString().replace("[","").replace("]","") + ")";
+        List<Map<String, Object>> jianyueData = SqlRunnerAdapter.db().selectList(sql);
+        Map<String, List<Long>> gradeClassMaps = new HashMap<>();//存入对应年级的所有班级id
+        for (Map<String, Object> el : jianyueData) {
+            String gradeId = el.get("source_id").toString().split("_")[1];
+            List<BaseClass> classList = classService.list(new QueryWrapper<BaseClass>().lambda().eq(BaseClass::getGradeId, gradeId));
+            List<Long> classIds = classList.stream().map(BaseClass::getId).collect(Collectors.toList());
+
+            gradeClassMaps.put(el.get("jianyue_id").toString(), classIds);
+        }
+
+
         for (Map<String, Object> receiveMsg : receiveMsgs) {
             String updSql = "update course_receive_msg set is_callback = 0 where id = " + receiveMsg.get("id").toString();
             SqlRunnerAdapter.db().update(updSql);
 
             String eduYearSerialNo = receiveMsg.get("edu_year_serial_no").toString();
+            String startDateStr = receiveMsg.get("start_date").toString();
+            String endDateStr = receiveMsg.get("end_date").toString();
+            //删除课表信息
+            String delSql = "delete from course_table where schedule_date between '" + startDateStr + "'" +
+                    " and '" + endDateStr + "'" +
+                    " and class_id in (" + gradeClassMaps.get(eduYearSerialNo).toString().replace("[","").replace("]","")+ ")";
+            SqlRunnerAdapter.db().delete(delSql);
 
-            LocalDate startDateObj = LocalDate.parse(receiveMsg.get("start_date").toString());
-            LocalDate endDateObj = LocalDate.parse(receiveMsg.get("end_date").toString());
+            LocalDate startDateObj = LocalDate.parse(startDateStr);
+            LocalDate endDateObj = LocalDate.parse(endDateStr);
             long between = ChronoUnit.DAYS.between(startDateObj, endDateObj);
             int times = Integer.parseInt(((between / 7) + 1) + "");
 
@@ -77,21 +105,7 @@ class JianyuekbScheduleTaskTest {
             updSql = "update course_receive_msg set is_callback = 1 where id = " + receiveMsg.get("id").toString();
             SqlRunnerAdapter.db().update(updSql);
         }
-        doExecute(allScheduleInfo);
-//        Map<String, JsonObject> infoMap = new HashMap<>();
-//        Map<Integer, Integer> tmePeriod = ScheduleUtil.getTmePeriod();
-//        for (JsonElement jsonElement : allScheduleInfo) {
-//            JsonObject asJsonObject = jsonElement.getAsJsonObject();
-//            String numberOfDayName = asJsonObject.get("numberOfDayName").getAsString();
-//            JsonObject json = new JsonObject();
-//            json.add("startTime", asJsonObject.get("startTime"));
-//            json.add("endTime", asJsonObject.get("endTime"));
-//            json.addProperty("tmePeriod", tmePeriod.get(asJsonObject.get("timeOption").getAsInt()));
-//            json.add("numberOfDay", asJsonObject.get("numberOfDay"));
-//            infoMap.put(numberOfDayName, json);
-//        }
-//        System.out.println(JsonUtil.asString(infoMap));
-
+//        doExecute(allScheduleInfo);
     }
 
     void doExecute(JsonArray scheduleInfo){
@@ -189,4 +203,56 @@ class JianyuekbScheduleTaskTest {
         SqlRunnerAdapter.db().dynamicInsertBatch(tableName, insertList);
 
     }
+
+
+    @Test
+    void updateClass2() throws Exception {
+        String url  = ScheduleUtil.apiUrl + "Class/page";
+        JsonObject pageJson = new JsonObject();
+        pageJson.addProperty("pageSize", 200);
+        pageJson.addProperty("pageIndex", 1);
+        JsonParser parser = new JsonParser();
+
+        long timestamp = System.currentTimeMillis();
+        String sign = ScheduleUtil.createSign(timestamp);
+
+        String doPost = ScheduleUtil.doPost(url, pageJson.toString(), sign, timestamp);
+        System.out.println(doPost);
+        JsonArray dataList = parser.parse(doPost).getAsJsonObject().get("data").getAsJsonObject().get("dataList").getAsJsonArray();
+        String sql = "select * from base_class where delete_mark = 0";
+        List<Map<String, Object>> classList = SqlRunnerAdapter.db().selectList(sql);
+        Map<String, Long> classMap = new HashMap<>();
+        for (Map<String, Object> objectMap : classList) {
+            classMap.put(objectMap.get("name").toString(), (Long)objectMap.get("id"));
+        }
+
+        sql = "select * from jianyue_data where table_name = 'base_class'";
+        List<Map<String, Object>> classList2 = SqlRunnerAdapter.db().selectList(sql);
+        Set<String> sourceIds = new HashSet<>();
+        for (Map<String, Object> objectMap : classList2) {
+            sourceIds.add(objectMap.get("jianyue_id").toString());
+        }
+
+        String tableName = "jianyue_data";
+        List<Entity> insertList = new ArrayList<>();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        for (JsonElement jsonElement : dataList) {
+            JsonObject object = jsonElement.getAsJsonObject();
+            String serialNo = object.get("serialNo").getAsString();
+            if(sourceIds.contains(serialNo)){
+                continue;
+            }
+            if(classMap.get(object.get("name").getAsString()) == null){
+                continue;
+            }
+            Entity entity = Entity.create(tableName);
+            entity.set("create_date", sdf.format(new Date()));
+            entity.set("table_name", "base_class");
+            entity.set("source_id", classMap.get(object.get("name").getAsString()));
+            entity.set("jianyue_id", serialNo);
+            insertList.add(entity);
+        }
+        SqlRunnerAdapter.db().dynamicInsertBatch(tableName, insertList);
+
+    }
 }