3 Commits
master ... b2c

Author SHA1 Message Date
chc
c69af3e751 获取用户信息时判断用户是否已禁用 2025-01-20 16:35:28 +08:00
chc
dfb98c107e B2C功能提交 2024-10-21 22:34:23 +08:00
chc
9d3ed4a4a7 b2c模式代码提交 2024-10-18 15:30:07 +08:00
35 changed files with 854 additions and 145 deletions

11
DB/b2c.sql Normal file
View File

@@ -0,0 +1,11 @@
/**
物流公司增加电子面单参数
*/
ALTER TABLE li_logistics ADD `customer_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '客户代码';
ALTER TABLE li_logistics ADD `customer_pwd` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '客户密码';
ALTER TABLE li_logistics ADD `month_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '月结号/密钥';
ALTER TABLE li_logistics ADD `send_site` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '归属网点';
ALTER TABLE li_logistics ADD `send_staff` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '收件快递员';
ALTER TABLE li_logistics ADD `face_sheet_flag` bit(1) DEFAULT NULL COMMENT '是否使用电子面单';
ALTER TABLE li_logistics ADD `pay_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '支付方式';
ALTER TABLE li_logistics ADD `exp_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '快递类型';

View File

@@ -0,0 +1,168 @@
package cn.lili.controller.other;
import cn.hutool.json.JSONUtil;
import cn.lili.cache.Cache;
import cn.lili.common.aop.annotation.DemoSite;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.system.entity.dos.Setting;
import cn.lili.modules.system.entity.dto.*;
import cn.lili.modules.system.entity.dto.connect.ConnectSetting;
import cn.lili.modules.system.entity.dto.connect.QQConnectSetting;
import cn.lili.modules.system.entity.dto.connect.WechatConnectSetting;
import cn.lili.modules.system.entity.dto.payment.AlipayPaymentSetting;
import cn.lili.modules.system.entity.dto.payment.PaymentSupportSetting;
import cn.lili.modules.system.entity.dto.payment.UnionPaymentSetting;
import cn.lili.modules.system.entity.dto.payment.WechatPaymentSetting;
import cn.lili.modules.system.entity.dto.payment.dto.PaymentSupportForm;
import cn.lili.modules.system.entity.enums.SettingEnum;
import cn.lili.modules.system.service.SettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author chc
* @since 2022/6/2114:46
*/
@RestController
@Api(tags = "买家端,系统设置")
@RequestMapping("/buyer/other/setting")
public class SettingBuyerController {
@Autowired
private SettingService settingService;
/**
* 缓存
*/
@Autowired
private Cache<String> cache;
@DemoSite
@ApiOperation(value = "查看配置")
@GetMapping(value = "/get/{key}")
@ApiImplicitParam(name = "key", value = "配置key", paramType = "path"
, allowableValues = "BASE_SETTING,EMAIL_SETTING,GOODS_SETTING,KUAIDI_SETTING,ORDER_SETTING,OSS_SETTING,POINT_SETTING," +
"WECHAT_PC_CONNECT,WECHAT_WAP_CONNECT,WECHAT_APP_CONNECT,WECHAT_MP_CONNECT," +
"QQ_WEB_CONNECT,QQ_APP_CONNECT," +
"QQ_WEB_CONNECT,QQ_APP_CONNECT,WEIBO_CONNECT,ALIPAY_CONNECT," +
"PAYMENT_SUPPORT,ALIPAY_PAYMENT,WECHAT_PAYMENT,SECKILL_SETTING,EXPERIENCE_SETTING,IM"
)
public ResultMessage settingGet(@PathVariable String key) {
return createSetting(key);
}
/**
* 获取表单
* 这里主要包含一个配置对象为空,导致转换异常问题的处理,解决配置项增加减少,带来的系统异常,无法直接配置
*
* @param key
* @return
* @throws InstantiationException
* @throws IllegalAccessException
*/
private ResultMessage createSetting(String key) {
SettingEnum settingEnum = SettingEnum.valueOf(key);
cache.remove(key);
Setting setting = settingService.get(key);
switch (settingEnum) {
case BASE_SETTING:
return setting == null ?
ResultUtil.data(new BaseSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), BaseSetting.class));
case WITHDRAWAL_SETTING:
return setting == null ?
ResultUtil.data(new WithdrawalSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), WithdrawalSetting.class));
case DISTRIBUTION_SETTING:
return setting == null ?
ResultUtil.data(new DistributionSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), DistributionSetting.class));
case EMAIL_SETTING:
return setting == null ?
ResultUtil.data(new EmailSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), EmailSetting.class));
case GOODS_SETTING:
return setting == null ?
ResultUtil.data(new GoodsSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), GoodsSetting.class));
case LOGISTICS_SETTING:
return setting == null ?
ResultUtil.data(new LogisticsSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), LogisticsSetting.class));
case ORDER_SETTING:
return setting == null ?
ResultUtil.data(new OrderSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), OrderSetting.class));
case OSS_SETTING:
return setting == null ?
ResultUtil.data(new OssSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), OssSetting.class));
case SMS_SETTING:
return setting == null ?
ResultUtil.data(new SmsSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), SmsSetting.class));
case POINT_SETTING:
return setting == null ?
ResultUtil.data(new PointSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), PointSetting.class));
case QQ_CONNECT:
return setting == null ?
ResultUtil.data(new QQConnectSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), QQConnectSetting.class));
case CONNECT_SETTING:
return setting == null ?
ResultUtil.data(new ConnectSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), ConnectSetting.class));
case PAYMENT_SUPPORT:
return setting == null ?
ResultUtil.data(new PaymentSupportSetting(new PaymentSupportForm())) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), PaymentSupportSetting.class));
case ALIPAY_PAYMENT:
return setting == null ?
ResultUtil.data(new AlipayPaymentSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), AlipayPaymentSetting.class));
case UNIONPAY_PAYMENT:
return setting == null ?
ResultUtil.data(new UnionPaymentSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), UnionPaymentSetting.class));
case WECHAT_CONNECT:
return setting == null ?
ResultUtil.data(new WechatConnectSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), WechatConnectSetting.class));
case WECHAT_PAYMENT:
return setting == null ?
ResultUtil.data(new WechatPaymentSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), WechatPaymentSetting.class));
case SECKILL_SETTING:
return setting == null ?
ResultUtil.data(new SeckillSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), SeckillSetting.class));
case EXPERIENCE_SETTING:
return setting == null ?
ResultUtil.data(new ExperienceSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), ExperienceSetting.class));
case IM_SETTING:
return setting == null ?
ResultUtil.data(new ImSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), ImSetting.class));
case HOT_WORDS:
return setting == null ?
ResultUtil.data(new HotWordsSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), HotWordsSetting.class));
case DELIVERY_SETTING:
return setting == null ?
ResultUtil.data(new DeliverySetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), DeliverySetting.class));
default:
throw new ServiceException(ResultCode.SETTING_NOT_TO_SET);
}
}
}

