Kaynağa Gözat

feat(app): 新增门店支付信息修改功能并优化课程详情接口

- 新增 editSitePayInfo 接口用于根据门店 ID 修改支付相关信息
- 优化 getCourseInfo 接口,支持传入订单 ID 进行价格规则查询
- 完善拍照验课人员查看接口权限控制逻辑
-修复 JwtFilter 中 token 验证失败时响应已提交的问题- 更新数据库查询逻辑以适配新的业务需求
SheepHy 1 ay önce
ebeveyn
işleme
799a68696b

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

@@ -56,12 +56,23 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
             executeLogin(request, response);
             return true;
         } catch (Exception e) {
-            JwtUtil.responseError(response,401,CommonConstant.TOKEN_IS_INVALID_MSG);
+            if (!isResponseCommitted(response)) {
+                JwtUtil.responseError(response, 401, "token验证失败");
+            } else {
+                log.warn("响应已提交,跳过错误响应写入");
+            }
             return false;
             //throw new AuthenticationException("Token失效,请重新登录", e);
         }
     }
 
+    private boolean isResponseCommitted(ServletResponse response) {
+        if (response instanceof HttpServletResponse) {
+            return ((HttpServletResponse) response).isCommitted();
+        }
+        return false;
+    }
+
     /**
      *
      */

+ 6 - 3
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/commercial/CommercialController.java

@@ -82,9 +82,10 @@ public class CommercialController {
      * @return
      */
     @Operation(summary = "课程详情")
-    @GetMapping("/getCourseInfo/{courseId}")
-    public Result<List<CoursesPriceRulesVO>> getCourseInfo(@Schema(description = "课程ID") @PathVariable("courseId") String courseId) {
-        return Result.OK(appCoureseService.getCourseInfo(courseId));
+    @GetMapping("/getCourseInfo")
+    public Result<List<CoursesPriceRulesVO>> getCourseInfo(@Schema(description = "课程ID") @RequestParam("courseId") String courseId,
+                                                           @Schema(description = "订单ID") @RequestParam("orderId") String orderId) {
+        return Result.OK(appCoureseService.getCourseInfo(courseId,orderId));
     }
 
     /**
@@ -108,9 +109,11 @@ public class CommercialController {
     @Operation(summary = "拍照验课人员查看")
     @PostMapping("/courseQueryUsers")
     public Result<List<AppCoursesVerificationRecord>> courseQueryUsers(@RequestBody CourseQueryUsersForm form) {
+        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         List<AppCoursesVerificationRecord> verificationRecords =
                 appCoursesVerificationRecordService.list(Wrappers.<AppCoursesVerificationRecord>lambdaQuery()
                         .eq(AppCoursesVerificationRecord::getCoursesPriceRuleId, form.getCoursePriceRulesId())
+                        .likeRight(AppCoursesVerificationRecord::getOrderCode, loginUser.getOrgCode())
                         .eq(ObjectUtil.isNotNull(form.getOrPostpone()), AppCoursesVerificationRecord::getOrPostpone, form.getOrPostpone())
                         .eq(ObjectUtil.isNotNull(form.getVerifyStatus()), AppCoursesVerificationRecord::getVerifyStatus, form.getVerifyStatus())
                 );

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

@@ -10,6 +10,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.modules.system.app.dto.AppSiteDTO;
 import org.jeecg.modules.system.app.dto.AppSitePageDTO;
+import org.jeecg.modules.system.app.dto.EditSitePayInfoDTO;
 import org.jeecg.modules.system.app.entity.AppSite;
 import org.jeecg.modules.system.app.service.IAppSitePriceRulesService;
 import org.jeecg.modules.system.app.service.IAppSiteService;
@@ -185,4 +186,18 @@ public class AppSiteController extends JeecgController<AppSite, IAppSiteService>
 		return appSiteService.editSite(appSiteDTO)?Result.OK("操作成功!"):Result.error("操作失败!");
 	}
 
+    /**
+     * <p>根据门店信息ID修改支付信息</p>
+     * @author SheepHy
+     * @param editSitePayInfoDTO,参数为类则包含{@link EditSitePayInfoDTO}
+     * @return 返回值描述,如无返回值则为void 返回值为类则包含{@link Boolean}
+     *
+     */
+    @Operation(summary="根据门店信息ID修改支付信息")
+    @RequestMapping(value = "/editSitePayInfo", method = {RequestMethod.PUT,RequestMethod.POST})
+    public Result<Boolean> editSitePayInfo(@RequestBody EditSitePayInfoDTO editSitePayInfoDTO){
+        return appSiteService.editSitePayInfo(editSitePayInfoDTO)?Result.OK("操作成功!"):Result.error("操作失败!");
+    }
+
+
 }

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

@@ -0,0 +1,19 @@
+package org.jeecg.modules.system.app.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+@Schema(description = "根据门店信息ID修改支付信息入参")
+@Data
+@Accessors(chain = true)
+public class EditSitePayInfoDTO {
+    @Schema(description = "门店信息ID")
+    private String siteId;
+    @Schema(description = "微信支付商户号")
+    private String mchId;
+    @Schema(description = "工商信用代码")
+    private String orgIdCardNum;
+    @Schema(description = "商户名称")
+    private String mchName;
+}

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

@@ -48,15 +48,19 @@
     </select>
     <select id="findByConcerts" 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
-        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
+                        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
         ]]>
     </select>
     <select id="findBySidAndCid" resultType="org.jeecg.modules.app.vo.stadium.StadiumConcertsResponseVO">
