Преглед изворни кода

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	fs-service/src/main/java/com/fs/sop/service/IQwSopTempRulesService.java
#	fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempRulesServiceImpl.java
吴树波 пре 5 дана
родитељ
комит
4c5097c9b0
28 измењених фајлова са 392 додато и 151 уклоњено
  1. 30 39
      fs-admin/src/main/java/com/fs/web/controller/system/SysConfigController.java
  2. 1 6
      fs-doctor-app/src/main/java/com/fs/app/controller/FsUserInformationCollectionController.java
  3. 19 0
      fs-service/src/main/java/com/fs/course/config/RandomRedPacketConfig.java
  4. 28 0
      fs-service/src/main/java/com/fs/course/config/RandomRedPacketRule.java
  5. 6 0
      fs-service/src/main/java/com/fs/course/domain/FsUserCourseVideo.java
  6. 1 1
      fs-service/src/main/java/com/fs/course/mapper/FsUserCourseVideoMapper.java
  7. 9 0
      fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseServiceImpl.java
  8. 85 1
      fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java
  9. 6 0
      fs-service/src/main/java/com/fs/course/vo/FsUserCourseVideoQVO.java
  10. 4 0
      fs-service/src/main/java/com/fs/erp/dto/sdk/df/DfClient.java
  11. 2 0
      fs-service/src/main/java/com/fs/his/service/IFsUserInformationCollectionService.java
  12. 27 0
      fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java
  13. 36 0
      fs-service/src/main/java/com/fs/his/service/impl/FsUserInformationCollectionServiceImpl.java
  14. 2 0
      fs-service/src/main/java/com/fs/his/vo/FsUserInformationCollectionAndPatientVO.java
  15. 5 0
      fs-service/src/main/java/com/fs/qw/param/FsUserCourseRedPageParam.java
  16. 3 0
      fs-service/src/main/java/com/fs/sop/service/IQwSopTempContentService.java
  17. 11 0
      fs-service/src/main/java/com/fs/sop/service/IQwSopTempDayService.java
  18. 3 0
      fs-service/src/main/java/com/fs/sop/service/IQwSopTempRulesService.java
  19. 7 0
      fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempContentServiceImpl.java
  20. 23 0
      fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempDayServiceImpl.java
  21. 7 0
      fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempRulesServiceImpl.java
  22. 60 45
      fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempServiceImpl.java
  23. 3 0
      fs-service/src/main/resources/application-dev.yml
  24. 3 0
      fs-service/src/main/resources/mapper/course/FsUserCourseVideoMapper.xml
  25. 1 1
      fs-service/src/main/resources/mapper/his/FsUserInformationCollectionMapper.xml
  26. 3 2
      fs-service/src/main/resources/mapper/hisStore/FsStoreOrderScrmMapper.xml
  27. 2 18
      fs-user-app/src/main/java/com/fs/app/controller/CompanyUserController.java
  28. 5 38
      fs-user-app/src/main/java/com/fs/app/controller/FsUserInformationCollectionController.java

+ 30 - 39
fs-admin/src/main/java/com/fs/web/controller/system/SysConfigController.java

@@ -30,13 +30,10 @@ import com.fs.system.service.ISysConfigService;
 
 /**
  * 参数配置 信息操作处理
- *
-
  */
 @RestController
 @RequestMapping("/system/config")
