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