|
@@ -642,6 +642,9 @@ public class OrderServiceImpl implements OrderService {
|
|
mailInfo.setShopTel(storeEntity.getTelephoneNumber());
|
|
mailInfo.setShopTel(storeEntity.getTelephoneNumber());
|
|
AddressEntity addressEntity = addressDao.queryStoreAddress(storeEntity.getId(),Dict.addressStatus.item_1.getItem());
|
|
AddressEntity addressEntity = addressDao.queryStoreAddress(storeEntity.getId(),Dict.addressStatus.item_1.getItem());
|
|
// 发货人
|
|
// 发货人
|
|
|
|
+ if (Objects.isNull(addressEntity)) {
|
|
|
|
+ throw new ServiceException("请先配置发货地址!");
|
|
|
|
+ }
|
|
mailInfo.setSenderTel(addressEntity.getTelNumber());
|
|
mailInfo.setSenderTel(addressEntity.getTelNumber());
|
|
mailInfo.setSenderName(addressEntity.getSenderName());
|
|
mailInfo.setSenderName(addressEntity.getSenderName());
|
|
mailInfo.setSenderProvince(addressEntity.getProvinceName());
|
|
mailInfo.setSenderProvince(addressEntity.getProvinceName());
|
|
@@ -2175,10 +2178,20 @@ public class OrderServiceImpl implements OrderService {
|
|
queryGoodsVo.setSellVolume((Integer) map.get("sellVolume"));
|
|
queryGoodsVo.setSellVolume((Integer) map.get("sellVolume"));
|
|
queryGoodsVo.setRetailPrice(new BigDecimal(String.valueOf(map.get("retailPrice"))));
|
|
queryGoodsVo.setRetailPrice(new BigDecimal(String.valueOf(map.get("retailPrice"))));
|
|
queryGoodsVo.setGoodsTaxes(new BigDecimal(String.valueOf(map.get("goodstaxes"))));
|
|
queryGoodsVo.setGoodsTaxes(new BigDecimal(String.valueOf(map.get("goodstaxes"))));
|
|
- queryGoodsVo.setDisCountedPrice(new BigDecimal(String.valueOf(map.get("discountedPrice"))));
|
|
|
|
|
|
+ Object discountedPriceObj = map.get("discountedPrice");
|
|
|
|
+ BigDecimal discountedPrice = BigDecimal.ZERO;
|
|
|
|
+ if (Objects.nonNull(discountedPriceObj)) {
|
|
|
|
+ discountedPrice = new BigDecimal(String.valueOf(discountedPriceObj));
|
|
|
|
+ }
|
|
|
|
+ queryGoodsVo.setDisCountedPrice(discountedPrice);
|
|
queryGoodsVo.setTotalPrice(new BigDecimal(String.valueOf(map.get("actualPaymentAmount"))));
|
|
queryGoodsVo.setTotalPrice(new BigDecimal(String.valueOf(map.get("actualPaymentAmount"))));
|
|
queryGoodsVo.setActivity((String) map.get("activity"));
|
|
queryGoodsVo.setActivity((String) map.get("activity"));
|
|
- queryGoodsVo.setDeductionScore((Integer) map.get("deductionScore"));
|
|
|
|
|
|
+ Object deductionScoreObj = map.get("deductionScore");
|
|
|
|
+ Integer deductionScore = 0;
|
|
|
|
+ if (Objects.nonNull(deductionScoreObj)) {
|
|
|
|
+ deductionScore = (Integer) deductionScoreObj;
|
|
|
|
+ }
|
|
|
|
+ queryGoodsVo.setDeductionScore(deductionScore);
|
|
Object deductionPriceObj = map.get("deductionPrice");
|
|
Object deductionPriceObj = map.get("deductionPrice");
|
|
BigDecimal deductionPrice = BigDecimal.ZERO;
|
|
BigDecimal deductionPrice = BigDecimal.ZERO;
|
|
if (Objects.nonNull(deductionPriceObj)) {
|
|
if (Objects.nonNull(deductionPriceObj)) {
|
|
@@ -2282,11 +2295,9 @@ public class OrderServiceImpl implements OrderService {
|
|
ListUtils listUtils = BeanUtils.instantiate(ListUtils.class);
|
|
ListUtils listUtils = BeanUtils.instantiate(ListUtils.class);
|
|
listUtils.copyList(goodsEntityList, queryGoodsVOList);
|
|
listUtils.copyList(goodsEntityList, queryGoodsVOList);
|
|
|
|
|
|
- // 商品总重量
|
|
|
|
- BigDecimal weight = new BigDecimal(0);
|
|
|
|
//生成商户订单号
|
|
//生成商户订单号
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
|
- String orderSn = "ZWCW" + format.format(new Date()) + CommonUtil.generateOrderNumber();
|
|
|
|
|
|
+ String orderSn = "ZMHK" + format.format(new Date()) + CommonUtil.generateOrderNumber();
|
|
// 检查库存和更新库存
|
|
// 检查库存和更新库存
|
|
for (QueryGoodsVO goodsDto : queryGoodsVOList) {
|
|
for (QueryGoodsVO goodsDto : queryGoodsVOList) {
|
|
// 要购买的数量
|
|
// 要购买的数量
|
|
@@ -2507,15 +2518,17 @@ public class OrderServiceImpl implements OrderService {
|
|
|
|
|
|
String env = environment.getProperty("haikong.env");
|
|
String env = environment.getProperty("haikong.env");
|
|
// 判断是微信的支付码还是支付宝的支付码
|
|
// 判断是微信的支付码还是支付宝的支付码
|
|
|
|
+ env = "prod";
|
|
if (!org.springframework.util.StringUtils.isEmpty(env) && Constants.PROD.equals(env)) {
|
|
if (!org.springframework.util.StringUtils.isEmpty(env) && Constants.PROD.equals(env)) {
|
|
if (parCode.startsWith("28")) {
|
|
if (parCode.startsWith("28")) {
|
|
// 支付宝支付
|
|
// 支付宝支付
|
|
- try {
|
|
|
|
|
|
+ throw new ServiceException("目前暂不支持支付宝付款!请使用微信进行支付!");
|
|
|
|
+ /*try {
|
|
AliPay(user, parCode, order, processRecordEntity, orderWXPayRecordCurrent, store);
|
|
AliPay(user, parCode, order, processRecordEntity, orderWXPayRecordCurrent, store);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
LOGGER.error("支付宝支付出现异常!订单号:【{}】", order.getOrder_sn(), e);
|
|
LOGGER.error("支付宝支付出现异常!订单号:【{}】", order.getOrder_sn(), e);
|
|
throw e;
|
|
throw e;
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
} else {
|
|
} else {
|
|
// 微信支付
|
|
// 微信支付
|
|
try {
|
|
try {
|
|
@@ -2808,9 +2821,9 @@ public class OrderServiceImpl implements OrderService {
|
|
|
|
|
|
String response = vmcShopTemplate.sendOrder(body);
|
|
String response = vmcShopTemplate.sendOrder(body);
|
|
|
|
|
|
- com.kmall.admin.haikong.utils.R<String> r = JacksonUtil.fromListJson(response, new TypeReference<com.kmall.admin.haikong.utils.R<String>>() {});
|
|
|
|
|
|
+ Response<String> r = JacksonUtil.fromListJson(response, new TypeReference<Response<String>>() {});
|
|
|
|
|
|
- if (Objects.nonNull(r) && r.getCode() == 0) {
|
|
|
|
|
|
+ if (Objects.nonNull(r) && !"failure".equals(r.getResult())) {
|
|
pickUpCodeService.updatePickUpCodeStatusByOrderSn(orderSn, Dict.PickUpCodeStatusEnum.item_0.getStatus());
|
|
pickUpCodeService.updatePickUpCodeStatusByOrderSn(orderSn, Dict.PickUpCodeStatusEnum.item_0.getStatus());
|
|
haiKongSendOrderInfoRecordEntity.setResendStatus(HaiKongMemberOrderResendStatusEnum.NON_RESEND.getStatus());
|
|
haiKongSendOrderInfoRecordEntity.setResendStatus(HaiKongMemberOrderResendStatusEnum.NON_RESEND.getStatus());
|
|
LOGGER.info("推送订单到免税mall成功!响应结果:{}", response);
|
|
LOGGER.info("推送订单到免税mall成功!响应结果:{}", response);
|
|
@@ -2864,7 +2877,11 @@ public class OrderServiceImpl implements OrderService {
|
|
*/
|
|
*/
|
|
private SeaportInfoDTO wrapSeaportInfo(OrderVo order) {
|
|
private SeaportInfoDTO wrapSeaportInfo(OrderVo order) {
|
|
SeaportInfoDTO seaportInfoDTO = new SeaportInfoDTO();
|
|
SeaportInfoDTO seaportInfoDTO = new SeaportInfoDTO();
|
|
- seaportInfoDTO.setSeaportCode("4600");
|
|
|
|
|
|
+ String value = sysConfigDao.queryByKey(Constants.CUSTOMS_PORT_CODE);
|
|
|
|
+ if (org.springframework.util.StringUtils.isEmpty(value)) {
|
|
|
|
+ throw new ServiceException("未配置海关口岸代码!配置方式:【系统管理】->【系统参数】");
|
|
|
|
+ }
|
|
|
|
+ seaportInfoDTO.setSeaportCode(value);
|
|
seaportInfoDTO.setPlatform("1");
|
|
seaportInfoDTO.setPlatform("1");
|
|
seaportInfoDTO.setIdentityCard(order.getIdCard());
|
|
seaportInfoDTO.setIdentityCard(order.getIdCard());
|
|
seaportInfoDTO.setIdentityName(order.getPay_name());
|
|
seaportInfoDTO.setIdentityName(order.getPay_name());
|
|
@@ -2904,7 +2921,7 @@ public class OrderServiceImpl implements OrderService {
|
|
orderInfoItemDTO.setItemcode(orderGoodsVo.getSku());
|
|
orderInfoItemDTO.setItemcode(orderGoodsVo.getSku());
|
|
orderInfoItemDTO.setAmount(orderGoodsVo.getActualPaymentAmount());
|
|
orderInfoItemDTO.setAmount(orderGoodsVo.getActualPaymentAmount());
|
|
orderInfoItemDTO.setNums(orderGoodsVo.getNumber());
|
|
orderInfoItemDTO.setNums(orderGoodsVo.getNumber());
|
|
- orderInfoItemDTO.setTax(true);
|
|
|
|
|
|
+ orderInfoItemDTO.setTax("true");
|
|
orderInfoItemDTO.setTaxPrice(orderGoodsVo.getTaxPrice());
|
|
orderInfoItemDTO.setTaxPrice(orderGoodsVo.getTaxPrice());
|
|
return orderInfoItemDTO;
|
|
return orderInfoItemDTO;
|
|
}
|
|
}
|
|
@@ -3232,7 +3249,7 @@ public class OrderServiceImpl implements OrderService {
|
|
// 发送请求
|
|
// 发送请求
|
|
String memberOrderSyncResponseJson = haiKongMemberTemplate.memberOrderSync(body);
|
|
String memberOrderSyncResponseJson = haiKongMemberTemplate.memberOrderSync(body);
|
|
LOGGER.info("请求会员系统同步消费订单接口!响应:{}", memberOrderSyncResponseJson);
|
|
LOGGER.info("请求会员系统同步消费订单接口!响应:{}", memberOrderSyncResponseJson);
|
|
- Response<Long> response = JacksonUtil.fromListJson(memberOrderSyncResponseJson, new TypeReference<Response<Long>>() {});
|
|
|
|
|
|
+ Response<String> response = JacksonUtil.fromListJson(memberOrderSyncResponseJson, new TypeReference<Response<String>>() {});
|
|
if (Objects.nonNull(response) && response.getSuccess()) {
|
|
if (Objects.nonNull(response) && response.getSuccess()) {
|
|
haiKongMemberOrderSyncResendEntity.setMemberSysOrderId(response.getData());
|
|
haiKongMemberOrderSyncResendEntity.setMemberSysOrderId(response.getData());
|
|
haiKongMemberOrderSyncResendEntity.setResendStatus(HaiKongMemberOrderResendStatusEnum.NON_RESEND.getStatus());
|
|
haiKongMemberOrderSyncResendEntity.setResendStatus(HaiKongMemberOrderResendStatusEnum.NON_RESEND.getStatus());
|
|
@@ -4676,11 +4693,13 @@ public class OrderServiceImpl implements OrderService {
|
|
.filter(m -> Constants.RejectStatus.ALLOW.getCode().equals(m.getReject()))
|
|
.filter(m -> Constants.RejectStatus.ALLOW.getCode().equals(m.getReject()))
|
|
.map(MkActivitiesScoreEntity::getSku)
|
|
.map(MkActivitiesScoreEntity::getSku)
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
+ LOGGER.info("参与积分抵扣的sku集合:{}", scoreDeductionAllowSkuList);
|
|
// 不参与积分抵扣的sku集合,如果该list不为空,则默认其余的sku参与积分抵扣
|
|
// 不参与积分抵扣的sku集合,如果该list不为空,则默认其余的sku参与积分抵扣
|
|
List<String> scoreDeductionRejectSkuList = mkActivitiesScoreEntities.stream()
|
|
List<String> scoreDeductionRejectSkuList = mkActivitiesScoreEntities.stream()
|
|
.filter(m -> Constants.RejectStatus.REJECT.getCode().equals(m.getReject()))
|
|
.filter(m -> Constants.RejectStatus.REJECT.getCode().equals(m.getReject()))
|
|
.map(MkActivitiesScoreEntity::getSku)
|
|
.map(MkActivitiesScoreEntity::getSku)
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
+ LOGGER.info("不参与积分抵扣的sku集合:{}", scoreDeductionRejectSkuList);
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(scoreDeductionAllowSkuList) && !CollectionUtils.isEmpty(scoreDeductionRejectSkuList)) {
|
|
if (!CollectionUtils.isEmpty(scoreDeductionAllowSkuList) && !CollectionUtils.isEmpty(scoreDeductionRejectSkuList)) {
|
|
LOGGER.error("积分抵扣表中既有参与又有不参与!与需求不符!");
|
|
LOGGER.error("积分抵扣表中既有参与又有不参与!与需求不符!");
|
|
@@ -4696,12 +4715,7 @@ public class OrderServiceImpl implements OrderService {
|
|
for (GoodsDetailsDto goodsDetailsDto : goodsDetailsDtos) {
|
|
for (GoodsDetailsDto goodsDetailsDto : goodsDetailsDtos) {
|
|
String sku = goodsDetailsDto.getGoodsSn();
|
|
String sku = goodsDetailsDto.getGoodsSn();
|
|
if (!promotionSkuList.contains(sku)) {
|
|
if (!promotionSkuList.contains(sku)) {
|
|
- if (CollectionUtils.isEmpty(scoreDeductionAllowSkuList) && !CollectionUtils.isEmpty(scoreDeductionRejectSkuList)) {
|
|
|
|
- if (!scoreDeductionRejectSkuList.contains(sku)) {
|
|
|
|
- BigDecimal skuActualPaymentAmount = goodsDetailsDto.getActualPaymentAmount();
|
|
|
|
- skuTotalPrice = skuTotalPrice.add(skuActualPaymentAmount);
|
|
|
|
- }
|
|
|
|
- } else if (!CollectionUtils.isEmpty(scoreDeductionAllowSkuList) && CollectionUtils.isEmpty(scoreDeductionRejectSkuList)) {
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(scoreDeductionAllowSkuList) && CollectionUtils.isEmpty(scoreDeductionRejectSkuList)) {
|
|
if (scoreDeductionAllowSkuList.contains(sku)) {
|
|
if (scoreDeductionAllowSkuList.contains(sku)) {
|
|
BigDecimal skuActualPaymentAmount = goodsDetailsDto.getActualPaymentAmount();
|
|
BigDecimal skuActualPaymentAmount = goodsDetailsDto.getActualPaymentAmount();
|
|
skuTotalPrice = skuTotalPrice.add(skuActualPaymentAmount);
|
|
skuTotalPrice = skuTotalPrice.add(skuActualPaymentAmount);
|
|
@@ -4728,21 +4742,28 @@ public class OrderServiceImpl implements OrderService {
|
|
// 过滤掉参与过限时特价并且与积分抵扣互斥的sku,以及未参加积分抵扣活动的sku
|
|
// 过滤掉参与过限时特价并且与积分抵扣互斥的sku,以及未参加积分抵扣活动的sku
|
|
goodsDetailsDtos = goodsDetailsDtos.stream().filter(goodsDetailsDto -> {
|
|
goodsDetailsDtos = goodsDetailsDtos.stream().filter(goodsDetailsDto -> {
|
|
String sku = goodsDetailsDto.getSku();
|
|
String sku = goodsDetailsDto.getSku();
|
|
|
|
+
|
|
|
|
+ // 满赠商品不参与积分分摊计算
|
|
|
|
+ if (Constants.ActivityTopicEnum.MZ.getTopicName().equals(goodsDetailsDto.getActivity())) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ // 如果临时促销中定义了该sku不参与,那么根据优先级不管该商品在积分抵扣中如何设置,都认定为不参与
|
|
if (!promotionSkuList.contains(sku)) {
|
|
if (!promotionSkuList.contains(sku)) {
|
|
// 如果导入的商品都为不参与,则其余的商品都默认参与积分抵扣活动
|
|
// 如果导入的商品都为不参与,则其余的商品都默认参与积分抵扣活动
|
|
- if (CollectionUtils.isEmpty(scoreDeductionAllowSkuList) && !CollectionUtils.isEmpty(scoreDeductionRejectSkuList)) {
|
|
|
|
- if (!scoreDeductionRejectSkuList.contains(sku)) {
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(scoreDeductionAllowSkuList) &&
|
|
|
|
+ !CollectionUtils.isEmpty(scoreDeductionRejectSkuList) &&
|
|
|
|
+ !scoreDeductionRejectSkuList.contains(sku)) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
// 如果导入的商品都为参与,则默认其余商品不参与
|
|
// 如果导入的商品都为参与,则默认其余商品不参与
|
|
- } else if (!CollectionUtils.isEmpty(scoreDeductionAllowSkuList) && CollectionUtils.isEmpty(scoreDeductionRejectSkuList)) {
|
|
|
|
- if (scoreDeductionAllowSkuList.contains(sku)) {
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(scoreDeductionAllowSkuList) &&
|
|
|
|
+ CollectionUtils.isEmpty(scoreDeductionRejectSkuList) &&
|
|
|
|
+ scoreDeductionAllowSkuList.contains(sku)) {
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // 满赠商品不参与积分分摊计算
|
|
|
|
- return !Constants.ActivityTopicEnum.MZ.getTopicName().equals(goodsDetailsDto.getActivity());
|
|
|
|
|
|
+ // 临时促销中有这个sku,说明不参与积分抵扣
|
|
|
|
+ return false;
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
// 系统设置的最大抵扣比例(最多能抵扣订单金额的比例),在系统管理的系统参数中设置,KEY为 HAIKONG_MEMBER_MAX_SCORE_RATIO
|
|
// 系统设置的最大抵扣比例(最多能抵扣订单金额的比例),在系统管理的系统参数中设置,KEY为 HAIKONG_MEMBER_MAX_SCORE_RATIO
|
|
String scoreRatioStr = sysConfigDao.queryByKey(Constants.HAIKONG_MEMBER_MAX_SCORE_RATIO);
|
|
String scoreRatioStr = sysConfigDao.queryByKey(Constants.HAIKONG_MEMBER_MAX_SCORE_RATIO);
|