View File

@@ -288,7 +288,7 @@ lili:
after-sale-topic: shop_lili_after_sale_topic
after-sale-group: shop_lili_after_sale_group
rocketmq:
name-server: 192.168.31.100:30876
name-server: 192.168.31.100:9876
isVIPChannel: false
producer:
group: lili_group

View File

@@ -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, "请配置发货参数"),
/**
* 站内信

View File

@@ -28,13 +28,6 @@ public interface GoodsService extends IService<Goods> {
*/
List<Goods> getByBrandIds(List<String> brandIds);
/**
* 下架所有商家商品
*
* @param storeId 店铺ID
*/
void underStoreGoods(String storeId);
/**
* 更新商品参数
*
@@ -113,16 +106,6 @@ public interface GoodsService extends IService<Goods> {
Boolean updateGoodsMarketAble(List<String> goodsIds, GoodsStatusEnum goodsStatusEnum, String underReason);
/**
* 更新商品上架状态状态
*
* @param storeId 店铺ID
* @param goodsStatusEnum 更新的商品状态
* @param underReason 下架原因
* @return 更新结果
*/
Boolean updateGoodsMarketAbleByStoreId(String storeId, GoodsStatusEnum goodsStatusEnum, String underReason);
/**
* 更新商品上架状态状态
*
@@ -177,12 +160,6 @@ public interface GoodsService extends IService<Goods> {
* @param store
*/
void updateStoreDetail(Store store);
/**
* 统计店铺的商品数量
* @param storeId 店铺id
* @return
*/
long countStoreGoodsNum(String storeId);
/**
* 同步商品分类名称

View File

@@ -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());
}

View File

@@ -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;
@@ -128,19 +129,6 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
return list(lambdaQueryWrapper);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void underStoreGoods(String storeId) {
//获取商品ID列表
List<String> list = this.baseMapper.getGoodsIdByStoreId(storeId);
//下架店铺下的商品
this.updateGoodsMarketAbleByStoreId(storeId, GoodsStatusEnum.DOWN, "店铺关闭");
applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("下架商品",
rocketmqCustomProperties.getGoodsTopic(), GoodsTagsEnum.DOWN.name(), JSONUtil.toJsonStr(list)));
}
/**
* 更新商品参数
*
@@ -339,29 +327,6 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
return result;
}
/**
* 更新商品上架状态状态
*
* @param storeId 店铺ID
* @param goodsStatusEnum 更新的商品状态
* @param underReason 下架原因
* @return 更新结果
*/
@Override
@SystemLogPoint(description = "店铺关闭下架商品", customerLog = "'操作类型:['+#goodsStatusEnum+'],操作对象:['+#storeId+'],操作原因:['+#underReason+']'")
public Boolean updateGoodsMarketAbleByStoreId(String storeId, GoodsStatusEnum goodsStatusEnum, String underReason) {
LambdaUpdateWrapper<Goods> updateWrapper = this.getUpdateWrapperByStoreAuthority();
updateWrapper.set(Goods::getMarketEnable, goodsStatusEnum.name());
updateWrapper.set(Goods::getUnderMessage, underReason);
updateWrapper.eq(Goods::getStoreId, storeId);
boolean result = this.update(updateWrapper);
//修改规格商品
this.goodsSkuService.updateGoodsSkuStatusByStoreId(storeId, goodsStatusEnum.name(), null);
return result;
}
@Override
@SystemLogPoint(description = "管理员关闭下架商品", customerLog = "'操作类型:['+#goodsStatusEnum+'],操作对象:['+#goodsIds+'],操作原因:['+#underReason+']'")
@@ -429,7 +394,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
if (freightTemplate == null) {
throw new ServiceException(ResultCode.FREIGHT_TEMPLATE_NOT_EXIST);
}
if (authUser != null && !freightTemplate.getStoreId().equals(authUser.getStoreId())) {
if (authUser != null) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
}
LambdaUpdateWrapper<Goods> lambdaUpdateWrapper = Wrappers.lambdaUpdate();
@@ -516,16 +481,6 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
goodsSkuService.update(updateWrapper);
}
@Override
public long countStoreGoodsNum(String storeId) {
return this.count(
new LambdaQueryWrapper<Goods>()
.eq(Goods::getStoreId, storeId)
.eq(Goods::getDeleteFlag, Boolean.FALSE)
.eq(Goods::getAuthFlag, GoodsAuthEnum.PASS.name())
.eq(Goods::getMarketEnable, GoodsStatusEnum.UPPER.name()));
}
@Override
public void categoryGoodsName(String categoryId) {
//获取分类下的商品
@@ -663,20 +618,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);
}
/**
@@ -704,7 +653,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
LambdaUpdateWrapper<Goods> updateWrapper = new LambdaUpdateWrapper<>();
AuthUser authUser = this.checkStoreAuthority();
if (authUser != null) {
updateWrapper.eq(Goods::getStoreId, authUser.getStoreId());
updateWrapper.eq(Goods::getStoreId, "-1");
}
return updateWrapper;
}
@@ -718,7 +667,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
private AuthUser checkStoreAuthority() {
AuthUser currentUser = UserContext.getCurrentUser();
//如果当前会员不为空,且为店铺角色
if (currentUser != null && (currentUser.getRole().equals(UserEnums.STORE) && currentUser.getStoreId() != null)) {
if (currentUser != null) {
return currentUser;
}
return null;
@@ -748,7 +697,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
LambdaQueryWrapper<Goods> queryWrapper = new LambdaQueryWrapper<>();
AuthUser authUser = this.checkStoreAuthority();
if (authUser != null) {
queryWrapper.eq(Goods::getStoreId, authUser.getStoreId());
queryWrapper.eq(Goods::getStoreId, "-1");
}
return queryWrapper;
}

View File

@@ -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': {" +

View File

@@ -118,7 +118,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
public Member getUserInfo() {
AuthUser tokenUser = UserContext.getCurrentUser();
if (tokenUser != null) {
return this.findByUsername(tokenUser.getUsername());
Member member = this.findByUsername(tokenUser.getUsername());
if(member != null && member.getDisabled()){
throw new ServiceException(ResultCode.USER_STATUS_ERROR);
}
return member;
}
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
}

View File

@@ -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());
//检测是否可以发布促销商品

View File

@@ -34,7 +34,7 @@ public interface FreightTemplateService extends IService<FreightTemplate> {
* @param storeId
* @return 运费模板列表
*/
List<FreightTemplateVO> getFreightTemplateList(String storeId);
List<FreightTemplateVO> getFreightTemplateList();
/**
* 获取运费模板详细信息

View File

@@ -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;

View File

@@ -241,10 +241,6 @@ public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements
storeLambdaUpdateWrapper.eq(Store::getId, id);
storeLambdaUpdateWrapper.set(Store::getStoreDisable, StoreStatusEnum.CLOSED.value());
boolean update = this.update(storeLambdaUpdateWrapper);
//下架所有此店铺商品
if (update) {
goodsService.underStoreGoods(id);
}
//删除店员token
clerkService.list(new LambdaQueryWrapper<Clerk>().eq(Clerk::getStoreId, id)).forEach(clerk -> {

View File

@@ -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,29 @@ 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;
}

View File

@@ -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;
}

View File

@@ -15,8 +15,14 @@ import java.io.Serializable;
public class ImSetting implements Serializable {
@ApiModelProperty(value = "平台地址")
private String httpUrl;
@ApiModelProperty(value = "地址")
private String url;
@ApiModelProperty(value = "企业Id")
private String companyId;
@ApiModelProperty(value = "二维码")
private String qrCode;
}

View File

@@ -0,0 +1,25 @@
package cn.lili.modules.system.entity.dto;
import cn.lili.common.vo.PageVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author chc
* @since 2022/6/2114:46
*/
@Data
public class LogisticsSearchParams extends PageVO {
@ApiModelProperty(value = "支持电子面单")
private Boolean standBy;
public <T> QueryWrapper<T> queryWrapper() {
QueryWrapper<T> wrapper = new QueryWrapper<>();
if(standBy != null){
wrapper.eq("standBy",standBy);
}
return wrapper;
}
}