@@ -84,16 +88,19 @@
             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) 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 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}
+    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>

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

@@ -52,7 +52,7 @@ public interface IAppCoureseService extends IService<AppCourses> {
 
     List<AppSiteAddressDTO> queryAddressList();
 
-    List<CoursesPriceRulesVO> getCourseInfo(String courseId);
+    List<CoursesPriceRulesVO> getCourseInfo(String courseId,String orderId);
 
     Boolean temporaryCourse(TemporaryCourseForm temporaryCourseForm);
 

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.system.app.dto.AppSiteDTO;
 import org.jeecg.modules.system.app.dto.AppSitePageDTO;
+import org.jeecg.modules.system.app.dto.EditSitePayInfoDTO;
 import org.jeecg.modules.system.app.entity.AppSite;
 
 /**
@@ -48,4 +49,13 @@ public interface IAppSiteService extends IService<AppSite> {
     IPage<AppSiteDTO> querySitePage(AppSitePageDTO dto);
 
     AppSiteDTO queryByTenantId(String tenantId);
+
+    /**
+     * <p>根据门店信息ID修改支付信息</p>
+     * @author SheepHy
+     * @param editSitePayInfoDTO,参数为类则包含{@link EditSitePayInfoDTO}
+     * @return 返回值描述,如无返回值则为void 返回值为类则包含{@link Boolean}
+     *
+     */
+    Boolean editSitePayInfo(EditSitePayInfoDTO editSitePayInfoDTO);
 }

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

@@ -302,12 +302,23 @@ public class AppCoureseServiceImpl extends ServiceImpl<AppCoursesMapper, AppCour
     }
 
     @Override
-    public List<CoursesPriceRulesVO> getCourseInfo(String courseId) {
+    public List<CoursesPriceRulesVO> getCourseInfo(String courseId,String orderId) {
 
-        List<CoursesPriceRulesVO> verifyCourseInfoDTOList = new ArrayList<>();
+        AppOrder appOrder = appOrderMapper.selectById(orderId);
 
-        List<AppCoursesPriceRules> priceRulesList = priceRulesMapper.selectList(Wrappers.lambdaQuery(AppCoursesPriceRules.class).eq(AppCoursesPriceRules::getCoursesId, courseId));
+        List<CoursesPriceRulesVO> verifyCourseInfoDTOList = new ArrayList<>();
 
+        List<AppCoursesPriceRules> priceRulesList;
+        if(appOrder.getOrderType() == 5 && appOrder.getOrderOrFree() == 1){
+            priceRulesList = priceRulesMapper.selectList(Wrappers.lambdaQuery(AppCoursesPriceRules.class)
+                    .eq(AppCoursesPriceRules::getCoursesId, courseId)
+                    .orderByAsc(AppCoursesPriceRules::getStartTime)
+                    .last("LIMIT 1"));
+        }else {
+            priceRulesList = priceRulesMapper.selectList(Wrappers.lambdaQuery(AppCoursesPriceRules.class)
+                    .eq(AppCoursesPriceRules::getCoursesId, courseId)
+                    .orderByAsc(AppCoursesPriceRules::getStartTime));
+        }
 //        Map<Integer, List<AppCoursesPriceRules>> map = priceRulesList.stream().collect(Collectors.groupingBy(AppCoursesPriceRules::getCoursesType));
 
         for (AppCoursesPriceRules priceRules : priceRulesList) {

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

@@ -12,8 +12,10 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.pay.config.WechatConstants;
 import org.jeecg.modules.system.app.dto.AppSiteDTO;
 import org.jeecg.modules.system.app.dto.AppSitePageDTO;
+import org.jeecg.modules.system.app.dto.EditSitePayInfoDTO;
 import org.jeecg.modules.system.app.entity.AppSite;
 import org.jeecg.modules.system.app.entity.AppSitePlace;
 import org.jeecg.modules.system.app.mapper.AppSiteMapper;
@@ -186,6 +188,19 @@ public class AppSiteServiceImpl extends ServiceImpl<AppSiteMapper, AppSite> impl
         return appSiteDTO;
     }
 
+    @Override
+    public Boolean editSitePayInfo(EditSitePayInfoDTO editSitePayInfoDTO) {
+        AppSite appSite = baseMapper.selectById(editSitePayInfoDTO.getSiteId());
+        SysDepart sysDepart = sysDepartMapper.selectOne(Wrappers.<SysDepart>lambdaQuery()
+                .eq(SysDepart::getOrgCode, appSite.getOrgCode()));
+        if(null == sysDepart) throw new JeecgBootException("商户部门不存在", SC_INTERNAL_SERVER_ERROR_500);
+        sysDepart.setMchId(editSitePayInfoDTO.getMchId());
+        sysDepart.setMchName(editSitePayInfoDTO.getMchName());
+        sysDepart.setOrgIdCardNum(editSitePayInfoDTO.getOrgIdCardNum());
+        sysDepart.setAppid(WechatConstants.WECHAT_SUB_APPID);
+        return sysDepartMapper.updateById(sysDepart) > 0;
+    }
+
     /**
      * 权限校验
      *