b2c模式代码提交
This commit is contained in:
@@ -464,6 +464,7 @@ public enum ResultCode {
|
||||
ORDER_SETTING_ERROR(70006, "系统订单配置异常"),
|
||||
ALI_SMS_SETTING_ERROR(70007, "您还未配置阿里云短信"),
|
||||
SMS_SIGN_EXIST_ERROR(70008, "短信签名已存在"),
|
||||
DELIVERY_SETTING_ERROR(70009, "请配置发货参数"),
|
||||
|
||||
/**
|
||||
* 站内信
|
||||
|
||||
@@ -114,7 +114,7 @@ public class GoodsImportServiceImpl implements GoodsImportService {
|
||||
|
||||
List<String> freightTemplateNameList = new ArrayList<>();
|
||||
//循环列表,存放ID-运费模板名称
|
||||
for (FreightTemplateVO freightTemplateVO : freightTemplateService.getFreightTemplateList(storeId)) {
|
||||
for (FreightTemplateVO freightTemplateVO : freightTemplateService.getFreightTemplateList()) {
|
||||
freightTemplateNameList.add(freightTemplateVO.getId() + "-" + freightTemplateVO.getName());
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import cn.lili.modules.store.service.FreightTemplateService;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
import cn.lili.modules.system.aspect.annotation.SystemLogPoint;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.entity.dto.BaseSetting;
|
||||
import cn.lili.modules.system.entity.dto.GoodsSetting;
|
||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
@@ -663,20 +664,14 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
//获取商品系统配置决定是否审核
|
||||
Setting setting = settingService.get(SettingEnum.GOODS_SETTING.name());
|
||||
GoodsSetting goodsSetting = JSONUtil.toBean(setting.getSettingValue(), GoodsSetting.class);
|
||||
Setting baseSetting = settingService.get(SettingEnum.BASE_SETTING.name());
|
||||
BaseSetting baseSettingValue = JSONUtil.toBean(baseSetting.getSettingValue(), BaseSetting.class);
|
||||
//是否需要审核
|
||||
goods.setAuthFlag(Boolean.TRUE.equals(goodsSetting.getGoodsCheck()) ? GoodsAuthEnum.TOBEAUDITED.name() : GoodsAuthEnum.PASS.name());
|
||||
//判断当前用户是否为店铺
|
||||
if (Objects.requireNonNull(UserContext.getCurrentUser()).getRole().equals(UserEnums.STORE)) {
|
||||
StoreVO storeDetail = this.storeService.getStoreDetail();
|
||||
if (storeDetail.getSelfOperated() != null) {
|
||||
goods.setSelfOperated(storeDetail.getSelfOperated());
|
||||
}
|
||||
goods.setStoreId(storeDetail.getId());
|
||||
goods.setStoreName(storeDetail.getStoreName());
|
||||
goods.setSelfOperated(storeDetail.getSelfOperated());
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.STORE_NOT_LOGIN_ERROR);
|
||||
}
|
||||
//平台商品,默认处理
|
||||
goods.setStoreId("-1");
|
||||
goods.setStoreName(baseSettingValue.getSiteName());
|
||||
goods.setSelfOperated(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.lili.modules.logistics.plugin.kdniao;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.modules.logistics.LogisticsPlugin;
|
||||
@@ -12,8 +13,13 @@ import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
|
||||
import cn.lili.modules.store.entity.dos.StoreLogistics;
|
||||
import cn.lili.modules.store.entity.dto.StoreDeliverGoodsAddressDTO;
|
||||
import cn.lili.modules.system.entity.dos.Logistics;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.entity.dto.DeliverySetting;
|
||||
import cn.lili.modules.system.entity.dto.LogisticsSetting;
|
||||
import cn.lili.modules.system.entity.dto.payment.UnionPaymentSetting;
|
||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.entity.vo.Traces;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -40,6 +46,9 @@ public class KdniaoPlugin implements LogisticsPlugin {
|
||||
@Autowired
|
||||
private LogisticsSetting logisticsSetting;
|
||||
|
||||
@Autowired
|
||||
private SettingService settingService;
|
||||
|
||||
public KdniaoPlugin(LogisticsSetting logisticsSetting) {
|
||||
this.logisticsSetting = logisticsSetting;
|
||||
}
|
||||
@@ -124,31 +133,41 @@ public class KdniaoPlugin implements LogisticsPlugin {
|
||||
//收件人地址
|
||||
String[] ConsigneeAddress = order.getConsigneeAddressPath().split(",");
|
||||
//获取店家信息
|
||||
StoreDeliverGoodsAddressDTO storeDeliverGoodsAddressDTO = labelOrderDTO.getStoreDeliverGoodsAddressDTO();
|
||||
// StoreDeliverGoodsAddressDTO storeDeliverGoodsAddressDTO = labelOrderDTO.getStoreDeliverGoodsAddressDTO();
|
||||
//发件人地址
|
||||
String[] consignorAddress = storeDeliverGoodsAddressDTO.getSalesConsignorAddressPath().split(",");
|
||||
// String[] consignorAddress = storeDeliverGoodsAddressDTO.getSalesConsignorAddressPath().split(",");
|
||||
//店铺-物流公司设置
|
||||
StoreLogistics storeLogistics = labelOrderDTO.getStoreLogistics();
|
||||
// StoreLogistics storeLogistics = labelOrderDTO.getStoreLogistics();
|
||||
Setting systemSetting = settingService.get(SettingEnum.DELIVERY_SETTING.name());
|
||||
DeliverySetting deliverySetting = JSONUtil.toBean(systemSetting.getSettingValue(), DeliverySetting.class);
|
||||
if(deliverySetting.getSalesConsignorName() == null
|
||||
|| deliverySetting.getSalesConsignorAddressId() == null
|
||||
|| deliverySetting.getSalesConsignorAddressPath() == null
|
||||
|| deliverySetting.getSalesConsignorMobile() == null
|
||||
|| deliverySetting.getSalesConsignorDetail() == null){
|
||||
throw new ServiceException(ResultCode.DELIVERY_SETTING_ERROR);
|
||||
}
|
||||
String[] consignorAddress = deliverySetting.getSalesConsignorAddressPath().split(",");
|
||||
|
||||
//组装快递鸟应用级参数
|
||||
String resultDate = "{" +
|
||||
"'OrderCode': '" + order.getSn() + "'," + //订单编码
|
||||
"'ShipperCode': '" + logistics.getCode() + "'," + //快递公司编码
|
||||
"'CustomerName': '" + storeLogistics.getCustomerName() + "'," +//客户编码
|
||||
"'CustomerPwd': '" + storeLogistics.getCustomerPwd() + "'," + //客户密码
|
||||
"'MonthCode': '" + storeLogistics.getMonthCode() + "'," + //密钥
|
||||
"'SendSite': '" + storeLogistics.getSendSite() + "'," + //归属网点
|
||||
"'SendStaff': '" + storeLogistics.getSendStaff() + "'," + //收件快递员
|
||||
"'PayType': " + storeLogistics.getPayType() + "," +
|
||||
"'ExpType': " + storeLogistics.getExpType() + "," +
|
||||
"'CustomerName': '" + logistics.getCustomerName() + "'," +//客户编码
|
||||
"'CustomerPwd': '" + logistics.getCustomerPwd() + "'," + //客户密码
|
||||
"'MonthCode': '" + logistics.getMonthCode() + "'," + //密钥
|
||||
"'SendSite': '" + logistics.getSendSite() + "'," + //归属网点
|
||||
"'SendStaff': '" + logistics.getSendStaff() + "'," + //收件快递员
|
||||
"'PayType': " + logistics.getPayType() + "," +
|
||||
"'ExpType': " + logistics.getExpType() + "," +
|
||||
//发件人信息
|
||||
"'Sender': {" +
|
||||
"'Name': '" + storeDeliverGoodsAddressDTO.getSalesConsignorName() + "'," +
|
||||
"'Mobile': '" + storeDeliverGoodsAddressDTO.getSalesConsignorMobile() + "'," +
|
||||
"'Name': '" + deliverySetting.getSalesConsignorName() + "'," +
|
||||
"'Mobile': '" + deliverySetting.getSalesConsignorMobile() + "'," +
|
||||
"'ProvinceName': '" + consignorAddress[0] + "'," + //省
|
||||
"'CityName': '" + consignorAddress[1] + "'," + //市
|
||||
"'ExpAreaName': '" + consignorAddress[2] + "'," + //区
|
||||
"'Address': '" + storeDeliverGoodsAddressDTO.getSalesConsignorDetail() + "'" + //发件人详细地址
|
||||
"'Address': '" + deliverySetting.getSalesConsignorDetail() + "'" + //发件人详细地址
|
||||
"}," +
|
||||
//收件人信息
|
||||
"'Receiver': {" +
|
||||
|
||||
@@ -172,9 +172,9 @@ public class SeckillApplyServiceImpl extends ServiceImpl<SeckillApplyMapper, Sec
|
||||
for (SeckillApplyVO seckillApply : seckillApplyList) {
|
||||
//获取参与活动的商品信息
|
||||
GoodsSku goodsSku = goodsSkuService.getCanPromotionGoodsSkuByIdFromCache(seckillApply.getSkuId());
|
||||
if (!goodsSku.getStoreId().equals(storeId)) {
|
||||
continue;
|
||||
}
|
||||
// if (!goodsSku.getStoreId().equals(storeId)) {
|
||||
// continue;
|
||||
// }
|
||||
//获取秒杀活动时间段
|
||||
DateTime startTime = DateUtil.offsetHour(DateUtil.beginOfDay(seckill.getStartTime()), seckillApply.getTimeLine());
|
||||
//检测是否可以发布促销商品
|
||||
|
||||
@@ -34,7 +34,7 @@ public interface FreightTemplateService extends IService<FreightTemplate> {
|
||||
* @param storeId
|
||||
* @return 运费模板列表
|
||||
*/
|
||||
List<FreightTemplateVO> getFreightTemplateList(String storeId);
|
||||
List<FreightTemplateVO> getFreightTemplateList();
|
||||
|
||||
/**
|
||||
* 获取运费模板详细信息
|
||||
|
||||
@@ -48,17 +48,15 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
|
||||
|
||||
|
||||
@Override
|
||||
public List<FreightTemplateVO> getFreightTemplateList(String storeId) {
|
||||
public List<FreightTemplateVO> getFreightTemplateList() {
|
||||
//先从缓存中获取运费模板,如果有则直接返回,如果没有则查询数据后再返回
|
||||
List<FreightTemplateVO> list = (List<FreightTemplateVO>) cache.get(CachePrefix.SHIP_TEMPLATE.getPrefix() + storeId);
|
||||
List<FreightTemplateVO> list = (List<FreightTemplateVO>) cache.get(CachePrefix.SHIP_TEMPLATE.getPrefix());
|
||||
if (list != null) {
|
||||
return list;
|
||||
}
|
||||
list = new ArrayList<>();
|
||||
//查询运费模板
|
||||
LambdaQueryWrapper<FreightTemplate> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.eq(FreightTemplate::getStoreId, storeId);
|
||||
List<FreightTemplate> freightTemplates = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
List<FreightTemplate> freightTemplates = this.list();
|
||||
if (!freightTemplates.isEmpty()) {
|
||||
//如果模板不为空则查询子模板信息
|
||||
for (FreightTemplate freightTemplate : freightTemplates) {
|
||||
@@ -71,16 +69,14 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
|
||||
list.add(freightTemplateVO);
|
||||
}
|
||||
}
|
||||
cache.put(CachePrefix.SHIP_TEMPLATE.getPrefix() + storeId, list);
|
||||
cache.put(CachePrefix.SHIP_TEMPLATE.getPrefix(), list);
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<FreightTemplate> getFreightTemplate(PageVO pageVo) {
|
||||
LambdaQueryWrapper<FreightTemplate> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.eq(FreightTemplate::getStoreId, UserContext.getCurrentUser().getStoreId());
|
||||
return this.baseMapper.selectPage(PageUtil.initPage(pageVo), lambdaQueryWrapper);
|
||||
return this.page(PageUtil.initPage(pageVo));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,10 +97,7 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
|
||||
@Override
|
||||
public FreightTemplateVO addFreightTemplate(FreightTemplateVO freightTemplateVO) {
|
||||
//获取当前登录商家账号
|
||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||
FreightTemplate freightTemplate = new FreightTemplate();
|
||||
//设置店铺ID
|
||||
freightTemplateVO.setStoreId(tokenUser.getStoreId());
|
||||
//复制属性
|
||||
BeanUtils.copyProperties(freightTemplateVO, freightTemplate);
|
||||
//添加运费模板
|
||||
@@ -122,7 +115,7 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
|
||||
}
|
||||
|
||||
//更新缓存
|
||||
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix() + tokenUser.getStoreId());
|
||||
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix());
|
||||
return freightTemplateVO;
|
||||
}
|
||||
|
||||
@@ -130,10 +123,10 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public FreightTemplateVO editFreightTemplate(FreightTemplateVO freightTemplateVO) {
|
||||
//获取当前登录商家账号
|
||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||
if (freightTemplateVO.getId().equals(tokenUser.getStoreId())) {
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
// AuthUser tokenUser = UserContext.getCurrentUser();
|
||||
// if (freightTemplateVO.getId().equals(tokenUser.getStoreId())) {
|
||||
// throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
// }
|
||||
FreightTemplate freightTemplate = new FreightTemplate();
|
||||
//复制属性
|
||||
BeanUtils.copyProperties(freightTemplateVO, freightTemplate);
|
||||
@@ -150,7 +143,7 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
|
||||
//添加模板子内容
|
||||
freightTemplateChildService.addFreightTemplateChild(list);
|
||||
//更新缓存
|
||||
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix() + tokenUser.getStoreId());
|
||||
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -159,13 +152,11 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean removeFreightTemplate(String id) {
|
||||
//获取当前登录商家账号
|
||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||
LambdaQueryWrapper<FreightTemplate> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.eq(FreightTemplate::getStoreId, tokenUser.getStoreId());
|
||||
lambdaQueryWrapper.eq(FreightTemplate::getId, id);
|
||||
//如果删除成功则删除运费模板子项
|
||||
if (this.remove(lambdaQueryWrapper)) {
|
||||
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix() + tokenUser.getStoreId());
|
||||
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix());
|
||||
return freightTemplateChildService.removeFreightTemplate(id);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.lili.modules.system.entity.dos;
|
||||
|
||||
import cn.lili.modules.store.entity.dto.StoreLogisticsCustomerDTO;
|
||||
import cn.lili.mybatis.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@@ -37,4 +38,39 @@ public class Logistics extends BaseEntity {
|
||||
|
||||
@ApiModelProperty(value = "禁用状态 OPEN:开启,CLOSE:禁用")
|
||||
private String disabled;
|
||||
|
||||
@ApiModelProperty(value = "客户代码")
|
||||
private String customerName;
|
||||
|
||||
@ApiModelProperty(value = "客户密码")
|
||||
private String customerPwd;
|
||||
|
||||
@ApiModelProperty(value = "密钥")
|
||||
private String monthCode;
|
||||
|
||||
@ApiModelProperty(value = "归属网点/网点编码")
|
||||
private String sendSite;
|
||||
|
||||
@ApiModelProperty(value = "收件快递员")
|
||||
private String sendStaff;
|
||||
|
||||
@ApiModelProperty(value = "是否使用电子面单")
|
||||
private boolean faceSheetFlag;
|
||||
|
||||
@ApiModelProperty(value = "支付方式")
|
||||
private String payType;
|
||||
|
||||
@ApiModelProperty(value = "快递类型")
|
||||
private String expType;
|
||||
|
||||
public Logistics(StoreLogisticsCustomerDTO storeLogisticsCustomerDTO){
|
||||
this.customerName=storeLogisticsCustomerDTO.getCustomerName();
|
||||
this.customerPwd=storeLogisticsCustomerDTO.getCustomerPwd();
|
||||
this.sendSite=storeLogisticsCustomerDTO.getSendSite();
|
||||
this.sendStaff=storeLogisticsCustomerDTO.getSendStaff();
|
||||
this.monthCode=storeLogisticsCustomerDTO.getMonthCode();
|
||||
this.faceSheetFlag=storeLogisticsCustomerDTO.isFaceSheetFlag();
|
||||
this.payType = storeLogisticsCustomerDTO.getPayType();
|
||||
this.expType = storeLogisticsCustomerDTO.getExpType();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.lili.modules.system.entity.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author chc
|
||||
* @since 2022/6/2114:46
|
||||
*/
|
||||
@Data
|
||||
public class DeliverySetting implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "发货人姓名")
|
||||
private String salesConsignorName;
|
||||
|
||||
@ApiModelProperty(value = "发货人手机号")
|
||||
private String salesConsignorMobile;
|
||||
|
||||
@ApiModelProperty(value = "地址Id, ','分割")
|
||||
private String salesConsignorAddressId;
|
||||
|
||||
@ApiModelProperty(value = "地址名称, ','分割")
|
||||
private String salesConsignorAddressPath;
|
||||
|
||||
@ApiModelProperty(value = "详细地址")
|
||||
private String salesConsignorDetail;
|
||||
}
|
||||
@@ -52,5 +52,7 @@ public enum SettingEnum {
|
||||
//银联支付设置
|
||||
UNIONPAY_PAYMENT,
|
||||
//热词设置
|
||||
HOT_WORDS
|
||||
HOT_WORDS,
|
||||
//发货设置
|
||||
DELIVERY_SETTING,
|
||||
}
|
||||
|
||||
@@ -102,19 +102,11 @@ public class LogisticsServiceImpl extends ServiceImpl<LogisticsMapper, Logistics
|
||||
logistics = this.getById(logisticsId);
|
||||
}
|
||||
// 店铺-物流公司设置
|
||||
LambdaQueryWrapper<StoreLogistics> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.eq(StoreLogistics::getLogisticsId, logistics.getId());
|
||||
lambdaQueryWrapper.eq(StoreLogistics::getStoreId, order.getStoreId());
|
||||
StoreLogistics storeLogistics = storeLogisticsService.getOne(lambdaQueryWrapper);
|
||||
//获取店家信息
|
||||
StoreDeliverGoodsAddressDTO storeDeliverGoodsAddressDTO = storeDetailService.getStoreDeliverGoodsAddressDto(order.getStoreId());
|
||||
|
||||
LabelOrderDTO labelOrderDTO = new LabelOrderDTO();
|
||||
labelOrderDTO.setOrder(order);
|
||||
labelOrderDTO.setOrderItems(orderItems);
|
||||
labelOrderDTO.setLogistics(logistics);
|
||||
labelOrderDTO.setStoreLogistics(storeLogistics);
|
||||
labelOrderDTO.setStoreDeliverGoodsAddressDTO(storeDeliverGoodsAddressDTO);
|
||||
//触发电子面单
|
||||
return logisticsPluginFactory.filePlugin().labelOrder(labelOrderDTO);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user