Ver código fonte

Merge remote-tracking branch 'origin/master'

yfh 5 dias atrás
pai
commit
52bf739edb
24 arquivos alterados com 1053 adições e 302 exclusões
  1. 10 0
      fs-admin/src/main/java/com/fs/live/controller/LiveAfterSalesController.java
  2. 75 0
      fs-admin/src/main/java/com/fs/qw/qwTask/qwTask.java
  3. 6 0
      fs-company/src/main/java/com/fs/company/controller/live/LiveAfterSalesController.java
  4. 2 1
      fs-quartz/src/main/java/com/fs/quartz/config/ScheduleConfig.java
  5. 76 3
      fs-qw-task/src/main/java/com/fs/app/controller/CommonController.java
  6. 2 2
      fs-qw-task/src/main/java/com/fs/app/taskService/impl/SopLogsTaskServiceImpl.java
  7. 1 1
      fs-service/src/main/java/com/fs/gtPush/service/impl/uniPush2ServiceImpl.java
  8. 4 0
      fs-service/src/main/java/com/fs/his/param/FsUserInformationCollectionParam.java
  9. 64 30
      fs-service/src/main/java/com/fs/his/service/impl/FsUserInformationCollectionServiceImpl.java
  10. 2 0
      fs-service/src/main/java/com/fs/his/vo/FsUserInformationCollectionAndPatientVO.java
  11. 3 0
      fs-service/src/main/java/com/fs/live/mapper/LiveAfterSalesMapper.java
  12. 2 0
      fs-service/src/main/java/com/fs/live/service/ILiveAfterSalesService.java
  13. 221 5
      fs-service/src/main/java/com/fs/live/service/impl/LiveAfterSalesServiceImpl.java
  14. 111 85
      fs-service/src/main/java/com/fs/live/service/impl/LiveOrderServiceImpl.java
  15. 16 5
      fs-service/src/main/java/com/fs/live/service/impl/LiveServiceImpl.java
  16. 1 0
      fs-service/src/main/java/com/fs/qw/mapper/QwUserMapper.java
  17. 15 11
      fs-service/src/main/resources/application-config-druid-bjczwh.yml
  18. 98 0
      fs-service/src/main/resources/application-config-druid-gzzdy.yml
  19. 1 1
      fs-service/src/main/resources/application-config-druid-hzyy.yml
  20. 1 1
      fs-service/src/main/resources/application-config-druid-sxjz.yml
  21. 159 150
      fs-service/src/main/resources/application-druid-bjczwh.yml
  22. 151 0
      fs-service/src/main/resources/application-druid-gzzdy.yml
  23. 5 0
      fs-service/src/main/resources/mapper/qw/QwUserMapper.xml
  24. 27 7
      fs-user-app/src/main/java/com/fs/app/controller/FsUserInformationCollectionController.java

+ 10 - 0
fs-admin/src/main/java/com/fs/live/controller/LiveAfterSalesController.java

@@ -180,4 +180,14 @@ public class LiveAfterSalesController extends BaseController
         param.setOperator(loginUser.getUser().getNickName());
         return liveAfterSalesService.cancel(param);
     }
+
+    @PreAuthorize("@ss.hasPermi('store:storeAfterSales:refund')")
+    @PostMapping("/handleImmediatelyRefund")
+    public R handleImmediatelyRefund(@RequestBody LiveAfterSalesRefundParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        param.setOperator(loginUser.getUser().getNickName());
+        return liveAfterSalesService.handleImmediatelyRefund(param.getOrderId());
+    }
+
 }

+ 75 - 0
fs-admin/src/main/java/com/fs/qw/qwTask/qwTask.java

@@ -1,17 +1,24 @@
 package com.fs.qw.qwTask;
 
 import com.fs.course.service.IFsUserCourseService;
+import com.fs.qw.domain.QwIpadServerLog;
+import com.fs.qw.domain.QwUser;
+import com.fs.qw.mapper.QwUserMapper;
 import com.fs.qw.service.*;
 import com.fs.sop.service.impl.QwSopLogsServiceImpl;
 import com.fs.sop.service.impl.QwSopServiceImpl;
 import com.fs.sop.service.ISopUserLogsService;
 import com.fs.statis.IFsStatisQwWatchService;
 import com.fs.statis.service.FsStatisSalerWatchService;
