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

木易华康-sop发课状态代码修改

Long пре 1 месец
родитељ
комит
5af8d96f0f

+ 33 - 53
fs-ipad-task/src/main/java/com/fs/app/task/SendMsg.java

@@ -344,62 +344,42 @@ public class SendMsg {
             // 推送 APP
             // 推送 APP
             boolean hasAppSend = false;
             boolean hasAppSend = false;
             int successCount = 0;
             int successCount = 0;
+            int failCount = 0;
             if (!setting.getSetting().isEmpty()) {
             if (!setting.getSetting().isEmpty()) {
-                if (!CloudHostUtils.hasCloudHostName("木易华康")) {
-                    new Thread(() -> {
-                        try {
-                            List<QwSopTempSetting.Content.Setting> settings = JSON.parseArray(JSON.toJSONString(setting.getSetting()), QwSopTempSetting.Content.Setting.class).stream().filter(e -> "9".equals(e.getContentType())).collect(Collectors.toList());
-                            if (!settings.isEmpty()) {
-                                asyncSopTestService.asyncSendMsgBySopAppLinkNormalIM(settings, qwSopLogs.getCorpId(), user.getCompanyUserId(), qwSopLogs.getFsUserId());
-                            }
-
-                            //app文本消息
-                            log.info("开始发送app文本消息消息开始,消息{},用户{}", JSONObject.toJSONString(settings), user.getQwUserName());
-                            settings = JSON.parseArray(JSON.toJSONString(setting.getSetting()), QwSopTempSetting.Content.Setting.class).stream().filter(e -> "15".equals(e.getContentType())).collect(Collectors.toList());
-
-                            if (!settings.isEmpty()) {
-                                asyncSopTestService.asyncSendMsgBySopAppTxtNormalIM(settings, qwSopLogs.getCorpId(), qwUser.getCompanyUserId(), qwSopLogs.getFsUserId());
-                            }
-                            //app语音消息
-                            log.info("开始发送app语音消息消息开始,消息{},用户{}", JSONObject.toJSONString(settings), user.getQwUserName());
-                            settings = JSON.parseArray(JSON.toJSONString(setting.getSetting()), QwSopTempSetting.Content.Setting.class).stream().filter(e -> "16".equals(e.getContentType())).collect(Collectors.toList());
-                            if (!settings.isEmpty()) {
-                                asyncSopTestService.asyncSendMsgBySopAppMP3NormalIM(settings, qwSopLogs.getCorpId(), qwUser.getCompanyUserId(), qwSopLogs.getFsUserId());
-                            }
-                        } catch (Exception e) {
-                            log.error("推送APP失败", e);
-                        }
-                    }).start();
-                } else {
-                    List<QwSopCourseFinishTempSetting.Setting> settings = setting.getSetting().stream().filter(e -> "9".equals(e.getContentType())).collect(Collectors.toList());
-                    if (!settings.isEmpty()) {
-                        hasAppSend = true;
-                        boolean sendFlag = asyncSopTestService.asyncSendMsgBySopAppLinkNormalIM(settings, qwSopLogs.getCorpId(), qwUser.getCompanyUserId(), qwSopLogs.getFsUserId(), qwSopLogs.getId());
-                        if (sendFlag) {
-                            successCount++;
-                        }
+                List<QwSopCourseFinishTempSetting.Setting> settings = setting.getSetting().stream().filter(e -> "9".equals(e.getContentType())).collect(Collectors.toList());
+                if (!settings.isEmpty()) {
+                    hasAppSend = true;
+                    boolean sendFlag = asyncSopTestService.asyncSendMsgBySopAppLinkNormalIM(settings, qwSopLogs.getCorpId(), qwUser.getCompanyUserId(), qwSopLogs.getFsUserId(), qwSopLogs.getId());
+                    if (sendFlag) {
+                        successCount++;
+                    } else {
+                        failCount++;
                     }
                     }
+                }
 
 
-                    //app文本消息
-                    log.info("开始发送app文本消息消息开始,消息{},用户{}", JSONObject.toJSONString(settings), user.getQwUserName());
-                    settings = setting.getSetting().stream().filter(e -> "15".equals(e.getContentType())).collect(Collectors.toList());
-                    if (!settings.isEmpty()) {
-                        hasAppSend = true;
-                        boolean sendFlag = asyncSopTestService.asyncSendMsgBySopAppTxtNormalIM(settings, qwUser.getCompanyUserId(), qwSopLogs.getFsUserId(), qwSopLogs.getId());
-                        if (sendFlag) {
-                            successCount++;
-                        }
+                //app文本消息
+                log.info("开始发送app文本消息消息开始,消息{},用户{}", JSONObject.toJSONString(settings), user.getQwUserName());
+                settings = setting.getSetting().stream().filter(e -> "15".equals(e.getContentType())).collect(Collectors.toList());
+                if (!settings.isEmpty()) {
+                    hasAppSend = true;
+                    boolean sendFlag = asyncSopTestService.asyncSendMsgBySopAppTxtNormalIM(settings, qwUser.getCompanyUserId(), qwSopLogs.getFsUserId(), qwSopLogs.getId());
+                    if (sendFlag) {
+                        successCount++;
+                    } else {
+                        failCount++;
                     }
                     }
+                }
 
 
-                    //app语音消息
-                    log.info("开始发送app语音消息消息开始,消息{},用户{}", JSONObject.toJSONString(settings), user.getQwUserName());
-                    settings = setting.getSetting().stream().filter(e -> "16".equals(e.getContentType())).collect(Collectors.toList());
-                    if (!settings.isEmpty()) {
-                        hasAppSend = true;
-                        boolean sendFlag = asyncSopTestService.asyncSendMsgBySopAppMP3NormalIM(settings, qwUser.getCompanyUserId(), qwSopLogs.getFsUserId(), qwSopLogs.getId());
-                        if (sendFlag) {
-                            successCount++;
-                        }
+                //app语音消息
+                log.info("开始发送app语音消息消息开始,消息{},用户{}", JSONObject.toJSONString(settings), user.getQwUserName());
+                settings = setting.getSetting().stream().filter(e -> "16".equals(e.getContentType())).collect(Collectors.toList());
+                if (!settings.isEmpty()) {
+                    hasAppSend = true;
+                    boolean sendFlag = asyncSopTestService.asyncSendMsgBySopAppMP3NormalIM(settings, qwUser.getCompanyUserId(), qwSopLogs.getFsUserId(), qwSopLogs.getId());
+                    if (sendFlag) {
+                        successCount++;
+                    } else {
+                        failCount++;
                     }
                     }
                 }
                 }
             }
             }
@@ -426,10 +406,10 @@ public class SendMsg {
             updateQwSop.setContentJson(JSON.toJSONString(setting));
             updateQwSop.setContentJson(JSON.toJSONString(setting));
 
 
             if (hasAppSend) {
             if (hasAppSend) {
-                if (successCount == 3) {
+                if (successCount > 0 && failCount == 0) {
                     updateQwSop.setAppSendRemark("APP全部发送成功");
                     updateQwSop.setAppSendRemark("APP全部发送成功");
                     updateQwSop.setAppSendStatus(1);
                     updateQwSop.setAppSendStatus(1);
-                } else if (successCount == 0) {
+                } else if (successCount == 0 && failCount > 0) {
                     updateQwSop.setAppSendRemark("APP全部发送失败");
                     updateQwSop.setAppSendRemark("APP全部发送失败");
                     updateQwSop.setAppSendStatus(2);
                     updateQwSop.setAppSendStatus(2);
                 } else {
                 } else {

+ 20 - 0
fs-service/src/main/resources/mapper/qw/QwSopSmsLogsMapper.xml

@@ -241,4 +241,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             )
             )
         </foreach>
         </foreach>
     </insert>
     </insert>
+
+    <select id="getQwSopSmsLogsStateList" resultType="com.fs.qw.domain.QwSopSmsLogs">
+        SELECT
+        id,
+        fs_user_id,
+        content,
+        sms_template_code,
+        sop_log_id,
+        server_id,
+        sms_index
+        FROM
+        qw_sop_sms_logs
+        WHERE
+        server_id IN
+        <foreach collection="serverIds" item="serverId" open="(" separator="," close=")">
+            #{serverId}
+        </foreach>
+        AND status = 1
+        AND update_time  &lt;= DATE_SUB(NOW(), INTERVAL 40 MINUTE)
+    </select>
 </mapper>
 </mapper>