Browse Source

feat(app):
1.数据库订单表增加合同编号字段字段
2.课程相关接口
fix(system):
1.包场相关接口重构

wzq 3 days ago
parent
commit
5990bfa1b0

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/controller/AppCoursesPriceRulesController.java

@@ -134,7 +134,7 @@ public class AppCoursesPriceRulesController extends JeecgController<AppCoursesPr
 	//@AutoLog(value = "课程价格规则表-通过id查询")
 	@Operation(summary="课程价格规则表-补课列表编辑")
 	@PostMapping(value = "/editPriceRules")
-	public Result<String> editPriceRules(List<AppCoursesRuleDTO> dtoList) {
+	public Result<String> editPriceRules(@RequestBody List<AppCoursesRuleDTO> dtoList) {
 		return appCoursesPriceRulesService.editWitchPriceRules(dtoList)?Result.OK("操作成功"):Result.error("保存失败");
 	}
 //

+ 26 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/controller/AppSiteController.java

@@ -161,4 +161,30 @@ public class AppSiteController extends JeecgController<AppSite, IAppSiteService>
         return super.importExcel(request, response, AppSite.class);
     }
 
+	/**
+	 * 通过tenantId查询
+	 *
+	 * @param tenantId
+	 * @return
+	 */
+	@AutoLog(value = "门店信息补充-通过tenantId查询")
+	@Operation(summary="门店信息补充-通过tenantId查询")
+	@GetMapping(value = "/queryByTenantId")
+	public Result<AppSiteDTO> queryByTenantId(@RequestParam(name="tenantId",required=true) String tenantId) {
+		return Result.ok(appSiteService.queryByTenantId(tenantId));
+	}
+
+	/**
+	 *  编辑
+	 *
+	 * @param appSiteDTO
+	 * @return
+	 */
+	@AutoLog(value = "门店信息补充-编辑")
+	@Operation(summary="门店信息补充-编辑")
+	@RequestMapping(value = "/editSite", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> editSite(@RequestBody AppSiteDTO appSiteDTO) {
+		return appSiteService.editSite(appSiteDTO)?Result.OK("操作成功!"):Result.error("操作失败!");
+	}
+
 }

+ 4 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppOrder.java

@@ -82,6 +82,10 @@ public class AppOrder implements Serializable {
 	@Excel(name = "保单id;保单列表", width = 15)
     @Schema(description = "保单id;保单列表")
     private String insureNumberIds;
+    /**合同编号*/
+    @Excel(name = "合同编号", width = 15)
+    @Schema(description = "合同编号")
+    private String contractNo;
 	/**取消备注*/
 	@Excel(name = "取消备注", width = 15)
     @Schema(description = "取消备注")

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppCoursesMapper.xml

@@ -178,7 +178,7 @@
         FROM
             `nm_courses` c
             left JOIN nm_site s ON c.address_site_id = s.id
-        WHERE 1=1
+        WHERE 1=1 and c.del_flag = '0'
         <if test="dto.orgCode != null and dto.orgCode != ''">
             AND c.org_code = #{ dto.orgCode }
         </if>

+ 1 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/IAppSiteService.java

@@ -50,4 +50,5 @@ public interface IAppSiteService extends IService<AppSite> {
 
     IPage<AppSiteDTO> querySitePage(AppSitePageDTO dto);
 
+    AppSiteDTO queryByTenantId(String tenantId);
 }

+ 3 - 3
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppCoursesPriceRulesServiceImpl.java

@@ -82,12 +82,12 @@ public class AppCoursesPriceRulesServiceImpl extends ServiceImpl<AppCoursesPrice
         List<AppCoursesRuleDTO> toUpdate = dtoList.stream()
                 .filter(dto -> dto.getId() != null && priceRules.stream().anyMatch(db -> db.getId().equals(dto.getId())))
                 .collect(Collectors.toList());
-        toUpdate.forEach(dto -> {
+        for (AppCoursesRuleDTO dto : toUpdate) {
             AppCoursesPriceRules entity = new AppCoursesPriceRules();
-            BeanUtils.copyProperties(entity, dto);
+            BeanUtils.copyProperties(dto,entity);
             int result = baseMapper.updateById(entity);
             if (result < 1) throw new JeecgBootException("课时更新失败");
-        });
+        }
         return Boolean.TRUE;
     }
 

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

