Bläddra i källkod

查出对应小程序

xw 1 dag sedan
förälder
incheckning
a3674758fe

+ 41 - 42
fs-admin/src/main/java/com/fs/hisStore/controller/FsStoreHealthOrderScrmController.java

@@ -3,6 +3,7 @@ package com.fs.hisStore.controller;
 
 import cn.hutool.core.bean.BeanUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
@@ -34,6 +35,8 @@ import com.fs.hisStore.vo.FsStoreOrderExportVO;
 import com.fs.hisStore.vo.FsStoreOrderItemExportVO;
 import com.fs.hisStore.vo.FsStoreOrderVO;
 import com.fs.hisStore.vo.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -46,6 +49,7 @@ import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
+@Api(tags = "健康商城订单管理")
 @RestController
 @RequestMapping("/store/store/storeOrder")
 public class FsStoreHealthOrderScrmController extends BaseController {
@@ -417,27 +421,7 @@ public class FsStoreHealthOrderScrmController extends BaseController {
                 if(shipmentType == null){
                     shipmentType = 2;
                 }
-                
-                // 从 fs_course_play_source_config 表查询所有小程序的appId
-                List<FsCoursePlaySourceConfig> configList = coursePlaySourceConfigService.lambdaQuery()
-                        .eq(FsCoursePlaySourceConfig::getType, 1)  // 1=小程序
-                        .eq(FsCoursePlaySourceConfig::getIsDel, 0)  // 未删除
-                        .list();
-                
-                // 提取所有appId,如果查不到就使用传入的miniAppId
-                String appId = miniAppId;
-                if (configList != null && !configList.isEmpty()) {
-                    // 优先查找与传入miniAppId匹配的
-                    boolean found = configList.stream()
-                            .anyMatch(config -> miniAppId.equals(config.getAppid()));
-                    if (!found && StringUtils.isNotEmpty(configList.get(0).getAppid())) {
-                        // 如果传入的miniAppId在数据库中不存在,使用第一个
-                        appId = configList.get(0).getAppid();
-                        logger.warn("传入的miniAppId {} 不存在,使用数据库中的appId: {}", miniAppId, appId);
-                    }
-                }
-                
-               return fsStoreOrderService.importDeliveryNoteExpress(dtoList,appId,shipmentType);
+               return fsStoreOrderService.importDeliveryNoteExpress(dtoList,miniAppId,shipmentType);
             }else {
                 R.error("操作失败,导入数据不能小于1条!");
             }
@@ -524,27 +508,7 @@ public class FsStoreHealthOrderScrmController extends BaseController {
                 if(dtoList.size() > 200){
                     R.error("操作失败,导入数据不能大于200条!");
                 }
-                
-                // 从 fs_course_play_source_config 表查询所有小程序的appId
-                List<FsCoursePlaySourceConfig> configList = coursePlaySourceConfigService.lambdaQuery()
-                        .eq(FsCoursePlaySourceConfig::getType, 1)  // 1=小程序
-                        .eq(FsCoursePlaySourceConfig::getIsDel, 0)  // 未删除
-                        .list();
-                
-                // 提取所有appId,如果查不到就使用传入的miniAppId
-                String appId = miniAppId;
-                if (configList != null && !configList.isEmpty()) {
-                    // 优先查找与传入miniAppId匹配的
-                    boolean found = configList.stream()
-                            .anyMatch(config -> miniAppId.equals(config.getAppid()));
-                    if (!found && StringUtils.isNotEmpty(configList.get(0).getAppid())) {
-                        // 如果传入的miniAppId在数据库中不存在,使用第一个
-                        appId = configList.get(0).getAppid();
-                        logger.warn("传入的miniAppId {} 不存在,使用数据库中的appId: {}", miniAppId, appId);
-                    }
-                }
-                
-                return fsStoreOrderService.importDeliveryNoteExpress(dtoList,appId);
+                return fsStoreOrderService.importDeliveryNoteExpress(dtoList,miniAppId);
             }else {
                 R.error("操作失败,导入数据不能小于1条!");
             }
@@ -554,6 +518,41 @@ public class FsStoreHealthOrderScrmController extends BaseController {
         return R.ok();
     }
 
+    /**
+     * 查询小程序列表(用于下拉选择)
+     *
+     */
+    @ApiOperation("查询小程序列表")
+    @GetMapping("/getMiniProgramList")
+    public AjaxResult getMiniProgramList()
+    {
+        try {
+            // 查询所有未删除的小程序配置(排除公众号)
+            QueryWrapper<FsCoursePlaySourceConfig> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("is_del", 0)  // 未删除
+                       .ne("type", 2)      // 不是公众号
+                       .orderByDesc("create_time");
+            
+            List<FsCoursePlaySourceConfig> configList = coursePlaySourceConfigService.list(queryWrapper);
+            
+            List<FsMiniProgramOptionVO> optionList = new java.util.ArrayList<>();
+            for (FsCoursePlaySourceConfig config : configList) {
+                FsMiniProgramOptionVO vo = new FsMiniProgramOptionVO();
+                vo.setId(config.getId());
+                vo.setName(config.getName());
+                vo.setAppid(config.getAppid());
+                vo.setType(config.getType());
+                optionList.add(vo);
+            }
+            
+            logger.info("查询小程序列表成功,数量:{}", optionList.size());
+            return AjaxResult.success(optionList);
+        } catch (Exception e) {
+            logger.error("查询小程序列表失败", e);
+            return AjaxResult.error("查询小程序列表失败:" + e.getMessage());
+        }
+    }
+
 
 //    /**
 //     * 发货单导出接口