Przeglądaj źródła

食堂评价消息通知调整

dzx 11 miesięcy temu
rodzic
commit
921ac048da

+ 33 - 11
src/main/java/com/xjrsoft/module/assessment/service/impl/AssessmentTemplatePlanServiceImpl.java

@@ -10,6 +10,7 @@ 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.ArchivesStatusEnum;
 import com.xjrsoft.common.enums.AssessQuestionTypeEnum;
 import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.utils.VoToColumnUtil;
@@ -551,33 +552,54 @@ public class AssessmentTemplatePlanServiceImpl extends MPJBaseServiceImpl<Assess
 
     @Override
     public Boolean sendMsg(AssessmentTemplatePlanSureDto dto) {
+        Long teacherId = null;
+        List<String> roleList = StpUtil.getRoleList();
+        if(roleList.size() == 2 && roleList.contains("TEACHER") && roleList.contains("CLASSTE")){
+            teacherId = StpUtil.getLoginIdAsLong();
+        }
         //先查询班上的所有学生
         MPJLambdaWrapper<XjrUser> queryWrapper = new MPJLambdaWrapper<>();
         queryWrapper
                 .select(XjrUser.class, x -> VoToColumnUtil.fieldsToColumns(XjrUser.class).contains(x.getProperty()))
                 .innerJoin(AssessmentPlanAnswerStudent.class, AssessmentPlanAnswerStudent::getStudentUserId,XjrUser::getId)
                 .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId,XjrUser::getId)
-                .eq(BaseStudentSchoolRoll::getClassId , dto.getClassId())
-                .eq(AssessmentPlanAnswerStudent::getAssessmentTemplatePlanId , dto.getId())
+                .innerJoin(BaseClass.class, BaseClass::getId, BaseStudentSchoolRoll::getClassId)
+                .eq(BaseStudentSchoolRoll::getClassId, dto.getClassId())
+                .eq(AssessmentPlanAnswerStudent::getAssessmentTemplatePlanId, dto.getId())
+                .eq(teacherId != null, BaseClass::getTeacherId, teacherId)
+                .eq(BaseStudentSchoolRoll::getArchivesStatus, ArchivesStatusEnum.FB2901.getCode())
                 .disableSubLogicDel();
         List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class, queryWrapper);
         AssessmentTemplatePlan templatePlan = templatePlanMapper.selectById(dto.getId());
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String templateId = "sHsmz7LRj7HLd7GSTS3r2jCLvK-4Wp19iGzEvYK8n_I";
         for (XjrUser user : userList) {
             WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
             weChatSendMessageDto.setUserId(user.getOpenId());
 
-            weChatSendMessageDto.setTemplateId(weChatUtil.getAssessmentTemplate());
+            weChatSendMessageDto.setTemplateId(templateId);
             weChatSendMessageDto.setUrl(StrUtil.format("{}/pages/student/canteen/evaluate?id={}", commonPropertiesConfig.getDomainApp(), dto.getId()));
             weChatSendMessageDto.setMsgId(dto.getId().toString());
 
-            JSONObject data = new JSONObject();
-            data.put("thing1.DATA", templatePlan.getName());
-            data.put("time2.DATA", sdf.format(templatePlan.getStartTime()));
-            data.put("time3.DATA", sdf.format(templatePlan.getEndTime()));
-            data.put("thing5.DATA", "test");
-            data.put("thing8.DATA", "test");
-            weChatSendMessageDto.setContent(data);
+            JSONObject paramJson = new JSONObject();
+
+            JSONObject thing8 = new JSONObject();
+            thing8.put("value", "食堂评价");
+            paramJson.put("thing8", thing8);
+
+            JSONObject thing2 = new JSONObject();
+            thing2.put("value", templatePlan.getName());
+            paramJson.put("thing2", thing2);
+
+            JSONObject thing6 = new JSONObject();
+            thing6.put("value", "重庆市铜梁职业教育中心");
+            paramJson.put("thing6", thing6);
+
+            JSONObject time3 = new JSONObject();
+            time3.put("value", sdf.format(templatePlan.getStartTime()));
+            paramJson.put("time3", time3);
+
+            weChatSendMessageDto.setContent(paramJson);
             weChatService.sendTemplateMessage(weChatSendMessageDto);
         }
         return true;

+ 5 - 0
src/main/java/com/xjrsoft/module/student/controller/BaseStudentAssessmentInspectionController.java

@@ -1,6 +1,7 @@
 package com.xjrsoft.module.student.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
 import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -56,6 +57,10 @@ public class BaseStudentAssessmentInspectionController {
     @ApiOperation(value = "学生班级巡查考核列表(分页)")
     @SaCheckPermission("basestudentassessmentinspection:detail")
     public RT<PageOutput<BaseStudentAssessmentInspectionPageVo>> page(@Valid BaseStudentAssessmentInspectionPageDto dto) {
+        List<String> roleList = StpUtil.getRoleList();
+        if(roleList.size() == 2 && roleList.contains("TEACHER") && roleList.contains("CLASSTE")){
+            dto.setTeacherId(StpUtil.getLoginIdAsLong());
+        }
         Page<BaseStudentAssessmentInspectionPageVo> page = inspectionService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
         return RT.ok(ConventPage.getPageOutput(page, BaseStudentAssessmentInspectionPageVo.class));
     }

+ 3 - 0
src/main/java/com/xjrsoft/module/student/dto/BaseStudentAssessmentInspectionPageDto.java

@@ -39,4 +39,7 @@ public class BaseStudentAssessmentInspectionPageDto extends PageInput {
 
     @ApiModelProperty("考核对象")
     private String assessmentType;
+
+    @ApiModelProperty("教师id")
+    private Long teacherId;
 }

+ 5 - 1
src/main/resources/mapper/student/BaseStudentAssessmentInspectionMapper.xml

@@ -19,7 +19,8 @@
         LEFT JOIN base_grade t4 ON t.grade_id = t4.id
         LEFT JOIN xjr_user t5 ON t.assessment_user_id = t5.id
         LEFT JOIN xjr_dictionary_detail t6 ON t6.code= t.score_type
-        WHERE  t.delete_mark = 0 AND t1.delete_mark = 0  AND t2.delete_mark = 0
+        LEFT JOIN base_class t7 ON t7.id = CAST(t.class_ids AS SIGNED)
+        WHERE  t.delete_mark = 0 AND t.delete_mark = 0  AND t2.delete_mark = 0
         <if test="dto.projectIds != null">
             and t.base_student_assessment_category_id = #{dto.projectIds}
         </if>
@@ -41,6 +42,9 @@
         <if test="dto.assessmentType != null and dto.assessmentType != ''">
             and t.assessment_type like concat('%',#{dto.assessmentType},'%')
         </if>
+        <if test="dto.teacherId != null">
+            and t7.teacher_id = #{dto.teacherId}
+        </if>
     </select>
 
     <select id="getInfo" resultType="com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionVo">