14 Commits
v4.4 ... 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
Chopper711
e89be8eb8c !358 优化 web-二维码登录 优化睡眠时间使用指数退避策略来延长每次轮询的时间间隔,减少CPU占用率
Merge pull request !358 from 铉清/N/A
2024-09-25 01:59:23 +00:00
铉清
3559971a8d 优化 web-二维码登录 优化睡眠时间使用指数退避策略来延长每次轮询的时间间隔,减少CPU占用率
Signed-off-by: 铉清 <13698617+xuanqings@user.noreply.gitee.com>
2024-09-21 16:17:53 +00:00
Chopper711
dc1d1a7e7e Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop 2024-09-18 15:40:02 +08:00
Chopper711
10ecce1e0d fix:修复代码与注释不匹配问题 2024-09-18 15:39:56 +08:00
chc
2520c27f77 Merge remote-tracking branch 'origin/master' 2024-09-18 15:16:35 +08:00
chc
63d684c972 订单增加部分发货状态。
部分发货无法申请售后
2024-09-18 15:16:28 +08:00
Chopper711
35739b64a3 fix: 部分字段重复问题处理 2024-09-18 14:20:13 +08:00
Chopper711
ddcda57a08 Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop 2024-09-18 12:24:16 +08:00
Chopper711
16ae69ed06 fix: 脚本问题导致限流脚本无效,不确定是否是版本升级带来的问题。 2024-09-18 12:24:11 +08:00
Chopper711
fd067d8abf update DB/version4.3toMASTER.sql.
缺少标点符号导致无法一次性执行 sql

Signed-off-by: Chopper711 <1814994716@qq.com>
2024-09-18 02:09:02 +00:00
pikachu1995@126.com
42b3c72977 微信小程序发货信息录入参数错误,短信发送使用系统后台配置的短信CODE 2024-09-14 16:11:05 +08:00
45 changed files with 890 additions and 186 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

