Browse Source

fix(app):修复订单地址信息获取逻辑与部门删除校验问题

- 优化课程详情接口用户折扣判断条件,增加用户ID非空校验
-修复赛事订单地址信息获取逻辑,根据场地类型区分获取方式
- 调整部门删除接口校验逻辑,增加子部门及用户存在性判断- 优化批量删除部门逻辑,增加子部门及用户校验和场地数据清理
- 调整支付明细查询条件字段映射,修复查询条件不生效问题
-修正场地价格规则查询时间判断逻辑,调整时间间隔参数
- 移除课程详情接口匿名访问权限配置,增强接口安全性
- 移除购物金额查询冗余字段,优化查询SQL结构
SheepHy 1 month ago
parent
commit
558b736507

+ 1 - 1
national-motion-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -121,7 +121,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/app/detail/getAllCourseCategory", "anon");
         filterChainDefinitionMap.put("/app/detail/getPlaceInfoNoFixation", "anon");
         filterChainDefinitionMap.put("/app/game/findById", "anon");
-        filterChainDefinitionMap.put("/app/detail/getCourseInfo", "anon");
+//        filterChainDefinitionMap.put("/app/detail/getCourseInfo", "anon");
         filterChainDefinitionMap.put("/app/stadium/getPlaceInfo", "anon");
         filterChainDefinitionMap.put("/test/**", "anon");//测试
 

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

@@ -229,7 +229,7 @@ public class DetailServiceImpl implements IDetailService {
         });
 
         courseInfoVO.setCourseDetail(courseDetailVOList);
-        if(null != loginUser){
+        if(null != loginUser &&  loginUser.getId() != null){
             courseInfoVO.setHasDiscount(checkOrderOrFree(loginUser.getId(),courseInfoVO.getCategoryId(),id));
         }else {
             courseInfoVO.setHasDiscount(false);

+ 12 - 5
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/OrderServiceImpl.java

@@ -777,7 +777,11 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
                         AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
                         appOrderProInfo.setProductId(createOrderForm.getProductIds());
                         appOrderProInfo.setProductName(appGame.getName());
-                        appOrderProInfo.setAddress(appGame.getSiteAddress());
+                        if(appGame.getSiteType() == 1){
+                            appOrderProInfo.setAddress(appGameMapper.selectById(appGame.getId()).getAddress());
+                        }else {
+                            appOrderProInfo.setAddress(appSiteMapper.selectById(appGame.getSiteId()).getAddress());
+                        }
                         appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_3);
                         appOrderProInfo.setFrameTimeStr(startTime + "-" + endTime);
                         appOrderProInfo.setExpireTime(DateUtil.format(appGameSchedule.getEndTime(), "yyyy-MM-dd HH:mm:ss"));
@@ -837,7 +841,11 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
                         AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
                         appOrderProInfo.setProductId(createOrderForm.getProductIds());
                         appOrderProInfo.setProductName(appGame.getName());
-                        appOrderProInfo.setAddress(appGame.getSiteAddress());
+                        if(appGame.getSiteType() == 1){
+                            appOrderProInfo.setAddress(appGameMapper.selectById(appGame.getId()).getAddress());
+                        }else {
+                            appOrderProInfo.setAddress(appSiteMapper.selectById(appGame.getSiteId()).getAddress());
+                        }
                         appOrderProInfo.setTicketNo(ticketNo);
                         appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_4);
                         appOrderProInfo.setFrameTimeStr(startTime + "-" + endTime);
@@ -1529,13 +1537,12 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
             appOrderInfoDTO.setAppGameScheduleVOList(appGameScheduleVOList);
             //赛程数
             appOrderInfoDTO.setGameScheduleNum(appGameScheduleVOList.size());
+            AppSite site = appSiteMapper.selectById(appGame.getSiteId());
             //地址信息