View File

@@ -52,5 +52,7 @@ public enum SettingEnum {
//银联支付设置
UNIONPAY_PAYMENT,
//热词设置
HOT_WORDS
HOT_WORDS,
//发货设置
DELIVERY_SETTING,
}

View File

@@ -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 {

View File

@@ -1,17 +1,22 @@
package cn.lili.controller.distribution;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.distribution.entity.dos.DistributionGoods;
import cn.lili.modules.distribution.entity.dto.DistributionGoodsSearchParams;
import cn.lili.modules.distribution.entity.vos.DistributionGoodsVO;
import cn.lili.modules.distribution.service.DistributionGoodsService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Objects;
/**
* 管理端,分销商品管理接口
@@ -41,4 +46,13 @@ public class DistributionGoodsManagerController {
distributionGoodsService.removeByIds(ids);
return ResultUtil.success();
}
@ApiOperation(value = "选择商品参与分销")
@ApiImplicitParam(name = "skuId", value = "规格ID", required = true, dataType = "String", paramType = "path")
@PutMapping(value = "/checked/{skuId}")
public ResultMessage<DistributionGoods> distributionCheckGoods(@NotNull(message = "规格ID不能为空") @PathVariable String skuId,
@NotNull(message = "佣金金额不能为空") @RequestParam Double commission) {
return ResultUtil.data(distributionGoodsService.checked(skuId, commission, "-1"));
}
}

View File

@@ -7,7 +7,9 @@ import cn.lili.common.exception.ServiceException;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.Category;
import cn.lili.modules.goods.entity.dto.CategorySearchParams;
import cn.lili.modules.goods.entity.vos.CategoryBrandVO;
import cn.lili.modules.goods.entity.vos.CategoryVO;
import cn.lili.modules.goods.service.CategoryBrandService;
import cn.lili.modules.goods.service.CategoryService;
import cn.lili.modules.goods.service.GoodsService;
import io.swagger.annotations.Api;
@@ -46,6 +48,12 @@ public class CategoryManagerController {
@Autowired
private GoodsService goodsService;
/**
* 分类品牌
*/
@Autowired
private CategoryBrandService categoryBrandService;
@ApiOperation(value = "查询某分类下的全部子分类列表")
@ApiImplicitParam(name = "parentId", value = "父id顶级为0", required = true, dataType = "String", paramType = "path")
@GetMapping(value = "/{parentId}/all-children")
@@ -129,4 +137,13 @@ public class CategoryManagerController {
return ResultUtil.success();
}
@ApiOperation(value = "获取所选分类关联的品牌信息")
@GetMapping(value = "/{categoryId}/brands")
@ApiImplicitParams({
@ApiImplicitParam(name = "categoryId", value = "分类id", required = true, paramType = "path"),
})
public List<CategoryBrandVO> queryBrands(@PathVariable String categoryId) {
return this.categoryBrandService.getCategoryBrandList(categoryId);
}
}