@@ -68,8 +68,6 @@ CREATE TABLE `li_order_package_item` (
*/ */
ALTER TABLE li_order_item ADD `deliver_number` int DEFAULT NULL COMMENT '发货数量'; ALTER TABLE li_order_item ADD `deliver_number` int DEFAULT NULL COMMENT '发货数量';
ALTER TABLE li_goods_sku ADD `alert_quantity` int DEFAULT NULL COMMENT '预警库存';
/* /*
sku增加预警库存 sku增加预警库存
*/ */
@@ -105,7 +103,7 @@ WHERE
sf.flow_type = 'REFUND' sf.flow_type = 'REFUND'
AND sf.store_id=b.store_id AND sf.store_id=b.store_id
AND sf.create_time BETWEEN b.start_time AND sf.create_time BETWEEN b.start_time
AND b.end_time),0) AND b.end_time),0);
UPDATE li_bill b UPDATE li_bill b
SET b.kanjia_refund_settlement_price =IFNULL(( SET b.kanjia_refund_settlement_price =IFNULL((
@@ -119,20 +117,6 @@ SET b.kanjia_refund_settlement_price =IFNULL((
AND sf.create_time BETWEEN b.start_time AND sf.create_time BETWEEN b.start_time
AND b.end_time),0); AND b.end_time),0);
/**
*/
ALTER TABLE li_order_item ADD `is_refund` varchar(255) DEFAULT NULL COMMENT '是否退款';
/**
*/
ALTER TABLE li_order_item ADD `refund_price` decimal(10,2) 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

@@ -29,7 +29,7 @@ import org.springframework.web.context.request.async.DeferredResult;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* 买家端,会员接口 * 买家端,会员接口
@@ -73,6 +73,8 @@ public class MemberBuyerController {
new ResponseEntity<>(ResultUtil.error(ResultCode.ERROR), HttpStatus.OK); new ResponseEntity<>(ResultUtil.error(ResultCode.ERROR), HttpStatus.OK);
int timeoutSecond = 20; int timeoutSecond = 20;
DeferredResult<ResponseEntity<Object>> deferredResult = new DeferredResult<>(timeoutSecond * 1000L, timeoutResponseEntity); DeferredResult<ResponseEntity<Object>> deferredResult = new DeferredResult<>(timeoutSecond * 1000L, timeoutResponseEntity);
// 用于记录重试次数
AtomicInteger retryCount = new AtomicInteger(0);
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
try { try {
int i = 0; int i = 0;
@@ -83,7 +85,16 @@ public class MemberBuyerController {
&& (QRCodeLoginSessionStatusEnum.WAIT_SCANNING.getCode() == status && (QRCodeLoginSessionStatusEnum.WAIT_SCANNING.getCode() == status
|| QRCodeLoginSessionStatusEnum.SCANNING.getCode() == status)) { || QRCodeLoginSessionStatusEnum.SCANNING.getCode() == status)) {
//睡眠一秒种,继续等待结果 //睡眠一秒种,继续等待结果
TimeUnit.SECONDS.sleep(1); //TimeUnit.SECONDS.sleep(1);
// 应用指数退避策略
int baseSleepTime = 1000; // 基础退避时间(毫秒)
int maxSleepTime = 10000; // 最大退避时间(毫秒)
int sleepTime = Math.min(maxSleepTime, baseSleepTime * (1 + retryCount.getAndIncrement()));
int randomFactor = (int) (Math.random() * (sleepTime / 2)); // 随机化因子
TimeUnit.MILLISECONDS.sleep(sleepTime + randomFactor);
} else { } else {
deferredResult.setResult(new ResponseEntity<>(ResultUtil.data(queryResult), HttpStatus.OK)); deferredResult.setResult(new ResponseEntity<>(ResultUtil.data(queryResult), HttpStatus.OK));
break; break;

View File

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

View File

@@ -43,7 +43,7 @@ public class VerificationOrderExecute implements OrderStatusChangeEvent {
//修改虚拟订单货物可以进行售后、投诉 //修改虚拟订单货物可以进行售后、投诉
orderItemService.update(new LambdaUpdateWrapper<OrderItem>().eq(OrderItem::getOrderSn, orderMessage.getOrderSn()) orderItemService.update(new LambdaUpdateWrapper<OrderItem>().eq(OrderItem::getOrderSn, orderMessage.getOrderSn())
.set(OrderItem::getAfterSaleStatus, OrderItemAfterSaleStatusEnum.NOT_APPLIED) .set(OrderItem::getAfterSaleStatus, OrderItemAfterSaleStatusEnum.NOT_APPLIED)
.set(OrderItem::getComplainStatus, OrderComplaintStatusEnum.COMPLETE)); .set(OrderItem::getComplainStatus, OrderComplaintStatusEnum.NO_APPLY));
} }
} }

View File

@@ -464,6 +464,7 @@ public enum ResultCode {
ORDER_SETTING_ERROR(70006, "系统订单配置异常"), ORDER_SETTING_ERROR(70006, "系统订单配置异常"),
ALI_SMS_SETTING_ERROR(70007, "您还未配置阿里云短信"), ALI_SMS_SETTING_ERROR(70007, "您还未配置阿里云短信"),
SMS_SIGN_EXIST_ERROR(70008, "短信签名已存在"), 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); 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); 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 * @param store
*/ */
void updateStoreDetail(Store 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<>(); List<String> freightTemplateNameList = new ArrayList<>();
//循环列表存放ID-运费模板名称 //循环列表存放ID-运费模板名称
for (FreightTemplateVO freightTemplateVO : freightTemplateService.getFreightTemplateList(storeId)) { for (FreightTemplateVO freightTemplateVO : freightTemplateService.getFreightTemplateList()) {
freightTemplateNameList.add(freightTemplateVO.getId() + "-" + freightTemplateVO.getName()); 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.store.service.StoreService;
import cn.lili.modules.system.aspect.annotation.SystemLogPoint; import cn.lili.modules.system.aspect.annotation.SystemLogPoint;
import cn.lili.modules.system.entity.dos.Setting; 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.dto.GoodsSetting;
import cn.lili.modules.system.entity.enums.SettingEnum; import cn.lili.modules.system.entity.enums.SettingEnum;
import cn.lili.modules.system.service.SettingService; import cn.lili.modules.system.service.SettingService;
@@ -128,19 +129,6 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
return list(lambdaQueryWrapper); 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; 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 @Override
@SystemLogPoint(description = "管理员关闭下架商品", customerLog = "'操作类型:['+#goodsStatusEnum+'],操作对象:['+#goodsIds+'],操作原因:['+#underReason+']'") @SystemLogPoint(description = "管理员关闭下架商品", customerLog = "'操作类型:['+#goodsStatusEnum+'],操作对象:['+#goodsIds+'],操作原因:['+#underReason+']'")
@@ -429,7 +394,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
if (freightTemplate == null) { if (freightTemplate == null) {
throw new ServiceException(ResultCode.FREIGHT_TEMPLATE_NOT_EXIST); 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); throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
} }
LambdaUpdateWrapper<Goods> lambdaUpdateWrapper = Wrappers.lambdaUpdate(); LambdaUpdateWrapper<Goods> lambdaUpdateWrapper = Wrappers.lambdaUpdate();
@@ -516,16 +481,6 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
goodsSkuService.update(updateWrapper); 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 @Override
public void categoryGoodsName(String categoryId) { 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()); Setting setting = settingService.get(SettingEnum.GOODS_SETTING.name());
GoodsSetting goodsSetting = JSONUtil.toBean(setting.getSettingValue(), GoodsSetting.class); 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()); goods.setAuthFlag(Boolean.TRUE.equals(goodsSetting.getGoodsCheck()) ? GoodsAuthEnum.TOBEAUDITED.name() : GoodsAuthEnum.PASS.name());
//判断当前用户是否为店铺 //平台商品,默认处理
if (Objects.requireNonNull(UserContext.getCurrentUser()).getRole().equals(UserEnums.STORE)) { goods.setStoreId("-1");
StoreVO storeDetail = this.storeService.getStoreDetail(); goods.setStoreName(baseSettingValue.getSiteName());
if (storeDetail.getSelfOperated() != null) { goods.setSelfOperated(true);
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);
}
} }
/** /**
@@ -704,7 +653,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
LambdaUpdateWrapper<Goods> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<Goods> updateWrapper = new LambdaUpdateWrapper<>();
AuthUser authUser = this.checkStoreAuthority(); AuthUser authUser = this.checkStoreAuthority();
if (authUser != null) { if (authUser != null) {
updateWrapper.eq(Goods::getStoreId, authUser.getStoreId()); updateWrapper.eq(Goods::getStoreId, "-1");
} }
return updateWrapper; return updateWrapper;
} }
@@ -718,7 +667,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
private AuthUser checkStoreAuthority() { private AuthUser checkStoreAuthority() {
AuthUser currentUser = UserContext.getCurrentUser(); AuthUser currentUser = UserContext.getCurrentUser();
//如果当前会员不为空,且为店铺角色 //如果当前会员不为空,且为店铺角色
if (currentUser != null && (currentUser.getRole().equals(UserEnums.STORE) && currentUser.getStoreId() != null)) { if (currentUser != null) {
return currentUser; return currentUser;
} }
return null; return null;
@@ -748,7 +697,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
LambdaQueryWrapper<Goods> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Goods> queryWrapper = new LambdaQueryWrapper<>();
AuthUser authUser = this.checkStoreAuthority(); AuthUser authUser = this.checkStoreAuthority();
if (authUser != null) { if (authUser != null) {
queryWrapper.eq(Goods::getStoreId, authUser.getStoreId()); queryWrapper.eq(Goods::getStoreId, "-1");
} }
return queryWrapper; return queryWrapper;
} }

View File

@@ -1,6 +1,7 @@
package cn.lili.modules.logistics.plugin.kdniao; package cn.lili.modules.logistics.plugin.kdniao;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.json.JSONUtil;
import cn.lili.common.enums.ResultCode; import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException; import cn.lili.common.exception.ServiceException;
import cn.lili.modules.logistics.LogisticsPlugin; 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.dos.StoreLogistics;
import cn.lili.modules.store.entity.dto.StoreDeliverGoodsAddressDTO; import cn.lili.modules.store.entity.dto.StoreDeliverGoodsAddressDTO;
import cn.lili.modules.system.entity.dos.Logistics; 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.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.entity.vo.Traces;
import cn.lili.modules.system.service.SettingService;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -40,6 +46,9 @@ public class KdniaoPlugin implements LogisticsPlugin {
@Autowired @Autowired
private LogisticsSetting logisticsSetting; private LogisticsSetting logisticsSetting;
@Autowired
private SettingService settingService;
public KdniaoPlugin(LogisticsSetting logisticsSetting) { public KdniaoPlugin(LogisticsSetting logisticsSetting) {
this.logisticsSetting = logisticsSetting; this.logisticsSetting = logisticsSetting;
} }
@@ -124,31 +133,41 @@ public class KdniaoPlugin implements LogisticsPlugin {
//收件人地址 //收件人地址
String[] ConsigneeAddress = order.getConsigneeAddressPath().split(","); 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 = "{" + String resultDate = "{" +
"'OrderCode': '" + order.getSn() + "'," + //订单编码 "'OrderCode': '" + order.getSn() + "'," + //订单编码
"'ShipperCode': '" + logistics.getCode() + "'," + //快递公司编码 "'ShipperCode': '" + logistics.getCode() + "'," + //快递公司编码
"'CustomerName': '" + storeLogistics.getCustomerName() + "'," +//客户编码 "'CustomerName': '" + logistics.getCustomerName() + "'," +//客户编码
"'CustomerPwd': '" + storeLogistics.getCustomerPwd() + "'," + //客户密码 "'CustomerPwd': '" + logistics.getCustomerPwd() + "'," + //客户密码
"'MonthCode': '" + storeLogistics.getMonthCode() + "'," + //密钥 "'MonthCode': '" + logistics.getMonthCode() + "'," + //密钥
"'SendSite': '" + storeLogistics.getSendSite() + "'," + //归属网点 "'SendSite': '" + logistics.getSendSite() + "'," + //归属网点
"'SendStaff': '" + storeLogistics.getSendStaff() + "'," + //收件快递员 "'SendStaff': '" + logistics.getSendStaff() + "'," + //收件快递员
"'PayType': " + storeLogistics.getPayType() + "," + "'PayType': " + logistics.getPayType() + "," +
"'ExpType': " + storeLogistics.getExpType() + "," + "'ExpType': " + logistics.getExpType() + "," +
//发件人信息 //发件人信息
"'Sender': {" + "'Sender': {" +
"'Name': '" + storeDeliverGoodsAddressDTO.getSalesConsignorName() + "'," + "'Name': '" + deliverySetting.getSalesConsignorName() + "'," +
"'Mobile': '" + storeDeliverGoodsAddressDTO.getSalesConsignorMobile() + "'," + "'Mobile': '" + deliverySetting.getSalesConsignorMobile() + "'," +
"'ProvinceName': '" + consignorAddress[0] + "'," + //省 "'ProvinceName': '" + consignorAddress[0] + "'," + //省
"'CityName': '" + consignorAddress[1] + "'," + //市 "'CityName': '" + consignorAddress[1] + "'," + //市
"'ExpAreaName': '" + consignorAddress[2] + "'," + //区 "'ExpAreaName': '" + consignorAddress[2] + "'," + //区
"'Address': '" + storeDeliverGoodsAddressDTO.getSalesConsignorDetail() + "'" + //发件人详细地址 "'Address': '" + deliverySetting.getSalesConsignorDetail() + "'" + //发件人详细地址
"}," + "}," +
//收件人信息 //收件人信息
"'Receiver': {" + "'Receiver': {" +

View File

@@ -118,7 +118,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
public Member getUserInfo() { public Member getUserInfo() {
AuthUser tokenUser = UserContext.getCurrentUser(); AuthUser tokenUser = UserContext.getCurrentUser();
if (tokenUser != null) { 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); throw new ServiceException(ResultCode.USER_NOT_LOGIN);
} }

View File

@@ -12,6 +12,7 @@ public enum DeliverStatusEnum {
* 发货状态 * 发货状态
*/ */
UNDELIVERED("未发货"), UNDELIVERED("未发货"),
PARTS_DELIVERED("部分发货"),
DELIVERED("已发货"), DELIVERED("已发货"),
RECEIVED("已收货"); RECEIVED("已收货");

View File

@@ -14,6 +14,7 @@ public enum OrderStatusEnum {
UNPAID("未付款"), UNPAID("未付款"),
PAID("已付款"), PAID("已付款"),
UNDELIVERED("待发货"), UNDELIVERED("待发货"),
PARTS_DELIVERED("部分发货"),
DELIVERED("已发货"), DELIVERED("已发货"),
COMPLETED("已完成"), COMPLETED("已完成"),
STAY_PICKED_UP("待自提"), STAY_PICKED_UP("待自提"),

View File

@@ -73,18 +73,18 @@ public class AllowOperation implements Serializable {
//可编辑订单收件人信息=实物订单 && 订单未发货 && 订单未取消 && 订单不是自提 //可编辑订单收件人信息=实物订单 && 订单未发货 && 订单未取消 && 订单不是自提
this.editConsignee = order.getOrderType().equals(OrderTypeEnum.NORMAL.name()) this.editConsignee = order.getOrderType().equals(OrderTypeEnum.NORMAL.name())
&& order.getDeliverStatus().equals(DeliverStatusEnum.UNDELIVERED.name()) && (order.getDeliverStatus().equals(DeliverStatusEnum.UNDELIVERED.name()) || order.getDeliverStatus().equals(DeliverStatusEnum.PARTS_DELIVERED.name()))
&& !status.equals(OrderStatusEnum.CANCELLED.name()) && !status.equals(OrderStatusEnum.CANCELLED.name())
&& !order.getDeliveryMethod().equals(DeliveryMethodEnum.SELF_PICK_UP.name()); && !order.getDeliveryMethod().equals(DeliveryMethodEnum.SELF_PICK_UP.name());
//是否允许被发货 //是否允许被发货
this.ship = editConsignee && status.equals(OrderStatusEnum.UNDELIVERED.name()); this.ship = editConsignee && (status.equals(OrderStatusEnum.UNDELIVERED.name()) || order.getDeliverStatus().equals(DeliverStatusEnum.PARTS_DELIVERED.name()));
//是否允许被收货 //是否允许被收货
this.rog = status.equals(OrderStatusEnum.DELIVERED.name()); this.rog = status.equals(OrderStatusEnum.DELIVERED.name());
//是否允许查看物流信息 //是否允许查看物流信息
this.showLogistics = order.getDeliverStatus().equals(DeliverStatusEnum.DELIVERED.name()) && status.equals(OrderStatusEnum.DELIVERED.name()); this.showLogistics = (order.getDeliverStatus().equals(DeliverStatusEnum.DELIVERED.name()) || order.getDeliverStatus().equals(DeliverStatusEnum.PARTS_DELIVERED.name())) && (status.equals(OrderStatusEnum.DELIVERED.name()) || status.equals(OrderStatusEnum.PARTS_DELIVERED.name()));
//虚拟订单 或 自提订单可以核销 //虚拟订单 或 自提订单可以核销
this.take = this.take =

View File

@@ -22,6 +22,7 @@ import cn.lili.common.utils.CurrencyUtil;
import cn.lili.common.utils.SnowFlake; import cn.lili.common.utils.SnowFlake;
import cn.lili.modules.goods.entity.dto.GoodsCompleteMessage; import cn.lili.modules.goods.entity.dto.GoodsCompleteMessage;
import cn.lili.modules.member.entity.dto.MemberAddressDTO; import cn.lili.modules.member.entity.dto.MemberAddressDTO;
import cn.lili.modules.order.aftersale.entity.enums.ComplaintStatusEnum;
import cn.lili.modules.order.cart.entity.dto.TradeDTO; import cn.lili.modules.order.cart.entity.dto.TradeDTO;
import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum; import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum;
import cn.lili.modules.order.order.aop.OrderLogPoint; import cn.lili.modules.order.order.aop.OrderLogPoint;
@@ -470,7 +471,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
public Order delivery(String orderSn, String logisticsNo, String logisticsId) { public Order delivery(String orderSn, String logisticsNo, String logisticsId) {
Order order = OperationalJudgment.judgment(this.getBySn(orderSn)); Order order = OperationalJudgment.judgment(this.getBySn(orderSn));
//如果订单未发货,并且订单状态值等于待发货 //如果订单未发货,并且订单状态值等于待发货
if (order.getDeliverStatus().equals(DeliverStatusEnum.UNDELIVERED.name()) && order.getOrderStatus().equals(OrderStatusEnum.UNDELIVERED.name())) { if ((order.getDeliverStatus().equals(DeliverStatusEnum.UNDELIVERED.name()) || order.getDeliverStatus().equals(DeliverStatusEnum.PARTS_DELIVERED.name())) &&
(order.getOrderStatus().equals(OrderStatusEnum.UNDELIVERED.name()) || order.getOrderStatus().equals(OrderStatusEnum.PARTS_DELIVERED.name()))) {
//获取对应物流 //获取对应物流
Logistics logistics = logisticsService.getById(logisticsId); Logistics logistics = logisticsService.getById(logisticsId);
if (logistics == null) { if (logistics == null) {
@@ -872,7 +874,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
throw new ServiceException("发货数量不正确!"); throw new ServiceException("发货数量不正确!");
} }
orderItem.setDeliverNumber((partDeliveryDTO.getDeliveryNum() + orderItem.getDeliverNumber())); orderItem.setDeliverNumber((partDeliveryDTO.getDeliveryNum() + orderItem.getDeliverNumber()));
// 记录分包裹中每个item子单的具体发货信息 // 记录分包裹中每个item子单的具体发货信息
OrderPackageItem orderPackageItem = new OrderPackageItem(); OrderPackageItem orderPackageItem = new OrderPackageItem();
orderPackageItem.setOrderSn(orderSn); orderPackageItem.setOrderSn(orderSn);
@@ -906,6 +907,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
//是否全部发货 //是否全部发货
if (delivery) { if (delivery) {
return delivery(orderSn, invoiceNumber, logisticsId); return delivery(orderSn, invoiceNumber, logisticsId);
}else if(order.getDeliverStatus().equals(DeliverStatusEnum.UNDELIVERED.name()) || order.getOrderStatus().equals(OrderStatusEnum.UNDELIVERED.name())){
//更改订单状态为部分发货
order.setDeliverStatus(DeliverStatusEnum.PARTS_DELIVERED.name());
order.setOrderStatus(OrderStatusEnum.PARTS_DELIVERED.name());
this.updateById(order);
} }
return order; return order;
} }

View File

@@ -172,9 +172,9 @@ public class SeckillApplyServiceImpl extends ServiceImpl<SeckillApplyMapper, Sec
for (SeckillApplyVO seckillApply : seckillApplyList) { for (SeckillApplyVO seckillApply : seckillApplyList) {
//获取参与活动的商品信息 //获取参与活动的商品信息
GoodsSku goodsSku = goodsSkuService.getCanPromotionGoodsSkuByIdFromCache(seckillApply.getSkuId()); GoodsSku goodsSku = goodsSkuService.getCanPromotionGoodsSkuByIdFromCache(seckillApply.getSkuId());
if (!goodsSku.getStoreId().equals(storeId)) { // if (!goodsSku.getStoreId().equals(storeId)) {
continue; // continue;
} // }
//获取秒杀活动时间段 //获取秒杀活动时间段
DateTime startTime = DateUtil.offsetHour(DateUtil.beginOfDay(seckill.getStartTime()), seckillApply.getTimeLine()); DateTime startTime = DateUtil.offsetHour(DateUtil.beginOfDay(seckill.getStartTime()), seckillApply.getTimeLine());
//检测是否可以发布促销商品 //检测是否可以发布促销商品

View File

@@ -5,8 +5,6 @@ import cn.lili.cache.Cache;
import cn.lili.cache.CachePrefix; import cn.lili.cache.CachePrefix;
import cn.lili.common.enums.ResultCode; import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException; import cn.lili.common.exception.ServiceException;
import cn.lili.common.properties.SmsTemplateProperties;
import cn.lili.common.properties.SystemSettingProperties;
import cn.lili.common.security.context.UserContext; import cn.lili.common.security.context.UserContext;
import cn.lili.common.utils.CommonUtil; import cn.lili.common.utils.CommonUtil;
import cn.lili.modules.member.entity.dos.Member; import cn.lili.modules.member.entity.dos.Member;
@@ -48,12 +46,6 @@ public class SmsUtilAliImplService implements SmsUtil {
@Autowired @Autowired
private SmsPluginFactory smsPluginFactory; private SmsPluginFactory smsPluginFactory;
@Autowired
private SmsTemplateProperties smsTemplateProperties;
@Autowired
private SystemSettingProperties systemSettingProperties;
@Override @Override
public void sendSmsCode(String mobile, VerificationEnums verificationEnums, String uuid) { public void sendSmsCode(String mobile, VerificationEnums verificationEnums, String uuid) {
//获取短信配置 //获取短信配置
@@ -78,18 +70,18 @@ public class SmsUtilAliImplService implements SmsUtil {
switch (verificationEnums) { switch (verificationEnums) {
//登录 //登录
case LOGIN: { case LOGIN: {
templateCode = smsTemplateProperties.getLOGIN(); templateCode = smsSetting.getLoginTemplateCode();
break; break;
} }
//注册 //注册
case BIND_MOBILE: case BIND_MOBILE:
case REGISTER: { case REGISTER: {
templateCode = smsTemplateProperties.getREGISTER(); templateCode = smsSetting.getRegisterTemplateCode();
break; break;
} }
//找回密码 //找回密码
case FIND_USER: { case FIND_USER: {
templateCode = smsTemplateProperties.getFIND_USER(); templateCode = smsSetting.getFindPasswordTemplateCode();
break; break;
} }
//修改密码 //修改密码
@@ -100,7 +92,7 @@ public class SmsUtilAliImplService implements SmsUtil {
} }
//更新为用户最新手机号 //更新为用户最新手机号
mobile = member.getMobile(); mobile = member.getMobile();
templateCode = smsTemplateProperties.getUPDATE_PASSWORD(); templateCode = smsSetting.getFindPasswordTemplateCode();
break; break;
} }
//设置支付密码 //设置支付密码
@@ -108,7 +100,7 @@ public class SmsUtilAliImplService implements SmsUtil {
Member member = memberService.getById(UserContext.getCurrentUser().getId()); Member member = memberService.getById(UserContext.getCurrentUser().getId());
//更新为用户最新手机号 //更新为用户最新手机号
mobile = member.getMobile(); mobile = member.getMobile();
templateCode = smsTemplateProperties.getWALLET_PASSWORD(); templateCode = smsSetting.getWalletPasswordTemplateCode();
break; break;
} }
//如果不是有效的验证码手段,则此处不进行短信操作 //如果不是有效的验证码手段,则此处不进行短信操作

View File

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

View File

@@ -48,17 +48,15 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
@Override @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) { if (list != null) {
return list; return list;
} }
list = new ArrayList<>(); list = new ArrayList<>();
//查询运费模板 //查询运费模板
LambdaQueryWrapper<FreightTemplate> lambdaQueryWrapper = Wrappers.lambdaQuery(); List<FreightTemplate> freightTemplates = this.list();
lambdaQueryWrapper.eq(FreightTemplate::getStoreId, storeId);
List<FreightTemplate> freightTemplates = this.baseMapper.selectList(lambdaQueryWrapper);
if (!freightTemplates.isEmpty()) { if (!freightTemplates.isEmpty()) {
//如果模板不为空则查询子模板信息 //如果模板不为空则查询子模板信息
for (FreightTemplate freightTemplate : freightTemplates) { for (FreightTemplate freightTemplate : freightTemplates) {
@@ -71,16 +69,14 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
list.add(freightTemplateVO); list.add(freightTemplateVO);
} }
} }
cache.put(CachePrefix.SHIP_TEMPLATE.getPrefix() + storeId, list); cache.put(CachePrefix.SHIP_TEMPLATE.getPrefix(), list);
return list; return list;
} }
@Override @Override
public IPage<FreightTemplate> getFreightTemplate(PageVO pageVo) { public IPage<FreightTemplate> getFreightTemplate(PageVO pageVo) {
LambdaQueryWrapper<FreightTemplate> lambdaQueryWrapper = Wrappers.lambdaQuery(); return this.page(PageUtil.initPage(pageVo));
lambdaQueryWrapper.eq(FreightTemplate::getStoreId, UserContext.getCurrentUser().getStoreId());
return this.baseMapper.selectPage(PageUtil.initPage(pageVo), lambdaQueryWrapper);
} }
@Override @Override
@@ -101,10 +97,7 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
@Override @Override
public FreightTemplateVO addFreightTemplate(FreightTemplateVO freightTemplateVO) { public FreightTemplateVO addFreightTemplate(FreightTemplateVO freightTemplateVO) {
//获取当前登录商家账号 //获取当前登录商家账号
AuthUser tokenUser = UserContext.getCurrentUser();
FreightTemplate freightTemplate = new FreightTemplate(); FreightTemplate freightTemplate = new FreightTemplate();
//设置店铺ID
freightTemplateVO.setStoreId(tokenUser.getStoreId());
//复制属性 //复制属性
BeanUtils.copyProperties(freightTemplateVO, freightTemplate); 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; return freightTemplateVO;
} }
@@ -130,10 +123,10 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public FreightTemplateVO editFreightTemplate(FreightTemplateVO freightTemplateVO) { public FreightTemplateVO editFreightTemplate(FreightTemplateVO freightTemplateVO) {
//获取当前登录商家账号 //获取当前登录商家账号
AuthUser tokenUser = UserContext.getCurrentUser(); // AuthUser tokenUser = UserContext.getCurrentUser();
if (freightTemplateVO.getId().equals(tokenUser.getStoreId())) { // if (freightTemplateVO.getId().equals(tokenUser.getStoreId())) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR); // throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
} // }
FreightTemplate freightTemplate = new FreightTemplate(); FreightTemplate freightTemplate = new FreightTemplate();
//复制属性 //复制属性
BeanUtils.copyProperties(freightTemplateVO, freightTemplate); BeanUtils.copyProperties(freightTemplateVO, freightTemplate);
@@ -150,7 +143,7 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
//添加模板子内容 //添加模板子内容
freightTemplateChildService.addFreightTemplateChild(list); freightTemplateChildService.addFreightTemplateChild(list);
//更新缓存 //更新缓存
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix() + tokenUser.getStoreId()); cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix());
return null; return null;
} }
@@ -159,13 +152,11 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean removeFreightTemplate(String id) { public boolean removeFreightTemplate(String id) {
//获取当前登录商家账号 //获取当前登录商家账号
AuthUser tokenUser = UserContext.getCurrentUser();
LambdaQueryWrapper<FreightTemplate> lambdaQueryWrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<FreightTemplate> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(FreightTemplate::getStoreId, tokenUser.getStoreId());
lambdaQueryWrapper.eq(FreightTemplate::getId, id); lambdaQueryWrapper.eq(FreightTemplate::getId, id);
//如果删除成功则删除运费模板子项 //如果删除成功则删除运费模板子项
if (this.remove(lambdaQueryWrapper)) { if (this.remove(lambdaQueryWrapper)) {
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix() + tokenUser.getStoreId()); cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix());
return freightTemplateChildService.removeFreightTemplate(id); return freightTemplateChildService.removeFreightTemplate(id);
} }
return false; return false;

View File

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

View File

@@ -1,5 +1,6 @@
package cn.lili.modules.system.entity.dos; package cn.lili.modules.system.entity.dos;
import cn.lili.modules.store.entity.dto.StoreLogisticsCustomerDTO;
import cn.lili.mybatis.BaseEntity; import cn.lili.mybatis.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@@ -37,4 +38,29 @@ public class Logistics extends BaseEntity {
@ApiModelProperty(value = "禁用状态 OPEN开启CLOSE禁用") @ApiModelProperty(value = "禁用状态 OPEN开启CLOSE禁用")
private String disabled; 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 { public class ImSetting implements Serializable {
@ApiModelProperty(value = "平台地址") @ApiModelProperty(value = "地址")
private String httpUrl; 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, 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); 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 labelOrderDTO = new LabelOrderDTO();
labelOrderDTO.setOrder(order); labelOrderDTO.setOrder(order);
labelOrderDTO.setOrderItems(orderItems); labelOrderDTO.setOrderItems(orderItems);
labelOrderDTO.setLogistics(logistics); labelOrderDTO.setLogistics(logistics);
labelOrderDTO.setStoreLogistics(storeLogistics);
labelOrderDTO.setStoreDeliverGoodsAddressDTO(storeDeliverGoodsAddressDTO);
//触发电子面单 //触发电子面单
return logisticsPluginFactory.filePlugin().labelOrder(labelOrderDTO); return logisticsPluginFactory.filePlugin().labelOrder(labelOrderDTO);
} else { } else {

View File

@@ -137,7 +137,7 @@ public class WechatMPServiceImpl implements WechatMPService {
map.put("upload_time", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(ZonedDateTime.now())); map.put("upload_time", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(ZonedDateTime.now()));
//支付者,支付者信息 //支付者,支付者信息
Connect connect = connectService.queryConnect(ConnectQueryDTO.builder().userId(UserContext.getCurrentUser().getId()).unionType(SourceEnum.WECHAT_MP_OPEN_ID.name()).build()); Connect connect = connectService.queryConnect(ConnectQueryDTO.builder().userId(order.getMemberId()).unionType(SourceEnum.WECHAT_MP_OPEN_ID.name()).build());
if (connect == null) { if (connect == null) {
return; return;
} }
@@ -263,7 +263,7 @@ public class WechatMPServiceImpl implements WechatMPService {
private String out_trade_no; private String out_trade_no;
public OrderKey(Order order) { public OrderKey(Order order) {
this.order_number_type = 2; this.order_number_type = 1;
this.out_trade_no = order.getPayOrderNo(); this.out_trade_no = order.getPayOrderNo();
this.transaction_id = order.getReceivableNo(); this.transaction_id = order.getReceivableNo();
} }

View File

@@ -2,7 +2,7 @@ local c
c = redis.call('get',KEYS[1]) c = redis.call('get',KEYS[1])
-- 调用不超过最大值,则直接返回 -- 调用不超过最大值,则直接返回
if c and tonumber(c) > tonumber(ARGV[1]) then if c and tonumber(c) > tonumber(ARGV[1]) then
return c; return tonumber(c);
end end
-- 执行计算器自加 -- 执行计算器自加
c = redis.call('incr',KEYS[1]) c = redis.call('incr',KEYS[1])

View File

@@ -1,17 +1,22 @@
package cn.lili.controller.distribution; package cn.lili.controller.distribution;
import cn.lili.common.enums.ResultUtil; import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage; 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.dto.DistributionGoodsSearchParams;
import cn.lili.modules.distribution.entity.vos.DistributionGoodsVO; import cn.lili.modules.distribution.entity.vos.DistributionGoodsVO;
import cn.lili.modules.distribution.service.DistributionGoodsService; import cn.lili.modules.distribution.service.DistributionGoodsService;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* 管理端,分销商品管理接口 * 管理端,分销商品管理接口
@@ -41,4 +46,13 @@ public class DistributionGoodsManagerController {
distributionGoodsService.removeByIds(ids); distributionGoodsService.removeByIds(ids);
return ResultUtil.success(); 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.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.Category; import cn.lili.modules.goods.entity.dos.Category;
import cn.lili.modules.goods.entity.dto.CategorySearchParams; 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.entity.vos.CategoryVO;
import cn.lili.modules.goods.service.CategoryBrandService;
import cn.lili.modules.goods.service.CategoryService; import cn.lili.modules.goods.service.CategoryService;
import cn.lili.modules.goods.service.GoodsService; import cn.lili.modules.goods.service.GoodsService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@@ -46,6 +48,12 @@ public class CategoryManagerController {
@Autowired @Autowired
private GoodsService goodsService; private GoodsService goodsService;
/**
* 分类品牌
*/
@Autowired
private CategoryBrandService categoryBrandService;
@ApiOperation(value = "查询某分类下的全部子分类列表") @ApiOperation(value = "查询某分类下的全部子分类列表")
@ApiImplicitParam(name = "parentId", value = "父id顶级为0", required = true, dataType = "String", paramType = "path") @ApiImplicitParam(name = "parentId", value = "父id顶级为0", required = true, dataType = "String", paramType = "path")
@GetMapping(value = "/{parentId}/all-children") @GetMapping(value = "/{parentId}/all-children")
@@ -129,4 +137,13 @@ public class CategoryManagerController {
return ResultUtil.success(); 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.ResultCode;
import cn.lili.common.enums.ResultUtil; import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException; import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage; import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.Goods; import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.dos.GoodsSku; 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.GoodsSearchParams;
import cn.lili.modules.goods.entity.dto.GoodsSkuStockDTO;
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum; import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum; import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
import cn.lili.modules.goods.entity.vos.GoodsVO; import cn.lili.modules.goods.entity.vos.GoodsVO;
import cn.lili.modules.goods.service.GoodsService; import cn.lili.modules.goods.service.GoodsService;
import cn.lili.modules.goods.service.GoodsSkuService; import cn.lili.modules.goods.service.GoodsSkuService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@@ -22,9 +26,12 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/** /**
* 管理端,商品管理接口 * 管理端,商品管理接口
@@ -119,4 +126,52 @@ public class GoodsManagerController {
return ResultUtil.data(goods); 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.PageVO;
import cn.lili.common.vo.ResultMessage; import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.Specification; 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.modules.goods.service.SpecificationService;
import cn.lili.mybatis.util.PageUtil; import cn.lili.mybatis.util.PageUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -34,6 +35,9 @@ public class SpecificationManagerController {
@Autowired @Autowired
private SpecificationService specificationService; private SpecificationService specificationService;
@Autowired
private CategorySpecificationService categorySpecificationService;
@GetMapping("/all") @GetMapping("/all")
@ApiOperation(value = "获取所有可用规格") @ApiOperation(value = "获取所有可用规格")
@@ -56,6 +60,12 @@ public class SpecificationManagerController {
return ResultUtil.success(); return ResultUtil.success();
} }
@GetMapping(value = "/{categoryId}")
@ApiOperation(value = "获取分类规格")
public List<Specification> getSpecifications(@PathVariable String categoryId) {
return categorySpecificationService.getCategorySpecList(categoryId);
}
@PutMapping("/{id}") @PutMapping("/{id}")
@ApiOperation(value = "更改规格") @ApiOperation(value = "更改规格")
public ResultMessage<Object> update(@Valid Specification specification, @PathVariable String id) { 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.aop.annotation.PreventDuplicateSubmissions;
import cn.lili.common.enums.ResultUtil; import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.vo.PageVO; import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage; import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.entity.dto.EvaluationQueryParams; import cn.lili.modules.member.entity.dto.EvaluationQueryParams;
@@ -67,4 +68,17 @@ public class MemberEvaluationManagerController {
return ResultUtil.success(); 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) { public ResultMessage<StoreAfterSaleAddressDTO> getStoreAfterSaleAddress(@NotNull(message = "售后单号") @PathVariable("sn") String sn) {
return ResultUtil.data(afterSaleService.getStoreAfterSaleAddressDTO(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.dos.Order;
import cn.lili.modules.order.order.entity.dto.OrderExportDTO; 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.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.OrderDetailVO;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO; 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.OrderPriceService;
import cn.lili.modules.order.order.service.OrderService; import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.system.service.LogisticsService;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -49,6 +52,15 @@ public class OrderManagerController {
@Autowired @Autowired
private OrderPriceService orderPriceService; private OrderPriceService orderPriceService;
@Autowired
private OrderPackageService orderPackageService;
/**
* 快递
*/
@Autowired
private LogisticsService logisticsService;
@ApiOperation(value = "查询订单列表分页") @ApiOperation(value = "查询订单列表分页")
@GetMapping @GetMapping
@@ -134,4 +146,64 @@ public class OrderManagerController {
orderService.updateSellerRemark(orderSn, sellerRemark); orderService.updateSellerRemark(orderSn, sellerRemark);
return ResultUtil.success(); 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; package cn.lili.controller.other;
import cn.lili.common.enums.ResultUtil; import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage; import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.system.entity.dos.Logistics; 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.modules.system.service.LogisticsService;
import cn.lili.mybatis.util.PageUtil; import cn.lili.mybatis.util.PageUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -37,8 +37,8 @@ public class LogisticsManagerController {
@ApiOperation(value = "分页获取物流公司") @ApiOperation(value = "分页获取物流公司")
@GetMapping(value = "/getByPage") @GetMapping(value = "/getByPage")
public ResultMessage<IPage<Logistics>> getByPage(PageVO page) { public ResultMessage<IPage<Logistics>> getByPage(LogisticsSearchParams page) {
return ResultUtil.data(logisticsService.page(PageUtil.initPage(page))); return ResultUtil.data(logisticsService.page(PageUtil.initPage(page),page.queryWrapper()));
} }
@ApiOperation(value = "编辑物流公司") @ApiOperation(value = "编辑物流公司")

View File

@@ -2,6 +2,9 @@ package cn.lili.controller.promotion;
import cn.lili.common.enums.ResultCode; import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil; 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.PageVO;
import cn.lili.common.vo.ResultMessage; import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.cart.entity.vo.FullDiscountVO; 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 org.springframework.web.bind.annotation.*;
import java.util.Collections; import java.util.Collections;
import java.util.Objects;
/** /**
* 管理端,满额活动接口 * 管理端,满额活动接口
@@ -56,4 +60,37 @@ public class FullDiscountManagerController {
} }
return ResultUtil.error(ResultCode.ERROR); 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; package cn.lili.controller.promotion;
import cn.hutool.core.util.ArrayUtil;
import cn.lili.common.enums.PromotionTypeEnum; import cn.lili.common.enums.PromotionTypeEnum;
import cn.lili.common.enums.ResultCode; import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil; import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException; 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.PageVO;
import cn.lili.common.vo.ResultMessage; import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.promotion.entity.dos.Pintuan; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays; 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; package cn.lili.controller.promotion;
import cn.lili.common.enums.ResultUtil; 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.PageVO;
import cn.lili.common.vo.ResultMessage; import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.promotion.entity.dos.Seckill; import cn.lili.modules.promotion.entity.dos.Seckill;
import cn.lili.modules.promotion.entity.dos.SeckillApply; import cn.lili.modules.promotion.entity.dos.SeckillApply;
import cn.lili.modules.promotion.entity.dto.search.SeckillSearchParams; 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.entity.vos.SeckillVO;
import cn.lili.modules.promotion.service.SeckillApplyService; import cn.lili.modules.promotion.service.SeckillApplyService;
import cn.lili.modules.promotion.service.SeckillService; 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 org.springframework.web.bind.annotation.*;
import java.util.Collections; import java.util.Collections;
import java.util.List;
import java.util.Objects;
/** /**
* 管理端,秒杀活动接口 * 管理端,秒杀活动接口
@@ -92,5 +97,11 @@ public class SeckillManagerController {
return ResultUtil.success(); 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 ? return setting == null ?
ResultUtil.data(new HotWordsSetting()) : ResultUtil.data(new HotWordsSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), HotWordsSetting.class)); 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: default:
throw new ServiceException(ResultCode.SETTING_NOT_TO_SET); 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 @GetMapping
public ResultMessage<List<FreightTemplateVO>> list() { public ResultMessage<List<FreightTemplateVO>> list() {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId(); String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
return ResultUtil.data(freightTemplateService.getFreightTemplateList(storeId)); return ResultUtil.data(freightTemplateService.getFreightTemplateList());
} }
@ApiOperation(value = "获取商家运费模板详情") @ApiOperation(value = "获取商家运费模板详情")