|
@@ -4,6 +4,7 @@ import com.pj.current.dto.APPLoginUserInfo;
|
|
|
import com.pj.enummj.DeleteStatus;
|
|
|
import com.pj.enummj.EnterpriseConfirm;
|
|
|
import com.pj.rabbitmq.config.RabbitMqConfig;
|
|
|
+import com.pj.tb_enterprise.TbEnterprise;
|
|
|
import com.pj.tb_goods.TbGoods;
|
|
|
import com.pj.tb_goods_type.TbGoodsTypeService;
|
|
|
import com.pj.tb_order.TbOrder;
|
|
@@ -39,13 +40,43 @@ public class MethodGoodsTransitService {
|
|
|
@Autowired
|
|
|
private AmqpTemplate amqpTemplate;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
* 给边民组组员发送短信通知
|
|
|
*/
|
|
|
public void sendSms(List<TbPeople> peopleIdList){
|
|
|
- peopleIdList.forEach(item -> {
|
|
|
- amqpTemplate.convertAndSend(RabbitMqConfig.PEOPLE_REVEIVE_MESSAGE_MQ,item);
|
|
|
- });
|
|
|
+
|
|
|
+
|
|
|
+ int processors = Runtime.getRuntime().availableProcessors() / 2;
|
|
|
+
|
|
|
+ ExecutorService executorService = Executors.newFixedThreadPool(processors);
|
|
|
+
|
|
|
+
|
|
|
+ int bai = 30;
|
|
|
+
|
|
|
+ int threads = (int) Math.ceil((double) peopleIdList.size() / bai);
|
|
|
+
|
|
|
+ int count = 0;
|
|
|
+ for (int i = 0; i < threads; i++) {
|
|
|
+ int start = i * bai;
|
|
|
+ int end = Math.min(start + bai,peopleIdList.size());
|
|
|
+
|
|
|
+ List<TbPeople> enterpriseList = peopleIdList.subList(start, end);
|
|
|
+
|
|
|
+ executorService.submit(() -> {
|
|
|
+ enterpriseList.forEach(item -> {
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ count += enterpriseList.size();
|
|
|
+ System.out.println("发送的短信数量为: " + count + " 条。");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ executorService.shutdown();
|
|
|
}
|
|
|
|
|
|
|