View File

@@ -0,0 +1,65 @@
package cn.lili.controller.goods;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.DraftGoods;
import cn.lili.modules.goods.entity.dto.DraftGoodsDTO;
import cn.lili.modules.goods.entity.dto.DraftGoodsSearchParams;
import cn.lili.modules.goods.entity.vos.DraftGoodsVO;
import cn.lili.modules.goods.service.DraftGoodsService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* 管理端,草稿商品接口
*
* @author paulG
* @since 2021/2/20 2:26 下午
*/
@RestController
@Api(tags = "管理端,草稿商品接口")
@RequestMapping("/manager/goods/draftGoods")
public class DraftGoodsManagerController {
@Autowired
private DraftGoodsService draftGoodsService;
@ApiOperation(value = "分页获取草稿商品列表")
@GetMapping(value = "/page")
public ResultMessage<IPage<DraftGoods>> getDraftGoodsByPage(DraftGoodsSearchParams searchParams) {
searchParams.setStoreId("-1");
return ResultUtil.data(draftGoodsService.getDraftGoods(searchParams));
}
@ApiOperation(value = "获取草稿商品")
@GetMapping(value = "/{id}")
public ResultMessage<DraftGoodsVO> getDraftGoods(@PathVariable String id) {
DraftGoodsVO draftGoods = OperationalJudgment.judgment(draftGoodsService.getDraftGoods(id));
return ResultUtil.data(draftGoods);
}
@ApiOperation(value = "保存草稿商品")
@PostMapping(value = "/save", consumes = "application/json", produces = "application/json")
public ResultMessage<String> saveDraftGoods(@RequestBody DraftGoodsDTO draftGoodsVO) {
draftGoodsVO.setStoreId("-1");
draftGoodsService.saveGoodsDraft(draftGoodsVO);
return ResultUtil.success();
}
@ApiOperation(value = "删除草稿商品")
@DeleteMapping(value = "/{id}")
public ResultMessage<String> deleteDraftGoods(@PathVariable String id) {
draftGoodsService.deleteGoodsDraft(id);
return ResultUtil.success();
}
}

View File