+import com.fs.wxwork.dto.WxWorkGetQrCodeDTO;
+import com.fs.wxwork.service.WxWorkService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
+import java.util.Date;
+import java.util.List;
 
 @Component("qwTask")
 public class qwTask {
@@ -47,6 +54,23 @@ public class qwTask {
     private IQwMaterialService iQwMaterialService;
 
 
+    @Autowired
+    private QwUserMapper qwUserMapper;
+
+    @Autowired
+    private IQwIpadServerService ipadServerService;
+
+    @Autowired
+    private IQwIpadServerLogService qwIpadServerLogService;
+
+    @Autowired
+    private IQwIpadServerUserService qwIpadServerUserService;
+
+    @Autowired
+    private IQwExternalContactService externalContactService;
+
+    @Autowired
+    private WxWorkService wxWorkService;
 
 
     //正在使用
@@ -211,4 +235,55 @@ public class qwTask {
 
 
     }
+
+    /**
+     * 定时清除 占着茅坑不拉屎的ipad 账号
+     */
+    public void selectQwUserByUnbindIpad(){
+        List<QwUser> list = qwUserMapper.selectQwUserByTest();
+        for (QwUser qwUser : list) {
+            try {
+                Integer serverStatus = qwUser.getServerStatus();
+                Long serverId = qwUser.getServerId();
+                if (serverStatus==0){
+                    System.out.println("不需要解绑");
+                }
+                if (serverId==null){
+                    System.out.println("serverId不存在");
+                }
+                QwUser u = new QwUser();
+                u.setId(qwUser.getId());
+                u.setServerId(null);
+                u.setServerStatus(0);
+                qwUserMapper.updateQwUser(u);
+                ipadServerService.addServer(serverId);
+                QwIpadServerLog qwIpadServerLog = new QwIpadServerLog();
+                qwIpadServerLog.setType(2);
+                qwIpadServerLog.setTilie("解绑");
+                qwIpadServerLog.setServerId(serverId);
+                qwIpadServerLog.setQwUserId(qwUser.getId());
+                qwIpadServerLog.setCompanyUserId(qwUser.getCompanyUserId());
+                qwIpadServerLog.setCompanyId(qwUser.getCompanyId());
+                qwIpadServerLog.setCreateTime(new Date());
+                qwIpadServerLogService.insertQwIpadServerLog(qwIpadServerLog);
+                qwIpadServerUserService.deleteQwIpadServerUserByQwUserId(qwUser.getId());
+                WxWorkGetQrCodeDTO wxWorkGetQrCodeDTO = new WxWorkGetQrCodeDTO();
+                wxWorkGetQrCodeDTO.setUuid(qwUser.getUid());
+                wxWorkService.LoginOut(wxWorkGetQrCodeDTO,qwUser.getServerId());
+                updateIpadStatus(qwUser.getId(),0);
+            } catch (Exception e) {
+                System.out.println("解绑ipad报错"+e);
+
+            }
+        }
+    }
+
+
+    void updateIpadStatus(Long id ,Integer status){
+        QwUser u = new QwUser();
+        u.setId(id);
+        u.setIpadStatus(status);
+        qwUserMapper.updateQwUser(u);
+    }
+
 }

+ 6 - 0
fs-company/src/main/java/com/fs/company/controller/live/LiveAfterSalesController.java

@@ -8,6 +8,8 @@ import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.ParseUtils;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.company.domain.CompanyUser;
+import com.fs.framework.security.SecurityUtils;
 import com.fs.his.domain.FsUser;
 import com.fs.his.service.IFsUserService;
 import com.fs.live.domain.LiveAfterSales;
@@ -55,6 +57,8 @@ public class LiveAfterSalesController extends BaseController
     public TableDataInfo list(LiveAfterSalesVo liveAfterSales)
     {
         startPage();
+        CompanyUser user = SecurityUtils.getLoginUser().getUser();
+        liveAfterSales.setCompanyId(user.getCompanyId());
         List<LiveAfterSalesVo> list = liveAfterSalesService.selectLiveAfterSalesVoList(liveAfterSales);
         for (LiveAfterSalesVo liveAfterSalesVo : list) {
             liveAfterSalesVo.setUserPhone(ParseUtils.parsePhone(liveAfterSalesVo.getUserPhone()));
@@ -71,6 +75,8 @@ public class LiveAfterSalesController extends BaseController
     public AjaxResult export(LiveAfterSalesVo liveAfterSales)
     {
         PageHelper.startPage(1, 10000, "");
+        CompanyUser user = SecurityUtils.getLoginUser().getUser();
+        liveAfterSales.setCompanyId(user.getCompanyId());
         List<LiveAfterSalesVo> list = liveAfterSalesService.selectLiveAfterSalesVoList(liveAfterSales);
         for (LiveAfterSalesVo liveAfterSalesVo : list) {
             liveAfterSalesVo.setUserPhone(liveAfterSalesVo.getUserPhone() == null ? "" : liveAfterSalesVo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));

+ 2 - 1
fs-quartz/src/main/java/com/fs/quartz/config/ScheduleConfig.java

@@ -8,7 +8,7 @@ import java.util.Properties;
 
 /**
  * 定时任务配置
- * 
+ *
 
  */
 @Configuration
@@ -51,6 +51,7 @@ public class ScheduleConfig
         factory.setOverwriteExistingJobs(true);
         // 设置自动启动,默认为true
         factory.setAutoStartup(true);
+//        factory.setAutoStartup(false);
 
         return factory;
     }

+ 76 - 3
fs-qw-task/src/main/java/com/fs/app/controller/CommonController.java

@@ -21,10 +21,11 @@ import com.fs.his.service.IFsInquiryOrderService;
 import com.fs.his.utils.qrcode.QRCodeUtils;
 import com.fs.qw.domain.QwCompany;
 import com.fs.qw.domain.QwExternalContact;
+import com.fs.qw.domain.QwIpadServerLog;
+import com.fs.qw.domain.QwUser;
 import com.fs.qw.mapper.QwExternalContactMapper;
-import com.fs.qw.service.IQwCompanyService;
-import com.fs.qw.service.IQwExternalContactService;
-import com.fs.qw.service.IQwMaterialService;
+import com.fs.qw.mapper.QwUserMapper;
+import com.fs.qw.service.*;
 import com.fs.qwApi.domain.QwExternalContactResult;
 import com.fs.qwApi.service.QwApiService;
 import com.fs.sop.mapper.QwSopLogsMapper;
@@ -33,6 +34,8 @@ import com.fs.sop.mapper.SopUserLogsMapper;
 import com.fs.sop.service.*;
 import com.fs.sop.vo.QwSopLogsDoSendListTVO;
 import com.fs.store.service.IFsUserCourseCountService;
+import com.fs.wxwork.dto.WxWorkGetQrCodeDTO;
+import com.fs.wxwork.service.WxWorkService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -48,6 +51,7 @@ import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.List;
 
 @Api("公共接口")
@@ -134,8 +138,77 @@ public class CommonController {
     @Autowired
     public RedisCache redisCache;
 
+    @Autowired
+    private QwUserMapper qwUserMapper;
+
+
+    @Autowired
+    IQwIpadServerService ipadServerService;
+
+    @Autowired
+    IQwIpadServerLogService qwIpadServerLogService;
+    @Autowired
+    IQwIpadServerUserService qwIpadServerUserService;
+
+    @Autowired
+    IQwExternalContactService externalContactService;
+    @Autowired
+    WxWorkService wxWorkService;
+
+    /**
+     *
+     */
+    @GetMapping("/selectQwUserByTest")
+    public void selectQwUserByTest() {
+        try {
+            List<QwUser> list = qwUserMapper.selectQwUserByTest();
+            for (QwUser qwUser : list) {
+                try {
+                    Integer serverStatus = qwUser.getServerStatus();
+                    Long serverId = qwUser.getServerId();
+                    if (serverStatus==0){
+                        log.error("不需要解绑");
+                    }
+                    if (serverId==null){
+                        log.error("serverId不存在");
+                    }
+                    QwUser u = new QwUser();
+                    u.setId(qwUser.getId());
+                    u.setServerId(null);
+                    u.setServerStatus(0);
+                    qwUserMapper.updateQwUser(u);
+                    ipadServerService.addServer(serverId);
+                    QwIpadServerLog qwIpadServerLog = new QwIpadServerLog();
+                    qwIpadServerLog.setType(2);
+                    qwIpadServerLog.setTilie("解绑");
+                    qwIpadServerLog.setServerId(serverId);
+                    qwIpadServerLog.setQwUserId(qwUser.getId());
+                    qwIpadServerLog.setCompanyUserId(qwUser.getCompanyUserId());
+                    qwIpadServerLog.setCompanyId(qwUser.getCompanyId());
+                    qwIpadServerLog.setCreateTime(new Date());
+                    qwIpadServerLogService.insertQwIpadServerLog(qwIpadServerLog);
+                    qwIpadServerUserService.deleteQwIpadServerUserByQwUserId(qwUser.getId());
+                    WxWorkGetQrCodeDTO wxWorkGetQrCodeDTO = new WxWorkGetQrCodeDTO();
+                    wxWorkGetQrCodeDTO.setUuid(qwUser.getUid());
+                    wxWorkService.LoginOut(wxWorkGetQrCodeDTO,qwUser.getServerId());
+                    updateIpadStatus(qwUser.getId(),0);
+                } catch (Exception e) {
+                    log.error("解绑ipad报错",e);
+                }
+            }
+        } catch (Exception e) {
+            log.error("定时处理未绑定员工企微异常",e);
+        }
 
+    }
 
+
+    void updateIpadStatus(Long id ,Integer status){
+        QwUser u = new QwUser();
+        u.setId(id);
+        u.setIpadStatus(status);
+        qwUserMapper.updateQwUser(u);
+    }
     /**
      *
      */

+ 2 - 2
fs-qw-task/src/main/java/com/fs/app/taskService/impl/SopLogsTaskServiceImpl.java

@@ -1127,9 +1127,9 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
         }
         clonedContent.getSetting().stream().filter(e -> "1".equals(e.getIsBindUrl())).forEach(e -> {
             e.setIsBindUrl("0");
-            e.setLinkDescribe(null);
+//            e.setLinkDescribe(null);
             e.setLinkUrl(null);
-            e.setLinkImageUrl(null);
+//            e.setLinkImageUrl(null);
         });
         sopLogs.setContentJson(JSON.toJSONString(clonedContent));
         enqueueQwSopLogs(sopLogs);

+ 1 - 1
fs-service/src/main/java/com/fs/gtPush/service/impl/uniPush2ServiceImpl.java

@@ -46,7 +46,7 @@ public class uniPush2ServiceImpl implements uniPush2Service {
     public void pushSopAppLinkMsgByExternalIM(String cropId, String linkTile, String linkDescribe,String linkImageUrl, String link, Long companyUserId,Long fsUserId) throws JsonProcessingException {
 
         if (companyUserId!=null&&fsUserId!=null && fsUserId!=0){
-            openIMService.sendCourse(fsUserId,companyUserId,link,linkTile,linkImageUrl,cropId);
+            openIMService.sendCourse(fsUserId,companyUserId,link,linkDescribe,linkImageUrl,cropId);
         }
 
     }

+ 4 - 0
fs-service/src/main/java/com/fs/his/param/FsUserInformationCollectionParam.java

@@ -48,5 +48,9 @@ public class FsUserInformationCollectionParam {
 
     private String doctorSign;
 
+    private Long doctorId;
+
+    private Long doctorType2Id;
+
     private String packageOrderCode;
 }

+ 64 - 30
fs-service/src/main/java/com/fs/his/service/impl/FsUserInformationCollectionServiceImpl.java

@@ -14,8 +14,11 @@ import com.fs.common.exception.CustomException;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.StringUtils;
 import com.fs.company.domain.CompanyUser;
+import com.fs.company.domain.CompanyUserUser;
 import com.fs.company.mapper.CompanyUserMapper;
+import com.fs.company.mapper.CompanyUserUserMapper;
 import com.fs.company.service.ICompanyService;
+import com.fs.company.service.ICompanyUserService;
 import com.fs.core.config.WxMaConfiguration;
 import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
@@ -149,6 +152,11 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
     private IFsInquiryOrderService fsInquiryOrderService;
     @Autowired
     private OpenIMService openIMService;
+    @Autowired
+    private CompanyUserUserMapper companyUserUserMapper;
+    @Autowired
+    private FsPackageMapper fsPackageMapper;
+
     /**
      * 查询用户信息采集
      *
@@ -219,6 +227,9 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         if (collection.getUserConfirm() == 1 && collection.getUserConfirm2() == 0) {
             throw new CustomException("确认中,暂无法修改");
         }
+        param.setDoctorId(collection.getDoctorId());
+        param.setDoctorType2Id(collection.getDoctorType2Id());
+        param.setPackageId(collection.getPackageId());
         FsUserInformationCollection fsUserInformationCollection = getFsUserInformationCollection(param);
         fsUserInformationCollection.setUpdateTime(DateUtils.getNowDate());
         baseMapper.updateFsUserInformationCollection(fsUserInformationCollection);
@@ -246,6 +257,9 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         }
         //清空订单号
         fsUserInformationCollectionMapper.collectionOderCodeNULL(param.getId());
+        param.setDoctorId(collection.getDoctorId());
+        param.setDoctorType2Id(collection.getDoctorType2Id());
+        param.setPackageId(collection.getPackageId());
         FsUserInformationCollection fsUserInformationCollection = getFsUserInformationCollection(param);
         fsUserInformationCollection.setUserConfirm2(0);
         fsUserInformationCollection.setUserConfirm(0);
@@ -574,7 +588,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
             map.setJsonInfo(JSON.toJSONString(answerVOS));
         }
 //
-
+        openIMService.doctorSendMsgToUser(collection.getUserId(),collection.getDoctorType2Id());
         if (fsUserInformationCollectionMapper.updateFsUserInformationCollection(map) > 0) {
             FsPackageOrder fsPackageOrder = packageOrderMapper.selectFsPackageOrderByOrderSn(collection.getPackageOrderCode());
             if(fsPackageOrder.getStoreOrderId()==null||fsPackageOrder.getStoreOrderId()==0){
@@ -674,6 +688,20 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         if (!Objects.equals(collection.getUserId(), param.getUserId())) {
             return R.error("用户信息不匹配,无法确认");
         }
+        //绑定用户
+        CompanyUserUser companyUserUserMap=new CompanyUserUser();
+        companyUserUserMap.setCompanyUserId(collection.getCompanyUserId());
+        companyUserUserMap.setUserId(collection.getUserId());
+        List<CompanyUserUser> list= companyUserUserMapper.selectCompanyUserUserList(companyUserUserMap);
+        if(list==null|| list.isEmpty()){
+            CompanyUser companyUser=companyUserMapper.selectCompanyUserById(collection.getCompanyUserId());
+            if(companyUser!=null&&companyUser.getStatus().equals("0")){
+                companyUserUserMap.setCompanyId(companyUser.getCompanyId());
+                companyUserUserMap.setCreateTime(new Date());
+                companyUserUserMapper.insertCompanyUserUser(companyUserUserMap);
+            }
+        }
+
         FsUserInformationCollection map = new FsUserInformationCollection();
         map.setId(param.getId());
         map.setUserConfirm(1);
@@ -982,37 +1010,43 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         if (companyUser == null) {
             throw new CustomException("销售不存在");
         }
-        Long doctorId = null;
-        if (companyUser.getDoctorId() != null) {
-            FsDoctor doctor = doctorMapper.selectFsDoctorByDoctorId(companyUser.getDoctorId());
-            if (doctor != null) {
-                doctorId = doctor.getDoctorId();
-            }
-        } else {
-            //随机获取医生id
-            doctorId = iFsDoctorService.selectFsDoctorDoctorByPackage();
-        }
-        fsUserInformationCollection.setDoctorId(doctorId);
-
+        //医生
+        Long doctorId = companyUser.getDoctorId();
+        fsUserInformationCollection.setDoctorId(getDoctorId(doctorId,1,param.getPackageId()));
+        //药师
+        Long doctorType2Id = param.getDoctorType2Id();
+        fsUserInformationCollection.setDoctorType2Id(getDoctorId(doctorType2Id,2,param.getPackageId()));
         return fsUserInformationCollection;
     }
 
-    public static void main(String[] args) {
-//        String str1 = "[{\"options\":[{\"flag\":false,\"name\":\"通天\",\"value\":0},{\"flag\":false,\"name\":\"哈哈\",\"value\":1}],\"title\":\"测试标题1\",\"value\":1},{\"options\":[{\"flag\":false,\"name\":\"呼呼\",\"value\":0},{\"flag\":false,\"name\":\"嘻嘻\",\"value\":1}],\"title\":\"测试标题2\",\"value\":1},{\"options\":[{\"flag\":false,\"name\":\"胸痛\",\"value\":0},{\"flag\":false,\"name\":\"胸闷\",\"value\":1},{\"flag\":false,\"name\":\"头晕\",\"value\":2},{\"flag\":false,\"name\":\"肢体麻木\",\"value\":3},{\"flag\":false,\"name\":\"无\",\"value\":4}],\"title\":\"您目前是否有心脑血管相关症状,如胸痛、胸闷、头晕、肢体麻木等?\",\"value\":1}]";
-//        String str2 = "[{\"options\":[{\"flag\":true,\"name\":\"胸痛\",\"value\":0},{\"flag\":true,\"name\":\"胸闷\",\"value\":1},{\"flag\":true,\"name\":\"头晕\",\"value\":2},{\"flag\":true,\"name\":\"肢体麻木\",\"value\":3},{\"flag\":true,\"name\":\"无\",\"value\":4}],\"title\":\"您目前是否有心脑血管相关症状,如胸痛、胸闷、头晕、肢体麻木等?\",\"value\":1},{\"options\":[{\"flag\":false,\"name\":\"胃疼\",\"value\":0},{\"flag\":false,\"name\":\"反酸\",\"value\":1},{\"flag\":false,\"name\":\"恶心\",\"value\":2},{\"flag\":false,\"name\":\"呕吐\",\"value\":3},{\"flag\":false,\"name\":\"黑便\",\"value\":4},{\"flag\":false,\"name\":\"无\",\"value\":5}],\"title\":\"您近期是否出现胃部不适症状,如胃痛、反酸、恶心、呕吐或黑便?\",\"value\":1}]";
-//        List<AnswerVO> vo1 = null;
-//        List<AnswerVO> vo2 = JSON.parseArray(str2, AnswerVO.class);
-//        System.out.println(vo1);
-//        System.out.println(vo2);
-//        vo2.addAll(vo1);
-//        Map<String, List<AnswerVO>> collect = vo2.stream()
-//                .collect(Collectors.groupingBy(AnswerVO::getTitle));
-//        List<AnswerVO> collect1 = vo2.stream()
-//                .collect(Collectors.groupingBy(AnswerVO::getTitle))
-//                .values().stream()
-//                .map(group -> group.stream().reduce((a, b) -> a).orElse(null)).collect(Collectors.toList());
-//        System.out.println(JSON.toJSONString(collect));
-//        System.out.println(JSON.toJSONString(collect1));
-        boolean contains = "是否有糖尿病相关疾病?".contains("糖尿病");
+    /**
+     *  如果是药师 需要根据套餐类型查询药师
+     * @param doctorId
+     * @param doctorType 1医生 2药师
+     * @return
+     */
+    private Long getDoctorId(Long doctorId,Integer doctorType,Long packageId) {
+        FsDoctor doctor = null;
+        if (doctorId != null) {
+            doctor = doctorMapper.selectFsDoctorByDoctorId(doctorId);
+        }
+        if (doctorId == null || doctor == null) {
+            if (doctorType == 1){
+                //随机获取医生id
+                doctorId = iFsDoctorService.selectFsDoctorDoctorByPackage();
+            } else if (doctorType == 2){
+                //随机获取药师id
+                FsPackage fsPackage = fsPackageMapper.selectFsPackageByPackageId(packageId);
+                if (fsPackage != null){
+                    doctor =doctorMapper.selectPackageFsDoctorType2Ids(fsPackage.getProductType());
+                }
+                if (doctor != null) {
+                    doctorId = doctor.getDoctorId();
+                }
+            }
+
+        }
+        return doctorId;
     }
+
 }

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

@@ -13,6 +13,8 @@ import java.util.List;
 @Data
 public class FsUserInformationCollectionAndPatientVO extends FsUserInformationCollection {
     private FsPatient patientInfo; //病人信息
+    private Integer isPay;
+    private Long storeOrderId;
 
 
 }

+ 3 - 0
fs-service/src/main/java/com/fs/live/mapper/LiveAfterSalesMapper.java

@@ -130,4 +130,7 @@ public interface LiveAfterSalesMapper {
             "where user_id=#{userId}  and sales_status =#{salesStatus} " +
             "</script>"})
     Integer selectLiveAfterSalesCount(@Param("userId")long userId,@Param("salesStatus") int salesStatus);
+
+    @Select(" select  * from  live_after_sales where order_id = #{orderId} and sales_status = 0 ")
+    LiveAfterSales getLiveAfterSalesByOrderId(@Param("orderId") Long orderId);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/live/service/ILiveAfterSalesService.java

@@ -90,4 +90,6 @@ public interface ILiveAfterSalesService {
     List<LiveAfterSalesQueryVO> selectLiveAfterSalesListQuery(LiveAfterSalesQueryParam param);
 
     Integer selectLiveAfterSalesCount(long l, int i);
+
+    R handleImmediatelyRefund(Long orderId);
 }

+ 221 - 5
fs-service/src/main/java/com/fs/live/service/impl/LiveAfterSalesServiceImpl.java

@@ -2,6 +2,7 @@ package com.fs.live.service.impl;
 
 import java.lang.reflect.InvocationTargetException;
 import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.util.*;
 
@@ -10,6 +11,7 @@ import cn.hutool.core.date.DateTime;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fs.common.core.domain.R;
 import com.fs.common.exception.CustomException;
@@ -17,6 +19,9 @@ import com.fs.common.utils.CloudHostUtils;
 import com.fs.common.utils.DateUtils;
 
 import com.fs.common.utils.StringUtils;
+import com.fs.common.utils.spring.SpringUtils;
+import com.fs.company.service.ICompanyService;
+import com.fs.config.cloud.CloudHostProper;
 import com.fs.erp.constant.AfterSalesOrderStatusEnum;
 import com.fs.erp.domain.FsJstAftersalePush;
 import com.fs.erp.dto.BaseResponse;
@@ -24,25 +29,30 @@ import com.fs.erp.dto.ErpRefundUpdateRequest;
 import com.fs.erp.mapper.FsJstAftersalePushMapper;
 import com.fs.erp.service.IErpOrderService;
 import com.fs.his.config.FsSysConfig;
+import com.fs.his.domain.FsHfpayConfig;
 import com.fs.his.domain.FsUser;
+import com.fs.his.mapper.FsHfpayConfigMapper;
 import com.fs.his.service.IFsUserService;
 import com.fs.his.utils.ConfigUtil;
+import com.fs.hisStore.config.FsErpConfig;
 import com.fs.hisStore.domain.*;
 import com.fs.hisStore.dto.StoreOrderProductDTO;
-import com.fs.hisStore.enums.AfterSalesStatusEnum;
-import com.fs.hisStore.enums.AfterStatusEnum;
-import com.fs.hisStore.enums.OrderInfoEnum;
-import com.fs.hisStore.enums.SysConfigEnum;
+import com.fs.hisStore.enums.*;
 import com.fs.hisStore.param.FsStoreAfterSalesProductParam;
+import com.fs.hisStore.service.IFsStoreProductScrmService;
 import com.fs.hisStore.service.IFsUserScrmService;
 import com.fs.hisStore.vo.FsStoreAfterSalesQueryVO;
 import com.fs.hisStore.vo.FsStoreOrderItemVO;
+import com.fs.huifuPay.domain.HuiFuRefundResult;
+import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayRefundRequest;
+import com.fs.huifuPay.service.HuiFuService;
 import com.fs.live.domain.*;
 import com.fs.live.dto.LiveAfterSalesProductDTO;
 import com.fs.live.enums.LiveAfterSalesStatusEnum;
 import com.fs.live.mapper.*;
 import com.fs.live.param.*;
 import com.fs.live.service.ILiveOrderItemService;
+import com.fs.live.service.ILiveOrderLogsService;
 import com.fs.live.service.ILiveOrderService;
 import com.fs.live.vo.LiveAfterSalesListUVO;
 import com.fs.live.vo.LiveAfterSalesQueryVO;
@@ -52,9 +62,17 @@ import com.fs.store.config.StoreConfig;
 import com.fs.store.domain.*;
 import com.fs.store.service.cache.IFsUserCacheService;
 import com.fs.system.service.ISysConfigService;
+import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
+import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
+import com.github.binarywang.wxpay.bean.result.WxPayRefundQueryResult;
+import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
+import com.github.binarywang.wxpay.config.WxPayConfig;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import com.github.binarywang.wxpay.service.WxPayService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang.ObjectUtils;
 import org.apache.http.util.Asserts;
 import org.springframework.aop.framework.AopContext;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -864,7 +882,7 @@ public class LiveAfterSalesServiceImpl implements ILiveAfterSalesService {
                 orderMap.setOrderCode(orderSn);
                 liveOrderService.updateLiveOrder(orderMap);
                 //生成新的订单
-                List<LiveOrderPayment> payments = liveOrderPaymentMapper.selectLiveOrderPaymentByPay(2, order.getOrderId());
+                List<LiveOrderPayment> payments = liveOrderPaymentMapper.selectLiveOrderPaymentByPay(5, order.getOrderId());
                 for (LiveOrderPayment payment : payments) {
                     LiveOrderPayment livePayment = new LiveOrderPayment();
                     livePayment.setPaymentId(payment.getPaymentId());
@@ -887,4 +905,202 @@ public class LiveAfterSalesServiceImpl implements ILiveAfterSalesService {
     }
 
 
+    @Autowired
+    private LiveOrderItemMapper liveOrderItemMapper;
+    @Autowired
+    private LiveUserLotteryRecordMapper liveUserLotteryRecordMapper;
+    @Autowired
+    private IFsStoreProductScrmService fsStoreProductService;
+
+    @Autowired
+    private WxPayService wxPayService;
+
+
+    @Autowired
+    private HuiFuService huiFuService;
+
+    @Autowired
+    private ILiveOrderLogsService liveOrderLogsService;
+    @Autowired
+    private ICompanyService companyService;
+
+    @Autowired
+    private LiveAfterSalesMapper liveAfterSalesMapper;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
+    public R handleImmediatelyRefund(Long orderId) {
+        IErpOrderService erpOrderService = getErpService();
+        FsErpConfig erpConfig = configUtil.generateStructConfigByKey("his.config", FsErpConfig.class);
+        LiveOrder order = liveOrderService.selectLiveOrderByOrderId(String.valueOf(orderId));
+        if (order == null) {
+            return R.error("订单不存在");
+        }
+        if (order.getStatus() == -2) {
+            return R.error("已退款");
+        }
+        if (!Integer.valueOf(-1).equals(order.getStatus())) {
+            return R.error("非法操作");
+        }
+        if (erpConfig.getErpOpen() != null
+                && erpConfig.getErpOpen() == 1
+                && StringUtils.isEmpty(order.getExtendOrderId())
+                && !CloudHostUtils.hasCloudHostName("康年堂")) {
+            return R.error("暂未推送至erp,请稍后再试!");
+        }
+//        if (StringUtils.isNotEmpty(order.getExtendOrderId())) {
+//            ErpRefundUpdateRequest request = new ErpRefundUpdateRequest();
+//            request.setTid(order.getOrderCode());
+//            request.setOid(order.getOrderCode());
+//            request.setRefund_state(1);
+//
+//            if (ObjectUtils.equals(order.getStatus(), 2)) {
+//                LiveAfterSalesParam param = new LiveAfterSalesParam();
+//                param.setOrderCode(order.getOrderCode());
+//                param.setRefundAmount(order.getPayMoney());
+//                param.setServiceType(1);
+//                param.setReasons("后台手动退款流程");
+//                param.setExplainImg(null);
+//                List<FsStoreAfterSalesProductParam> productParams = new ArrayList<>();
+//                List <LiveOrderItem> items = liveOrderItemMapper.selectLiveOrderItemByOrderId(order.getOrderId());
+//                for (LiveOrderItem item : items){
+//                    FsStoreAfterSalesProductParam param1 = new FsStoreAfterSalesProductParam();
+//                    param1.setProductId(item.getProductId());
+//                    param1.setNum(Math.toIntExact(item.getNum()));
+//                    productParams.add(param1);
+//                }
+//                return liveAfterSalesService.applyForAfterSales(order.getUserId(), param);
+//            } else {
+//                jSTOrderService.refundUpdateLive(request);
+//            }
+//        }
+        order.setStatus(OrderInfoEnum.STATUS_NE2.getValue());
+        order.setRefundMoney(order.getPayMoney());
+        order.setRefundStatus(String.valueOf(OrderInfoEnum.REFUND_STATUS_2.getValue()));
+        liveUserLotteryRecordMapper.updateOrderStatusByOrderId(order.getOrderId(), -2);
+        liveOrderService.updateLiveOrder(order);
+
+        //退库存
+        //获取订单下的商品
+        List<LiveOrderItem> orderItemVOS = liveOrderItemMapper.selectLiveOrderItemByOrderId(order.getOrderId());
+        for (LiveOrderItem vo : orderItemVOS) {
+            if (vo.getIsAfterSales() == 1) {
+                fsStoreProductService.incProductStock(vo.getNum(), vo.getProductId(), vo.getProductAttrValueId());
+            }
+        }
+        if ("3".equals(order.getPayType())) {
+            //货到付款
+        } else {
+            //将钱退还给用户
+            List<LiveOrderPayment> payments = liveOrderPaymentMapper.selectLiveOrderPaymentByPay(5, order.getOrderId());
+            if (payments != null && !payments.isEmpty()) {
+                String json = configService.selectConfigByKey("his.pay");
+                FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
+                for (LiveOrderPayment payment : payments) {
+                    if (payment.getPayMode() == null || "wx".equals(payment.getPayMode())) {
+                        WxPayConfig payConfig = new WxPayConfig();
+                        payConfig.setAppId(fsPayConfig.getAppId());
+                        payConfig.setMchId(fsPayConfig.getWxMchId());
+                        payConfig.setMchKey(fsPayConfig.getWxMchKey());
+                        payConfig.setKeyPath(fsPayConfig.getKeyPath());
+                        payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
+                        payConfig.setSubMchId(org.apache.commons.lang3.StringUtils.trimToNull(null));
+                        wxPayService.setConfig(payConfig);
+                        WxPayRefundRequest refundRequest = new WxPayRefundRequest();
+                        refundRequest.setOutTradeNo("live-" + payment.getPayCode());
+                        refundRequest.setOutRefundNo("live-" + payment.getPayCode());
+                        refundRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(payment.getPayMoney().toString()));
+                        refundRequest.setRefundFee(WxPayUnifiedOrderRequest.yuanToFen(payment.getPayMoney().toString()));
+                        try {
+                            WxPayRefundResult refundResult = wxPayService.refund(refundRequest);
+                            WxPayRefundQueryResult refundQueryResult = wxPayService.refundQuery("", refundResult.getOutTradeNo(), refundResult.getOutRefundNo(), refundResult.getRefundId());
+                            if (refundQueryResult != null && "SUCCESS".equals(refundQueryResult.getResultCode())) {
+                                LiveOrderPayment paymentMap = new LiveOrderPayment();
+                                paymentMap.setPaymentId(payment.getPaymentId());
+                                paymentMap.setStatus(-1);
+                                paymentMap.setRefundTime(DateUtils.getNowDate());
+                                paymentMap.setRefundMoney(payment.getPayMoney());
+                                liveOrderPaymentMapper.updateLiveOrderPayment(paymentMap);
+                            } else {
+                                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                                return R.error("退款请求失败" + (refundQueryResult != null ? refundQueryResult.getErrCodeDes() : ""));
+                            }
+                        } catch (WxPayException e) {
+                            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                            return R.error("退款请求失败" + e.getErrCodeDes());
+                        }
+                    } else if (payment.getPayMode() != null && "hf".equals(payment.getPayMode())) {
+                        String huifuId = "";
+                        FsHfpayConfigMapper fsHfpayConfigMapper = SpringUtils.getBean(FsHfpayConfigMapper.class);
+                        if (payment.getAppId() != null) {
+                            FsHfpayConfig fsHfpayConfig = fsHfpayConfigMapper.selectByAppId(payment.getAppId());
+                            if (fsHfpayConfig != null) {
+                                huifuId = fsHfpayConfig.getHuifuId();
+                            }
+                        } else {
+                            CloudHostProper cloudHostProper = SpringUtils.getBean(CloudHostProper.class);
+                            if ("益善缘".equals(cloudHostProper.getCompanyName())) {
+                                FsHfpayConfig fsPayConfig2 = fsHfpayConfigMapper.selectByAppId("wx0d1a3dd485268521");
+                                if (fsPayConfig2 != null) {
+                                    huifuId = fsPayConfig2.getHuifuId();
+                                }
+                            } else {
+                                huifuId = fsPayConfig.getHuifuId();
+                            }
+                        }
+
+                        V2TradePaymentScanpayRefundRequest request = new V2TradePaymentScanpayRefundRequest();
+                        request.setOrgHfSeqId(payment.getTradeNo());
+                        request.setHuifuId(huifuId);
+                        request.setOrdAmt(payment.getPayMoney().toString());
+                        request.setOrgReqDate(new SimpleDateFormat("yyyyMMdd").format(payment.getCreateTime()));
+                        request.setReqSeqId("refund-" + payment.getPayCode());
+                        Map<String, Object> extendInfoMap = new HashMap<>();
+                        extendInfoMap.put("org_party_order_id", payment.getBankSerialNo());
+                        request.setExtendInfo(extendInfoMap);
+                        HuiFuRefundResult refund = huiFuService.refund(request);
+                        log.info("退款:" + refund);
+                        if (refund != null && ("00000000".equals(refund.getResp_code()) || "00000100".equals(refund.getResp_code()))
+                                && ("S".equals(refund.getTrans_stat()) || "P".equals(refund.getTrans_stat()))) {
+                            payment.setRefundMoney(payment.getPayMoney());
+                            payment.setStatus(-1);
+                            payment.setRefundTime(new Date());
+                            liveOrderPaymentMapper.updateLiveOrderPayment(payment);
+                        } else {
+                            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                            return R.error(refund != null ? refund.getResp_desc() : "退款失败");
+                        }
+                    } else {
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        return R.error("支付类型异常");
+                    }
+                }
+            }
+        }
+        liveOrderLogsService.create(order.getOrderId(), OrderLogEnum.REFUND_ORDER_SUCCESS.getValue(),
+                OrderLogEnum.REFUND_ORDER_SUCCESS.getDesc());
+        //减去公司收入
+        if (order.getCompanyId() != null && order.getCompanyId() > 0 && order.getTuiMoneyStatus() != null && order.getTuiMoneyStatus() == 1) {
+            companyService.subLiveCompanyMoney(order);
+        }
+        // 减去用户佣金
+        if (order.getTuiUserId() != null && order.getTuiUserId() > 0) {
+            IFsUserScrmService userService = SpringUtils.getBean(IFsUserScrmService.class);
+            if (userService != null) {
+                // 需要将LiveOrder转换为FsStoreOrderScrm用于subTuiMoney方法
+                FsStoreOrderScrm storeOrder = new FsStoreOrderScrm();
+                storeOrder.setId(order.getOrderId());
+                storeOrder.setTuiUserId(order.getTuiUserId());
+                userService.subTuiMoney(storeOrder);
+            }
+        }
+        LiveAfterSales liveAfterSales = liveAfterSalesMapper.getLiveAfterSalesByOrderId(orderId);
+        LiveAfterSales liveMp = new LiveAfterSales();
+        liveMp.setId(liveAfterSales.getId());
+        liveMp.setStatus(LiveAfterSalesStatusEnum.STATUS_4.getValue());
+        liveMp.setSalesStatus(3);
+        liveAfterSalesMapper.updateLiveAfterSales(liveMp);
+
+        return R.ok();
+    }
 }

+ 111 - 85
fs-service/src/main/java/com/fs/live/service/impl/LiveOrderServiceImpl.java

@@ -29,6 +29,8 @@ import com.alibaba.fastjson.JSON;
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.config.FSSysConfig;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
@@ -63,6 +65,7 @@ import com.fs.his.enums.FsStoreOrderLogEnum;
 import com.fs.his.mapper.FsHfpayConfigMapper;
 import com.fs.his.mapper.FsStoreProductAttrValueMapper;
 import com.fs.his.mapper.FsUserMapper;
+import com.fs.his.mapper.FsUserWxMapper;
 import com.fs.his.service.IFsExpressService;
 import com.fs.his.service.IFsStoreProductService;
 import com.fs.his.service.IFsUserService;
@@ -136,6 +139,8 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
     private final RedisCache redisCache;
     @Autowired
     private LiveOrderMapper baseMapper;
+    @Autowired
+    private FsUserWxMapper fsUserWxMapper;
 
 
 
@@ -2364,82 +2369,86 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 
     private BigDecimal handleDeliveryMoney(Long cityId, FsStoreProductScrm fsStoreProduct, String totalNumSize) {
         BigDecimal storePostage = BigDecimal.ZERO;
-//        List<Long> citys = new ArrayList<>();
-//        citys.add(cityId);
-//        citys.add(0l);
-//        String ids = String.valueOf(fsStoreProduct.getTempId());
-//        List<FsShippingTemplates> shippingTemplatesList = shippingTemplatesService.selectFsShippingTemplatesByIds(ids);
-//        String cityIds = String.join(",", citys.stream()
-//                .map(String::valueOf).collect(Collectors.toList()));
-//        List<FsShippingTemplatesRegion> shippingTemplatesRegionList = shippingTemplatesRegionService.selectFsShippingTemplatesRegionListByTempIdsAndCityIds(ids,cityIds);
-//        Map<Long, Integer> shippingTemplatesMap = shippingTemplatesList
-//                .stream()
-//                .collect(Collectors.toMap(FsShippingTemplates::getId,
-//                        FsShippingTemplates::getType));
-//        //提取运费模板有相同值覆盖
-//        Map<Long, FsShippingTemplatesRegion> shippingTemplatesRegionMap =
-//                shippingTemplatesRegionList.stream()
-//                        .collect(Collectors.toMap(FsShippingTemplatesRegion::getTempId,
-//                                YxShippingTemplatesRegion -> YxShippingTemplatesRegion,
-//                                (key1, key2) -> key2));
-//        Long tempId = Long.valueOf(fsStoreProduct.getTempId());
-//        double num = 0d;
-//        Integer templateType = shippingTemplatesMap.get(tempId);
-//        List<FsStoreProductAttrValue> productAttrValues = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(fsStoreProduct.getProductId());
-//        if(productAttrValues == null || productAttrValues.isEmpty()) {
-//            return storePostage;
-//        }
-//        FsStoreProductAttrValue productAttrValue = productAttrValues.get(0);
-//        Integer totalNum = Integer.valueOf(totalNumSize);
-//        // TYPE_1: 按件数计算
-//        if (ShippingTempEnum.TYPE_1.getValue().equals(templateType)) {
-//            num = totalNum.doubleValue();
-//        }
-//        // TYPE_2: 按重量计算(数量 × 重量)
-//        else if (ShippingTempEnum.TYPE_2.getValue().equals(templateType)) {
-//            num = NumberUtil.mul(totalNum, productAttrValue.getWeight()).doubleValue();
-//        }
-//        // TYPE_3: 按体积计算(数量 × 体积)
-//        else if (ShippingTempEnum.TYPE_3.getValue().equals(templateType)) {
-//            num = NumberUtil.mul(totalNum, productAttrValue.getVolume()).doubleValue();
-//        }
-//        FsShippingTemplatesRegion shippingTemplatesRegion = shippingTemplatesRegionMap.get(tempId);
-//        if (shippingTemplatesRegion == null) {
-//            log.error("没有找到运费模板");
-//            return storePostage;
-//        }
-//        BigDecimal price = NumberUtil.round(NumberUtil.mul(totalNum, fsStoreProduct.getPrice()), 2);
-//
-//        TemplateDTO templateDTO = TemplateDTO.builder()
-//                .number(num)  // 累计数量(件数/重量/体积)
-//                .price(price)  // 累计金额
-//                .first(shippingTemplatesRegion.getFirst().doubleValue())  // 首件数量
-//                .firstPrice(shippingTemplatesRegion.getFirstPrice())  // 首件运费
-//                .continues(shippingTemplatesRegion.getContinues().doubleValue())  // 续件数量
-//                .continuePrice(shippingTemplatesRegion.getContinuePrice())  // 续件运费
-//                .tempId(tempId)  // 模板ID
-//                .cityId(cityId)  // 城市ID
-//                .build();
-//        //只满足首件
-//        if (Double.compare(templateDTO.getNumber(), templateDTO.getFirst()) <= 0) {
-//            storePostage = NumberUtil.round(NumberUtil.add(storePostage,
-//                    templateDTO.getFirstPrice()), 2);
-//        } else {
-//            BigDecimal firstPrice = NumberUtil.add(storePostage, templateDTO.getFirstPrice());
-//
-//            if (templateDTO.getContinues() <= 0) {
-//                storePostage = firstPrice;
-//            } else {
-//                //续件平均值且向上取整数
-//                double average = Math.ceil(NumberUtil.div(NumberUtil.sub(templateDTO.getNumber(),
-//                                templateDTO.getFirst()),
-//                        templateDTO.getContinues().doubleValue()));
-//                //最终邮费
-//                storePostage = NumberUtil.add(firstPrice, NumberUtil.mul(average,
-//                        templateDTO.getContinuePrice()));
-//            }
-//
-//        }
+        List<Long> citys = new ArrayList<>();
+        citys.add(cityId);
+        citys.add(0l);
+        String ids = String.valueOf(fsStoreProduct.getTempId());
+        //如果没有配置运费 直接返回
+        if(StringUtils.isBlank(ids)){
+            return storePostage;
+        }
+        List<FsShippingTemplatesScrm> shippingTemplatesList = shippingTemplatesService.selectFsShippingTemplatesByIds(ids);
+        String cityIds = String.join(",", citys.stream()
+                .map(String::valueOf).collect(Collectors.toList()));
+        List<FsShippingTemplatesRegionScrm> shippingTemplatesRegionList = shippingTemplatesRegionService.selectFsShippingTemplatesRegionListByTempIdsAndCityIds(ids,cityIds);
+        Map<Long, Integer> shippingTemplatesMap = shippingTemplatesList
+                .stream()
+                .collect(Collectors.toMap(FsShippingTemplatesScrm::getId,
+                        FsShippingTemplatesScrm::getType));
+        //提取运费模板有相同值覆盖
+        Map<Long, FsShippingTemplatesRegionScrm> shippingTemplatesRegionMap =
+                shippingTemplatesRegionList.stream()
+                        .collect(Collectors.toMap(FsShippingTemplatesRegionScrm::getTempId,
+                                YxShippingTemplatesRegion -> YxShippingTemplatesRegion,
+                                (key1, key2) -> key2));
+        Long tempId = Long.valueOf(fsStoreProduct.getTempId());
+        double num = 0d;
+        Integer templateType = shippingTemplatesMap.get(tempId);
+        List<FsStoreProductAttrValueScrm> productAttrValues = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(fsStoreProduct.getProductId());
+        if(productAttrValues == null || productAttrValues.isEmpty()) {
+            return storePostage;
+        }
+        FsStoreProductAttrValueScrm productAttrValue = productAttrValues.get(0);
+        Integer totalNum = Integer.valueOf(totalNumSize);
+        // TYPE_1: 按件数计算
+        if (ShippingTempEnum.TYPE_1.getValue().equals(templateType)) {
+            num = totalNum.doubleValue();
+        }
+        // TYPE_2: 按重量计算(数量 × 重量)
+        else if (ShippingTempEnum.TYPE_2.getValue().equals(templateType)) {
+            num = NumberUtil.mul(totalNum, productAttrValue.getWeight()).doubleValue();
+        }
+        // TYPE_3: 按体积计算(数量 × 体积)
+        else if (ShippingTempEnum.TYPE_3.getValue().equals(templateType)) {
+            num = NumberUtil.mul(totalNum, productAttrValue.getVolume()).doubleValue();
+        }
+        FsShippingTemplatesRegionScrm shippingTemplatesRegion = shippingTemplatesRegionMap.get(tempId);
+        if (shippingTemplatesRegion == null) {
+            log.error("没有找到运费模板");
+            return storePostage;
+        }
+        BigDecimal price = NumberUtil.round(NumberUtil.mul(totalNum, fsStoreProduct.getPrice()), 2);
+
+        TemplateDTO templateDTO = TemplateDTO.builder()
+                .number(num)  // 累计数量(件数/重量/体积)
+                .price(price)  // 累计金额
+                .first(shippingTemplatesRegion.getFirst().doubleValue())  // 首件数量
+                .firstPrice(shippingTemplatesRegion.getFirstPrice())  // 首件运费
+                .continues(shippingTemplatesRegion.getContinues().doubleValue())  // 续件数量
+                .continuePrice(shippingTemplatesRegion.getContinuePrice())  // 续件运费
+                .tempId(tempId)  // 模板ID
+                .cityId(cityId.toString())  // 城市ID
+                .build();
+        //只满足首件
+        if (Double.compare(templateDTO.getNumber(), templateDTO.getFirst()) <= 0) {
+            storePostage = NumberUtil.round(NumberUtil.add(storePostage,
+                    templateDTO.getFirstPrice()), 2);
+        } else {
+            BigDecimal firstPrice = NumberUtil.add(storePostage, templateDTO.getFirstPrice());
+
+            if (templateDTO.getContinues() <= 0) {
+                storePostage = firstPrice;
+            } else {
+                //续件平均值且向上取整数
+                double average = Math.ceil(NumberUtil.div(NumberUtil.sub(templateDTO.getNumber(),
+                                templateDTO.getFirst()),
+                        templateDTO.getContinues().doubleValue()));
+                //最终邮费
+                storePostage = NumberUtil.add(firstPrice, NumberUtil.mul(average,
+                        templateDTO.getContinuePrice()));
+            }
+
+        }
 
         return storePostage;
     }
@@ -2847,9 +2856,25 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
         if(StringUtils.isNotEmpty(orderId)&&order.getOrderId().toString().equals(orderId)){
             return R.error("正在支付中...");
         }
-
         FsUserScrm user=userMapper.selectFsUserById(Long.valueOf(order.getUserId()));
-        if(user!=null&& StringUtils.isNotEmpty(user.getMaOpenId())){
+        if(user == null){
+            return R.error("未找到用户信息,请联系管理员!");
+        }
+        String json = configService.selectConfigByKey("his.pay");
+        FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
+        String openId;
+        if(StringUtils.isNotEmpty(user.getMaOpenId())){
+            log.info("用户信息有openid:{}", user.getMaOpenId());
+            openId = user.getMaOpenId();
+        }else{
+            Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
+                    .eq(FsUserWx::getFsUserId, order.getUserId())
+                    .eq(FsUserWx::getAppId, fsPayConfig.getAppId());
+            FsUserWx fsUserWx = fsUserWxMapper.selectOne(queryWrapper);
+            log.info("查到的openId信息:{}", fsUserWx);
+            openId = fsUserWx.getOpenId();
+        }
+        if(StringUtils.isNotEmpty(openId)){
             //已改价处理
             if(order.getIsEditMoney()!=null&&order.getIsEditMoney()==1){
                 //改过价不做处理
@@ -2888,8 +2913,6 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 //            order.setOrderCode(orderCode);
 //            if(order.getPayType().equals("1")||order.getPayType().equals("2")){
             if((order.getPayType().equals("1")||order.getPayType().equals("2")||order.getPayType().equals("3")) && order.getPayMoney().compareTo(new BigDecimal(0))>0){
-                String json = configService.selectConfigByKey("his.pay");
-                FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
                 LiveOrderPayment storePayment=new LiveOrderPayment();
                 storePayment.setCompanyId(order.getCompanyId());
                 storePayment.setCompanyUserId(order.getCompanyUserId());
@@ -2899,9 +2922,9 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                 storePayment.setPayMoney(order.getPayMoney());
                 storePayment.setCreateTime(new Date());
                 storePayment.setPayTypeCode("weixin");
-                storePayment.setBusinessType(2);
+                storePayment.setBusinessType(5);
                 storePayment.setRemark("直播订单支付");
-                storePayment.setOpenId(user.getRealName());
+                storePayment.setOpenId(openId);
                 storePayment.setUserId(user.getUserId());
                 storePayment.setBusinessId(String.valueOf(order.getOrderId()));
                 storePayment.setAppId(fsPayConfig.getAppId() == null ? "" : fsPayConfig.getAppId());
@@ -2910,11 +2933,11 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                 if (fsPayConfig.getType().equals("hf")){
                     HuiFuCreateOrder o = new HuiFuCreateOrder();
                     o.setTradeType("T_MINIAPP");
-                    o.setOpenid(user.getMaOpenId());
+                    o.setOpenid(storePayment.getOpenId());
                     o.setReqSeqId("live-"+storePayment.getPayCode());
                     o.setTransAmt(storePayment.getPayMoney().toString());
                     o.setGoodsDesc("直播订单支付");
-                    if (param != null && StringUtils.isNotBlank(param.getAppId())) {
+                    if (StringUtils.isNotBlank(param.getAppId())) {
                         o.setAppId(param.getAppId());
                     }
                     HuifuCreateOrderResult result = huiFuService.createOrder(o);
@@ -2926,6 +2949,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                         mt.setBusinessCode(order.getOrderCode());
                         liveOrderPaymentMapper.updateLiveOrderPayment(mt);
                         redisCache.setCacheObject("isPaying:"+order.getOrderId(),order.getOrderId().toString(),1, TimeUnit.MINUTES);
+                        log.info("汇付支付");
                         Map<String, Object> resultMap = JSON.parseObject(result.getPay_info(), new TypeReference<Map<String, Object>>() {});
                         String s = (String) resultMap.get("package");
                         resultMap.put("packageValue",s);
@@ -2945,7 +2969,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                     payConfig.setNotifyUrl(fsPayConfig.getNotifyUrlScrm());
                     wxPayService.setConfig(payConfig);
                     WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
-                    orderRequest.setOpenid(user.getMaOpenId());//公众号支付提供用户openid
+                    orderRequest.setOpenid(storePayment.getOpenId());
                     orderRequest.setBody("直播订单支付");
                     orderRequest.setOutTradeNo("live-" + storePayment.getPayCode());
                     orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));//测试
@@ -3270,9 +3294,11 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 
         // 更改店铺库存
         fsStoreProduct.setStock(fsStoreProduct.getStock()-Integer.parseInt(liveOrder.getTotalNum()));
+        fsStoreProduct.setSales(fsStoreProduct.getSales()+Long.parseLong(liveOrder.getTotalNum()));
         fsStoreProductService.updateFsStoreProduct(fsStoreProduct);
         // 更新直播间库存
         goods.setStock(goods.getStock()-Integer.parseInt(liveOrder.getTotalNum()));
+        goods.setSales(goods.getSales()+Integer.parseInt(liveOrder.getTotalNum()));
         liveGoodsMapper.updateLiveGoods(goods);
 
         //判断是否是三种特定产品

+ 16 - 5
fs-service/src/main/java/com/fs/live/service/impl/LiveServiceImpl.java

@@ -6,13 +6,18 @@ import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.core.page.PageRequest;
 import com.fs.common.exception.base.BaseException;
 import com.fs.company.mapper.CompanyMapper;
 import com.fs.core.config.WxMaConfiguration;
 import com.fs.his.domain.FsStoreProduct;
 import com.fs.his.domain.FsUser;
+import com.fs.his.domain.FsUserWx;
 import com.fs.his.mapper.FsUserMapper;
+import com.fs.his.mapper.FsUserWxMapper;
 import com.fs.hisStore.domain.FsStoreProductScrm;
 import com.fs.hisStore.mapper.FsStoreProductScrmMapper;
 import com.fs.live.dto.TemplateMessageSendRequestDTO;
@@ -111,6 +116,8 @@ public class LiveServiceImpl implements ILiveService
     @Autowired
     private FsUserMapper fsUserMapper;
     @Autowired
+    private FsUserWxMapper fsUserWxMapper;
+    @Autowired
     private CompanyMapper companyMapper;
     @Autowired
     private LiveCouponMapper liveCouponMapper;
@@ -243,11 +250,15 @@ public class LiveServiceImpl implements ILiveService
         notifyTask.setPage("/pages_course/living?liveId=" + param.get("liveId"));
         notifyTask.setTaskName("直播间预约提醒");
         notifyTask.setTemplateId((String) param.get("templateId"));
-        FsUser fsUser = fsUserMapper.selectFsUserById(Long.valueOf((Integer) param.get("userId")));
-        String maOpenId = fsUser.getMaOpenId();
-        if (StringUtils.isEmpty(maOpenId)) {
-            maOpenId = (String) param.get("maOpenId");
-        }
+        Long userId = Long.valueOf((Integer) param.get("userId"));
+        Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
+                .eq(FsUserWx::getFsUserId, userId)
+                .eq(FsUserWx::getAppId, param.getOrDefault("appid", "wx44beed5640bcb1ba"));
+        FsUserWx fsUserWx = fsUserWxMapper.selectOne(queryWrapper);
+        String maOpenId = fsUserWx.getOpenId();
+//        if (StringUtils.isEmpty(maOpenId)) {
+//            maOpenId = (String) param.get("maOpenId");
+//        }
         notifyTask.setTouser(maOpenId);
         notifyTask.setPage(String.valueOf(1));
 

+ 1 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwUserMapper.java

@@ -487,4 +487,5 @@ public interface QwUserMapper extends BaseMapper<QwUser>
             "</script>")
     List<QwUser> selectQwUserByIds(@Param("qwUserIdList") List<Long> qwUserIdList);
 
+    List<QwUser> selectQwUserByTest();
 }

+ 15 - 11
fs-service/src/main/resources/application-config-druid-bjczwh.yml

@@ -37,8 +37,8 @@ wx:
       port: 6379
       timeout: 2000
     configs:
-      - appId: wx090xxxx5456e # 第一个公众号的appid  //公众号名称:德瑞康
-        secret: dc70e9xxxx0aea6b7c52b7 # 公众号的appsecret--德瑞康
+      - appId: wx014d7c4fff877ea0 # 第一个公众号的appid  //公众号名称:食养美好生活
+        secret: ef574e8c66433cac1b158ea3a901650c # 公众号的appsecret--食养美好生活
         token: PPKOdAlCoMO # 接口配置里的Token值
         aesKey: Eswa6VjwtVMCcw03qZy6fWllgrv5aytIA1SZPEU0kU2 # 接口配置里的EncodingAESKey值
 aifabu:  #爱链接
@@ -55,8 +55,14 @@ watch:
   password3: v9xsKuqn_$d2y
 
 fs :
-  commonApi: http://127.0.0.1:7771
-  h5CommonApi: http://127.0.0.1:7771
+  commonApi: http://192.168.0.194:7771
+  h5CommonApi: http://192.168.0.194:7771
+  jwt:
+    # 加密秘钥
+    secret: bjczwh-bcdefg
+    # token有效时长,7天,单位秒
+    expire: 31536000
+    header: AppToken
 nuonuo:
   key: 10924508
   secret: A2EB20764D304D16
@@ -78,17 +84,15 @@ tmp_secret_config:
   proxy: fs
 cloud_host:
   company_name: 北京存在文化
-  projectCode: BJCZWH
+  projectCode: CZWH
 headerImg:
   imgUrl:
 
 ipad:
-  ipadUrl: http://ipad.cdwjyyh.com
-  aiApi: 1212121212
-  voiceApi:
-  commonApi:
+  ipadUrl: http://aipad.moonxiang.com
+  aiApi: http://49.232.181.28:3000/api
+  voiceApi: http://81.70.193.34:8667
+  commonApi: http://81.70.193.34:7771
 wx_miniapp_temp:
   pay_order_temp_id:
   inquiry_temp_id:
-
-

+ 98 - 0
fs-service/src/main/resources/application-config-druid-gzzdy.yml

@@ -0,0 +1,98 @@
+baidu:
+  token: 12313231232
+  back-domain: https://www.xxxx.com
+#配置
+logging:
+  level:
+    org.springframework.web: INFO
+    com.github.binarywang.demo.wx.cp: DEBUG
+    me.chanjar.weixin: DEBUG
+wx:
+  miniapp:
+    configs:
+      - appid:
+        secret:
+        token:
+        aesKey:
+        msgDataFormat: JSON
+      - appid:
+        secret:
+        token:
+        aesKey: HlEiBB55eaWUaeBVAQO3cWKWPYv1vOVQSq7nFNICw4E
+        msgDataFormat: JSON
+  cp:
+    corpId:
+    appConfigs:
+      - agentId: 100005
+        secret: ec7okROXJqkNafq66aKNasTzQIG0CYrj3vyBbo
+        token: PPKOdAlMO
+        aesKey: PKvaxtpSvNGpfT7VUHIK8Wok2ESyYX24qpXJAdMP
+  pay:
+    appId:  #微信公众号或者小程序等的appid
+    mchId:  #微信支付商户号
+    mchKey:  #微信支付商户密钥
+    subAppId:  #服务商模式下的子商户公众账号ID
+    subMchId:  #服务商模式下的子商户号
+    keyPath: c:\\cert\\apiclient_cert.p12 # p12证书的位置,可以指定绝对路径,也可以指定类路径(以classpath:开头)
+    notifyUrl: https://userapp.dyzkl.cn/app/wxpay/wxPayNotify
+  mp:
+    useRedis: false
+    redisConfig:
+      host: 127.0.0.1
+      port: 6379
+      timeout: 2000
+    configs:
+      - appId:  wxf468f88fbbb845af # 第一个公众号的appid
+        secret: 812d49175dadf579bdd4ad812867793a  # 公众号的appsecret
+        token: PPKOdAlCoMO # 接口配置里的Token值
+        aesKey: Eswa6VjwtVMCcw03qZy6fWllgrv5aytIA1SZPEU0kU2 # 接口配置里的EncodingAESKey值
+aifabu:  #爱链接
+  appKey: 7b471be905ab17ef358c0dd117601d008
+watch:
+  watchUrl: watch.ylrzcloud.com/prod-api
+#  account: tcloud
+#  password: mdf-m2h_6yw2$hq
+  account1: ccif #866655060138751
+  password1: cp-t5or_6xw7$mt
+  account2: tcloud #rt500台
+  password2: mdf-m2h_6yw2$hq
+  account3: whr
+  password3: v9xsKuqn_$d2y
+
+fs :
+  commonApi: http://172.16.16.7:7771
+  h5CommonApi: http://172.16.16.7:7771
+  jwt:
+    # 加密秘钥
+    secret: f4e2e52034348f86b67cde581c0f9eb5
+    # token有效时长,7天,单位秒
+    expire: 31536000
+    header: AppToken
+nuonuo:
+  key: 10924508
+  secret: A2EB20764D304D16
+
+# 存储捅配置
+tencent_cloud_config:
+  secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
+  secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
+  bucket: gzzdy-1323137866
+  app_id: 1323137866
+  region: ap-chongqing
+  proxy: gzzdy
+cloud_host:
+  company_name: 广州郑多燕
+  projectCode: GZZDY
+#看课授权时显示的头像
+headerImg:
+  imgUrl:
+ipad:
+  ipadUrl: http://ipad.dyzkl.cn
+  aiApi: http://49.232.181.28:3000/api
+  voiceApi: http://123.207.48.104:8009
+  commonApi: http://123.207.48.104:7771
+wx_miniapp_temp:
+  pay_order_temp_id:
+  inquiry_temp_id:
+
+

+ 1 - 1
fs-service/src/main/resources/application-config-druid-hzyy.yml

@@ -89,7 +89,7 @@ headerImg:
   imgUrl: https://hzyy.obs.cn-north-4.myhuaweicloud.com/fs/20250616/1750067609692.png
 ipad:
   ipadUrl: http://139.159.133.223:8667
-  aiApi: http://1.95.196.10:3000/api
+  aiApi: http://49.232.181.28:3000/api
   voiceApi:
   commonApi:
 wx_miniapp_temp:

+ 1 - 1
fs-service/src/main/resources/application-config-druid-sxjz.yml

@@ -92,7 +92,7 @@ headerImg:
   imgUrl: https://jz-cos-1356808054.cos.ap-chengdu.myqcloud.com/fs/20250515/0877754b59814ea8a428fa3697b20e68.png
 ipad:
   ipadUrl: http://ipad.xintaihl.cn
-  aiApi: http://1.95.196.10:3000/api
+  aiApi: http://49.232.181.28:3000/api
   voiceApi:
   commonApi:
 wx_miniapp_temp:

+ 159 - 150
fs-service/src/main/resources/application-druid-bjczwh.yml

@@ -1,158 +1,167 @@
 # 数据源配置
 spring:
-    profiles:
-        include: config-druid-bjczwh,common
-    # redis 配置
-    redis:
-        host: r-bp1ylqods7sqn8gs4b.redis.rds.aliyuncs.com
-        port: 6379
-        # 数据库索引
-        database: 0
-        # 密码
-        password: Ylrz_1q2w3e4r5t6y
-        # 连接超时时间
-        timeout: 10s
-        lettuce:
-            pool:
-                # 连接池中的最小空闲连接
-                min-idle: 0
-                # 连接池中的最大空闲连接
-                max-idle: 8
-                # 连接池的最大数据库连接数
-                max-active: 100
-                # #连接池最大阻塞等待时间(使用负值表示没有限制)
-                max-wait: -1ms
-    datasource:
-#        clickhouse:
-#            type: com.alibaba.druid.pool.DruidDataSource
-#            driverClassName: com.clickhouse.jdbc.ClickHouseDriver
-#            url: jdbc:clickhouse://1.14.104.71:8123/sop_test?compress=0&use_server_time_zone=true&use_client_time_zone=false&timezone=Asia/Shanghai
-#            username: rt_2024
-#            password: Yzx_19860213
-#            initialSize: 10
-#            maxActive: 100
-#            minIdle: 10
-#            maxWait: 6000
-        mysql:
-            type: com.alibaba.druid.pool.DruidDataSource
-            driverClassName: com.mysql.cj.jdbc.Driver
-            druid:
-                # 主库数据源
-                master:
-                  url: jdbc:mysql://rm-bp10925iw97l3b2hb.mysql.rds.aliyuncs.com:3306/fs_his?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-                  username: root
-                  password: Ylrz_1q2w3e4r5t6y
-                # 从库数据源
-                slave:
-                    # 从数据源开关/默认关闭
-                    enabled: false
-                    url:
-                    username:
-                    password:
-                # 初始连接数
-                initialSize: 5
-                # 最小连接池数量
-                minIdle: 10
-                # 最大连接池数量
-                maxActive: 20
-                # 配置获取连接等待超时的时间
-                maxWait: 60000
-                # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
-                timeBetweenEvictionRunsMillis: 60000
-                # 配置一个连接在池中最小生存的时间,单位是毫秒
-                minEvictableIdleTimeMillis: 300000
-                # 配置一个连接在池中最大生存的时间,单位是毫秒
-                maxEvictableIdleTimeMillis: 900000
-                # 配置检测连接是否有效
-                validationQuery: SELECT 1 FROM DUAL
-                testWhileIdle: true
-                testOnBorrow: false
-                testOnReturn: false
-                webStatFilter:
-                    enabled: true
-                statViewServlet:
-                    enabled: true
-                    # 设置白名单,不填则允许所有访问
-                    allow:
-                    url-pattern: /druid/*
-                    # 控制台管理用户名和密码
-                    login-username: fs
-                    login-password: 123456
-                filter:
-                    stat:
-                        enabled: true
-                        # 慢SQL记录
-                        log-slow-sql: true
-                        slow-sql-millis: 1000
-                        merge-sql: true
-                    wall:
-                        config:
-                            multi-statement-allow: true
-        sop:
-            type: com.alibaba.druid.pool.DruidDataSource
-            driverClassName: com.mysql.cj.jdbc.Driver
-            druid:
-                # 主库数据源
-                master:
-                    url: jdbc:mysql://rm-bp10925iw97l3b2hb.mysql.rds.aliyuncs.com:3306/fs_his_sop?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-                    username: root
-                    password: Ylrz_1q2w3e4r5t6y
-                # 初始连接数
-                initialSize: 5
-                # 最小连接池数量
-                minIdle: 10
-                # 最大连接池数量
-                maxActive: 20
-                # 配置获取连接等待超时的时间
-                maxWait: 60000
-                # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
-                timeBetweenEvictionRunsMillis: 60000
-                # 配置一个连接在池中最小生存的时间,单位是毫秒
-                minEvictableIdleTimeMillis: 300000
-                # 配置一个连接在池中最大生存的时间,单位是毫秒
-                maxEvictableIdleTimeMillis: 900000
-                # 配置检测连接是否有效
-                validationQuery: SELECT 1 FROM DUAL
-                testWhileIdle: true
-                testOnBorrow: false
-                testOnReturn: false
-                webStatFilter:
-                    enabled: true
-                statViewServlet:
-                    enabled: true
-                    # 设置白名单,不填则允许所有访问
-                    allow:
-                    url-pattern: /druid/*
-                    # 控制台管理用户名和密码
-                    login-username: fs
-                    login-password: 123456
-                filter:
-                    stat:
-                        enabled: true
-                        # 慢SQL记录
-                        log-slow-sql: true
-                        slow-sql-millis: 1000
-                        merge-sql: true
-                    wall:
-                        config:
-                            multi-statement-allow: true
+  profiles:
+    include: config-druid-bjczwh,common
+  # redis 配置
+  redis:
+    host: redis-b6d80cf4-3df9-43c8-8182-bfe3ace0098b.cn-southwest-2.dcs.myhuaweicloud.com
+    port: 6379
+    # 数据库索引
+    database: 0
+    # 密码
+    password:
+    # 连接超时时间
+    timeout: 10s
+    lettuce:
+      pool:
+        # 连接池中的最小空闲连接
+        min-idle: 0
+        # 连接池中的最大空闲连接
+        max-idle: 8
+        # 连接池的最大数据库连接数
+        max-active: 100
+        # #连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-wait: -1ms
+  datasource:
+    #        clickhouse:
+    #            type: com.alibaba.druid.pool.DruidDataSource
+    #            driverClassName: com.clickhouse.jdbc.ClickHouseDriver
+    #            url: jdbc:clickhouse://1.14.104.71:8123/sop_test?compress=0&use_server_time_zone=true&use_client_time_zone=false&timezone=Asia/Shanghai
+    #            username: rt_2024
+    #            password: Yzx_19860213
+    #            initialSize: 10
+    #            maxActive: 100
+    #            minIdle: 10
+    #            maxWait: 6000
+    mysql:
+      type: com.alibaba.druid.pool.DruidDataSource
+      driverClassName: com.mysql.cj.jdbc.Driver
+      druid:
+        # 主库数据源
+        master:
+          url: jdbc:mysql://rds.czwh.lan:3306/fs_his?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+          username: czwh
+          password: Ylrz_1q2w3e4r5t6y
+        # 从库数据源
+        slave:
+          # 从数据源开关/默认关闭
+          enabled: false
+          url:
+          username:
+          password:
+        # 初始连接数
+        initialSize: 5
+        # 最小连接池数量
+        minIdle: 10
+        # 最大连接池数量
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        # 配置一个连接在池中最大生存的时间,单位是毫秒
+        maxEvictableIdleTimeMillis: 900000
+        # 配置检测连接是否有效
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        webStatFilter:
+          enabled: true
+        statViewServlet:
+          enabled: true
+          # 设置白名单,不填则允许所有访问
+          allow:
+          url-pattern: /druid/*
+          # 控制台管理用户名和密码
+          login-username: fs
+          login-password: 123456
+        filter:
+          stat:
+            enabled: true
+            # 慢SQL记录
+            log-slow-sql: true
+            slow-sql-millis: 1000
+            merge-sql: true
+          wall:
+            config:
+              multi-statement-allow: true
+    sop:
+      type: com.alibaba.druid.pool.DruidDataSource
+      driverClassName: com.mysql.cj.jdbc.Driver
+      druid:
+        # 主库数据源
+        master:
+          url: jdbc:mysql://rds.czwh.lan:3306/fs_his_sop?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+          username: czwh
+          password: Ylrz_1q2w3e4r5t6y
+        # 初始连接数
+        initialSize: 5
+        # 最小连接池数量
+        minIdle: 10
+        # 最大连接池数量
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        # 配置一个连接在池中最大生存的时间,单位是毫秒
+        maxEvictableIdleTimeMillis: 900000
+        # 配置检测连接是否有效
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        webStatFilter:
+          enabled: true
+        statViewServlet:
+          enabled: true
+          # 设置白名单,不填则允许所有访问
+          allow:
+          url-pattern: /druid/*
+          # 控制台管理用户名和密码
+          login-username: fs
+          login-password: 123456
+        filter:
+          stat:
+            enabled: true
+            # 慢SQL记录
+            log-slow-sql: true
+            slow-sql-millis: 1000
+            merge-sql: true
+          wall:
+            config:
+              multi-statement-allow: true
 rocketmq:
-    name-server: rmq-16xj8o92zp.rocketmq.cd.qcloud.tencenttdmq.com:8080
-    producer:
-        group: my-producer-group
-        access-key: ak16xj8o92zp984557f83ba2 # 替换为实际的 accessKey
-        secret-key: sk2ff1c6b15b74b888 # 替换为实际的 secretKey
-    consumer:
-        group: common-group
-        access-key: ak16xj8o92zp984557f83ba2 # 替换为实际的 accessKey
-        secret-key: sk2ff1c6b15b74b888 # 替换为实际的 secretKey
+  name-server: 192.168.0.124:8100
+  producer:
+    group: my-producer-group
+    access-key: default # 替换为实际的 accessKey
+    secret-key: O1VnW98G8Rmn0PoZ # 替换为实际的 secretKey
+  consumer:
+    topic: course-finish-notes
+    group: course-finish-group
+    access-key: default # 替换为实际的 accessKey
+    secret-key: O1VnW98G8Rmn0PoZ # 替换为实际的 secretKey
 openIM:
-    secret: openIM123
-    userID: imAdmin
-    url: https://web.im.fbylive.com/api
+  secret: openIM123
+  userID: imAdmin
+  url: https://web.im.fbylive.com/api
 #是否为新商户,新商户不走mpOpenId
-isNewWxMerchant: true
+isNewWxMerchant: false
 #是否使用新im
 im:
-    type: NONE
+  type: NONE
+
+qw:
+  enableAutoTag: 1
+tag:
+  thread:
+    num: 5
+  rate:
+    limit: 30
 

+ 151 - 0
fs-service/src/main/resources/application-druid-gzzdy.yml

@@ -0,0 +1,151 @@
+# 数据源配置
+spring:
+  profiles:
+    include: common,config-druid-gzzdy
+  # redis 配置
+  redis:
+    # 地址
+    host: 172.16.16.17
+    # 端口,默认为6379
+    port: 6379
+    # 密码
+    password: Ylrz_tM8/oW6$pU9|t#&
+    # 连接超时时间
+    timeout: 30s
+    lettuce:
+      pool:
+        # 连接池中的最小空闲连接
+        min-idle: 0
+        # 连接池中的最大空闲连接
+        max-idle: 8
+        # 连接池的最大数据库连接数
+        max-active: 100
+        # #连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-wait: -1ms
+    database: 0
+  datasource:
+    mysql:
+      type: com.alibaba.druid.pool.DruidDataSource
+      driverClassName: com.mysql.cj.jdbc.Driver
+      druid:
+        # 主库数据源
+        master:
+          url: jdbc:mysql://172.16.16.12:3306/fs_his?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+          username: root
+          password: ylrz14752131..!@YX
+        # 从库数据源
+        slave:
+          # 从数据源开关/默认关闭
+          enabled: false
+          url:
+          username:
+          password:
+        # 初始连接数
+        initialSize: 5
+        # 最小连接池数量
+        minIdle: 10
+        # 最大连接池数量
+        maxActive: 200
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        # 配置一个连接在池中最大生存的时间,单位是毫秒
+        maxEvictableIdleTimeMillis: 900000
+        # 配置检测连接是否有效
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        webStatFilter:
+          enabled: true
+        statViewServlet:
+          enabled: false
+          # 设置白名单,不填则允许所有访问
+          allow:
+          url-pattern: /druid/*
+          # 控制台管理用户名和密码
+          login-username: fs
+          login-password: 123456
+        filter:
+          stat:
+            enabled: true
+            # 慢SQL记录
+            log-slow-sql: true
+            slow-sql-millis: 1000
+            merge-sql: true
+          wall:
+            config:
+              multi-statement-allow: true
+    sop:
+      type: com.alibaba.druid.pool.DruidDataSource
+      driverClassName: com.mysql.cj.jdbc.Driver
+      druid:
+        # 主库数据源
+        master:
+#          url: jdbc:mysql://172.17.0.3:3306/sop?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+          url: jdbc:mysql://172.16.16.12:3306/sop?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+          username: root
+          password: ylrz14752131..!@YX
+        # 初始连接数
+        initialSize: 5
+        # 最小连接池数量
+        minIdle: 10
+        # 最大连接池数量
+        maxActive: 200
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        # 配置一个连接在池中最大生存的时间,单位是毫秒
+        maxEvictableIdleTimeMillis: 900000
+        # 配置检测连接是否有效
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        webStatFilter:
+          enabled: true
+        statViewServlet:
+          enabled: false
+          # 设置白名单,不填则允许所有访问
+          allow:
+          url-pattern: /druid/*
+          # 控制台管理用户名和密码
+          login-username: fs
+          login-password: 123456
+        filter:
+          stat:
+            enabled: true
+            # 慢SQL记录
+            log-slow-sql: true
+            slow-sql-millis: 1000
+            merge-sql: true
+          wall:
+            config:
+              multi-statement-allow: true
+rocketmq:
+  name-server: rmq-1vjak37re.rocketmq.gz.qcloud.tencenttdmq.com:8080 # RocketMQ NameServer 地址
+  producer:
+    group: course-finish-group
+    access-key: ak1vjak37reb7b19a2b09d1 # 替换为实际的 accessKey
+    secret-key: sk3987beb638e3414f # 替换为实际的 secretKey
+  consumer:
+    group: test-group
+    access-key: ak1vjak37reb7b19a2b09d1 # 替换为实际的 accessKey
+    secret-key: sk3987beb638e3414f # 替换为实际的 secretKey
+openIM:
+  secret: openIM123
+  userID: imAdmin
+  url:
+#是否使用新im
+im:
+  type: NONE
+#是否为新商户,新商户不走mpOpenId
+isNewWxMerchant: true
+
+enableRedPackAccount: 0

+ 5 - 0
fs-service/src/main/resources/mapper/qw/QwUserMapper.xml

@@ -304,4 +304,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT dept_id FROM sub_dept
     </select>
 
+    <select id="selectQwUserByTest" resultMap="QwUserResult">
+        <include refid="selectQwUserVo"/>
+        where status = 0 and server_status = 1
+    </select>
+
 </mapper>

+ 27 - 7
fs-user-app/src/main/java/com/fs/app/controller/FsUserInformationCollectionController.java

@@ -6,17 +6,22 @@ import com.fs.company.domain.CompanyUser;
 import com.fs.company.domain.CompanyUserUser;
 import com.fs.company.service.ICompanyUserService;
 import com.fs.company.service.ICompanyUserUserService;
-import com.fs.his.domain.FsPatient;
-import com.fs.his.domain.FsUserInformationCollection;
+import com.fs.his.domain.*;
+import com.fs.his.mapper.FsStoreOrderMapper;
 import com.fs.his.param.CollectionInfoConfirmParam;
 import com.fs.his.param.FsUserInformationCollectionParam;
+import com.fs.his.service.IFsPackageOrderService;
 import com.fs.his.service.IFsPatientService;
+import com.fs.his.service.IFsStoreOrderService;
 import com.fs.his.service.IFsUserInformationCollectionService;
+import com.fs.his.service.impl.FsStoreOrderServiceImpl;
 import com.fs.his.vo.FsUserInformationCollectionAndPatientVO;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 
 /**
  * 用户信息采集Controller
@@ -34,7 +39,8 @@ public class FsUserInformationCollectionController extends AppBaseController
     private IFsPatientService fsPatientService;
     @Autowired
     private ICompanyUserService companyUserService;
-
+    @Autowired
+    private IFsPackageOrderService fsPackageOrderService;
 
 
     /**
@@ -60,16 +66,30 @@ public class FsUserInformationCollectionController extends AppBaseController
         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){
-                FsUserInformationCollectionAndPatientVO vo = new FsUserInformationCollectionAndPatientVO();
-                BeanUtils.copyProperties(info, vo);
+
                 vo.setPatientInfo(fsPatient);
-                return R.ok().put("data", vo);
+                //查询是否支付
+                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);
             }
         }
-        return R.ok().put("data", info);
+
+        return R.ok().put("data", vo);
     }