Procházet zdrojové kódy

fix(app):修复包场编辑与查询逻辑并新增场地ID字段

- 包场编辑时新增对比修改逻辑,删除不在新分类中的场地
- 查询包场信息时优化查询条件拼接
- 修复 SchoolPlaceAddDTO 缺失的 placeId 字段- 启用定时任务 synchronousDoorOpeningAndClosingRecords 的 fixedDelay 配置
SheepHy před 3 týdny
rodič
revize
fce6b25a16

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/quartz/job/OrTeachingJobService.java

@@ -236,7 +236,7 @@ public class OrTeachingJobService {
      * @Param
      * @return
      **/
-//    @Scheduled(fixedDelay = 7200000)
+    @Scheduled(fixedDelay = 7200000)
 //    @Scheduled(cron = "0 0 23 * * ?")
     public void synchronousDoorOpeningAndClosingRecords(){
         try {

+ 3 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/SchoolPlaceAddDTO.java

@@ -45,4 +45,7 @@ public class SchoolPlaceAddDTO implements Serializable {
 
     @Schema(description = "是否拥有操作权限")
     private Boolean havePermission;
+
+    @Schema(description = "场地ID")
+    private String placeId;
 }

+ 19 - 4
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppSitePlaceServiceImpl.java

@@ -512,20 +512,32 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
     public Boolean editPack(AppSitePlaceParkDTO appSitePlaceParkDTO) {
         AppSitePlaceCuDTO placeCuDTO = appSitePlaceParkDTO.getAppSitePlaceCuDTO();
         List<AppSiteCategoryRuleDTO> appSiteCategoryRuleDTOS = appSitePlaceParkDTO.getAppSiteCategoryRuleDTOS();
-
         AppSite site = appSiteMapper.selectById(placeCuDTO.getSiteId());
         if (site == null) {
             throw new JeecgBootException("商户门店不存在", SC_INTERNAL_SERVER_ERROR_500);
         }
         // 查询当前场地的所有包场场所
-        List<AppSitePlace> existingPlaces = baseMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getSiteId, site.getId()).eq(AppSitePlace::getType, SitePlaceTypeEnum.PACKAGE.getCode()));
+        List<AppSitePlace> existingPlaces = baseMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery()
+                .eq(AppSitePlace::getSiteId, site.getId())
+                .eq(AppSitePlace::getType, SitePlaceTypeEnum.PACKAGE.getCode()));
         if (existingPlaces.isEmpty()) {
             // 无须对比直接做新增
             return savePack(appSitePlaceParkDTO);
         }
-
         // 对比修改
         for (AppSiteCategoryRuleDTO appSiteCategoryRuleDTO : appSiteCategoryRuleDTOS) {
+            // 收集所有新的分类ID
+            Set<String> newCategoryIds = appSiteCategoryRuleDTOS.stream()
+                    .map(AppSiteCategoryRuleDTO::getCategoryId)
+                    .collect(Collectors.toSet());
+
+            // 删除不在新分类列表中的现有场地
+            existingPlaces.forEach(place -> {
+                if (!newCategoryIds.contains(place.getCategoryId())) {
+                    baseMapper.deleteById(place);
+                }
+            });
+
             String categoryId = appSiteCategoryRuleDTO.getCategoryId();
             Integer count = appSiteCategoryRuleDTO.getCount();
 
@@ -897,6 +909,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
             schoolPlaceAddDTO
                     .setSiteId(site.getId())
                     .setSiteId(appSitePlace.getId())
+                    .setPlaceId(appSitePlace.getId())
                     .setInsureIds(appSitePlace.getInsureIds())
                     .setReminder(appSitePlace.getReminder());
             if (ObjectUtil.isNotEmpty(appSitePlace.getCover())) {
@@ -916,7 +929,9 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
     public AppSitePlaceParkDTO queryPack(String siteId) {
         AppSitePlaceParkDTO appSitePlaceParkDTO = new AppSitePlaceParkDTO();
         AppSite site = appSiteMapper.selectById(siteId);
-        List<AppSitePlace> appSitePlaceList = this.baseMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getSiteId, site.getId()).eq(AppSitePlace::getType, SitePlaceTypeEnum.PACKAGE.getCode()));
+        List<AppSitePlace> appSitePlaceList = this.baseMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery()
+                .eq(AppSitePlace::getSiteId, site.getId())
+                .eq(AppSitePlace::getType, SitePlaceTypeEnum.PACKAGE.getCode()));
         if (ObjectUtils.isNotEmpty(appSitePlaceList)) {
             List<AppSiteCategoryRuleDTO> appSiteCategoryRuleDTOS = new ArrayList<>();
             if (CollUtil.isNotEmpty(appSitePlaceList)) {