Browse Source

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

大数据与最优化研究所 2 weeks ago
parent
commit
b0f219a43b

+ 25 - 17
src/main/java/com/xjrsoft/module/job/JianyuekbScheduleTask.java

@@ -26,7 +26,9 @@ import com.xjrsoft.module.courseTable.entity.CourseTable;
 import com.xjrsoft.module.courseTable.service.ICourseTableService;
 import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
 import com.xjrsoft.module.organization.entity.Department;
+import com.xjrsoft.module.organization.entity.Role;
 import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.organization.entity.UserRoleRelation;
 import com.xjrsoft.module.organization.service.IDepartmentService;
 import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.organization.service.IWeChatService;
@@ -138,10 +140,10 @@ public class JianyuekbScheduleTask {
 
     public void doExecute() {
         String active = SpringUtil.getActiveProfile();
-//        if(!"prod".equals(active)){
-//            log.info("非正式环境,无法执行获取课表数据");
-//            return;
-//        }
+        if(!"prod".equals(active)){
+            log.info("非正式环境,无法执行获取课表数据");
+            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);
         if (receiveMsgs.isEmpty()) {
@@ -176,7 +178,7 @@ public class JianyuekbScheduleTask {
         LocalDate today = LocalDate.now();
 
         DataUtil dataUtil = new DataUtil();
-        Set<String> ongoing = redisUtil.get(taskKey, new TypeReference<Set<String>>() {
+        Set<String> ongoing = redisUtil.get(taskKey, new TypeReference<>() {
         });//正在进行中的
         if (ongoing == null) {
             ongoing = new HashSet<>();
@@ -185,7 +187,6 @@ public class JianyuekbScheduleTask {
         Map<String, Map<String, String>> dataMap = initDataMap();
         for (Map<String, Object> receiveMsg : receiveMsgs) {
             String eduYearSerialNo = receiveMsg.get("edu_year_serial_no").toString();
-            Long courseReceiveMsgId = Long.parseLong(receiveMsg.get("id").toString());
             if (ongoing.contains(eduYearSerialNo)) {
                 continue;
             }
@@ -239,7 +240,7 @@ public class JianyuekbScheduleTask {
 
                 ongoing.remove(eduYearSerialNo);
                 redisUtil.set(taskKey, ongoing);
-                insertCourse(allScheduleInfo, dataMap, dataUtil, courseReceiveMsgId, startDateStr, endDateStr);
+                insertCourse(allScheduleInfo, dataMap, dataUtil, receiveMsg, startDateStr, endDateStr);
                 //恢复挂起的流程
                 restoreCourseAdjust(processIds);
                 //处理该日期内已经审批通过的调课和顶课申请
@@ -253,7 +254,7 @@ public class JianyuekbScheduleTask {
         }
     }
 
-    void insertCourse(JsonArray scheduleInfo, Map<String, Map<String, String>> dataMap, DataUtil dataUtil, Long courseReceiveMsgId, String startDate, String endDate) {
+    void insertCourse(JsonArray scheduleInfo, Map<String, Map<String, String>> dataMap, DataUtil dataUtil, Map<String, Object> receiveMsg, String startDate, String endDate) {
         //获取年级
         String tableName = "base_grade";
 //            Map<String, Long> gradeMap = dataMap.get(tableName);
@@ -274,27 +275,34 @@ public class JianyuekbScheduleTask {
         Map<String, String> classroomMap = dataMap.get(tableName);
 
         Set<String> techerIds = dataUtil.insertCourseTableEntiy(scheduleInfo, classroomMap, courseMap, semesterMap,
-                teacherMap, classMap, courseReceiveMsgId, startDate, endDate);
-        sendMsg(techerIds, courseReceiveMsgId);
+                teacherMap, classMap, receiveMsg.get("id").toString(), startDate, endDate);
+        sendMsg(techerIds, receiveMsg);
         dataUtil.insertClassTime(scheduleInfo);
     }
 
-    void sendMsg(Set<String> techerIds, Long courseReceiveMsgId) {
-        ActiveSpan.tag("params[ JianyuekbScheduleTaskSendMsg ]", "sendMsg");
+    void sendMsg(Set<String> techerIds, Map<String, Object> receiveMsg) {
         try {
-            CourseReceiveMsg receiveMsg = receiveMsgService.getById(courseReceiveMsgId);
             JianyueData jianyueData = jianyueDataService.getOne(
                     new QueryWrapper<JianyueData>().lambda()
-                            .eq(JianyueData::getJianyueId, receiveMsg.getEduYearSerialNo())
+                            .eq(JianyueData::getJianyueId, receiveMsg.get("edu_year_serial_no").toString())
             );
             String[] sourceId = jianyueData.getSourceId().split("_");
             Department department = departmentService.getById(sourceId[0]);
 
             BaseGrade grade = gradeService.getById(sourceId[1]);
-
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             //通知对应教师
             List<User> userList = userService.listByIds(new ArrayList<>(techerIds));
+            List<User> userList1 = userService.list(
+                    new MPJLambdaWrapper<User>()
+                            .distinct()
+                            .select(User::getId)
+                            .select(User.class, x -> VoToColumnUtil.fieldsToColumns(User.class).contains(x.getProperty()))
+                            .innerJoin(UserRoleRelation.class, UserRoleRelation::getUserId, User::getId)
+                            .innerJoin(Role.class, Role::getId, UserRoleRelation::getRoleId)
+                            .eq(Role::getCode, "KEBIAOGX")
+            );
+            userList.addAll(userList1);
+
             for (User user : userList) {
                 WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
                 weChatSendMessageDto.setTemplateId(noticeTeacherTemplate);
@@ -313,7 +321,7 @@ public class JianyuekbScheduleTask {
                 paramJson.put("thing6", thing6);
 
                 JSONObject time3 = new JSONObject();
-                time3.put("value", sdf.format(receiveMsg.getCreateDate()));
+                time3.put("value", receiveMsg.get("create_date").toString());
                 paramJson.put("time3", time3);
 
                 weChatSendMessageDto.setContent(paramJson);

+ 6 - 0
src/main/java/com/xjrsoft/module/liteflow/node/StudentDropOutNode.java

@@ -7,6 +7,7 @@ import com.xjrsoft.common.enums.ArchivesStatusEnum;
 import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.StudentChangeTypeEnum;
 import com.xjrsoft.common.enums.WorkflowApproveType;
+import com.xjrsoft.module.room.mapper.RoomBedMapper;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.entity.StudentDropOut;
 import com.xjrsoft.module.student.mapper.StudentDropOutMapper;
@@ -47,6 +48,9 @@ public class StudentDropOutNode extends NodeComponent {
     @Autowired
     private IStudentChangeRecordService changeRecordService;
 
+    @Autowired
+    private RoomBedMapper roomBedMapper;
+
 
     @Override
     public void process() throws Exception {
@@ -96,6 +100,8 @@ public class StudentDropOutNode extends NodeComponent {
                                         .eq(BaseStudentSchoolRoll::getUserId, studentDropOut.getStudentUserId())
                                         .eq(BaseStudentSchoolRoll::getDeleteMark, DeleteMark.NODELETE.getCode())
                         );
+                        //清除床位信息
+                        roomBedMapper.clearBedInfoByStudentUserId(studentDropOut.getStudentUserId(), studentDropOut.getCreateUserId());
                         if(schoolRoll != null){
                             //记录异动
                             changeRecordService.insertData(

+ 7 - 1
src/main/java/com/xjrsoft/module/liteflow/node/WfRoomApplicantNode.java

@@ -10,6 +10,7 @@ import com.xjrsoft.module.hikvision.entity.HikvisionData;
 import com.xjrsoft.module.hikvision.mapper.HikvisionDataMapper;
 import com.xjrsoft.module.hikvision.util.DataUtil;
 import com.xjrsoft.module.room.entity.WfRoomApplicant;
+import com.xjrsoft.module.room.mapper.RoomBedMapper;
 import com.xjrsoft.module.room.service.IWfRoomApplicantService;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
@@ -48,7 +49,8 @@ public class WfRoomApplicantNode extends NodeComponent {
     private WorkflowRecordMapper workflowRecordMapper;
     @Autowired
     private IStudentChangeRecordService changeRecordService;
-
+    @Autowired
+    private RoomBedMapper roomBedMapper;
 
     @Override
     public void process() throws Exception {
@@ -102,6 +104,8 @@ public class WfRoomApplicantNode extends NodeComponent {
                             schoolRoll.setStduyStatus(StudyStatusEnum.InResidence.getCode());
                         } else if (RoomApplicantTypeEnum.ToBeDayPupil.getCode().equals(wfRoomApplicant.getRecedeType())) {
                             schoolRoll.setStduyStatus(StudyStatusEnum.AttendDaySchool.getCode());
+                            //清除床位信息
+                            roomBedMapper.clearBedInfoByStudentUserId(wfRoomApplicant.getApplicantUserId(), wfRoomApplicant.getCreateUserId());
                         }
                         //修改学生班级
                         studentSchoolRollService.updateById(schoolRoll);
@@ -117,6 +121,8 @@ public class WfRoomApplicantNode extends NodeComponent {
                             throw new RuntimeException(e);
                         }
                         //wfRoomApplicantService.noticeParents(formId);
+
+
                     });
                 }
             });

+ 30 - 6
src/main/java/com/xjrsoft/module/material/controller/MaterialTaskController.java

@@ -10,6 +10,7 @@ import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.annotation.XjrLog;
+import com.xjrsoft.common.constant.GlobalConstant;
 import com.xjrsoft.common.model.result.R;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
@@ -18,14 +19,29 @@ import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.app.dto.UpdateEnableMarkDto;
 import com.xjrsoft.module.form.dto.FormExecuteInfoDto;
 import com.xjrsoft.module.form.service.IFormExecuteService;
-import com.xjrsoft.module.material.dto.*;
+import com.xjrsoft.module.material.dto.AddMaterialTaskAssignDto;
+import com.xjrsoft.module.material.dto.AddMaterialTaskDto;
+import com.xjrsoft.module.material.dto.FormDataExportQueryDto;
+import com.xjrsoft.module.material.dto.MaterialTaskAssignAppendixDto;
+import com.xjrsoft.module.material.dto.MaterialTaskAssignApprovedDto;
+import com.xjrsoft.module.material.dto.MaterialTaskAssignListDto;
+import com.xjrsoft.module.material.dto.MaterialTaskAssignPageDto;
+import com.xjrsoft.module.material.dto.MaterialTaskPageDto;
+import com.xjrsoft.module.material.dto.MaterialTaskWaitPageDto;
+import com.xjrsoft.module.material.dto.UpdateMaterialTaskDto;
+import com.xjrsoft.module.material.dto.ViewContentDto;
 import com.xjrsoft.module.material.entity.MaterialTask;
 import com.xjrsoft.module.material.entity.MaterialTaskAssign;
 import com.xjrsoft.module.material.entity.MaterialType;
 import com.xjrsoft.module.material.entity.MaterialTypeAssign;
 import com.xjrsoft.module.material.service.IMaterialTaskAssignService;
 import com.xjrsoft.module.material.service.IMaterialTaskService;
-import com.xjrsoft.module.material.vo.*;
+import com.xjrsoft.module.material.vo.MaterialTaskAssignListVo;
+import com.xjrsoft.module.material.vo.MaterialTaskAssignVo;
+import com.xjrsoft.module.material.vo.MaterialTaskExcelVo;
+import com.xjrsoft.module.material.vo.MaterialTaskPageVo;
+import com.xjrsoft.module.material.vo.MaterialTaskVo;
+import com.xjrsoft.module.material.vo.MaterialTaskWaitPageVo;
 import com.xjrsoft.module.organization.entity.Department;
 import com.xjrsoft.module.organization.entity.UserDeptRelation;
 import com.xjrsoft.module.teacher.entity.XjrUser;
@@ -33,7 +49,14 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
+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.multipart.MultipartFile;
 
 import javax.validation.Valid;
@@ -64,7 +87,7 @@ public class MaterialTaskController {
     @SaCheckPermission("materialtask:detail")
     @XjrLog(value = "材料提交任务列表(分页 我发布的)")
     public RT<PageOutput<MaterialTaskPageVo>> page(@Valid MaterialTaskPageDto dto) {
-
+        List<Long> roleIds = StpUtil.getTokenSession().get(GlobalConstant.LOGIN_USER_ROLE_ID_KEY, new ArrayList<>());
         MPJLambdaWrapper<MaterialTask> queryWrapper = new MPJLambdaWrapper<>();
         queryWrapper
                 .orderByDesc(MaterialTask::getId)
@@ -72,8 +95,9 @@ public class MaterialTaskController {
                 .like(StrUtil.isNotBlank(dto.getName()), MaterialTask::getName, dto.getName())
                 .eq((ObjectUtil.isNotEmpty(dto.getMaterialTypeId())) && dto.getMaterialTypeId() > 0, MaterialTask::getMaterialTypeId, dto.getMaterialTypeId())
                 .eq((ObjectUtil.isNotEmpty(dto.getStatus())) && dto.getStatus() > 0, MaterialTask::getStatus, dto.getStatus())
-                .gt(dto.getCreateDateStart() != null && !dto.getCreateDateStart().equals(""), MaterialTask::getCreateDate, dto.getCreateDateStart())
-                .lt(dto.getCreateDateEnd() != null && !dto.getCreateDateEnd().equals(""), MaterialTask::getCreateDate, dto.getCreateDateEnd())
+                .eq(!roleIds.contains(GlobalConstant.SUPER_ADMIN_ROLE_ID), MaterialType::getCreateUserId, StpUtil.getLoginIdAsLong())
+                .gt(dto.getCreateDateStart() != null, MaterialTask::getCreateDate, dto.getCreateDateStart())
+                .lt(dto.getCreateDateEnd() != null, MaterialTask::getCreateDate, dto.getCreateDateEnd())
                 .select(MaterialTask::getId)
                 .selectAs(MaterialType::getName, MaterialTaskPageVo::getMaterialTypeIdCn)
                 .selectAs(MaterialType::getCreateDate, MaterialTaskPageVo::getCreateDate)

+ 5 - 0
src/main/java/com/xjrsoft/module/material/service/impl/MaterialTypeServiceImpl.java

@@ -1,5 +1,6 @@
 package com.xjrsoft.module.material.service.impl;
 
+import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -7,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.constant.GlobalConstant;
 import com.xjrsoft.common.enums.MaterialCategoryEnum;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
@@ -29,6 +31,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -107,11 +110,13 @@ public class MaterialTypeServiceImpl extends MPJBaseServiceImpl<MaterialTypeMapp
 
     @Override
     public PageOutput<MaterialTypePageVo> getPage(MaterialTypePageDto dto) {
+        List<Long> roleIds = StpUtil.getTokenSession().get(GlobalConstant.LOGIN_USER_ROLE_ID_KEY, new ArrayList<>());
         LambdaQueryWrapper<MaterialType> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper
                 .orderByDesc(MaterialType::getId)
                 .select(MaterialType.class, x -> VoToColumnUtil.fieldsToColumns(MaterialTypePageVo.class).contains(x.getProperty()))
                 .like(dto.getName() != null && !dto.getName().equals(""), MaterialType::getName, dto.getName())
+                .eq(!roleIds.contains(GlobalConstant.SUPER_ADMIN_ROLE_ID), MaterialType::getCreateUserId, StpUtil.getLoginIdAsLong())
                 .eq(dto.getMaterialCategory() != null && !dto.getMaterialCategory().equals(""), MaterialType::getMaterialCategory, dto.getMaterialCategory());
         IPage<MaterialType> page = this.page(ConventPage.getPage(dto), queryWrapper);
         PageOutput<MaterialTypePageVo> pageOutput = ConventPage.getPageOutput(page, MaterialTypePageVo.class);

+ 3 - 0
src/main/java/com/xjrsoft/module/room/dto/RoomBedPageDto.java

@@ -42,4 +42,7 @@ public class RoomBedPageDto extends PageInput {
 
     @ApiModelProperty("入住身份")
     public String identity;
+
+    @ApiModelProperty("床位号")
+    public String bedNumber;
 }

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

@@ -625,7 +625,7 @@ public class DataUtil {
 
             String sql = "INSERT INTO course_table(id,base_semester_id,teacher_id,teacher_name,teacher_serial_no,course_id,course_name," +
                     "class_id, class_name,weeks,weeks_cn,time_period,time_number,site_id,site_name,status," +
-                    "create_date,schedule_date,jianyue_id) select " + id + String.format("%04d", count) + ","
+                    "create_date,schedule_date,jianyue_id, start_time, end_time) select " + id + String.format("%04d", count) + ","
                     + semesterMap.get(asJsonObject.get("semesterSerialNo").getAsString()) + ",";
             if (teachers.size() > 0) {
                 JsonObject teacherJson = teachers.get(0).getAsJsonObject();
@@ -647,8 +647,8 @@ public class DataUtil {
                     + (classroomMap.get(asJsonObject.get("classRoomSerialNo").getAsString()) == null ? 0 : classroomMap.get(asJsonObject.get("classRoomSerialNo").getAsString())) + ","
                     + "'" + asJsonObject.get("classRoomName").getAsString() + "',1,now(),"
                     + "'" + asJsonObject.get("scheduleDate").getAsString() + "',"
-                    + "'" + asJsonObject.get("id").getAsString() + "' FROM DUAL"
-                    + " WHERE NOT EXISTS(SELECT * FROM course_table WHERE jianyue_id = '" + asJsonObject.get("id").getAsString() + "' and status = 1)";
+                    + "'" + asJsonObject.get("id").getAsString() + "', '" + asJsonObject.get("startTime").getAsString() + "', '" + asJsonObject.get("endTime").getAsString() +"' FROM DUAL"
+                    + " WHERE NOT EXISTS(SELECT 1 FROM course_table WHERE jianyue_id = '" + asJsonObject.get("id").getAsString() + "' and status = 1)";
 //            sqls.add(updateSql);
 //            sqls.add(sql);
             SqlRunnerAdapter.db().insert(sql);
@@ -658,7 +658,7 @@ public class DataUtil {
 
     public Set<String> insertCourseTableEntiy(JsonArray data, Map<String, String> classroomMap, Map<String, String> coureseMap,
                                               Map<String, String> semesterMap, Map<String, String> teacherMap, Map<String, String> classMap
-            , Long courseReceiveMsgId, String startDate, String endDate) {
+            , String courseReceiveMsgId, String startDate, String endDate) {
         String sql = "SELECT jianyue_id FROM course_table" +
                 " where schedule_date between '" + startDate + "' and '" + endDate + "'";
         List<Map<String, Object>> oldDataList = SqlRunnerAdapter.db().selectList(sql);

+ 3 - 0
src/main/resources/mapper/room/RoomBedMapper.xml

@@ -42,6 +42,9 @@
         <if test="dto.identity != null and dto.identity != ''">
             and t2.check_in_status like concat('%',#{dto.identity},'%')
         </if>
+        <if test="dto.bedNumber != null and dto.bedNumber != ''">
+            and t1.bed_number like concat('%',#{dto.bedNumber},'%')
+        </if>
         ORDER BY t1.sort_code
     </select>