@@ -442,7 +442,6 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
 
                 item.getAppSiteRuleTimeFormDTOList().forEach(formDTO -> {
                     formDTO.getAppSiteRuleDTOList().forEach(ruleDTO -> {
-                        System.out.println();
                         AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
                         BeanUtils.copyProperties(formDTO, appSitePriceRules);
                         appSitePriceRules.setSitePlaceId(appSitePlace.getId());
@@ -458,9 +457,6 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
                         appSitePriceRulesList.add(appSitePriceRules);
                     });
                 });
-                appSitePriceRulesList.forEach(appSitePriceRule -> {
-                    System.out.println(appSitePriceRule.toString());
-                });
                 appSitePriceRulesMapper.insertList(appSitePriceRulesList);
             }
         });
@@ -497,22 +493,86 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
             Integer count = appSiteCategoryRuleDTO.getCount();
 
             // 查询该分类已有的场地
-            List<AppSitePlace> categoryPlaces = existingPlaces.stream().filter(p -> p.getCategoryId() != null && p.getCategoryId().equals(categoryId)).sorted(Comparator.comparing(AppSitePlace::getName)).collect(Collectors.toList());
+            List<AppSitePlace> sitePlaces = existingPlaces.stream().filter(p -> p.getCategoryId() != null && p.getCategoryId().equals(categoryId)).collect(Collectors.toList());
 
             AppCategory category = appCategoryMapper.selectById(categoryId);
             if (category == null) {
                 throw new JeecgBootException("分类不存在", SC_INTERNAL_SERVER_ERROR_500);
             }
 
-            appSiteCategoryRuleDTO.getAppSiteRuleTimeFormDTOList().forEach(formDTO -> {
+            if (sitePlaces.isEmpty()) {
+                // 创建场地
+                for (int i = 1; i <= count; i++) {
+                    AppSitePlace appSitePlace = new AppSitePlace();
+                    BeanUtils.copyProperties(placeCuDTO, appSitePlace);
+                    appSitePlace.setType(SitePlaceTypeEnum.PACKAGE.getCode());
+                    appSitePlace.setName(category.getName() + i);
+                    appSitePlace.setSiteId(site.getId());
+                    appSitePlace.setOrgCode(site.getOrgCode());
+                    appSitePlace.setTenantId(site.getTenantId());
+                    appSitePlace.setCategoryId(category.getId());
+                    appSitePlace.setType(SitePlaceTypeEnum.PACKAGE.getCode());
+                    baseMapper.insert(appSitePlace);
+                }
+                sitePlaces = baseMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getSiteId, site.getId()).eq(AppSitePlace::getCategoryId, category.getId()));
+            }
+
+            // 表单siteRuleTimeId集合
+            List<String> formIds = appSiteCategoryRuleDTO.getAppSiteRuleTimeFormDTOList().stream().map(AppSiteRuleTimeFormDTO::getId).filter(StrUtil::isNotBlank).collect(Collectors.toList());
+
+            // 查询本地所有的siteRuleTime
+            List<AppSiteRuleTime> appSiteRuleTimeList = appSiteRuleTimeMapper.selectList(Wrappers.<AppSiteRuleTime>lambdaQuery().eq(AppSiteRuleTime::getSiteId, site.getId()).eq(AppSiteRuleTime::getCategoryId, categoryId));
+            // 删除
+            if (CollUtil.isNotEmpty(appSiteRuleTimeList)) {
+                List<String> localIds = appSiteRuleTimeList.stream().map(AppSiteRuleTime::getId).collect(Collectors.toList());
+                // 找出要删除的旧规则(存在于db,不存在于new)
+                List<String> toDelete = getDifferListByMap(localIds, formIds);
+
+                if (!toDelete.isEmpty()) {
+                    toDelete.forEach(id -> {
+                        appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSiteRuleTimeId, id));
+                    });
+                    appSiteRuleTimeMapper.deleteBatchIds(toDelete);
+                }
+            }
+
+            List<AppSiteRuleTimeFormDTO> appSiteRuleTimeFormDTOList = appSiteCategoryRuleDTO.getAppSiteRuleTimeFormDTOList();
+            for (AppSiteRuleTimeFormDTO formDTO : appSiteRuleTimeFormDTOList) {
+
                 // 新增
-                if (StrUtil.isNotBlank(formDTO.getId())) {
+                if (StrUtil.isBlank(formDTO.getId())) {
                     AppSiteRuleTime appSiteRuleTime = new AppSiteRuleTime();
                     appSiteRuleTime.setSiteId(site.getId()).setCategoryId(category.getId()).setStartTime(formDTO.getStartTime()).setEndTime(formDTO.getEndTime());
                     appSiteRuleTimeMapper.insert(appSiteRuleTime);
                     formDTO.getAppSiteRuleDTOList().forEach(ruleDTO -> {
                         ruleDTO.setSiteRuleTimeId(appSiteRuleTime.getId());
                     });
+
+                    if (CollUtil.isNotEmpty(sitePlaces)) {
+                        List<AppSitePriceRules> appSitePriceRulesList = new ArrayList<>();
+
+                        for (AppSitePlace sitePlace : sitePlaces) {
+                            for (AppSiteRuleDTO ruleDTO : formDTO.getAppSiteRuleDTOList()) {
+                                AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
+                                BeanUtils.copyProperties(formDTO, appSitePriceRules);
+                                appSitePriceRules.setId(null);
+                                appSitePriceRules.setSitePlaceId(sitePlace.getId());
+                                appSitePriceRules.setOrgCode(sitePlace.getOrgCode());
+                                appSitePriceRules.setTenantId(sitePlace.getTenantId());
+                                appSitePriceRules.setCategoryId(category.getId());
+                                appSitePriceRules.setDayOfWeek(ruleDTO.getDayOfWeek());
+                                appSitePriceRules.setSellingPrice(ruleDTO.getSellingPrice());
+                                appSitePriceRules.setType(sitePlace.getType());
+                                appSitePriceRules.setSiteRuleTimeId(ruleDTO.getSiteRuleTimeId());
+                                appSitePriceRules.setStatus(CommonConstant.STATUS_0_INT);
+                                appSitePriceRules.setDelFlag(CommonConstant.STATUS_0_INT);
+                                appSitePriceRulesList.add(appSitePriceRules);
+                            }
+                        }
+                        for (AppSitePriceRules appSitePriceRules : appSitePriceRulesList) {
+                            appSitePriceRulesMapper.insert(appSitePriceRules);
+                        }
+                    }
                 }
                 // 修改
                 else {
@@ -528,57 +588,43 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
                             }
                         }
                     }
