|
@@ -502,11 +502,11 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
|
|
|
if (onlinePay) {
|
|
|
//线上支付分摊优惠总和到子订单
|
|
|
//经理折扣+优惠券+满减
|
|
|
- double allDiscount = MathUtil.add(MathUtil.add(newOrder.getCouponAmount(), newOrder.getPromotionFullReduction()),newOrder.getDiscountFee()).doubleValue();
|
|
|
+ double allDiscount = MathUtil.add(MathUtil.add(newOrder.getCouponAmount(), newOrder.getPromotionFullReduction()), newOrder.getDiscountFee()).doubleValue();
|
|
|
// 分摊优惠前总佣金
|
|
|
AtomicDouble oldBrokerage = new AtomicDouble(0);
|
|
|
List<NewShopOrder> shopOrderList = newOrder.getNewShopOrders();
|
|
|
- shopOrderList.forEach(shopOrder->{
|
|
|
+ shopOrderList.forEach(shopOrder -> {
|
|
|
oldBrokerage.set(MathUtil.add(oldBrokerage.get(), shopOrder.getBrokerage()).doubleValue());
|
|
|
});
|
|
|
// 按分摊前的佣金排序
|
|
@@ -655,10 +655,10 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
|
|
|
if (onlinePay) {
|
|
|
//线上支付分摊优惠总和到子订单
|
|
|
//经理折扣+优惠券+满减
|
|
|
- double allDiscount = MathUtil.add(MathUtil.add(newOrder.getCouponAmount(), newOrder.getPromotionFullReduction()),newOrder.getDiscountFee()).doubleValue();
|
|
|
+ double allDiscount = MathUtil.add(MathUtil.add(newOrder.getCouponAmount(), newOrder.getPromotionFullReduction()), newOrder.getDiscountFee()).doubleValue();
|
|
|
// 分摊优惠前总佣金
|
|
|
AtomicDouble oldBrokerage = new AtomicDouble(0);
|
|
|
- newShopOrderList.forEach(shopOrder->{
|
|
|
+ newShopOrderList.forEach(shopOrder -> {
|
|
|
oldBrokerage.set(MathUtil.add(oldBrokerage.get(), shopOrder.getBrokerage()).doubleValue());
|
|
|
});
|
|
|
// 按分摊前的佣金排序
|
|
@@ -1355,7 +1355,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
|
|
|
}
|
|
|
}
|
|
|
List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(cmReturnedPurchase.getOrderID());
|
|
|
- logger.info("shopOrders》》》》》"+shopOrders.toString());
|
|
|
+ logger.info("shopOrders》》》》》" + shopOrders.toString());
|
|
|
if (CollectionUtils.isNotEmpty(shopOrders)) {
|
|
|
for (NewShopOrder shopOrder : shopOrders) {
|
|
|
//获取退货退款记录
|
|
@@ -1656,10 +1656,11 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
|
|
|
NewShopOrder shopOrder = newShopOrderDao.get(entry.getKey() + "");
|
|
|
Integer outStoreNum = shopOrder.getOutStoreNum();
|
|
|
if (null == outStoreNum) {
|
|
|
- outStoreNum = shopOrder.getItemCount();
|
|
|
+ outStoreNum = 0;
|
|
|
}
|
|
|
int num = entry.getValue().stream().mapToInt(NewOrderProduct::getThisTimePostNum).sum();
|
|
|
if (outStoreNum + num > (shopOrder.getItemCount() + shopOrder.getPresentNum())) {
|
|
|
+
|
|
|
throw new Exception("发货数量异常");
|
|
|
}
|
|
|
shopOrder.setOutStoreNum(outStoreNum + num);//更新子订单总的出库数量
|
|
@@ -1690,26 +1691,26 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
|
|
|
NewOrder order = newOrderDao.findByOrderID(orderID);
|
|
|
String sendOutStatus = order.getSendOutStatus();
|
|
|
List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(order.getOrderID());
|
|
|
- Integer count=0;
|
|
|
+ Integer count = 0;
|
|
|
String statusSuffix = "";
|
|
|
if (shopOrders.stream().allMatch(s -> "3".equals(s.getSendOutStatus()))) {
|
|
|
//推送次数多次发货不推送(只推送一次)
|
|
|
- Date date=new Date();
|
|
|
+ Date date = new Date();
|
|
|
logger.info("****************************发货微信消息推送************************************");
|
|
|
- if("1".equals(order.getSendOutStatus())){
|
|
|
+ if ("1".equals(order.getSendOutStatus())) {
|
|
|
if ("0".equals(order.getSecondHandOrderFlag()) && "0".equals(order.getRebateFlag()) && !"6060".equals(newShopOrderDao.getProductOrder(order.getOrderID())) && !"0".equals(order.getOrderType())) {
|
|
|
try {
|
|
|
|
|
|
- Integer userid = order.getUserID();
|
|
|
- String unionid = newShopOrderDao.getOpenidunionId(userid);
|
|
|
+ Integer orderId = order.getOrderID();
|
|
|
+ String unionid = newShopOrderDao.FromUnionId(orderId);
|
|
|
List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
|
|
|
- System.out.println("userid>>>>>>>>>>>>>>>" + userid + "unionid》》》》》》》》》》" + unionid + "openid》》》》》》》》》" + openidList);
|
|
|
+ logger.info("userid>>>>>>>>>>>>>>>" + orderId + "unionid》》》》》》》》》》" + unionid + "openid》》》》》》》》》" + openidList);
|
|
|
String accessToken = weChatService.getAccessToken();
|
|
|
String orderNo = order.getOrderNo();
|
|
|
String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
String company = StringUtils.strip(logisticsInfo.keySet().toString(), "[]");
|
|
|
String companyno = StringUtils.strip(logisticsInfo.values().toString(), "[]");
|
|
|
- String pagePath = "pages/user/order/order-details?type=share&orderId="+ order.getOrderID();
|
|
|
+ String pagePath = "pages/user/order/order-details?type=share&orderId=" + order.getOrderID();
|
|
|
for (String openid : openidList) {
|
|
|
weChatService.sendTemplateMsgy(accessToken, openid, orderNo, time, company, companyno, pagePath);
|
|
|
}
|
|
@@ -1724,28 +1725,28 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
|
|
|
count++;
|
|
|
} else {
|
|
|
//推送次数多次发货不推送(只推送一次)
|
|
|
- Date date=new Date();
|
|
|
+ Date date = new Date();
|
|
|
logger.info("**************************发货微信消息推送************************************");
|
|
|
- if ("0".equals(order.getSecondHandOrderFlag()) && "0".equals(order.getRebateFlag()) && !"6060".equals(newShopOrderDao.getProductOrder(order.getOrderID())) && !"0".equals(order.getOrderType())) {
|
|
|
- try {
|
|
|
-
|
|
|
- Integer userid = order.getUserID();
|
|
|
- String unionid = newShopOrderDao.getOpenidunionId(userid);
|
|
|
- List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
|
|
|
- System.out.println("userid>>>>>>>>>>>>>>>" + userid + "unionid》》》》》》》》》》" + newShopOrderDao.getOpenidListByPermission(unionid)+ "openid》》》》》》》》》" + openidList);
|
|
|
- String accessToken = weChatService.getAccessToken();
|
|
|
- String orderNo = order.getOrderNo();
|
|
|
- String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
- String company = StringUtils.strip(logisticsInfo.keySet().toString(), "[]");
|
|
|
- String companyno = StringUtils.strip(logisticsInfo.values().toString(), "[]");
|
|
|
- String pagePath = "pages/user/order/order-details?orderId=" + order.getOrderID();
|
|
|
- for (String openid : openidList) {
|
|
|
- weChatService.sendTemplateMsgy(accessToken, openid, orderNo, time, company, companyno, pagePath);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("【订单发货通知】获取微信公众号access_token异常!", e);
|
|
|
+ if ("0".equals(order.getSecondHandOrderFlag()) && "0".equals(order.getRebateFlag()) && !"6060".equals(newShopOrderDao.getProductOrder(order.getOrderID())) && !"0".equals(order.getOrderType())) {
|
|
|
+ try {
|
|
|
+
|
|
|
+ Integer orderId = order.getOrderID();
|
|
|
+ String unionid = newShopOrderDao.FromUnionId(orderId);
|
|
|
+ List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
|
|
|
+ System.out.println("userid>>>>>>>>>>>>>>>" + orderId + "unionid》》》》》》》》》》" + newShopOrderDao.getOpenidListByPermission(unionid) + "openid》》》》》》》》》" + openidList);
|
|
|
+ String accessToken = weChatService.getAccessToken();
|
|
|
+ String orderNo = order.getOrderNo();
|
|
|
+ String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
+ String company = StringUtils.strip(logisticsInfo.keySet().toString(), "[]");
|
|
|
+ String companyno = StringUtils.strip(logisticsInfo.values().toString(), "[]");
|
|
|
+ String pagePath = "pages/user/order/order-details?orderId=" + order.getOrderID();
|
|
|
+ for (String openid : openidList) {
|
|
|
+ weChatService.sendTemplateMsgy(accessToken, openid, orderNo, time, company, companyno, pagePath);
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("【订单发货通知】获取微信公众号access_token异常!", e);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
//代码走到这里订单肯定是有发货了 整个订单里面的商品没有全部发完 那就是部分发货了
|
|
|
statusSuffix = "2";
|
|
@@ -1813,32 +1814,34 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /*try {
|
|
|
- //发货短信推送(取消推送)
|
|
|
- CmUser user = cmUserDao.get(order.getUserID().toString());
|
|
|
- if (user != null && StringUtils.isNotBlank(user.getBindMobile()) && "0".equals(order.getRebateFlag())) {
|
|
|
- String wwwServer = Global.getConfig("wwwServer");
|
|
|
- boolean sendSms = false;
|
|
|
- if ("2".equals(order.getSendOutStatus()) && "1".equals(sendOutStatus)) {
|
|
|
- //部分发货
|
|
|
- String shortLink = getShortLink(8, 7, wwwServer + "user/order/detail.html?orderId=" + order.getOrderID());
|
|
|
- String content = "您的订单(订单编号:" + order.getOrderNo() + ")已部分发货。您可关注采美公众号或者访问采美微信小程序和网站查看订单。平台公众号:微信搜索“采美365网”; " +
|
|
|
- "微信小程序:微信搜索“采美采购商城”;网址:www.caimei365.com/t/" + shortLink;
|
|
|
- sendSms = getSendSms(7, user.getBindMobile(), content);
|
|
|
- } else if ("3".equals(order.getSendOutStatus())) {
|
|
|
- //已发货
|
|
|
- String shortLink = getShortLink(8, 8, wwwServer + "user/order/detail.html?orderId=" + order.getOrderID());
|
|
|
- String content = "您的订单(订单编号:" + order.getOrderNo() + ")已发货完毕。您可关注采美公众号或者访问采美微信小程序和网站查看订单。平台公众号:微信搜索“采美365网”; " +
|
|
|
- "微信小程序:微信搜索“采美采购商城”;网址:www.caimei365.com/t/" + shortLink;
|
|
|
- sendSms = getSendSms(8, user.getBindMobile(), content);
|
|
|
- }
|
|
|
- if (!sendSms) {
|
|
|
- logger.info("发货短信推送失败,订单id>>>>" + order.getOrderID());
|
|
|
+ if (count == 1) {
|
|
|
+ try {
|
|
|
+ //发货短信推送(取消推送)
|
|
|
+ CmUser user = cmUserDao.get(order.getUserID().toString());
|
|
|
+ if (user != null && StringUtils.isNotBlank(user.getBindMobile()) && "0".equals(order.getRebateFlag())) {
|
|
|
+ String wwwServer = Global.getConfig("wwwServer");
|
|
|
+ boolean sendSms = false;
|
|
|
+ if ("2".equals(order.getSendOutStatus()) && "1".equals(sendOutStatus)) {
|
|
|
+ //部分发货
|
|
|
+ String shortLink = getShortLink(8, 7, wwwServer + "user/order/detail.html?orderId=" + order.getOrderID());
|
|
|
+ String content = "您的订单(订单编号:" + order.getOrderNo() + ")已部分发货。您可关注采美公众号或者访问采美微信小程序和网站查看订单。平台公众号:微信搜索“采美365网”; " +
|
|
|
+ "微信小程序:微信搜索“采美采购商城”;网址:www.caimei365.com/t/" + shortLink;
|
|
|
+ sendSms = getSendSms(7, user.getBindMobile(), content);
|
|
|
+ } else if ("3".equals(order.getSendOutStatus())) {
|
|
|
+ //已发货
|
|
|
+ String shortLink = getShortLink(8, 8, wwwServer + "user/order/detail.html?orderId=" + order.getOrderID());
|
|
|
+ String content = "您的订单(订单编号:" + order.getOrderNo() + ")已发货完毕。您可关注采美公众号或者访问采美微信小程序和网站查看订单。平台公众号:微信搜索“采美365网”; " +
|
|
|
+ "微信小程序:微信搜索“采美采购商城”;网址:www.caimei365.com/t/" + shortLink;
|
|
|
+ sendSms = getSendSms(8, user.getBindMobile(), content);
|
|
|
+ }
|
|
|
+ if (!sendSms) {
|
|
|
+ logger.info("发货短信推送失败,订单id>>>>" + order.getOrderID());
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }*/
|
|
|
+ }
|
|
|
return lb.getId();
|
|
|
}
|
|
|
|