Selaa lähdekoodia

APP相关提交

yjwang 1 kuukausi sitten
vanhempi
commit
1549a6a76b

+ 2 - 0
fs-service/src/main/java/com/fs/course/mapper/FsUserCourseFavoriteMapper.java

@@ -88,4 +88,6 @@ public interface FsUserCourseFavoriteMapper
             " order by f.create_time desc "+
             "</script>"})
     List<FsUserCourseFavoriteListUVO> selectFsUserCourseFavoriteListUVO(@Param("maps") FsUserCourseListUParam param);
+
+    int deleteBatchFavorite(@Param("courseIds") List<Long> courseIds, @Param("userId") long userId);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/course/mapper/FsUserCourseMapper.java

@@ -328,4 +328,6 @@ public interface FsUserCourseMapper
 
     @Select("select course_id,course_name,description,img_url,second_img secondImg,views from fs_user_course where course_id = #{courseId} and is_del = 0")
     List<FsUserCourseVideoAppletVO> selectFsUserCourseVideoAppletListByCourseId(@Param("courseId") Long courseId);
+
+    int minusBatchFavorite(@Param("courseIds") List<Long> courseIds);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/course/service/IFsUserCourseFavoriteService.java

@@ -71,4 +71,6 @@ public interface IFsUserCourseFavoriteService
 
     List<FsUserCourseFavoriteListUVO> selectFsUserCourseFavoriteListUVO(FsUserCourseListUParam param);
 
+    int deleteBatchFavorite(List<Long> courseIds, long userId);
+
 }

+ 2 - 0
fs-service/src/main/java/com/fs/course/service/IFsUserCourseService.java

@@ -134,4 +134,6 @@ public interface IFsUserCourseService
     List<FsUserCourseVideoAppletVO> selectFsUserCourseVideoAppletListByCourseId(Long courseId);
 
     R createAppCourseSortLink(FsCourseLinkCreateParam fsCourseLinkCreateParam);
+
+    int minusBatchFavorite(List<Long> courseIds);
 }

+ 6 - 0
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseFavoriteServiceImpl.java

@@ -112,4 +112,10 @@ public class FsUserCourseFavoriteServiceImpl implements IFsUserCourseFavoriteSer
     public List<FsUserCourseFavoriteListUVO> selectFsUserCourseFavoriteListUVO(FsUserCourseListUParam param) {
         return fsUserCourseFavoriteMapper.selectFsUserCourseFavoriteListUVO(param);
     }
+
+    @Override
+    public int deleteBatchFavorite(List<Long> courseIds, long userId) {
+        return fsUserCourseFavoriteMapper.deleteBatchFavorite(courseIds,userId);
+    }
+
 }

+ 5 - 0
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseServiceImpl.java

@@ -1028,4 +1028,9 @@ public class FsUserCourseServiceImpl implements IFsUserCourseService
         }
         return result.toString();
     }
+
+    @Override
+    public int minusBatchFavorite(List<Long> courseIds) {
+        return fsUserCourseMapper.minusBatchFavorite(courseIds);
+    }
 }

+ 19 - 19
fs-service/src/main/java/com/fs/hisStore/util/DrugComponentAnalyzer.java