-
+                    for (AppSitePriceRules appSitePriceRule : appSitePriceRules) {
+                        appSitePriceRulesMapper.updateById(appSitePriceRule);
+                    }
                 }
-            });
-            // 表单siteRuleTimeId集合
-            List<String> formIds = appSiteCategoryRuleDTO.getAppSiteRuleTimeFormDTOList().stream().map(AppSiteRuleTimeFormDTO::getId).filter(StrUtil::isNotBlank).collect(Collectors.toList());
-
-            // 查询本地所有的siteRuleTime
-            List<AppSiteRuleTime> appSiteRuleTimeList = appSiteRuleTimeMapper.selectList(Wrappers.<AppSiteRuleTime>lambdaQuery().eq(AppSiteRuleTime::getSiteId, site.getId()).eq(AppSiteRuleTime::getCategoryId, categoryId));
-            // 删除
-            if (CollUtil.isNotEmpty(appSiteRuleTimeList)) {
-                List<String> localIds = appSiteRuleTimeList.stream().map(AppSiteRuleTime::getId).collect(Collectors.toList());
-                // 找出要删除的旧规则(存在于db,不存在于new)
-                List<String> toDelete = getDifferListByMap(localIds, formIds);
-
-                toDelete.forEach(id -> {
-                    appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSiteRuleTimeId, id));
-                });
-                appSiteRuleTimeMapper.deleteBatchIds(toDelete);
             }
-
             Long sitePlaceNum = baseMapper.selectCount(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getSiteId, site.getId()).eq(AppSitePlace::getCategoryId, categoryId));
