|
@@ -4,12 +4,15 @@ import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.caimei365.order.components.ProductService;
|
|
import com.caimei365.order.components.ProductService;
|
|
import com.caimei365.order.mapper.BaseMapper;
|
|
import com.caimei365.order.mapper.BaseMapper;
|
|
|
|
+import com.caimei365.order.mapper.CartClubMapper;
|
|
|
|
+import com.caimei365.order.mapper.CartSellerMapper;
|
|
import com.caimei365.order.mapper.SubmitMapper;
|
|
import com.caimei365.order.mapper.SubmitMapper;
|
|
import com.caimei365.order.model.ResponseJson;
|
|
import com.caimei365.order.model.ResponseJson;
|
|
import com.caimei365.order.model.po.*;
|
|
import com.caimei365.order.model.po.*;
|
|
import com.caimei365.order.model.dto.SubmitDto;
|
|
import com.caimei365.order.model.dto.SubmitDto;
|
|
import com.caimei365.order.model.bo.OrderParamBo;
|
|
import com.caimei365.order.model.bo.OrderParamBo;
|
|
import com.caimei365.order.model.vo.*;
|
|
import com.caimei365.order.model.vo.*;
|
|
|
|
+import com.caimei365.order.service.MessagePushService;
|
|
import com.caimei365.order.service.SubmitService;
|
|
import com.caimei365.order.service.SubmitService;
|
|
import com.caimei365.order.utils.CodeUtil;
|
|
import com.caimei365.order.utils.CodeUtil;
|
|
import com.caimei365.order.utils.ImageUtil;
|
|
import com.caimei365.order.utils.ImageUtil;
|
|
@@ -49,7 +52,12 @@ public class SubmitServiceImpl implements SubmitService {
|
|
private String domain;
|
|
private String domain;
|
|
@Resource
|
|
@Resource
|
|
private ProductService productService;
|
|
private ProductService productService;
|
|
-
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private CartClubMapper cartClubMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private CartSellerMapper cartSellerMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private MessagePushService messagePushService;
|
|
/**
|
|
/**
|
|
* 生成订单
|
|
* 生成订单
|
|
*
|
|
*
|
|
@@ -1266,74 +1274,53 @@ public class SubmitServiceImpl implements SubmitService {
|
|
/*
|
|
/*
|
|
* 删除购物车
|
|
* 删除购物车
|
|
*/
|
|
*/
|
|
- // productIdList
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-// log.info("******************** 提交订单逻辑处理 end *******************");
|
|
|
|
-// /*
|
|
|
|
-// * 构造返回参数
|
|
|
|
-// */
|
|
|
|
-// Map<String, String> info = new HashMap<>();
|
|
|
|
-// info.put("orderId", String.valueOf(mainOrder.getOrderId()));
|
|
|
|
-// info.put("orderNo", String.valueOf(mainOrder.getOrderNo()));
|
|
|
|
-// info.put("orderMark", "#" + mainOrder.getOrderId() + "#");
|
|
|
|
-// //应付订单金额
|
|
|
|
-// info.put("payTotalFee", String.valueOf(mainOrder.getPayTotalFee()));
|
|
|
|
-// //真实需要付款金额
|
|
|
|
-// info.put("payableAmount", String.valueOf(mainOrder.getPayableAmount()));
|
|
|
|
-//
|
|
|
|
-// //下单推送
|
|
|
|
-// if (org.apache.commons.lang.StringUtils.isNotBlank(user.getBindMobile())) {
|
|
|
|
-// String shortLink = orderPushService.getShortLink(8, 3, domain + "/user/mainOrder/detail.html?orderId=" + mainOrder.getOrderId());
|
|
|
|
-// String name = productName.toString();
|
|
|
|
-// if (name.length() > 10) {
|
|
|
|
-// name = name.substring(0, 10);
|
|
|
|
-// }
|
|
|
|
-// String content = "您已成功下单“" + name + "...”等" + mainOrder.getProductCount() + "件商品,订单编号:" + mainOrder.getOrderNo() + ",订单等待支付,支付完成后采美将尽快安排发货。" +
|
|
|
|
-// "您可关注采美公众号或者访问采美微信小程序和网站查看并支付订单。平台公众号:微信搜索“采美365网”; 微信小程序:微信搜索“采美采购商城”;网址:www.caimei365.com/t/" + shortLink;
|
|
|
|
-// boolean sendSms = orderPushService.getSendSms(3, user.getBindMobile(), content);
|
|
|
|
-// if (!sendSms) {
|
|
|
|
-// log.info("下单推送失败,orderId>>>>" + mainOrder.getOrderId());
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// if (isPaySuccessFlag) {
|
|
|
|
-// // 余额抵扣成功
|
|
|
|
-// // 1提交成功[且支付完成]
|
|
|
|
-// info.put("code", "1");
|
|
|
|
-// info.put("msg", "提交成功且已支付");
|
|
|
|
-// return JsonModel.newInstance().success(info);
|
|
|
|
-// } else {
|
|
|
|
-// info.put("code", "2");
|
|
|
|
-// info.put("msg", "提交成功但未支付");
|
|
|
|
-// return JsonModel.newInstance().success(info);
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ if (3 == orderParamBo.getCartType()) {
|
|
|
|
+ // 清理当前机构的协销购物车数据
|
|
|
|
+ cartSellerMapper.deleteSellerCartByProductIds(orderParamBo.getBuyUserId(), orderParamBo.getClubId(), productIdList);
|
|
|
|
+ log.info("【提交订单】>>>>删除当前机构的 协销 购物车数据!");
|
|
|
|
+ } else {
|
|
|
|
+ // 清理用户购物车
|
|
|
|
+ cartClubMapper.deleteCartByProductIds(orderParamBo.getUserId(), productIdList);
|
|
|
|
+ log.info("【提交订单】>>>>删除当前机构 用户 购物车数据!");
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ log.info("******************** 提交订单逻辑处理 end *******************");
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * 构造返回参数
|
|
|
|
+ */
|
|
|
|
+ Map<String, Object> info = new HashMap<>();
|
|
|
|
+ info.put("orderId", mainOrder.getOrderId());
|
|
|
|
+ info.put("orderNo", mainOrder.getOrderNo());
|
|
|
|
+ info.put("orderMark", "#" + mainOrder.getOrderId() + "#");
|
|
|
|
+ //应付订单金额
|
|
|
|
+ info.put("payTotalFee", mainOrder.getPayTotalFee());
|
|
|
|
+ //真实需要付款金额
|
|
|
|
+ info.put("payableAmount", mainOrder.getPayableAmount());
|
|
|
|
|
|
|
|
+ //下单推送
|
|
|
|
+ if (StringUtils.isNotBlank(address.getMobile())) {
|
|
|
|
+ String shortLink = messagePushService.getShortLink(8, 3, domain + "/user/mainOrder/detail.html?orderId=" + mainOrder.getOrderId());
|
|
|
|
+ String name = orderProductList.get(0).getName();
|
|
|
|
+ if (name.length() > 10) {
|
|
|
|
+ name = name.substring(0, 10);
|
|
|
|
+ }
|
|
|
|
+ String content = "您已成功下单“" + name + "...”等" + mainOrder.getProductCount() + "件商品,订单编号:" + mainOrder.getOrderNo() + ",订单等待支付,支付完成后采美将尽快安排发货。" +
|
|
|
|
+ "您可关注采美公众号或者访问采美微信小程序和网站查看并支付订单。平台公众号:微信搜索“采美365网”; 微信小程序:微信搜索“采美采购商城”;网址:www.caimei365.com/t/" + shortLink;
|
|
|
|
+ boolean sendSms = messagePushService.getSendSms(3, address.getMobile(), content);
|
|
|
|
+ if (!sendSms) {
|
|
|
|
+ log.info("下单推送失败,orderId>>>>" + mainOrder.getOrderId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- return null;
|
|
|
|
|
|
+ if (isPaySuccessFlag) {
|
|
|
|
+ // 1提交成功(支付完成)
|
|
|
|
+ return ResponseJson.success(1,"提交成功且已支付完成!", info);
|
|
|
|
+ } else {
|
|
|
|
+ //2提交成功(未支付)
|
|
|
|
+ return ResponseJson.success(2,"提交成功但未支付!", info);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|