Kaynağa Gözat

学生请假通知家长

dzx 6 ay önce
ebeveyn
işleme
6b83c39dac

+ 1 - 0
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskServiceImpl.java

@@ -593,6 +593,7 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
                     setOrgId(majorDeptMap.get(taskClass.getMajorSetId()));
                     setCode(gradeCode + String.format("%03d", finalMaxCode));
                     setMajorSetId(taskClass.getMajorSetId());
+                    setCreateDate(new Date());
                 }};
 
                 classService.save(baseClass);

+ 3 - 0
src/main/java/com/xjrsoft/module/student/mapper/BaseStudentSchoolRollMapper.java

@@ -48,5 +48,8 @@ public interface BaseStudentSchoolRollMapper extends MPJBaseMapper<BaseStudentSc
     @Update("UPDATE base_student_school_roll SET class_id = #{classId} where user_id = #{userId}")
     Boolean updateStudentClass(Long classId, Long userId);
 
+
+    String getClassNameByUserId(@Param("userId") Long userId);
+
 }
 

+ 3 - 0
src/main/java/com/xjrsoft/module/student/service/IBaseStudentSchoolRollService.java

@@ -12,6 +12,7 @@ import com.xjrsoft.module.student.vo.BaseStudentInfoPageDataVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
 import com.xjrsoft.module.student.vo.BaseStudentSompleInfoVo;
 import com.xjrsoft.module.student.vo.MobileClassStatisticsVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -51,4 +52,6 @@ public interface IBaseStudentSchoolRollService extends MPJBaseService<BaseStuden
     Boolean updateStudentClass(Long classId, Long userId);
 
     List<BaseStudentSompleInfoVo> getInfosByParam(BaseStudentSimpleInfoDto dto);
+
+    String getClassNameByUserId(Long userId);
 }

+ 4 - 0
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentSchoolRollServiceImpl.java

@@ -207,4 +207,8 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
         List<BaseStudentSompleInfoVo> userList = userMapper.getInfosByParam(dto);
         return userList;
     }
+
+    public String getClassNameByUserId(Long userId){
+        return baseStudentSchoolRollMapper.getClassNameByUserId(userId);
+    }
 }

+ 15 - 11
src/main/java/com/xjrsoft/module/student/service/impl/StudentLeaveServiceImpl.java

@@ -24,6 +24,7 @@ import com.xjrsoft.module.outint.vo.IdCountVo;
 import com.xjrsoft.module.student.dto.StudentLeavePageDto;
 import com.xjrsoft.module.student.entity.StudentLeave;
 import com.xjrsoft.module.student.mapper.StudentLeaveMapper;
+import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
 import com.xjrsoft.module.student.service.IStudentLeaveService;
 import com.xjrsoft.module.student.vo.StudentLeavePageVo;
 import lombok.AllArgsConstructor;
@@ -49,6 +50,7 @@ public class StudentLeaveServiceImpl extends MPJBaseServiceImpl<StudentLeaveMapp
     private final HikvisionDataMapper hikvisionDataMapper;
     private final IUserService userService;
     private final IWeChatService weChatService;
+    private final IBaseStudentSchoolRollService rollService;
 
     @Override
     public Boolean hikvisionLeave(Long id) {
@@ -142,12 +144,13 @@ public class StudentLeaveServiceImpl extends MPJBaseServiceImpl<StudentLeaveMapp
                         .isNotNull(User::getOpenId)
         );
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
-        SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
+        SimpleDateFormat sdf = new SimpleDateFormat("yyy年MM月dd日 HH:mm");
         String endDate = studentLeave.getEndDate().format(formatter);
         String startDate = studentLeave.getStartDate().format(formatter);
 
         User student = userService.getById(studentLeave.getStudentUserId());
-        String wechatTemplate = "sHsmz7LRj7HLd7GSTS3r2jCLvK-4Wp19iGzEvYK8n_I";
+        String className = rollService.getClassNameByUserId(studentLeave.getStudentUserId());
+        String wechatTemplate = "sCZ8W7j9-y8gaFzQSZwObjwGTaf4-9vVnIg6A18LUeE";
         for (User user : list) {
             WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
             weChatSendMessageDto.setUserId(user.getOpenId());
@@ -156,28 +159,29 @@ public class StudentLeaveServiceImpl extends MPJBaseServiceImpl<StudentLeaveMapp
 
             JSONObject data = new JSONObject();
             // 任务名称
-            data.put("thing8", new JSONObject() {{
-                put("value", "学生请假");
+            data.put("thing4", new JSONObject() {{
+                put("value", studentLeave.getReason());
             }});
             // 事项名称
-            data.put("thing2", new JSONObject() {{
-                put("value", "请假时间:" + startDate + "~" + endDate);
+            data.put("time1", new JSONObject() {{
+                put("value", startDate + "~" + endDate);
             }});
             // 申请人
-            data.put("thing6", new JSONObject() {{
+            data.put("short_thing3", new JSONObject() {{
                 put("value", student.getName());
             }});
             // 时间
-            data.put("time3", new JSONObject() {{
+            data.put("time5", new JSONObject() {{
                 put("value", sdf.format(studentLeave.getCreateDate()));
             }});
+            data.put("thing2", new JSONObject() {{
+                put("value", className);
+            }});
             weChatSendMessageDto.setContent(data);
             weChatService.sendTemplateMessage(weChatSendMessageDto);
         }
 
-
-
-        return null;
+        return true;
     }
 
     JsonArray selectResource(ApiUtil apiUtil){

+ 6 - 0
src/main/resources/mapper/student/BaseStudentSchoolRollMapper.xml

@@ -193,4 +193,10 @@
         </if>
         group by t3.stduy_status,t2.gender
     </select>
+
+    <select id="getClassNameByUserId" resultType="java.lang.String">
+        SELECT t1.name FROM base_class t1
+        INNER JOIN base_student_school_roll ON t1.id = t2.class_id
+        WHERE t2.user_id = #{userId}
+    </select>
 </mapper>