|
@@ -26,6 +26,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -34,6 +35,9 @@ import javax.annotation.Resource;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.Executors;
|
|
|
+import java.util.concurrent.ScheduledExecutorService;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
* Description
|
|
@@ -374,6 +378,7 @@ public class OrderClubServiceImpl implements OrderClubService {
|
|
|
order.setStatus(31);
|
|
|
order.setReceiptStatus(3);
|
|
|
}
|
|
|
+ Integer count=0;
|
|
|
log.info("********************下单微信公众号消息推送***************************");
|
|
|
if (0 == order.getSecondHandOrderFlag() && 0 == order.getRebateFlag() && !orderClubMapper.getProductOrder(order.getOrderId()).contains(6060) && order.getOrderType() != 0) {
|
|
|
log.info("*******" + order.getSecondHandOrderFlag() + "**********" + order.getRebateFlag());
|
|
@@ -400,6 +405,7 @@ public class OrderClubServiceImpl implements OrderClubService {
|
|
|
for (String openid : openidList) {
|
|
|
// sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接)
|
|
|
weChatService.sendTemplateMsgs(accessToken, openid, associateTitle, name,orderno, money, remarkText, pagePath);
|
|
|
+ count++;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("【订单发货通知】获取微信公众号access_token异常!", e);
|
|
@@ -415,7 +421,46 @@ public class OrderClubServiceImpl implements OrderClubService {
|
|
|
messageCenter.setContent(null);
|
|
|
messageCenter.setTime(curDateStr);
|
|
|
orderClubMapper.addMessageCenter(messageCenter);
|
|
|
+
|
|
|
+
|
|
|
+ log.info(">>>>>>>>>>>>>>>>>>>>>>"+orderId);
|
|
|
+ log.info("********************确认订单短信消息推送***************************");
|
|
|
+ if(count<=0){
|
|
|
+ ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
|
|
|
+ executorService.schedule(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+// String orderno = orderClubMapper.getOrderNo(orderId);
|
|
|
+ OrderVo orderVo=orderClubMapper.getOrderMess(orderId);
|
|
|
+
|
|
|
+ String bindMobile = baseMapper.getBindMobileByUserId(order.getUserId());
|
|
|
+ log.info(">>>>>>>>>>>>>>>>>>>>>>"+orderId);
|
|
|
+
|
|
|
+ log.info(">>>>>>>>>>>>>>>>>>>>>>"+orderVo.getProCount());
|
|
|
+ String name=orderVo.getProName();
|
|
|
+ if (name.length() > 10) {
|
|
|
+ name = StringUtils.strip(name.substring(0, 11));
|
|
|
+ name += "...";
|
|
|
+ }
|
|
|
+ if(orderVo.getPayFlag()==1 && orderVo.getOnlinePayFlag()==0){
|
|
|
+ String shortLink = remoteCallService.getShortLink(8, 2, "https://www.caimei365.com");
|
|
|
+ String content = "【采美365】您已成功下单“"+ name +"”等"+orderVo.getProCount()+"件商品,订单编号:"+orderVo.getOrderNo()+"订单等待支付,支付完成后采美将尽快安排发货。您可点击采美网址www.caimei365.com或使用微信小程序“采美采购商城”查看并支付订单。";
|
|
|
+ boolean sendSms = remoteCallService.getSendSms(2, orderVo.getMobile(), content);
|
|
|
+ if (!sendSms) {
|
|
|
+ log.info("》》》》》》》》》》》》》》》》购买会员短信推送失败");
|
|
|
+ }else {
|
|
|
+ log.info("》》》》》》》》》》》》》》》》购买会员短信推送成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 300000, TimeUnit.MILLISECONDS);
|
|
|
+ }else {log.info("》》》》》推送了微信公众号");}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
order.setUpdateDate(curDateStr);
|
|
|
order.setConfirmTime(curDateStr);
|
|
|
//确认订单状态
|
|
@@ -423,7 +468,6 @@ public class OrderClubServiceImpl implements OrderClubService {
|
|
|
// 更新订单状态
|
|
|
orderClubMapper.updateOrderStatus(order);
|
|
|
|
|
|
-
|
|
|
return ResponseJson.success("确认订单成功!", null);
|
|
|
}
|
|
|
|