@@ -5,15 +5,19 @@ import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.dto.GoodsOperationDTO;
import cn.lili.modules.goods.entity.dto.GoodsSearchParams;
import cn.lili.modules.goods.entity.dto.GoodsSkuStockDTO;
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
import cn.lili.modules.goods.entity.vos.GoodsVO;
import cn.lili.modules.goods.service.GoodsService;
import cn.lili.modules.goods.service.GoodsSkuService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -22,9 +26,12 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 管理端,商品管理接口
@@ -119,4 +126,52 @@ public class GoodsManagerController {
return ResultUtil.data(goods);
}
@ApiOperation(value = "新增商品")
@PostMapping(value = "/create", consumes = "application/json", produces = "application/json")
public ResultMessage<GoodsOperationDTO> save(@Valid @RequestBody GoodsOperationDTO goodsOperationDTO) {
goodsService.addGoods(goodsOperationDTO);
return ResultUtil.success();
}
@ApiOperation(value = "修改商品")
@PutMapping(value = "/update/{goodsId}", consumes = "application/json", produces = "application/json")
public ResultMessage<GoodsOperationDTO> update(@Valid @RequestBody GoodsOperationDTO goodsOperationDTO, @PathVariable String goodsId) {
goodsService.editGoods(goodsOperationDTO, goodsId);
return ResultUtil.success();
}
@ApiOperation(value = "修改商品库存")
@PutMapping(value = "/update/stocks", consumes = "application/json")
public ResultMessage<Object> updateStocks(@RequestBody List<GoodsSkuStockDTO> updateStockList) {
// 获取商品skuId集合
List<String> goodsSkuIds = updateStockList.stream().map(GoodsSkuStockDTO::getSkuId).collect(Collectors.toList());
// 根据skuId集合查询商品信息
List<GoodsSku> goodsSkuList = goodsSkuService.list(new LambdaQueryWrapper<GoodsSku>().in(GoodsSku::getId, goodsSkuIds));
// 过滤不符合当前店铺的商品
List<String> filterGoodsSkuIds = goodsSkuList.stream().map(GoodsSku::getId).collect(Collectors.toList());
List<GoodsSkuStockDTO> collect = updateStockList.stream().filter(i -> filterGoodsSkuIds.contains(i.getSkuId())).collect(Collectors.toList());
goodsSkuService.updateStocks(collect);
return ResultUtil.success();
}
@DemoSite
@ApiOperation(value = "删除商品")
@PutMapping(value = "/delete")
@ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "query", allowMultiple = true)
public ResultMessage<Object> deleteGoods(@RequestParam List<String> goodsId) {
goodsService.deleteGoods(goodsId);
return ResultUtil.success();
}
@ApiOperation(value = "设置商品运费模板")
@PutMapping(value = "/freight")
@ApiImplicitParams({
@ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "query", allowMultiple = true),
@ApiImplicitParam(name = "templateId", value = "运费模板ID", required = true, paramType = "query")
})
public ResultMessage<Object> freight(@RequestParam List<String> goodsId, @RequestParam String templateId) {
goodsService.freight(goodsId, templateId);
return ResultUtil.success();
}
}

View File

@@ -6,6 +6,7 @@ import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.Specification;
import cn.lili.modules.goods.service.CategorySpecificationService;
import cn.lili.modules.goods.service.SpecificationService;
import cn.lili.mybatis.util.PageUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -34,6 +35,9 @@ public class SpecificationManagerController {
@Autowired
private SpecificationService specificationService;
@Autowired
private CategorySpecificationService categorySpecificationService;
@GetMapping("/all")
@ApiOperation(value = "获取所有可用规格")
@@ -56,6 +60,12 @@ public class SpecificationManagerController {
return ResultUtil.success();
}
@GetMapping(value = "/{categoryId}")
@ApiOperation(value = "获取分类规格")
public List<Specification> getSpecifications(@PathVariable String categoryId) {
return categorySpecificationService.getCategorySpecList(categoryId);
}
@PutMapping("/{id}")
@ApiOperation(value = "更改规格")
public ResultMessage<Object> update(@Valid Specification specification, @PathVariable String id) {

View File

@@ -2,6 +2,7 @@ package cn.lili.controller.member;
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.entity.dto.EvaluationQueryParams;
@@ -67,4 +68,17 @@ public class MemberEvaluationManagerController {
return ResultUtil.success();
}
@ApiOperation(value = "回复评价")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "评价ID", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "reply", value = "回复内容", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "replyImage", value = "回复图片", dataType = "String", paramType = "query")
})
@PutMapping(value = "/reply/{id}")
public ResultMessage<MemberEvaluationVO> reply(@PathVariable String id, @RequestParam String reply, @RequestParam String replyImage) {
OperationalJudgment.judgment(memberEvaluationService.queryById(id));
memberEvaluationService.reply(id, reply, replyImage);
return ResultUtil.success();
}
}

View File

@@ -99,4 +99,19 @@ public class AfterSaleManagerController {
public ResultMessage<StoreAfterSaleAddressDTO> getStoreAfterSaleAddress(@NotNull(message = "售后单号") @PathVariable("sn") String sn) {
return ResultUtil.data(afterSaleService.getStoreAfterSaleAddressDTO(sn));
}
@PreventDuplicateSubmissions
@ApiOperation(value = "卖家确认收货")
@ApiImplicitParams({
@ApiImplicitParam(name = "afterSaleSn", value = "售后sn", required = true, paramType = "path"),
@ApiImplicitParam(name = "serviceStatus", value = "PASS审核通过REFUSE审核未通过", required = true, paramType = "query"),
@ApiImplicitParam(name = "remark", value = "备注", paramType = "query")
})
@PutMapping(value = "/confirm/{afterSaleSn}")
public ResultMessage<AfterSale> confirm(@NotNull(message = "请选择售后单") @PathVariable String afterSaleSn,
@NotNull(message = "请审核") String serviceStatus,
String remark) {
return ResultUtil.data(afterSaleService.storeConfirm(afterSaleSn, serviceStatus, remark));
}
}

View File

