Procházet zdrojové kódy

Merge branch 'refs/heads/master' into 企微聊天

# Conflicts:
#	fs-service/src/main/resources/application-druid-bjczwh.yml
#	fs-service/src/main/resources/mapper/qw/QwUserMapper.xml
ct před 1 týdnem
rodič
revize
84d1f7598b
27 změnil soubory, kde provedl 541 přidání a 348 odebrání
  1. 75 0
      fs-admin/src/main/java/com/fs/qw/qwTask/qwTask.java
  2. 1 6
      fs-doctor-app/src/main/java/com/fs/app/controller/FsUserInformationCollectionController.java
  3. 2 1
      fs-quartz/src/main/java/com/fs/quartz/config/ScheduleConfig.java
  4. 76 3
      fs-qw-task/src/main/java/com/fs/app/controller/CommonController.java
  5. 9 0
      fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseServiceImpl.java
  6. 1 1
      fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java
  7. 4 0
      fs-service/src/main/java/com/fs/erp/dto/sdk/df/DfClient.java
  8. 2 0
      fs-service/src/main/java/com/fs/his/service/IFsUserInformationCollectionService.java
  9. 27 0
      fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java
  10. 36 0
      fs-service/src/main/java/com/fs/his/service/impl/FsUserInformationCollectionServiceImpl.java
  11. 2 0
      fs-service/src/main/java/com/fs/his/vo/FsUserInformationCollectionAndPatientVO.java
  12. 1 1
      fs-service/src/main/java/com/fs/live/service/impl/LiveAfterSalesServiceImpl.java
  13. 1 0
      fs-service/src/main/java/com/fs/qw/mapper/QwUserMapper.java
  14. 3 0
      fs-service/src/main/java/com/fs/sop/service/IQwSopTempContentService.java
  15. 11 0
      fs-service/src/main/java/com/fs/sop/service/IQwSopTempDayService.java
  16. 3 0
      fs-service/src/main/java/com/fs/sop/service/IQwSopTempRulesService.java
  17. 7 0
      fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempContentServiceImpl.java
  18. 23 0
      fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempDayServiceImpl.java
  19. 7 0
      fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempRulesServiceImpl.java
  20. 60 45
      fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempServiceImpl.java
  21. 15 11
      fs-service/src/main/resources/application-config-druid-bjczwh.yml
  22. 3 0
      fs-service/src/main/resources/application-dev.yml
  23. 159 223
      fs-service/src/main/resources/application-druid-bjczwh.yml
  24. 1 1
      fs-service/src/main/resources/mapper/his/FsUserInformationCollectionMapper.xml
  25. 5 0
      fs-service/src/main/resources/mapper/qw/QwUserMapper.xml
  26. 2 18
      fs-user-app/src/main/java/com/fs/app/controller/CompanyUserController.java
  27. 5 38
      fs-user-app/src/main/java/com/fs/app/controller/FsUserInformationCollectionController.java

+ 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);
+    }
+
 }

+ 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")

+ 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);
+    }
     /**
      *
      */

+ 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("/#", ""));
+    }
     /**
      * 修改课堂配置
      */

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

@@ -1411,7 +1411,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);
         }
 

+ 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;
 
 
 }

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

@@ -882,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());

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

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

+ 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;
@@ -94,4 +95,6 @@ public interface IQwSopTempRulesService extends IService<QwSopTempRules>{
     List<QwSopTempRules> listByCourseId(Long courseId);
 
     void removeByTempIds(Collection<String> tempIds);
+
+    void removeByWrapper(LambdaQueryWrapper<QwSopTempRules> wrapper);
 }

+ 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;
@@ -252,4 +253,10 @@ public class QwSopTempRulesServiceImpl extends ServiceImpl<QwSopTempRulesMapper,
     public void removeByTempIds(Collection<String> tempIds) {
         this.remove(new QueryWrapper<QwSopTempRules>().in("temp_id", tempIds));
     }
+
+    @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)
+                );
+            }
         }
     }
 

+ 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:
-
-

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

@@ -251,6 +251,9 @@ headerImg:
 ipad:
     ipadUrl: https://contrastably-magnetooptic-gladys.ngrok-free.dev
     aiApi: http://1.95.196.10:3000/api
+    voiceApi:
+    commonApi:
+    url:
 wx_miniapp_temp:
     pay_order_temp_id:
     inquiry_temp_id:

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

@@ -1,231 +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
-    shardingsphere:
-        datasource:
-            names: ds0
-            ds0:
-                # 主库数据源
-                type: com.alibaba.druid.pool.DruidDataSource
-                driverClassName: com.mysql.cj.jdbc.Driver
-                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
-                # 初始连接数
-                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
-        rules:
-            sharding:
-                tables:
-                    qw_msg:
-                        actual-data-nodes: ds0.qw_msg_$->{0..9}
-                        table-strategy:
-                            standard:
-                                sharding-column: session_id
-                                sharding-algorithm-name: msg-inline
-                    fs_user_operation_log:
-                        actual-data-nodes: ds0.fs_user_operation_log_$->{0..9}
-                        table-strategy:
-                            standard:
-                                sharding-column: user_id
-                                sharding-algorithm-name: oper-inline
-                sharding-algorithms:
-                    msg-inline:
-                        type: INLINE
-                        props:
-                            algorithm-expression: qw_msg_$->{session_id % 10}
-                    oper-inline:
-                        type: INLINE
-                        props:
-                            algorithm-expression: fs_user_operation_log_$->{user_id % 10}
+  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
 

+ 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">

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

@@ -319,4 +319,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         and qu.company_user_id = #{companyUserId}
     </select>
 
+    <select id="selectQwUserByTest" resultMap="QwUserResult">
+        <include refid="selectQwUserVo"/>
+        where status = 0 and server_status = 1
+    </select>
+
 </mapper>

+ 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);
     }