-            appOrderInfoDTO.setGameAddress(appGame.getSiteAddress());
+            appOrderInfoDTO.setGameAddress(site.getAddress());
             appOrderInfoDTO.setLatitude(appGame.getLatitude());
             appOrderInfoDTO.setLongitude(appGame.getLongitude());
             if (appGame.getSiteType().equals(CommonConstant.STATUS_1_INT)) {
-                //门店信息
-                AppSite site = appSiteMapper.selectById(appGame.getSiteId());
                 if (ObjectUtils.isNotEmpty(site)){
                     appOrderInfoDTO.setPhone(site.getPhone());
                     appOrderInfoDTO.setAddressSiteId(site.getId());

+ 15 - 22
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppSitePlaceMapper.xml

@@ -51,16 +51,12 @@
                         b.id,b.start_time,b.end_time ,b.selling_price,
                         CASE
                             WHEN c.order_status <=1 THEN 1
-                            WHEN DATE_ADD(CURRENT_TIME(), INTERVAL 8 HOUR) < TIME(b.end_time)
-                     AND TIME_TO_SEC(TIMEDIFF(TIME(b.end_time), TIME(b.start_time)))/2 >
-                     TIME_TO_SEC(TIMEDIFF(TIME(b.end_time), DATE_ADD(CURRENT_TIME(), INTERVAL 8 HOUR)))
-                     THEN 0
-                     ELSE 1
-    END AS concertStatus
-    from nm_site_place a
-    left join  nm_site_price_rules b on a.id = b.site_place_id
-    LEFT JOIN nm_order_pro_info c on c.product_id =b.id and c.use_date_str =#{today}
-    where a.site_id = #{siteId} and b.category_id =#{categoryId} and b.day_of_week =#{weekDay} and b.del_flag = 0
+                            ELSE 0
+                            END AS concertStatus
+                 from nm_site_place a
+                          left join  nm_site_price_rules b on a.id = b.site_place_id
+                          LEFT JOIN nm_order_pro_info c on c.product_id =b.id and c.use_date_str =#{today}
+                 where a.site_id = #{siteId} and b.category_id =#{categoryId} and b.day_of_week =#{weekDay} and b.del_flag = 0
         ]]>
     </select>
     <select id="findBySidAndCid" resultType="org.jeecg.modules.app.vo.stadium.StadiumConcertsResponseVO">
@@ -88,19 +84,16 @@
             g.id = #{id} and g.del_flag = 0
     </select>
     <select id="findByConcertsAndTime" resultMap="ConcertsVOResult">
