Commit bdac1fed12918fda611309af04f2a3a39ffe084e

Authored by guzijian
1 parent 32468c7e

feat: 短信异步发送

trash-garbage/src/main/java/com/trash/garbage/pojo/domain/GarOrder.java
@@ -150,13 +150,7 @@ public class GarOrder implements Serializable { @@ -150,13 +150,7 @@ public class GarOrder implements Serializable {
150 150
151 private String garCoordinate; 151 private String garCoordinate;
152 152
153 - public Integer getGarOrderMatchFlag() {  
154 - return garOrderMatchFlag;  
155 - }  
156 -  
157 - public void setGarOrderMatchFlag(Integer garOrderMatchFlag) {  
158 - this.garOrderMatchFlag = garOrderMatchFlag;  
159 - } 153 + private Boolean garInCarStore;
160 154
161 /** 155 /**
162 * 评分标识 156 * 评分标识
@@ -167,13 +161,6 @@ public class GarOrder implements Serializable { @@ -167,13 +161,6 @@ public class GarOrder implements Serializable {
167 */ 161 */
168 private Integer garHandlerEvaluateFlag; 162 private Integer garHandlerEvaluateFlag;
169 163
170 - public Integer getGarHandlerEvaluateFlag() {  
171 - return garHandlerEvaluateFlag;  
172 - }  
173 -  
174 - public void setGarHandlerEvaluateFlag(Integer garHandlerEvaluateFlag) {  
175 - this.garHandlerEvaluateFlag = garHandlerEvaluateFlag;  
176 - }  
177 164
178 /** 165 /**
179 * 原因 166 * 原因
@@ -185,6 +172,23 @@ public class GarOrder implements Serializable { @@ -185,6 +172,23 @@ public class GarOrder implements Serializable {
185 private static final long serialVersionUID = 1L; 172 private static final long serialVersionUID = 1L;
186 173
187 174
  175 + public Integer getGarHandlerEvaluateFlag() {
  176 + return garHandlerEvaluateFlag;
  177 + }
  178 +
  179 + public void setGarHandlerEvaluateFlag(Integer garHandlerEvaluateFlag) {
  180 + this.garHandlerEvaluateFlag = garHandlerEvaluateFlag;
  181 + }
  182 +
  183 +
  184 + public Integer getGarOrderMatchFlag() {
  185 + return garOrderMatchFlag;
  186 + }
  187 +
  188 + public void setGarOrderMatchFlag(Integer garOrderMatchFlag) {
  189 + this.garOrderMatchFlag = garOrderMatchFlag;
  190 + }
  191 +
188 public String getGarOrderId() { 192 public String getGarOrderId() {
189 return garOrderId; 193 return garOrderId;
190 } 194 }
trash-garbage/src/main/java/com/trash/garbage/pojo/dto/OrderDto.java
@@ -71,6 +71,9 @@ public class OrderDto { @@ -71,6 +71,9 @@ public class OrderDto {
71 */ 71 */
72 private String garOrderCompanyTel; 72 private String garOrderCompanyTel;
73 73
  74 + private Boolean garInCarStore;
  75 +
  76 +
74 77
75 /** 78 /**
76 * 约定时间 79 * 约定时间
@@ -233,6 +236,13 @@ public class OrderDto { @@ -233,6 +236,13 @@ public class OrderDto {
233 public void setGarCoordinate(String garCoordinate) { 236 public void setGarCoordinate(String garCoordinate) {
234 this.garCoordinate = garCoordinate; 237 this.garCoordinate = garCoordinate;
235 } 238 }
  239 + public Boolean getGarInCarStore() {
  240 + return garInCarStore;
  241 + }
  242 +
  243 + public void setGarInCarStore(Boolean garInCarStore) {
  244 + this.garInCarStore = garInCarStore;
  245 + }
236 246
237 @Override 247 @Override
238 public String toString() { 248 public String toString() {
@@ -249,6 +259,7 @@ public class OrderDto { @@ -249,6 +259,7 @@ public class OrderDto {
249 ", garOrderCompanyId='" + garOrderCompanyId + '\'' + 259 ", garOrderCompanyId='" + garOrderCompanyId + '\'' +
250 ", garOrderCompanyName='" + garOrderCompanyName + '\'' + 260 ", garOrderCompanyName='" + garOrderCompanyName + '\'' +
251 ", garOrderCompanyTel='" + garOrderCompanyTel + '\'' + 261 ", garOrderCompanyTel='" + garOrderCompanyTel + '\'' +
  262 + ", garInCarStore=" + garInCarStore +
252 ", garOrderAgreementTime='" + garOrderAgreementTime + '\'' + 263 ", garOrderAgreementTime='" + garOrderAgreementTime + '\'' +
253 ", garRemark='" + garRemark + '\'' + 264 ", garRemark='" + garRemark + '\'' +
254 ", garCarInfoList=" + garCarInfoList + 265 ", garCarInfoList=" + garCarInfoList +
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderServiceImpl.java
@@ -33,6 +33,8 @@ import com.trash.garbage.mapper.GarOrderMapper; @@ -33,6 +33,8 @@ import com.trash.garbage.mapper.GarOrderMapper;
33 import com.trash.garbage.pojo.vo.OrderDetailVo; 33 import com.trash.garbage.pojo.vo.OrderDetailVo;
34 import cn.hutool.core.collection.CollectionUtil; 34 import cn.hutool.core.collection.CollectionUtil;
35 35
  36 +import javax.annotation.Resource;
  37 +
36 /** 38 /**
37 * @author 20412 39 * @author 20412
38 * @description 针对表【gar_order(建筑垃圾—订单表)】的数据库操作Service实现 40 * @description 针对表【gar_order(建筑垃圾—订单表)】的数据库操作Service实现
@@ -43,6 +45,9 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> @@ -43,6 +45,9 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder>
43 implements GarOrderService { 45 implements GarOrderService {
44 46
45 47
  48 + @Resource
  49 + private SMSUtils smsUtils;
  50 +
46 @Autowired 51 @Autowired
47 private GarOrderImageService garOrderImageService; 52 private GarOrderImageService garOrderImageService;
48 53
@@ -114,7 +119,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> @@ -114,7 +119,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder>
114 } 119 }
115 garOrderImageService.saveBatch(images); 120 garOrderImageService.saveBatch(images);
116 // TODO 短信提醒 居民下单 121 // TODO 短信提醒 居民下单
117 - SMSUtils.sendMessage(order.getGarOrderCompanyTel(), "企业收单:您有新的清运订单,请及时查看并处理。"); 122 + smsUtils.sendMessage(order.getGarOrderCompanyTel(), "企业收单:您有新的清运订单,请及时查看并处理。");
118 return order.getGarOrderId(); 123 return order.getGarOrderId();
119 } 124 }
120 125
@@ -337,7 +342,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> @@ -337,7 +342,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder>
337 order.getGarOrderCompanyTel() : order.getGarOrderContactTel(); 342 order.getGarOrderCompanyTel() : order.getGarOrderContactTel();
338 String message = GlobalStatus.GarUserStatusEnum.NORMAL_USER.getDescription().equals(user.getGarUserType()) ? 343 String message = GlobalStatus.GarUserStatusEnum.NORMAL_USER.getDescription().equals(user.getGarUserType()) ?
339 "居民取消订单:您的清运订单已取消,详情可在小程序查看" : "企业拒单"; 344 "居民取消订单:您的清运订单已取消,详情可在小程序查看" : "企业拒单";
340 - SMSUtils.sendMessage(tel, message); 345 + smsUtils.sendMessage(tel, message);
341 return "订单取消成功"; 346 return "订单取消成功";
342 } 347 }
343 // 企业负责人 348 // 企业负责人
@@ -354,7 +359,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> @@ -354,7 +359,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder>
354 .set(GarOrder::getGarOrderHandlerId, user.getGarUserId()); 359 .set(GarOrder::getGarOrderHandlerId, user.getGarUserId());
355 update(uw); 360 update(uw);
356 // TODO 短信提醒 361 // TODO 短信提醒
357 - SMSUtils.sendMessage(order.getGarOrderContactTel(), "运输公司已接受订单号为 " + order.getGarOrderId() + " 的订单。"); 362 + smsUtils.sendMessage(order.getGarOrderContactTel(), "运输公司已接受订单号为 " + order.getGarOrderId() + " 的订单。");
358 return "已接受订单"; 363 return "已接受订单";
359 } 364 }
360 // 企业负责人 清运中 ==》已完成 365 // 企业负责人 清运中 ==》已完成
@@ -368,7 +373,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> @@ -368,7 +373,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder>
368 update(uw); 373 update(uw);
369 } 374 }
370 // TODO 短信提醒 375 // TODO 短信提醒
371 - SMSUtils.sendMessage(order.getGarOrderContactTel(), "运输公司已完成订单号为 " + order.getGarOrderId() + " 的订单。"); 376 + smsUtils.sendMessage(order.getGarOrderContactTel(), "运输公司已完成订单号为 " + order.getGarOrderId() + " 的订单。");
372 return "订单已完成"; 377 return "订单已完成";
373 } 378 }
374 } 379 }
trash-garbage/src/main/java/com/trash/garbage/utils/SMSUtils.java
@@ -10,6 +10,9 @@ import com.aliyuncs.profile.DefaultProfile; @@ -10,6 +10,9 @@ import com.aliyuncs.profile.DefaultProfile;
10 import com.trash.common.utils.util.PostSms; 10 import com.trash.common.utils.util.PostSms;
11 import com.trash.common.utils.vo.mt.JsonSmsSend; 11 import com.trash.common.utils.vo.mt.JsonSmsSend;
12 import com.trash.common.utils.vo.mt.Mobile; 12 import com.trash.common.utils.vo.mt.Mobile;
  13 +import org.springframework.scheduling.annotation.Async;
  14 +import org.springframework.scheduling.annotation.EnableAsync;
  15 +import org.springframework.stereotype.Component;
13 16
14 import java.util.ArrayList; 17 import java.util.ArrayList;
15 import java.util.List; 18 import java.util.List;
@@ -17,6 +20,8 @@ import java.util.List; @@ -17,6 +20,8 @@ import java.util.List;
17 /** 20 /**
18 * 短信发送工具类 21 * 短信发送工具类
19 */ 22 */
  23 +@Component
  24 +@EnableAsync
20 public class SMSUtils { 25 public class SMSUtils {
21 26
22 /** 27 /**
@@ -25,7 +30,8 @@ public class SMSUtils { @@ -25,7 +30,8 @@ public class SMSUtils {
25 * @param tell 手机号 30 * @param tell 手机号
26 * @param content 模板 31 * @param content 模板
27 */ 32 */
28 - public static void sendMessage(String tell, String content) { 33 + @Async
  34 + public void sendMessage(String tell, String content) {
29 //发送 35 //发送
30 Mobile mobile = new Mobile(); 36 Mobile mobile = new Mobile();
31 mobile.setMobile(tell); 37 mobile.setMobile(tell);