Browse Source

feat: yzt sop调试

xdd 2 months ago
parent
commit
49b6e268cf

+ 55 - 16
fs-ipad-task/src/main/java/com/fs/app/task/SendMsg.java

@@ -95,13 +95,26 @@ public class SendMsg {
     }
     @Scheduled(fixedDelay = 20000) // 每20秒执行一次
     public void sendMsg2() {
+        long startTime = System.currentTimeMillis();
+        log.info("定时任务开始执行,开始时间:{}", LocalDateTime.now());
+
         log.info("执行日志:{}", LocalDateTime.now());
         if (StringUtils.isEmpty(groupNo)) {
-            log.error("corpId为空不执行");
+            log.error("corpId为空不执行,groupNo:{}", groupNo);
             return;
         }
+
+        log.info("开始查询课程配置信息");
         SysConfig courseConfig = sysConfigMapper.selectConfigByConfigKey("course.config");
+        if (courseConfig == null) {
+            log.error("未查询到课程配置信息,configKey:course.config");
+            return;
+        }
+        log.info("成功查询到课程配置信息,配置值:{}", courseConfig.getConfigValue());
+
         CourseConfig config = JSON.parseObject(courseConfig.getConfigValue(), CourseConfig.class);
+        log.info("课程配置解析完成,配置对象:{}", JSON.toJSONString(config));
+
         // 消息发送延迟
         int delayStart;
         int delayEnd;
@@ -109,30 +122,56 @@ public class SendMsg {
             log.debug("消息发送延迟为空手动设置1000ms - 2000ms");
             delayStart = 1000;
             delayEnd = 2000;
+            log.info("使用默认延迟配置,延迟开始:{}ms,延迟结束:{}ms", delayStart, delayEnd);
         } else {
             delayStart = config.getDelayStart();
             delayEnd = config.getDelayEnd();
+            log.info("使用配置文件延迟设置,延迟开始:{}ms,延迟结束:{}ms", delayStart, delayEnd);
         }
+
+        log.info("开始获取小程序配置映射");
         Map<String, CourseMaConfig> miniMap = getMiniMap();
-        getQwUserList().forEach(e -> {
-            qwMap.computeIfAbsent(e.getId(), k -> {
-                CompletableFuture.runAsync(() -> {
-                    try {
-                        log.info("开始任务:{}", e.getQwUserName());
-                        processUser(e, delayStart, delayEnd, miniMap);
-                    } catch (Exception exception) {
-                        log.error("发送错误:", exception);
-                    } finally {
-                        log.info("删除任务:{}", e.getQwUserName());
-                        qwMap.remove(e.getId());
+        log.info("获取小程序配置映射完成,配置数量:{}", miniMap != null ? miniMap.size() : 0);
+
+        log.info("开始获取企微用户列表");
+        List<QwUser> qwUserList = getQwUserList();
+        log.info("获取企微用户列表完成,用户数量:{}", qwUserList != null ? qwUserList.size() : 0);
+
+        if (qwUserList != null) {
+            qwUserList.forEach(e -> {
+                log.info("处理企微用户,用户ID:{},用户名:{}", e.getId(), e.getQwUserName());
+                qwMap.computeIfAbsent(e.getId(), k -> {
+                    log.info("为用户创建异步任务,用户ID:{},用户名:{}", e.getId(), e.getQwUserName());
+                    CompletableFuture.runAsync(() -> {
+                        long userTaskStartTime = System.currentTimeMillis();
+                        try {
+                            log.info("开始任务:{}", e.getQwUserName());
+                            log.info("用户任务开始执行,用户ID:{},开始时间:{}", e.getId(), LocalDateTime.now());
+                            processUser(e, delayStart, delayEnd, miniMap);
+                            long userTaskEndTime = System.currentTimeMillis();
+                            log.info("用户任务执行完成,用户ID:{},结束时间:{},耗时:{}ms",
+                                    e.getId(), LocalDateTime.now(), (userTaskEndTime - userTaskStartTime));
+                        } catch (Exception exception) {
+                            long userTaskEndTime = System.currentTimeMillis();
+                            log.error("用户任务执行失败,用户ID:{},用户名:{},耗时:{}ms,发送错误:",
+                                    e.getId(), e.getQwUserName(), (userTaskEndTime - userTaskStartTime), exception);
+                        } finally {
+                            log.info("删除任务:{}", e.getQwUserName());
+                            log.info("从任务映射中移除用户,用户ID:{},用户名:{}", e.getId(), e.getQwUserName());
+                            qwMap.remove(e.getId());
 //                        removeQwMap.putIfAbsent(e.getId(), System.currentTimeMillis());
-                    }
-                }, customThreadPool);
-                return System.currentTimeMillis(); // 占位值
+                        }
+                    }, customThreadPool);
+                    return System.currentTimeMillis(); // 占位值
+                });
             });
-        });
+        }
+
+        long endTime = System.currentTimeMillis();
+        log.info("定时任务执行完成,结束时间:{},总耗时:{}ms", LocalDateTime.now(), (endTime - startTime));
     }
 
+
     private void processUser(QwUser qwUser, int delayStart, int delayEnd, Map<String, CourseMaConfig> miniMap) {
         long start1 = System.currentTimeMillis();
         List<QwSopLogs> qwSopLogList = qwSopLogsMapper.selectByQwUserId(qwUser.getId());

+ 1 - 28
fs-service/src/main/java/com/fs/his/mapper/FsPackageOrderMapper.java

@@ -75,34 +75,7 @@ public interface FsPackageOrderMapper
      */
     public int deleteFsPackageOrderByOrderIds(Long[] orderIds);
 
-    @Select({"<script> " +
-            "select o.order_id,o.package_second_name,o.source,o.order_sn,o.package_name,o.pay_time, o.days,o.pay_price,o.pay_money,o.pay_type,o.`status`,o.package_sub_type,o.create_time,o.start_time,o.finish_time      ,d.doctor_name,u.nick_name,u.phone,c.company_name,cu.nick_name company_user_name,patient_json->>'$.patientName' as patientName,fso.delivery_status,fso.delivery_pay_status  from fs_package_order o LEFT JOIN fs_doctor d ON d.doctor_id=o.doctor_id LEFT JOIN fs_user u ON u.user_id=o.user_id LEFT JOIN company c on c.company_id =o.company_id LEFT JOIN company_user cu on cu.user_id=o.company_user_id LEFT JOIN fs_store_order fso ON fso.order_id= o.store_order_id"+
-            " where 1 = 1 \n" +
-            "            <if test=\"maps.orderSn != null  and maps.orderSn != ''\"> and o.order_sn = #{maps.orderSn}</if>\n" +
-            "            <if test=\"maps.phone != null and maps.phone != '' \">and u.phone = #{maps.phone} </if>\n" +
-            "            <if test=\"maps.doctorName != null \">and d.doctor_name like concat('%', #{maps.doctorName}, '%')</if>\n" +
-            "            <if test=\"maps.packageName != null  and maps.packageName != ''\"> and o.package_name like concat('%', #{maps.packageName}, '%')</if>\n" +
-            "            <if test=\"maps.isPay != null \"> and o.is_pay = #{maps.isPay}</if>\n" +
-            "            <if test=\"maps.packageSubType != null \"> and o.package_sub_type = #{maps.packageSubType}</if>\n" +
-            "            <if test=\"maps.userName != null and maps.userName != '' \"> and fso.user_name like concat('%', #{maps.userName}, '%')</if>\n" +
-            "            <if test=\"maps.userPhone != null and maps.userPhone != '' \"> and fso.user_phone = #{maps.userPhone}</if>\n" +
-            "            <if test=\"maps.status != null \"> and o.status = #{maps.status}</if>\n" +
-            "            <if test=\"maps.source != null \"> and o.source = #{maps.source}</if>\n" +
-            "            <if test=\"maps.sTime != null \">  and DATE(o.start_time) &gt;= DATE(#maps.sTime})</if>\n" +
-            "            <if test=\"maps.eTime != null \">  and DATE(o.start_time) &lt;= DATE(#{maps.eTime})</if>\n" +
-            "            <if test=\"maps.stTime != null \">  and DATE(o.create_time) &gt;= DATE(#{maps.stTime})</if>\n" +
-            "            <if test=\"maps.endTime != null \">  and DATE(o.create_time) &lt;= DATE(#{maps.endTime})</if>\n" +
-            "            <if test=\"maps.endStartTime != null \">  and DATE(o.finish_time) &gt;= DATE(#{maps.endStartTime})</if>\n" +
-            "            <if test=\"maps.endEndTime != null \">  and DATE(o.finish_time) &lt;= DATE(#{maps.endEndTime})</if>\n" +
-            "            <if test=\"maps.companyUserId != null \"> and o.company_user_id = #{maps.companyUserId}</if>\n" +
-            "            <if test=\"maps.companyName != null \"> and c.company_name like concat('%', #{maps.companyName}, '%')</if>\n" +
-            "            <if test=\"maps.companyUserName != null \"> and cu.user_name like concat('%', #{maps.companyUserName}, '%')</if>\n" +
-            "            <if test = 'maps.companyId != null  and   maps.companyId != \"-1\" '> and o.company_id =#{maps.companyId} </if>" +
-            "            <if test = ' maps.companyId == \"-1\" '> and o.company_id is null </if>" +
-            "            <if test = 'maps.deptId != null    '> AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) )) </if>" +
-            " ${maps.params.dataScope} "+
-            " order by  order_id desc "+
-            "</script>"})
+
     List<FsPackageOrderListVO> selectFsPackageOrderListVO(@Param("maps")FsPackageOrderParam fsPackageOrder);
 
     @Select("select o.*,d.doctor_name,u.nick_name,u.phone,c.company_name,cu.nick_name company_user_name,fp.second_name,o.patient_json->>'$.patientName' as patientName  " +

+ 1 - 1
fs-service/src/main/java/com/fs/qw/service/impl/QwUserServiceImpl.java

@@ -1181,7 +1181,7 @@ public class QwUserServiceImpl implements IQwUserService
             return R.ok("登录成功");
         }
         WxWorkSetCallbackUrlDTO wxWorkSetCallbackUrlDTO = new WxWorkSetCallbackUrlDTO();
-//        System.out.println("回调地址"+aiHostProper.getIpadUrl()+"/msg/callback/"+serverId);
+        System.out.println("回调地址"+aiHostProper.getIpadUrl()+"/msg/callback/"+serverId);
         wxWorkSetCallbackUrlDTO.setUrl(aiHostProper.getIpadUrl()+"/msg/callback/"+serverId);
         wxWorkSetCallbackUrlDTO.setUuid(data.getUuid());
         wxWorkService.SetCallbackUrl(wxWorkSetCallbackUrlDTO,serverId);

+ 1 - 1
fs-service/src/main/java/com/fs/sop/mapper/QwSopLogsMapper.java

@@ -321,6 +321,6 @@ public interface QwSopLogsMapper extends BaseMapper<QwSopLogs> {
     @DataSource(DataSourceType.SOP)
     List<QwSopLogs> selectIpadByCorpId(@Param("corpId") String corpId, @Param("now") LocalDateTime now);
 
-    @DataSource(DataSourceType.SopREAD)
+    @DataSource(DataSourceType.SOP)
     List<QwSopLogs> selectByQwUserId(@Param("id") Long id);
 }

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

@@ -81,7 +81,7 @@ cloud_host:
 headerImg:
   imgUrl: https://yztcourse-1325300895.cos.ap-guangzhou.myqcloud.com/yztcourse/20250523/e04871a98cc84be39a7f60c084698e21.jpg
 ipad:
-  ipadUrl: http://ipad.cdwjyyh.com
+  ipadUrl: http://ipad.yztjkkj.com
   aiApi: http://152.136.202.157:3000/api
 
 wx_miniapp_temp:

+ 29 - 0
fs-service/src/main/resources/mapper/his/FsPackageOrderMapper.xml

@@ -317,4 +317,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             LEFT JOIN fs_package P ON O.package_id = P.package_id
         where O.is_pay = 1 ORDER BY RAND() desc LIMIT 20
     </select>
+    <select id="selectFsPackageOrderListVO" resultType="com.fs.his.vo.FsPackageOrderListVO">
+        select o.order_id,o.package_second_name,o.source,o.order_sn,o.package_name,o.pay_time, o.days,o.pay_price,o.pay_money,o.pay_type,o.`status`,o.package_sub_type,o.create_time,o.start_time,o.finish_time      ,d.doctor_name,u.nick_name,u.phone,c.company_name,cu.nick_name company_user_name,patient_json->>'$.patientName' as patientName,fso.delivery_status,fso.delivery_pay_status  from fs_package_order o LEFT JOIN fs_doctor d ON d.doctor_id=o.doctor_id LEFT JOIN fs_user u ON u.user_id=o.user_id LEFT JOIN company c on c.company_id =o.company_id LEFT JOIN company_user cu on cu.user_id=o.company_user_id LEFT JOIN fs_store_order fso ON fso.order_id= o.store_order_id
+        <where>
+            <if test="maps.orderSn != null  and maps.orderSn != ''"> and o.order_sn = #{maps.orderSn}</if>
+            <if test="maps.phone != null and maps.phone != '' ">and u.phone = #{maps.phone} </if>
+            <if test="maps.doctorName != null ">and d.doctor_name like concat('%', #{maps.doctorName}, '%')</if>
+            <if test="maps.packageName != null  and maps.packageName != ''"> and o.package_name like concat('%', #{maps.packageName}, '%')</if>
+            <if test="maps.isPay != null "> and o.is_pay = #{maps.isPay}</if>
+            <if test="maps.packageSubType != null "> and o.package_sub_type = #{maps.packageSubType}</if>
+            <if test="maps.userName != null and maps.userName != '' "> and fso.user_name like concat('%', #{maps.userName}, '%')</if>
+            <if test="maps.userPhone != null and maps.userPhone != '' "> and fso.user_phone = #{maps.userPhone}</if>
+            <if test="maps.status != null "> and o.status = #{maps.status}</if>
+            <if test="maps.source != null "> and o.source = #{maps.source}</if>
+            <if test="maps.sTime != null ">  and DATE(o.start_time) &gt;= DATE(#{maps.sTime})</if>
+            <if test="maps.eTime != null ">  and DATE(o.start_time) &lt;= DATE(#{maps.eTime})</if>
+            <if test="maps.stTime != null ">  and DATE(o.create_time) &gt;= DATE(#{maps.stTime})</if>
+            <if test="maps.endTime != null ">  and DATE(o.create_time) &lt;= DATE(#{maps.endTime})</if>
+            <if test="maps.endStartTime != null ">  and DATE(o.finish_time) &gt;= DATE(#{maps.endStartTime})</if>
+            <if test="maps.endEndTime != null ">  and DATE(o.finish_time) &lt;= DATE(#{maps.endEndTime})</if>
+            <if test="maps.companyUserId != null "> and o.company_user_id = #{maps.companyUserId}</if>
+            <if test="maps.companyName != null "> and c.company_name like concat('%', #{maps.companyName}, '%')</if>
+            <if test="maps.companyUserName != null "> and cu.user_name like concat('%', #{maps.companyUserName}, '%')</if>
+            <if test='maps.companyId != null  and   maps.companyId != "-1" '> and o.company_id =#{maps.companyId} </if>
+            <if test='maps.companyId == "-1" '> and o.company_id is null </if>
+            <if test='maps.deptId != null '> AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) )) </if>
+        </where>
+        order by  order_id desc
+    </select>
+
 </mapper>