|
|
|
@ -13,8 +13,10 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
|
|
|
import cn.iocoder.yudao.framework.pay.properties.AliPayProperties;
|
|
|
|
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
|
|
import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi;
|
|
|
|
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
|
|
|
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.PhoneRecordDO;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
|
|
|
|
@ -31,6 +33,8 @@ import cn.iocoder.yudao.module.shop.request.order.StoreOrderSendRequest;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.request.order.StoreOrderUpdatePriceRequest;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.response.order.*;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.service.express.ExpressService;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.service.onepass.OnePassService;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.service.order.StoreOrderInfoService;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.service.order.StoreOrderRefundService;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
|
|
|
|
@ -43,6 +47,7 @@ import cn.iocoder.yudao.module.shop.utils.RedisUtil;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.vo.order.LogisticsResultVo;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoOldVo;
|
|
|
|
|
import cn.iocoder.yudao.module.shop.vo.product.MyRecord;
|
|
|
|
|
import com.alipay.api.AlipayApiException;
|
|
|
|
|
import com.alipay.api.internal.util.AlipaySignature;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
@ -124,6 +129,15 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|
|
|
|
@Autowired
|
|
|
|
|
private AliPayProperties aliPayProperties;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ExpressService expressService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ApiConfigApi apiConfigApi;
|
|
|
|
|
|
|
|
|
|
// @Autowired
|
|
|
|
|
// private OnePassService onePassService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 列表(PC)
|
|
|
|
|
*
|
|
|
|
@ -427,7 +441,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|
|
|
|
StoreOrder info = getInfoException(orderNo);
|
|
|
|
|
if (info.getType().equals(1)) {// 视频号订单
|
|
|
|
|
// TODO 快递信息
|
|
|
|
|
// Express express = expressService.getByName(info.getDeliveryName());
|
|
|
|
|
// ExpressDO express = expressService.getByName(info.getDeliveryName());
|
|
|
|
|
// if (ObjectUtil.isNotNull(express)) {
|
|
|
|
|
// info.setDeliveryCode(express.getCode());
|
|
|
|
|
// } else {
|
|
|
|
@ -1459,22 +1473,22 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|
|
|
|
private void express(StoreOrderSendRequest request, StoreOrder storeOrder) {
|
|
|
|
|
// 校验快递发货参数
|
|
|
|
|
validateExpressSend(request);
|
|
|
|
|
// TODO 快递公司信息
|
|
|
|
|
// Express express = expressService.getByCode(request.getExpressCode());
|
|
|
|
|
// if (request.getExpressRecordType().equals("1")) { // 正常发货
|
|
|
|
|
// deliverGoods(request, storeOrder);
|
|
|
|
|
// }
|
|
|
|
|
// 快递公司信息
|
|
|
|
|
ExpressDO express = expressService.getByCode(request.getExpressCode());
|
|
|
|
|
if (request.getExpressRecordType().equals("1")) { // 正常发货
|
|
|
|
|
deliverGoods(request, storeOrder);
|
|
|
|
|
}
|
|
|
|
|
// if (request.getExpressRecordType().equals("2")) { // 电子面单
|
|
|
|
|
// request.setExpressName(express.getName());
|
|
|
|
|
// expressDump(request, storeOrder, express);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// storeOrder.setDeliveryCode(express.getCode());
|
|
|
|
|
// storeOrder.setDeliveryName(express.getName());
|
|
|
|
|
// storeOrder.setStatus(1);
|
|
|
|
|
// storeOrder.setDeliveryType("express");
|
|
|
|
|
|
|
|
|
|
String message = Constants.ORDER_LOG_MESSAGE_EXPRESS.replace("{deliveryName}", request.getExpressName()).replace("{deliveryCode}", storeOrder.getDeliveryId());
|
|
|
|
|
storeOrder.setDeliveryCode(express.getCode());
|
|
|
|
|
storeOrder.setDeliveryName(express.getName());
|
|
|
|
|
storeOrder.setStatus(1);
|
|
|
|
|
storeOrder.setDeliveryType("express");
|
|
|
|
|
|
|
|
|
|
String message = Constants.ORDER_LOG_MESSAGE_EXPRESS.replace("{deliveryName}", express.getName()).replace("{deliveryCode}", storeOrder.getDeliveryId());
|
|
|
|
|
|
|
|
|
|
Boolean execute = transactionTemplate.execute(i -> {
|
|
|
|
|
updateById(storeOrder);
|
|
|
|
@ -1488,6 +1502,56 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|
|
|
|
sendGoodsNotify(storeOrder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// /**
|
|
|
|
|
// * 电子面单
|
|
|
|
|
// * @param request
|
|
|
|
|
// * @param storeOrder
|
|
|
|
|
// * @param express
|
|
|
|
|
// */
|
|
|
|
|
// private void expressDump(StoreOrderSendRequest request, StoreOrder storeOrder, ExpressDO express) {
|
|
|
|
|
// String configExportOpen = apiConfigApi.getConfigKey("config_export_open").toString();
|
|
|
|
|
// if (!configExportOpen.equals("1")) {// 电子面单未开启
|
|
|
|
|
// throw new ServiceException("请先开启电子面单");
|
|
|
|
|
// }
|
|
|
|
|
// MyRecord record = new MyRecord();
|
|
|
|
|
// record.set("com", express.getCode());// 快递公司编码
|
|
|
|
|
// record.set("to_name", storeOrder.getRealName());// 收件人
|
|
|
|
|
// record.set("to_tel", storeOrder.getUserPhone());// 收件人电话
|
|
|
|
|
// record.set("to_addr", storeOrder.getUserAddress());// 收件人详细地址
|
|
|
|
|
// record.set("from_name", request.getToName());// 寄件人
|
|
|
|
|
// record.set("from_tel", request.getToTel());// 寄件人电话
|
|
|
|
|
// record.set("from_addr", request.getToAddr());// 寄件人详细地址
|
|
|
|
|
// record.set("temp_id", request.getExpressTempId());// 电子面单模板ID
|
|
|
|
|
// String siid = apiConfigApi.getConfigKey("config_export_siid").toString();
|
|
|
|
|
// record.set("siid", siid);// 云打印机编号
|
|
|
|
|
// record.set("count", storeOrder.getTotalNum());// 商品数量
|
|
|
|
|
//
|
|
|
|
|
// //获取购买商品名称
|
|
|
|
|
// List<Integer> orderIdList = new ArrayList<>();
|
|
|
|
|
// orderIdList.add(storeOrder.getId());
|
|
|
|
|
// HashMap<Integer, List<StoreOrderInfoOldVo>> orderInfoMap = StoreOrderInfoService.getMapInId(orderIdList);
|
|
|
|
|
// if (orderInfoMap.isEmpty() || !orderInfoMap.containsKey(storeOrder.getId())) {
|
|
|
|
|
// throw new ServiceException("没有找到购买的商品信息");
|
|
|
|
|
// }
|
|
|
|
|
// List<String> productNameList = new ArrayList<>();
|
|
|
|
|
// for (StoreOrderInfoOldVo storeOrderInfoVo : orderInfoMap.get(storeOrder.getId())) {
|
|
|
|
|
// productNameList.add(storeOrderInfoVo.getInfo().getProductName());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// record.set("cargo", String.join(",", productNameList));// 物品名称
|
|
|
|
|
// if (express.getPartnerId()) {
|
|
|
|
|
// record.set("partner_id", express.getAccount());// 电子面单月结账号(部分快递公司必选)
|
|
|
|
|
// }
|
|
|
|
|
// if (express.getPartnerKey()) {
|
|
|
|
|
// record.set("partner_key", express.getPassword());// 电子面单密码(部分快递公司必选)
|
|
|
|
|
// }
|
|
|
|
|
// if (express.getNet()) {
|
|
|
|
|
// record.set("net", express.getNetName());// 收件网点名称(部分快递公司必选)
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// MyRecord myRecord = onePassService.expressDump(record);
|
|
|
|
|
// storeOrder.setDeliveryId(myRecord.getStr("kuaidinum"));
|
|
|
|
|
// }
|
|
|
|
|
/**
|
|
|
|
|
* 校验快递发货参数
|
|
|
|
|
*/
|
|
|
|
@ -1498,7 +1562,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isBlank(request.getExpressCode())) throw new ServiceException("请选择快递公司");
|
|
|
|
|
if (StrUtil.isBlank(request.getExpressRecordType())) throw new ServiceException("请选择发货记录类型");
|
|
|
|
|
if (StrUtil.isBlank(request.getExpressTempId())) throw new ServiceException("请选择电子面单");
|
|
|
|
|
// if (StrUtil.isBlank(request.getExpressTempId())) throw new ServiceException("请选择电子面单");
|
|
|
|
|
if (StrUtil.isBlank(request.getToName())) throw new ServiceException("请填写寄件人姓名");
|
|
|
|
|
if (StrUtil.isBlank(request.getToTel())) throw new ServiceException("请填写寄件人电话");
|
|
|
|
|
if (StrUtil.isBlank(request.getToAddr())) throw new ServiceException("请填写寄件人地址");
|
|
|
|
|