-            <![CDATA[  select b.site_place_id,a.name as site_place_name,
-                              b.id,b.start_time,b.end_time ,b.selling_price,
-                              CASE
-                                  WHEN c.order_status <=1 THEN 1
-                                  WHEN DATE_ADD(CURRENT_TIME(), INTERVAL 8 HOUR) < TIME(b.end_time)
-                           AND TIME_TO_SEC(TIMEDIFF(TIME(b.end_time), TIME(b.start_time)))/2 >
-                           TIME_TO_SEC(TIMEDIFF(TIME(b.end_time), DATE_ADD(CURRENT_TIME(), INTERVAL 8 HOUR)))
-                           THEN 0
-                           ELSE 1
+        <![CDATA[  select b.site_place_id,a.name as site_place_name,
+                          b.id,b.start_time,b.end_time ,b.selling_price,
+                          CASE
+                              WHEN c.order_status <=1 THEN 1
+                              WHEN DATE_ADD(CURRENT_TIME(), INTERVAL 8.2 HOUR) < TIME(b.end_time) THEN 0
+                       ELSE 1
     END AS concertStatus
-    from nm_site_place a
-    left join  nm_site_price_rules b on a.id = b.site_place_id
-    LEFT JOIN nm_order_pro_info c on c.product_id =b.id and c.use_date_str =#{today}
+        from nm_site_place a
+        left join  nm_site_price_rules b on a.id = b.site_place_id
+        LEFT JOIN nm_order_pro_info c on c.product_id =b.id and c.use_date_str =#{today}
     where a.site_id = #{siteId} and b.category_id =#{categoryId} and b.day_of_week =#{weekDay} and b.del_flag = 0
         ]]>
     </select>

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

@@ -7,16 +7,16 @@
         where 1=1
         <if test="receiptPaymentDetailsInfo != null and receiptPaymentDetailsInfo != ''">
             <if test="receiptPaymentDetailsInfo.payType != null">
-            AND a.name =#{receiptPaymentDetailsInfo.payType}
+            AND pay_type =#{receiptPaymentDetailsInfo.payType}
             </if>
             <if test="receiptPaymentDetailsInfo.purseChangeReason != null ">
-                AND a.name = #{receiptPaymentDetailsInfo.purseChangeReason}
+                AND purse_change_reason = #{receiptPaymentDetailsInfo.purseChangeReason}
             </if>
             <if test="receiptPaymentDetailsInfo.moneyType != null">
-                AND a.name = #{receiptPaymentDetailsInfo.moneyType}
+                AND money_type = #{receiptPaymentDetailsInfo.moneyType}
             </if>
             <if test="receiptPaymentDetailsInfo.orgCode != null and receiptPaymentDetailsInfo.orgCode  != ''">
-                AND a.name = #{receiptPaymentDetailsInfo.orgCode}
+                AND org_code = #{receiptPaymentDetailsInfo.orgCode}
             </if>
         </if>
     </select>

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

@@ -27,7 +27,7 @@
         a.create_time ,
         a.update_time ,
         a.receip_payment_details_id ,
-        b.account_status,b.name as siteName,b.cover as siteCover FROM nm_shop_money a
+        b.name as siteName,b.cover as siteCover FROM nm_shop_money a
         inner join nm_site b on a.org_code = b.org_code
         where 1=1
         <if test="shopMoney != null and shopMoney != ''">

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

@@ -12,6 +12,7 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.config.TenantContext;
 import org.jeecg.common.constant.CacheConstant;
 import org.jeecg.common.constant.CommonConstant;
+import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.util.JwtUtil;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.ImportExcelUtil;
@@ -22,7 +23,9 @@ import org.jeecg.modules.system.app.entity.AppSite;
 import org.jeecg.modules.system.app.mapper.AppSiteMapper;
 import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.entity.SysUserDepart;
 import org.jeecg.modules.system.mapper.SysDepartMapper;
+import org.jeecg.modules.system.mapper.SysUserDepartMapper;
 import org.jeecg.modules.system.model.DepartIdModel;
 import org.jeecg.modules.system.model.SysDepartTreeModel;
 import org.jeecg.modules.system.service.ISysDepartService;
@@ -75,6 +78,8 @@ public class SysDepartController {
     private SysDepartMapper sysDepartMapper;
     @Resource
     private AppSiteMapper appSiteMapper;
+    @Resource
+    private SysUserDepartMapper sysUserDepartMapper;
 	/**
 	 * 查询数据 查出我的部门,并以树结构数据格式响应给前端
 	 *
@@ -248,9 +253,16 @@ public class SysDepartController {
 
        Result<SysDepart> result = new Result<SysDepart>();
        SysDepart sysDepart = sysDepartService.getById(id);
-       if(!sysDepartMapper.selectList(Wrappers.<SysDepart>lambdaQuery().eq(SysDepart::getParentId, id)).isEmpty()){
-           result.error500("请先删除子部门");
-       }
+        List<SysDepart> sysDeparts = sysDepartMapper.selectList(Wrappers.<SysDepart>lambdaQuery().eq(SysDepart::getParentId, id));
+        if(sysDeparts.isEmpty()){
+            throw new JeecgBootException("请先删除子部门");
+        }else {
+            sysDeparts.forEach(depart -> {
+                if(!sysUserDepartMapper.selectList(Wrappers.<SysUserDepart>lambdaQuery().eq(SysUserDepart::getId, depart.getId())).isEmpty()){
+                    throw new JeecgBootException("当前部门或下级部门存在用户!");
+                }
+            });
+        }
        if(sysDepart==null) {
            result.error500("未找到对应实体");
        }else {
@@ -275,12 +287,27 @@ public class SysDepartController {
 	@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
 	@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
 	public Result<SysDepart> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-
-		Result<SysDepart> result = new Result<SysDepart>();
+        List<String> strings = List.of(ids.split(","));
+        Result<SysDepart> result = new Result<SysDepart>();
 		if (ids == null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		} else {
+
 			this.sysDepartService.deleteBatchWithChildren(Arrays.asList(ids.split(",")));
+            strings.forEach(sysDepart -> {
+                List<SysDepart> sysDeparts = sysDepartMapper.selectList(Wrappers.<SysDepart>lambdaQuery().eq(SysDepart::getParentId, sysDepart));
+                if(sysDeparts.isEmpty()){
+                    throw new JeecgBootException("请先删除子部门");
+                }else {
+                    sysDeparts.forEach(depart -> {
+                        if(!sysUserDepartMapper.selectList(Wrappers.<SysUserDepart>lambdaQuery().eq(SysUserDepart::getId, depart.getId())).isEmpty()){
+                            throw new JeecgBootException("当前部门或下级部门存在用户!");
+                        }
+                    });
+                }
+                appSiteMapper.delete(Wrappers.<AppSite>lambdaQuery()
+                        .eq(AppSite::getOrgCode, sysDepartMapper.getDepartById(sysDepart).getOrgCode()));
+            });
 			result.success("删除成功!");
 		}
 		return result;