物流公司和配置信息修改

pull/2/head
js199000131 2023-05-18 11:01:34 +08:00
parent c4bdbb6904
commit cbf8056b88
5 changed files with 147 additions and 13 deletions

View File

@ -0,0 +1,10 @@
package cn.iocoder.yudao.module.shop.dal.mysql.express;
import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ExpressMapper extends BaseMapper<ExpressDO> {
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.shop.service.express;
import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* ExpressService
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEBCRMEB
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
@Service
@Validated
public interface ExpressService {
/**
*
* @param code
* @return ExpressDO
*/
ExpressDO getByCode(String code);
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.shop.service.express.impl;
import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO;
import cn.iocoder.yudao.module.shop.dal.mysql.express.ExpressMapper;
import cn.iocoder.yudao.module.shop.service.express.ExpressService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class ExpressServiceImpl implements ExpressService {
@Resource
private ExpressMapper dao;
/**
*
* @param code
*/
@Override
public ExpressDO getByCode(String code) {
LambdaQueryWrapper<ExpressDO> lqw = new LambdaQueryWrapper<>();
lqw.eq(ExpressDO::getCode, code);
ExpressDO expressDO = dao.selectOne(lqw);
return expressDO;
}
}

View File

@ -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("请填写寄件人地址");

View File

@ -217,6 +217,8 @@ yudao:
- cy_recharge_order_info
- cy_refund_fee_record
- market_banner
- eb_express
- eb_store_order_status
sms-code: # 短信验证码相关的配置项
expire-times: 10m
send-frequency: 1m