@@ -11,10 +11,13 @@ import cn.lili.modules.member.entity.dto.MemberAddressDTO;
import cn.lili.modules.order.order.entity.dos.Order;
import cn.lili.modules.order.order.entity.dto.OrderExportDTO;
import cn.lili.modules.order.order.entity.dto.OrderSearchParams;
import cn.lili.modules.order.order.entity.dto.PartDeliveryParamsDTO;
import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
import cn.lili.modules.order.order.service.OrderPackageService;
import cn.lili.modules.order.order.service.OrderPriceService;
import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.system.service.LogisticsService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
@@ -49,6 +52,15 @@ public class OrderManagerController {
@Autowired
private OrderPriceService orderPriceService;
@Autowired
private OrderPackageService orderPackageService;
/**
* 快递
*/
@Autowired
private LogisticsService logisticsService;
@ApiOperation(value = "查询订单列表分页")
@GetMapping
@@ -134,4 +146,64 @@ public class OrderManagerController {
orderService.updateSellerRemark(orderSn, sellerRemark);
return ResultUtil.success();
}
@ApiOperation(value = "订单包裹发货")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderSn", value = "订单sn", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "logisticsNo", value = "发货单号", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "logisticsId", value = "物流公司", required = true, dataType = "String", paramType = "query")
})
@PostMapping(value = "/{orderSn}/partDelivery")
public ResultMessage<Object> delivery(@RequestBody PartDeliveryParamsDTO partDeliveryParamsDTO) {
return ResultUtil.data(orderService.partDelivery(partDeliveryParamsDTO));
}
@ApiOperation(value = "查看包裹列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
})
@GetMapping(value = "/getPackage/{orderSn}")
public ResultMessage<Object> getPackage(@NotBlank(message = "订单编号不能为空") @PathVariable String orderSn) {
return ResultUtil.data(orderPackageService.getOrderPackageVOList(orderSn));
}
@PreventDuplicateSubmissions
@ApiOperation(value = "创建电子面单")
@PostMapping(value = "/{orderSn}/createElectronicsFaceSheet")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderSn", value = "订单号", required = true, paramType = "path"),
@ApiImplicitParam(name = "logisticsId", value = "物流公司", required = true, dataType = "String", paramType = "query")
})
public ResultMessage<Object> createElectronicsFaceSheet(@NotNull(message = "参数非法") @PathVariable String orderSn,
@NotNull(message = "请选择物流公司") String logisticsId) {
return ResultUtil.data(logisticsService.labelOrder(orderSn, logisticsId));
}
@PreventDuplicateSubmissions
@ApiOperation(value = "订单核验")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderSn", value = "订单号", required = true, paramType = "path"),
@ApiImplicitParam(name = "verificationCode", value = "核验码", required = true, paramType = "path")
})
@PutMapping(value = "/take/{orderSn}/{verificationCode}")
public ResultMessage<Object> take(@PathVariable String orderSn, @PathVariable String verificationCode) {
return ResultUtil.data(orderService.take(orderSn, verificationCode));
}
@PreventDuplicateSubmissions
@ApiOperation(value = "订单核验")
@ApiImplicitParams({
@ApiImplicitParam(name = "verificationCode", value = "核验码", required = true, paramType = "path")
})
@PutMapping(value = "/take/{verificationCode}")
public ResultMessage<Object> take(@PathVariable String verificationCode) {
return ResultUtil.data(orderService.take(verificationCode));
}
@ApiOperation(value = "根据核验码获取订单信息")
@ApiImplicitParam(name = "verificationCode", value = "核验码", required = true, paramType = "path")
@GetMapping(value = "/getOrderByVerificationCode/{verificationCode}")
public ResultMessage<Object> getOrderByVerificationCode(@PathVariable String verificationCode) {
return ResultUtil.data(orderService.getOrderByVerificationCode(verificationCode));
}
}

View File