-
             // 数据库场地数量    小于   表单场地数量  -----新增多余场地数量
             if (sitePlaceNum < count) {
-                // 增加场地 数量
-                for (int i = 1; i < count - sitePlaceNum; i++) {
-                    AppSitePlace appSitePlace = new AppSitePlace();
-                    BeanUtils.copyProperties(placeCuDTO, appSitePlace);
-                    appSitePlace.setSiteId(site.getId()).setCategoryId(categoryId).setName(category.getName() + (count + i)).setType(SitePlaceTypeEnum.PACKAGE.getCode()).setOrgCode(site.getOrgCode()).setTenantId(site.getTenantId());
-                    baseMapper.insert(appSitePlace);
-                    List<AppSitePriceRules> appSitePriceRulesList = new ArrayList<>();
-                    appSiteCategoryRuleDTO.getAppSiteRuleTimeFormDTOList().forEach(formDTO -> {
-                        List<AppSiteRuleDTO> appSiteRuleDTOList = formDTO.getAppSiteRuleDTOList();
-                        for (AppSiteRuleDTO appSiteRuleDTO : appSiteRuleDTOList) {
-                            AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
-                            BeanUtils.copyProperties(appSiteRuleDTO, appSitePriceRules);
-                            appSitePriceRulesList.add(appSitePriceRules);
-                        }
-                    });
-                    appSitePriceRulesMapper.insertList(appSitePriceRulesList);
-                    ;
+                if (sitePlaceNum > 0) {
+                    // 增加场地 数量
+                    for (int i = 1; i < count - sitePlaceNum; i++) {
+                        AppSitePlace appSitePlace = new AppSitePlace();
+                        BeanUtils.copyProperties(placeCuDTO, appSitePlace);
+                        appSitePlace.setSiteId(site.getId()).setCategoryId(categoryId).setName(category.getName() + (count + i)).setType(SitePlaceTypeEnum.PACKAGE.getCode()).setOrgCode(site.getOrgCode()).setTenantId(site.getTenantId());
+                        baseMapper.insert(appSitePlace);
+                        List<AppSitePriceRules> appSitePriceRulesList = new ArrayList<>();
+                        appSiteCategoryRuleDTO.getAppSiteRuleTimeFormDTOList().forEach(formDTO -> {
+                            List<AppSiteRuleDTO> appSiteRuleDTOList = formDTO.getAppSiteRuleDTOList();
+                            for (AppSiteRuleDTO appSiteRuleDTO : appSiteRuleDTOList) {
+                                AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
+                                BeanUtils.copyProperties(appSiteRuleDTO, appSitePriceRules);
+                                appSitePriceRulesList.add(appSitePriceRules);
+                            }
+                        });
+                        appSitePriceRulesMapper.insertList(appSitePriceRulesList);
+                    }
                 }
+
             }
             // 数据库场地数量    大于   表单场地数量  -----删除多余场地数量
-            else if (sitePlaceNum > count) {
+            if (sitePlaceNum > count) {
                 // 减少场地 数量
                 for (int i = 1; i < sitePlaceNum - count; i++) {
                     // 名称匹配
                     AppSitePlace appSitePlace = baseMapper.selectOne(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getSiteId, site.getId()).eq(AppSitePlace::getCategoryId, categoryId).eq(AppSitePlace::getName, category.getName() + (sitePlaceNum - i)));
                     appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId()));
-                    appSitePriceRulesMapper.deleteById(appSitePlace);
+                    baseMapper.deleteById(appSitePlace);
                 }
             }
         }

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.exception.JeecgBootException;
@@ -78,8 +79,6 @@ public class AppSiteServiceImpl extends ServiceImpl<AppSiteMapper, AppSite> impl
         if (null == site.getType()) throw new JeecgBootException("场地类型不能为空", SC_INTERNAL_SERVER_ERROR_500);
         AppSite dbSite = baseMapper.selectById(site.getId());
         if (null == dbSite) throw new JeecgBootException("未找到对应数据", SC_INTERNAL_SERVER_ERROR_500);
-        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-//        checkPermission(dbSite,sysUser);
         if (null == site.getOrgCode())
             throw new JeecgBootException("商户部门编码不能为空", SC_INTERNAL_SERVER_ERROR_500);
         if (null == site.getTenantId())
@@ -140,6 +139,15 @@ public class AppSiteServiceImpl extends ServiceImpl<AppSiteMapper, AppSite> impl
         });
     }
 
+    @Override
+    public AppSiteDTO queryByTenantId(String tenantId) {
+        AppSite site = baseMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getTenantId, tenantId));
+        if (ObjectUtils.isNotEmpty(site)) throw new JeecgBootException("未找到对应数据", SC_INTERNAL_SERVER_ERROR_500);
+        AppSiteDTO appSiteDTO = new AppSiteDTO();
+        BeanUtils.copyProperties(site, appSiteDTO);
+        return appSiteDTO;
+    }
+
     /**
      * 权限校验
      *