-public class SysConfigController extends BaseController
-{
+public class SysConfigController extends BaseController {
     @Autowired
     private ISysConfigService configService;
     @Autowired
@@ -47,8 +44,7 @@ public class SysConfigController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:config:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysConfig config)
-    {
+    public TableDataInfo list(SysConfig config) {
         startPage();
         List<SysConfig> list = configService.selectConfigList(config);
         return getDataTable(list);
@@ -57,8 +53,7 @@ public class SysConfigController extends BaseController
     @Log(title = "参数管理", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:config:export')")
     @GetMapping("/export")
-    public AjaxResult export(SysConfig config)
-    {
+    public AjaxResult export(SysConfig config) {
         List<SysConfig> list = configService.selectConfigList(config);
         ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
         return util.exportExcel(list, "参数数据");
@@ -69,8 +64,7 @@ public class SysConfigController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:config:query')")
     @GetMapping(value = "/{configId}")
-    public AjaxResult getInfo(@PathVariable Long configId)
-    {
+    public AjaxResult getInfo(@PathVariable Long configId) {
         return AjaxResult.success(configService.selectConfigById(configId));
     }
 
@@ -78,8 +72,7 @@ public class SysConfigController extends BaseController
      * 根据参数键名查询参数值
      */
     @GetMapping(value = "/configKey/{configKey}")
-    public AjaxResult getConfigKey(@PathVariable String configKey)
-    {
+    public AjaxResult getConfigKey(@PathVariable String configKey) {
         return AjaxResult.success(configService.selectConfigByKey(configKey));
     }
 
@@ -90,10 +83,8 @@ public class SysConfigController extends BaseController
     @Log(title = "参数管理", businessType = BusinessType.INSERT)
     @PostMapping
     @RepeatSubmit
-    public AjaxResult add(@Validated @RequestBody SysConfig config)
-    {
-        if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
-        {
+    public AjaxResult add(@Validated @RequestBody SysConfig config) {
+        if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
             return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
         }
         config.setCreateBy(getUsername());
@@ -106,10 +97,8 @@ public class SysConfigController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:config:edit')")
     @Log(title = "参数管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysConfig config)
-    {
-        if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
-        {
+    public AjaxResult edit(@Validated @RequestBody SysConfig config) {
+        if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
             return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
         }
         config.setUpdateBy(getUsername());
@@ -122,8 +111,7 @@ public class SysConfigController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:config:remove')")
     @Log(title = "参数管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{configIds}")
-    public AjaxResult remove(@PathVariable Long[] configIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] configIds) {
         configService.deleteConfigByIds(configIds);
         return success();
     }
@@ -134,50 +122,53 @@ public class SysConfigController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:config:remove')")
     @Log(title = "参数管理", businessType = BusinessType.CLEAN)
     @DeleteMapping("/refreshCache")
-    public AjaxResult refreshCache()
-    {
+    public AjaxResult refreshCache() {
         configService.resetConfigCache();
         return AjaxResult.success();
     }
 
     @GetMapping(value = "/getConfigByKey/{configKey}")
-    public AjaxResult getConfigByKey(@PathVariable String configKey)
-    {
-        SysConfig config=configService.selectConfigByConfigKey(configKey);
+    public AjaxResult getConfigByKey(@PathVariable String configKey) {
+        SysConfig config = configService.selectConfigByConfigKey(configKey);
         return AjaxResult.success(config);
     }
 
     @PostMapping(value = "/updateConfigByKey")
     @Log(title = "更改参数", businessType = BusinessType.UPDATE)
     @RepeatSubmit
-    public AjaxResult updateConfigByKey(@Validated @RequestBody SysConfig config)
-    {
+    public AjaxResult updateConfigByKey(@Validated @RequestBody SysConfig config) {
         config.setCreateBy(SecurityUtils.getUsername());
-        return toAjax(configService.updateConfig(config));
+        //修复只能更新的BUG
+        if (null != config.getConfigId()) {
+            return toAjax(configService.updateConfig(config));
+        } else {
+            return toAjax(configService.insertConfig(config));
+        }
+
     }
 
 
     /**
      * 启用-关闭小程序销售管理
+     *
      * @param bock
      * @return
      */
     @GetMapping("/updateIsTownOn")
-    public R queryIsTownOn(String bock, String appId)
-    {
-        String key = appId+"start_status_001";
+    public R queryIsTownOn(String bock, String appId) {
+        String key = appId + "start_status_001";
         String start = redisCache.getCacheObject(key);
-        if (ObjectUtil.isNotEmpty(bock)){
-            if (bock.equals("001")){
-                redisCache.setCacheObject(key,bock);
+        if (ObjectUtil.isNotEmpty(bock)) {
+            if (bock.equals("001")) {
+                redisCache.setCacheObject(key, bock);
                 return R.ok("调整成功");
-            }else if (bock.equals("002")){
-                redisCache.setCacheObject(key,bock);
+            } else if (bock.equals("002")) {
+                redisCache.setCacheObject(key, bock);
                 return R.ok("调整成功");
             }
 
         }
-        return R.ok().put("date",start);
+        return R.ok().put("date", start);
     }
 
 }

+ 1 - 6
fs-doctor-app/src/main/java/com/fs/app/controller/FsUserInformationCollectionController.java

@@ -2,11 +2,8 @@ package com.fs.app.controller;
 
 import com.fs.common.core.domain.R;
 import com.fs.his.domain.FsUserInformationCollection;
-import com.fs.his.dto.FsUserInformationCollectionDTO;
-import com.fs.his.param.CollectionInfoConfirmParam;
 import com.fs.his.param.UserInformationDoctorType2Param;
 import com.fs.his.service.IFsUserInformationCollectionService;
-import com.fs.his.vo.FsInquiryOrderListPDVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,10 +18,8 @@ public class FsUserInformationCollectionController extends  AppBaseController {
     private IFsUserInformationCollectionService fsUserInformationCollectionService;
     @GetMapping("/getUserInformation")
     public R getUserInformation(@RequestParam("id") Long id) {
-        FsUserInformationCollectionDTO fsUserInformationCollection = fsUserInformationCollectionService.selectFsUserInformationCollectionDTOById(id);
 
-
-        return R.ok().put("data", fsUserInformationCollection);
+        return R.ok().put("data", fsUserInformationCollectionService.selectFsUserInformationCollectionVoById(id));
     }
     //医生确认
     @PostMapping("/doctorConfirm")

+ 19 - 0
fs-service/src/main/java/com/fs/course/config/RandomRedPacketConfig.java

@@ -0,0 +1,19 @@
+package com.fs.course.config;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author MixLiu
+ * @date 2025/11/27 下午2:07)
+ */
+@Data
+public class RandomRedPacketConfig {
+    /**
+     * 是否开启随机红包
+     */
+    private Boolean enableRandomRedpacket;
+
+    private List<RandomRedPacketRule> rules;
+}

+ 28 - 0
fs-service/src/main/java/com/fs/course/config/RandomRedPacketRule.java

@@ -0,0 +1,28 @@
+package com.fs.course.config;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author MixLiu
+ * @date 2025/11/27 下午2:08)
+ */
+
+@Data
+public class RandomRedPacketRule {
+    /**
+     * 最小金额
+     */
+    private BigDecimal minAmount;
+
+    /**
+     * 最大金额
+     */
+    private BigDecimal maxAmount;
+
+    /**
+     * 权重
+     */
+    private Integer weight;
+}

+ 6 - 0
fs-service/src/main/java/com/fs/course/domain/FsUserCourseVideo.java

@@ -78,6 +78,12 @@ public class FsUserCourseVideo extends BaseEntity
     private Integer uploadType;
 
     private BigDecimal redPacketMoney;
+
+    /**
+     * 随机红包配置
+     */
+    private String randomRedPacketRules;
+
     private Long fileSize;//文件大小  字节
     private String fileKey;//文件key 对用存储桶
     private String round;//轮次

+ 1 - 1
fs-service/src/main/java/com/fs/course/mapper/FsUserCourseVideoMapper.java

@@ -62,7 +62,7 @@ public interface FsUserCourseVideoMapper
     public int updateFsUserCourseVideo(FsUserCourseVideo fsUserCourseVideo);
 
     @Update("<script> " +
-            "update fs_user_course_video set red_packet_money=#{data.redPacketMoney} where course_id=#{data.courseId} " +
+            "update fs_user_course_video set red_packet_money=#{data.redPacketMoney}, random_red_packet_rules = #{data.randomRedPacketRules} where course_id=#{data.courseId} " +
             "</script>")
     public int updateFsUserCourseRedPage(@Param("data") FsUserCourseRedPageParam courseRedPageParam);
 

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

@@ -15,6 +15,7 @@ import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
+import com.fs.common.utils.CloudHostUtils;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.StringUtils;
 import com.fs.company.domain.CompanyTag;
@@ -776,6 +777,11 @@ public class FsUserCourseServiceImpl implements IFsUserCourseService
         link.setUpdateTime(calendar.getTime());
         int i = fsCourseLinkMapper.insertFsCourseLink(link);
         if (i > 0){
+            if (CloudHostUtils.hasCloudHostName("中康")){
+                String domainName = getDomainName(param.getCompanyUserId(), config);
+                String sortLink = domainName + link.getRealLink().replace("/#","");
+                return R.ok().put("url", sortLink).put("link", random);
+            }
             String domainName = getDomainName(param.getCompanyUserId(), config);
             String sortLink = domainName + appShortLink + link.getLink();
             return R.ok().put("url", sortLink).put("link", random);
@@ -783,6 +789,9 @@ public class FsUserCourseServiceImpl implements IFsUserCourseService
         return R.error("生成链接失败!");
     }
 
+    public static void main(String[] args) {
+        System.out.println(appRealLink.replace("/#", ""));
+    }
     /**
      * 修改课堂配置
      */

+ 85 - 1
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -2,6 +2,7 @@ package com.fs.course.service.impl;
 
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -33,6 +34,8 @@ import com.fs.company.mapper.CompanyUserMapper;
 import com.fs.company.service.ICompanyService;
 import com.fs.config.cloud.CloudHostProper;
 import com.fs.course.config.CourseConfig;
+import com.fs.course.config.RandomRedPacketConfig;
+import com.fs.course.config.RandomRedPacketRule;
 import com.fs.course.domain.*;
 import com.fs.course.dto.CoursePackageDTO;
 import com.fs.course.mapper.*;
@@ -1400,7 +1403,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 
         // 判断来源是否是app,如是app,则发放积分奖励
         int sourceApp = 3;
-        if(sourceApp == param.getSource()){
+        if(sourceApp == param.getSource()&&!CloudHostUtils.hasCloudHostName("中康")){
             return sendIntegralReward(param, user, log, config);
         }
 
@@ -1444,6 +1447,33 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
             amount = redPackage.getRedPacketMoney();
         } else if (video != null) {
             amount = video.getRedPacketMoney();
+            //是否开启了随机红包
+            String json = configService.selectConfigByKey("randomRedpacket:config");
+            if(StringUtils.isNotBlank(json)){
+                RandomRedPacketConfig randomRedPacket = JSONUtil.toBean(json, RandomRedPacketConfig.class);
+                //是否开启拼手气红包
+                if(null != randomRedPacket && randomRedPacket.getEnableRandomRedpacket()){
+                    BigDecimal randomMoney = BigDecimal.ZERO;
+                    //优先读取课程配置随机红包规则
+                    String randomRedPacketRules = video.getRandomRedPacketRules();
+                    if(StringUtils.isNotBlank(randomRedPacketRules) ){
+                        JSONArray array = JSONObject.parseArray(randomRedPacketRules);
+                        List<RandomRedPacketRule> rules = new ArrayList<>();
+                        for (Object o : array) {
+                            rules.add(JSONObject.toJavaObject((JSONObject) o, RandomRedPacketRule.class));
+                        }
+                        randomMoney = getRandomMoneyByRules(rules);
+                    }
+                    //如果课程没有配置 读取后台默认随机规则
+                    else{
+                        randomMoney = getRandomMoneyByRules(randomRedPacket.getRules());
+                    }
+                    //兼容拼手气红包报错情况的发放红包情况
+                    if(BigDecimal.ZERO.compareTo(randomMoney) < 0){
+                        amount = randomMoney;
+                    }
+                }
+            }
         }
 
         // 准备发送红包参数
@@ -3613,6 +3643,60 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         return R.ok();
     }
 
+    /**
+     * 根据匹配规则返回随机红包值(需求是概率独立计算)
+     * @param rules
+     * @return
+     */
+    private BigDecimal getRandomMoneyByRules(List<RandomRedPacketRule> rules) {
+        try {
+
+            if (CollectionUtils.isEmpty(rules)) {
+                logger.error("随机红包规则列表为空,不予处理");
+//            throw new ServiceException("随机红包规则列表为空");
+            }
+            // 计算总权重
+            int totalWeight = rules.stream()
+                    .mapToInt(RandomRedPacketRule::getWeight)
+                    .sum();
+            // 根据权重随机选择规则
+            Random random = new Random();
+            int randomPoint = random.nextInt(totalWeight);
+
+            RandomRedPacketRule selectedRule = null;
+            int currentWeight = 0;
+
+            for (RandomRedPacketRule rule : rules) {
+                currentWeight += rule.getWeight();
+                if (randomPoint < currentWeight) {
+                    selectedRule = rule;
+                    break;
+                }
+            }
+
+            // 如果因为计算精度问题没有选中规则,默认选第一个
+            if (selectedRule == null) {
+                selectedRule = rules.get(0);
+            }
+            // 在选中规则的范围内生成随机金额
+            BigDecimal maxAmount = selectedRule.getMaxAmount();
+            BigDecimal minAmount = selectedRule.getMinAmount();
+            // 如果最大最小金额相等,直接返回该金额
+            if (maxAmount.compareTo(minAmount) == 0) {
+                return maxAmount;
+            }
+            // 生成随机金额
+            BigDecimal range = maxAmount.subtract(minAmount);
+            BigDecimal randomValue = range.multiply(BigDecimal.valueOf(random.nextDouble()));
+            BigDecimal result = minAmount.add(randomValue);
+            // 保留两位小数,四舍五入
+            return result.setScale(2, RoundingMode.HALF_UP);
+        } catch (Exception e) {
+            logger.error("获取拼手气红包金额异常:{}",rules, e);
+        }
+
+        return BigDecimal.ZERO;
+    }
 
 
 }

+ 6 - 0
fs-service/src/main/java/com/fs/course/vo/FsUserCourseVideoQVO.java

@@ -68,6 +68,12 @@ public class FsUserCourseVideoQVO extends BaseEntity {
     private String lineThree; //线路三 华为云obs
     private Integer uploadType;
     private String redPacketMoney;
+
+    /**
+     * 随机红包配置
+     */
+    private String randomRedPacketRules;
+
     private Long fileSize;//文件大小  字节
     private String fileKey;//文件key 对用存储桶
     private String round;//轮次

+ 4 - 0
fs-service/src/main/java/com/fs/erp/dto/sdk/df/DfClient.java

@@ -85,6 +85,10 @@ public class DfClient {
 
 	public String execute(RequestUrlEnum request, Map<String, Object> params,Long dfAccountId) throws IOException {
 		FsDfAccount dfAccount = fsDfAccountMapper.selectFsDfAccountById(dfAccountId);
+		if (dfAccount == null){
+			log.error("未查询到代服账户,传参:请求={},参数-{},代服id-{}",JSON.toJSONString(request),JSON.toJSONString(params),dfAccountId);
+			return null;
+		}
 		String appkey = dfAccount.getDfAppKey();
 		String appsecret = dfAccount.getDfAppsecret();
 		String timestamp = String.valueOf(System.currentTimeMillis());

+ 2 - 0
fs-service/src/main/java/com/fs/his/service/IFsUserInformationCollectionService.java

@@ -112,4 +112,6 @@ public interface IFsUserInformationCollectionService extends IService<FsUserInfo
     FsUserInformationCollectionDTO selectFsUserInformationCollectionDTOById(Long id);
 
     int updatePackageOrderCode(FsUserInformationCollection fsUserInformationCollection);
+
+    FsUserInformationCollectionAndPatientVO selectFsUserInformationCollectionVoById(Long id);
 }

+ 27 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -60,6 +60,7 @@ import com.fs.huifuPay.sdk.opps.core.utils.HuiFuUtils;
 import com.fs.huifuPay.service.HuiFuService;
 import com.fs.im.dto.*;
 import com.fs.im.service.IImService;
+import com.fs.im.service.OpenIMService;
 import com.fs.qw.domain.QwExternalContact;
 import com.fs.qw.domain.QwUser;
 import com.fs.qw.mapper.QwExternalContactMapper;
@@ -293,6 +294,11 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
     @Autowired
     private com.fs.gtPush.service.uniPush2Service uniPush2Service;
 
+    @Autowired
+    private FsUserInformationCollectionMapper fsUserInformationCollectionMapper;
+    @Autowired
+    private OpenIMService openIMService;
+
     //ERP 类型到服务的映射
     private Map<Integer, IErpOrderService> erpServiceMap;
 
@@ -1036,6 +1042,10 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         }
 
         if (fsStoreOrderMapper.insertFsStoreOrder(order) > 0) {
+            if(CloudHostUtils.hasCloudHostName("金牛明医")){
+                //信息采集 发送药师im
+                doctorSendIm(packageOrder);
+            }
             if (packageOrder.getCycle() >= followRate) {
                 FsFollow fsFollow = new FsFollow();
                 fsFollow.setTempId(FollowTempId + 0L);
@@ -1120,6 +1130,23 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         return R.ok();
     }
 
+    private void doctorSendIm(FsPackageOrder packageOrder) {
+        try {
+            //信息采集 发送药师im
+            FsUserInformationCollection fsUserInformationCollectionParam = new FsUserInformationCollection();
+            fsUserInformationCollectionParam.setPackageOrderId(packageOrder.getOrderId());
+            fsUserInformationCollectionParam.setPackageOrderCode(packageOrder.getOrderSn());
+            List<FsUserInformationCollection> fsUserInformationCollections = fsUserInformationCollectionMapper.selectFsUserInformationCollectionList(fsUserInformationCollectionParam);
+            if (!fsUserInformationCollections.isEmpty()) {
+                for (FsUserInformationCollection collection : fsUserInformationCollections) {
+                    openIMService.sendUserInformation(collection.getUserId(),collection.getDoctorType2Id(),collection.getId());
+                }
+            }
+        } catch (Exception e) {
+            log.error("信息采集 通知药师发送失败:{}",e.getMessage());
+        }
+    }
+
     @SuppressWarnings("all")
     @Override
     public String importSroreOrder(List<FsStoreProductDeliverExcelVO> list, Long storeId, Long companyId) {

+ 36 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsUserInformationCollectionServiceImpl.java

@@ -25,6 +25,7 @@ import com.fs.core.utils.OrderCodeUtils;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.domain.*;
 import com.fs.his.dto.FsUserInformationCollectionDTO;
+import com.fs.his.enums.FsPackageOrderStatusEnum;
 import com.fs.his.enums.FsStoreOrderStatusEnum;
 import com.fs.his.mapper.*;
 import com.fs.his.param.*;
@@ -59,6 +60,7 @@ import com.google.gson.Gson;
 import me.chanjar.weixin.common.error.WxErrorException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -131,6 +133,8 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
 
     @Autowired
     private FsPackageOrderMapper packageOrderMapper;
+    @Autowired
+    private FsPatientMapper fsPatientMapper;
 
     @Autowired
     private FsPrescribeMapper fsPrescribeMapper;
@@ -971,6 +975,38 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         return fsUserInformationCollectionMapper.updateFsUserInformationCollection(fsUserInformationCollection);
     }
 
+    @Override
+    public FsUserInformationCollectionAndPatientVO selectFsUserInformationCollectionVoById(Long id) {
+        FsUserInformationCollection info = baseMapper.selectFsUserInformationCollectionById(id);
+        FsUserInformationCollectionAndPatientVO vo = new FsUserInformationCollectionAndPatientVO();
+        BeanUtils.copyProperties(info, vo);
+        Long patientId = info.getPatientId();
+        if(patientId != null){
+            FsPatient fsPatient = fsPatientMapper.selectFsPatientByPatientId(patientId);
+            if (fsPatient != null){
+
+                vo.setPatientInfo(fsPatient);
+                //查询是否支付
+                Integer isPay = 0;
+                Long packageOrderId = info.getPackageOrderId();
+                if (packageOrderId != null){
+                    FsPackageOrder order = packageOrderMapper.selectFsPackageOrderByOrderId(packageOrderId);
+                    if (order != null && order.getStatus() > 1){
+                        isPay = 1;
+                        vo.setStoreOrderId(order.getStoreOrderId());
+                        Integer status = order.getStatus();
+                        vo.setOrderStatus(FsPackageOrderStatusEnum.toType(status).getDesc()); //订单状态
+                        vo.setPackageJson(order.getPackageJson());
+                    }
+                }
+                vo.setIsPay(isPay);
+            }
+        }
+        CompanyUser companyUser = companyUserMapper.selectCompanyUserById(info.getCompanyUserId());
+        info.setCompanyId(companyUser.getCompanyId());
+        return vo;
+    }
+
     private List<AnswerVO> getAnswerVOs(List<AnswerVO> target,List<AnswerVO> source) {
         target.addAll(source);
         return target.stream()

+ 2 - 0
fs-service/src/main/java/com/fs/his/vo/FsUserInformationCollectionAndPatientVO.java

@@ -15,6 +15,8 @@ public class FsUserInformationCollectionAndPatientVO extends FsUserInformationCo
     private FsPatient patientInfo; //病人信息
     private Integer isPay;
     private Long storeOrderId;
+    private String orderStatus;
+    private String packageJson;
 
 
 }

+ 5 - 0
fs-service/src/main/java/com/fs/qw/param/FsUserCourseRedPageParam.java

@@ -11,5 +11,10 @@ public class FsUserCourseRedPageParam {
     private Long courseId;
     //红包
     private BigDecimal redPacketMoney;
+
+    /**
+     * 新增配置 随机红包配置
+     */
+    private String randomRedPacketRules;
 }
 

+ 3 - 0
fs-service/src/main/java/com/fs/sop/service/IQwSopTempContentService.java

@@ -1,5 +1,6 @@
 package com.fs.sop.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.common.annotation.DataSource;
 import com.fs.common.enums.DataSourceType;
@@ -90,4 +91,6 @@ public interface IQwSopTempContentService extends IService<QwSopTempContent>{
     void removeByTempIds(Collection<String> tempIds);
 
     List<QwSopTempContent> listByTempIds(Collection<String> tempIds);
+
+    void removeByWrapper(LambdaQueryWrapper<QwSopTempContent> wrapper);
 }

+ 11 - 0
fs-service/src/main/java/com/fs/sop/service/IQwSopTempDayService.java

@@ -1,10 +1,15 @@
 package com.fs.sop.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.sop.domain.QwSopTempDay;
 
+import java.sql.Wrapper;
 import java.util.Collection;
 import java.util.List;
+import java.util.Set;
 
 /**
  * sop任务模板规则Service接口
@@ -35,4 +40,10 @@ public interface IQwSopTempDayService extends IService<QwSopTempDay> {
     int getDayNumByIdLimitOne(String tempId);
 
     void removeByTempIds(Collection<String> tempIds);
+
+    void removeByWrapper(LambdaQueryWrapper<QwSopTempDay> wrapper);
+
+    List<QwSopTempDay> listByTempIds(LambdaQueryWrapper<QwSopTempDay> wrapper);
+
+    void updateByWrapper(UpdateWrapper<QwSopTempDay> wrapper);
 }

+ 3 - 0
fs-service/src/main/java/com/fs/sop/service/IQwSopTempRulesService.java

@@ -1,5 +1,6 @@
 package com.fs.sop.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.common.annotation.DataSource;
 import com.fs.common.enums.DataSourceType;
@@ -95,5 +96,7 @@ public interface IQwSopTempRulesService extends IService<QwSopTempRules>{
 
     void removeByTempIds(Collection<String> tempIds);
 
+    void removeByWrapper(LambdaQueryWrapper<QwSopTempRules> wrapper);
+
     List<QwSopTempRules> selectListByDayId(Long id);
 }

+ 7 - 0
fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempContentServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fs.sop.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.common.annotation.DataSource;
@@ -163,4 +164,10 @@ public class QwSopTempContentServiceImpl extends ServiceImpl<QwSopTempContentMap
     public List<QwSopTempContent> listByTempIds(Collection<String> tempIds) {
         return baseMapper.selectList(new QueryWrapper<QwSopTempContent>().in("temp_id", tempIds));
     }
+
+    @Override
+    @DataSource(DataSourceType.SOP)
+    public void removeByWrapper(LambdaQueryWrapper<QwSopTempContent> wrapper) {
+        this.remove(wrapper);
+    }
 }

+ 23 - 0
fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempDayServiceImpl.java

@@ -2,6 +2,7 @@ package com.fs.sop.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.common.annotation.DataSource;
@@ -13,7 +14,9 @@ import lombok.AllArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.sql.Wrapper;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -24,6 +27,7 @@ import java.util.List;
  */
 @Service
 @AllArgsConstructor
+@DataSource(DataSourceType.SOP)
 public class QwSopTempDayServiceImpl extends ServiceImpl<QwSopTempDayMapper, QwSopTempDay> implements IQwSopTempDayService {
 
 
@@ -92,4 +96,23 @@ public class QwSopTempDayServiceImpl extends ServiceImpl<QwSopTempDayMapper, QwS
     public void removeByTempIds(Collection<String> tempIds) {
         this.remove(new QueryWrapper<QwSopTempDay>().in("temp_id", tempIds));
     }
+
+    @Override
+    @DataSource(DataSourceType.SOP)
+    public void removeByWrapper(LambdaQueryWrapper<QwSopTempDay> wrapper) {
+        this.remove(wrapper);
+    }
+
+    @Override
+    @DataSource(DataSourceType.SOP)
+    public List<QwSopTempDay> listByTempIds(LambdaQueryWrapper<QwSopTempDay> wrapper) {
+        return this.list(wrapper);
+    }
+
+    @Override
+    @DataSource(DataSourceType.SOP)
+    public void updateByWrapper(UpdateWrapper<QwSopTempDay> wrapper) {
+        this.update(wrapper);
+    }
+
 }

+ 7 - 0
fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempRulesServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fs.sop.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.common.annotation.DataSource;
@@ -258,4 +259,10 @@ public class QwSopTempRulesServiceImpl extends ServiceImpl<QwSopTempRulesMapper,
     public List<QwSopTempRules> selectListByDayId(Long id) {
         return list(new QueryWrapper<QwSopTempRules>().eq("day_id", id));
     }
+
+    @Override
+    @DataSource(DataSourceType.SOP)
+    public void removeByWrapper(LambdaQueryWrapper<QwSopTempRules> wrapper) {
+        this.remove(wrapper);
+    }
 }

+ 60 - 45
fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempServiceImpl.java

@@ -2,7 +2,10 @@ package com.fs.sop.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.annotation.DataSource;
 import com.fs.common.enums.DataSourceType;
 import com.fs.common.exception.base.BaseException;
@@ -46,7 +49,6 @@ import java.text.SimpleDateFormat;
 import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Consumer;
 import java.util.stream.Collectors;
@@ -425,6 +427,10 @@ public class QwSopTempServiceImpl implements IQwSopTempService {
         temp.setProject(fsUserCourse.getProject());
         qwSopTempMapper.updateQwSopTemp(temp);
         List<FsUserCourseVideo> videoList = fsUserCourseVideoMapper.selectVideoByCourseId(fsUserCourse.getCourseId());
+        createSopTempRules(temp, videoList, fsUserCourse);
+    }
+
+    private void createSopTempRules(QwSopTemp temp, List<FsUserCourseVideo> videoList, FsUserCourse fsUserCourse) {
         AtomicInteger i = new AtomicInteger(1);
         Integer gap = temp.getGap();
         List<QwSopTempDay> collect = videoList.stream().map(e -> {
@@ -627,67 +633,76 @@ public class QwSopTempServiceImpl implements IQwSopTempService {
         if (CollectionUtils.isEmpty(rulesList)) {
             return;
         }
-
         // 获取这些规则关联的模板ID集合
         Set<String> tempIds = rulesList.stream()
                 .map(QwSopTempRules::getTempId)
                 .filter(Objects::nonNull)
                 .collect(Collectors.toSet());
 
-        // 查询相关联的sop模板
-        if (CollectionUtils.isEmpty(tempIds)) {
-            return;
-        }
-        // 只弄课程模板的
+        FsUserCourse fsUserCourse = fsUserCourseMapper.selectFsUserCourseByCourseId(courseId);
+        List<FsUserCourseVideo> videoList = fsUserCourseVideoMapper.selectVideoByCourseId(fsUserCourse.getCourseId());
         List<QwSopTemp> tempList = qwSopTempMapper.selectListByIds(tempIds);
-        tempList = tempList.stream().filter(f -> Objects.equals(f.getStatus(), "1")).collect(Collectors.toList());
-        if (CollectionUtils.isEmpty(tempList)) {
-            return;
+        List<QwSopTempContent> contentList = qwSopTempContentService.listByTempIds(tempIds);
+        List<QwSopTempDay> dayList = qwSopTempDayService.listByTempIds(new LambdaQueryWrapper<QwSopTempDay>().in(QwSopTempDay::getTempId, tempIds));
+        List<Long> videoIdList = videoList.stream().map(FsUserCourseVideo::getVideoId).collect(Collectors.toList());
+        // videoList转Map key 为videoId value 为 courseSort
+        Map<Long, Long> videoSortMap = videoList.stream().collect(Collectors.toMap(FsUserCourseVideo::getVideoId, FsUserCourseVideo::getCourseSort));
+
+        // 将课程中已删除的视频在规则和日期中删除
+        Set<Long> dayIdList = rulesList.stream().filter(e -> !videoIdList.contains(e.getVideoId())).map(QwSopTempRules::getDayId).collect(Collectors.toSet());
+        if (CollectionUtils.isNotEmpty(dayIdList)) {
+            qwSopTempDayService.removeByWrapper(new LambdaQueryWrapper<QwSopTempDay>().in(QwSopTempDay::getId, dayIdList));
+            qwSopTempRulesService.removeByWrapper(new LambdaQueryWrapper<QwSopTempRules>().in(QwSopTempRules::getDayId, dayIdList));
+            qwSopTempContentService.removeByWrapper(new LambdaQueryWrapper<QwSopTempContent>().in(QwSopTempContent::getDayId, dayIdList));
         }
 
-        // 获取这些规则关联的模板ID集合
-        Set<String> sopTempIds = tempList.stream()
-                .map(QwSopTemp::getId)
-                .filter(Objects::nonNull)
-                .collect(Collectors.toSet());
+        // 需要添加的课程视频
+        List<FsUserCourseVideo> addVideoList = videoList.stream()
+                .filter(e -> rulesList.stream().noneMatch(f -> f.getVideoId().equals(e.getVideoId()))).collect(Collectors.toList());
 
-        List<QwSopTempContent> contentList = qwSopTempContentService.listByTempIds(sopTempIds);
+        if (CollectionUtils.isNotEmpty(addVideoList)) {
+            for (QwSopTemp temp : tempList) {
+                // 通过历史中的第一课的数据来构建
+                Optional<QwSopTempDay> first = dayList.stream().filter(e -> e.getTempId().equals(temp.getId())).findFirst();
+                if (!first.isPresent()) {
+                    break;
+                }
+                QwSopTempDay qwSopTempDay = first.get();
+                // 构造timeList timeDesc time
+                temp.setTime(LocalTime.now());
+
+                temp.setTimeList(rulesList.stream()
+                        .filter(e -> e.getTempId().equals(temp.getId()) && Objects.equals(e.getIsOfficial(), "0")
+                                && Objects.equals(e.getDayId(), qwSopTempDay.getId())
+                        ).map(QwSopTempRules::getTime)
+                        .collect(Collectors.toList()));
 
-        qwSopTempDayService.removeByTempIds(tempIds);
-        qwSopTempRulesService.removeByTempIds(tempIds);
-        qwSopTempContentService.removeByTempIds(tempIds);
-        // 对每个模板执行同步操作
-        for (QwSopTemp temp : tempList) {
-            // 构造timeList timeDesc time
-            rulesList.stream().filter(e -> e.getTempId().equals(temp.getId())).findFirst()
-                    .ifPresent(first -> temp.setTime(LocalTime.parse(first.getTime() + ":00")));
-
-            temp.setTimeList(rulesList.stream()
-                    .filter(e -> e.getTempId().equals(temp.getId()) && Objects.equals(e.getIsOfficial(), "0")
-                            && Objects.equals(e.getName(), "第1天")).map(QwSopTempRules::getTime)
-                    .collect(Collectors.toList()));
-            // 过滤并找到 dayId 最小的元素
-            Optional<QwSopTempContent> minDayEntity = contentList.stream()
-                    // 1. 过滤条件:tempId匹配 + isBindUrl为null
-                    .filter(e -> e.getTempId().equals(temp.getId())
-                            && Objects.isNull(e.getIsBindUrl()))
-                    // 2. 按 dayId 升序排序,取第一个(最小)
-                    .min(Comparator.comparingLong(QwSopTempContent::getDayId)); // 若dayId是Long,用comparingLong
-
-            if (minDayEntity.isPresent()) {
-                QwSopTempContent qwSopTempContent = minDayEntity.get();
                 temp.setTimeDesc(contentList.stream().filter(e -> e.getTempId().equals(temp.getId())
                                 && Objects.isNull(e.getIsBindUrl())
-                                && Objects.equals(qwSopTempContent.getDayId(), e.getDayId())
+                                && Objects.equals(qwSopTempDay.getId(), e.getDayId())
                         )
                         .map(m -> JSONObject.parseObject(m.getContent()).getString("value")).collect(Collectors.toList()));
+                temp.setProject(fsUserCourse.getProject());
+                temp.setCourseId(courseId);
+                temp.setOpenOfficial("1");
+                qwSopTempMapper.updateQwSopTemp(temp);
+                createSopTempRules(temp, addVideoList, fsUserCourse);
             }
+        }
 
-            // 插入课程id
-            temp.setCourseId(courseId);
-            temp.setOpenOfficial("1");
-            // 重新生成该模板的规则和内容
-            threadPoolTaskExecutor.execute(() -> createSopTempRules(temp));
+        // 整理排序
+        List<QwSopTempRules> afterRuleList = qwSopTempRulesService.listByCourseId(courseId);
+        for (QwSopTemp temp : tempList) {
+            Long[] dayIdArray = afterRuleList.stream().filter(e -> e.getTempId().equals(temp.getId())).sorted(Comparator.comparing(a -> videoSortMap.get(a.getVideoId())))
+                    .map(QwSopTempRules::getDayId).distinct().toArray(Long[]::new);
+            for (int i = 0; i < dayIdArray.length; i++) {
+                qwSopTempDayService.updateByWrapper(new UpdateWrapper<QwSopTempDay>()
+                        .eq("id", dayIdArray[i])
+                        .set("sorts", i + 1)
+                        .set("name", "第" + (i + 1) + "天")
+                        .set("day_num", i + 1)
+                );
+            }
         }
     }
 

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

@@ -178,6 +178,9 @@ headerImg:
 ipad:
     ipadUrl: http://admin.test.ylrztop.com/ipad
     aiApi: http://1.95.196.10:3000/api
+    voiceApi:
+    commonApi:
+    url:
 wx_miniapp_temp:
     pay_order_temp_id:
     inquiry_temp_id:

+ 3 - 0
fs-service/src/main/resources/mapper/course/FsUserCourseVideoMapper.xml

@@ -92,6 +92,7 @@
             <if test="lineThree != null">line_three,</if>
             <if test="uploadType != null">upload_type,</if>
             <if test="redPacketMoney != null">red_packet_money,</if>
+            <if test="randomRedPacketRules != null">random_red_packet_rules,</if>
             <if test="fileSize != null">file_size,</if>
             <if test="fileKey != null">file_key,</if>
             <if test="round != null">round,</if>
@@ -130,6 +131,7 @@
             <if test="lineThree != null">#{lineThree},</if>
             <if test="uploadType != null">#{uploadType},</if>
             <if test="redPacketMoney != null">#{redPacketMoney},</if>
+            <if test="randomRedPacketRules != null">#{randomRedPacketRules},</if>
             <if test="fileSize != null">#{fileSize},</if>
             <if test="fileKey != null">#{fileKey},</if>
             <if test="round != null">#{round},</if>
@@ -218,6 +220,7 @@
             <if test="lineThree != null">line_three = #{lineThree},</if>
             <if test="uploadType != null">upload_type = #{uploadType},</if>
             <if test="redPacketMoney != null">red_packet_money = #{redPacketMoney},</if>
+            <if test="randomRedPacketRules != null">random_red_packet_rules = #{randomRedPacketRules},</if>
             <if test="fileSize != null">file_size = #{fileSize},</if>
             <if test="fileKey != null">file_key = #{fileKey},</if>
             <if test="round != null">round = #{round},</if>

+ 1 - 1
fs-service/src/main/resources/mapper/his/FsUserInformationCollectionMapper.xml

@@ -97,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 <if test="maps.doctorType2Confirm != null"> and fui.doctor_type2_confirm = #{maps.doctorType2Confirm}</if>
                 <if test="maps.packageOrderCode != null  and maps.packageOrderCode != ''"> and fui.package_order_code = #{maps.packageOrderCode}</if>
             </where>
-
+        order by id desc
     </select>
     <select id="selectFsUserInformationCollectionByDoctorType1"
             resultType="com.fs.his.domain.FsUserInformationCollection">

+ 3 - 2
fs-service/src/main/resources/mapper/hisStore/FsStoreOrderScrmMapper.xml

@@ -1574,8 +1574,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 <!--    商城订单查询接口-->
     <select id="selectFsStoreOrderListVO" resultType="com.fs.hisStore.vo.FsStoreOrderVO">
-        select o.*,u.phone,u.register_code,u.register_date,u.source, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber
-        , csc.name miniProgramName,fsp.cost as cost, fspc.cate_name,spavs.bar_code
+        select o.id,o.order_code,o.extend_order_id,o.pay_order_id,o.bank_order_id,o.user_id,o.real_name,o.user_phone,o.user_address,o.cart_id,o.freight_price,o.total_num,o.total_price,o.total_postage,o.pay_price,o.pay_postage,o.pay_delivery,o.pay_money,o.deduction_price,o.coupon_id,o.coupon_price,o.paid,o.pay_time,o.pay_type,o.create_time,o.update_time,o.status,o.refund_status,o.refund_reason_wap_img,o.refund_reason_wap_explain,o.refund_reason_time,o.refund_reason_wap,o.refund_reason,o.refund_price,o.delivery_sn,o.delivery_name,o.delivery_type,o.delivery_id,o.gain_integral,o.use_integral,o.pay_integral,o.back_integral,o.mark,o.is_del,o.remark,o.verify_code,o.store_id,o.shipping_type,o.is_channel,o.is_remind,o.is_sys_del,o.is_prescribe,o.prescribe_id,o.company_id,o.company_user_id,o.is_package,o.package_json,o.order_type,o.package_id,o.finish_time,o.delivery_status,o.delivery_pay_status,o.delivery_time,o.delivery_pay_time,o.delivery_pay_money,o.tui_money,o.tui_money_status,o.delivery_import_time,o.tui_user_id,o.tui_user_money_status,o.order_create_type,o.store_house_code,o.dept_id,o.is_edit_money,o.customer_id,o.is_pay_remain,o.delivery_send_time,o.certificates,o.upload_time,o.item_json,o.schedule_id,o.delivery_pay_type,o.order_visit,o.service_fee,o.cycle,o.prescribe_price,o.follow_doctor_id,o.follow_time,o.user_coupon_id,o.order_medium,o.erp_phone
+        ,u.phone,u.register_code,u.register_date,u.source, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber
+        , csc.name miniProgramName,fsp.cost, fspc.cate_name,spavs.bar_code
         from fs_store_order_scrm o
         left join fs_user u on o.user_id=u.user_id
         left join company c on c.company_id=o.company_id

+ 2 - 18
fs-user-app/src/main/java/com/fs/app/controller/CompanyUserController.java

@@ -37,10 +37,7 @@ import com.fs.fastgptApi.vo.AudioVO;
 import com.fs.his.domain.FsPatient;
 import com.fs.his.domain.FsUserInformationCollection;
 import com.fs.his.param.*;
-import com.fs.his.service.IFsPatientService;
-import com.fs.his.service.IFsPrescribeService;
-import com.fs.his.service.IFsQuestionAndAnswerService;
-import com.fs.his.service.IFsUserInformationCollectionService;
+import com.fs.his.service.*;
 import com.fs.his.vo.*;
 import com.fs.sop.domain.QwSopTempVoice;
 import com.fs.sop.service.IQwSopTempVoiceService;
@@ -98,8 +95,6 @@ public class CompanyUserController extends  AppBaseController {
     private IFsUserInformationCollectionService fsUserInformationCollectionService;
     @Autowired
     private IFsQuestionAndAnswerService fsQuestionAndAnswerService;
-    @Autowired
-    private IFsPatientService fsPatientService;
 
     public static final String SOP_TEMP_VOICE_KEY = "sop:tempVoice";
     @PostMapping("/login")
@@ -430,18 +425,7 @@ public class CompanyUserController extends  AppBaseController {
     @GetMapping(value = "/informationCollection/{id}")
     public R getInformationCollectionInfo(@PathVariable("id") Long id)
     {
-        FsUserInformationCollection info = fsUserInformationCollectionService.selectFsUserInformationCollectionById(id);
-        Long patientId = info.getPatientId();
-        if(patientId != null){
-            FsPatient fsPatient = fsPatientService.selectFsPatientByPatientId(patientId);
-            if (fsPatient != null){
-                FsUserInformationCollectionAndPatientVO vo = new FsUserInformationCollectionAndPatientVO();
-                BeanUtils.copyProperties(info, vo);
-                vo.setPatientInfo(fsPatient);
-                return R.ok().put("data", vo);
-            }
-        }
-        return R.ok().put("data",info);
+        return R.ok().put("data", fsUserInformationCollectionService.selectFsUserInformationCollectionVoById(id));
     }
 
     /**

+ 5 - 38
fs-user-app/src/main/java/com/fs/app/controller/FsUserInformationCollectionController.java

@@ -35,12 +35,6 @@ public class FsUserInformationCollectionController extends AppBaseController
 {
     @Autowired
     private IFsUserInformationCollectionService fsUserInformationCollectionService;
-    @Autowired
-    private IFsPatientService fsPatientService;
-    @Autowired
-    private ICompanyUserService companyUserService;
-    @Autowired
-    private IFsPackageOrderService fsPackageOrderService;
 
 
     /**
@@ -51,44 +45,17 @@ public class FsUserInformationCollectionController extends AppBaseController
     public R getInfo(@PathVariable("id") Long id)
     {
 
-        FsUserInformationCollection info = fsUserInformationCollectionService.selectFsUserInformationCollectionById(id);
-
-        if (info == null){
+        FsUserInformationCollectionAndPatientVO vo = fsUserInformationCollectionService.selectFsUserInformationCollectionVoById(id);
+        if (vo == null){
             return R.error("未查询到信息!");
         }
         String userId = getUserId();
-        if (info.getUserId() != Long.parseLong(userId)){
+        if (vo.getUserId() != Long.parseLong(userId)){
             return R.error("未查询您的采集信息!");
         }
-        if (info.getDoctorConfirm() == 0){
-            info.setPackageId(null);
-        }
-        CompanyUser companyUser = companyUserService.selectCompanyUserById(info.getCompanyUserId());
-        info.setCompanyId(companyUser.getCompanyId());
-        Long patientId = info.getPatientId();
-
-        FsUserInformationCollectionAndPatientVO vo = new FsUserInformationCollectionAndPatientVO();
-        BeanUtils.copyProperties(info, vo);
-
-        if(patientId != null){
-            FsPatient fsPatient = fsPatientService.selectFsPatientByPatientId(patientId);
-            if (fsPatient != null){
-
-                vo.setPatientInfo(fsPatient);
-                //查询是否支付
-                Integer isPay = 0;
-                Long packageOrderId = info.getPackageOrderId();
-                if (packageOrderId != null){
-                    FsPackageOrder order = fsPackageOrderService.selectFsPackageOrderByOrderId(packageOrderId);
-                    if (order != null && order.getStatus() > 1){
-                        isPay = 1;
-                        vo.setStoreOrderId(order.getStoreOrderId());
-                    }
-                }
-                vo.setIsPay(isPay);
-            }
+        if (vo.getDoctorConfirm() == 0){
+            vo.setPackageId(null);
         }
-
         return R.ok().put("data", vo);
     }