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/member/MemberMessageBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/member/MemberMessageBuyerController.java
index 1dae47d7..0ca41606 100644
--- a/buyer-api/src/main/java/cn/lili/controller/member/MemberMessageBuyerController.java
+++ b/buyer-api/src/main/java/cn/lili/controller/member/MemberMessageBuyerController.java
@@ -1,6 +1,7 @@
package cn.lili.controller.member;
import cn.lili.common.enums.ResultUtil;
+import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.message.entity.enums.MessageStatusEnum;
@@ -34,21 +35,23 @@ public class MemberMessageBuyerController {
@ApiOperation(value = "分页获取会员站内消息")
@GetMapping
public ResultMessage> page(MemberMessageQueryVO memberMessageQueryVO, PageVO page) {
+ memberMessageQueryVO.setMemberId(UserContext.getCurrentUser().getId());
return ResultUtil.data(memberMessageService.getPage(memberMessageQueryVO, page));
}
@ApiOperation(value = "消息已读")
@ApiImplicitParam(name = "messageId", value = "会员消息id", required = true, paramType = "path")
- @PutMapping
- public ResultMessage read(@PathVariable String messageId) {
+ @PutMapping("/{message_id}")
+ public ResultMessage read(@PathVariable("message_id") String messageId) {
return ResultUtil.data(memberMessageService.editStatus(MessageStatusEnum.ALREADY_READY.name(), messageId));
}
- @ApiOperation(value = "消息删除")
+ @ApiOperation(value = "消息放入回收站")
@ApiImplicitParam(name = "messageId", value = "会员消息id", required = true, paramType = "path")
- @DeleteMapping
- public ResultMessage deleteMessage(@PathVariable String messageId) {
- return ResultUtil.data(memberMessageService.deleteMessage(messageId));
+ @DeleteMapping("/{message_id}")
+ public ResultMessage deleteMessage(@PathVariable("message_id") String messageId) {
+ return ResultUtil.data(memberMessageService.editStatus(MessageStatusEnum.ALREADY_REMOVE.name(), messageId));
+
}
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..fd9bbe3a 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
@@ -53,7 +53,7 @@ public class DistributionBuyerController {
@ApiOperation(value = "获取分销员分页订单列表")
@GetMapping("/distributionOrder")
public ResultMessage> distributionOrderPage(DistributionOrderSearchParams distributionOrderSearchParams) {
- distributionOrderSearchParams.setDistributionId(UserContext.getCurrentUser().getId());
+ distributionOrderSearchParams.setDistributionId(distributionService.getDistribution().getId());
return ResultUtil.data(distributionOrderService.getDistributionOrderPage(distributionOrderSearchParams));
}
diff --git a/buyer-api/src/main/java/cn/lili/controller/passport/MemberBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/passport/MemberBuyerController.java
index d909135c..a9981b3d 100644
--- a/buyer-api/src/main/java/cn/lili/controller/passport/MemberBuyerController.java
+++ b/buyer-api/src/main/java/cn/lili/controller/passport/MemberBuyerController.java
@@ -63,9 +63,9 @@ public class MemberBuyerController {
public ResultMessage
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/VerificationOrderExecute.java b/consumer/src/main/java/cn/lili/event/impl/VerificationOrderExecute.java
index 95e2e3a8..0b696158 100644
--- a/consumer/src/main/java/cn/lili/event/impl/VerificationOrderExecute.java
+++ b/consumer/src/main/java/cn/lili/event/impl/VerificationOrderExecute.java
@@ -4,11 +4,16 @@ import cn.hutool.core.util.RandomUtil;
import cn.lili.common.utils.CommonUtil;
import cn.lili.event.OrderStatusChangeEvent;
import cn.lili.modules.order.order.entity.dos.Order;
+import cn.lili.modules.order.order.entity.dos.OrderItem;
import cn.lili.modules.order.order.entity.dto.OrderMessage;
+import cn.lili.modules.order.order.entity.enums.OrderComplaintStatusEnum;
+import cn.lili.modules.order.order.entity.enums.OrderItemAfterSaleStatusEnum;
import cn.lili.modules.order.order.entity.enums.OrderStatusEnum;
+import cn.lili.modules.order.order.service.OrderItemService;
import cn.lili.modules.order.order.service.OrderService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -23,7 +28,8 @@ public class VerificationOrderExecute implements OrderStatusChangeEvent {
@Autowired
private OrderService orderService;
-
+ @Autowired
+ private OrderItemService orderItemService;
@Override
public void orderChange(OrderMessage orderMessage) {
//订单状态为待核验,添加订单添加核验码
@@ -36,6 +42,10 @@ public class VerificationOrderExecute implements OrderStatusChangeEvent {
orderService.update(new LambdaUpdateWrapper()
.set(Order::getVerificationCode, code)
.eq(Order::getSn, orderMessage.getOrderSn()));
+ //修改虚拟订单货物可以进行售后、投诉
+ orderItemService.update(new LambdaUpdateWrapper().eq(OrderItem::getOrderSn, orderMessage.getOrderSn())
+ .set(OrderItem::getAfterSaleStatus, OrderItemAfterSaleStatusEnum.NOT_APPLIED)
+ .set(OrderItem::getCommentStatus, OrderComplaintStatusEnum.NO_APPLY));
}
}
diff --git a/consumer/src/main/java/cn/lili/listener/NoticeSendMessageListener.java b/consumer/src/main/java/cn/lili/listener/NoticeSendMessageListener.java
index 01433f64..659c1c53 100644
--- a/consumer/src/main/java/cn/lili/listener/NoticeSendMessageListener.java
+++ b/consumer/src/main/java/cn/lili/listener/NoticeSendMessageListener.java
@@ -148,7 +148,7 @@ public class NoticeSendMessageListener implements RocketMQListener {
Integer memberNum = memberService.getMemberNum(memberSearchVO);
//构建分页查询参数
//100条查一次
- Integer pageSize = 200;
+ Integer pageSize = 100;
Integer pageCount = 0;
pageCount = memberNum / pageSize;
pageCount = memberNum % pageSize > 0 ? pageCount + 1 : pageCount;
diff --git a/consumer/src/main/java/cn/lili/timetask/handler/impl/coupon/CouponActivityExecute.java b/consumer/src/main/java/cn/lili/timetask/handler/impl/coupon/CouponActivityExecute.java
deleted file mode 100644
index f960098f..00000000
--- a/consumer/src/main/java/cn/lili/timetask/handler/impl/coupon/CouponActivityExecute.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package cn.lili.timetask.handler.impl.coupon;
-
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.lili.modules.promotion.entity.dos.CouponActivity;
-import cn.lili.modules.promotion.entity.enums.CouponActivityTypeEnum;
-import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum;
-import cn.lili.modules.promotion.service.CouponActivityService;
-import cn.lili.timetask.handler.EveryMinuteExecute;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-/**
- * 优惠券活动状态监测
- *
- * @author Bulbasaur
- * @date: 2021/5/24 10:08 上午
- */
-@Component
-public class CouponActivityExecute implements EveryMinuteExecute {
-
- @Autowired
- private CouponActivityService couponActivityService;
-
- @Override
- public void execute() {
- //精确发券活动
- specify();
- //注册赠券的活动
- registered();
- }
-
- /**
- * 监测精确发券活动
- * 达到活动时间发送优惠券
- */
- private void specify(){
- DateTime dateTime=DateUtil.date();
- List couponActivities=couponActivityService.list(new LambdaQueryWrapper()
- .eq(CouponActivity::getCouponActivityType, CouponActivityTypeEnum.SPECIFY.name())
- .le(CouponActivity::getStartTime, dateTime)
- .eq(CouponActivity::getPromotionStatus,PromotionStatusEnum.NEW.name()));
- //如果有符合要求的优惠券活动,发送优惠券
- if(couponActivities.size()>0){
- for (CouponActivity couponActivity:couponActivities) {
- couponActivityService.specify(couponActivity.getId());
-
- //修改精准发券优惠券活动状态
- couponActivityService.update(new LambdaUpdateWrapper()
- .eq(CouponActivity::getId,couponActivity.getId())
- .set(CouponActivity::getPromotionStatus,PromotionStatusEnum.END.name()));
- }
- }
-
- }
- /**
- * 注册赠券活动状态监测
- */
- private void registered(){
- //开启注册赠券优惠券活动
- LambdaUpdateWrapper lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
- lambdaUpdateWrapper.eq(CouponActivity::getCouponActivityType, CouponActivityTypeEnum.REGISTERED.name())
- .eq(CouponActivity::getPromotionStatus, PromotionStatusEnum.NEW.name())
- .le(CouponActivity::getStartTime, DateUtil.date())
- .set(CouponActivity::getPromotionStatus,PromotionStatusEnum.START.name());
- couponActivityService.update(lambdaUpdateWrapper);
-
- //关闭注册赠券优惠券活动
- LambdaUpdateWrapper endWrapper = new LambdaUpdateWrapper<>();
- endWrapper.eq(CouponActivity::getCouponActivityType, CouponActivityTypeEnum.REGISTERED.name())
- .eq(CouponActivity::getPromotionStatus, PromotionStatusEnum.START.name())
- .le(CouponActivity::getEndTime, DateUtil.date())
- .set(CouponActivity::getPromotionStatus,PromotionStatusEnum.END.name());
- couponActivityService.update(endWrapper);
- }
-}
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/enums/ResultCode.java b/framework/src/main/java/cn/lili/common/enums/ResultCode.java
index bc0b33c2..26490d88 100644
--- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java
+++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java
@@ -51,7 +51,7 @@ public enum ResultCode {
/**
* 商品
*/
- GOODS_ERROR(11010, "读取商品异常"),
+ GOODS_ERROR(11001, "商品异常,请稍后重试"),
GOODS_NOT_EXIST(11001, "商品已下架"),
GOODS_NAME_ERROR(11002, "商品名称不正确,名称应为2-50字符"),
GOODS_UNDER_ERROR(11003, "商品下架失败"),
@@ -63,6 +63,7 @@ public enum ResultCode {
GOODS_SKU_COST_ERROR(11009, "商品SKU成本价不能小于等于0"),
GOODS_SKU_WEIGHT_ERROR(11010, "商品重量不能为负数"),
GOODS_SKU_QUANTITY_ERROR(11011, "商品库存数量不能为负数"),
+ GOODS_SKU_QUANTITY_NOT_ENOUGH(11011, "商品库存不足"),
/**
* 参数
@@ -196,6 +197,10 @@ public enum ResultCode {
ORDER_DELIVER_NUM_ERROR(31010, "没有待发货的订单"),
+ ORDER_NOT_SUPPORT_DISTRIBUTION(31011, "购物车中包含不支持配送的商品,请重新选择收货地址,或者重新选择商品"),
+
+ ORDER_CAN_NOT_CANCEL(31012, "当前订单状态不可取消"),
+
/**
* 支付
*/
@@ -223,6 +228,8 @@ public enum ResultCode {
PAY_NOT_EXIST_ORDER(32011, "支付订单不存在"),
+ CAN_NOT_RECHARGE_WALLET(32012, "不能使用余额进行充值"),
+
/**
* 售后
*/
@@ -313,6 +320,11 @@ public enum ResultCode {
FULL_DISCOUNT_EDIT_DELETE(43002, "删除满优惠活动成功"),
+ /**
+ * 直播
+ */
+ STODIO_GOODS_EXIST_ERROR(44001,"直播商品已存在"),
+
/**
* 店铺
*/
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/validation/Mobile.java b/framework/src/main/java/cn/lili/common/validation/Mobile.java
index 374b37f0..578888bc 100644
--- a/framework/src/main/java/cn/lili/common/validation/Mobile.java
+++ b/framework/src/main/java/cn/lili/common/validation/Mobile.java
@@ -1,6 +1,7 @@
package cn.lili.common.validation;
import cn.lili.common.validation.impl.MobileValidator;
+import cn.lili.common.validation.impl.PhoneValidator;
import javax.validation.Constraint;
import javax.validation.Payload;
@@ -12,7 +13,7 @@ import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
- * 手机号码校验注解
+ * 电话号码校验注解
*
* @author Bulbasaur
*/
@@ -22,9 +23,9 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Constraint(validatedBy = {MobileValidator.class})
public @interface Mobile {
- String regexp() default "1[3|4|5|7|8]\\d{9}";
+ String regexp() default "";
- String message() default "手机号码格式不正确";
+ String message() default "电话号码格式不正确";
Class>[] groups() default {};
diff --git a/framework/src/main/java/cn/lili/common/validation/Phone.java b/framework/src/main/java/cn/lili/common/validation/Phone.java
new file mode 100644
index 00000000..9acdd3b9
--- /dev/null
+++ b/framework/src/main/java/cn/lili/common/validation/Phone.java
@@ -0,0 +1,32 @@
+package cn.lili.common.validation;
+
+import cn.lili.common.validation.impl.PhoneValidator;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * 手机号码校验注解
+ *
+ * @author Bulbasaur
+ */
+@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})
+@Retention(RUNTIME)
+@Documented
+@Constraint(validatedBy = {PhoneValidator.class})
+public @interface Phone {
+
+ String regexp() default "1[3|4|5|7|8]\\d{9}";
+
+ String message() default "手机号码格式不正确";
+
+ Class>[] groups() default {};
+
+ Class extends Payload>[] payload() default {};
+}
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 add99847..2b21b32c 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
@@ -1,6 +1,7 @@
package cn.lili.common.validation.impl;
import cn.lili.common.validation.Mobile;
+import cn.lili.common.validation.Phone;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
@@ -10,12 +11,21 @@ import java.util.regex.Pattern;
public class MobileValidator implements ConstraintValidator {
- private static Pattern pattern = 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}$");
-
@Override
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
- Matcher m = pattern.matcher(value);
- return m.matches();
+ Pattern p1 = null,p2 = null;
+ Matcher m = null;
+ boolean b = false;
+ p1 = Pattern.compile("^[0][1-9]{2,3}-[0-9]{5,10}$"); // 验证带区号的
+ p2 = Pattern.compile("^[1-9]{1}[0-9]{5,8}$"); // 验证没有区号的
+ if(value.length() >9)
+ { m = p1.matcher(value);
+ b = m.matches();
+ }else{
+ m = p2.matcher(value);
+ b = m.matches();
+ }
+ return b;
}
@Override
diff --git a/framework/src/main/java/cn/lili/common/validation/impl/PhoneValidator.java b/framework/src/main/java/cn/lili/common/validation/impl/PhoneValidator.java
new file mode 100644
index 00000000..731e9fe2
--- /dev/null
+++ b/framework/src/main/java/cn/lili/common/validation/impl/PhoneValidator.java
@@ -0,0 +1,25 @@
+package cn.lili.common.validation.impl;
+
+import cn.lili.common.validation.Phone;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+public class PhoneValidator implements ConstraintValidator {
+
+ private static Pattern pattern = 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}$");
+
+ @Override
+ public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
+ Matcher m = pattern.matcher(value);
+ return m.matches();
+ }
+
+ @Override
+ public void initialize(Phone constraintAnnotation) {
+
+ }
+}
diff --git a/framework/src/main/java/cn/lili/common/verification/SliderImageUtil.java b/framework/src/main/java/cn/lili/common/verification/SliderImageUtil.java
index a40cfc67..39b00968 100644
--- a/framework/src/main/java/cn/lili/common/verification/SliderImageUtil.java
+++ b/framework/src/main/java/cn/lili/common/verification/SliderImageUtil.java
@@ -78,7 +78,7 @@ public class SliderImageUtil {
graphics.dispose();
//添加水印
- ImageUtil.addWatermark(originalImage, "请滑动拼图");
+ ImageUtil.addWatermark(originalImage, "LILI-SHOP");
ByteArrayOutputStream newImageOs = new ByteArrayOutputStream();//新建流。
ImageIO.write(newImage, TEMP_IMG_FILE_TYPE, newImageOs);//利用ImageIO类提供的write方法,将bi以png图片的数据模式写入流。
byte[] newImagery = newImageOs.toByteArray();
diff --git a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java
index 18f9d74c..f3750381 100644
--- a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java
@@ -5,6 +5,7 @@ import cn.lili.common.delayqueue.BroadcastMessage;
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;
import cn.lili.common.trigger.enums.DelayTypeEnums;
import cn.lili.common.trigger.interfaces.TimeTrigger;
import cn.lili.common.trigger.model.TimeExecuteConstant;
@@ -71,7 +72,8 @@ 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()) * 1000L, broadcastMessage,
+ Long.parseLong(studio.getStartTime()) * 1000L,
+ broadcastMessage,
DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()),
rocketmqCustomProperties.getPromotionTopic());
@@ -106,8 +108,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());
@@ -117,8 +119,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());
@@ -152,6 +154,14 @@ public class StudioServiceImpl extends ServiceImpl impleme
@Override
public Boolean push(Integer roomId, Integer goodsId) {
+
+ //判断直播间是否已添加商品
+ if (studioCommodityService.getOne(
+ new LambdaQueryWrapper().eq(StudioCommodity::getRoomId, roomId)
+ .eq(StudioCommodity::getGoodsId, goodsId)) != null) {
+ throw new ServiceException(ResultCode.STODIO_GOODS_EXIST_ERROR);
+ }
+
//调用微信接口添加直播间商品并进行记录
if (wechatLivePlayerUtil.pushGoods(roomId, goodsId)) {
studioCommodityService.save(new StudioCommodity(roomId, goodsId));
@@ -186,10 +196,14 @@ public class StudioServiceImpl extends ServiceImpl impleme
@Override
public IPage studioList(PageVO pageVO, Integer recommend, String status) {
- return this.page(PageUtil.initPage(pageVO), new QueryWrapper()
+ QueryWrapper queryWrapper = new QueryWrapper()
.eq(recommend != null, "recommend", true)
.eq(status != null, "status", status)
- .orderByDesc("create_time"));
+ .orderByDesc("create_time");
+ 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/broadcast/util/WechatLivePlayerUtil.java b/framework/src/main/java/cn/lili/modules/broadcast/util/WechatLivePlayerUtil.java
index 32f80ed6..776f85a9 100644
--- a/framework/src/main/java/cn/lili/modules/broadcast/util/WechatLivePlayerUtil.java
+++ b/framework/src/main/java/cn/lili/modules/broadcast/util/WechatLivePlayerUtil.java
@@ -38,18 +38,11 @@ public class WechatLivePlayerUtil {
* @return 房间ID
*/
public Map create(Studio studio) throws Exception {
- //获取token
- String token = wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.WECHAT_MP);
//发送url
- String url = "https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token=" + token;
+ String url = "https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token=";
//添加直播间
- Map map = this.mockRoom(token, studio);
- String content = HttpUtils.doPostWithJson(url, map);
- JSONObject json = new JSONObject(content);
- log.info("微信小程序直播间创建结果:" + content);
- if (!json.getStr("errcode").equals("0")) {
- throw new ServiceException(json.getStr("errmsg"));
- }
+ Map map = this.mockRoom(studio);
+ JSONObject json = this.doPostWithJson(url, map);
Map roomMap = new HashMap<>();
roomMap.put("roomId", json.getStr("roomId"));
roomMap.put("qrcodeUrl", json.getStr("qrcode_url"));
@@ -63,20 +56,13 @@ public class WechatLivePlayerUtil {
* @return 房间ID
*/
public boolean editRoom(Studio studio) {
- //获取token
- String token = wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.WECHAT_MP);
//发送url
- String url = "https://api.weixin.qq.com/wxaapi/broadcast/room/editroom?access_token=" + token;
+ String url = "https://api.weixin.qq.com/wxaapi/broadcast/room/editroom?access_token=";
//修改直播间
- Map map = this.mockRoom(token, studio);
+ Map map = this.mockRoom(studio);
map.put("id", studio.getRoomId().toString());
- String content = HttpUtils.doPostWithJson(url, map);
- JSONObject json = new JSONObject(content);
- log.info("微信小程序直播间修改结果:" + content);
- if (!json.getStr("errcode").equals("0")) {
- throw new ServiceException(json.getStr("errmsg"));
- }
+ this.doPostWithJson(url, map);
return true;
}
@@ -88,10 +74,8 @@ public class WechatLivePlayerUtil {
* @return 回放地址
*/
public String getLiveInfo(Integer roomId) {
- //获取token
- String token = wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.WECHAT_MP);
//发送url
- String url = "https://api.weixin.qq.com/wxa/business/getliveinfo?access_token=" + token;
+ String url = "https://api.weixin.qq.com/wxa/business/getliveinfo?access_token=";
Map map = new HashMap<>();
//获取回放
map.put("action", "get_replay");
@@ -101,10 +85,7 @@ public class WechatLivePlayerUtil {
map.put("start", "0");
//每次拉取的数量,建议100以内
map.put("limit", "1");
-
- String content = HttpUtils.doPostWithJson(url, map);
- JSONObject json = new JSONObject(content);
- log.info("微信小程序获取信息:" + content);
+ JSONObject json = this.doPostWithJson(url, map);
//TODO get media_url
return json.getStr("live_replay");
}
@@ -117,22 +98,15 @@ public class WechatLivePlayerUtil {
* @return 操作结果
*/
public Boolean pushGoods(Integer roomId, Integer goodsId) {
- //获取token
- String token = wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.WECHAT_MP);
//发送url
- String url = "https://api.weixin.qq.com/wxaapi/broadcast/room/addgoods?access_token=" + token;
+ String url = "https://api.weixin.qq.com/wxaapi/broadcast/room/addgoods?access_token=";
Map map = new HashMap<>();
//直播间回放
Integer[] ids = {goodsId};
map.put("ids", ids);
//商品ID
map.put("roomId", roomId);
- String content = HttpUtils.doPostWithJson(url, map);
- JSONObject json = new JSONObject(content);
- log.info("直播间导入商品:" + content);
- if (!json.getStr("errcode").equals("0")) {
- throw new ServiceException(json.getStr("errmsg"));
- }
+ this.doPostWithJson(url, map);
return true;
}
@@ -144,22 +118,15 @@ public class WechatLivePlayerUtil {
* @return 操作结果
*/
public Boolean goodsDeleteInRoom(Integer roomId, Integer goodsId) {
- //获取token
- String token = wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.WECHAT_MP);
//发送url
- String url = "https://api.weixin.qq.com/wxaapi/broadcast/goods/deleteInRoom?access_token=" + token;
+ String url = "https://api.weixin.qq.com/wxaapi/broadcast/goods/deleteInRoom?access_token=";
Map map = new HashMap<>();
//直播间回放
map.put("goodsId", goodsId);
//商品ID
map.put("roomId", roomId);
- String content = HttpUtils.doPostWithJson(url, map);
- JSONObject json = new JSONObject(content);
- log.info("微信小程序直播间删除商品:" + content);
- if(json.getStr("errcode").equals("0")){
- return true;
- }
- throw new ServiceException(json.getStr("errmsg"));
+ this.doPostWithJson(url, map);
+ return true;
}
@@ -170,10 +137,8 @@ public class WechatLivePlayerUtil {
* @return 添加结果
*/
public JSONObject addGoods(Commodity commodity) {
- //获取token
- String token = wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.WECHAT_MP);
//发送url
- String url = "https://api.weixin.qq.com/wxaapi/broadcast/goods/add?access_token=" + token;
+ String url = "https://api.weixin.qq.com/wxaapi/broadcast/goods/add?access_token=";
//商品名称,最长14个汉字
if (commodity.getName().length() > 14) {
@@ -183,14 +148,11 @@ public class WechatLivePlayerUtil {
//新建微信商品DTO
GoodsInfo goodsInfo = new GoodsInfo(commodity);
//上传微信临时图片
- goodsInfo.setCoverImgUrl(wechatMediaUtil.uploadMedia(token, "image", commodity.getGoodsImage()));
+ goodsInfo.setCoverImgUrl(wechatMediaUtil.uploadMedia("image", commodity.getGoodsImage()));
Map map = new HashMap<>();
//调用新增直播商品接口
map.put("goodsInfo", goodsInfo);
- String content = HttpUtils.doPostWithJson(url, map);
- JSONObject json = new JSONObject(content);
- log.info("微信小程序添加直播商品结果:" + content);
- return json;
+ return this.doPostWithJson(url, map);
}
/**
@@ -200,16 +162,11 @@ public class WechatLivePlayerUtil {
* @return 删除结果
*/
public JSONObject deleteGoods(String goodsId) {
- //获取token
- String token = wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.WECHAT_MP);
//发送url
- String url = "https://api.weixin.qq.com/wxaapi/broadcast/goods/delete?access_token=" + token;
+ String url = "https://api.weixin.qq.com/wxaapi/broadcast/goods/delete?access_token=";
Map map = new HashMap<>();
map.put("goodsId", goodsId);
- String content = HttpUtils.doPostWithJson(url, map);
- JSONObject json = new JSONObject(content);
- log.info("微信小程序删除直播商品结果:" + content);
- return json;
+ return this.doPostWithJson(url, map);
}
/**
@@ -219,26 +176,49 @@ public class WechatLivePlayerUtil {
* @return 删除结果
*/
public JSONObject getGoodsWareHouse(List goodsIdList) {
- //获取token
- String token = wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.WECHAT_MP);
//发送url
- String url = "https://api.weixin.qq.com/wxa/business/getgoodswarehouse?access_token=" + token;
+ String url = "https://api.weixin.qq.com/wxa/business/getgoodswarehouse?access_token=";
Map map = new HashMap<>();
map.put("goods_ids", goodsIdList);
- String content = HttpUtils.doPostWithJson(url, map);
- JSONObject json = new JSONObject(content);
- log.info("微信小程序查询直播商品结果:" + content);
- return json;
+ return this.doPostWithJson(url, map);
}
- private Map mockRoom(String token, Studio studio) {
+ /**
+ * 请求微信接口
+ *
+ * @param url 链接
+ * @param map 参数
+ * @return 返回内容
+ */
+ private JSONObject doPostWithJson(String url, Map map) {
+ //获取token
+ String token = wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.WECHAT_MP);
+ //请求链接添加token
+ url += token;
+ //发起请求
+ String content = HttpUtils.doPostWithJson(url, map);
+ //记录请求结果
+ log.info("微信小程序请求结果:" + content);
+ //获取请求内容,如果token过期则重新获取,如果出错则抛出错误
+ JSONObject jsonObject = new JSONObject(content);
+ if (jsonObject.get("errcode").toString().equals("0")) {
+ return jsonObject;
+ } else if (jsonObject.get("errcode").equals("40001")) {
+ wechatAccessTokenUtil.removeAccessToken(ClientTypeEnum.WECHAT_MP);
+ return this.doPostWithJson(url, map);
+ } else {
+ throw new ServiceException(jsonObject.get("errmsg").toString());
+ }
+ }
+
+ private Map mockRoom(Studio studio) {
Map map = new HashMap<>();
//背景图
- map.put("coverImg", wechatMediaUtil.uploadMedia(token, "image", studio.getCoverImg()));
+ map.put("coverImg", wechatMediaUtil.uploadMedia("image", studio.getCoverImg()));
//分享图
- map.put("shareImg", wechatMediaUtil.uploadMedia(token, "image", studio.getShareImg()));
+ map.put("shareImg", wechatMediaUtil.uploadMedia("image", studio.getShareImg()));
//购物直播频道封面图
- map.put("feedsImg", wechatMediaUtil.uploadMedia(token, "image", studio.getFeedsImg()));
+ map.put("feedsImg", wechatMediaUtil.uploadMedia("image", studio.getFeedsImg()));
//直播间名字
map.put("name", studio.getName());
//直播计划开始时间
diff --git a/framework/src/main/java/cn/lili/modules/broadcast/util/WechatMediaUtil.java b/framework/src/main/java/cn/lili/modules/broadcast/util/WechatMediaUtil.java
index ad6cef2b..eb885cb1 100644
--- a/framework/src/main/java/cn/lili/modules/broadcast/util/WechatMediaUtil.java
+++ b/framework/src/main/java/cn/lili/modules/broadcast/util/WechatMediaUtil.java
@@ -1,7 +1,11 @@
package cn.lili.modules.broadcast.util;
import cn.hutool.json.JSONObject;
+import cn.lili.common.exception.ServiceException;
+import cn.lili.modules.base.entity.enums.ClientTypeEnum;
+import cn.lili.modules.message.util.WechatAccessTokenUtil;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.*;
@@ -18,14 +22,18 @@ import java.util.Date;
@Slf4j
@Component
public class WechatMediaUtil {
+ @Autowired
+ private WechatAccessTokenUtil wechatAccessTokenUtil;
/**
* 上传多媒体数据到微信服务器
- * @param accessToken 从微信获取到的access_token
+ *
* @param mediaFileUrl 来自网络上面的媒体文件地址
* @return
*/
- public String uploadMedia(String accessToken, String type, String mediaFileUrl) {
+ public String uploadMedia(String type, String mediaFileUrl) {
+ //获取token
+ String accessToken = wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.WECHAT_MP);
/*
* 上传媒体文件到微信服务器需要请求的地址
*/
@@ -38,21 +46,21 @@ public class WechatMediaUtil {
try {
String boundary = "----WebKitFormBoundaryOYXo8heIv9pgpGjT";
URL url = new URL(mediaStr);
- HttpURLConnection urlConn = (HttpURLConnection)url.openConnection();
+ HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
//让输入输出流开启
urlConn.setDoInput(true);
urlConn.setDoOutput(true);
//使用post方式请求的时候必须关闭缓存
urlConn.setUseCaches(false);
//设置请求头的Content-Type属性
- urlConn.setRequestProperty("Content-Type", "multipart/form-data; boundary="+boundary);
+ urlConn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
urlConn.setRequestMethod("POST");
//获取输出流,使用输出流拼接请求体
OutputStream out = urlConn.getOutputStream();
//读取文件的数据,构建一个GET请求,然后读取指定地址中的数据
mediaUrl = new URL(mediaFileUrl);
- HttpURLConnection mediaConn = (HttpURLConnection)mediaUrl.openConnection();
+ HttpURLConnection mediaConn = (HttpURLConnection) mediaUrl.openConnection();
//设置请求方式
mediaConn.setRequestMethod("GET");
//设置可以打开输入流
@@ -68,15 +76,15 @@ public class WechatMediaUtil {
byte[] bytes = new byte[1024];
int size = 0;
//使用outputStream流输出信息到请求体当中去
- out.write(("--"+boundary+"\r\n").getBytes());
+ out.write(("--" + boundary + "\r\n").getBytes());
out.write(("Content-Disposition: form-data; name=\"media\";\r\n"
- + "filename=\""+(new Date().getTime())+fileExt+"\"\r\n"
- + "Content-Type: "+contentType+"\r\n\r\n").getBytes());
- while( (size = bufferedIn.read(bytes)) != -1) {
+ + "filename=\"" + (new Date().getTime()) + fileExt + "\"\r\n"
+ + "Content-Type: " + contentType + "\r\n\r\n").getBytes());
+ while ((size = bufferedIn.read(bytes)) != -1) {
out.write(bytes, 0, size);
}
//切记,这里的换行符不能少,否则将会报41005错误
- out.write(("\r\n--"+boundary+"--\r\n").getBytes());
+ out.write(("\r\n--" + boundary + "--\r\n").getBytes());
bufferedIn.close();
in.close();
@@ -87,27 +95,39 @@ public class WechatMediaUtil {
BufferedReader bufferedReader = new BufferedReader(reader);
String tempStr = null;
resultStr = new StringBuffer();
- while((tempStr = bufferedReader.readLine()) != null) {
+ while ((tempStr = bufferedReader.readLine()) != null) {
resultStr.append(tempStr);
}
bufferedReader.close();
reader.close();
resultIn.close();
urlConn.disconnect();
- } catch (Exception e) {
- log.error("微信媒体上传失败",e);
+ } catch (Exception e) {
+ log.error("微信媒体上传失败", e);
}
- JSONObject jsonObject=new JSONObject(resultStr.toString());
- return jsonObject.get("media_id").toString();
+ JSONObject jsonObject = new JSONObject(resultStr.toString());
+ log.info("微信媒体上传:" + jsonObject.toString());
+ //判断是否传递成功,如果token过期则重新获取
+ if (jsonObject.get("errcode") != null && jsonObject.get("errcode").equals("40001")) {
+ wechatAccessTokenUtil.removeAccessToken(ClientTypeEnum.WECHAT_MP);
+ return this.uploadMedia(type, mediaFileUrl);
+ } else if (jsonObject.get("errcode") != null) {
+ throw new ServiceException(jsonObject.get("errmsg").toString());
+ } else {
+ return jsonObject.get("media_id").toString();
+ }
+
}
+
/**
* 通过传过来的contentType判断是哪一种类型
+ *
* @param contentType 获取来自连接的contentType
* @return
*/
public String judgeType(String contentType) {
String fileExt = "";
- switch (contentType){
+ switch (contentType) {
case "image/png":
fileExt = ".png";
break;
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 cf28840a..acf388a3 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
@@ -184,6 +184,8 @@ public class ConnectUtil {
.clientId(qqConnectSettingItem.getAppId())
.clientSecret(qqConnectSettingItem.getAppKey())
.redirectUri(getRedirectUri(authInterface))
+ //这里qq获取unionid 需要配置为true,详情可以查阅属性说明,内部有帮助文档
+ .unionId(true)
.build(), cache);
}
}
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/goods/entity/dos/CategoryParameterGroup.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/CategoryParameterGroup.java
index 5c97992d..3737862d 100644
--- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/CategoryParameterGroup.java
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/CategoryParameterGroup.java
@@ -41,7 +41,7 @@ public class CategoryParameterGroup extends BaseEntity {
@NotNull(message = "关联的分类不能为空")
private String categoryId;
/**
- *
+ * 排序
*/
@ApiModelProperty(value = "排序", hidden = true)
private Integer sort;
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/DraftGoods.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/DraftGoods.java
index 23e0a4a3..df07486c 100644
--- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/DraftGoods.java
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/DraftGoods.java
@@ -64,6 +64,10 @@ public class DraftGoods extends BaseEntity {
@ApiModelProperty(value = "详情")
private String intro;
+
+ @ApiModelProperty(value = "商品移动端详情")
+ private String mobileIntro;
+
@Max(value = 99999999, message = "价格不能超过99999999")
@ApiModelProperty(value = "商品价格")
private Double price;
@@ -114,11 +118,6 @@ public class DraftGoods extends BaseEntity {
@ApiModelProperty(value = "是否自营")
private Boolean selfOperated;
- /**
- * 商品移动端详情
- */
- @ApiModelProperty(value = "商品移动端详情")
- private String mobileIntro;
@ApiModelProperty(value = "商品视频")
private String goodsVideo;
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java
index acf79d3d..142c2298 100644
--- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java
@@ -1,5 +1,6 @@
package cn.lili.modules.goods.entity.dos;
+import cn.hutool.core.convert.Convert;
import cn.hutool.json.JSONUtil;
import cn.lili.base.BaseEntity;
import cn.lili.common.enums.ResultCode;
@@ -221,8 +222,8 @@ public class Goods extends BaseEntity {
this.intro = goodsOperationDTO.getIntro();
this.mobileIntro = goodsOperationDTO.getMobileIntro();
this.cost = goodsOperationDTO.getCost();
- if (goodsOperationDTO.getGoodsParamsList() != null && goodsOperationDTO.getGoodsParamsList().isEmpty()) {
- this.params = JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsList());
+ if (goodsOperationDTO.getGoodsParamsDTOList() != null && goodsOperationDTO.getGoodsParamsDTOList().isEmpty()) {
+ this.params = JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsDTOList());
}
//如果立即上架则
this.marketEnable = goodsOperationDTO.isRelease() ? GoodsStatusEnum.UPPER.name() : GoodsStatusEnum.DOWN.name();
@@ -234,19 +235,19 @@ public class Goods extends BaseEntity {
if (sku.get("sn") == null) {
throw new ServiceException(ResultCode.GOODS_SKU_SN_ERROR);
}
- if (StringUtil.isEmpty(sku.get("price").toString()) || Integer.parseInt( sku.get("price").toString()) <= 0) {
+ if (StringUtil.isEmpty(sku.get("price").toString()) || Convert.toDouble(sku.get("price")) <= 0) {
throw new ServiceException(ResultCode.GOODS_SKU_PRICE_ERROR);
}
- if (StringUtil.isEmpty(sku.get("cost").toString()) || Integer.parseInt( sku.get("cost").toString()) <= 0) {
+ if (StringUtil.isEmpty(sku.get("cost").toString()) || Convert.toDouble(sku.get("cost")) <= 0) {
throw new ServiceException(ResultCode.GOODS_SKU_COST_ERROR);
}
//虚拟商品没有重量字段
- if(sku.containsKey("weight")) {
- if (StringUtil.isEmpty(sku.get("weight").toString()) || Integer.parseInt(sku.get("weight").toString()) < 0) {
+ if (sku.containsKey("weight")) {
+ if (StringUtil.isEmpty(sku.get("weight").toString()) || Convert.toDouble(sku.get("weight").toString()) < 0) {
throw new ServiceException(ResultCode.GOODS_SKU_WEIGHT_ERROR);
}
}
- if (StringUtil.isEmpty(sku.get("quantity").toString()) || Integer.parseInt( sku.get("quantity").toString()) < 0) {
+ if (StringUtil.isEmpty(sku.get("quantity").toString()) || Convert.toInt(sku.get("quantity").toString()) < 0) {
throw new ServiceException(ResultCode.GOODS_SKU_QUANTITY_ERROR);
}
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/GoodsParams.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/GoodsParams.java
deleted file mode 100644
index 16045221..00000000
--- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/GoodsParams.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package cn.lili.modules.goods.entity.dos;
-
-import cn.lili.base.BaseEntity;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.hibernate.validator.constraints.Length;
-
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-
-/**
- * 商品关联参数
- *
- * @author pikachu
- * @date 2020-02-23 9:14:33
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Entity
-@Table(name = "li_goods_params")
-@TableName("li_goods_params")
-@ApiModel(value = "商品关联参数")
-public class GoodsParams extends BaseEntity {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 商品id
- */
- @TableField(value = "goods_id")
- @ApiModelProperty(value = "商品id", hidden = true)
- private String goodsId;
- /**
- * 参数id
- */
- @TableField(value = "param_id")
- @ApiModelProperty(value = "参数id", required = true)
- private String paramId;
- /**
- * 参数名字
- */
- @TableField(value = "param_name")
- @ApiModelProperty(value = "参数名字", required = true)
- private String paramName;
- /**
- * 参数值
- */
- @TableField(value = "param_value")
- @ApiModelProperty(value = "参数值", required = true)
- @Length(max = 100, message = "参数值字符不能大于120")
- private String paramValue;
-
- @TableField(value = "is_index")
- @ApiModelProperty(value = "是否可索引,0 不显示 1 显示", required = true)
- @NotNull(message = "是否可索引必选")
- @Min(value = 0, message = "是否可索引传值不正确")
- @Max(value = 1, message = "是否可索引传值不正确")
- private Integer isIndex = 0;
-
-}
\ No newline at end of file
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Parameters.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Parameters.java
index f9198944..96fcc1f8 100644
--- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Parameters.java
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Parameters.java
@@ -1,13 +1,17 @@
package cn.lili.modules.goods.entity.dos;
-import cn.lili.base.BaseEntity;
+import cn.lili.base.IdEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
+import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
@@ -25,7 +29,9 @@ import javax.validation.constraints.NotNull;
@Table(name = "li_parameters")
@TableName("li_parameters")
@ApiModel(value = "商品参数")
-public class Parameters extends BaseEntity {
+public class Parameters extends IdEntity {
+
+
private static final long serialVersionUID = -566510714456317006L;
@@ -36,6 +42,7 @@ public class Parameters extends BaseEntity {
@ApiModelProperty(value = "选择值")
+ @NotEmpty(message = "参数选项值必填")
private String options;
@ApiModelProperty(value = "是否可索引,0 不显示 1 显示", required = true)
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Specification.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Specification.java
index 436d6ce3..b4e8a272 100644
--- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Specification.java
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Specification.java
@@ -1,6 +1,6 @@
package cn.lili.modules.goods.entity.dos;
-import cn.lili.base.BaseEntity;
+import cn.lili.base.IdEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
@@ -23,7 +23,7 @@ import javax.validation.constraints.NotEmpty;
@Table(name = "li_specification")
@TableName("li_specification")
@ApiModel(value = "规格项")
-public class Specification extends BaseEntity {
+public class Specification extends IdEntity {
private static final long serialVersionUID = 147792597901239486L;
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dto/DraftGoodsDTO.java b/framework/src/main/java/cn/lili/modules/goods/entity/dto/DraftGoodsDTO.java
index 607223b6..b1517e6b 100644
--- a/framework/src/main/java/cn/lili/modules/goods/entity/dto/DraftGoodsDTO.java
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/dto/DraftGoodsDTO.java
@@ -1,7 +1,6 @@
package cn.lili.modules.goods.entity.dto;
import cn.lili.modules.goods.entity.dos.DraftGoods;
-import cn.lili.modules.goods.entity.dos.GoodsParams;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -22,7 +21,7 @@ public class DraftGoodsDTO extends DraftGoods {
@ApiModelProperty(value = "商品参数")
@Valid
- private List goodsParamsList;
+ private List goodsParamsDTOList;
@ApiModelProperty(value = "商品图片")
private List goodsGalleryList;
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java
index 20cf8120..3decd397 100644
--- a/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java
@@ -1,6 +1,5 @@
package cn.lili.modules.goods.entity.dto;
-import cn.lili.modules.goods.entity.dos.GoodsParams;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
@@ -83,8 +82,7 @@ public class GoodsOperationDTO implements Serializable {
private boolean recommend;
@ApiModelProperty(value = "商品参数")
- @Valid
- private List goodsParamsList;
+ private List goodsParamsDTOList;
@ApiModelProperty(value = "商品图片")
private List goodsGalleryList;
@@ -121,4 +119,7 @@ public class GoodsOperationDTO implements Serializable {
*/
@ApiModelProperty(value = "商品类型")
private String goodsType;
+
+
+
}
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsDTO.java b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsDTO.java
new file mode 100644
index 00000000..09be40e0
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsDTO.java
@@ -0,0 +1,31 @@
+package cn.lili.modules.goods.entity.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 商品关联参数
+ *
+ * @author pikachu
+ * @date 2020-02-23 9:14:33
+ */
+@Data
+@ApiModel(value = "商品参数分组")
+public class GoodsParamsDTO {
+
+ @TableField(value = "group_id")
+ @ApiModelProperty(value = "分组id")
+ private String groupId;
+
+ @TableField(value = "group_name")
+ @ApiModelProperty(value = "分组名称")
+ private String groupName;
+
+ @ApiModelProperty(value = "分组内的商品参数列表")
+ private List goodsParamsItemDTOList;
+
+}
\ No newline at end of file
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsItemDTO.java b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsItemDTO.java
new file mode 100644
index 00000000..84eb2113
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsItemDTO.java
@@ -0,0 +1,35 @@
+package cn.lili.modules.goods.entity.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+
+/**
+ * 商品参数项
+ *
+ * @author Chopper
+ * @version v1.0
+ * 2021-06-24 15:41
+ */
+@Data
+@ApiModel(value = "商品参数列表")
+public class GoodsParamsItemDTO {
+
+ @ApiModelProperty(value = "参数ID")
+ private String paramId;
+
+ @ApiModelProperty(value = "参数名字")
+ private String paramName;
+
+ @ApiModelProperty(value = "参数值")
+ private String paramValue;
+
+ @ApiModelProperty(value = "是否可索引,0 不索引 1 索引")
+ private Integer isIndex = 0;
+
+ @ApiModelProperty(value = "是否必填,0 不显示 1 显示")
+ private Integer required = 0;
+}
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/vos/DraftGoodsVO.java b/framework/src/main/java/cn/lili/modules/goods/entity/vos/DraftGoodsVO.java
index f6e67966..2bf39fad 100644
--- a/framework/src/main/java/cn/lili/modules/goods/entity/vos/DraftGoodsVO.java
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/vos/DraftGoodsVO.java
@@ -1,10 +1,9 @@
package cn.lili.modules.goods.entity.vos;
import cn.lili.modules.goods.entity.dos.DraftGoods;
-import cn.lili.modules.goods.entity.dos.GoodsParams;
+import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
-import lombok.EqualsAndHashCode;
import java.util.List;
@@ -23,7 +22,7 @@ public class DraftGoodsVO extends DraftGoods {
private List categoryName;
@ApiModelProperty(value = "商品参数")
- private List goodsParamsList;
+ private List goodsParamsDTOList;
@ApiModelProperty(value = "商品图片")
private List goodsGalleryList;
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsVO.java b/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsDTOVO.java
similarity index 90%
rename from framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsVO.java
rename to framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsDTOVO.java
index 795a22c6..64deda4f 100644
--- a/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsVO.java
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsDTOVO.java
@@ -1,7 +1,7 @@
package cn.lili.modules.goods.entity.vos;
-import cn.lili.modules.goods.entity.dos.GoodsParams;
+import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -12,7 +12,7 @@ import lombok.Data;
* @date 2020-02-26 23:24:13
*/
@Data
-public class GoodsParamsVO extends GoodsParams {
+public class GoodsParamsDTOVO extends GoodsParamsDTO {
private static final long serialVersionUID = -4904700751774005326L;
@ApiModelProperty("1 输入项 2 选择项")
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsGroupVO.java b/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsGroupVO.java
index 18d0a9d5..9202f953 100644
--- a/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsGroupVO.java
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsParamsGroupVO.java
@@ -16,7 +16,7 @@ import java.util.List;
public class GoodsParamsGroupVO implements Serializable {
private static final long serialVersionUID = 1450550797436233753L;
@ApiModelProperty("参数组关联的参数集合")
- private List params;
+ private List params;
@ApiModelProperty("参数组名称")
private String groupName;
@ApiModelProperty("参数组id")
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsVO.java b/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsVO.java
index 6207aac0..ebb31251 100644
--- a/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsVO.java
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/vos/GoodsVO.java
@@ -1,7 +1,7 @@
package cn.lili.modules.goods.entity.vos;
import cn.lili.modules.goods.entity.dos.Goods;
-import cn.lili.modules.goods.entity.dos.GoodsParams;
+import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -22,7 +22,7 @@ public class GoodsVO extends Goods {
private List categoryName;
@ApiModelProperty(value = "商品参数")
- private List goodsParamsList;
+ private List goodsParamsDTOList;
@ApiModelProperty(value = "商品图片")
private List goodsGalleryList;
diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/vos/SpecValueVO.java b/framework/src/main/java/cn/lili/modules/goods/entity/vos/SpecValueVO.java
index 79ee16af..81bbc39b 100644
--- a/framework/src/main/java/cn/lili/modules/goods/entity/vos/SpecValueVO.java
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/vos/SpecValueVO.java
@@ -26,14 +26,24 @@ public class SpecValueVO implements Serializable {
@ApiModelProperty(value = "规格值")
private String specValue;
- /**
- * 规格类型,1图片 0 非图片
- */
@ApiModelProperty(value = "该规格是否有图片,1 有 0 没有")
private Integer specType;
/**
* 规格图片
*/
@ApiModelProperty(value = "规格的图片")
- private List specImage;
+ private List specImage;
+
+ @Data
+ public static class SpecImages implements Serializable {
+
+ private static final long serialVersionUID = 1816357809660916086L;
+
+ private String url;
+
+ private String name;
+
+ private String status;
+
+ }
}
diff --git a/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsMapper.java b/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsMapper.java
index 928248c7..cea5e6a8 100644
--- a/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsMapper.java
+++ b/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsMapper.java
@@ -10,6 +10,8 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
+import java.util.List;
+
/**
* 规格项数据处理层
*
@@ -19,12 +21,12 @@ import org.apache.ibatis.annotations.Update;
public interface GoodsMapper extends BaseMapper {
/**
- * 下架所有商家商品
+ * 根据店铺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/mapper/GoodsParamsMapper.java b/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsParamsMapper.java
index 37d136f4..471c649c 100644
--- a/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsParamsMapper.java
+++ b/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsParamsMapper.java
@@ -1,7 +1,7 @@
package cn.lili.modules.goods.mapper;
-import cn.lili.modules.goods.entity.dos.GoodsParams;
-import cn.lili.modules.goods.entity.vos.GoodsParamsVO;
+import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
+import cn.lili.modules.goods.entity.vos.GoodsParamsDTOVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
@@ -14,9 +14,9 @@ import java.util.List;
* @author pikachu
* @date 2020-02-18 15:18:56
*/
-public interface GoodsParamsMapper extends BaseMapper {
+public interface GoodsParamsMapper extends BaseMapper {
@Select("select p.*,gp.param_value,p.group_id from li_parameters p left join li_goods_params gp on p.id=gp.param_id and gp.goods_id = #{goodsId} where p.category_id = #{categoryId} order by sort")
- List paramList(String goodsId, String categoryId);
+ List paramList(String goodsId, String categoryId);
}
\ No newline at end of file
diff --git a/framework/src/main/java/cn/lili/modules/goods/service/GoodsParamsService.java b/framework/src/main/java/cn/lili/modules/goods/service/GoodsParamsService.java
deleted file mode 100644
index bd8195fc..00000000
--- a/framework/src/main/java/cn/lili/modules/goods/service/GoodsParamsService.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package cn.lili.modules.goods.service;
-
-import cn.lili.modules.goods.entity.dos.GoodsParams;
-import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO;
-import cn.lili.modules.goods.entity.vos.GoodsParamsVO;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import java.util.List;
-
-
-/**
- * 商品关联参数业务层
- *
- * @author pikachu
- * @date 2020-03-13 16:18:56
- */
-public interface GoodsParamsService extends IService {
-
- /**
- * 添加商品参数
- * @param paramList 参数列表
- * @param goodsId 商品ID
- */
- void addParams(List paramList, String goodsId);
-
- /**
- * 更新商品参数是否索引
- *
- * @param paramId 参数id
- * @param isIndex 是否索引
- */
- void updateParametersIsIndex(String paramId, Integer isIndex);
-
- /**
- * 根据参数id删除已经设置的商品参数
- *
- * @param paramId 参数id
- */
- void deleteByParamId(String paramId);
-
- /**
- * 获取商品关联参数
- *
- * @param goodsId 商品ID
- * @return 商品关联参数
- */
- List getGoodsParamsByGoodsId(String goodsId);
-
- /**
- * 添加商品参数
- *
- * @param goodsParamsVO 商品参数
- * @return 添加是否成功
- */
- boolean addParams(GoodsParamsVO goodsParamsVO);
-
- /**
- * 根据分类id查询绑定参数信息
- *
- * @param categoryId 分类id
- * @param goodsId 商品id
- * @return 分类id
- */
- List paramList(String categoryId, String goodsId);
-
- /**
- * 查询商品参数信息
- *
- * @param goodsId 商品id
- * @param categoryId 分了id
- * @return 商品参数信息
- */
- List queryGoodsParams(String goodsId, String categoryId);
-
-
-}
\ No newline at end of file
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 3c46db2b..6f350d1c 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
@@ -8,7 +8,7 @@ import cn.lili.modules.goods.entity.dos.Category;
import cn.lili.modules.goods.entity.dos.CategoryParameterGroup;
import cn.lili.modules.goods.entity.vos.CategoryVO;
import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO;
-import cn.lili.modules.goods.entity.vos.GoodsParamsVO;
+import cn.lili.modules.goods.entity.vos.GoodsParamsDTOVO;
import cn.lili.modules.goods.mapper.CategoryMapper;
import cn.lili.modules.goods.service.CategoryService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -255,13 +255,13 @@ public class CategoryServiceImpl extends ServiceImpl i
* @param paramList 参数列表
* @return 拼装后的返回值
*/
- private List convertParamList(List groupList, List paramList) {
- Map> map = new HashMap<>(16);
- for (GoodsParamsVO param : paramList) {
+ private List convertParamList(List groupList, List paramList) {
+ Map> map = new HashMap<>(16);
+ for (GoodsParamsDTOVO param : paramList) {
if (map.get(param.getGroupId()) != null) {
map.get(param.getGroupId()).add(param);
} else {
- List list = new ArrayList<>();
+ List list = new ArrayList<>();
list.add(param);
map.put(param.getGroupId(), list);
}
diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/DraftGoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/DraftGoodsServiceImpl.java
index ca55c272..25292b88 100644
--- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/DraftGoodsServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/DraftGoodsServiceImpl.java
@@ -8,6 +8,7 @@ import cn.lili.common.utils.StringUtils;
import cn.lili.modules.goods.entity.dos.*;
import cn.lili.modules.goods.entity.dto.DraftGoodsDTO;
import cn.lili.modules.goods.entity.dto.DraftGoodsSearchParams;
+import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
import cn.lili.modules.goods.entity.vos.DraftGoodsVO;
import cn.lili.modules.goods.mapper.DraftGoodsMapper;
import cn.lili.modules.goods.service.CategoryService;
@@ -45,7 +46,7 @@ public class DraftGoodsServiceImpl extends ServiceImpl list = JSONUtil.toList(jsonArray, GoodsSku.class);
diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsParamsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsParamsServiceImpl.java
deleted file mode 100644
index fc3d10ca..00000000
--- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsParamsServiceImpl.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package cn.lili.modules.goods.serviceimpl;
-
-import cn.lili.modules.goods.entity.dos.CategoryParameterGroup;
-import cn.lili.modules.goods.entity.dos.GoodsParams;
-import cn.lili.modules.goods.entity.dos.Parameters;
-import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO;
-import cn.lili.modules.goods.entity.vos.GoodsParamsVO;
-import cn.lili.modules.goods.mapper.GoodsParamsMapper;
-import cn.lili.modules.goods.service.CategoryParameterGroupService;
-import cn.lili.modules.goods.service.GoodsParamsService;
-import cn.lili.modules.goods.service.ParametersService;
-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 com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * 商品关联参数接口实现
- *
- * @author pikachu
- * @version v1.0
- * @since v1.0
- * 2020-02-23 15:18:56
- */
-@Service
-@Transactional
-public class GoodsParamsServiceImpl extends ServiceImpl implements GoodsParamsService {
- //分类-参数绑定
- @Autowired
- private CategoryParameterGroupService categoryParameterGroupService;
-
- @Autowired
- private ParametersService parametersService;
-
- @Override
- public void addParams(List paramList, String goodsId) {
- //先删除现有商品参数
- this.remove(new UpdateWrapper().eq("goods_id", goodsId));
- //循环添加参数
- if (paramList != null) {
- for (GoodsParams param : paramList) {
- Parameters parameters = parametersService.getById(param.getParamId());
- GoodsParams goodsParams = new GoodsParams();
- goodsParams.setGoodsId(goodsId);
- goodsParams.setParamName(param.getParamName());
- goodsParams.setParamValue(param.getParamValue());
- goodsParams.setIsIndex(parameters.getIsIndex());
- goodsParams.setParamId(param.getId());
- this.save(goodsParams);
- }
- }
- }
-
- /**
- * 更新商品参数是否索引
- *
- * @param paramId 参数id
- * @param isIndex 是否索引
- */
- @Override
- public void updateParametersIsIndex(String paramId, Integer isIndex) {
- LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
- updateWrapper.eq(GoodsParams::getParamId, paramId);
- updateWrapper.set(GoodsParams::getIsIndex, isIndex);
- this.update(updateWrapper);
- }
-
- /**
- * 根据参数id删除已经设置的商品参数
- *
- * @param paramId 参数id
- */
- @Override
- public void deleteByParamId(String paramId) {
- this.remove(new QueryWrapper().eq("param_id", paramId));
- }
-
- @Override
- public List getGoodsParamsByGoodsId(String goodsId) {
- return this.list(new LambdaQueryWrapper().eq(GoodsParams::getGoodsId, goodsId));
- }
-
- /**
- * 添加商品参数
- *
- * @param goodsParamsVO 商品参数
- * @return 添加是否成功
- */
- @Override
- public boolean addParams(GoodsParamsVO goodsParamsVO) {
- return this.save(goodsParamsVO);
- }
-
- @Override
- public List paramList(String goodsId, String categoryId) {
- return this.baseMapper.paramList(goodsId, categoryId);
- }
-
- @Override
- public List queryGoodsParams(String categoryId, String goodsId) {
- //查询分类关联参数组
- List groupList = categoryParameterGroupService.getCategoryGroup(categoryId);
- //查询商品参数
- List paramList = this.paramList(goodsId, categoryId);
- //拼装数据返回
- return this.convertParamList(groupList, paramList);
- }
-
-
- /**
- * 拼装返回值
- *
- * @param paramList
- * @return
- */
- private List convertParamList(List groupList, List paramList) {
- Map> map = new HashMap<>(16);
- for (GoodsParamsVO param : paramList) {
- if (map.get(param.getGroupId()) != null) {
- map.get(param.getGroupId()).add(param);
- } else {
- List list = new ArrayList<>();
- list.add(param);
- map.put(param.getGroupId(), list);
- }
- }
- List resList = new ArrayList<>();
- for (CategoryParameterGroup group : groupList) {
- GoodsParamsGroupVO list = new GoodsParamsGroupVO();
- list.setGroupName(group.getGroupName());
- list.setGroupId(group.getId());
- list.setParams(map.get(group.getId()));
- resList.add(list);
- }
- return resList;
- }
-}
\ No newline at end of file
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 29593f34..b9167c90 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
@@ -16,12 +16,16 @@ import cn.lili.config.rocketmq.RocketmqCustomProperties;
import cn.lili.modules.goods.entity.dos.Category;
import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.dos.GoodsGallery;
+import cn.lili.modules.goods.entity.dos.Parameters;
import cn.lili.modules.goods.entity.dto.GoodsOperationDTO;
+import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
+import cn.lili.modules.goods.entity.dto.GoodsParamsItemDTO;
import cn.lili.modules.goods.entity.dto.GoodsSearchParams;
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
import cn.lili.modules.goods.entity.vos.GoodsSkuVO;
import cn.lili.modules.goods.entity.vos.GoodsVO;
+import cn.lili.modules.goods.entity.vos.ParameterGroupVO;
import cn.lili.modules.goods.mapper.GoodsMapper;
import cn.lili.modules.goods.service.*;
import cn.lili.modules.member.entity.dos.MemberEvaluation;
@@ -59,9 +63,7 @@ import java.util.List;
@Transactional
public class GoodsServiceImpl extends ServiceImpl implements GoodsService {
- //商品属性
- @Autowired
- private GoodsParamsService goodsParamsService;
+
//分类
@Autowired
private CategoryService categoryService;
@@ -85,11 +87,16 @@ public class GoodsServiceImpl extends ServiceImpl implements
//rocketMq配置
@Autowired
private RocketmqCustomProperties rocketmqCustomProperties;
+ @Autowired
+ private CategoryParameterGroupService categoryParameterGroupService;
@Override
public void underStoreGoods(String storeId) {
- this.baseMapper.underStoreGoods(storeId);
+ //获取商品ID列表
+ List list= this.baseMapper.getGoodsIdByStoreId(storeId);
+ //下架店铺下的商品
+ updateGoodsMarketAble(list,GoodsStatusEnum.DOWN,"店铺关闭");
}
@Override
@@ -107,12 +114,15 @@ public class GoodsServiceImpl extends ServiceImpl implements
this.checkGoods(goods);
//向goods加入图片
this.setGoodsGalleryParam(goodsOperationDTO.getGoodsGalleryList().get(0), goods);
+ //添加商品参数
+ if (goodsOperationDTO.getGoodsParamsDTOList() != null && !goodsOperationDTO.getGoodsParamsDTOList().isEmpty()) {
+ //检测商品参数是否合法
+ //this.checkGoodsParams(goodsOperationDTO.getGoodsParamsDTOList(), goodsOperationDTO.getCategoryPath().substring(goodsOperationDTO.getCategoryPath().lastIndexOf(",") + 1));
+ //给商品参数填充值
+ goods.setParams(JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsDTOList()));
+ }
//添加商品
this.save(goods);
- //添加商品参数
- if (goodsOperationDTO.getGoodsParamsList() != null && !goodsOperationDTO.getGoodsParamsList().isEmpty()) {
- this.goodsParamsService.addParams(goodsOperationDTO.getGoodsParamsList(), goods.getId());
- }
//添加商品sku信息
this.goodsSkuService.add(goodsOperationDTO.getSkuList(), goods);
//添加相册
@@ -130,12 +140,12 @@ public class GoodsServiceImpl extends ServiceImpl implements
this.checkGoods(goods);
//向goods加入图片
this.setGoodsGalleryParam(goodsOperationDTO.getGoodsGalleryList().get(0), goods);
+ //添加商品参数
+ if (goodsOperationDTO.getGoodsParamsDTOList() != null && !goodsOperationDTO.getGoodsParamsDTOList().isEmpty()) {
+ goods.setParams(JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsDTOList()));
+ }
//修改商品
this.updateById(goods);
- //添加商品参数
- if (goodsOperationDTO.getGoodsParamsList() != null && !goodsOperationDTO.getGoodsParamsList().isEmpty()) {
- this.goodsParamsService.addParams(goodsOperationDTO.getGoodsParamsList(), goods.getId());
- }
//修改商品sku信息
this.goodsSkuService.update(goodsOperationDTO.getSkuList(), goods, goodsOperationDTO.getRegeneratorSkuFlag());
//添加相册
@@ -180,7 +190,10 @@ public class GoodsServiceImpl extends ServiceImpl implements
}
goodsVO.setCategoryName(categoryName);
- goodsVO.setGoodsParamsList(goodsParamsService.getGoodsParamsByGoodsId(goodsId));
+ //参数非空则填写参数
+ if (StringUtils.isNotEmpty(goods.getParams())) {
+ goodsVO.setGoodsParamsDTOList(JSONUtil.toList(goods.getParams(), GoodsParamsDTO.class));
+ }
return goodsVO;
}
@@ -321,6 +334,52 @@ public class GoodsServiceImpl extends ServiceImpl implements
goods.setThumbnail(goodsGallery.getThumbnail());
}
+ /**
+ * 检测商品参数是否非法传递
+ *
+ * @param goodsParamsDTOS 商品参数
+ * @param categoryId 分类id
+ */
+ private void checkGoodsParams(List goodsParamsDTOS, String categoryId) {
+ //根据绑定的分了id查询出参数信息
+ List parameterGroupVOS = categoryParameterGroupService.getCategoryParams(categoryId);
+ if (parameterGroupVOS.size() > 0) {
+ //绑定分类的参数集合
+ List parametersList = new ArrayList<>();
+ //循环分类绑定的参数信息 把它整理到新的分类参数集合中 用于最后的参数信息对比
+ for (ParameterGroupVO parameterGroupVO : parameterGroupVOS) {
+ List parameters = parameterGroupVO.getParams();
+ for (Parameters param : parameters) {
+ parametersList.add(param);
+ }
+ }
+ List goodsOperationParamList = new ArrayList<>();
+ //循环添加商品传递的参数信息 把它整理到新的分类参数集合中 用于最后的参数信息对比
+ for (GoodsParamsDTO goodsParamsDTO : goodsParamsDTOS) {
+ List goodsParamsItemDTOS = goodsParamsDTO.getGoodsParamsItemDTOList();
+ for (GoodsParamsItemDTO goodsParamsItemDTO : goodsParamsItemDTOS) {
+ goodsOperationParamList.add(goodsParamsItemDTO);
+ }
+ }
+ //两个参数集合进行对比
+ for (Parameters parameters :parametersList){
+ for (GoodsParamsItemDTO goodsParamsItemDTO :goodsOperationParamList){
+ if(parameters.getId().equals(goodsParamsItemDTO.getParamId())){
+ //校验是否可以索引参数是否正确
+ if(!parameters.getIsIndex().equals(goodsParamsItemDTO.getIsIndex())){
+ throw new ServiceException("商品参数错误,刷新后重试");
+ }
+ //校验是否必填参数是否正确
+ if(!parameters.getRequired().equals(goodsParamsItemDTO.getRequired())){
+ throw new ServiceException("商品参数错误,刷新后重试");
+ }
+ }
+ }
+ }
+
+ }
+ }
+
/**
* 检查商品信息
* 如果商品是虚拟商品则无需配置配送模板
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 9f8e0f68..8f28f806 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
@@ -11,9 +11,10 @@ import cn.lili.common.rocketmq.RocketmqSendCallbackBuilder;
import cn.lili.common.rocketmq.tags.GoodsTagsEnum;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.utils.PageUtil;
+import cn.lili.common.utils.StringUtils;
import cn.lili.config.rocketmq.RocketmqCustomProperties;
import cn.lili.modules.goods.entity.dos.Goods;
-import cn.lili.modules.goods.entity.dos.GoodsParams;
+import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.dto.GoodsSearchParams;
import cn.lili.modules.goods.entity.dto.GoodsSkuStockDTO;
@@ -44,6 +45,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
+import java.util.stream.Collectors;
/**
* 商品sku业务层实现
@@ -64,9 +66,6 @@ public class GoodsSkuServiceImpl extends ServiceImpl i
//商品相册
@Autowired
private GoodsGalleryService goodsGalleryService;
- //规格
- @Autowired
- private SpecificationService specificationService;
//缓存
@Autowired
private StringRedisTemplate stringRedisTemplate;
@@ -208,7 +207,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl i
//获取当前商品的索引信息
EsGoodsIndex goodsIndex = goodsIndexService.findById(skuId);
if (goodsIndex == null) {
- goodsIndex = goodsIndexService.resetEsGoodsIndex(goodsSku, goodsVO.getGoodsParamsList());
+ goodsIndex = goodsIndexService.resetEsGoodsIndex(goodsSku, goodsVO.getGoodsParamsDTOList());
}
//商品规格
GoodsSkuVO goodsSkuDetail = this.getGoodsSkuVO(goodsSku);
@@ -320,33 +319,30 @@ public class GoodsSkuServiceImpl extends ServiceImpl i
@Override
public GoodsSkuVO getGoodsSkuVO(GoodsSku goodsSku) {
+ //厨师还商品
GoodsSkuVO goodsSkuVO = new GoodsSkuVO(goodsSku);
+ //获取sku信息
JSONObject jsonObject = JSONUtil.parseObj(goodsSku.getSpecs());
+ //用于接受sku信息
List specValueVOS = new ArrayList<>();
+ //用于接受sku相册
List goodsGalleryList = new ArrayList<>();
-// for (Map.Entry entry : jsonObject.entrySet()) {
-// SpecValueVO s = new SpecValueVO();
-// if (entry.getKey().equals("images")) {
-// s.setSpecName(entry.getKey());
-// if (entry.getValue().toString().contains("url")) {
-// List specImages = JSONUtil.toList(JSONUtil.parseArray(entry.getValue()), SpecValueVO.SpecImages.class);
-// s.setSpecImage(specImages);
-// goodsGalleryList = specImages.stream().map(SpecValueVO.SpecImages::getUrl).collect(Collectors.toList());
-// }
-// } else {
-// SpecificationVO specificationVO = new SpecificationVO();
-// specificationVO.setSpecName(entry.getKey());
-// specificationVO.setStoreId(goodsSku.getStoreId());
-// specificationVO.setCategoryPath(goodsSku.getCategoryPath());
-// Specification specification = specificationService.addSpecification(specificationVO);
-// s.setSpecNameId(specification.getId());
-// SpecValues specValues = specValuesService.getSpecValues(entry.getValue().toString(), specification.getId());
-// s.setSpecValueId(specValues.getId());
-// s.setSpecName(entry.getKey());
-// s.setSpecValue(entry.getValue().toString());
-// }
-// specValueVOS.add(s);
-// }
+ //循环提交的sku表单
+ for (Map.Entry entry : jsonObject.entrySet()) {
+ SpecValueVO specValueVO = new SpecValueVO();
+ if (entry.getKey().equals("images")) {
+ specValueVO.setSpecName(entry.getKey());
+ if (entry.getValue().toString().contains("url")) {
+ List specImages = JSONUtil.toList(JSONUtil.parseArray(entry.getValue()), SpecValueVO.SpecImages.class);
+ specValueVO.setSpecImage(specImages);
+ goodsGalleryList = specImages.stream().map(SpecValueVO.SpecImages::getUrl).collect(Collectors.toList());
+ }
+ } else {
+ specValueVO.setSpecName(entry.getKey());
+ specValueVO.setSpecValue(entry.getValue().toString());
+ }
+ specValueVOS.add(specValueVO);
+ }
goodsSkuVO.setGoodsGalleryList(goodsGalleryList);
goodsSkuVO.setSpecList(specValueVOS);
return goodsSkuVO;
@@ -465,8 +461,8 @@ public class GoodsSkuServiceImpl extends ServiceImpl i
EsGoodsIndex esGoodsOld = goodsIndexService.findById(goodsSku.getId());
EsGoodsIndex goodsIndex = new EsGoodsIndex(goodsSku);
if (goods.getParams() != null && !goods.getParams().isEmpty()) {
- List goodsParams = JSONUtil.toList(goods.getParams(), GoodsParams.class);
- goodsIndex = new EsGoodsIndex(goodsSku, goodsParams);
+ List goodsParamDTOS = JSONUtil.toList(goods.getParams(), GoodsParamsDTO.class);
+ goodsIndex = new EsGoodsIndex(goodsSku, goodsParamDTOS);
}
//如果商品库存不为0,并且es中有数据
if (goodsSku.getQuantity() > 0 && esGoodsOld == null) {
@@ -606,29 +602,34 @@ public class GoodsSkuServiceImpl extends ServiceImpl i
List attributes = new ArrayList<>();
//获取规格信息
- for (Map.Entry m : map.entrySet()) {
+ for (Map.Entry spec : map.entrySet()) {
//保存规格信息
- if (m.getKey().equals("id") || m.getKey().equals("sn") || m.getKey().equals("cost") || m.getKey().equals("price") || m.getKey().equals("quantity") || m.getKey().equals("weight")) {
+ if (spec.getKey().equals("id") || spec.getKey().equals("sn") || spec.getKey().equals("cost")
+ || spec.getKey().equals("price") || spec.getKey().equals("quantity")
+ || spec.getKey().equals("weight")) {
continue;
} else {
- specMap.put(m.getKey(), m.getValue());
- if (m.getKey().equals("images")) {
+ specMap.put(spec.getKey(), spec.getValue());
+ if (spec.getKey().equals("images")) {
//设置规格商品缩略图
- List