diff --git a/srs-admin/src/main/java/com/srs/web/controller/comprehensive/CphMsgController.java b/srs-admin/src/main/java/com/srs/web/controller/comprehensive/CphMsgController.java index 3b3d006..61e1039 100644 --- a/srs-admin/src/main/java/com/srs/web/controller/comprehensive/CphMsgController.java +++ b/srs-admin/src/main/java/com/srs/web/controller/comprehensive/CphMsgController.java @@ -23,7 +23,7 @@ import com.srs.common.core.page.TableDataInfo; /** * 消息Controller - * + * * @author srs * @date 2023-07-12 */ @@ -103,4 +103,13 @@ public class CphMsgController extends BaseController { return toAjax(cphMsgService.deleteCphMsgByIds(ids)); } + + /** + * 根据学号查询用户ID + */ + @GetMapping("/getUserIdByStuNo/{stuNo}") + public AjaxResult getUserIdByStuNo(@PathVariable("stuNo") String stuNo) + { + return success(cphMsgService.getUserIdByStuNo(stuNo)); + } } diff --git a/srs-admin/src/main/java/com/srs/web/controller/routine/NotificationManagementController.java b/srs-admin/src/main/java/com/srs/web/controller/routine/NotificationManagementController.java index e88e4ab..38f1d9c 100644 --- a/srs-admin/src/main/java/com/srs/web/controller/routine/NotificationManagementController.java +++ b/srs-admin/src/main/java/com/srs/web/controller/routine/NotificationManagementController.java @@ -1,8 +1,6 @@ package com.srs.web.controller.routine; - import java.util.List; import javax.servlet.http.HttpServletResponse; - import com.srs.routine.domain.NotificationManagement; import com.srs.routine.domain.dto.SendNotificationDto; import com.srs.routine.service.INotificationManagementService; @@ -31,17 +29,6 @@ public class NotificationManagementController extends BaseController { @Autowired private INotificationManagementService notificationManagementService; - /** - * 查询通知管理列表 - */ - @PreAuthorize("@ss.hasPermi('routine:NotificationManagement:list')") - @GetMapping("/list") - @ApiOperation("查询通知管理列表") - public TableDataInfo list(NotificationManagement notificationManagement) { - startPage(); - List list = notificationManagementService.selectNotificationManagementList(notificationManagement); - return getDataTable(list); - } /** * 导出通知管理列表 @@ -50,7 +37,8 @@ public class NotificationManagementController extends BaseController { @Log(title = "通知管理", businessType = BusinessType.EXPORT) @PostMapping("/export") @ApiOperation("导出通知管理列表") - public void export(HttpServletResponse response, NotificationManagement notificationManagement) { + public void export(HttpServletResponse response, NotificationManagement notificationManagement) + { List list = notificationManagementService.selectNotificationManagementList(notificationManagement); ExcelUtil util = new ExcelUtil(NotificationManagement.class); util.exportExcel(response, list, "通知管理数据"); @@ -62,7 +50,8 @@ public class NotificationManagementController extends BaseController { @PreAuthorize("@ss.hasPermi('routine:NotificationManagement:query')") @GetMapping(value = "/{id}") @ApiOperation("获取通知管理详细信息") - public AjaxResult getInfo(@PathVariable("id") Long id) { + public AjaxResult getInfo(@PathVariable("id") Long id) + { return success(notificationManagementService.selectNotificationManagementById(id)); } @@ -73,7 +62,8 @@ public class NotificationManagementController extends BaseController { @Log(title = "通知管理", businessType = BusinessType.INSERT) @PostMapping("/add") @ApiOperation("新增通知管理") - public AjaxResult add(@RequestBody NotificationManagement notificationManagement) { + public AjaxResult add(@RequestBody NotificationManagement notificationManagement) + { return toAjax(notificationManagementService.insertNotificationManagement(notificationManagement)); } @@ -84,7 +74,8 @@ public class NotificationManagementController extends BaseController { @Log(title = "通知管理", businessType = BusinessType.UPDATE) @PostMapping("/update") @ApiOperation("修改通知管理") - public AjaxResult edit(@RequestBody NotificationManagement notificationManagement) { + public AjaxResult edit(@RequestBody NotificationManagement notificationManagement) + { return toAjax(notificationManagementService.updateNotificationManagement(notificationManagement)); } @@ -95,8 +86,20 @@ public class NotificationManagementController extends BaseController { @Log(title = "通知管理", businessType = BusinessType.DELETE) @PostMapping("/{ids}") @ApiOperation("删除通知管理") - public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(notificationManagementService.deleteNotificationManagementByIds(ids)); + public AjaxResult remove(@PathVariable String ids) + { + // 处理逗号分隔的ID字符串 + String[] idArray = ids.split(","); + Long[] idLongArray = new Long[idArray.length]; + for (int i = 0; i < idArray.length; i++) { + idLongArray[i] = Long.parseLong(idArray[i]); + } + + if (idLongArray.length == 1) { + return toAjax(notificationManagementService.deleteNotificationManagementById(idLongArray[0])); + } else { + return toAjax(notificationManagementService.deleteNotificationManagementByIds(idLongArray)); + } } /** @@ -105,7 +108,8 @@ public class NotificationManagementController extends BaseController { @PreAuthorize("@ss.hasPermi('routine:NotificationManagement:list')") @GetMapping("/gradeList") @ApiOperation("获取年级列表") - public AjaxResult getGradeList() { + public AjaxResult getGradeList() + { List gradeList = notificationManagementService.getGradeList(); return success(gradeList); } @@ -117,7 +121,8 @@ public class NotificationManagementController extends BaseController { @Log(title = "按年级发送通知", businessType = BusinessType.INSERT) @PostMapping("/sendByGrades") @ApiOperation("按年级发送通知") - public AjaxResult sendNotificationByGrades(@RequestBody SendNotificationDto sendNotificationDto) { + public AjaxResult sendNotificationByGrades(@RequestBody SendNotificationDto sendNotificationDto) + { int result = notificationManagementService.sendNotificationByGrades(sendNotificationDto); return toAjax(result); } @@ -128,7 +133,8 @@ public class NotificationManagementController extends BaseController { @PreAuthorize("@ss.hasPermi('routine:NotificationManagement:list')") @GetMapping("/my-sent") @ApiOperation("查询当前用户发送的通知列表") - public TableDataInfo mySentList(NotificationManagement notificationManagement) { + public TableDataInfo mySentList(NotificationManagement notificationManagement) + { startPage(); List list = notificationManagementService.selectNotificationManagementListBySender(notificationManagement); return getDataTable(list); diff --git a/srs-admin/src/main/java/com/srs/web/controller/routine/RtStuIdReissueController.java b/srs-admin/src/main/java/com/srs/web/controller/routine/RtStuIdReissueController.java index 15cd199..604577a 100644 --- a/srs-admin/src/main/java/com/srs/web/controller/routine/RtStuIdReissueController.java +++ b/srs-admin/src/main/java/com/srs/web/controller/routine/RtStuIdReissueController.java @@ -145,8 +145,16 @@ public class RtStuIdReissueController extends BaseController { @PostMapping("/add") @ApiOperation("新增学生证补办") public AjaxResult add(@RequestBody RtStuIdReissue rtStuIdReissue) { - // rtStuIdReissue.setCounsellorId(SecurityUtils.getUserId()); - rtStuIdReissue.setCreateBy(SecurityUtils.getUsername()); + // 检查该学号是否已有申请记录 + RtStuIdReissue existingApplication = rtStuIdReissueService.selectRtStuIdReissueByStuNo(rtStuIdReissue.getStuNo()); + if (existingApplication != null) { + // 如果已有申请记录且未完成制作,则不允许重复提交 + if (existingApplication.getInspectionProgress() < 3) { + return AjaxResult.error("您已有正在处理的申请,请勿重复提交"); + } + // 如果已完成制作,允许提交新申请,但需要先删除旧记录 + rtStuIdReissueService.deleteRtStuIdReissueById(existingApplication.getId()); + } return toAjax(rtStuIdReissueService.insertRtStuIdReissue(rtStuIdReissue)); } @@ -169,9 +177,30 @@ public class RtStuIdReissueController extends BaseController { @PostMapping("/update") @ApiOperation("修改学生证补办") public AjaxResult edit(@RequestBody RtStuIdReissue rtStuIdReissue) { + // 检查当前申请状态,如果已完成制作则不允许修改 + RtStuIdReissue currentApplication = rtStuIdReissueService.selectRtStuIdReissueById(rtStuIdReissue.getId()); + if (currentApplication != null && currentApplication.getInspectionProgress() >= 3) { + return AjaxResult.error("申请已完成制作,不可修改"); + } return toAjax(rtStuIdReissueService.updateRtStuIdReissue(rtStuIdReissue)); } + /** + * 删除单个学生证补办申请(学生取消申请) + */ + @PreAuthorize("@ss.hasPermi('routine:stuIdReissue:remove')") + @Log(title = "取消学生证补办申请", businessType = BusinessType.DELETE) + @PostMapping("/cancel/{id}") + @ApiOperation("取消学生证补办申请") + public AjaxResult cancelApplication(@PathVariable Long id) { + // 先检查审核状态,如果已完成制作则不允许取消 + RtStuIdReissue rtStuIdReissue = rtStuIdReissueService.selectRtStuIdReissueById(id); + if (rtStuIdReissue != null && rtStuIdReissue.getInspectionProgress() >= 3) { + return AjaxResult.error("当前审核已完成,不可取消"); + } + return toAjax(rtStuIdReissueService.deleteRtStuIdReissueById(id)); + } + /** * 删除学生证补办 */ @@ -182,4 +211,6 @@ public class RtStuIdReissueController extends BaseController { public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(rtStuIdReissueService.deleteRtStuIdReissueByIds(ids)); } + + } diff --git a/srs-admin/src/main/java/com/srs/web/controller/routine/RtStuMultiLevelReviewController.java b/srs-admin/src/main/java/com/srs/web/controller/routine/RtStuMultiLevelReviewController.java index 692cbe5..c1ed12b 100644 --- a/srs-admin/src/main/java/com/srs/web/controller/routine/RtStuMultiLevelReviewController.java +++ b/srs-admin/src/main/java/com/srs/web/controller/routine/RtStuMultiLevelReviewController.java @@ -114,4 +114,15 @@ public class RtStuMultiLevelReviewController extends BaseController { public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(rtStuMultiLevelReviewService.deleteRtStuMultiLevelReviewByIds(ids)); } + + /** + * 更新审核信息并同时更新学生证补办状态 + */ + @PreAuthorize("@ss.hasPermi('routine:stuMultiLevelReview:edit')") + @Log(title = "更新审核信息并同时更新学生证补办状态", businessType = BusinessType.UPDATE) + @PostMapping("/updateWithStuIdReissue") + @ApiOperation("更新审核信息并同时更新学生证补办状态") + public AjaxResult updateWithStuIdReissue(@RequestBody RtStuMultiLevelReview rtStuMultiLevelReview) { + return toAjax(rtStuMultiLevelReviewService.updateRtStuMultiLevelReviewWithStuIdReissue(rtStuMultiLevelReview)); + } } diff --git a/srs-comprehensive/src/main/java/com/srs/comprehensive/mapper/CphMsgMapper.java b/srs-comprehensive/src/main/java/com/srs/comprehensive/mapper/CphMsgMapper.java index 7eafa0f..a18b327 100644 --- a/srs-comprehensive/src/main/java/com/srs/comprehensive/mapper/CphMsgMapper.java +++ b/srs-comprehensive/src/main/java/com/srs/comprehensive/mapper/CphMsgMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 消息Mapper接口 - * + * * @author srs * @date 2023-07-12 */ @@ -17,7 +17,7 @@ public interface CphMsgMapper extends BaseMapper { /** * 查询消息 - * + * * @param id 消息主键 * @return 消息 */ @@ -25,7 +25,7 @@ public interface CphMsgMapper extends BaseMapper /** * 查询消息列表 - * + * * @param cphMsg 消息 * @return 消息集合 */ @@ -33,7 +33,7 @@ public interface CphMsgMapper extends BaseMapper /** * 新增消息 - * + * * @param cphMsg 消息 * @return 结果 */ @@ -41,7 +41,7 @@ public interface CphMsgMapper extends BaseMapper /** * 修改消息 - * + * * @param cphMsg 消息 * @return 结果 */ @@ -49,7 +49,7 @@ public interface CphMsgMapper extends BaseMapper /** * 删除消息 - * + * * @param id 消息主键 * @return 结果 */ @@ -57,9 +57,18 @@ public interface CphMsgMapper extends BaseMapper /** * 批量删除消息 - * + * * @param ids 需要删除的数据主键集合 * @return 结果 */ public int deleteCphMsgByIds(Long[] ids); + + + /** + * 根据学号查询用户ID + * + * @param stuNo 学号 + * @return 用户ID + */ + public Long getUserIdByStuNo(String stuNo); } diff --git a/srs-comprehensive/src/main/java/com/srs/comprehensive/service/ICphMsgService.java b/srs-comprehensive/src/main/java/com/srs/comprehensive/service/ICphMsgService.java index d63cf70..6d9cf84 100644 --- a/srs-comprehensive/src/main/java/com/srs/comprehensive/service/ICphMsgService.java +++ b/srs-comprehensive/src/main/java/com/srs/comprehensive/service/ICphMsgService.java @@ -5,15 +5,15 @@ import com.srs.comprehensive.domain.CphMsg; /** * 消息Service接口 - * + * * @author srs * @date 2023-07-12 */ -public interface ICphMsgService +public interface ICphMsgService { /** * 查询消息 - * + * * @param id 消息主键 * @return 消息 */ @@ -21,7 +21,7 @@ public interface ICphMsgService /** * 查询消息列表 - * + * * @param cphMsg 消息 * @return 消息集合 */ @@ -29,7 +29,7 @@ public interface ICphMsgService /** * 新增消息 - * + * * @param cphMsg 消息 * @return 结果 */ @@ -37,7 +37,7 @@ public interface ICphMsgService /** * 修改消息 - * + * * @param cphMsg 消息 * @return 结果 */ @@ -45,7 +45,7 @@ public interface ICphMsgService /** * 批量删除消息 - * + * * @param ids 需要删除的消息主键集合 * @return 结果 */ @@ -53,9 +53,17 @@ public interface ICphMsgService /** * 删除消息信息 - * + * * @param id 消息主键 * @return 结果 */ public int deleteCphMsgById(Long id); + + /** + * 根据学号查询用户ID + * + * @param stuNo 学号 + * @return 用户ID + */ + public Long getUserIdByStuNo(String stuNo); } diff --git a/srs-comprehensive/src/main/java/com/srs/comprehensive/service/impl/CphMsgServiceImpl.java b/srs-comprehensive/src/main/java/com/srs/comprehensive/service/impl/CphMsgServiceImpl.java index ea498e9..d3a13e0 100644 --- a/srs-comprehensive/src/main/java/com/srs/comprehensive/service/impl/CphMsgServiceImpl.java +++ b/srs-comprehensive/src/main/java/com/srs/comprehensive/service/impl/CphMsgServiceImpl.java @@ -12,7 +12,7 @@ import com.srs.comprehensive.service.ICphMsgService; /** * 消息Service业务层处理 - * + * * @author srs * @date 2023-07-12 */ @@ -24,7 +24,7 @@ public class CphMsgServiceImpl extends ServiceImpl implemen /** * 查询消息 - * + * * @param id 消息主键 * @return 消息 */ @@ -36,7 +36,7 @@ public class CphMsgServiceImpl extends ServiceImpl implemen /** * 查询消息列表 - * + * * @param cphMsg 消息 * @return 消息 */ @@ -48,7 +48,7 @@ public class CphMsgServiceImpl extends ServiceImpl implemen /** * 新增消息 - * + * * @param cphMsg 消息 * @return 结果 */ @@ -61,7 +61,7 @@ public class CphMsgServiceImpl extends ServiceImpl implemen /** * 修改消息 - * + * * @param cphMsg 消息 * @return 结果 */ @@ -74,7 +74,7 @@ public class CphMsgServiceImpl extends ServiceImpl implemen /** * 批量删除消息 - * + * * @param ids 需要删除的消息主键 * @return 结果 */ @@ -86,7 +86,7 @@ public class CphMsgServiceImpl extends ServiceImpl implemen /** * 删除消息信息 - * + * * @param id 消息主键 * @return 结果 */ @@ -95,4 +95,16 @@ public class CphMsgServiceImpl extends ServiceImpl implemen { return cphMsgMapper.deleteCphMsgById(id); } + + /** + * 根据学号查询用户ID + * + * @param stuNo 学号 + * @return 用户ID + */ + @Override + public Long getUserIdByStuNo(String stuNo) + { + return cphMsgMapper.getUserIdByStuNo(stuNo); + } } diff --git a/srs-comprehensive/src/main/resources/mapper/comprehensive/CphMsgMapper.xml b/srs-comprehensive/src/main/resources/mapper/comprehensive/CphMsgMapper.xml index 0dcfa25..8c6b99e 100644 --- a/srs-comprehensive/src/main/resources/mapper/comprehensive/CphMsgMapper.xml +++ b/srs-comprehensive/src/main/resources/mapper/comprehensive/CphMsgMapper.xml @@ -1,9 +1,9 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -21,19 +21,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + - + insert into cph_msg @@ -44,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time, update_by, update_time, - + #{sender}, #{receiver}, @@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createTime}, #{updateBy}, #{updateTime}, - + @@ -75,9 +75,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from cph_msg where id in + delete from cph_msg where id in #{id} - \ No newline at end of file + + + diff --git a/srs-routine/src/main/java/com/srs/routine/domain/NotificationManagement.java b/srs-routine/src/main/java/com/srs/routine/domain/NotificationManagement.java index 5baed55..49cc959 100644 --- a/srs-routine/src/main/java/com/srs/routine/domain/NotificationManagement.java +++ b/srs-routine/src/main/java/com/srs/routine/domain/NotificationManagement.java @@ -6,10 +6,8 @@ import io.swagger.annotations.ApiModelProperty; import lombok.*; import com.srs.common.core.domain.BaseEntity; - - /** - * 通知管理对象 cph_msg + * 通知管理对象 srs_notification * * @author srs * @date 2025-07-30 @@ -20,40 +18,63 @@ import com.srs.common.core.domain.BaseEntity; @AllArgsConstructor @Builder @ApiModel(value = "NotificationManagement对象" , description = "通知管理") -@TableName("cph_msg") +@TableName("srs_notification") public class NotificationManagement extends BaseEntity{ -private static final long serialVersionUID=1L; + private static final long serialVersionUID=1L; /** - * $column.columnComment + * 通知ID */ - @ApiModelProperty("${column.columnComment}") + @ApiModelProperty("通知ID") @TableId(value = "id", type = IdType.AUTO) - @Excel(name = "${comment}" , readConverterExp = "$column.readConverterExp()") + @Excel(name = "通知ID") private Long id; /** - * 发送人用户id + * 通知标题 */ - @ApiModelProperty("发送人用户id") + @ApiModelProperty("通知标题") + @TableField("title") + @Excel(name = "通知标题") + private String title; + + /** + * 通知内容 + */ + @ApiModelProperty("通知内容") + @TableField("content") + @Excel(name = "通知内容") + private String content; + + /** + * 年级ID列表,以逗号分隔 + */ + @ApiModelProperty("年级ID列表,以逗号分隔") + @TableField("grade_ids") + @Excel(name = "年级ID列表") + private String gradeIds; + + /** + * 年级名称 + */ + @ApiModelProperty("年级名称") + @TableField("gradeName") + @Excel(name = "年级名称") + private String gradeName; + + /** + * 发送人用户ID + */ + @ApiModelProperty("发送人用户ID") @TableField("sender") - @Excel(name = "发送人用户id") + @Excel(name = "发送人用户ID") private Long sender; /** - * 收信人用户id + * 接收人用户ID(用于cph_msg表) */ - @ApiModelProperty("收信人用户id") + @ApiModelProperty("接收人用户ID") @TableField("receiver") private Long receiver; - /** - * 消息内容 - */ - @ApiModelProperty("消息内容") - @TableField("content") - @Excel(name = "消息内容") - private String content; - - } diff --git a/srs-routine/src/main/java/com/srs/routine/domain/dto/SendNotificationDto.java b/srs-routine/src/main/java/com/srs/routine/domain/dto/SendNotificationDto.java index 18d78dd..c9894f8 100644 --- a/srs-routine/src/main/java/com/srs/routine/domain/dto/SendNotificationDto.java +++ b/srs-routine/src/main/java/com/srs/routine/domain/dto/SendNotificationDto.java @@ -22,6 +22,9 @@ public class SendNotificationDto { @ApiModelProperty("选中的年级ID列表") private List selectedGrades; + @ApiModelProperty("通知标题") + private String title; + @ApiModelProperty("通知内容") private String content; diff --git a/srs-routine/src/main/java/com/srs/routine/mapper/NotificationManagementMapper.java b/srs-routine/src/main/java/com/srs/routine/mapper/NotificationManagementMapper.java index 01107e1..d1f492c 100644 --- a/srs-routine/src/main/java/com/srs/routine/mapper/NotificationManagementMapper.java +++ b/srs-routine/src/main/java/com/srs/routine/mapper/NotificationManagementMapper.java @@ -76,15 +76,15 @@ public interface NotificationManagementMapper extends BaseMapper selectStudentIdsByGrades(@Param("gradeIds") List gradeIds); /** - * 根据学号查询用户ID + * 根据年级ID列表查询学生学号列表 * - * @param stuNo 学号 - * @return 用户ID + * @param gradeIds 年级ID列表 + * @return 学生学号列表 */ - Long selectUserIdByStuNo(@Param("stuNo") String stuNo); + List selectStudentNosByGrades(@Param("gradeIds") List gradeIds); /** - * 批量插入通知记录 + * 批量插入通知记录到cph_msg表 * * @param notifications 通知记录列表 * @return 结果 @@ -99,4 +99,23 @@ public interface NotificationManagementMapper extends BaseMapper selectNotificationManagementListBySender(@Param("notification") NotificationManagement notificationManagement, @Param("senderId") Long senderId); + + /** + * 批量删除cph_msg表数据 + * + * @param notificationList 通知列表 + * @return 结果 + */ + int batchDeleteCphMsg(@Param("list") List notificationList); + + /** + * 批量更新cph_msg表数据 + * + * @param oldList 原数据列表 + * @param newList 新数据列表 + * @return 结果 + */ + int batchUpdateCphMsg(@Param("oldList") List oldList, @Param("newList") List newList); + + } diff --git a/srs-routine/src/main/java/com/srs/routine/mapper/RtStuMultiLevelReviewMapper.java b/srs-routine/src/main/java/com/srs/routine/mapper/RtStuMultiLevelReviewMapper.java index 85b2fa9..8b567cc 100644 --- a/srs-routine/src/main/java/com/srs/routine/mapper/RtStuMultiLevelReviewMapper.java +++ b/srs-routine/src/main/java/com/srs/routine/mapper/RtStuMultiLevelReviewMapper.java @@ -63,4 +63,14 @@ public interface RtStuMultiLevelReviewMapper extends BaseMapper getStudentIdsByGrades(List gradeIds); - - /** - * 根据学号查询用户ID - * - * @param stuNo 学号 - * @return 用户ID - */ - Long getUserIdByStuNo(String stuNo); - + List getStudentNosByGrades(List gradeIds); /** * 查询当前用户发送的通知列表 @@ -99,6 +90,4 @@ public interface INotificationManagementService extends IService selectNotificationManagementListBySender(NotificationManagement notificationManagement); - - } diff --git a/srs-routine/src/main/java/com/srs/routine/service/IRtStuIdReissueService.java b/srs-routine/src/main/java/com/srs/routine/service/IRtStuIdReissueService.java index bb21c8d..2f77088 100644 --- a/srs-routine/src/main/java/com/srs/routine/service/IRtStuIdReissueService.java +++ b/srs-routine/src/main/java/com/srs/routine/service/IRtStuIdReissueService.java @@ -70,5 +70,13 @@ public interface IRtStuIdReissueService extends IService { */ StuInfoReturnVo getStuInfo(String stuNo); + /** + * 完成制作 + * + * @param id 学生证补办主键 + * @return 结果 + */ + int completedRtStuIdReissue(Long id); + } diff --git a/srs-routine/src/main/java/com/srs/routine/service/IRtStuMultiLevelReviewService.java b/srs-routine/src/main/java/com/srs/routine/service/IRtStuMultiLevelReviewService.java index f02096f..31cba1d 100644 --- a/srs-routine/src/main/java/com/srs/routine/service/IRtStuMultiLevelReviewService.java +++ b/srs-routine/src/main/java/com/srs/routine/service/IRtStuMultiLevelReviewService.java @@ -61,4 +61,15 @@ public interface IRtStuMultiLevelReviewService extends IService selectNotificationManagementList(NotificationManagement notificationManagement) { @@ -57,6 +60,7 @@ public class NotificationManagementServiceImpl extends ServiceImpl 0 && originalNotification != null) { + // 构建更新条件:根据原内容、发送人和创建时间匹配 + List updateList = new ArrayList<>(); + updateList.add(originalNotification); + + // 构建新数据用于更新 + List newList = new ArrayList<>(); + NotificationManagement newMsg = new NotificationManagement(); + newMsg.setContent(notificationManagement.getContent()); + newMsg.setSender(notificationManagement.getSender()); + newMsg.setCreateTime(originalNotification.getCreateTime()); // 保持原创建时间不变 + newList.add(newMsg); + + // 批量更新cph_msg表 + notificationManagementMapper.batchUpdateCphMsg(updateList, newList); + } + + return result; } /** @@ -79,7 +109,22 @@ public class NotificationManagementServiceImpl extends ServiceImpl notifications = new ArrayList<>(); + for (Long id : ids) { + NotificationManagement notification = selectNotificationManagementById(id); + if (notification != null) { + notifications.add(notification); + } + } + + if (!notifications.isEmpty()) { + notificationManagementMapper.batchDeleteCphMsg(notifications); + } + + // 删除srs_notification表数据 return notificationManagementMapper.deleteNotificationManagementByIds(ids); } @@ -90,7 +135,17 @@ public class NotificationManagementServiceImpl extends ServiceImpl notifications = new ArrayList<>(); + notifications.add(notification); + notificationManagementMapper.batchDeleteCphMsg(notifications); + } + + // 删除srs_notification表数据 return notificationManagementMapper.deleteNotificationManagementById(id); } @@ -111,65 +166,58 @@ public class NotificationManagementServiceImpl extends ServiceImpl 0) { + // 根据年级获取学生用户ID列表 + List studentIds = notificationManagementMapper.selectStudentIdsByGrades(sendNotificationDto.getSelectedGrades()); + + if (studentIds != null && !studentIds.isEmpty()) { + // 使用srs_notification表的create_time,确保两个表的时间一致 + java.util.Date notificationCreateTime = notification.getCreateTime(); + + // 批量构建cph_msg记录 + List cphMsgList = studentIds.stream() + .map(studentId -> { + NotificationManagement msg = new NotificationManagement(); + msg.setSender(SecurityUtils.getUserId()); + msg.setReceiver(studentId); + msg.setContent(sendNotificationDto.getContent()); + msg.setCreateTime(notificationCreateTime); + return msg; + }) + .collect(Collectors.toList()); + + // 批量插入cph_msg表 + int i= notificationManagementMapper.batchInsertNotification(cphMsgList); + // 如果插入成功,发送企业微信消息 + if (i > 0) { + //根据年级获取学生学号列表 + List studentNos = getStudentNosByGrades(sendNotificationDto.getSelectedGrades()); + if (studentNos != null && !studentNos.isEmpty()) { + // 批量发送企业微信消息 + sendWeChatMessagesBatch(studentNos, sendNotificationDto.getContent()); + } + } + return i; + } } - // 根据年级获取学生用户ID列表 - List studentIds = getStudentIdsByGrades(sendNotificationDto.getSelectedGrades()); - - if (studentIds == null || studentIds.isEmpty()) { - return 0; - } - - // 批量构建通知记录 - final Long finalSenderId = senderId; - List notifications = studentIds.stream() - .map(studentId -> { - NotificationManagement notification = new NotificationManagement(); - notification.setSender(finalSenderId); - notification.setReceiver(studentId); - notification.setContent(sendNotificationDto.getContent()); - notification.setCreateTime(DateUtils.getNowDate()); - return notification; - }) - .collect(Collectors.toList()); - - // 批量插入 - int i= notificationManagementMapper.batchInsertNotification(notifications); - if (i > 0){ - // todo 给这些学生发送企业微信消息 - // 先给:20200016 - } - return i; + return result; } - /** - * 根据年级获取学生用户ID列表 - * - * @param gradeIds 年级ID列表 - * @return 学生用户ID列表 - */ - @Override - public List getStudentIdsByGrades(List gradeIds) { - return notificationManagementMapper.selectStudentIdsByGrades(gradeIds); - } - - /** - * 根据学号查询用户ID - * - * @param stuNo 学号 - * @return 用户ID - */ - @Override - public Long getUserIdByStuNo(String stuNo) { - return notificationManagementMapper.selectUserIdByStuNo(stuNo); - } - - /** * 查询当前用户发送的通知列表 * @@ -182,6 +230,34 @@ public class NotificationManagementServiceImpl extends ServiceImpl studentNos, String content) { + // 企业微信批量发送限制,每次最多发送1000个用户 + int batchSize = 1000; + for (int i = 0; i < studentNos.size(); i += batchSize) { + List batch = studentNos.subList(i, Math.min(i + batchSize, studentNos.size())); + // 拼接成"2023001|2023002|2023003"格式 + String toUser = String.join("|", batch); + // 调用企业微信发送消息方法 + weChatUtil.sendTextMessage(toUser, content); + } + } + + /** + * 根据年级获取学生学号列表 + * + * @param gradeIds 年级ID列表 + * @return 学生学号列表 + */ + @Override + public List getStudentNosByGrades(List gradeIds) { + return notificationManagementMapper.selectStudentNosByGrades(gradeIds); + } } diff --git a/srs-routine/src/main/java/com/srs/routine/service/impl/RtStuIdReissueServiceImpl.java b/srs-routine/src/main/java/com/srs/routine/service/impl/RtStuIdReissueServiceImpl.java index 0764b7f..632636d 100644 --- a/srs-routine/src/main/java/com/srs/routine/service/impl/RtStuIdReissueServiceImpl.java +++ b/srs-routine/src/main/java/com/srs/routine/service/impl/RtStuIdReissueServiceImpl.java @@ -137,4 +137,19 @@ public class RtStuIdReissueServiceImpl extends ServiceImpl 0) { + String messageContent = rtStuMultiLevelReview.getNotes(); + if (messageContent == null || messageContent.trim().isEmpty()) { + messageContent = "你申请办理的学生证制作完成,长堽校区前往xxx领取,里建校区前往xxx领取"; + } + WeChatUtil weChatUtil = new WeChatUtil(); + weChatUtil.sendTextMessage(rtStuMultiLevelReview.getStuNo(), messageContent); + } + return result; + } + + } diff --git a/srs-routine/src/main/resources/mapper/routine/NotificationManagementMapper.xml b/srs-routine/src/main/resources/mapper/routine/NotificationManagementMapper.xml index bbcd073..17f3399 100644 --- a/srs-routine/src/main/resources/mapper/routine/NotificationManagementMapper.xml +++ b/srs-routine/src/main/resources/mapper/routine/NotificationManagementMapper.xml @@ -1,14 +1,16 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - + + + + @@ -27,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, sender, receiver, content, create_by, create_time, update_by, update_time from cph_msg + select id, title, content, grade_ids, sender, create_by, create_time, update_by, update_time from srs_notification @@ -36,57 +38,69 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + - + + - insert into cph_msg + insert into srs_notification - sender, - receiver, + title, content, + grade_ids, + sender, create_by, create_time, update_by, update_time, - + - #{sender}, - #{receiver}, + #{title}, #{content}, + #{gradeIds}, + #{sender}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, - + - update cph_msg + update srs_notification - sender = #{sender}, - receiver = #{receiver}, + title = #{title}, content = #{content}, + grade_ids = #{gradeIds}, + sender = #{sender}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, @@ -96,11 +110,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from cph_msg where id = #{id} + delete from srs_notification where id = #{id} - delete from cph_msg where id in + delete from srs_notification where id in #{id} @@ -126,8 +140,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - + insert into cph_msg (sender, receiver, content, create_time) values @@ -136,4 +161,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - \ No newline at end of file + + + delete from cph_msg where (content, sender, create_time) in + + (#{item.content}, #{item.sender}, #{item.createTime}) + + + + + + update cph_msg + set content = #{newList[0].content} + where content = #{oldList[0].content} + and sender = #{oldList[0].sender} + and create_time = #{oldList[0].createTime} + + + diff --git a/srs-routine/src/main/resources/mapper/routine/RtStuMultiLevelReviewMapper.xml b/srs-routine/src/main/resources/mapper/routine/RtStuMultiLevelReviewMapper.xml index 3f8fb60..dd4c7b4 100644 --- a/srs-routine/src/main/resources/mapper/routine/RtStuMultiLevelReviewMapper.xml +++ b/srs-routine/src/main/resources/mapper/routine/RtStuMultiLevelReviewMapper.xml @@ -103,4 +103,28 @@ #{id} - \ No newline at end of file + + + + + update rt_stu_multi_level_review + + stu_name = #{stuName}, + stuNo = #{stuNo}, + reason = #{reason}, + reviewer = #{reviewer}, + reviewer_identity = #{reviewerIdentity}, + review_time = #{reviewTime}, + reviewer_id = #{reviewerId}, + notes = #{notes}, + type = #{type}, + reviewer_status = #{reviewerStatus}, + + where id = #{id}; + + + update rt_stu_id_reissue + set inspection_progress = #{reviewerStatus} + where stu_no = #{stuNo}; + +