liujc 10 months ago
parent
commit
eb17e88ef4

+ 1 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/ClientEnum.java

@@ -13,6 +13,7 @@ public enum ClientEnum implements BaseEnum<String, ClientEnum> {
     TEACHER("老师端"),
     STUDENT("学生端"),
     TENANT_STUDENT("机构-学生端"),
+    TENANT_TEACHER("机构-学生端"),
     ORGANIZATION("机构-小程序"),
     SYSTEM("平台端"),
     WEBSITE("官网"),

+ 15 - 13
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CustomerServiceBatchSendingServiceImpl.java

@@ -57,6 +57,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.PostConstruct;
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -509,10 +510,6 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
 
     private void sendMessage(CustomerServiceBatchSending info) {
 
-        lambdaUpdate()
-            .eq(CustomerServiceBatchSending::getId, info.getId())
-            .set(CustomerServiceBatchSending::getSendFlag, 1)
-            .update();
 
         // 接收消息用户数
         List<Integer> receiveNums = Lists.newCopyOnWriteArrayList();
@@ -521,6 +518,11 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
 
         try {
 
+            lambdaUpdate()
+                .eq(CustomerServiceBatchSending::getId, info.getId())
+                .set(CustomerServiceBatchSending::getSendFlag, 1)
+                .update();
+
             // 消息发送数量,默认只发送1类消息(文字或图片)
             int messageNum = 1;
             if (StringUtils.isNoneBlank(info.getTextMessage(), info.getImgMessage())) {
@@ -652,16 +654,16 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
                 .set(CustomerServiceBatchSending::getReceiveNumber, receiveNums.stream().mapToInt(Integer::intValue).sum())
                 .set(CustomerServiceBatchSending::getSendEndTime, DateTime.now().toDate())
                 .update();
+        }
 
-            CustomerServiceBatchSending one = lambdaQuery()
-                .eq(CustomerServiceBatchSending::getSendStatus, EImSendStatus.SENDING)
-                .eq(CustomerServiceBatchSending::getSendFlag, 0)
-                .orderByAsc(CustomerServiceBatchSending::getId)
-                .last("limit 1")
-                .one();
-            if (one !=null) {
-                sendMessage(one);
-            }
+        CustomerServiceBatchSending one = lambdaQuery()
+            .eq(CustomerServiceBatchSending::getSendStatus, EImSendStatus.SENDING)
+            .eq(CustomerServiceBatchSending::getSendFlag, 0)
+            .orderByAsc(CustomerServiceBatchSending::getId)
+            .last("limit 1")
+            .one();
+        if (one !=null) {
+            sendMessage(one);
         }
     }
 

+ 2 - 3
cooleshow-user/user-biz/src/main/resources/config/mybatis/CustomerServiceBatchSendingMapper.xml

@@ -71,12 +71,11 @@
             </if>
             <if test="param.tenantFlag != null">
                 <if test="param.tenantFlag == 1">
-                    AND t2.tenant_id_ &gt; 0
+                    AND t2.tenant_id_  != -1
                 </if>
                 <if test="param.tenantFlag == 0">
-                    AND (t2.tenant_id_  is null or t2.tenant_id_ &lt; 0)
+                    AND t2.tenant_id_ = -1
                 </if>
-
             </if>
         </where>
     </select>