diff --git a/admin/pom.xml b/admin/pom.xml
index e188f455..e2b538db 100644
--- a/admin/pom.xml
+++ b/admin/pom.xml
@@ -6,7 +6,7 @@
cn.lili
lili-shop-parent
- 1.0.1
+ 4.2.0
admin
diff --git a/buyer-api/pom.xml b/buyer-api/pom.xml
index 7499e497..22afda90 100644
--- a/buyer-api/pom.xml
+++ b/buyer-api/pom.xml
@@ -10,14 +10,14 @@
cn.lili
lili-shop-parent
- 1.0.1
+ 4.2.0
cn.lili
framework
- 1.0.1
+ 4.2.0
diff --git a/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionBuyerController.java
index 410601c2..b8c97954 100644
--- a/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionBuyerController.java
+++ b/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionBuyerController.java
@@ -5,6 +5,7 @@ import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.distribution.entity.dos.Distribution;
import cn.lili.modules.distribution.entity.dos.DistributionOrder;
+import cn.lili.modules.distribution.entity.dto.DistributionApplyDTO;
import cn.lili.modules.distribution.entity.vos.DistributionOrderSearchParams;
import cn.lili.modules.distribution.service.DistributionOrderService;
import cn.lili.modules.distribution.service.DistributionService;
@@ -41,19 +42,15 @@ public class DistributionBuyerController {
//申请分销员
@ApiOperation(value = "申请分销员")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "name", value = "姓名", required = true, paramType = "query", dataType = "String"),
- @ApiImplicitParam(name = "idNumber", value = "身份证号", required = true, paramType = "query", dataType = "String")
- })
@PostMapping
- public ResultMessage
diff --git a/common-api/src/main/java/cn/lili/controller/common/UploadController.java b/common-api/src/main/java/cn/lili/controller/common/UploadController.java
index d2e84495..d4f5cdfd 100644
--- a/common-api/src/main/java/cn/lili/controller/common/UploadController.java
+++ b/common-api/src/main/java/cn/lili/controller/common/UploadController.java
@@ -100,7 +100,7 @@ public class UploadController {
fileService.save(newFile);
} catch (Exception e) {
log.error("文件上传失败", e);
- throw new ServiceException(ResultCode.OSS_EXCEPTION);
+ throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR);
}
return ResultUtil.data(result);
}
diff --git a/config/application.yml b/config/application.yml
index 5a9316c8..0e645d6b 100644
--- a/config/application.yml
+++ b/config/application.yml
@@ -77,7 +77,7 @@ spring:
default-datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://192.168.0.116:3306/Bulbasaur?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+ url: jdbc:mysql://192.168.0.116:3306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: lilishop
maxActive: 20
@@ -194,9 +194,9 @@ logging:
# 输出级别
level:
cn.lili: info
- # org.hibernate: debug
- # org.springframework: debug
- # org.springframework.data.mongodb.core: debug
+ org.hibernate: debug
+ org.springframework: debug
+ org.springframework.data.mongodb.core: debug
file:
# 指定路径
path: lili-logs
diff --git a/consumer/pom.xml b/consumer/pom.xml
index dd25a81b..b9b34c24 100644
--- a/consumer/pom.xml
+++ b/consumer/pom.xml
@@ -8,14 +8,14 @@
cn.lili
lili-shop-parent
- 1.0.1
+ 4.2.0
cn.lili
framework
- 1.0.1
+ 4.2.0
diff --git a/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java b/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java
index 3b63bdd8..e3346136 100644
--- a/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java
+++ b/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java
@@ -59,7 +59,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
//如果订单状态不为空
if (orderDetailVO != null) {
Map params = new HashMap<>();
- switch (orderMessage.getNewStatus()){
+ switch (orderMessage.getNewStatus()) {
//如果订单新的状态为已取消 则发送取消订单站内信
case CANCELLED:
params.put(NoticeMessageParameterEnum.CANCEL_REASON.getType(), orderDetailVO.getOrder().getCancelReason());
@@ -82,7 +82,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
break;
//如果是拼团订单,发送拼团成功消息
case UNDELIVERED:
- if(orderDetailVO.getOrder().getOrderPromotionType().equals(OrderPromotionTypeEnum.PINTUAN.name())){
+ if (OrderPromotionTypeEnum.PINTUAN.name().equals(orderDetailVO.getOrder().getOrderPromotionType())) {
//拼团成功消息
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.PINTUAN_SUCCESS);
}
@@ -148,11 +148,14 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
@Override
public void memberPointChange(MemberPointMessage memberPointMessage) {
+ if (memberPointMessage == null) {
+ return;
+ }
//组织站内信参数
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
noticeMessageDTO.setMemberId(memberPointMessage.getMemberId());
Map params = new HashMap<>();
- if (memberPointMessage.getType().equals(1)) {
+ if (memberPointMessage.getType()) {
params.put("expenditure_points", "0");
params.put("income_points", memberPointMessage.getPoint().toString());
} else {
diff --git a/consumer/src/main/java/cn/lili/event/impl/StockUpdateExecute.java b/consumer/src/main/java/cn/lili/event/impl/StockUpdateExecute.java
index 7c54b374..216b4331 100644
--- a/consumer/src/main/java/cn/lili/event/impl/StockUpdateExecute.java
+++ b/consumer/src/main/java/cn/lili/event/impl/StockUpdateExecute.java
@@ -1,5 +1,6 @@
package cn.lili.event.impl;
+import cn.hutool.core.convert.Convert;
import cn.lili.common.cache.Cache;
import cn.lili.event.OrderStatusChangeEvent;
import cn.lili.modules.goods.entity.dos.GoodsSku;
@@ -188,7 +189,7 @@ public class StockUpdateExecute implements OrderStatusChangeEvent {
List skuStocks = cache.multiGet(skuKeys);
//循环写入商品库存
for (int i = 0; i < skuStocks.size(); i++) {
- goodsSkus.get(i).setQuantity(Integer.parseInt(skuStocks.get(i).toString()));
+ goodsSkus.get(i).setQuantity(Convert.toInt(skuStocks.get(i).toString()));
}
//批量修改商品库存
goodsSkuService.updateBatchById(goodsSkus);
@@ -197,7 +198,7 @@ public class StockUpdateExecute implements OrderStatusChangeEvent {
if (!promotionKey.isEmpty()) {
List promotionStocks = cache.multiGet(promotionKey);
for (int i = 0; i < promotionKey.size(); i++) {
- promotionGoods.get(i).setQuantity(Integer.parseInt(promotionStocks.get(i).toString()));
+ promotionGoods.get(i).setQuantity(Convert.toInt(promotionStocks.get(i).toString()));
Integer num = promotionGoods.get(i).getNum();
promotionGoods.get(i).setNum((num != null ? num : 0) + order.getOrder().getGoodsNum());
}
@@ -232,7 +233,7 @@ public class StockUpdateExecute implements OrderStatusChangeEvent {
List skuStocks = cache.multiGet(skuKeys);
//循环写入商品SKU库存
for (int i = 0; i < skuStocks.size(); i++) {
- goodsSkus.get(i).setQuantity(Integer.parseInt(skuStocks.get(i).toString()));
+ goodsSkus.get(i).setQuantity(Convert.toInt(skuStocks.get(i).toString()));
}
log.info("订单取消,库存还原:{}", goodsSkus);
//批量修改商品库存
diff --git a/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java b/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java
index fa4132d0..16dd44dc 100644
--- a/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java
+++ b/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java
@@ -3,6 +3,10 @@ package cn.lili.listener;
import cn.hutool.json.JSONUtil;
import cn.lili.common.rocketmq.tags.GoodsTagsEnum;
import cn.lili.event.GoodsCommentCompleteEvent;
+import cn.lili.modules.distribution.entity.dos.DistributionGoods;
+import cn.lili.modules.distribution.entity.dos.DistributionSelectedGoods;
+import cn.lili.modules.distribution.service.DistributionGoodsService;
+import cn.lili.modules.distribution.service.DistributionSelectedGoodsService;
import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.dto.GoodsCompleteMessage;
@@ -15,6 +19,8 @@ import cn.lili.modules.member.service.GoodsCollectionService;
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
import cn.lili.modules.search.service.EsGoodsIndexService;
import cn.lili.modules.store.service.StoreService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
@@ -57,6 +63,13 @@ public class GoodsMessageListener implements RocketMQListener {
//商品评价
@Autowired
private List goodsCommentCompleteEvents;
+ //分销商品
+ @Autowired
+ private DistributionGoodsService distributionGoodsService;
+ //分销员-商品关联表
+ @Autowired
+ private DistributionSelectedGoodsService distributionSelectedGoodsService;
+
@Override
public void onMessage(MessageExt messageExt) {
@@ -77,9 +90,10 @@ public class GoodsMessageListener implements RocketMQListener {
break;
//审核商品
case GOODS_AUDIT:
+ break;
//删除商品
case GOODS_DELETE:
- storeService.updateStoreGoodsNum(new String(messageExt.getBody()));
+ deleteGoods(messageExt);
break;
//规格删除
case SKU_DELETE:
@@ -107,38 +121,72 @@ public class GoodsMessageListener implements RocketMQListener {
break;
//购买商品完成
case BUY_GOODS_COMPLETE:
- String goodsCompleteMessageStr = new String(messageExt.getBody());
- List goodsCompleteMessageList = JSONUtil.toList(JSONUtil.parseArray(goodsCompleteMessageStr), GoodsCompleteMessage.class);
- for (GoodsCompleteMessage goodsCompleteMessage : goodsCompleteMessageList) {
- Goods goods = goodsService.getById(goodsCompleteMessage.getGoodsId());
- if (goods != null) {
- //更新商品购买数量
- if (goods.getBuyCount() == null) {
- goods.setBuyCount(0);
- }
- int buyCount = goods.getBuyCount() + goodsCompleteMessage.getBuyNum();
- LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
- updateWrapper.eq(Goods::getId, goodsCompleteMessage.getGoodsId());
- updateWrapper.set(Goods::getBuyCount, buyCount);
- goodsService.update(updateWrapper);
- } else {
- log.error("商品Id为[" + goodsCompleteMessage.getGoodsId() + "的商品不存在,更新商品失败!");
- }
- GoodsSku goodsSku = goodsSkuService.getById(goodsCompleteMessage.getSkuId());
- if (goodsSku != null) {
- //更新商品购买数量
- if (goodsSku.getBuyCount() == null) {
- goodsSku.setBuyCount(0);
- }
- int buyCount = goodsSku.getBuyCount() + goodsCompleteMessage.getBuyNum();
- goodsSku.setBuyCount(buyCount);
- goodsSkuService.update(goodsSku);
- goodsIndexService.updateIndexBuyNum(goodsCompleteMessage.getSkuId(), buyCount);
- } else {
- log.error("商品SkuId为[" + goodsCompleteMessage.getGoodsId() + "的商品不存在,更新商品失败!");
- }
- }
+ this.goodsBuyComplete(messageExt);
break;
}
}
+
+ /**
+ * 删除商品
+ * 1.更新店铺的商品数量
+ * 2.删除分销员-分销商品绑定关系
+ * 3.删除分销商品
+ * @param messageExt 消息
+ */
+ private void deleteGoods(MessageExt messageExt){
+ Goods goods=JSONUtil.toBean(new String(messageExt.getBody()),Goods.class);
+ //更新店铺商品数量
+ storeService.updateStoreGoodsNum(goods.getStoreId());
+
+ //删除获取分销商品
+ DistributionGoods distributionGoods=distributionGoodsService.getOne(new LambdaQueryWrapper()
+ .eq(DistributionGoods::getGoodsId,goods.getId()));
+
+ //删除分销商品绑定关系
+ distributionSelectedGoodsService.remove(new LambdaQueryWrapper()
+ .eq(DistributionSelectedGoods::getDistributionGoodsId,distributionGoods.getId()));
+
+ //删除分销商品
+ distributionGoodsService.removeById(distributionGoods.getId());
+ }
+
+ /**
+ * 商品购买完成
+ * 1.更新商品购买数量
+ * 2.更新SKU购买数量
+ * 3.更新索引购买数量
+ * @param messageExt
+ */
+ private void goodsBuyComplete(MessageExt messageExt){
+ String goodsCompleteMessageStr = new String(messageExt.getBody());
+ List goodsCompleteMessageList = JSONUtil.toList(JSONUtil.parseArray(goodsCompleteMessageStr), GoodsCompleteMessage.class);
+ for (GoodsCompleteMessage goodsCompleteMessage : goodsCompleteMessageList) {
+ Goods goods = goodsService.getById(goodsCompleteMessage.getGoodsId());
+ if (goods != null) {
+ //更新商品购买数量
+ if (goods.getBuyCount() == null) {
+ goods.setBuyCount(0);
+ }
+ int buyCount = goods.getBuyCount() + goodsCompleteMessage.getBuyNum();
+ goodsService.update(new LambdaUpdateWrapper()
+ .eq(Goods::getId, goodsCompleteMessage.getGoodsId())
+ .set(Goods::getBuyCount, buyCount));
+ } else {
+ log.error("商品Id为[" + goodsCompleteMessage.getGoodsId() + "的商品不存在,更新商品失败!");
+ }
+ GoodsSku goodsSku = goodsSkuService.getById(goodsCompleteMessage.getSkuId());
+ if (goodsSku != null) {
+ //更新商品购买数量
+ if (goodsSku.getBuyCount() == null) {
+ goodsSku.setBuyCount(0);
+ }
+ int buyCount = goodsSku.getBuyCount() + goodsCompleteMessage.getBuyNum();
+ goodsSku.setBuyCount(buyCount);
+ goodsSkuService.update(goodsSku);
+ goodsIndexService.updateIndexBuyNum(goodsCompleteMessage.getSkuId(), buyCount);
+ } else {
+ log.error("商品SkuId为[" + goodsCompleteMessage.getGoodsId() + "的商品不存在,更新商品失败!");
+ }
+ }
+ }
}
diff --git a/consumer/src/main/java/cn/lili/timetask/handler/impl/goods/GoodsExecute.java b/consumer/src/main/java/cn/lili/timetask/handler/impl/goods/GoodsExecute.java
index 3bcdbf1e..f9d92ea6 100644
--- a/consumer/src/main/java/cn/lili/timetask/handler/impl/goods/GoodsExecute.java
+++ b/consumer/src/main/java/cn/lili/timetask/handler/impl/goods/GoodsExecute.java
@@ -1,5 +1,6 @@
package cn.lili.timetask.handler.impl.goods;
+import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.lili.modules.goods.mapper.GoodsMapper;
@@ -40,7 +41,7 @@ public class GoodsExecute implements EveryDayExecute {
.between("create_time", DateUtil.yesterday(), new DateTime()));
for (Map map : list) {
- goodsMapper.addGoodsCommentNum(Integer.parseInt(map.get("num").toString()), map.get("goods_id").toString());
+ goodsMapper.addGoodsCommentNum(Convert.toInt(map.get("num").toString()), map.get("goods_id").toString());
}
}
diff --git a/consumer/src/main/java/cn/lili/timetask/handler/impl/order/OrderEveryDayTaskExecute.java b/consumer/src/main/java/cn/lili/timetask/handler/impl/order/OrderEveryDayTaskExecute.java
index 223489e3..84c0cabc 100644
--- a/consumer/src/main/java/cn/lili/timetask/handler/impl/order/OrderEveryDayTaskExecute.java
+++ b/consumer/src/main/java/cn/lili/timetask/handler/impl/order/OrderEveryDayTaskExecute.java
@@ -3,6 +3,7 @@ package cn.lili.timetask.handler.impl.order;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil;
+import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.modules.member.entity.dto.MemberEvaluationDTO;
import cn.lili.modules.member.entity.enums.EvaluationGradeEnum;
@@ -58,7 +59,7 @@ public class OrderEveryDayTaskExecute implements EveryDayExecute {
//自动确认收货
OrderSetting orderSetting = JSONUtil.toBean(setting.getSettingValue(), OrderSetting.class);
if (orderSetting == null) {
- throw new ServiceException("系统配置异常");
+ throw new ServiceException(ResultCode.ORDER_SETTING_ERROR);
}
//自动确认收货
diff --git a/consumer/src/main/java/cn/lili/timetask/handler/impl/view/PageViewStatisticsExecute.java b/consumer/src/main/java/cn/lili/timetask/handler/impl/view/PageViewStatisticsExecute.java
index 22c0a9f4..2daf4256 100644
--- a/consumer/src/main/java/cn/lili/timetask/handler/impl/view/PageViewStatisticsExecute.java
+++ b/consumer/src/main/java/cn/lili/timetask/handler/impl/view/PageViewStatisticsExecute.java
@@ -1,5 +1,6 @@
package cn.lili.timetask.handler.impl.view;
+import cn.hutool.core.convert.Convert;
import cn.lili.common.cache.Cache;
import cn.lili.common.cache.CachePrefix;
import cn.lili.common.utils.BeanUtil;
@@ -167,15 +168,15 @@ class PageViewStatistics {
//将字符串解析成需要的对象
str = str.substring(str.indexOf("}") + 2);
String[] dateStr = str.split("-");
- Integer year = Integer.parseInt(dateStr[0]);
- Integer month = Integer.parseInt(dateStr[1]);
+ Integer year = Convert.toInt(dateStr[0]);
+ Integer month = Convert.toInt(dateStr[1]);
Integer day;
//是否有店铺id
if (dateStr.length > 3) {
- day = Integer.parseInt(dateStr[2]);
+ day = Convert.toInt(dateStr[2]);
this.storeId = dateStr[3];
} else {
- day = Integer.parseInt(dateStr[2]);
+ day = Convert.toInt(dateStr[2]);
}
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, year);
diff --git a/framework/pom.xml b/framework/pom.xml
index 4873ab05..ba3991db 100644
--- a/framework/pom.xml
+++ b/framework/pom.xml
@@ -7,7 +7,7 @@
cn.lili
lili-shop-parent
- 1.0.1
+ 4.2.0
framework
diff --git a/framework/src/main/java/cn/lili/common/aop/limiter/LimitInterceptor.java b/framework/src/main/java/cn/lili/common/aop/limiter/LimitInterceptor.java
index ff0b5210..2e625ef9 100644
--- a/framework/src/main/java/cn/lili/common/aop/limiter/LimitInterceptor.java
+++ b/framework/src/main/java/cn/lili/common/aop/limiter/LimitInterceptor.java
@@ -1,6 +1,7 @@
package cn.lili.common.aop.limiter;
import cn.lili.common.aop.limiter.annotation.LimitPoint;
+import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import com.google.common.collect.ImmutableList;
import lombok.extern.slf4j.Slf4j;
@@ -60,7 +61,7 @@ public class LimitInterceptor {
log.info("限制请求{}, 当前请求{},缓存key{}", limitCount, count.intValue(), key);
//如果缓存里没有值,或者他的值小于限制频率
if (count.intValue() >= limitCount) {
- throw new ServiceException("访问过于频繁,请稍后再试");
+ throw new ServiceException(ResultCode.LIMIT_ERROR);
}
}
//如果从redis中执行都值判定为空,则这里跳过
diff --git a/framework/src/main/java/cn/lili/common/enums/ResultCode.java b/framework/src/main/java/cn/lili/common/enums/ResultCode.java
index 26490d88..bd499283 100644
--- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java
+++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java
@@ -32,9 +32,10 @@ public enum ResultCode {
/**
* 系统异常
*/
-
WECHAT_CONNECT_NOT_EXIST(1001, "微信联合登录未配置"),
VERIFICATION_EXIST(1002, "验证码服务异常"),
+ LIMIT_ERROR(1003,"访问过于频繁,请稍后再试"),
+ ILLEGAL_REQUEST_ERROR(1004, "非法请求,请重新刷新页面操作"),
/**
* 分类
*/
@@ -47,6 +48,7 @@ public enum ResultCode {
CATEGORY_SAVE_ERROR(10007, "此类别下存在商品不能删除"),
CATEGORY_PARAMETER_SAVE_ERROR(10008, "分类绑定参数组添加失败"),
CATEGORY_PARAMETER_UPDATE_ERROR(10009, "分类绑定参数组添加失败"),
+ CATEGORY_DELETE_FLAG_ERROR(10010, "子类状态不能与父类不一致!"),
/**
* 商品
@@ -64,209 +66,159 @@ public enum ResultCode {
GOODS_SKU_WEIGHT_ERROR(11010, "商品重量不能为负数"),
GOODS_SKU_QUANTITY_ERROR(11011, "商品库存数量不能为负数"),
GOODS_SKU_QUANTITY_NOT_ENOUGH(11011, "商品库存不足"),
+ MUST_HAVE_GOODS_SKU(11012,"规格必须要有一个!"),
+ GOODS_PARAMS_ERROR(11013,"商品参数错误,刷新后重试"),
+ PHYSICAL_GOODS_NEED_TEMP(11014,"实物商品需选择配送模板"),
+ VIRTUAL_GOODS_NOT_NEED_TEMP(11015,"实物商品需选择配送模板"),
+ GOODS_TYPE_ERROR(11016, "需选择商品类型"),
/**
* 参数
*/
PARAMETER_SAVE_ERROR(12001, "参数添加失败"),
-
PARAMETER_UPDATE_ERROR(12002, "参数编辑失败"),
/**
* 规格
*/
SPEC_SAVE_ERROR(13001, "规格修改失败"),
-
SPEC_UPDATE_ERROR(13002, "规格修改失败"),
-
SPEC_DELETE_ERROR(13003, "此规格已绑定分类不允许删除"),
/**
* 品牌
*/
BRAND_SAVE_ERROR(14001, "品牌添加失败"),
-
BRAND_UPDATE_ERROR(14002, "品牌修改失败"),
-
BRAND_DISABLE_ERROR(14003, "品牌禁用失败"),
-
BRAND_DELETE_ERROR(14004, "品牌删除失败"),
+ BRAND_NAME_EXIST_ERROR(20002, "品牌名称重复!"),
+ BRAND_USE_DISABLE_ERROR(20003, "当前品牌下存在分类不可禁用"),
+ BRAND_NOT_EXIST(20004, "品牌不存在"),
/**
* 用户
*/
USER_EDIT_SUCCESS(20001, "用户修改成功"),
-
USER_NOT_EXIST(20002, "用户不存在"),
-
USER_NOT_LOGIN(20003, "用户未登录"),
-
USER_AUTH_EXPIRED(20004, "用户已退出,请重新登录"),
-
USER_AUTHORITY_ERROR(20005, "权限不足"),
-
USER_CONNECT_LOGIN_ERROR(20006, "未找到登录信息"),
-
USER_NAME_EXIST(20007, "该用户名已被注册"),
-
USER_PHONE_EXIST(20008, "该手机号已被注册"),
-
USER_PHONE_NOT_EXIST(20009, "手机号不存在"),
-
USER_PASSWORD_ERROR(20010, "密码不正确"),
-
USER_NOT_PHONE(20011, "非当前用户的手机号"),
-
USER_CONNECT_ERROR(20012, "联合第三方登录,授权信息错误"),
-
USER_RECEIPT_REPEAT_ERROR(20013, "会员发票信息重复"),
-
USER_RECEIPT_NOT_EXIST(20014, "会员发票信息不存在"),
-
USER_EDIT_ERROR(20015, "用户修改失败"),
-
USER_OLD_PASSWORD_ERROR(20016, "旧密码不正确"),
-
USER_COLLECTION_EXIST(20017, "无法重复收藏"),
-
USER_GRADE_IS_DEFAULT(20018, "会员等级为默认会员等级"),
-
- DELETE_EXIST(2001, "无法重复收藏"),
+ DELETE_EXIST(20019, "无法重复收藏"),
+ USER_NOT_BINDING(20020,"未绑定用户"),
+ USER_AUTO_REGISTER_ERROR(20021,"自动注册失败,请稍后重试"),
+ USER_OVERDUE_CONNECT_ERROR(20022,"授权信息已过期,请重新授权/登录"),
+ USER_CONNECT_BANDING_ERROR(20023,"当前联合登陆方式,已绑定其他账号,需进行解绑操作"),
+ USER_CONNECT_NOT_EXIST_ERROR(20024, "暂无联合登陆信息,无法实现一键注册功能,请点击第三方登录进行授权"),
/**
* 权限
*/
PERMISSION_DEPARTMENT_ROLE_ERROR(21001, "角色已绑定部门,请逐个删除"),
-
PERMISSION_USER_ROLE_ERROR(21002, "角色已绑定管理员,请逐个删除"),
-
PERMISSION_MENU_ROLE_ERROR(21003, "菜单已绑定角色,请先删除或编辑角色"),
-
PERMISSION_DEPARTMENT_DELETE_ERROR(21004, "部门已经绑定管理员,请先删除或编辑管理员"),
-
PERMISSION_BEYOND_TEN(21005, "最多可以设置10个角色"),
/**
* 分销
*/
DISTRIBUTION_CLOSE(22000, "分销功能关闭"),
-
DISTRIBUTION_NOT_EXIST(22001, "分销员不存在"),
-
DISTRIBUTION_IS_APPLY(22002, "分销员已申请,无需重复提交"),
-
DISTRIBUTION_AUDIT_ERROR(22003, "审核分销员失败"),
-
DISTRIBUTION_RETREAT_ERROR(22004, "分销员清退失败"),
-
DISTRIBUTION_CASH_NOT_EXIST(22005, "分销员提现记录不存在"),
-
DISTRIBUTION_GOODS_DOUBLE(22006, "不能重复添加分销商品"),
/**
* 购物车
*/
CART_ERROR(30001, "读取结算页的购物车异常"),
-
CART_PINTUAN_NOT_EXIST_ERROR(30002, "拼团活动不存在错误"),
-
CART_PINTUAN_LIMIT_ERROR(30003, "购买数量超过拼团活动限制数量"),
-
SHIPPING_NOT_APPLY(30005, "购物商品不支持当前收货地址配送"),
/**
* 订单
*/
ORDER_ERROR(31001, "创建订单异常,请稍后重试"),
-
ORDER_NOT_EXIST(31002, "订单不存在"),
-
ORDER_DELIVERED_ERROR(31003, "订单状态错误,无法进行确认收货"),
-
ORDER_UPDATE_PRICE_ERROR(31004, "已支付的订单不能修改金额"),
-
ORDER_LOGISTICS_ERROR(31005, "物流错误"),
-
ORDER_DELIVER_ERROR(31006, "物流错误"),
-
ORDER_NOT_USER(31007, "非当前会员的订单"),
-
ORDER_TAKE_ERROR(31008, "当前订单无法核销"),
-
MEMBER_ADDRESS_NOT_EXIST(31009, "订单无收货地址,请先配置收货地址"),
-
ORDER_DELIVER_NUM_ERROR(31010, "没有待发货的订单"),
-
ORDER_NOT_SUPPORT_DISTRIBUTION(31011, "购物车中包含不支持配送的商品,请重新选择收货地址,或者重新选择商品"),
-
ORDER_CAN_NOT_CANCEL(31012, "当前订单状态不可取消"),
+ ORDER_BATCH_DELIVER_ERROR(31013, "批量发货,文件读取失败"),
+ ORDER_ITEM_NOT_EXIST(31014, "当前订单项不存在!"),
+
/**
* 支付
*/
PAY_UN_WANTED(32000, "当前订单不需要付款,返回订单列表等待系统订单出库即可"),
-
PAY_SUCCESS(32001, "支付成功"),
-
PAY_INCONSISTENT_ERROR(32002, "付款金额和应付金额不一致"),
-
PAY_DOUBLE_ERROR(32003, "订单已支付,不能再次进行支付"),
-
PAY_CASHIER_ERROR(32004, "收银台信息获取错误"),
-
PAY_ERROR(32005, "支付业务异常,请稍后重试"),
-
PAY_BAN(32006, "当前订单不需要付款,请返回订单列表重新操作"),
-
PAY_PARTIAL_ERROR(32007, "该订单已部分支付,请前往订单中心进行支付"),
-
PAY_NOT_SUPPORT(32008, "支付暂不支持"),
-
PAY_CLIENT_TYPE_ERROR(32009, "错误的客户端"),
-
PAY_POINT_ENOUGH(32010, "积分不足,不能兑换"),
-
PAY_NOT_EXIST_ORDER(32011, "支付订单不存在"),
-
CAN_NOT_RECHARGE_WALLET(32012, "不能使用余额进行充值"),
+
/**
* 售后
*/
AFTER_SALES_NOT_PAY_ERROR(33001, "当前订单未支付,不能申请售后"),
-
AFTER_SALES_CANCEL_ERROR(33002, "当前售后单无法取消"),
-
AFTER_SALES_BAN(33003, "订单状态不允许申请售后,请联系平台或商家"),
-
AFTER_SALES_DOUBLE_ERROR(33004, "售后已审核,无法重复操作"),
-
AFTER_SALES_LOGISTICS_ERROR(33005, "物流公司错误,请重新选择"),
-
AFTER_STATUS_ERROR(33006, "售后状态错误,请刷新页面"),
+ RETURN_MONEY_OFFLINE_BANK_ERROR(33007, "当账号类型为银行转账时,银行信息不能为空"),
/**
* 投诉
*/
COMPLAINT_ORDER_ITEM_EMPTY_ERROR(33100, "订单不存在"),
-
COMPLAINT_SKU_EMPTY_ERROR(33101, "商品已下架,如需投诉请联系平台客服"),
-
COMPLAINT_ERROR(33102, "投诉异常,请稍后重试"),
+ COMPLAINT_NOT_EXIT(33103, "当前投诉记录不存在"),
+ COMPLAINT_ARBITRATION_RESULT_ERROR(33104, "结束订单投诉时,仲裁结果不能为空"),
+ COMPLAINT_APPEAL_CONTENT_ERROR(33105, "商家申诉时,申诉内容不能为空"),
+
/**
* 余额
*/
WALLET_NOT_EXIT_ERROR(34000, "钱包不存在,请联系管理员"),
-
WALLET_INSUFFICIENT(34001, "余额不足以支付订单,请充值!"),
-
WALLET_WITHDRAWAL_INSUFFICIENT(34002, "可提现金额不足!"),
-
WALLET_ERROR_INSUFFICIENT(34003, "零钱提现失败!"),
-
WALLET_REMARK_ERROR(34004, "请填写审核备注!"),
-
WALLET_APPLY_ERROR(34005, "提现申请异常!"),
/**
@@ -275,87 +227,125 @@ public enum ResultCode {
EVALUATION_DOUBLE_ERROR(35001, "无法重复提交评价"),
/**
- * 签到
+ * 活动
*/
- MEMBER_SIGN_REPEAT(40001, "请勿重复签到"),
+ PROMOTION_GOODS_NOT_EXIT(40001, "当前促销商品不存在!"),
+ PROMOTION_SAME_ACTIVE_EXIST(40002,"当前时间内已存在同类活动"),
+ PROMOTION_START_TIME_ERROR(40003,"活动起始时间不能大于活动结束时间"),
+ PROMOTION_TIME_ERROR(40004,"活动起始时间必须大于当前时间"),
+ PROMOTION_SAME_ERROR(40005,"当前时间段已存在相同活动!"),
+ PROMOTION_GOODS_ERROR(40006,"请选择要参与活动的商品"),
+ PROMOTION_STATUS_END(40007,"当前活动已停止"),
+ PROMOTION_UPDATE_ERROR(40008,"当前活动已开始/结束,无法编辑!"),
/**
* 优惠券
*/
COUPON_EDIT_STATUS_SUCCESS(41001, "修改状态成功!"),
-
COUPON_CANCELLATION_SUCCESS(41002, "会员优惠券作废成功"),
-
COUPON_EXPIRED(41003, "优惠券已使用/已过期,不能使用"),
-
COUPON_EDIT_STATUS_ERROR(41004, "优惠券修改状态失败!"),
+ COUPON_RECEIVE_ERROR(41005, "当前优惠券状态不可领取"),
+ COUPON_NUM_INSUFFICIENT_ERROR(41006, "优惠券剩余领取数量不足"),
+ COUPON_NOT_EXIST(41007, "当前优惠券不存在"),
+ COUPON_LIMIT_NUM_LESS_THAN_0(41008, "领取限制数量不能为负数"),
+ COUPON_LIMIT_GREATER_THAN_PUBLISH(41009, "领取限制数量超出发行数量"),
+ COUPON_DISCOUNT_ERROR(41010, "优惠券折扣必须小于10且大于0"),
+ COUPON_SCOPE_TYPE_GOODS_ERROR(41011, "当前关联范围类型为指定商品时,商品列表不能为空"),
+ COUPON_SCOPE_TYPE_CATEGORY_ERROR(41012, "当前关联范围类型为部分商品分类时,范围关联的id不能为空"),
+ COUPON_SCOPE_TYPE_STORE_ERROR(41013, "当前关联范围类型为部分店铺分类时,范围关联的id不能为空"),
+ COUPON_SCOPE_ERROR(41014, "指定商品范围关联id无效!"),
+ COUPON_MEMBER_NOT_EXIST(41015, "没有当前会员优惠券"),
+ COUPON_MEMBER_STATUS_ERROR(41016, "当前会员优惠券已过期/作废无法变更状态!"),
+
/**
* 拼团
*/
PINTUAN_MANUAL_OPEN_SUCCESS(42001, "手动开启拼团活动成功"),
-
PINTUAN_MANUAL_CLOSE_SUCCESS(42002, "手动关闭拼团活动成功"),
-
PINTUAN_ADD_SUCCESS(42003, "添加拼团活动成功"),
-
PINTUAN_EDIT_SUCCESS(42004, "修改拼团活动成功"),
-
PINTUAN_DELETE_SUCCESS(42005, "删除拼团活动成功"),
-
PINTUAN_MANUAL_OPEN_ERROR(42006, "手动开启拼团活动失败"),
-
PINTUAN_MANUAL_CLOSE_ERROR(42007, "手动关闭拼团活动失败"),
-
PINTUAN_ADD_ERROR(42008, "添加拼团活动失败"),
-
PINTUAN_EDIT_ERROR(42009, "修改拼团活动失败"),
-
PINTUAN_DELETE_ERROR(42010, "删除拼团活动失败"),
+ PINTUAN_JOIN_ERROR(42011, "不能参与自己发起的拼团活动!"),
+ PINTUAN_LIMIT_NUM_ERROR(42012, "购买数量超过拼团活动限制数量!"),
+ PINTUAN_NOT_EXIST_ERROR(42013,"当前拼团商品不存在!"),
/**
* 满额活动
*/
FULL_DISCOUNT_EDIT_SUCCESS(43001, "修改满优惠活动成功"),
-
FULL_DISCOUNT_EDIT_DELETE(43002, "删除满优惠活动成功"),
+ FULL_DISCOUNT_MODIFY_ERROR(43003,"当前编辑的满优惠活动已经开始或者已经结束,无法修改"),
+ FULL_DISCOUNT_NOT_EXIST_ERROR(43004,"当前要操作的满优惠活动不存在!"),
+ FULL_DISCOUNT_WAY_ERROR(43005,"请选择一种优惠方式!"),
+ FULL_DISCOUNT_GIFT_ERROR(43006,"请选择赠品!"),
+ FULL_DISCOUNT_COUPON_TIME_ERROR(43007,"赠送的优惠券有效时间必须大于活动时间"),
+ FULL_DISCOUNT_MONEY_ERROR(43008,"请填写满减金额"),
+ FULL_DISCOUNT_MONEY_GREATER_THAN_MINUS(43009,"满减金额不能大于优惠门槛"),
+ FULL_RATE_NUM_ERROR(43010,"请填写打折数值"),
/**
* 直播
*/
STODIO_GOODS_EXIST_ERROR(44001,"直播商品已存在"),
+ COMMODITY_ERROR(44002,"添加直播商品失败"),
+ /**
+ * 秒杀
+ */
+ SECKILL_NOT_EXIST_ERROR(45001,"当前参与的秒杀活动不存在!"),
+ SECKILL_UPDATE_ERROR(45002,"当前秒杀活动活动已经开始,无法修改!"),
+ SECKILL_PRICE_ERROR(45003,"活动价格不能大于商品原价"),
+ SECKILL_TIME_ERROR(45004,"时刻参数异常"),
+ SECKILL_DELETE_ERROR(45005,"该秒杀活动活动的状态不能删除"),
+ SECKILL_CLOSE_ERROR(45006,"该秒杀活动活动的状态不能关闭"),
+
+
+ /**
+ * 优惠券活动
+ */
+ COUPON_ACTIVITY_START_TIME_ERROR(46001,"活动时间小于当前时间,不能进行编辑删除操作"),
+ COUPON_ACTIVITY_MEMBER_ERROR(46002,"指定精准发券则必须指定会员,会员不可以为空"),
+ COUPON_ACTIVITY_ITEM_ERROR(46003,"优惠券活动必须指定优惠券,不能为空"),
+ COUPON_ACTIVITY_ITEM_MUST_NUM_ERROR(46004,"优惠券活动最多指定10个优惠券"),
+ COUPON_ACTIVITY_ITEM_NUM_ERROR(46005,"赠券数量必须大于0"),
+
+ /**
+ * 其他促销
+ */
+ MEMBER_SIGN_REPEAT(47001, "请勿重复签到"),
+ POINT_GOODS_ACTIVE_STOCK_ERROR(47002, "活动库存数量不能高于商品库存"),
/**
* 店铺
*/
+
STORE_NOT_EXIST(50001, "此店铺不存在"),
-
STORE_NAME_EXIST_ERROR(50002, "店铺名称已存在!"),
-
STORE_APPLY_DOUBLE_ERROR(50003, "已有店铺,无需重复申请!"),
+ STORE_NOT_OPEN(50004, "该会员未开通店铺"),
+ STORE_NOT_LOGIN_ERROR(50005, "未登录店铺"),
/**
* 结算单
*/
BILL_CHECK_ERROR(51001, "只有已出账结算单可以核对"),
-
BILL_COMPLETE_ERROR(51002, "只有已审核结算单可以支付"),
/**
* 文章
*/
ARTICLE_CATEGORY_NAME_EXIST(60001, "文章分类名称已存在"),
-
ARTICLE_CATEGORY_PARENT_NOT_EXIST(60002, "文章分类父分类不存在"),
-
ARTICLE_CATEGORY_BEYOND_TWO(60003, "最多为二级分类,操作失败"),
-
ARTICLE_CATEGORY_DELETE_ERROR(60004, "该文章分类下存在子分类,不能删除"),
-
ARTICLE_CATEGORY_HAS_ARTICLE(60005, "该文章分类下存在文章,不能删除"),
-
ARTICLE_CATEGORY_NO_DELETION(60007, "默认文章分类不能进行删除"),
-
ARTICLE_NO_DELETION(60008, "默认文章不能进行删除"),
@@ -363,69 +353,67 @@ public enum ResultCode {
* 页面
*/
PAGE_NOT_EXIST(61001, "页面不存在"),
-
PAGE_OPEN_DELETE_ERROR(61002, "当前页面为开启状态,无法删除"),
-
PAGE_DELETE_ERROR(61003, "当前页面为唯一页面,无法删除"),
-
PAGE_RELEASE_ERROR(61004, "页面已发布,无需重复提交"),
/**
* 设置
*/
SETTING_NOT_TO_SET(70001, "该参数不需要设置"),
-
- /**
- * 短信
- */
- SMS_SIGN_EXIST_ERROR(80001, "短信签名已存在"),
+ ALIPAY_NOT_SETTING(70002, "支付宝支付未配置"),
+ ALIPAY_EXCEPTION(70003, "支付宝支付错误,请稍后重试"),
+ ALIPAY_PARAMS_EXCEPTION(70004, "支付宝参数异常"),
+ LOGISTICS_NOT_SETTING(70005,"您还未配置快递查询"),
+ ORDER_SETTING_ERROR(70006,"系统订单配置异常"),
+ ALI_SMS_SETTING_ERROR(70007,"您还未配置阿里云短信"),
+ SMS_SIGN_EXIST_ERROR(70008, "短信签名已存在"),
/**
* 站内信
*/
- NOTICE_NOT_EXIST(80101, "当前消息模板不存在"),
+ NOTICE_NOT_EXIST(80001, "当前消息模板不存在"),
+ NOTICE_ERROR(80002, "修改站内信异常,请稍后重试"),
+ NOTICE_SEND_ERROR(80003, "发送站内信异常,请检查系统日志"),
- NOTICE_ERROR(80102, "修改站内信异常,请稍后重试"),
/**
* OSS
*/
- OSS_NOT_EXIST(80201, "OSS未配置"),
-
- OSS_EXCEPTION(80202, "文件上传失败,请稍后重试"),
+ OSS_NOT_EXIST(80101, "OSS未配置"),
+ OSS_EXCEPTION_ERROR(80102, "文件上传失败,请稍后重试"),
+ OSS_DELETE_ERROR(80102, "图片删除失败"),
/**
* 验证码
*/
- VERIFICATION_SEND_SUCCESS(80301, "短信验证码,发送成功"),
-
- VERIFICATION_ERROR(80302, "验证失败"),
-
- VERIFICATION_SMS_ERROR(80303, "短信验证码错误,请重新校验"),
-
- VERIFICATION_SMS_EXPIRED_ERROR(80304, "验证码已失效,请重新校验"),
-
- /**
- * 配置错误
- */
- ALIPAY_NOT_SETTING(80401, "支付宝支付未配置"),
-
- ALIPAY_EXCEPTION(80402, "支付宝支付错误,请稍后重试"),
-
- ALIPAY_PARAMS_EXCEPTION(80403, "支付宝参数异常"),
+ VERIFICATION_SEND_SUCCESS(80201, "短信验证码,发送成功"),
+ VERIFICATION_ERROR(80202, "验证失败"),
+ VERIFICATION_SMS_ERROR(80203, "短信验证码错误,请重新校验"),
+ VERIFICATION_SMS_EXPIRED_ERROR(80204, "验证码已失效,请重新校验"),
/**
* 微信相关异常
*/
- WECHAT_CONNECT_NOT_SETTING(80500, "微信联合登陆信息未配置"),
+ WECHAT_CONNECT_NOT_SETTING(80300, "微信联合登陆信息未配置"),
+ WECHAT_PAYMENT_NOT_SETTING(80301, "微信支付信息未配置"),
+ WECHAT_QRCODE_ERROR(80302, "微信二维码生成异常"),
+ WECHAT_MP_MESSAGE_ERROR(80303, "微信小程序小消息订阅异常"),
+ WECHAT_JSAPI_SIGN_ERROR(80304,"微信JsApi签名异常"),
+ WECHAT_CERT_ERROR(80305,"证书获取失败"),
+ WECHAT_MP_MESSAGE_TMPL_ERROR(80306,"未能获取到微信模版消息id"),
+ WECHAT_ERROR(80307,"微信接口异常"),
+ APP_VERSION_EXIST(80307, "APP版本已存在"),
- WECHAT_PAYMENT_NOT_SETTING(80501, "微信支付信息未配置"),
+ /**
+ * 其他
+ */
+ CUSTOM_WORDS_EXIST_ERROR(90000, "当前自定义分词已存在!"),
+ CUSTOM_WORDS_NOT_EXIST_ERROR(90001, "当前自定义分词不存在!"),
+ CUSTOM_WORDS_SECRET_KEY_ERROR(90002, "秘钥验证失败!"),
+ CONNECT_NOT_EXIST(90000,"登录方式不存在"),
- WECHAT_QRCODE_ERROR(80502, "微信二维码生成异常"),
-
- WECHAT_MP_MESSAGE_ERROR(80503, "微信小程序小消息订阅异常"),
-
- APP_VERSION_EXIST(80600, "APP版本已存在");
+ ;
private final Integer code;
private final String message;
diff --git a/framework/src/main/java/cn/lili/common/sms/impl/SmsUtilAliImplService.java b/framework/src/main/java/cn/lili/common/sms/impl/SmsUtilAliImplService.java
index 70bef42a..2b9bf7d1 100644
--- a/framework/src/main/java/cn/lili/common/sms/impl/SmsUtilAliImplService.java
+++ b/framework/src/main/java/cn/lili/common/sms/impl/SmsUtilAliImplService.java
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.lili.common.cache.Cache;
import cn.lili.common.cache.CachePrefix;
+import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.sms.AliSmsUtil;
@@ -64,7 +65,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
//获取短信配置
Setting setting = settingService.get(SettingEnum.SMS_SETTING.name());
if (StrUtil.isBlank(setting.getSettingValue())) {
- throw new ServiceException("您还未配置阿里云短信");
+ throw new ServiceException(ResultCode.ALI_SMS_SETTING_ERROR);
}
SmsSetting smsSetting = new Gson().fromJson(setting.getSettingValue(), SmsSetting.class);
@@ -351,7 +352,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
try {
Setting setting = settingService.get(SettingEnum.SMS_SETTING.name());
if (StrUtil.isBlank(setting.getSettingValue())) {
- throw new ServiceException("您还未配置阿里云短信");
+ throw new ServiceException(ResultCode.ALI_SMS_SETTING_ERROR);
}
SmsSetting smsSetting = new Gson().fromJson(setting.getSettingValue(), SmsSetting.class);
diff --git a/framework/src/main/java/cn/lili/common/token/base/generate/ManagerTokenGenerate.java b/framework/src/main/java/cn/lili/common/token/base/generate/ManagerTokenGenerate.java
index a58d1aa6..5b4d6e70 100644
--- a/framework/src/main/java/cn/lili/common/token/base/generate/ManagerTokenGenerate.java
+++ b/framework/src/main/java/cn/lili/common/token/base/generate/ManagerTokenGenerate.java
@@ -84,7 +84,7 @@ public class ManagerTokenGenerate extends AbstractTokenGenerate {
//for循环路径集合
for (String path : paths) {
//如果是超级权限 则计入超级权限
- if (menu.getIsSupper()) {
+ if (menu.getIsSupper() != null && menu.getIsSupper()) {
//如果已有超级权限,则这里就不做权限的累加
if (!superPermissions.contains(path)) {
superPermissions.add(path);
diff --git a/framework/src/main/java/cn/lili/common/token/base/generate/StoreTokenGenerate.java b/framework/src/main/java/cn/lili/common/token/base/generate/StoreTokenGenerate.java
index cf1a45f6..28b94c86 100644
--- a/framework/src/main/java/cn/lili/common/token/base/generate/StoreTokenGenerate.java
+++ b/framework/src/main/java/cn/lili/common/token/base/generate/StoreTokenGenerate.java
@@ -1,5 +1,6 @@
package cn.lili.common.token.base.generate;
+import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.AuthUser;
import cn.lili.common.security.enums.UserEnums;
@@ -19,7 +20,6 @@ import org.springframework.stereotype.Component;
*
* @author Chopper
* @version v4.0
- * @Description:
* @since 2020/11/16 10:51
*/
@Component
@@ -36,7 +36,7 @@ public class StoreTokenGenerate extends AbstractTokenGenerate {
//生成token
Member member = memberService.findByUsername(username);
if (!member.getHaveStore()) {
- throw new ServiceException("该会员未开通店铺");
+ throw new ServiceException(ResultCode.STORE_NOT_OPEN);
}
AuthUser user = new AuthUser(member.getUsername(), member.getId(), member.getNickName(), UserEnums.STORE);
LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
diff --git a/framework/src/main/java/cn/lili/common/utils/StringUtils.java b/framework/src/main/java/cn/lili/common/utils/StringUtils.java
index e97c61c4..b8e29aa7 100644
--- a/framework/src/main/java/cn/lili/common/utils/StringUtils.java
+++ b/framework/src/main/java/cn/lili/common/utils/StringUtils.java
@@ -1,5 +1,6 @@
package cn.lili.common.utils;
+import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import java.beans.BeanInfo;
@@ -61,7 +62,7 @@ public class StringUtils extends StrUtil {
return 0;
}
try {
- value = Integer.parseInt(obj.toString());
+ value = Convert.toInt(obj.toString());
} catch (Exception ex) {
if (checked) {
throw new RuntimeException("整型数字格式不正确");
diff --git a/framework/src/main/java/cn/lili/common/validation/impl/MobileValidator.java b/framework/src/main/java/cn/lili/common/validation/impl/MobileValidator.java
index 2b21b32c..bdcc2d70 100644
--- a/framework/src/main/java/cn/lili/common/validation/impl/MobileValidator.java
+++ b/framework/src/main/java/cn/lili/common/validation/impl/MobileValidator.java
@@ -8,26 +8,30 @@ import javax.validation.ConstraintValidatorContext;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
+/**
+ * 电话校验
+ * 支持手机号+电话同时校验
+ */
public class MobileValidator implements ConstraintValidator {
@Override
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
- Pattern p1 = null,p2 = null;
+ Pattern p1 = null, p2 = null, p3 = null;
Matcher m = null;
- boolean b = false;
- p1 = Pattern.compile("^[0][1-9]{2,3}-[0-9]{5,10}$"); // 验证带区号的
+ p1 = Pattern.compile("0\\d{2,3}[-]?\\d{7,8}|0\\d{2,3}\\s?\\d{7,8}|13[0-9]\\d{8}|15[1089]\\d{8}"); // 验证带区号的
p2 = Pattern.compile("^[1-9]{1}[0-9]{5,8}$"); // 验证没有区号的
- if(value.length() >9)
- { m = p1.matcher(value);
- b = m.matches();
- }else{
+ p3 = Pattern.compile("^0?(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$");// 验证手机号
+ if (value.length() == 11) {
+ m = p3.matcher(value);
+ } else if (value.length() > 9) {
+ m = p1.matcher(value);
+ } else {
m = p2.matcher(value);
- b = m.matches();
}
- return b;
+ return m.matches();
}
+
@Override
public void initialize(Mobile constraintAnnotation) {
diff --git a/framework/src/main/java/cn/lili/common/verification/service/impl/VerificationServiceImpl.java b/framework/src/main/java/cn/lili/common/verification/service/impl/VerificationServiceImpl.java
index 6321b365..53a87813 100644
--- a/framework/src/main/java/cn/lili/common/verification/service/impl/VerificationServiceImpl.java
+++ b/framework/src/main/java/cn/lili/common/verification/service/impl/VerificationServiceImpl.java
@@ -2,6 +2,7 @@ package cn.lili.common.verification.service.impl;
import cn.lili.common.cache.Cache;
import cn.lili.common.cache.CachePrefix;
+import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.utils.StringUtils;
import cn.lili.common.verification.SliderImageUtil;
@@ -47,7 +48,7 @@ public class VerificationServiceImpl implements VerificationService {
public Map createVerification(VerificationEnums verificationEnums, String uuid) throws IOException {
if (uuid == null) {
- throw new ServiceException("非法请求,请重新刷新页面操作");
+ throw new ServiceException(ResultCode.ILLEGAL_REQUEST_ERROR);
}
//获取验证码配置
diff --git a/framework/src/main/java/cn/lili/config/elasticsearch/ElasticsearchConfig.java b/framework/src/main/java/cn/lili/config/elasticsearch/ElasticsearchConfig.java
index 989220f8..e25bb9d7 100644
--- a/framework/src/main/java/cn/lili/config/elasticsearch/ElasticsearchConfig.java
+++ b/framework/src/main/java/cn/lili/config/elasticsearch/ElasticsearchConfig.java
@@ -1,5 +1,6 @@
package cn.lili.config.elasticsearch;
+import cn.hutool.core.convert.Convert;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpHost;
@@ -75,7 +76,7 @@ public class ElasticsearchConfig extends AbstractElasticsearchConfiguration {
HttpHost[] httpHosts = new HttpHost[clusterNodes.size()];
for (int i = 0; i < clusterNodes.size(); i++) {
String[] node = clusterNodes.get(i).split(":");
- httpHosts[i] = new HttpHost(node[0], Integer.parseInt(node[1]), elasticsearchProperties.getSchema());
+ httpHosts[i] = new HttpHost(node[0], Convert.toInt(node[1]), elasticsearchProperties.getSchema());
}
return httpHosts;
}
diff --git a/framework/src/main/java/cn/lili/config/sharding/CreateTimeShardingTableAlgorithm.java b/framework/src/main/java/cn/lili/config/sharding/CreateTimeShardingTableAlgorithm.java
index e640e877..ab83fc26 100644
--- a/framework/src/main/java/cn/lili/config/sharding/CreateTimeShardingTableAlgorithm.java
+++ b/framework/src/main/java/cn/lili/config/sharding/CreateTimeShardingTableAlgorithm.java
@@ -1,5 +1,6 @@
package cn.lili.config.sharding;
+import cn.hutool.core.convert.Convert;
import cn.lili.common.utils.DateUtil;
import com.google.common.collect.Range;
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm;
@@ -34,10 +35,10 @@ public class CreateTimeShardingTableAlgorithm implements PreciseShardingAlgorith
Collection collect = new ArrayList<>();
Range valueRange = rangeShardingValue.getValueRange();
- Integer startMonth = Integer.parseInt(DateUtil.toString(valueRange.lowerEndpoint().longValue(), "MM"));
- Integer endMonth = Integer.parseInt(DateUtil.toString(valueRange.upperEndpoint().longValue(), "MM"));
- Integer startYear = Integer.parseInt(DateUtil.toString(valueRange.lowerEndpoint().longValue(), "yyyy"));
- Integer endYear = Integer.parseInt(DateUtil.toString(valueRange.upperEndpoint().longValue(), "yyyy"));
+ Integer startMonth = Convert.toInt(DateUtil.toString(valueRange.lowerEndpoint().longValue(), "MM"));
+ Integer endMonth = Convert.toInt(DateUtil.toString(valueRange.upperEndpoint().longValue(), "MM"));
+ Integer startYear = Convert.toInt(DateUtil.toString(valueRange.lowerEndpoint().longValue(), "yyyy"));
+ Integer endYear = Convert.toInt(DateUtil.toString(valueRange.upperEndpoint().longValue(), "yyyy"));
//如果是同一年查询
//2020-1~2020-2
diff --git a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/CommodityServiceImpl.java b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/CommodityServiceImpl.java
index beabdc2e..65608071 100644
--- a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/CommodityServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/CommodityServiceImpl.java
@@ -4,6 +4,7 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
+import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.security.enums.UserEnums;
@@ -50,7 +51,8 @@ public class CommodityServiceImpl extends ServiceImpl impleme
public Boolean create(Studio studio) {
try {
//创建小程序直播
-// Map roomMap = wechatLivePlayerUtil.create(studio);
-// studio.setRoomId(Integer.parseInt(roomMap.get("roomId")));
-// studio.setQrCodeUrl(roomMap.get("qrcodeUrl"));
+ Map roomMap = wechatLivePlayerUtil.create(studio);
+ studio.setRoomId(Convert.toInt(roomMap.get("roomId")));
+ studio.setQrCodeUrl(roomMap.get("qrcodeUrl"));
studio.setStoreId(UserContext.getCurrentUser().getStoreId());
studio.setStatus(StudioStatusEnum.NEW.name());
//直播间添加成功发送直播间开启、关闭延时任务
@@ -72,7 +73,7 @@ public class StudioServiceImpl extends ServiceImpl impleme
//直播开启延时任务
BroadcastMessage broadcastMessage = new BroadcastMessage(studio.getId(), StudioStatusEnum.START.name());
TimeTriggerMsg timeTriggerMsg = new TimeTriggerMsg(TimeExecuteConstant.BROADCAST_EXECUTOR,
- Long.parseLong(studio.getStartTime()),
+ Long.parseLong(studio.getStartTime()) * 1000L,
broadcastMessage,
DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()),
rocketmqCustomProperties.getPromotionTopic());
@@ -83,7 +84,7 @@ public class StudioServiceImpl extends ServiceImpl impleme
//直播结束延时任务
broadcastMessage = new BroadcastMessage(studio.getId(), StudioStatusEnum.END.name());
timeTriggerMsg = new TimeTriggerMsg(TimeExecuteConstant.BROADCAST_EXECUTOR,
- Long.parseLong(studio.getEndTime()), broadcastMessage,
+ Long.parseLong(studio.getEndTime()) * 1000L, broadcastMessage,
DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()),
rocketmqCustomProperties.getPromotionTopic());
//发送促销活动开始的延时任务
@@ -108,8 +109,8 @@ public class StudioServiceImpl extends ServiceImpl impleme
this.timeTrigger.edit(
TimeExecuteConstant.BROADCAST_EXECUTOR,
broadcastMessage,
- Long.parseLong(oldStudio.getStartTime()),
- Long.parseLong(studio.getStartTime()),
+ Long.parseLong(oldStudio.getStartTime()) * 1000L,
+ Long.parseLong(studio.getStartTime()) * 1000L,
DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()),
DateUtil.getDelayTime(Long.parseLong(studio.getStartTime())),
rocketmqCustomProperties.getPromotionTopic());
@@ -119,8 +120,8 @@ public class StudioServiceImpl extends ServiceImpl impleme
this.timeTrigger.edit(
TimeExecuteConstant.BROADCAST_EXECUTOR,
broadcastMessage,
- Long.parseLong(oldStudio.getEndTime()),
- Long.parseLong(studio.getEndTime()),
+ Long.parseLong(oldStudio.getEndTime()) * 1000L,
+ Long.parseLong(studio.getEndTime()) * 1000L,
DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()),
DateUtil.getDelayTime(Long.parseLong(studio.getEndTime())),
rocketmqCustomProperties.getPromotionTopic());
@@ -200,7 +201,7 @@ public class StudioServiceImpl extends ServiceImpl impleme
.eq(recommend != null, "recommend", true)
.eq(status != null, "status", status)
.orderByDesc("create_time");
- if (UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) {
+ if (UserContext.getCurrentUser() != null && UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) {
queryWrapper.eq("store_id", UserContext.getCurrentUser().getStoreId());
}
return this.page(PageUtil.initPage(pageVO), queryWrapper);
diff --git a/framework/src/main/java/cn/lili/modules/connect/request/AuthAlipayRequest.java b/framework/src/main/java/cn/lili/modules/connect/request/AuthAlipayRequest.java
index b51f3d2d..89bb41d3 100644
--- a/framework/src/main/java/cn/lili/modules/connect/request/AuthAlipayRequest.java
+++ b/framework/src/main/java/cn/lili/modules/connect/request/AuthAlipayRequest.java
@@ -1,5 +1,6 @@
package cn.lili.modules.connect.request;
+import cn.hutool.core.convert.Convert;
import cn.lili.common.cache.Cache;
import cn.lili.common.utils.StringUtils;
import cn.lili.common.utils.UrlBuilder;
@@ -56,7 +57,7 @@ public class AuthAlipayRequest extends AuthDefaultRequest {
return AuthToken.builder()
.accessToken(response.getAccessToken())
.uid(response.getUserId())
- .expireIn(Integer.parseInt(response.getExpiresIn()))
+ .expireIn(Convert.toInt(response.getExpiresIn()))
.refreshToken(response.getRefreshToken())
.build();
}
@@ -86,7 +87,7 @@ public class AuthAlipayRequest extends AuthDefaultRequest {
.data(AuthToken.builder()
.accessToken(response.getAccessToken())
.uid(response.getUserId())
- .expireIn(Integer.parseInt(response.getExpiresIn()))
+ .expireIn(Convert.toInt(response.getExpiresIn()))
.refreshToken(response.getRefreshToken())
.build())
.build();
diff --git a/framework/src/main/java/cn/lili/modules/connect/request/AuthQQRequest.java b/framework/src/main/java/cn/lili/modules/connect/request/AuthQQRequest.java
index 164ec3a1..15299731 100644
--- a/framework/src/main/java/cn/lili/modules/connect/request/AuthQQRequest.java
+++ b/framework/src/main/java/cn/lili/modules/connect/request/AuthQQRequest.java
@@ -1,5 +1,6 @@
package cn.lili.modules.connect.request;
+import cn.hutool.core.convert.Convert;
import cn.lili.common.cache.Cache;
import cn.lili.common.utils.StringUtils;
import cn.lili.common.utils.UrlBuilder;
@@ -118,7 +119,7 @@ public class AuthQQRequest extends AuthDefaultRequest {
}
return AuthToken.builder()
.accessToken(accessTokenObject.get("access_token"))
- .expireIn(Integer.parseInt(accessTokenObject.getOrDefault("expires_in", "0")))
+ .expireIn(Convert.toInt(accessTokenObject.getOrDefault("expires_in", "0")))
.refreshToken(accessTokenObject.get("refresh_token"))
.build();
}
diff --git a/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java b/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java
index e56dae7a..e9aa36f5 100644
--- a/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java
@@ -108,11 +108,11 @@ public class ConnectServiceImpl extends ServiceImpl impl
CookieUtil.addCookie(CONNECT_TYPE, type, 1800, ThreadContextHolder.getHttpResponse());
//自动登录失败,则把信息缓存起来
cache.put(ConnectService.cacheKey(type, uuid), authUser, 30L, TimeUnit.MINUTES);
- throw new ServiceException("未绑定用户");
+ throw new ServiceException(ResultCode.USER_NOT_BINDING);
}
} catch (Exception e) {
log.error("联合登陆异常:", e);
- throw new ServiceException("未知错误,请稍后重试");
+ throw new ServiceException(ResultCode.ERROR);
}
return token;
}
diff --git a/framework/src/main/java/cn/lili/modules/connect/util/ConnectUtil.java b/framework/src/main/java/cn/lili/modules/connect/util/ConnectUtil.java
index acf388a3..4dd3c02d 100644
--- a/framework/src/main/java/cn/lili/modules/connect/util/ConnectUtil.java
+++ b/framework/src/main/java/cn/lili/modules/connect/util/ConnectUtil.java
@@ -137,7 +137,7 @@ public class ConnectUtil {
public AuthRequest getAuthRequest(String type) {
ConnectAuthEnum authInterface = ConnectAuthEnum.valueOf(type);
if (authInterface == null) {
- throw new ServiceException("错误的登录方式");
+ throw new ServiceException(ResultCode.CONNECT_NOT_EXIST);
}
AuthRequest authRequest = null;
switch (authInterface) {
diff --git a/framework/src/main/java/cn/lili/modules/distribution/entity/dos/Distribution.java b/framework/src/main/java/cn/lili/modules/distribution/entity/dos/Distribution.java
index ce31ee33..7615e194 100644
--- a/framework/src/main/java/cn/lili/modules/distribution/entity/dos/Distribution.java
+++ b/framework/src/main/java/cn/lili/modules/distribution/entity/dos/Distribution.java
@@ -1,6 +1,8 @@
package cn.lili.modules.distribution.entity.dos;
import cn.lili.base.BaseEntity;
+import cn.lili.common.utils.BeanUtil;
+import cn.lili.modules.distribution.entity.dto.DistributionApplyDTO;
import cn.lili.modules.distribution.entity.enums.DistributionStatusEnum;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
@@ -10,6 +12,8 @@ import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.Table;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Size;
/**
* 分销员对象
@@ -28,13 +32,12 @@ public class Distribution extends BaseEntity {
private static final long serialVersionUID = -4878132663540847325L;
- public Distribution(String memberId, String memberName, String name, String idNumber) {
+ public Distribution(String memberId, String memberName, DistributionApplyDTO distributionApplyDTO) {
this.memberId = memberId;
this.memberName = memberName;
- this.name = name;
- this.idNumber = idNumber;
distributionOrderCount=0;
this.distributionStatus = DistributionStatusEnum.APPLY.name();
+ BeanUtil.copyProperties(distributionApplyDTO, this);
}
@ApiModelProperty(value = "会员id")
@@ -67,4 +70,19 @@ public class Distribution extends BaseEntity {
@ApiModelProperty(value = "分销员状态", required = true)
private String distributionStatus;
+ @Size(min = 1, max = 200, message = "结算银行开户行名称长度为1-200位")
+ @NotBlank(message = "结算银行开户行名称不能为空")
+ @ApiModelProperty(value = "结算银行开户行名称")
+ private String settlementBankAccountName;
+
+ @Size(min = 1, max = 200, message = "结算银行开户账号长度为1-200位")
+ @NotBlank(message = "结算银行开户账号不能为空")
+ @ApiModelProperty(value = "结算银行开户账号")
+ private String settlementBankAccountNum;
+
+ @Size(min = 1, max = 200, message = "结算银行开户支行名称长度为1-200位")
+ @NotBlank(message = "结算银行开户支行名称不能为空")
+ @ApiModelProperty(value = "结算银行开户支行名称")
+ private String settlementBankBranchName;
+
}
\ No newline at end of file
diff --git a/framework/src/main/java/cn/lili/modules/distribution/entity/dos/DistributionSelectedGoods.java b/framework/src/main/java/cn/lili/modules/distribution/entity/dos/DistributionSelectedGoods.java
index 5174ad08..620f6e90 100644
--- a/framework/src/main/java/cn/lili/modules/distribution/entity/dos/DistributionSelectedGoods.java
+++ b/framework/src/main/java/cn/lili/modules/distribution/entity/dos/DistributionSelectedGoods.java
@@ -38,7 +38,7 @@ public class DistributionSelectedGoods {
@ApiModelProperty(value = "分销员ID")
private String distributionId;
- @ApiModelProperty(value = "分销员品ID")
+ @ApiModelProperty(value = "分销商品ID")
private String distributionGoodsId;
public DistributionSelectedGoods(String distributionId, String distributionGoodsId) {
diff --git a/framework/src/main/java/cn/lili/modules/distribution/entity/dto/DistributionApplyDTO.java b/framework/src/main/java/cn/lili/modules/distribution/entity/dto/DistributionApplyDTO.java
new file mode 100644
index 00000000..b98026de
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/distribution/entity/dto/DistributionApplyDTO.java
@@ -0,0 +1,40 @@
+package cn.lili.modules.distribution.entity.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Size;
+
+/**
+ * 分销员申请DTO
+ * @author Bulbasaur
+ * @date: 2021/6/30 11:07 上午
+ *
+ */
+@Data
+public class DistributionApplyDTO {
+
+ @NotBlank(message = "姓名不能为空")
+ @ApiModelProperty(value = "会员姓名")
+ private String name;
+
+ @NotBlank(message = "身份证号不能为空")
+ @ApiModelProperty(value = "身份证号")
+ private String idNumber;
+
+ @Size(min = 1, max = 200, message = "结算银行开户行名称长度为1-200位")
+ @NotBlank(message = "结算银行开户行名称不能为空")
+ @ApiModelProperty(value = "结算银行开户行名称")
+ private String settlementBankAccountName;
+
+ @Size(min = 1, max = 200, message = "结算银行开户账号长度为1-200位")
+ @NotBlank(message = "结算银行开户账号不能为空")
+ @ApiModelProperty(value = "结算银行开户账号")
+ private String settlementBankAccountNum;
+
+ @Size(min = 1, max = 200, message = "结算银行开户支行名称长度为1-200位")
+ @NotBlank(message = "结算银行开户支行名称不能为空")
+ @ApiModelProperty(value = "结算银行开户支行名称")
+ private String settlementBankBranchName;
+}
diff --git a/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionGoodsVO.java b/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionGoodsVO.java
index 73a075d9..07d266d1 100644
--- a/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionGoodsVO.java
+++ b/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionGoodsVO.java
@@ -39,6 +39,9 @@ public class DistributionGoodsVO {
@ApiModelProperty(value = "商品编号")
private String sn;
+ @ApiModelProperty(value = "商品ID")
+ private String goodsId;
+
@ApiModelProperty(value = "规格ID")
private String skuId;
diff --git a/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionOrderSearchParams.java b/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionOrderSearchParams.java
index 9a4512e6..befe4480 100644
--- a/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionOrderSearchParams.java
+++ b/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionOrderSearchParams.java
@@ -55,8 +55,8 @@ public class DistributionOrderSearchParams extends PageVO {
queryWrapper.like(StringUtils.isNotBlank(distributionName), "distribution_name", distributionName);
queryWrapper.eq(StringUtils.isNotBlank(distributionOrderStatus), "distribution_order_status", distributionOrderStatus);
queryWrapper.eq(StringUtils.isNotBlank(orderSn), "order_sn", orderSn);
- queryWrapper.eq(StringUtils.isNotBlank(StringUtils.toString(distributionId)), "distribution_id", distributionId);
- queryWrapper.eq(StringUtils.isNotBlank(StringUtils.toString(storeId)), "store_id", storeId);
+ queryWrapper.eq(StringUtils.isNotBlank(distributionId), "distribution_id", distributionId);
+ queryWrapper.eq(StringUtils.isNotBlank(storeId), "store_id", storeId);
if (endTime != null && startTime != null) {
queryWrapper.between("create_time", startTime, endTime);
}
diff --git a/framework/src/main/java/cn/lili/modules/distribution/mapper/DistributionMapper.java b/framework/src/main/java/cn/lili/modules/distribution/mapper/DistributionMapper.java
index 4a43c512..cd32c80b 100644
--- a/framework/src/main/java/cn/lili/modules/distribution/mapper/DistributionMapper.java
+++ b/framework/src/main/java/cn/lili/modules/distribution/mapper/DistributionMapper.java
@@ -16,6 +16,6 @@ public interface DistributionMapper extends BaseMapper {
@Update("UPDATE li_distribution set can_rebate = can_rebate+#{canRebate} WHERE id = #{distributionId}")
void subCanRebate(Double canRebate,String distributionId);
- @Update("UPDATE li_distribution set can_rebate = (can_rebate+#{canRebate}) AND rebate_total=(rebate_total+#{canRebate}) AND distribution_order_count=(distribution_order_count+1) WHERE id = #{distributionId}")
+ @Update("UPDATE li_distribution set can_rebate = (can_rebate+#{canRebate}) , rebate_total=(rebate_total+#{canRebate}) , distribution_order_count=(distribution_order_count+1) WHERE id = #{distributionId}")
void addCanRebate(Double canRebate,String distributionId);
}
\ No newline at end of file
diff --git a/framework/src/main/java/cn/lili/modules/distribution/service/DistributionSelectedGoodsService.java b/framework/src/main/java/cn/lili/modules/distribution/service/DistributionSelectedGoodsService.java
index 3912291d..994d5d8a 100644
--- a/framework/src/main/java/cn/lili/modules/distribution/service/DistributionSelectedGoodsService.java
+++ b/framework/src/main/java/cn/lili/modules/distribution/service/DistributionSelectedGoodsService.java
@@ -16,4 +16,11 @@ public interface DistributionSelectedGoodsService extends IService {
*
* @return
*/
- Distribution applyDistribution(String name, String idNumber);
+ Distribution applyDistribution(DistributionApplyDTO distributionApplyDTO);
/**
* 审核分销申请
diff --git a/framework/src/main/java/cn/lili/modules/distribution/serviceimpl/DistributionSelectedGoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/distribution/serviceimpl/DistributionSelectedGoodsServiceImpl.java
index b7cac66c..12f97949 100644
--- a/framework/src/main/java/cn/lili/modules/distribution/serviceimpl/DistributionSelectedGoodsServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/distribution/serviceimpl/DistributionSelectedGoodsServiceImpl.java
@@ -4,6 +4,7 @@ import cn.lili.modules.distribution.entity.dos.DistributionSelectedGoods;
import cn.lili.modules.distribution.mapper.DistributionSelectedGoodsMapper;
import cn.lili.modules.distribution.service.DistributionSelectedGoodsService;
import cn.lili.modules.distribution.service.DistributionService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,4 +33,15 @@ public class DistributionSelectedGoodsServiceImpl extends ServiceImpl()
+ .eq(DistributionSelectedGoods::getDistributionGoodsId,distributionGoodsId)
+ .eq(DistributionSelectedGoods::getDistributionId,distributionId));
+ }
}
diff --git a/framework/src/main/java/cn/lili/modules/distribution/serviceimpl/DistributionServiceImpl.java b/framework/src/main/java/cn/lili/modules/distribution/serviceimpl/DistributionServiceImpl.java
index 70d60870..f3c329ee 100644
--- a/framework/src/main/java/cn/lili/modules/distribution/serviceimpl/DistributionServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/distribution/serviceimpl/DistributionServiceImpl.java
@@ -6,9 +6,11 @@ import cn.lili.common.cache.CachePrefix;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.context.UserContext;
+import cn.lili.common.utils.BeanUtil;
import cn.lili.common.utils.PageUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.modules.distribution.entity.dos.Distribution;
+import cn.lili.modules.distribution.entity.dto.DistributionApplyDTO;
import cn.lili.modules.distribution.entity.dto.DistributionSearchParams;
import cn.lili.modules.distribution.entity.enums.DistributionStatusEnum;
import cn.lili.modules.distribution.mapper.DistributionMapper;
@@ -64,7 +66,7 @@ public class DistributionServiceImpl extends ServiceImpl {
/**
- * 下架所有商家商品
+ * 根据店铺ID获取商品ID列表
*
- * @param storeId
+ * @param storeId 店铺ID
*/
- @Update("update li_goods set market_enable = 0 WHERE store_id = #{storeId}")
- void underStoreGoods(String storeId);
+ @Select("SELECT id FROM li_goods WHERE store_id = #{storeId}")
+ List getGoodsIdByStoreId(String storeId);
@Update("UPDATE li_goods SET comment_num = comment_num + #{commentNum} WHERE id = #{goodsId}")
void addGoodsCommentNum(Integer commentNum, String goodsId);
diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/BrandServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/BrandServiceImpl.java
index ebff552a..0a6f394a 100644
--- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/BrandServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/BrandServiceImpl.java
@@ -1,5 +1,6 @@
package cn.lili.modules.goods.serviceimpl;
+import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.utils.PageUtil;
import cn.lili.modules.goods.entity.dos.Brand;
@@ -62,7 +63,7 @@ public class BrandServiceImpl extends ServiceImpl implements
public boolean addBrand(BrandVO brandVO) {
if (getOne(new LambdaQueryWrapper().eq(Brand::getName, brandVO.getName())) != null) {
- throw new ServiceException("品牌名称重复!");
+ throw new ServiceException(ResultCode.BRAND_NAME_EXIST_ERROR);
}
return this.save(brandVO);
}
@@ -71,7 +72,7 @@ public class BrandServiceImpl extends ServiceImpl implements
public boolean updateBrand(BrandVO brandVO) {
this.checkExist(brandVO.getId());
if (getOne(new LambdaQueryWrapper().eq(Brand::getName, brandVO.getName()).ne(Brand::getId, brandVO.getId())) != null) {
- throw new ServiceException("品牌名称重复!");
+ throw new ServiceException(ResultCode.BRAND_NAME_EXIST_ERROR);
}
return this.updateById(brandVO);
}
@@ -80,7 +81,7 @@ public class BrandServiceImpl extends ServiceImpl implements
public boolean brandDisable(String brandId, boolean disable) {
Brand brand = this.checkExist(brandId);
if (Boolean.TRUE.equals(disable) && !categoryBrandService.getCategoryBrandListByBrandId(brandId).isEmpty()) {
- throw new ServiceException("当前品牌下存在分类不可禁用");
+ throw new ServiceException(ResultCode.BRAND_USE_DISABLE_ERROR);
}
brand.setDeleteFlag(disable);
return updateById(brand);
@@ -90,7 +91,7 @@ public class BrandServiceImpl extends ServiceImpl implements
Brand brand = getById(brandId);
if (brand == null) {
log.error("品牌ID为" + brandId + "的品牌不存在");
- throw new ServiceException();
+ throw new ServiceException(ResultCode.BRAND_NOT_EXIST);
}
return brand;
}
diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java
index 6f350d1c..37907ce9 100644
--- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java
@@ -3,6 +3,7 @@ package cn.lili.modules.goods.serviceimpl;
import cn.hutool.core.util.StrUtil;
import cn.lili.common.cache.Cache;
import cn.lili.common.cache.CachePrefix;
+import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.modules.goods.entity.dos.Category;
import cn.lili.modules.goods.entity.dos.CategoryParameterGroup;
@@ -174,7 +175,7 @@ public class CategoryServiceImpl extends ServiceImpl i
if (category.getParentId() != null && !category.getParentId().equals("0")) {
Category parentCategory = this.getById(category.getParentId());
if (!parentCategory.getDeleteFlag().equals(category.getDeleteFlag())) {
- throw new ServiceException("子类状态不能与父类不一致!");
+ throw new ServiceException(ResultCode.CATEGORY_DELETE_FLAG_ERROR);
}
}
UpdateWrapper updateWrapper = new UpdateWrapper<>();
diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java
index a2560973..9b15e69d 100644
--- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java
@@ -93,7 +93,10 @@ public class GoodsServiceImpl extends ServiceImpl implements
@Override
public void underStoreGoods(String storeId) {
- this.baseMapper.underStoreGoods(storeId);
+ //获取商品ID列表
+ List list= this.baseMapper.getGoodsIdByStoreId(storeId);
+ //下架店铺下的商品
+ updateGoodsMarketAble(list,GoodsStatusEnum.DOWN,"店铺关闭");
}
@Override
@@ -276,7 +279,7 @@ public class GoodsServiceImpl extends ServiceImpl implements
//商品删除消息
String destination = rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.GOODS_DELETE.name();
//发送mq消息
- rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(goods.getStoreId()), RocketmqSendCallbackBuilder.commonCallback());
+ rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(goods), RocketmqSendCallbackBuilder.commonCallback());
}
return true;
@@ -364,11 +367,11 @@ public class GoodsServiceImpl extends ServiceImpl implements
if(parameters.getId().equals(goodsParamsItemDTO.getParamId())){
//校验是否可以索引参数是否正确
if(!parameters.getIsIndex().equals(goodsParamsItemDTO.getIsIndex())){
- throw new ServiceException("商品参数错误,刷新后重试");
+ throw new ServiceException(ResultCode.GOODS_PARAMS_ERROR);
}
//校验是否必填参数是否正确
if(!parameters.getRequired().equals(goodsParamsItemDTO.getRequired())){
- throw new ServiceException("商品参数错误,刷新后重试");
+ throw new ServiceException(ResultCode.GOODS_PARAMS_ERROR);
}
}
}
@@ -392,16 +395,16 @@ public class GoodsServiceImpl extends ServiceImpl implements
switch (goods.getGoodsType()) {
case "PHYSICAL_GOODS":
if (goods.getTemplateId().equals("0")) {
- throw new ServiceException("实物商品需选择配送模板");
+ throw new ServiceException(ResultCode.PHYSICAL_GOODS_NEED_TEMP);
}
break;
case "VIRTUAL_GOODS":
if (!goods.getTemplateId().equals("0")) {
- throw new ServiceException("虚拟商品不需要选择配送模板");
+ throw new ServiceException(ResultCode.VIRTUAL_GOODS_NOT_NEED_TEMP);
}
break;
default:
- throw new ServiceException("需选择商品类型");
+ throw new ServiceException(ResultCode.GOODS_TYPE_ERROR);
}
//检查商品是否存在--修改商品时使用
if (goods.getId() != null) {
@@ -432,7 +435,7 @@ public class GoodsServiceImpl extends ServiceImpl implements
goods.setStoreName(storeDetail.getStoreName());
goods.setSelfOperated(storeDetail.getSelfOperated());
} else {
- throw new ServiceException("当前未登录店铺");
+ throw new ServiceException(ResultCode.STORE_NOT_LOGIN_ERROR);
}
}
diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java
index adfcb2c9..e6361cd3 100644
--- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java
@@ -96,7 +96,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl i
// 添加商品sku
newSkuList = this.addGoodsSku(skuList, goods);
} else {
- throw new ServiceException("规格必须要有一个!");
+ throw new ServiceException(ResultCode.MUST_HAVE_GOODS_SKU);
}
this.updateStock(newSkuList);
@@ -107,7 +107,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl i
public void update(List