Переглянути джерело

feat(sys): 添加部门删除前的课程和场地检查

- 在删除部门前检查是否存在关联的课程和场地- 如果存在关联数据,抛出异常提示用户先下架课程或场地
- 更新部门类型判断逻辑,将原来的"30"改为"21"- 修改微信通知模板ID,更新相关通知内容配置
SheepHy 1 тиждень тому
батько
коміт
1df0728d69

+ 3 - 3
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/wxNotification/WxNotificationService.java

@@ -104,7 +104,7 @@ public class WxNotificationService {
             for (JobReservationSiteVo jobReservationSiteVo : jobReservationSiteVos) {
                 NotificationRequest notificationRequest = new NotificationRequest();
                 notificationRequest.setOpenid(jobReservationSiteVo.getUserOpenId());
-                notificationRequest.setTemplateId("WSJjc9I24ijtr3EyNVXjEvTQm0gIECW9ABYVFcegOwM");
+                notificationRequest.setTemplateId("ooDlPCKVLfo9njUzhUpTnFkFFhtlETpRlVLgrRtCfXk");
                 JSONObject data = new JSONObject();
                 // 根据模板内容设置数据项
                 data.put("thing5", new JSONObject().fluentPut("value",jobReservationSiteVo.getSiteName() ));
@@ -142,7 +142,7 @@ public class WxNotificationService {
             for (JobExtendedClassNoticeVo jobExtendedClassNoticeVo : jobExtendedClassNoticeVos) {
                 NotificationRequest notificationRequest = new NotificationRequest();
                 notificationRequest.setOpenid(jobExtendedClassNoticeVo.getUserOpenId());
-                notificationRequest.setTemplateId("NPlIBEwBDPX23J3Jip0CwYUU4vF9ZlcK8U1d6Gs4yrM");
+                notificationRequest.setTemplateId("HbK-qbIC_iTY0w08xfkgirdeR_VrVhetLwEIBo3Lue4");
                 JSONObject data = new JSONObject();
                 // 根据模板内容设置数据项
                 data.put("thing2", new JSONObject().fluentPut("value", jobExtendedClassNoticeVo.getLassHourTime()));
@@ -190,7 +190,7 @@ public class WxNotificationService {
                 // 发送到消息队列异步处理
                 NotificationRequest notificationRequest = new NotificationRequest();
                 notificationRequest.setOpenid(jobClassNoticeVo.getUserOpenId());
-                notificationRequest.setTemplateId("Yi1Z1IKRwgF6-mpiFcOUTvavc4TUAsfsLynK_3Yu350");//上课时间模板
+                notificationRequest.setTemplateId("T2icwNiI--oBnLfTiAniAoAJAwq1Ukb78bCjIcpuTRQ");//上课时间模板
                 JSONObject data = new JSONObject();
                 String date = getDate(jobClassNoticeVo.getStartTime());
                 String siteName = null;

+ 22 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java

@@ -19,8 +19,12 @@ import org.jeecg.common.util.ImportExcelUtil;
 import org.jeecg.common.util.RedisUtil;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
+import org.jeecg.modules.system.app.entity.AppCourses;
 import org.jeecg.modules.system.app.entity.AppSite;
+import org.jeecg.modules.system.app.entity.AppSitePlace;
+import org.jeecg.modules.system.app.mapper.AppCoursesMapper;
 import org.jeecg.modules.system.app.mapper.AppSiteMapper;
+import org.jeecg.modules.system.app.mapper.AppSitePlaceMapper;
 import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.entity.SysUserDepart;
@@ -80,6 +84,10 @@ public class SysDepartController {
     private AppSiteMapper appSiteMapper;
     @Resource
     private SysUserDepartMapper sysUserDepartMapper;
+    @Resource
+    private AppCoursesMapper appCoursesMapper;
+    @Resource
+    private AppSitePlaceMapper appSitePlaceMapper;
 	/**
 	 * 查询数据 查出我的部门,并以树结构数据格式响应给前端
 	 *
@@ -263,6 +271,12 @@ public class SysDepartController {
                 }
             });
         }
+        if(!appCoursesMapper.selectList(Wrappers.<AppCourses>lambdaQuery().eq(AppCourses::getOrgCode, sysDepart.getOrgCode())).isEmpty()){
+            throw new JeecgBootException("存在课程请先下架课程!");
+        }
+        if(!appSitePlaceMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getOrgCode, sysDepart.getOrgCode())).isEmpty()){
+            throw new JeecgBootException("存在场地请先下架场地!");
+        }
        if(sysDepart==null) {
            result.error500("未找到对应实体");
        }else {
@@ -305,6 +319,14 @@ public class SysDepartController {
                         }
                     });
                 }
+                if(!appCoursesMapper.selectList(Wrappers.<AppCourses>lambdaQuery()
+                        .eq(AppCourses::getOrgCode, sysDepartMapper.getDepartById(sysDepart).getOrgCode())).isEmpty()){
+                    throw new JeecgBootException("存在课程请先下架课程!");
+                }
+                if(!appSitePlaceMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery()
+                        .eq(AppSitePlace::getOrgCode, sysDepartMapper.getDepartById(sysDepart).getOrgCode())).isEmpty()){
+                    throw new JeecgBootException("存在场地请先下架场地!");
+                }
                 appSiteMapper.delete(Wrappers.<AppSite>lambdaQuery()
                         .eq(AppSite::getOrgCode, sysDepartMapper.getDepartById(sysDepart).getOrgCode()));
             });

+ 2 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java

@@ -218,7 +218,7 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
                 sysDepart.setSystemType(1);
             }else if(sysDepart.getOrgCategory().equals("20")){
                 sysDepart.setSystemType(2);
-            }else if(sysDepart.getOrgCategory().equals("30")){
+            }else if(sysDepart.getOrgCategory().equals("21")){
                 sysDepart.setSystemType(2);
             }
             //update-begin--Author:baihailong  Date:20191209 for:部门编码规则生成器做成公用配置
@@ -493,7 +493,7 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
             }
             switch (sysDepart.getOrgCategory()) {
                 case "10" -> sysDepart.setSystemType(1);
-                case "20", "30" -> sysDepart.setSystemType(2);
+                case "20", "21" -> sysDepart.setSystemType(2);
             }
             sysDepart.setUpdateTime(new Date());
             sysDepart.setUpdateBy(username);