@@ -1,9 +1,9 @@
package cn.lili.controller.other;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.system.entity.dos.Logistics;
import cn.lili.modules.system.entity.dto.LogisticsSearchParams;
import cn.lili.modules.system.service.LogisticsService;
import cn.lili.mybatis.util.PageUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -37,8 +37,8 @@ public class LogisticsManagerController {
@ApiOperation(value = "分页获取物流公司")
@GetMapping(value = "/getByPage")
public ResultMessage<IPage<Logistics>> getByPage(PageVO page) {
return ResultUtil.data(logisticsService.page(PageUtil.initPage(page)));
public ResultMessage<IPage<Logistics>> getByPage(LogisticsSearchParams page) {
return ResultUtil.data(logisticsService.page(PageUtil.initPage(page),page.queryWrapper()));
}
@ApiOperation(value = "编辑物流公司")

View File

@@ -2,6 +2,9 @@ package cn.lili.controller.promotion;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.AuthUser;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.cart.entity.vo.FullDiscountVO;
@@ -17,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.Objects;
/**
* 管理端,满额活动接口
@@ -56,4 +60,37 @@ public class FullDiscountManagerController {
}
return ResultUtil.error(ResultCode.ERROR);
}
@ApiOperation(value = "新增满优惠活动")
@PostMapping(consumes = "application/json", produces = "application/json")
public ResultMessage<FullDiscount> addFullDiscount(@RequestBody FullDiscountVO fullDiscountVO) {
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
fullDiscountVO.setStoreId("-1");
// fullDiscountVO.setStoreName(currentUser.getStoreName());
if (!fullDiscountService.savePromotions(fullDiscountVO)) {
return ResultUtil.error(ResultCode.PINTUAN_ADD_ERROR);
}
return ResultUtil.data(fullDiscountVO);
}
@ApiOperation(value = "修改满优惠活动")
@PutMapping(consumes = "application/json", produces = "application/json")
public ResultMessage<String> editFullDiscount(@RequestBody FullDiscountVO fullDiscountVO) {
OperationalJudgment.judgment(fullDiscountService.getFullDiscount(fullDiscountVO.getId()));
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
fullDiscountVO.setStoreId(currentUser.getStoreId());
fullDiscountVO.setStoreName(currentUser.getStoreName());
if (!fullDiscountService.updatePromotions(fullDiscountVO)) {
return ResultUtil.error(ResultCode.PINTUAN_EDIT_ERROR);
}
return ResultUtil.success(ResultCode.FULL_DISCOUNT_EDIT_SUCCESS);
}
@ApiOperation(value = "删除满优惠活动")
@DeleteMapping("/{id}")
public ResultMessage<String> deleteFullDiscount(@PathVariable String id) {
OperationalJudgment.judgment(fullDiscountService.getById(id));
fullDiscountService.removePromotions(Collections.singletonList(id));
return ResultUtil.success(ResultCode.FULL_DISCOUNT_EDIT_DELETE);
}
}

View File

@@ -1,9 +1,13 @@
package cn.lili.controller.promotion;
import cn.hutool.core.util.ArrayUtil;
import cn.lili.common.enums.PromotionTypeEnum;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.AuthUser;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.promotion.entity.dos.Pintuan;
@@ -17,9 +21,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 管理端,平台拼团接口
@@ -69,4 +78,45 @@ public class PintuanManagerController {
}
@DeleteMapping("/{pintuanId}")
@ApiOperation(value = "手动删除拼团活动")
public ResultMessage<String> deletePintuan(@PathVariable String pintuanId) {
OperationalJudgment.judgment(pintuanService.getById(pintuanId));
if (pintuanService.removePromotions(Collections.singletonList(pintuanId))) {
return ResultUtil.success(ResultCode.PINTUAN_DELETE_SUCCESS);
}
throw new ServiceException(ResultCode.PINTUAN_DELETE_ERROR);
}
@PostMapping(consumes = "application/json", produces = "application/json")
@ApiOperation(value = "添加拼团活动")
public ResultMessage<String> addPintuan(@RequestBody @Validated PintuanVO pintuan) {
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
pintuan.setStoreId(currentUser.getStoreId());
pintuan.setStoreName(currentUser.getStoreName());
if (pintuanService.savePromotions(pintuan)) {
return ResultUtil.success(ResultCode.PINTUAN_ADD_SUCCESS);
}
throw new ServiceException(ResultCode.PINTUAN_ADD_ERROR);
}
@PutMapping(consumes = "application/json", produces = "application/json")
@ApiOperation(value = "修改拼团活动")
public ResultMessage<String> editPintuan(@RequestBody @Validated PintuanVO pintuan) {
OperationalJudgment.judgment(pintuanService.getById(pintuan.getId()));
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
pintuan.setStoreId(currentUser.getStoreId());
pintuan.setStoreName(currentUser.getStoreName());
if (pintuan.getPromotionGoodsList() != null && !pintuan.getPromotionGoodsList().isEmpty()) {
List<String> skuIds = pintuan.getPromotionGoodsList().stream().map(PromotionGoods::getSkuId).collect(Collectors.toList());
pintuan.setScopeId(ArrayUtil.join(skuIds.toArray(), ","));
} else {
pintuan.setScopeId(null);
}
if (pintuanService.updatePromotions(pintuan)) {
return ResultUtil.success(ResultCode.PINTUAN_EDIT_SUCCESS);
}
throw new ServiceException(ResultCode.PINTUAN_EDIT_ERROR);
}
}

View File

@@ -1,11 +1,14 @@
package cn.lili.controller.promotion;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.promotion.entity.dos.Seckill;
import cn.lili.modules.promotion.entity.dos.SeckillApply;
import cn.lili.modules.promotion.entity.dto.search.SeckillSearchParams;
import cn.lili.modules.promotion.entity.vos.SeckillApplyVO;
import cn.lili.modules.promotion.entity.vos.SeckillVO;
import cn.lili.modules.promotion.service.SeckillApplyService;
import cn.lili.modules.promotion.service.SeckillService;
@@ -17,6 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* 管理端,秒杀活动接口
@@ -92,5 +97,11 @@ public class SeckillManagerController {
return ResultUtil.success();
}
@PostMapping(path = "/apply/{seckillId}", consumes = "application/json", produces = "application/json")
@ApiOperation(value = "添加秒杀活动申请")
public ResultMessage<String> addSeckillApply(@PathVariable String seckillId, @RequestBody List<SeckillApplyVO> applyVos) {
seckillApplyService.addSeckillApply(seckillId, "-1", applyVos);
return ResultUtil.success();
}
}

View File

@@ -0,0 +1,69 @@
package cn.lili.controller.setting;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.store.entity.vos.FreightTemplateVO;
import cn.lili.modules.store.service.FreightTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Objects;
/**
* 店铺端,运费模板接口
*
* @author paulG
* @since 2020/8/26
**/
@RestController
@Api(tags = "店铺端,运费模板接口")
@RequestMapping("/manager/setting/freightTemplate")
public class FreightTemplateManagerController {
@Autowired
private FreightTemplateService freightTemplateService;
@ApiOperation(value = "运费模板列表")
@GetMapping
public ResultMessage<List<FreightTemplateVO>> list() {
return ResultUtil.data(freightTemplateService.getFreightTemplateList());
}
@ApiOperation(value = "获取运费模板详情")
@ApiImplicitParam(name = "id", value = "模板ID", required = true, paramType = "path")
@GetMapping("/{id}")
public ResultMessage<FreightTemplateVO> list(@PathVariable String id) {
FreightTemplateVO freightTemplate = OperationalJudgment.judgment(freightTemplateService.getFreightTemplate(id));
return ResultUtil.data(freightTemplate);
}
@ApiOperation(value = "添加运费模板")
@PostMapping
public ResultMessage<FreightTemplateVO> add(@Valid @RequestBody FreightTemplateVO freightTemplateVO) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
freightTemplateVO.setStoreId(storeId);
return ResultUtil.data(freightTemplateService.addFreightTemplate(freightTemplateVO));
}
@ApiOperation(value = "修改运费模板")
@PutMapping("/{id}")
public ResultMessage<FreightTemplateVO> edit(@PathVariable String id, @RequestBody @Valid FreightTemplateVO freightTemplateVO) {
OperationalJudgment.judgment(freightTemplateService.getFreightTemplate(id));
return ResultUtil.data(freightTemplateService.editFreightTemplate(freightTemplateVO));
}
@ApiOperation(value = "删除运费模板")
@ApiImplicitParam(name = "id", value = "模板ID", required = true, paramType = "path")
@DeleteMapping("/{id}")
public ResultMessage<Object> edit(@PathVariable String id) {
OperationalJudgment.judgment(freightTemplateService.getFreightTemplate(id));
freightTemplateService.removeFreightTemplate(id);
return ResultUtil.success();
}
}

View File

@@ -205,6 +205,10 @@ public class SettingManagerController {
return setting == null ?
ResultUtil.data(new HotWordsSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), HotWordsSetting.class));
case DELIVERY_SETTING:
return setting == null ?
ResultUtil.data(new DeliverySetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), DeliverySetting.class));
default:
throw new ServiceException(ResultCode.SETTING_NOT_TO_SET);
}

