|
@@ -324,6 +324,9 @@ public class OrderServiceImpl implements OrderService {
|
|
|
@Autowired
|
|
|
private HaiKongSendOrderInfoDetailRecordService haiKongSendOrderInfoDetailRecordService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StockChangeRecordService stockChangeRecordService;
|
|
|
+
|
|
|
@Override
|
|
|
public OrderEntity queryObject(Long id) {
|
|
|
return orderDao.queryObject(id);
|
|
@@ -2135,7 +2138,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public synchronized Map offlineRetailSubmit(Map param, SysUserEntity user) {
|
|
|
+ public Map offlineRetailSubmit(Map param, SysUserEntity user) {
|
|
|
long start = System.currentTimeMillis();
|
|
|
// 解析订单数据 List
|
|
|
List<LinkedHashMap> goodsList = (List<LinkedHashMap>) param.get("goodsList");
|
|
@@ -2173,17 +2176,23 @@ public class OrderServiceImpl implements OrderService {
|
|
|
LOGGER.error("decode machine code failed! error message : ", e);
|
|
|
}
|
|
|
Integer storeId = user.getStoreId();
|
|
|
+ if(Objects.isNull(storeId)){
|
|
|
+ throw new ServiceException(String.format("登录用户错误,请刷新后确认!"));
|
|
|
+ }
|
|
|
// 根据商品条码、sku、门店id查询相对应的商品信息,并组装成对象
|
|
|
List<QueryGoodsVO> queryGoodsVOList = new ArrayList<>();
|
|
|
Map<String, GoodsEntity> goodsEntityMap;
|
|
|
List<GoodsEntity> goodsEntityList;
|
|
|
+
|
|
|
+ List<StockChangeRecordEntity> stockChangeRecordEntities = new ArrayList<>();
|
|
|
try {
|
|
|
goodsList.forEach(map -> {
|
|
|
QueryGoodsVO queryGoodsVo = new QueryGoodsVO();
|
|
|
queryGoodsVo.setProdBarcode((String) map.get("prodBarcode"));
|
|
|
queryGoodsVo.setSku((String) map.get("goodsSn"));
|
|
|
queryGoodsVo.setStoreId(storeId.longValue());
|
|
|
- queryGoodsVo.setSellVolume((Integer) map.get("sellVolume"));
|
|
|
+ Integer sellVolume = (Integer) map.get("sellVolume");
|
|
|
+ queryGoodsVo.setSellVolume(sellVolume);
|
|
|
queryGoodsVo.setRetailPrice(new BigDecimal(String.valueOf(map.get("retailPrice"))));
|
|
|
queryGoodsVo.setGoodsTaxes(new BigDecimal(String.valueOf(map.get("goodstaxes"))));
|
|
|
Object discountedPriceObj = map.get("discountedPrice");
|
|
@@ -2206,6 +2215,17 @@ public class OrderServiceImpl implements OrderService {
|
|
|
deductionPrice = new BigDecimal(deductionPriceObj.toString());
|
|
|
}
|
|
|
queryGoodsVo.setDeductionPrice(deductionPrice);
|
|
|
+
|
|
|
+ StockChangeRecordEntity stockChangeRecordEntity = new StockChangeRecordEntity();
|
|
|
+ stockChangeRecordEntity.setNumber(sellVolume);
|
|
|
+ stockChangeRecordEntity.setMerchSn(user.getMerchSn());
|
|
|
+ stockChangeRecordEntity.setThirdMerchSn(user.getThirdPartyMerchCode());
|
|
|
+ stockChangeRecordEntity.setRemark("销售出库");
|
|
|
+ stockChangeRecordEntity.setSku(queryGoodsVo.getProdBarcode());
|
|
|
+ stockChangeRecordEntity.setStoreId(storeId);
|
|
|
+ stockChangeRecordEntity.setType(Constants.StockChangeType.item_2.getType());
|
|
|
+ stockChangeRecordEntities.add(stockChangeRecordEntity);
|
|
|
+
|
|
|
queryGoodsVOList.add(queryGoodsVo);
|
|
|
});
|
|
|
// 将在循环中查询数据库改为一次性查询
|
|
@@ -2216,6 +2236,8 @@ public class OrderServiceImpl implements OrderService {
|
|
|
throw new ServiceException(e);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
Map resultObj = Maps.newHashMap();
|
|
|
// 海控需求,下单流程修改,收银端接收会员码,付款码,用户信息,订单数据
|
|
|
// 1. 校验库存:保税仓库存 + 展销店库存 - 出区数 >= 购买数
|
|
@@ -2310,10 +2332,9 @@ public class OrderServiceImpl implements OrderService {
|
|
|
listUtils.copyList(goodsEntityList, queryGoodsVOList);
|
|
|
|
|
|
//生成商户订单号
|
|
|
- SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
|
|
-// String orderSn = "ZMHK" + format.format(new Date()) + CommonUtil.generateOrderNumber();
|
|
|
Snowflake snowflake = IdUtil.createSnowflake(14, 14);
|
|
|
String orderSn = "8" + snowflake.nextIdStr().substring(6);
|
|
|
+ LOGGER.info("订单======>{},请求生成订单数据======>{}", orderSn, JacksonUtil.toJson(param));
|
|
|
// 检查库存和更新库存
|
|
|
for (QueryGoodsVO goodsDto : queryGoodsVOList) {
|
|
|
// 要购买的数量
|
|
@@ -2337,8 +2358,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
LOGGER.error("sku:【{}】库存不足,门店可用库存:【{}】,仓库可用库存:【{}】,购买数量:【{}】", sku, stockNum, warehouseStock, sellVolume);
|
|
|
throw new ServiceException(String.format("sku:【%s】库存不足,门店可用库存:【%s】,仓库可用库存:【%s】,购买数量:【%s】", sku, stockNum, warehouseStock, sellVolume));
|
|
|
}
|
|
|
- sellVolume -= 1;
|
|
|
- // TODO 库存变化记录新增字段:订单号、门店编号
|
|
|
+ // 库存变化记录新增字段:订单号、门店编号
|
|
|
// 门店库存变化记录
|
|
|
StoreMngChangeEntity storeMngChangeEntity = new StoreMngChangeEntity();
|
|
|
storeMngChangeEntity.setChangeType(Dict.changeType.item_1.getItem());
|
|
@@ -2409,6 +2429,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
goodsEntity.setActivity(goodsDto.getActivity());
|
|
|
goodsEntity.setStoreId(storeId);
|
|
|
goodsEntity.setListPicUrl(goodsDto.getListPicUrl());
|
|
|
+ // wcq-注解: goodsEntity1 库存信息 goodsEntity 此次购买的商品信息附加一些库存属性值
|
|
|
GoodsEntity goodsEntity1 = goodsEntityMap.get(sku);
|
|
|
if (Objects.nonNull(goodsEntity1)) {
|
|
|
goodsEntity.setWarehouseSn(goodsEntity1.getWarehouseSn());
|
|
@@ -2464,6 +2485,19 @@ public class OrderServiceImpl implements OrderService {
|
|
|
userEntity.setOpenId(userEntity.getMobile());
|
|
|
userEntity.setMemberCode(memberCode);
|
|
|
userDao.update(userEntity);
|
|
|
+
|
|
|
+ MerchUserEntity merchUserEntity = merchUserDao.queryObjectByStoreId(storeId.longValue(), userEntity.getId().longValue());
|
|
|
+
|
|
|
+ if (Objects.isNull(merchUserEntity)) {
|
|
|
+ merchUserEntity = new MerchUserEntity();
|
|
|
+ merchUserEntity.setMerchSn(user.getMerchSn());
|
|
|
+ merchUserEntity.setStoreId(storeId);
|
|
|
+ merchUserEntity.setUserId(userEntity.getId());
|
|
|
+ merchUserEntity.setCreateTime(new Date());
|
|
|
+ merchUserEntity.setIsLoadGoods("0");
|
|
|
+ merchUserDao.save(merchUserEntity);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 判断该用户是否是生日
|
|
@@ -2513,6 +2547,12 @@ public class OrderServiceImpl implements OrderService {
|
|
|
// 批量保存订单详情
|
|
|
orderGoodsService.saveBatchOrderDetail(orderGoodsVoList);
|
|
|
|
|
|
+ stockChangeRecordEntities.forEach(stockChangeRecordEntity -> {
|
|
|
+ stockChangeRecordEntity.setOrderSn(orderSn);
|
|
|
+ });
|
|
|
+
|
|
|
+ stockChangeRecordService.saveBatchByOrderSubmit(stockChangeRecordEntities);
|
|
|
+
|
|
|
//清空预订单商品临时表
|
|
|
Map orderInfoMap = Maps.newHashMap();
|
|
|
orderInfoMap.put("orderInfo", order);
|
|
@@ -2533,13 +2573,12 @@ public class OrderServiceImpl implements OrderService {
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(env) && Constants.PROD.equals(env)) {
|
|
|
if (parCode.startsWith("28")) {
|
|
|
// 支付宝支付
|
|
|
- throw new ServiceException("目前暂不支持支付宝付款!请使用微信进行支付!");
|
|
|
- /*try {
|
|
|
+ try {
|
|
|
AliPay(user, parCode, order, processRecordEntity, orderWXPayRecordCurrent, store);
|
|
|
} catch (Exception e) {
|
|
|
LOGGER.error("支付宝支付出现异常!订单号:【{}】", order.getOrder_sn(), e);
|
|
|
throw e;
|
|
|
- }*/
|
|
|
+ }
|
|
|
} else {
|
|
|
// 微信支付
|
|
|
try {
|
|
@@ -2620,9 +2659,10 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderGiftScoreRulesVo.setGenerateType(Constants.MemberScoreRulesEnum.TWO.getCode());
|
|
|
if (ratio.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
// 算出所积的分
|
|
|
- int giftScore = money.multiply(ratio).setScale(0, BigDecimal.ROUND_FLOOR).add(new BigDecimal(memberScore.get())).intValue();
|
|
|
+ BigDecimal bigDecimal = money.multiply(ratio).setScale(0, BigDecimal.ROUND_FLOOR);
|
|
|
+ int giftScore = bigDecimal.add(new BigDecimal(memberScore.get())).intValue();
|
|
|
memberScore.set(giftScore);
|
|
|
- orderGiftScoreRulesVo.setGiftScore(giftScore);
|
|
|
+ orderGiftScoreRulesVo.setGiftScore(bigDecimal.intValue());
|
|
|
orderGiftScoreRulesVo.setGenerateRatio(ratio);
|
|
|
} else {
|
|
|
// 积分比例设置为0,该商品不记积分。
|
|
@@ -2650,9 +2690,10 @@ public class OrderServiceImpl implements OrderService {
|
|
|
BigDecimal money = goodsMap.get(sku);
|
|
|
if (ratio.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
// 算出所积的分
|
|
|
- int giftScore = money.multiply(ratio).setScale(0, BigDecimal.ROUND_FLOOR).add(new BigDecimal(memberScore.get())).intValue();
|
|
|
+ BigDecimal bigDecimal = money.multiply(ratio).setScale(0, BigDecimal.ROUND_FLOOR);
|
|
|
+ int giftScore = bigDecimal.add(new BigDecimal(memberScore.get())).intValue();
|
|
|
memberScore.set(giftScore);
|
|
|
- orderGiftScoreRulesVo.setGiftScore(giftScore);
|
|
|
+ orderGiftScoreRulesVo.setGiftScore(bigDecimal.intValue());
|
|
|
orderGiftScoreRulesVo.setGenerateRatio(ratio);
|
|
|
} else {
|
|
|
// 积分比例设置为0,该商品不记积分。
|
|
@@ -2679,9 +2720,10 @@ public class OrderServiceImpl implements OrderService {
|
|
|
BigDecimal money = goodsMap.get(sku);
|
|
|
if (ratio.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
// 算出所积的分
|
|
|
- int giftScore = money.multiply(ratio).setScale(0, BigDecimal.ROUND_FLOOR).add(new BigDecimal(memberScore.get())).intValue();
|
|
|
+ BigDecimal bigDecimal = money.multiply(ratio).setScale(0, BigDecimal.ROUND_FLOOR);
|
|
|
+ int giftScore = bigDecimal.add(new BigDecimal(memberScore.get())).intValue();
|
|
|
memberScore.set(giftScore);
|
|
|
- orderGiftScoreRulesVo.setGiftScore(giftScore);
|
|
|
+ orderGiftScoreRulesVo.setGiftScore(bigDecimal.intValue());
|
|
|
orderGiftScoreRulesVo.setGenerateRatio(ratio);
|
|
|
} else {
|
|
|
// 积分比例设置为0,该商品不记积分。
|
|
@@ -2755,10 +2797,14 @@ public class OrderServiceImpl implements OrderService {
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(memberCode)) {
|
|
|
// 同步会员订单消费记录
|
|
|
syncMemberConsumeRecord(memberPhone, order, deductionScore);
|
|
|
- syncMemberScoreChangeRecord(openId, order, deductionScore, "下单扣减", queryGoodsVOList, giftGoodsScoreDetailMap, HaiKongMemberScoreChangeEventEnum.SUBTRACT.getEvent());
|
|
|
- // 积分变动接口,下单扣减
|
|
|
+ if (deductionScore > 0) {
|
|
|
+ // 积分变动接口,下单扣减
|
|
|
+ syncMemberScoreChangeRecord(openId, order, deductionScore, "下单扣减", queryGoodsVOList, giftGoodsScoreDetailMap, HaiKongMemberScoreChangeEventEnum.SUBTRACT.getEvent());
|
|
|
+ }
|
|
|
Integer score = memberScore.get();
|
|
|
- syncMemberScoreChangeRecord(openId, order, score, "下单赠送", queryGoodsVOList, giftGoodsScoreDetailMap, HaiKongMemberScoreChangeEventEnum.ADD.getEvent());
|
|
|
+ if (score > 0) {
|
|
|
+ syncMemberScoreChangeRecord(openId, order, score, "下单赠送", queryGoodsVOList, giftGoodsScoreDetailMap, HaiKongMemberScoreChangeEventEnum.ADD.getEvent());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 生成取票码
|
|
@@ -2780,7 +2826,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
JedisUtil.del(Constants.WAREHOUSE_STOCK_MAP_KEY + "_" + storeId);
|
|
|
|
|
|
|
|
|
- if (org.springframework.util.StringUtils.isEmpty(env) && Constants.TEST.equals(env)) {
|
|
|
+ if (!org.springframework.util.StringUtils.isEmpty(env) && Constants.TEST.equals(env)) {
|
|
|
order.setPayApp("wxpay");
|
|
|
order.setRequest("1111111111111111111");
|
|
|
order.setResponse("2222222222222222222");
|
|
@@ -2794,7 +2840,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
LOGGER.info("----------------------------------------------------------------------------");
|
|
|
return resultObj;
|
|
|
} catch (Exception e) {
|
|
|
- LOGGER.error("下单出现异常:" + e);
|
|
|
+ LOGGER.error("下单出现异常:",e);
|
|
|
resultObj.put("errno", 400);
|
|
|
resultObj.put("errmsg", "订单异常------" + e.getMessage());
|
|
|
throw new RuntimeException(e);
|
|
@@ -2840,6 +2886,10 @@ public class OrderServiceImpl implements OrderService {
|
|
|
} else if (Objects.nonNull(r) && ErrorCodeConstants.VmcShopSysErrorCodeEnum.CODE_10500.getCode().equals(r.getCode())) {
|
|
|
pickUpCodeService.updatePickUpCodeStatusByOrderSn(orderSn, Dict.PickUpCodeStatusEnum.item_6.getStatus());
|
|
|
haiKongSendOrderInfoRecordEntity.setResendStatus(HaiKongMemberOrderResendStatusEnum.NON_RESEND.getStatus());
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("orderSn", orderSn);
|
|
|
+ map.put("clearMsg", response);
|
|
|
+ orderProcessRecordDao.updateMallOrderProcessRecord(map);
|
|
|
LOGGER.error("推送订单到免税mall失败!响应结果:{}", response);
|
|
|
} else if (Objects.isNull(r)) {
|
|
|
pickUpCodeService.updatePickUpCodeStatusByOrderSn(orderSn, Dict.PickUpCodeStatusEnum.item_6.getStatus());
|
|
@@ -2883,6 +2933,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
entity.setIdentityCard(seaportInfo.getIdentityCard());
|
|
|
entity.setIdentityMobile(seaportInfo.getIdentityMobile());
|
|
|
entity.setIdentityName(seaportInfo.getIdentityName());
|
|
|
+ entity.setOutTradeNo(sendOrderToVmcShopDTO.getPayInfo().getOutTradeNo());
|
|
|
entity.setOrderProductInfo(JacksonUtil.toJson(seaportInfo.getOrderProductInfoList()));
|
|
|
|
|
|
return entity;
|
|
@@ -2920,7 +2971,21 @@ public class OrderServiceImpl implements OrderService {
|
|
|
String response = order.getResponse();
|
|
|
response = response.replaceAll("\r|\n", "");
|
|
|
payInfoDTO.setResponse(response);
|
|
|
- payInfoDTO.setOutTradeNo(order.getAliTradeNo());
|
|
|
+ if ("wxpay".equals(order.getPayApp())) {
|
|
|
+ String payTransactionId = order.getPayTransactionId();
|
|
|
+ if (org.springframework.util.StringUtils.isEmpty(payTransactionId)) {
|
|
|
+ OrderEntity orderEntity = orderDao.queryObjectByOrderSn(order.getOrder_sn());
|
|
|
+ payTransactionId = orderEntity.getPayTransactionId();
|
|
|
+ }
|
|
|
+ payInfoDTO.setOutTradeNo(payTransactionId);
|
|
|
+ } else {
|
|
|
+ String aliTradeNo = order.getAliTradeNo();
|
|
|
+ if (org.springframework.util.StringUtils.isEmpty(aliTradeNo)) {
|
|
|
+ OrderEntity orderEntity = orderDao.queryObjectByOrderSn(order.getOrder_sn());
|
|
|
+ aliTradeNo = orderEntity.getAliTradeNo();
|
|
|
+ }
|
|
|
+ payInfoDTO.setOutTradeNo(aliTradeNo);
|
|
|
+ }
|
|
|
return payInfoDTO;
|
|
|
}
|
|
|
|
|
@@ -2940,8 +3005,9 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderInfoItemDTO.setPrice(orderGoodsVo.getRetail_price());
|
|
|
orderInfoItemDTO.setItemcode(orderGoodsVo.getSku());
|
|
|
orderInfoItemDTO.setAmount(orderGoodsVo.getActualPaymentAmount());
|
|
|
- orderInfoItemDTO.setBuyPrice(orderGoodsVo.getActualPaymentAmount());
|
|
|
- orderInfoItemDTO.setNums(orderGoodsVo.getNumber());
|
|
|
+ Integer number = orderGoodsVo.getNumber();
|
|
|
+ orderInfoItemDTO.setBuyPrice(orderGoodsVo.getActualPaymentAmount().divide(BigDecimal.valueOf(number), 2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ orderInfoItemDTO.setNums(number);
|
|
|
orderInfoItemDTO.setTax("true");
|
|
|
orderInfoItemDTO.setTaxPrice(orderGoodsVo.getTaxPrice());
|
|
|
return orderInfoItemDTO;
|
|
@@ -3108,6 +3174,8 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderSendCusParams.put("thirdPartyMerchName", store.getThirdPartyMerchName());
|
|
|
orderSendCusParams.put("tradeNo", order.getAliTradeNo());
|
|
|
orderSendCusParams.put("amount", order.getActual_price());
|
|
|
+ orderSendCusParams.put("buyerIdNo", order.getIdCard());
|
|
|
+ orderSendCusParams.put("buyerName", order.getPay_name());
|
|
|
|
|
|
// 将支付单信息发送到当前项目下的 cuspay
|
|
|
aliCusDeclareBiz.biz(orderSendCusParams);
|
|
@@ -3160,6 +3228,12 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderDao.updateOrderInfo(orderRaram);
|
|
|
this.confirmPay(order.getId(), Dict.payFlag.item_weixin.getItem(), orderWXPayRecordCurrent.getOutTradeNoWX());
|
|
|
|
|
|
+ sendWxPayInfo(order, store, wechatMicropayApiResult.getTransaction_id());
|
|
|
+ HaiKongSendOrderInfoRecordEntity haiKongSendOrderInfoRecordEntity = new HaiKongSendOrderInfoRecordEntity();
|
|
|
+ haiKongSendOrderInfoRecordEntity.setOuterOrderNo(order.getOrder_sn());
|
|
|
+ haiKongSendOrderInfoRecordEntity.setOutTradeNo(wechatMicropayApiResult.getTransaction_id());
|
|
|
+ haiKongSendOrderInfoRecordService.updateByOrderSn(haiKongSendOrderInfoRecordEntity);
|
|
|
+
|
|
|
// 设置支付单完成时间
|
|
|
processRecordEntity.setPaymentSuccTimeStr(wechatMicropayApiResult.getTime_end());
|
|
|
processRecordEntity.setPaymentSuccTime(
|
|
@@ -3174,9 +3248,8 @@ public class OrderServiceImpl implements OrderService {
|
|
|
int times = 0;
|
|
|
// 查询是否支付了
|
|
|
while (true) {
|
|
|
- boolean flag = orderQuery(order, processRecordEntity);
|
|
|
+ boolean flag = orderQuery(order, processRecordEntity, store);
|
|
|
if (flag) {
|
|
|
- atomicBoolean.set(true);
|
|
|
break;
|
|
|
}
|
|
|
try {
|
|
@@ -3215,20 +3288,21 @@ public class OrderServiceImpl implements OrderService {
|
|
|
throw new RuntimeException("未支付或支付失败,请联系管理员");
|
|
|
}
|
|
|
|
|
|
- if (atomicBoolean.get()) {
|
|
|
- // 推送支付单
|
|
|
- sendWxPayInfo(order, store, wechatMicropayApiResult);
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- private void sendWxPayInfo(OrderVo order, StoreEntity store, WechatMicropayApiResult wechatMicropayApiResult) {
|
|
|
+ private void sendWxPayInfo(OrderVo order, StoreEntity store, String tradeNo) {
|
|
|
// 组装支付单信息
|
|
|
String payTransactionId = "";
|
|
|
- if (Objects.nonNull(wechatMicropayApiResult)) {
|
|
|
- payTransactionId = wechatMicropayApiResult.getTransaction_id();
|
|
|
+ if (!org.springframework.util.StringUtils.isEmpty(tradeNo)) {
|
|
|
+ payTransactionId = tradeNo;
|
|
|
} else {
|
|
|
- payTransactionId = order.getPayTransactionId();
|
|
|
+ if (!org.springframework.util.StringUtils.isEmpty(order.getPayTransactionId())) {
|
|
|
+ payTransactionId = order.getPayTransactionId();
|
|
|
+ } else {
|
|
|
+ OrderEntity orderEntity = orderDao.queryObjectByOrderSn(order.getOrder_sn());
|
|
|
+ payTransactionId = orderEntity.getPayTransactionId();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
Map<String, Object> orderSendCusParams = new HashMap<>();
|
|
@@ -3241,7 +3315,8 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderSendCusParams.put("transactionId", payTransactionId);
|
|
|
orderSendCusParams.put("subOrderId", ""); // ccnet原逻辑没有对该字段赋值
|
|
|
orderSendCusParams.put("subOrderNo", order.getOrder_sn());
|
|
|
- orderSendCusParams.put("feeType", order.getFeeType());
|
|
|
+ orderSendCusParams.put("feeType", "CNY");
|
|
|
+ orderSendCusParams.put("duty", 0);
|
|
|
int orderFee = order.getActual_price().multiply(new BigDecimal(100)).intValue();
|
|
|
orderSendCusParams.put("orderFee", orderFee);
|
|
|
orderSendCusParams.put("productFee", orderFee);
|
|
@@ -3268,11 +3343,32 @@ public class OrderServiceImpl implements OrderService {
|
|
|
memberOrderInfoSyncDTO.setConsumeDate(new Date());
|
|
|
memberOrderInfoSyncDTO.setOrderAmount(order.getActual_price());
|
|
|
memberOrderInfoSyncDTO.setOrderScore(deductionScore);
|
|
|
+ HashMap<Object, Object> orderIdMap = new HashMap<>();
|
|
|
+ orderIdMap.put("orderId",order.getId().toString());
|
|
|
+ //新增传给海控会员系统添加商品明细
|
|
|
+ List<OrderGoodsEntity> orderGoodsEntities = orderGoodsDao.queryList(orderIdMap);
|
|
|
+ List list = new ArrayList<Map>();
|
|
|
+ for (OrderGoodsEntity orderGoodsEntity : orderGoodsEntities) {
|
|
|
+ HashMap<Object, Object> map = new HashMap<>();
|
|
|
+ map.put("item_no",orderGoodsEntity.getSku());//商品编码
|
|
|
+ map.put("item_name",orderGoodsEntity.getGoodsName());//名称
|
|
|
+ map.put("item_price",orderGoodsEntity.getActualPaymentAmount());//商品实际支付金额
|
|
|
+ //会员系统那边开发可不传这两个字段
|
|
|
+// map.put("add_score");//商品基础积分
|
|
|
+// map.put("active_score",);//商品活动积分
|
|
|
+ map.put("use_score",orderGoodsEntity.getDeductionScore());//商品使用积分抵扣
|
|
|
+ map.put("deduction_money",orderGoodsEntity.getDeductionPrice());//商品积分抵扣金额
|
|
|
+ map.put("item_num",orderGoodsEntity.getNumber());//商品数量
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ memberOrderInfoSyncDTO.setItemInfoList(list);
|
|
|
+
|
|
|
BeanUtils.copyProperties(memberOrderInfoSyncDTO, haiKongMemberOrderSyncResendEntity);
|
|
|
Date date = new Date();
|
|
|
haiKongMemberOrderSyncResendEntity.setCreateTime(date);
|
|
|
haiKongMemberOrderSyncResendEntity.setLastResendTime(date);
|
|
|
haiKongMemberOrderSyncResendEntity.setPhone(memberPhone);
|
|
|
+ haiKongMemberOrderSyncResendEntity.setOrderId(order.getId().toString());
|
|
|
try {
|
|
|
String body = JacksonUtil.toJson(memberOrderInfoSyncDTO);
|
|
|
LOGGER.info("请求会员系统同步消费订单接口!请求体:{}", body);
|
|
@@ -3293,7 +3389,9 @@ public class OrderServiceImpl implements OrderService {
|
|
|
} catch (Exception e) {
|
|
|
LOGGER.error("请求会员系统同步消费订单接口出现异常!准备新增发送失败记录,等待重发!异常信息:", e);
|
|
|
// 没有请求成功,写表,重发
|
|
|
- haiKongMemberOrderSyncResendEntity.setResendStatus(HaiKongMemberOrderResendStatusEnum.NON_RESEND.getStatus());
|
|
|
+ //lhm 重发状态是修改成无需重发应修改为等待重发供定时器去重发
|
|
|
+// haiKongMemberOrderSyncResendEntity.setResendStatus(HaiKongMemberOrderResendStatusEnum.NON_RESEND.getStatus());
|
|
|
+ haiKongMemberOrderSyncResendEntity.setResendStatus(HaiKongMemberOrderResendStatusEnum.WAIT_RESEND.getStatus());
|
|
|
haiKongMemberOrderSyncResendService.save(haiKongMemberOrderSyncResendEntity);
|
|
|
}
|
|
|
}
|
|
@@ -3375,7 +3473,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private boolean orderQuery(OrderVo order, OrderProcessRecordEntity processRecordEntity) {
|
|
|
+ private boolean orderQuery(OrderVo order, OrderProcessRecordEntity processRecordEntity, StoreEntity store) {
|
|
|
LOGGER.info(">>>>>>>>>>>>>>>>>>>>wxOrderQuery 微信查询接口调用");
|
|
|
String merchOrderSn = order.getMerchOrderSn();
|
|
|
String orderId = order.getId() + "";
|
|
@@ -3397,8 +3495,19 @@ public class OrderServiceImpl implements OrderService {
|
|
|
Map processParam = Maps.newHashMap();
|
|
|
processParam.put("payTime", successTime);
|
|
|
processParam.put("orderSn", orderSn);
|
|
|
+ order.setPayTransactionId(result.getTransaction_id());
|
|
|
orderDao.updateOrderProcessRecord(processParam);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ sendWxPayInfo(order, store, result.getTransaction_id());
|
|
|
+ HaiKongSendOrderInfoRecordEntity haiKongSendOrderInfoRecordEntity = new HaiKongSendOrderInfoRecordEntity();
|
|
|
+ haiKongSendOrderInfoRecordEntity.setOutTradeNo(result.getTransaction_id());
|
|
|
+ haiKongSendOrderInfoRecordEntity.setResponse(JacksonUtil.toJson(result));
|
|
|
+ haiKongSendOrderInfoRecordEntity.setOuterOrderNo(order.getOrder_sn());
|
|
|
+
|
|
|
+ haiKongSendOrderInfoRecordService.updateByOrderSn(haiKongSendOrderInfoRecordEntity);
|
|
|
+
|
|
|
// orderWXPayRecordService
|
|
|
// .updateWXPayRecordTradeState(orderWXPayRecordTemp.getId(), wechatRefundApiResult);
|
|
|
|
|
@@ -3639,6 +3748,8 @@ public class OrderServiceImpl implements OrderService {
|
|
|
//调用会员系统积分全量回退接口
|
|
|
vipIntegralGoBack(order);
|
|
|
|
|
|
+ //调用会员退货单推送-整单退货接口
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -4263,6 +4374,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
*/
|
|
|
@Override
|
|
|
public CalculateOrderDiscountPriceResponseVO calculateOrderDiscountPrice(CalculateOrderDiscountPriceVO calculateOrderDiscountPriceVo) {
|
|
|
+ LOGGER.debug("计算活动优惠价格,请求参数为{}",calculateOrderDiscountPriceVo);
|
|
|
if (Objects.isNull(calculateOrderDiscountPriceVo)) {
|
|
|
LOGGER.error("计算活动优惠价格,请求参数为null!");
|
|
|
throw new ServiceException("计算活动优惠价格,请求参数为null!");
|
|
@@ -4278,22 +4390,22 @@ public class OrderServiceImpl implements OrderService {
|
|
|
// 清空上一次计算活动价格的相关信息
|
|
|
BigDecimal deductionPrice = good.getDeductionPrice();
|
|
|
if (Objects.nonNull(deductionPrice)) {
|
|
|
- good.setDeductionPrice(null);
|
|
|
+ good.setDeductionPrice(BigDecimal.ZERO);
|
|
|
}
|
|
|
Integer deductionScore = good.getDeductionScore();
|
|
|
if (Objects.nonNull(deductionScore)) {
|
|
|
- good.setDeductionScore(null);
|
|
|
+ good.setDeductionScore(0);
|
|
|
}
|
|
|
BigDecimal discountedPrice = good.getDiscountedPrice();
|
|
|
if (Objects.nonNull(discountedPrice)) {
|
|
|
- good.setDiscountedPrice(null);
|
|
|
+ good.setDiscountedPrice(BigDecimal.ZERO);
|
|
|
}
|
|
|
String activity = good.getActivity();
|
|
|
if (Objects.nonNull(activity)) {
|
|
|
good.setActivity(null);
|
|
|
}
|
|
|
BigDecimal actualPaymentAmount = good.getActualPaymentAmount().multiply(BigDecimal.valueOf(good.getSellVolume()));
|
|
|
- good.setActualPaymentAmount(good.getRetailPrice());
|
|
|
+ good.setActualPaymentAmount(good.getRetailPrice().multiply(BigDecimal.valueOf(good.getSellVolume())));
|
|
|
|
|
|
QueryGoodsVO queryGoodsVo = new QueryGoodsVO();
|
|
|
BeanUtils.copyProperties(good, queryGoodsVo);
|
|
@@ -4399,10 +4511,11 @@ public class OrderServiceImpl implements OrderService {
|
|
|
if (entityBarcode.equals(prodBarcode) && entityGoodsSn.equals(sku) && shopSn.equals(storeId)) {
|
|
|
GoodsEntity goodsEntity = goodsMap.get(sku);
|
|
|
BigDecimal tax = CalculateTax.calculateFinalTax(goodsEntity, activityPrice, goodsService).setScale(3, RoundingMode.HALF_UP);
|
|
|
- goodsDetailsDto.setActualPaymentAmount(activityPrice);
|
|
|
+ goodsDetailsDto.setActualPaymentAmount(activityPrice.multiply(new BigDecimal(goodsDetailsDto.getSellVolume())));
|
|
|
goodsDetailsDto.setGoodstaxes(String.valueOf(tax.multiply(new BigDecimal(goodsDetailsDto.getSellVolume()))));
|
|
|
goodsDetailsDto.setActivity(Constants.ActivityTopicEnum.LSCX.getTopicName());
|
|
|
- goodsDetailsDto.setDiscountedPrice(retailPrice.subtract(activityPrice));
|
|
|
+ // 优惠价格 应该用优惠后的特价价格 乘以 数量
|
|
|
+ goodsDetailsDto.setDiscountedPrice((retailPrice.subtract(activityPrice)).multiply(new BigDecimal(goodsDetailsDto.getSellVolume())));
|
|
|
goodsDetailsDto.setDeductionPrice(null);
|
|
|
activityFlag.set(false);
|
|
|
promotionActivityFlag.set(true);
|
|
@@ -4619,7 +4732,10 @@ public class OrderServiceImpl implements OrderService {
|
|
|
queryGoodsVo.setStoreId(Long.parseLong(storeId));
|
|
|
queryGoodsVo.setDisCountedPrice(BigDecimal.ZERO);
|
|
|
queryGoodsVo.setTotalPrice(good.getActualPaymentAmount().multiply(BigDecimal.valueOf(good.getSellVolume())));
|
|
|
- orderTotalPrice = orderTotalPrice.add(good.getActualPaymentAmount().multiply(BigDecimal.valueOf(good.getSellVolume())));
|
|
|
+ orderTotalPrice = orderTotalPrice.add(good.getRetailPrice().multiply(BigDecimal.valueOf(good.getSellVolume())));// 订单总金额 改为用零售价*数量
|
|
|
+ // 订单总价 总价减去 优惠活动的优惠价格 后续积分优惠 也从总金额中减去(打补丁操作
|
|
|
+ // 这块设计有问题 :后续积分优惠金额 由总金额减去积分抵扣金额 但没有处理其他活动的优惠金额 补丁内容:如果这里有参加其他活动的商品 优惠金额要在这里减去)
|
|
|
+ orderTotalPrice = orderTotalPrice.subtract(good.getDiscountedPrice());
|
|
|
goodsVos.add(queryGoodsVo);
|
|
|
}
|
|
|
calculateOrderDiscountPriceResponseVO.setOrderTotalPrice(orderTotalPrice);
|
|
@@ -4628,6 +4744,8 @@ public class OrderServiceImpl implements OrderService {
|
|
|
calculateOrderDiscountPriceResponseVO.setMemberCurrentAvailableScore(0);
|
|
|
calculateOrderDiscountPriceResponseVO.setDeductionScore(0);
|
|
|
|
|
|
+ // 根据收银端开关选择是否适用积分抵扣。
|
|
|
+ boolean useScore = Objects.isNull(calculateOrderDiscountPriceVo.getUseScore()) || calculateOrderDiscountPriceVo.getUseScore();
|
|
|
// 计算完活动优惠后,计算积分抵扣。(活动与积分抵扣不互斥)
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(memberCode)) {
|
|
|
String memberInfoByCodeResponseJson;
|
|
@@ -4677,6 +4795,10 @@ public class OrderServiceImpl implements OrderService {
|
|
|
userService.update(userEntity);
|
|
|
}
|
|
|
Integer score = memberInfoDTO.getScore();
|
|
|
+ // 是否适用积分抵扣
|
|
|
+ if (!useScore) {
|
|
|
+ return calculateOrderDiscountPriceResponseVO;
|
|
|
+ }
|
|
|
if (Objects.nonNull(score) && score > 0) {
|
|
|
// 有积分
|
|
|
afterDiscountPrice = calculatePreferentialPrice(orderTotalPrice, score, memberCode, openId, calculateOrderDiscountPriceResponseVO, goodsDetailsDtos, promotionSkuList, mkActivitiesEntityList);
|
|
@@ -4775,8 +4897,12 @@ public class OrderServiceImpl implements OrderService {
|
|
|
if (!promotionSkuList.contains(sku)) {
|
|
|
if (!CollectionUtils.isEmpty(scoreDeductionAllowSkuList) && CollectionUtils.isEmpty(scoreDeductionRejectSkuList)) {
|
|
|
if (scoreDeductionAllowSkuList.contains(sku)) {
|
|
|
- BigDecimal skuActualPaymentAmount = goodsDetailsDto.getActualPaymentAmount()
|
|
|
- .multiply(BigDecimal.valueOf(goodsDetailsDto.getSellVolume()));
|
|
|
+ BigDecimal skuActualPaymentAmount = goodsDetailsDto.getActualPaymentAmount();
|
|
|
+ skuTotalPrice = skuTotalPrice.add(skuActualPaymentAmount);
|
|
|
+ }
|
|
|
+ } else if (CollectionUtils.isEmpty(scoreDeductionAllowSkuList) && !CollectionUtils.isEmpty(scoreDeductionRejectSkuList)) {
|
|
|
+ if (!scoreDeductionRejectSkuList.contains(sku)) {
|
|
|
+ BigDecimal skuActualPaymentAmount = goodsDetailsDto.getActualPaymentAmount();
|
|
|
skuTotalPrice = skuTotalPrice.add(skuActualPaymentAmount);
|
|
|
}
|
|
|
}
|
|
@@ -4850,8 +4976,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
String sku = goodsDetailsDto.getGoodsSn();
|
|
|
String prodBarcode = goodsDetailsDto.getProdBarcode();
|
|
|
// 此字段 = 零售价 - 其他活动优惠金额
|
|
|
- BigDecimal actualPaymentAmount = goodsDetailsDto.getActualPaymentAmount()
|
|
|
- .multiply(BigDecimal.valueOf(goodsDetailsDto.getSellVolume()));
|
|
|
+ BigDecimal actualPaymentAmount = goodsDetailsDto.getActualPaymentAmount();// 商品金额
|
|
|
// 当前商品最大支持抵扣的金额
|
|
|
BigDecimal currentSkuMaxDeductionPrice = actualPaymentAmount.multiply(scoreRatio).setScale(0, BigDecimal.ROUND_FLOOR);
|
|
|
// 其他活动优惠金额
|
|
@@ -4863,6 +4988,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
BigDecimal discountedPrice = BigDecimal.ZERO;
|
|
|
// 计算抵扣,当商品不是最后一个商品
|
|
|
if (i < index) {
|
|
|
+
|
|
|
shareScoreItem = actualPaymentAmount.multiply(scoreIntegerDecimal).divide(skuTotalPrice, 0, BigDecimal.ROUND_FLOOR);
|
|
|
discountedPrice = shareScoreItem.divide(BigDecimal.valueOf(scoreLimit), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
@@ -5071,25 +5197,31 @@ public class OrderServiceImpl implements OrderService {
|
|
|
|
|
|
BigDecimal goodsTotalPrice = BigDecimal.ZERO;
|
|
|
BigDecimal fullCutCouponDec = Constant.ZERO; // 非现金抵扣 = 各种优惠价格 +优惠券的价格 暂时借用这个字段去,为了不改动ccnet系统
|
|
|
+ BigDecimal deductionPrice = Constant.ZERO;// 积分抵扣金额
|
|
|
BigDecimal couponPrice = BigDecimal.ZERO;
|
|
|
BigDecimal freightPrice = Constant.ZERO;
|
|
|
Integer number = 0;
|
|
|
//订单价格计算:订单的总价+运费
|
|
|
for (GoodsEntity goodsEntity : goodsList) {
|
|
|
+ // 商品总价 = 商品单价 * 购买数量 保留两位小数
|
|
|
goodsTotalPrice = goodsTotalPrice
|
|
|
.add(goodsEntity.getRetailPrice().multiply(new BigDecimal(goodsEntity.getSellVolume()))).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ // todo: 促销活动费用 这里取的是总优惠金额 不正确 但是后续把这个值传到订单的
|
|
|
fullCutCouponDec = fullCutCouponDec
|
|
|
.add(goodsEntity.getDiscountedPrice()).setScale(2, RoundingMode.HALF_UP);
|
|
|
- couponPrice = couponPrice.add(goodsEntity.getDiscountedPrice()).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ // todo: 优惠券优惠金额 这里取的是总优惠金额 不正确
|
|
|
+ // couponPrice = couponPrice.add(goodsEntity.getDiscountedPrice()).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ // 计算总积分抵扣金额
|
|
|
+ deductionPrice = deductionPrice.add(goodsEntity.getDeductionPrice()).setScale(2, RoundingMode.HALF_UP);
|
|
|
number += goodsEntity.getSellVolume();
|
|
|
}
|
|
|
|
|
|
|
|
|
BigDecimal orderTotalPrice = goodsTotalPrice.add(new BigDecimal(0));
|
|
|
- fullCutCouponDec = fullCutCouponDec.add(couponPrice).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ // fullCutCouponDec = fullCutCouponDec.add(couponPrice).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
// 加上税额
|
|
|
- goodsTotalPrice = goodsTotalPrice.subtract(totalTax).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ // goodsTotalPrice = goodsTotalPrice.subtract(totalTax).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
// SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
|
|
//
|
|
@@ -5140,30 +5272,40 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderInfo.setStore_id(storeId);
|
|
|
orderInfo.setFreight_price(freightPrice.intValue());
|
|
|
|
|
|
- orderInfo.setCoupon_id(Integer.parseInt(String.valueOf(0L)));
|
|
|
- orderInfo.setCoupon_price(couponPrice);
|
|
|
+ orderInfo.setCoupon_id(Integer.parseInt(String.valueOf(0L)));// 优惠券id
|
|
|
+ orderInfo.setCoupon_price(couponPrice);// 优惠券金额
|
|
|
orderInfo.setCoupon_name("无");
|
|
|
orderInfo.setActivity_id(0L);
|
|
|
|
|
|
//使用的促销费用
|
|
|
- orderInfo.setFull_cut_price(fullCutCouponDec);
|
|
|
- orderInfo.setCampMinusId(0);
|
|
|
+ orderInfo.setFull_cut_price(fullCutCouponDec); // 促销活动费用
|
|
|
+ orderInfo.setCampMinusId(0);// 促销活动id
|
|
|
orderInfo.setCampName("");
|
|
|
|
|
|
//留言
|
|
|
orderInfo.setPostscript("无");
|
|
|
orderInfo.setAdd_time(new Date());
|
|
|
+ // 商品总价
|
|
|
orderInfo.setGoods_price(actualPrice.subtract(totalTax));
|
|
|
- orderInfo.setOrder_price(actualPrice);
|
|
|
+ // 订单总价 这里的订单总价取的是 扣减完优惠的商品总价
|
|
|
+ // orderInfo.setOrder_price(actualPrice);
|
|
|
+ // 订单总价 根据前端显示 这里应该取未扣减优惠的商品总价
|
|
|
+ orderInfo.setOrder_price(orderTotalPrice);
|
|
|
orderInfo.setActual_price(actualPrice); // 实际支付金额
|
|
|
+ // 订单类型 1 普通订单 2 团购订单
|
|
|
orderInfo.setOrder_type("1");
|
|
|
+ // 订单状态 0订单创建成功等待付款, 100订单付款中,101订单已取消,
|
|
|
+ // 102订单已删除,201订单已付款,等待发货,300订单已发货,
|
|
|
+ // 301用户确认收货,401 没有发货,退款 402 已收货,退款退货,500订单已关闭;501 支付失败
|
|
|
orderInfo.setOrder_status(0);
|
|
|
orderInfo.setShipping_status(0);
|
|
|
orderInfo.setPay_status(0);
|
|
|
orderInfo.setShipping_id(0L);
|
|
|
+ // 配送费用
|
|
|
orderInfo.setShipping_fee(Constant.ZERO);
|
|
|
orderInfo.setIntegral(0);
|
|
|
- orderInfo.setIntegral_money(Constant.ZERO);
|
|
|
+ // 积分抵扣金额
|
|
|
+ orderInfo.setIntegral_money(deductionPrice);
|
|
|
orderInfo.setCreateTime(new Date());
|
|
|
orderInfo.setModTime(new Date());
|
|
|
orderInfo.setPayMobile(loginUser.getMobile());
|
|
@@ -5299,6 +5441,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
return R.error("该订单所属商户不存在:"+orderEntity.getOrderSn());
|
|
|
}
|
|
|
// 组装支付单信息
|
|
|
+ UserEntity userEntity = userService.queryByMobile(orderEntity.getMobile());
|
|
|
Map<String, Object> orderSendCusParams = new HashMap<>();
|
|
|
if(Dict.payFlag.item_weixin.getItem().equals(orderEntity.getPayFlag())){
|
|
|
orderSendCusParams.put("merchSn", orderEntity.getMerchSn());
|
|
@@ -5316,7 +5459,6 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderSendCusParams.put("orderFee", orderFee);
|
|
|
orderSendCusParams.put("productFee", orderFee);
|
|
|
orderSendCusParams.put("transportFee", 0);
|
|
|
- UserEntity userEntity = userService.queryByMobile(orderEntity.getMobile());
|
|
|
orderSendCusParams.put("certId", userEntity.getIdNo());
|
|
|
orderSendCusParams.put("name", orderEntity.getPayName());
|
|
|
|
|
@@ -5332,6 +5474,8 @@ public class OrderServiceImpl implements OrderService {
|
|
|
//阿里支付流水号
|
|
|
orderSendCusParams.put("tradeNo", orderEntity.getAliTradeNo());
|
|
|
orderSendCusParams.put("amount", orderEntity.getActualPrice());
|
|
|
+ orderSendCusParams.put("buyerIdNo", userEntity.getIdNo());
|
|
|
+ orderSendCusParams.put("buyerName", orderEntity.getPayName());
|
|
|
|
|
|
// 将支付单信息发送到当前项目下的 cuspay
|
|
|
aliCusDeclareBiz.biz(orderSendCusParams);
|
|
@@ -5389,4 +5533,27 @@ public class OrderServiceImpl implements OrderService {
|
|
|
public int queryOrderMainTotal() {
|
|
|
return orderDao.queryOrderMainTotal();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R resendOrderInfoToVmcShop(String orderSn) {
|
|
|
+
|
|
|
+ HaiKongSendOrderInfoRecordEntity sendOrderInfoRecordEntity = haiKongSendOrderInfoRecordService.queryObjectByOrderSn(orderSn);
|
|
|
+
|
|
|
+ if (Objects.isNull(sendOrderInfoRecordEntity)) {
|
|
|
+ LOGGER.error(String.format("重新推送订单到免税mall,订单号【%s】对应发送记录不存在", orderSn));
|
|
|
+ return R.error(String.format("订单号【%s】对应发送记录不存在", orderSn));
|
|
|
+ }
|
|
|
+ // 直接修改状态
|
|
|
+ if (!HaiKongMemberOrderResendStatusEnum.RESEND_SUCCESS.getStatus().equals(sendOrderInfoRecordEntity.getResendStatus())) {
|
|
|
+ HaiKongSendOrderInfoRecordEntity sendOrderInfoRecordEntity1 = new HaiKongSendOrderInfoRecordEntity();
|
|
|
+ sendOrderInfoRecordEntity1.setResendStatus(HaiKongMemberOrderResendStatusEnum.WAIT_RESEND.getStatus());
|
|
|
+ sendOrderInfoRecordEntity1.setOuterOrderNo(orderSn);
|
|
|
+ haiKongSendOrderInfoRecordService.updateByOrderSn(sendOrderInfoRecordEntity1);
|
|
|
+ } else {
|
|
|
+ return R.ok("已经推送到免税mall成功,无需重推!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return R.ok("重推成功!");
|
|
|
+ }
|
|
|
}
|