@@ -42,25 +42,25 @@ public class DrugComponentAnalyzer {
     // 词典数据集合
     private static final Set<String> DRUG_DICT = new HashSet<>();
 
-    static {
-        try {
-            // 1. 校验文件是否存在
-            File drugFile = new File(DRUG_FILE_PATH);
-            if (!drugFile.exists()) {
-                throw new FileNotFoundException("词典文件不存在:" + DRUG_FILE_PATH);
-            }
-            // 2. 核心逻辑:给 WordDictionary 加载词典文件(依赖 Path)
-            Path path = drugFile.toPath();
-            WordDictionary.getInstance().loadUserDict(path);
-            //这个是线下的使用方式
-//            ClassPathResource resource = new ClassPathResource("drug.txt");
-//            System.out.println("文件路径:"+resource.getFile().getPath());
-//            Path linePath = resource.getFile().toPath();
-//            WordDictionary.getInstance().loadUserDict(linePath);
-        } catch (Exception e) {
-            throw new RuntimeException("加载词典失败(路径:" + DRUG_FILE_PATH + ")", e);
-        }
-    }
+//    static {
+//        try {
+//            // 1. 校验文件是否存在
+//            File drugFile = new File(DRUG_FILE_PATH);
+//            if (!drugFile.exists()) {
+//                throw new FileNotFoundException("词典文件不存在:" + DRUG_FILE_PATH);
+//            }
+//            // 2. 核心逻辑:给 WordDictionary 加载词典文件(依赖 Path)
+//            Path path = drugFile.toPath();
+//            WordDictionary.getInstance().loadUserDict(path);
+//            //这个是线下的使用方式
+////            ClassPathResource resource = new ClassPathResource("drug.txt");
+////            System.out.println("文件路径:"+resource.getFile().getPath());
+////            Path linePath = resource.getFile().toPath();
+////            WordDictionary.getInstance().loadUserDict(linePath);
+//        } catch (Exception e) {
+//            throw new RuntimeException("加载词典失败(路径:" + DRUG_FILE_PATH + ")", e);
+//        }
+//    }
 
     /**
      * 拆分药品成分(过滤停用词,仅保留有效成分)

+ 2 - 2
fs-service/src/main/java/com/fs/hospital580/dto/PreDemandDto.java

@@ -29,8 +29,8 @@ public class PreDemandDto extends CommonDto implements Serializable {
     private String imgList;                 // 图片附件(url形式,最多三个),多个以英文逗号,隔开
     private String thirdReturnUrl;          // 结束问诊后跳回三方的地址
 
-    public void setThirdReturnUrl(Long orderId) {
-        this.thirdReturnUrl = "/pages_user/shopping/storeOrderDetail?id="+orderId;
+    public void setThirdReturnUrl(Long orderId, Byte souceFrom) {
+        this.thirdReturnUrl = "/pages_user/shopping/storeOrderDetail?id="+orderId+"&thirdPlatform="+souceFrom;
     }
 }
 

+ 3 - 0
fs-service/src/main/resources/application-config-dev-yjb.yml

@@ -9,6 +9,9 @@ logging:
     me.chanjar.weixin: DEBUG
     com.fs: debug
 wx:
+  open:
+    appId: wx7796a33a71912e32
+    secret: 51601ec1e3247fe1615ef7b55baf95c7
   miniapp:
     configs:
       - appid: wx29d26f63f836be7f

+ 8 - 0
fs-service/src/main/resources/mapper/course/FsUserCourseFavoriteMapper.xml

@@ -66,4 +66,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{favoriteId}
         </foreach>
     </delete>
+
+    <delete id="deleteBatchFavorite">
+        delete from fs_user_course_favorite  where course_id in
+        <foreach collection="courseIds" item="courseId" separator="," open="(" close=")">
+            #{courseId}
+        </foreach>
+        and user_id=#{userId}
+    </delete>
 </mapper>

+ 7 - 0
fs-service/src/main/resources/mapper/course/FsUserCourseMapper.xml

@@ -321,4 +321,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 <!--        ORDER BY-->
 <!--        c.course_id-->
 <!--    </select>-->
+
+    <update id="minusBatchFavorite">
+        update fs_user_course set favorite_num=favorite_num-1 where course_id in
+        <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
+            #{courseId}
+        </foreach>
+    </update>
 </mapper>

+ 11 - 0
fs-user-app/src/main/java/com/fs/app/controller/CourseController.java

@@ -341,4 +341,15 @@ public class CourseController extends  AppBaseController{
     public void updateUrl(){
         tencentCloudCosService.updateUrl();
     }
+
+    @Login
+    @ApiOperation("批量取消收藏")
+    @PostMapping("/cancelFavorite")
+    @Transactional
+    public R cancelFavorite(@RequestBody List<Long> courseIds){
+        //取消点赞
+        courseFavoriteService.deleteBatchFavorite(courseIds,Long.parseLong(getUserId()));
+        courseService.minusBatchFavorite(courseIds);
+        return R.ok("已取消收藏");
+    }
 }

+ 1 - 1
fs-user-app/src/main/java/com/fs/app/facade/impl/Hospital580FacadeServiceImpl.java

@@ -139,7 +139,7 @@ public class Hospital580FacadeServiceImpl implements Hospital580FacadeService {
         BeanUtil.copyProperties(order, dto);
         dto.setBizOrderId(order.getPreId().toString());
         dto.setMemberId(order.getUserFamilyPhone());
-        dto.setThirdReturnUrl(vo.getStoreOrderId());
+        dto.setThirdReturnUrl(vo.getStoreOrderId(), order.getSouceFrom());
         dto.setBeforeAiDataList(vo.getBeforeAiDataList().stream().map(item -> {
             BeforeAiData textRecordDto = new BeforeAiData();
             textRecordDto.setSubjectId(item.getSubjectId());

+ 61 - 61
fs-user-app/src/main/java/com/fs/app/redis/OrderExpireHandler.java

@@ -59,66 +59,66 @@ public class OrderExpireHandler {
     private IFsStoreOrderScrmService fsStoreOrderService;
 
 
-    @Scheduled(fixedDelay = 60_000) // 每分钟跑一次
-    public void handleUnpaidOrders() {
-        // 全局锁:防止多实例同时执行任务(粒度粗,仅控制任务入口)
-        RLock globalLock = redissonClient.getLock("order-expire-handler-global-lock");
-        try {
-            if (globalLock.tryLock(LOCK_WAIT_TIME, LOCK_LEASE_TIME, TimeUnit.SECONDS)) {
-                LocalDateTime now = LocalDateTime.now();
-                log.info("开始处理超时未支付订单,当前时间:{}", now);
-
-                // 获取配置时间
-                String json = configService.selectConfigByKey("store.config");
-                com.fs.store.config.StoreConfig config = JSONUtil.toBean(json, com.fs.store.config.StoreConfig.class);
-                if (config == null || config.getUnPayTime() == null) {
-                    log.error("未获取到门店配置,unPayTime为空");
-                    return;
-                }
-
-                // 查询所有待处理订单
-                Map<String, Object> params = new HashMap<>(3);
-                params.put("now", now);
-                params.put("prescribeTimeoutMinutes", PRESCRIBE_TIMEOUT_MINUTES);
-                params.put("unPayTime", config.getUnPayTime());
-                List<FsStoreOrderScrm> orders = orderScrmMapper.selectTimeoutUnpaidOrders(params);
-
-                if (CollectionUtils.isEmpty(orders)) {
-                    log.info("暂无超时未支付订单需要处理");
-                    return;
-                }
-                log.info("共查询到{}个超时未支付订单,开始逐个处理", orders.size());
-
-                for (FsStoreOrderScrm order : orders) {
-                    try {
-                        processExpiredOrder(order);
-                        log.info("订单{}处理完成,状态已更新为-3", order.getId());
-                    } catch (Exception e) {
-                        log.error("处理订单{}失败", order.getId(), e);
-                        // 记录失败订单,可后续补偿
-                        // failOrderService.recordFailOrder(order.getId(), "库存恢复失败:" + e.getMessage());
-                    }
-                }
-            } else {
-                log.warn("获取全局分布式锁失败,跳过本次订单处理");
-            }
-        } catch (InterruptedException e) {
-            Thread.currentThread().interrupt();
-            log.error("获取全局锁时线程中断", e);
-        } finally {
-            if (globalLock.isHeldByCurrentThread()) {
-                globalLock.unlock();
-            }
-        }
-    }
-    @Transactional(rollbackFor = Exception.class)
-    void processExpiredOrder(FsStoreOrderScrm order) {
-        Long orderId = order.getId();
-        if (orderId == null) {
-            log.warn("订单ID为空,跳过处理");
-            return;
-        }
-        fsStoreOrderService.cancelOrderReuse(order);
-    }
+//    @Scheduled(fixedDelay = 60_000) // 每分钟跑一次
+//    public void handleUnpaidOrders() {
+//        // 全局锁:防止多实例同时执行任务(粒度粗,仅控制任务入口)
+//        RLock globalLock = redissonClient.getLock("order-expire-handler-global-lock");
+//        try {
+//            if (globalLock.tryLock(LOCK_WAIT_TIME, LOCK_LEASE_TIME, TimeUnit.SECONDS)) {
+//                LocalDateTime now = LocalDateTime.now();
+//                log.info("开始处理超时未支付订单,当前时间:{}", now);
+//
+//                // 获取配置时间
+//                String json = configService.selectConfigByKey("store.config");
+//                com.fs.store.config.StoreConfig config = JSONUtil.toBean(json, com.fs.store.config.StoreConfig.class);
+//                if (config == null || config.getUnPayTime() == null) {
+//                    log.error("未获取到门店配置,unPayTime为空");
+//                    return;
+//                }
+//
+//                // 查询所有待处理订单
+//                Map<String, Object> params = new HashMap<>(3);
+//                params.put("now", now);
+//                params.put("prescribeTimeoutMinutes", PRESCRIBE_TIMEOUT_MINUTES);
+//                params.put("unPayTime", config.getUnPayTime());
+//                List<FsStoreOrderScrm> orders = orderScrmMapper.selectTimeoutUnpaidOrders(params);
+//
+//                if (CollectionUtils.isEmpty(orders)) {
+//                    log.info("暂无超时未支付订单需要处理");
+//                    return;
+//                }
+//                log.info("共查询到{}个超时未支付订单,开始逐个处理", orders.size());
+//
+//                for (FsStoreOrderScrm order : orders) {
+//                    try {
+//                        processExpiredOrder(order);
+//                        log.info("订单{}处理完成,状态已更新为-3", order.getId());
+//                    } catch (Exception e) {
+//                        log.error("处理订单{}失败", order.getId(), e);
+//                        // 记录失败订单,可后续补偿
+//                        // failOrderService.recordFailOrder(order.getId(), "库存恢复失败:" + e.getMessage());
+//                    }
+//                }
+//            } else {
+//                log.warn("获取全局分布式锁失败,跳过本次订单处理");
+//            }
+//        } catch (InterruptedException e) {
+//            Thread.currentThread().interrupt();
+//            log.error("获取全局锁时线程中断", e);
+//        } finally {
+//            if (globalLock.isHeldByCurrentThread()) {
+//                globalLock.unlock();
+//            }
+//        }
+//    }
+//    @Transactional(rollbackFor = Exception.class)
+//    void processExpiredOrder(FsStoreOrderScrm order) {
+//        Long orderId = order.getId();
+//        if (orderId == null) {
+//            log.warn("订单ID为空,跳过处理");
+//            return;
+//        }
+//        fsStoreOrderService.cancelOrderReuse(order);
+//    }
 
 }