View File

@@ -0,0 +1,80 @@
package cn.lili.controller.store;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.store.entity.dos.StoreAddress;
import cn.lili.modules.store.service.StoreAddressService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Objects;
/**
* 店铺端,商家地址(自提点)接口
*
* @author Bulbasaur
* @since 2020/11/22 14:23
*/
@RestController
@Api(tags = "商家端,地址(自提点)接口")
@RequestMapping("/manager/store/member/storeAddress")
public class StoreAddressController {
/**
* 店铺自提点
*/
@Autowired
private StoreAddressService storeAddressService;
@ApiOperation(value = "获取商家自提点分页")
@GetMapping
public ResultMessage<IPage<StoreAddress>> get(PageVO pageVo) {
return ResultUtil.data(storeAddressService.getStoreAddress("-1", pageVo));
}
@ApiOperation(value = "获取商家自提点信息")
@ApiImplicitParam(name = "id", value = "自提点ID", required = true, paramType = "path")
@GetMapping("/{id}")
public ResultMessage<StoreAddress> get(@PathVariable String id) {
StoreAddress address = OperationalJudgment.judgment(storeAddressService.getById(id));
return ResultUtil.data(address);
}
@ApiOperation(value = "添加")
@PostMapping
public ResultMessage<StoreAddress> add(@Valid StoreAddress storeAddress) {
storeAddress.setStoreId("-1");
storeAddressService.save(storeAddress);
return ResultUtil.data(storeAddress);
}
@ApiOperation(value = "编辑")
@ApiImplicitParam(name = "id", value = "自提点ID", required = true, paramType = "path")
@PutMapping("/{id}")
public ResultMessage<StoreAddress> edit(@PathVariable String id, @Valid StoreAddress storeAddress) {
OperationalJudgment.judgment(storeAddressService.getById(id));
storeAddress.setId(id);
storeAddress.setStoreId("-1");
storeAddressService.updateById(storeAddress);
return ResultUtil.data(storeAddress);
}
@ApiOperation(value = "删除")
@ApiImplicitParam(name = "id", value = "自提点ID", required = true, paramType = "path")
@DeleteMapping(value = "/{id}")
public ResultMessage<Object> delByIds(@PathVariable String id) {
OperationalJudgment.judgment(storeAddressService.getById(id));
storeAddressService.removeStoreAddress(id);
return ResultUtil.success();
}
}

View File

@@ -33,7 +33,7 @@ public class FreightTemplateStoreController {
@GetMapping
public ResultMessage<List<FreightTemplateVO>> list() {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
return ResultUtil.data(freightTemplateService.getFreightTemplateList(storeId));
return ResultUtil.data(freightTemplateService.getFreightTemplateList());
}
@ApiOperation(value = "获取商家运费模板详情")