From c9b7ee2c81a983bb41ae635ad1632b058f404d8d Mon Sep 17 00:00:00 2001 From: Chopper Date: Thu, 24 Jun 2021 10:57:27 +0800 Subject: [PATCH 01/55] =?UTF-8?q?=20=E5=95=86=E5=93=81=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/goods/entity/dos/DraftGoods.java | 9 +- .../modules/goods/entity/vos/SpecValueVO.java | 18 +++- .../serviceimpl/GoodsParamsServiceImpl.java | 7 +- .../serviceimpl/GoodsSkuServiceImpl.java | 83 ++++++++++--------- .../PlatformViewDataServiceImpl.java | 3 - .../goods/SpecificationStoreController.java | 3 +- 6 files changed, 63 insertions(+), 60 deletions(-) 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/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/serviceimpl/GoodsParamsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsParamsServiceImpl.java index 4fae7285..93296051 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsParamsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsParamsServiceImpl.java @@ -2,7 +2,6 @@ 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; @@ -12,7 +11,6 @@ import cn.lili.modules.goods.service.ParametersService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -38,8 +36,6 @@ public class GoodsParamsServiceImpl extends ServiceImpl paramList, String goodsId) { @@ -48,12 +44,11 @@ public class GoodsParamsServiceImpl extends ServiceImpl i //商品相册 @Autowired private GoodsGalleryService goodsGalleryService; - //规格 - @Autowired - private SpecificationService specificationService; //缓存 @Autowired private StringRedisTemplate stringRedisTemplate; @@ -317,33 +316,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; @@ -603,29 +599,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> images = (List>) m.getValue(); + List> images = (List>) spec.getValue(); if (images == null || images.isEmpty()) { - throw new ServiceException("sku图片至少为一个"); + continue; + } + //设置规格商品缩略图 + //如果规格没有图片,则用商品图片复盖。有则增加规格图片,放在商品图片集合之前 + if (spec.getValue() != null && StringUtils.isNotEmpty(spec.getValue().toString())) { + thumbnail = goodsGalleryService.getGoodsGallery(images.get(0).get("url")).getThumbnail(); + small = goodsGalleryService.getGoodsGallery(images.get(0).get("url")).getSmall(); + } else { + //设置商品名称 + goodsName.append(" ").append(spec.getValue()); + //规格简短信息 + simpleSpecs.append(" ").append(spec.getValue()); } - thumbnail = goodsGalleryService.getGoodsGallery(images.get(0).get("url")).getThumbnail(); - small = goodsGalleryService.getGoodsGallery(images.get(0).get("url")).getSmall(); - } else { - //设置商品名称 - goodsName.append(" ").append(m.getValue()); - //规格简短信息 - simpleSpecs.append(" ").append(m.getValue()); } } } - //设置规格信息 sku.setGoodsName(goodsName.toString()); sku.setThumbnail(thumbnail); @@ -656,4 +657,4 @@ public class GoodsSkuServiceImpl extends ServiceImpl i public void setGoodsIndexService(EsGoodsIndexService goodsIndexService) { this.goodsIndexService = goodsIndexService; } -} \ No newline at end of file +} diff --git a/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/PlatformViewDataServiceImpl.java b/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/PlatformViewDataServiceImpl.java index 8d69e54f..2d358804 100644 --- a/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/PlatformViewDataServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/PlatformViewDataServiceImpl.java @@ -4,7 +4,6 @@ import cn.lili.common.cache.Cache; import cn.lili.common.cache.CachePrefix; import cn.lili.common.security.enums.UserEnums; import cn.lili.common.utils.CurrencyUtil; -import cn.lili.common.utils.DateUtil; import cn.lili.config.properties.StatisticsProperties; import cn.lili.modules.base.entity.enums.ClientTypeEnum; import cn.lili.modules.member.entity.vo.MemberDistributionVO; @@ -221,8 +220,6 @@ public class PlatformViewDataServiceImpl extends ServiceImpl getSpecifications(String categoryId) { + public List getSpecifications(@PathVariable String categoryId) { return categorySpecificationService.getCategorySpecList(categoryId); } From 158234412c99c89da291c607460a2fda7990c71b Mon Sep 17 00:00:00 2001 From: Chopper Date: Thu, 24 Jun 2021 11:18:13 +0800 Subject: [PATCH 02/55] =?UTF-8?q?uv=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../statistics/serviceimpl/PlatformViewDataServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/PlatformViewDataServiceImpl.java b/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/PlatformViewDataServiceImpl.java index 2d358804..c39cf71e 100644 --- a/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/PlatformViewDataServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/PlatformViewDataServiceImpl.java @@ -51,6 +51,9 @@ public class PlatformViewDataServiceImpl extends ServiceImpl Date: Thu, 24 Jun 2021 15:29:23 +0800 Subject: [PATCH 03/55] =?UTF-8?q?=E8=99=9A=E6=8B=9F=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E4=BF=AE=E6=94=B9=E6=94=B6=E4=BB=B6=E4=BA=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/modules/order/order/entity/vo/AllowOperation.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java b/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java index dd8a1e9a..29a956e5 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java @@ -69,8 +69,9 @@ public class AllowOperation implements Serializable { //新订单,允许支付 this.pay = status.equals(OrderStatusEnum.UNPAID.name()) && payStatus.equals(PayStatusEnum.UNPAID.name()); - //订单未发货,就可以编辑收货人信息 - this.editConsignee = order.getDeliverStatus().equals(DeliverStatusEnum.UNDELIVERED.name()) && !status.equals(OrderStatusEnum.CANCELLED.name()); + //订单未发货,就可以编辑收货人信息(实物订单) + this.editConsignee = order.getOrderType().equals(OrderTypeEnum.VIRTUAL.name()) && + order.getDeliverStatus().equals(DeliverStatusEnum.UNDELIVERED.name()) && !status.equals(OrderStatusEnum.CANCELLED.name()); //是否允许被发货 this.ship = editConsignee && status.equals(OrderStatusEnum.UNDELIVERED.name()); From e6ad65d8c0fa90e76a737388ce28b241d06d23b8 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Thu, 24 Jun 2021 15:51:14 +0800 Subject: [PATCH 04/55] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=8F=91=E8=A1=8C?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E6=98=AF0,=E5=88=99=E4=B8=8D=E9=99=90?= =?UTF-8?q?=E5=88=B6=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/lili/modules/promotion/entity/dos/Coupon.java | 2 +- .../modules/promotion/serviceimpl/CouponServiceImpl.java | 6 +++--- .../promotion/serviceimpl/MemberCouponServiceImpl.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/promotion/entity/dos/Coupon.java b/framework/src/main/java/cn/lili/modules/promotion/entity/dos/Coupon.java index 9c9739e0..1188a79a 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/entity/dos/Coupon.java +++ b/framework/src/main/java/cn/lili/modules/promotion/entity/dos/Coupon.java @@ -66,7 +66,7 @@ public class Coupon extends BasePromotion { @ApiModelProperty(value = "活动描述") private String description; - @ApiModelProperty(value = "发行数量") + @ApiModelProperty(value = "发行数量,如果是0则是不限制") private Integer publishNum; @ApiModelProperty(value = "领取限制") diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java index 16111412..de3683db 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java @@ -271,8 +271,8 @@ public class CouponServiceImpl extends ServiceImpl impleme if (coupon.getCouponLimitNum() < 0) { throw new ServiceException("领取限制数量不能为负数"); } - - if (coupon.getCouponLimitNum() > coupon.getPublishNum()) { + //如果发行数量是0则判断领取限制数量 + if (coupon.getPublishNum() != 0 && coupon.getCouponLimitNum() > coupon.getPublishNum()) { throw new ServiceException("领取限制数量超出发行数量"); } @@ -282,7 +282,7 @@ public class CouponServiceImpl extends ServiceImpl impleme throw new ServiceException("优惠券折扣必须小于10且大于0"); } - if (coupon.getRangeDayType().equals(CouponRangeDayEnum.FIXEDTIME.name())) { + if (coupon.getRangeDayType() != null && coupon.getRangeDayType().equals(CouponRangeDayEnum.FIXEDTIME.name())) { long nowTime = DateUtil.getDateline() * 1000; if (coupon.getStartTime().getTime() < nowTime && coupon.getEndTime().getTime() > nowTime) { throw new ServiceException("活动时间小于当前时间,不能进行编辑删除操作"); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java index 7ac348ca..b5177a18 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java @@ -55,7 +55,7 @@ public class MemberCouponServiceImpl extends ServiceImpl= coupon.getPublishNum()) { + if (coupon.getPublishNum() != 0 && coupon.getReceivedNum() >= coupon.getPublishNum()) { throw new ServiceException("优惠券剩余领取数量不足"); } if (haveCoupons >= coupon.getCouponLimitNum()) { From 9c574ad9b75711f50ac8ac2abedf6c6f30110be2 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Thu, 24 Jun 2021 16:03:49 +0800 Subject: [PATCH 05/55] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=AA=92=E4=BD=93=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/lili/modules/broadcast/util/WechatMediaUtil.java | 1 + 1 file changed, 1 insertion(+) 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..70cb60a4 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 @@ -98,6 +98,7 @@ public class WechatMediaUtil { log.error("微信媒体上传失败",e); } JSONObject jsonObject=new JSONObject(resultStr.toString()); + log.info("微信媒体上传:"+jsonObject.toString()); return jsonObject.get("media_id").toString(); } /** From 30846819d869584297fbedf4f2dc61d86a38da22 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Thu, 24 Jun 2021 17:19:17 +0800 Subject: [PATCH 06/55] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BA=BF=E4=B8=8A?= =?UTF-8?q?=E3=80=81=E6=9C=AC=E5=9C=B0=E5=BC=80=E5=8F=91=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=BE=AE=E4=BF=A1token=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../broadcast/util/WechatLivePlayerUtil.java | 123 ++++++++---------- .../broadcast/util/WechatMediaUtil.java | 53 +++++--- .../message/util/WechatAccessTokenUtil.java | 7 + 3 files changed, 94 insertions(+), 89 deletions(-) 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..d6a4fded 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,48 @@ 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").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 70cb60a4..792f24ad 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,28 +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()); - log.info("微信媒体上传:"+jsonObject.toString()); - return jsonObject.get("media_id").toString(); + JSONObject jsonObject = new JSONObject(resultStr.toString()); + log.info("微信媒体上传:" + jsonObject.toString()); + //判断是否传递成功,如果token过期则重新获取 + if (jsonObject.get("errcode").equals("0")) { + return jsonObject.get("media_id").toString(); + } else if (jsonObject.get("errcode").equals("40001")) { + wechatAccessTokenUtil.removeAccessToken(ClientTypeEnum.WECHAT_MP); + return this.uploadMedia(type, mediaFileUrl); + } else { + throw new ServiceException(jsonObject.get("errmsg").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/message/util/WechatAccessTokenUtil.java b/framework/src/main/java/cn/lili/modules/message/util/WechatAccessTokenUtil.java index 26ca19e2..0ec1b8e5 100644 --- a/framework/src/main/java/cn/lili/modules/message/util/WechatAccessTokenUtil.java +++ b/framework/src/main/java/cn/lili/modules/message/util/WechatAccessTokenUtil.java @@ -110,5 +110,12 @@ public class WechatAccessTokenUtil { } + /** + * 清除 token + * @param clientTypeEnum + */ + public void removeAccessToken(ClientTypeEnum clientTypeEnum) { + cache.remove(CachePrefix.WECHAT_CGI_ACCESS_TOKEN.getPrefix() + clientTypeEnum.name()); + } } \ No newline at end of file From 83367ca96d19bec303ab0623ef19f28728e03ab4 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Thu, 24 Jun 2021 17:30:03 +0800 Subject: [PATCH 07/55] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=AA=92=E4=BD=93=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/modules/broadcast/util/WechatMediaUtil.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 792f24ad..768d6b53 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 @@ -108,13 +108,13 @@ public class WechatMediaUtil { JSONObject jsonObject = new JSONObject(resultStr.toString()); log.info("微信媒体上传:" + jsonObject.toString()); //判断是否传递成功,如果token过期则重新获取 - if (jsonObject.get("errcode").equals("0")) { - return jsonObject.get("media_id").toString(); - } else if (jsonObject.get("errcode").equals("40001")) { + if (jsonObject.get("errcode").equals("40001")) { wechatAccessTokenUtil.removeAccessToken(ClientTypeEnum.WECHAT_MP); return this.uploadMedia(type, mediaFileUrl); - } else { + } else if (jsonObject.get("errcode")!=null) { throw new ServiceException(jsonObject.get("errmsg").toString()); + } else { + return jsonObject.get("media_id").toString(); } } From 4fd8e4ecef391ffb7f86592a973399c0e6078f92 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Thu, 24 Jun 2021 18:17:16 +0800 Subject: [PATCH 08/55] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=99=9A=E6=8B=9F?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=94=AE=E5=90=8E=E7=B1=BB=E5=9E=8B=E5=8F=AA?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=80=80=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/event/impl/VerificationOrderExecute.java | 12 +++++++++++- .../lili/modules/broadcast/util/WechatMediaUtil.java | 4 ++-- .../order/order/entity/vo/AfterSaleApplyVO.java | 8 ++++++++ .../order/serviceimpl/AfterSaleServiceImpl.java | 9 +++++++++ .../order/order/serviceimpl/OrderServiceImpl.java | 9 ++------- 5 files changed, 32 insertions(+), 10 deletions(-) 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/framework/src/main/java/cn/lili/modules/broadcast/util/WechatMediaUtil.java b/framework/src/main/java/cn/lili/modules/broadcast/util/WechatMediaUtil.java index 768d6b53..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 @@ -108,10 +108,10 @@ public class WechatMediaUtil { JSONObject jsonObject = new JSONObject(resultStr.toString()); log.info("微信媒体上传:" + jsonObject.toString()); //判断是否传递成功,如果token过期则重新获取 - if (jsonObject.get("errcode").equals("40001")) { + 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) { + } else if (jsonObject.get("errcode") != null) { throw new ServiceException(jsonObject.get("errmsg").toString()); } else { return jsonObject.get("media_id").toString(); diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AfterSaleApplyVO.java b/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AfterSaleApplyVO.java index 5259e528..847e2ca0 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AfterSaleApplyVO.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AfterSaleApplyVO.java @@ -47,4 +47,12 @@ public class AfterSaleApplyVO { */ @ApiModelProperty(value = "账号类型", allowableValues = "ALIPAY,WECHATPAY,MEMBERWALLET,BANKTRANSFER") private String accountType; + + @ApiModelProperty(value = "是否支持退货") + private boolean returnGoods; + + @ApiModelProperty(value = "是否支持退款") + private boolean returnMoney; + + } diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java index 2df123ac..4c4e44a5 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java @@ -20,6 +20,7 @@ import cn.lili.modules.order.order.entity.dos.OrderItem; import cn.lili.modules.order.order.entity.dto.AfterSaleDTO; import cn.lili.modules.order.order.entity.enums.OrderItemAfterSaleStatusEnum; import cn.lili.modules.order.order.entity.enums.OrderStatusEnum; +import cn.lili.modules.order.order.entity.enums.OrderTypeEnum; import cn.lili.modules.order.order.entity.enums.PayStatusEnum; import cn.lili.modules.order.order.entity.vo.AfterSaleApplyVO; import cn.lili.modules.order.order.entity.vo.AfterSaleSearchParams; @@ -128,6 +129,14 @@ public class AfterSaleServiceImpl extends ServiceImpl implements //检测虚拟订单信息 checkVerificationOrder(order, verificationCode); order.setOrderStatus(OrderStatusEnum.COMPLETED.name()); - //修改订单信息 - this.updateById(order); - //发送订单完成消息 - OrderMessage orderMessage = new OrderMessage(); - orderMessage.setNewStatus(OrderStatusEnum.COMPLETED); - orderMessage.setOrderSn(order.getSn()); - this.sendUpdateStatusMessage(orderMessage); + //订单完成 + this.complete(orderSn); return order; } From 02d23dc21753c65c8d962b1d85071c64bcd5b613 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 25 Jun 2021 09:46:38 +0800 Subject: [PATCH 09/55] =?UTF-8?q?1=E3=80=81=E4=B8=BB=E8=A6=81=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=95=86=E5=93=81=E5=8F=82=E6=95=B0=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E9=97=AE=E9=A2=98=E7=AD=89=202=E3=80=81?= =?UTF-8?q?=E9=85=8D=E9=80=81=E5=95=86=E5=93=81=E8=B6=85=E5=87=BA=E9=85=8D?= =?UTF-8?q?=E9=80=81=E5=8C=BA=E5=9F=9F=E6=8F=90=E5=87=BA=E8=AD=A6=E5=91=8A?= =?UTF-8?q?=EF=BC=8C=E4=BD=86=E6=98=AF=E4=BE=9D=E7=84=B6=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E4=B8=8B=E5=8D=95=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/lili/common/enums/ResultCode.java | 2 + .../common/verification/SliderImageUtil.java | 2 +- .../lili/modules/goods/entity/dos/Goods.java | 4 +- .../modules/goods/entity/dos/GoodsParams.java | 67 -------- .../modules/goods/entity/dos/Parameters.java | 11 +- .../goods/entity/dos/Specification.java | 4 +- .../goods/entity/dto/DraftGoodsDTO.java | 3 +- .../goods/entity/dto/GoodsOperationDTO.java | 7 +- .../goods/entity/dto/GoodsParamsDTO.java | 31 ++++ .../goods/entity/dto/GoodsParamsItemDTO.java | 35 +++++ .../goods/entity/vos/DraftGoodsVO.java | 5 +- ...odsParamsVO.java => GoodsParamsDTOVO.java} | 4 +- .../goods/entity/vos/GoodsParamsGroupVO.java | 2 +- .../modules/goods/entity/vos/GoodsVO.java | 4 +- .../goods/mapper/GoodsParamsMapper.java | 8 +- .../goods/service/GoodsParamsService.java | 76 ---------- .../serviceimpl/CategoryServiceImpl.java | 10 +- .../serviceimpl/DraftGoodsServiceImpl.java | 9 +- .../serviceimpl/GoodsParamsServiceImpl.java | 143 ------------------ .../goods/serviceimpl/GoodsServiceImpl.java | 26 ++-- .../serviceimpl/GoodsSkuServiceImpl.java | 8 +- .../order/cart/render/TradeBuilder.java | 13 +- .../search/entity/dos/EsGoodsIndex.java | 53 +++---- .../search/service/EsGoodsIndexService.java | 6 +- .../serviceimpl/EsGoodsIndexServiceImpl.java | 8 +- ...tegoryParameterGroupManagerController.java | 7 +- .../GoodsParameterManagerController.java | 1 - .../goods/ParameterManagerController.java | 1 - .../other/ElasticsearchController.java | 8 +- 29 files changed, 179 insertions(+), 379 deletions(-) delete mode 100644 framework/src/main/java/cn/lili/modules/goods/entity/dos/GoodsParams.java create mode 100644 framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsDTO.java create mode 100644 framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsParamsItemDTO.java rename framework/src/main/java/cn/lili/modules/goods/entity/vos/{GoodsParamsVO.java => GoodsParamsDTOVO.java} (90%) delete mode 100644 framework/src/main/java/cn/lili/modules/goods/service/GoodsParamsService.java delete mode 100644 framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsParamsServiceImpl.java 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..b23eb766 100644 --- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java +++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java @@ -196,6 +196,8 @@ public enum ResultCode { ORDER_DELIVER_NUM_ERROR(31010, "没有待发货的订单"), + ORDER_NOT_SUPPORT_DISTRIBUTION(31011, "购物车中包含不支持配送的商品,请重新选择收货地址,或者重新选择商品"), + /** * 支付 */ 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/goods/entity/dos/Goods.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java index acf79d3d..e4f8eefa 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 @@ -221,8 +221,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(); 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/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 9c91b756..00000000 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsParamsServiceImpl.java +++ /dev/null @@ -1,143 +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.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; - - - @Override - public void addParams(List paramList, String goodsId) { - //先删除现有商品参数 - this.remove(new UpdateWrapper().eq("goods_id", goodsId)); - //循环添加参数 - if (paramList != null) { - for (GoodsParams param : paramList) { - GoodsParams goodsParams = new GoodsParams(); - goodsParams.setGoodsId(goodsId); - goodsParams.setParamName(param.getParamName()); - goodsParams.setParamValue(param.getParamValue()); - goodsParams.setIsIndex(param.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..b93dbeca 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 @@ -17,6 +17,7 @@ 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.dto.GoodsOperationDTO; +import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; import cn.lili.modules.goods.entity.dto.GoodsSearchParams; import cn.lili.modules.goods.entity.enums.GoodsAuthEnum; import cn.lili.modules.goods.entity.enums.GoodsStatusEnum; @@ -59,9 +60,7 @@ import java.util.List; @Transactional public class GoodsServiceImpl extends ServiceImpl implements GoodsService { - //商品属性 - @Autowired - private GoodsParamsService goodsParamsService; + //分类 @Autowired private CategoryService categoryService; @@ -107,12 +106,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.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 +129,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 +179,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; } 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 3f7419b1..adfcb2c9 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 @@ -14,7 +14,7 @@ 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; @@ -204,7 +204,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); @@ -458,8 +458,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) { diff --git a/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java b/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java index d51ddd1c..2f75e40d 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java @@ -1,5 +1,7 @@ package cn.lili.modules.order.cart.render; +import cn.lili.common.enums.ResultCode; +import cn.lili.common.exception.ServiceException; import cn.lili.modules.order.cart.entity.dto.TradeDTO; import cn.lili.modules.order.cart.entity.enums.CartTypeEnum; import cn.lili.modules.order.cart.entity.vo.CartSkuVO; @@ -98,6 +100,15 @@ public class TradeBuilder { log.error("购物车{}渲染异常:", cartRenderSteps.get(index).getClass(), e); } } + + if (tradeDTO.getNotSupportFreight() != null && tradeDTO.getNotSupportFreight().size() > 0) { + StringBuilder stringBuilder = new StringBuilder("包含商品有-"); + tradeDTO.getNotSupportFreight().forEach(sku -> { + stringBuilder.append(sku.getGoodsSku().getGoodsName()); + }); + throw new ServiceException(ResultCode.ORDER_NOT_SUPPORT_DISTRIBUTION, stringBuilder.toString()); + } + //购物车信息接受 List cartVOList = new ArrayList<>(); //循环购物车信息 @@ -113,7 +124,7 @@ public class TradeBuilder { /** * 创建一笔交易 * - * @param checkedWay 购物车类型 + * @param checkedWay 购物车类型 * @return 交易信息 */ public Trade createTrade(CartTypeEnum checkedWay) { diff --git a/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java b/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java index e8388bd1..e3b72a27 100644 --- a/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java +++ b/framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java @@ -1,8 +1,8 @@ package cn.lili.modules.search.entity.dos; import cn.lili.common.elasticsearch.EsSuffix; -import cn.lili.modules.goods.entity.dos.GoodsParams; import cn.lili.modules.goods.entity.dos.GoodsSku; +import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -273,36 +273,37 @@ public class EsGoodsIndex implements Serializable { this.intro = sku.getIntro(); this.grade = sku.getGrade(); this.releaseTime = new Date(); -// if (CharSequenceUtil.isNotEmpty(sku.getSpecs())) { -// List attributes = new ArrayList<>(); -// JSONObject jsonObject = JSONUtil.parseObj(sku.getSpecs()); -// for (Map.Entry entry : jsonObject.entrySet()) { -// if (!entry.getKey().equals("images")) { -// EsGoodsAttribute attribute = new EsGoodsAttribute(); -// attribute.setType(1); -// attribute.setName(entry.getKey()); -// attribute.setValue(entry.getValue().toString()); -// attributes.add(attribute); -// } -// } -// this.attrList = attributes; -// } } } - public EsGoodsIndex(GoodsSku sku, List goodsParams) { + /** + * 参数索引增加 + * + * @param sku + * @param goodsParamDTOS + */ + public EsGoodsIndex(GoodsSku sku, List goodsParamDTOS) { this(sku); - if (goodsParams != null && !goodsParams.isEmpty()) { + //如果参数不为空 + if (goodsParamDTOS != null && !goodsParamDTOS.isEmpty()) { + //接受不了参数索引 List attributes = new ArrayList<>(); - for (GoodsParams goodsParam : goodsParams) { - EsGoodsAttribute attribute = new EsGoodsAttribute(); - if (goodsParam.getIsIndex() != null && goodsParam.getIsIndex() == 1) { - attribute.setType(1); - attribute.setName(goodsParam.getParamName()); - attribute.setValue(goodsParam.getParamValue()); - attributes.add(attribute); - } - } + //循环参数分组 + goodsParamDTOS.forEach(goodsParamGroup -> { + //循环分组的内容 + goodsParamGroup.getGoodsParamsItemDTOList().forEach(goodsParam -> { + //如果字段需要索引,则增加索引字段 + if (goodsParam.getIsIndex() != null && goodsParam.getIsIndex() == 1) { + EsGoodsAttribute attribute = new EsGoodsAttribute(); + attribute.setType(1); + attribute.setName(goodsParam.getParamName()); + attribute.setValue(goodsParam.getParamValue()); + attributes.add(attribute); + } + } + ); + + }); this.attrList = attributes; } } diff --git a/framework/src/main/java/cn/lili/modules/search/service/EsGoodsIndexService.java b/framework/src/main/java/cn/lili/modules/search/service/EsGoodsIndexService.java index fbc7bc17..1d696cb2 100644 --- a/framework/src/main/java/cn/lili/modules/search/service/EsGoodsIndexService.java +++ b/framework/src/main/java/cn/lili/modules/search/service/EsGoodsIndexService.java @@ -1,6 +1,6 @@ package cn.lili.modules.search.service; -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.promotion.entity.dos.PromotionGoods; import cn.lili.modules.promotion.entity.dto.BasePromotion; @@ -146,8 +146,8 @@ public interface EsGoodsIndexService { * 重置当前商品索引 * * @param goodsSku 商品sku信息 - * @param goodsParams 商品参数 + * @param goodsParamDTOS 商品参数 * @return 商品索引 */ - EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List goodsParams); + EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List goodsParamDTOS); } diff --git a/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java b/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java index e1240279..8ac541e4 100644 --- a/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsIndexServiceImpl.java @@ -8,7 +8,7 @@ import cn.hutool.extra.pinyin.PinyinUtil; import cn.lili.common.elasticsearch.BaseElasticsearchService; import cn.lili.common.elasticsearch.EsSuffix; import cn.lili.config.elasticsearch.ElasticsearchProperties; -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.dos.GoodsWords; import cn.lili.modules.goods.entity.enums.GoodsWordsTypeEnum; @@ -368,12 +368,12 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements * 重置当前商品索引 * * @param goodsSku 商品sku信息 - * @param goodsParams 商品参数 + * @param goodsParamDTOS 商品参数 * @return 商品索引 */ @Override - public EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List goodsParams) { - EsGoodsIndex index = new EsGoodsIndex(goodsSku, goodsParams); + public EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List goodsParamDTOS) { + EsGoodsIndex index = new EsGoodsIndex(goodsSku, goodsParamDTOS); //获取活动信息 Map goodsCurrentPromotionMap = promotionService.getGoodsCurrentPromotionMap(index); //写入促销信息 diff --git a/manager-api/src/main/java/cn/lili/controller/goods/CategoryParameterGroupManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/CategoryParameterGroupManagerController.java index ca7b820e..4658ab88 100644 --- a/manager-api/src/main/java/cn/lili/controller/goods/CategoryParameterGroupManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/goods/CategoryParameterGroupManagerController.java @@ -1,8 +1,8 @@ package cn.lili.controller.goods; import cn.lili.common.enums.ResultCode; -import cn.lili.common.exception.ServiceException; import cn.lili.common.enums.ResultUtil; +import cn.lili.common.exception.ServiceException; import cn.lili.common.vo.ResultMessage; import cn.lili.modules.goods.entity.dos.CategoryParameterGroup; import cn.lili.modules.goods.entity.dos.Parameters; @@ -14,6 +14,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -50,7 +51,7 @@ public class CategoryParameterGroupManagerController { @ApiOperation(value = "保存数据") @PostMapping - public ResultMessage saveOrUpdate(CategoryParameterGroup categoryParameterGroup) { + public ResultMessage saveOrUpdate(@Validated CategoryParameterGroup categoryParameterGroup) { if (categoryParameterGroupService.save(categoryParameterGroup)) { return ResultUtil.data(categoryParameterGroup); @@ -60,7 +61,7 @@ public class CategoryParameterGroupManagerController { @ApiOperation(value = "更新数据") @PutMapping - public ResultMessage update(CategoryParameterGroup categoryParameterGroup) { + public ResultMessage update(@Validated CategoryParameterGroup categoryParameterGroup) { if (categoryParameterGroupService.updateById(categoryParameterGroup)) { return ResultUtil.data(categoryParameterGroup); diff --git a/manager-api/src/main/java/cn/lili/controller/goods/GoodsParameterManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/GoodsParameterManagerController.java index eb9ec22a..c80bbb4d 100644 --- a/manager-api/src/main/java/cn/lili/controller/goods/GoodsParameterManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/goods/GoodsParameterManagerController.java @@ -3,7 +3,6 @@ package cn.lili.controller.goods; import cn.lili.common.enums.ResultUtil; import cn.lili.common.vo.ResultMessage; import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO; -import cn.lili.modules.goods.service.GoodsParamsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; diff --git a/manager-api/src/main/java/cn/lili/controller/goods/ParameterManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/ParameterManagerController.java index 8555e5c9..6d16dadb 100644 --- a/manager-api/src/main/java/cn/lili/controller/goods/ParameterManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/goods/ParameterManagerController.java @@ -5,7 +5,6 @@ import cn.lili.common.enums.ResultUtil; import cn.lili.common.exception.ServiceException; import cn.lili.common.vo.ResultMessage; import cn.lili.modules.goods.entity.dos.Parameters; -import cn.lili.modules.goods.service.GoodsParamsService; import cn.lili.modules.goods.service.ParametersService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; diff --git a/manager-api/src/main/java/cn/lili/controller/other/ElasticsearchController.java b/manager-api/src/main/java/cn/lili/controller/other/ElasticsearchController.java index 5ab07dbd..083e91f0 100644 --- a/manager-api/src/main/java/cn/lili/controller/other/ElasticsearchController.java +++ b/manager-api/src/main/java/cn/lili/controller/other/ElasticsearchController.java @@ -2,9 +2,8 @@ package cn.lili.controller.other; import cn.hutool.json.JSONUtil; 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.dos.Parameters; import cn.lili.modules.goods.entity.enums.GoodsAuthEnum; import cn.lili.modules.goods.entity.enums.GoodsStatusEnum; import cn.lili.modules.goods.service.GoodsService; @@ -15,7 +14,6 @@ import cn.lili.modules.search.entity.dos.EsGoodsIndex; import cn.lili.modules.search.service.EsGoodsIndexService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import io.swagger.annotations.Api; -import org.junit.jupiter.api.Assertions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.web.bind.annotation.GetMapping; @@ -73,8 +71,8 @@ public class ElasticsearchController { Goods goods = goodsService.getById(goodsId); EsGoodsIndex index = new EsGoodsIndex(goodsSku); if (goods.getParams() != null && !goods.getParams().isEmpty()) { - List goodsParams = JSONUtil.toList(goods.getParams(), GoodsParams.class); - index = new EsGoodsIndex(goodsSku, goodsParams); + List goodsParamDTOS = JSONUtil.toList(goods.getParams(), GoodsParamsDTO.class); + index = new EsGoodsIndex(goodsSku, goodsParamDTOS); } Map goodsCurrentPromotionMap = promotionService.getGoodsCurrentPromotionMap(index); index.setPromotionMap(goodsCurrentPromotionMap); From 54320499e5b4aff3055dda5f20f459d2cd9a0383 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 25 Jun 2021 10:17:58 +0800 Subject: [PATCH 10/55] =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/controller/passport/MemberBuyerController.java | 6 +++--- .../src/main/java/cn/lili/common/enums/ResultCode.java | 3 ++- .../cn/lili/modules/order/cart/service/CartServiceImpl.java | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) 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 smsLogin(@NotNull(message = "手机号为空") @RequestParam String mobile, @NotNull(message = "验证码为空") @RequestParam String code, @RequestHeader String uuid) { - if(smsUtil.verifyCode(mobile,VerificationEnums.LOGIN,uuid,code)){ - return ResultUtil.data(memberService.mobilePhoneLogin(mobile)); - }else { + if (smsUtil.verifyCode(mobile, VerificationEnums.LOGIN, uuid, code)) { + return ResultUtil.data(memberService.mobilePhoneLogin(mobile)); + } else { throw new ServiceException("验证码错误"); } } 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 b23eb766..f0d99e42 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, "商品库存不足"), /** * 参数 diff --git a/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java index 4ccfd098..34b660de 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java @@ -360,17 +360,17 @@ public class CartServiceImpl implements CartService { private GoodsSku checkGoods(String skuId, Integer num) { GoodsSku dataSku = this.goodsSkuService.getGoodsSkuByIdFromCache(skuId); if (dataSku == null) { - throw new ServiceException("商品已失效,请重新选购!"); + throw new ServiceException(ResultCode.GOODS_NOT_EXIST); } if (!GoodsAuthEnum.PASS.name().equals(dataSku.getIsAuth()) || !GoodsStatusEnum.UPPER.name().equals(dataSku.getMarketEnable())) { - throw new ServiceException("商品已下架,请重新选购!"); + throw new ServiceException(ResultCode.GOODS_NOT_EXIST); } //读取sku的可用库存 Integer enableQuantity = goodsSkuService.getStock(skuId); //如果sku的可用库存小于等于0或者小于用户购买的数量,则不允许购买 if (enableQuantity <= 0 || enableQuantity < num) { - throw new ServiceException("商品库存已不足,请选购其他商品。"); + throw new ServiceException(ResultCode.GOODS_SKU_QUANTITY_NOT_ENOUGH); } return dataSku; } From 1b5add1d13bdd8b392876980eeac9737a2fe35b6 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 25 Jun 2021 10:31:10 +0800 Subject: [PATCH 11/55] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E9=87=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/modules/order/cart/service/CartServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java index 34b660de..41fd0be2 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java @@ -459,7 +459,7 @@ public class CartServiceImpl implements CartService { @Override public Long getCartNum(Boolean checked) { //构建购物车 - TradeDTO tradeDTO = this.getCheckedTradeDTO(CartTypeEnum.CART); + TradeDTO tradeDTO = this.getAllTradeDTO(); //过滤sku列表 List collect = tradeDTO.getSkuList().stream().filter(i -> Boolean.FALSE.equals(i.getInvalid())).collect(Collectors.toList()); long count = 0L; From d99a4d2d50321aeea1fb60e9cb1eb660cc51d117 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 25 Jun 2021 10:35:22 +0800 Subject: [PATCH 12/55] =?UTF-8?q?=E5=95=86=E5=93=81=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GoodsParameterManagerController.java | 42 ------------------- .../goods/ParameterManagerController.java | 6 --- 2 files changed, 48 deletions(-) delete mode 100644 manager-api/src/main/java/cn/lili/controller/goods/GoodsParameterManagerController.java diff --git a/manager-api/src/main/java/cn/lili/controller/goods/GoodsParameterManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/GoodsParameterManagerController.java deleted file mode 100644 index c80bbb4d..00000000 --- a/manager-api/src/main/java/cn/lili/controller/goods/GoodsParameterManagerController.java +++ /dev/null @@ -1,42 +0,0 @@ -package cn.lili.controller.goods; - -import cn.lili.common.enums.ResultUtil; -import cn.lili.common.vo.ResultMessage; -import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - * 管理端,商品关联参数管理接口 - * - * @author pikachu - * @date 2020-02-18 15:18:56 - */ -@RestController -@Api(tags = "管理端,商品关联参数管理接口") -@RequestMapping("/manager/goods/parameters") -public class GoodsParameterManagerController { - - @Autowired - private GoodsParamsService goodsParamsService; - - @ApiImplicitParams({ - @ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "path", dataType = "String"), - @ApiImplicitParam(name = "categoryId", value = "分类ID", required = true, paramType = "path", dataType = "String") - }) - @ApiOperation(value = "通过商品id和分类id查询参数信息") - @GetMapping(value = "/{goodsId}/{categoryId}") - public ResultMessage> getGoodsParameters(@PathVariable String goodsId, @PathVariable String categoryId) { - return ResultUtil.data(this.goodsParamsService.queryGoodsParams(goodsId, categoryId)); - } - -} diff --git a/manager-api/src/main/java/cn/lili/controller/goods/ParameterManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/ParameterManagerController.java index 6d16dadb..78d7a0e5 100644 --- a/manager-api/src/main/java/cn/lili/controller/goods/ParameterManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/goods/ParameterManagerController.java @@ -28,8 +28,6 @@ public class ParameterManagerController { @Autowired private ParametersService parametersService; - @Autowired - private GoodsParamsService goodsParamsService; @ApiOperation(value = "添加参数") @PostMapping @@ -47,9 +45,6 @@ public class ParameterManagerController { public ResultMessage update(@Valid Parameters parameters) { if (parametersService.updateById(parameters)) { - if (parameters.getIsIndex() != null) { - goodsParamsService.updateParametersIsIndex(parameters.getId(), parameters.getIsIndex()); - } return ResultUtil.data(parameters); } throw new ServiceException(ResultCode.PARAMETER_UPDATE_ERROR); @@ -60,7 +55,6 @@ public class ParameterManagerController { @DeleteMapping(value = "/{id}") public ResultMessage delById(@PathVariable String id) { parametersService.removeById(id); - goodsParamsService.deleteByParamId(id); return ResultUtil.success(); } From ac68acda503c9e368daac3169fb0cc5c011f39d9 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 25 Jun 2021 10:37:31 +0800 Subject: [PATCH 13/55] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/controller/goods/SpecificationManagerController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/manager-api/src/main/java/cn/lili/controller/goods/SpecificationManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/SpecificationManagerController.java index e5c2dd7e..41b114d5 100644 --- a/manager-api/src/main/java/cn/lili/controller/goods/SpecificationManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/goods/SpecificationManagerController.java @@ -46,7 +46,6 @@ public class SpecificationManagerController { public Page page(String specName, PageVO page) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.like(StringUtils.isNotEmpty(specName), Specification::getSpecName, specName); - lambdaQueryWrapper.orderByDesc(Specification::getCreateTime); return specificationService.page(PageUtil.initPage(page), lambdaQueryWrapper); } From 47c42db720e7ace479f743209faf432154699af1 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 25 Jun 2021 10:48:21 +0800 Subject: [PATCH 14/55] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=EF=BC=8C=E6=A0=A1=E9=AA=8C=E5=8F=82=E6=95=B0=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/cart/render/TradeBuilder.java | 9 ------ .../cart/render/impl/SkuFreightRender.java | 2 +- .../order/serviceimpl/TradeServiceImpl.java | 31 +++++++++++++++++++ 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java b/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java index 2f75e40d..9a69a2a7 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java @@ -1,7 +1,5 @@ package cn.lili.modules.order.cart.render; -import cn.lili.common.enums.ResultCode; -import cn.lili.common.exception.ServiceException; import cn.lili.modules.order.cart.entity.dto.TradeDTO; import cn.lili.modules.order.cart.entity.enums.CartTypeEnum; import cn.lili.modules.order.cart.entity.vo.CartSkuVO; @@ -101,13 +99,6 @@ public class TradeBuilder { } } - if (tradeDTO.getNotSupportFreight() != null && tradeDTO.getNotSupportFreight().size() > 0) { - StringBuilder stringBuilder = new StringBuilder("包含商品有-"); - tradeDTO.getNotSupportFreight().forEach(sku -> { - stringBuilder.append(sku.getGoodsSku().getGoodsName()); - }); - throw new ServiceException(ResultCode.ORDER_NOT_SUPPORT_DISTRIBUTION, stringBuilder.toString()); - } //购物车信息接受 List cartVOList = new ArrayList<>(); diff --git a/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuFreightRender.java b/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuFreightRender.java index 776f797b..5f71e10f 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuFreightRender.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuFreightRender.java @@ -40,7 +40,7 @@ public class SkuFreightRender implements CartRenderStep { MemberAddress memberAddress = tradeDTO.getMemberAddress(); //如果收货地址为空,则抛出异常 if (memberAddress == null) { - throw new ServiceException(ResultCode.MEMBER_ADDRESS_NOT_EXIST); + return; } //循环渲染购物车商品运费价格 forSku: diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/TradeServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/TradeServiceImpl.java index b4e49d35..ed5d50b3 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/TradeServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/TradeServiceImpl.java @@ -8,6 +8,7 @@ import cn.lili.common.rocketmq.RocketmqSendCallbackBuilder; import cn.lili.common.rocketmq.tags.MqOrderTagsEnum; import cn.lili.config.rocketmq.RocketmqCustomProperties; import cn.lili.modules.member.entity.dos.Member; +import cn.lili.modules.member.entity.dos.MemberAddress; import cn.lili.modules.member.service.MemberService; import cn.lili.modules.order.cart.entity.dto.MemberCouponDTO; import cn.lili.modules.order.cart.entity.dto.TradeDTO; @@ -68,6 +69,11 @@ public class TradeServiceImpl extends ServiceImpl implements @Override @Transactional(rollbackFor = Exception.class) public Trade createTrade(TradeDTO tradeDTO) { + + //创建订单预校验 + createTradeCheck(tradeDTO); + + Trade trade = new Trade(tradeDTO); String key = CachePrefix.TRADE.getPrefix() + trade.getSn(); //积分预处理 @@ -87,6 +93,31 @@ public class TradeServiceImpl extends ServiceImpl implements return trade; } + /** + * 创建订单最后一步校验 + * + * @param tradeDTO + */ + private void createTradeCheck(TradeDTO tradeDTO) { + + //创建订单如果没有收获地址, + MemberAddress memberAddress = tradeDTO.getMemberAddress(); + if (memberAddress == null) { + throw new ServiceException(ResultCode.MEMBER_ADDRESS_NOT_EXIST); + } + + /** + * 订单配送区域校验 + */ + if (tradeDTO.getNotSupportFreight() != null && tradeDTO.getNotSupportFreight().size() > 0) { + StringBuilder stringBuilder = new StringBuilder("包含商品有-"); + tradeDTO.getNotSupportFreight().forEach(sku -> { + stringBuilder.append(sku.getGoodsSku().getGoodsName()); + }); + throw new ServiceException(ResultCode.ORDER_NOT_SUPPORT_DISTRIBUTION, stringBuilder.toString()); + } + } + @Override public Trade getBySn(String sn) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); From b6062f4fb9248af6dbe845b81cd9a319b07e662b Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 25 Jun 2021 11:35:02 +0800 Subject: [PATCH 15/55] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=BA=97=E9=93=BA=E5=8F=82=E6=95=B0=E4=BC=A0?= =?UTF-8?q?=E9=80=92=E5=90=8E=E5=8F=B0=EF=BC=8C=E7=BB=9F=E8=AE=A1=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E4=B8=8D=E5=8F=98=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../statistics/model/vo/OrderOverviewVO.java | 18 +++--- .../OrderStatisticsDataServiceImpl.java | 57 +++++++++++++------ 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/statistics/model/vo/OrderOverviewVO.java b/framework/src/main/java/cn/lili/modules/statistics/model/vo/OrderOverviewVO.java index 5cd79262..fbb3bd5d 100644 --- a/framework/src/main/java/cn/lili/modules/statistics/model/vo/OrderOverviewVO.java +++ b/framework/src/main/java/cn/lili/modules/statistics/model/vo/OrderOverviewVO.java @@ -13,35 +13,35 @@ import lombok.Data; public class OrderOverviewVO { @ApiModelProperty(value = "UV人次") - private Integer uvNum; + private Integer uvNum = 0; //下单统计 @ApiModelProperty(value = "下单数量") - private Long orderNum; + private Long orderNum = 0L; @ApiModelProperty(value = "下单人数") - private Long orderMemberNum; + private Long orderMemberNum = 0L; @ApiModelProperty(value = "下单金额") - private Double orderAmount; + private Double orderAmount = 0D; //付款统计 @ApiModelProperty(value = "付款订单数量") - private Long paymentOrderNum; + private Long paymentOrderNum = 0L; @ApiModelProperty(value = "付款人数") - private Long paymentsNum; + private Long paymentsNum = 0L; @ApiModelProperty(value = "付款金额") - private Double paymentAmount; + private Double paymentAmount = 0D; //退单统计 @ApiModelProperty(value = "退单笔数") - private Long refundOrderNum; + private Long refundOrderNum = 0L; @ApiModelProperty(value = "退单金额") - private Double refundOrderPrice; + private Double refundOrderPrice = 0D; //转换率 @ApiModelProperty(value = "下单转换率") diff --git a/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/OrderStatisticsDataServiceImpl.java b/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/OrderStatisticsDataServiceImpl.java index 200dd483..e581d414 100644 --- a/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/OrderStatisticsDataServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/OrderStatisticsDataServiceImpl.java @@ -22,7 +22,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -50,18 +49,15 @@ public class OrderStatisticsDataServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper(); //queryWrapper.eq("flow_type", FlowTypeEnum.PAY.name()); - queryWrapper.eq(StringUtils.isNotEmpty(orderStatus),Order::getOrderStatus,orderStatus); + queryWrapper.eq(StringUtils.isNotEmpty(orderStatus), Order::getOrderStatus, orderStatus); queryWrapper.eq(StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.STORE.name()), Order::getStoreId, UserContext.getCurrentUser().getStoreId()); return orderService.count(queryWrapper); From 39d6032152a06895c880112846107bd9fddde05f Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 25 Jun 2021 11:40:05 +0800 Subject: [PATCH 16/55] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/lili/common/enums/ResultCode.java | 2 ++ .../order/order/serviceimpl/OrderServiceImpl.java | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) 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 f0d99e42..395cf364 100644 --- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java +++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java @@ -199,6 +199,8 @@ public enum ResultCode { ORDER_NOT_SUPPORT_DISTRIBUTION(31011, "购物车中包含不支持配送的商品,请重新选择收货地址,或者重新选择商品"), + ORDER_CAN_NOT_CANCEL(31012, "当前订单状态不可取消"), + /** * 支付 */ diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java index bd28444c..c0b02ebc 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java @@ -202,8 +202,11 @@ public class OrderServiceImpl extends ServiceImpl implements @OrderLogPoint(description = "'订单['+#orderSn+']取消,原因为:'+#reason", orderSn = "#orderSn") public Order cancel(String orderSn, String reason) { Order order = OperationalJudgment.judgment(this.getBySn(orderSn)); - if (order.getOrderPromotionType().equals(OrderPromotionTypeEnum.PINTUAN.name()) && !order.getOrderStatus().equals(OrderStatusEnum.UNDELIVERED.name())) { - throw new ServiceException("未成团订单不可取消"); + //如果订单促销类型不为空&&订单是拼团订单,并且订单未成团,则抛出异常 + if (StringUtils.isNotEmpty(order.getOrderPromotionType()) + && order.getOrderPromotionType().equals(OrderPromotionTypeEnum.PINTUAN.name()) + && !order.getOrderStatus().equals(OrderStatusEnum.UNDELIVERED.name())) { + throw new ServiceException(ResultCode.ORDER_CAN_NOT_CANCEL); } if (CharSequenceUtil.equalsAny(order.getOrderStatus(), OrderStatusEnum.UNDELIVERED.name(), @@ -217,7 +220,7 @@ public class OrderServiceImpl extends ServiceImpl implements orderStatusMessage(order); return order; } else { - throw new ServiceException("当前订单状态不可取消"); + throw new ServiceException(ResultCode.ORDER_CAN_NOT_CANCEL); } } From 14ff0a350185d22765dca54f1cbfb66f596b2817 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 25 Jun 2021 11:43:56 +0800 Subject: [PATCH 17/55] =?UTF-8?q?=E4=BA=A4=E6=98=93=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=90=8E=E4=B8=8D=E4=BC=9A=E8=87=AA=E5=8A=A8=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/modules/payment/kit/params/impl/TradeCashier.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/TradeCashier.java b/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/TradeCashier.java index 7bd4e62e..e4e20cd2 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/TradeCashier.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/TradeCashier.java @@ -113,7 +113,7 @@ public class TradeCashier implements CashierExecute { if (payParam.getOrderType().equals(CashierEnum.TRADE.name())) { Trade trade = tradeService.getBySn(payParam.getSn()); if (trade != null) { - return trade.equals(PayStatusEnum.PAID.name()); + return trade.getPayStatus().equals(PayStatusEnum.PAID.name()); } else { throw new ServiceException(ResultCode.PAY_NOT_EXIST_ORDER); } From efb226b37bf743085131d68a267c07c77256ee4a Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 25 Jun 2021 14:32:39 +0800 Subject: [PATCH 18/55] =?UTF-8?q?=E6=8A=95=E8=AF=89=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/order/order/service/OrderComplaintService.java | 6 +++--- .../order/order/serviceimpl/OrderComplaintServiceImpl.java | 4 ++-- .../statistics/serviceimpl/IndexStatisticsServiceImpl.java | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/order/order/service/OrderComplaintService.java b/framework/src/main/java/cn/lili/modules/order/order/service/OrderComplaintService.java index 4d742153..37eee01b 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/service/OrderComplaintService.java +++ b/framework/src/main/java/cn/lili/modules/order/order/service/OrderComplaintService.java @@ -68,11 +68,11 @@ public interface OrderComplaintService extends IService { OrderComplaint updateOrderComplainByStatus(OrderComplaintOperationParams operationParam); /** - * 获取新投诉数量 + * 待处理投诉数量 * - * @return 新投诉 + * @return 待处理投诉数量 */ - Integer newComplainNum(); + Integer waitComplainNum(); /** * 取消交易投诉 diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderComplaintServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderComplaintServiceImpl.java index ae260d65..b0a198aa 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderComplaintServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderComplaintServiceImpl.java @@ -198,9 +198,9 @@ public class OrderComplaintServiceImpl extends ServiceImpl Date: Fri, 25 Jun 2021 14:56:16 +0800 Subject: [PATCH 19/55] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E9=80=80=E6=AC=BE?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=97=A0=E6=B3=95=E5=8F=98=E6=9B=B4=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java index 9732ffe3..5dc658ec 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java @@ -555,7 +555,7 @@ public class WechatPlugin implements Payment { if (refundLog != null) { refundLog.setIsRefund(true); refundLog.setReceivableNo(refundId); - refundLogService.save(refundLog); + refundLogService.saveOrUpdate(refundLog); } } catch (Exception e) { log.error("微信退款失败",e); From 0d6d92139b5ada5bceb773f09361ea5692331513 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 25 Jun 2021 16:00:23 +0800 Subject: [PATCH 20/55] =?UTF-8?q?=E4=BD=99=E9=A2=9D=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E5=88=A4=E5=AE=9A=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/lili/controller/payment/CashierController.java | 6 +++++- .../lili/modules/payment/kit/params/impl/OrderCashier.java | 5 ++--- .../lili/modules/payment/kit/params/impl/TradeCashier.java | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/buyer-api/src/main/java/cn/lili/controller/payment/CashierController.java b/buyer-api/src/main/java/cn/lili/controller/payment/CashierController.java index 30117fee..0ba33e91 100644 --- a/buyer-api/src/main/java/cn/lili/controller/payment/CashierController.java +++ b/buyer-api/src/main/java/cn/lili/controller/payment/CashierController.java @@ -2,6 +2,7 @@ package cn.lili.controller.payment; import cn.lili.common.enums.ResultCode; import cn.lili.common.enums.ResultUtil; +import cn.lili.common.exception.ServiceException; import cn.lili.common.vo.ResultMessage; import cn.lili.modules.payment.kit.CashierSupport; import cn.lili.modules.payment.kit.dto.PayParam; @@ -64,8 +65,11 @@ public class CashierController { try { return cashierSupport.payment(paymentMethodEnum, paymentClientEnum, request, response, payParam); + } catch (ServiceException se) { + log.info("支付异常", se); + throw se; } catch (Exception e) { - log.error("收银台支付错误",e); + log.error("收银台支付错误", e); } return null; diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/OrderCashier.java b/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/OrderCashier.java index d99ef09b..dc0bbc56 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/OrderCashier.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/OrderCashier.java @@ -9,15 +9,14 @@ import cn.lili.modules.order.order.entity.enums.OrderStatusEnum; import cn.lili.modules.order.order.entity.enums.PayStatusEnum; import cn.lili.modules.order.order.entity.vo.OrderDetailVO; import cn.lili.modules.order.order.service.OrderService; -import cn.lili.modules.payment.kit.dto.PaymentSuccessParams; import cn.lili.modules.payment.kit.dto.PayParam; +import cn.lili.modules.payment.kit.dto.PaymentSuccessParams; import cn.lili.modules.payment.kit.enums.CashierEnum; import cn.lili.modules.payment.kit.params.CashierExecute; import cn.lili.modules.payment.kit.params.dto.CashierParam; import cn.lili.modules.system.entity.dto.BaseSetting; import cn.lili.modules.system.entity.enums.SettingEnum; import cn.lili.modules.system.service.SettingService; -import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -106,7 +105,7 @@ public class OrderCashier implements CashierExecute { if (payParam.getOrderType().equals(CashierEnum.ORDER.name())) { Order order = orderService.getBySn(payParam.getSn()); if (order != null) { - return order.getPayStatus().equals(PayStatusEnum.PAID.name()); + return PayStatusEnum.PAID.name().equals(order.getPayStatus()); } else { throw new ServiceException(ResultCode.PAY_NOT_EXIST_ORDER); } diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/TradeCashier.java b/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/TradeCashier.java index e4e20cd2..6a488b0e 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/TradeCashier.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/TradeCashier.java @@ -113,7 +113,7 @@ public class TradeCashier implements CashierExecute { if (payParam.getOrderType().equals(CashierEnum.TRADE.name())) { Trade trade = tradeService.getBySn(payParam.getSn()); if (trade != null) { - return trade.getPayStatus().equals(PayStatusEnum.PAID.name()); + return PayStatusEnum.PAID.name().equals(trade.getPayStatus()); } else { throw new ServiceException(ResultCode.PAY_NOT_EXIST_ORDER); } From 3c2cf69cbe70fa5e79a487efae4a24d26fa8f925 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Fri, 25 Jun 2021 16:03:14 +0800 Subject: [PATCH 21/55] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=AA=92=E4=BD=93?= =?UTF-8?q?=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/modules/broadcast/util/WechatLivePlayerUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 d6a4fded..4d6d8501 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 @@ -185,6 +185,7 @@ public class WechatLivePlayerUtil { /** * 请求微信接口 + * * @param url 链接 * @param map 参数 * @return 返回内容 @@ -193,14 +194,14 @@ public class WechatLivePlayerUtil { //获取token String token = wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.WECHAT_MP); //请求链接添加token - url+=token; + url += token; //发起请求 String content = HttpUtils.doPostWithJson(url, map); //记录请求结果 log.info("微信小程序请求结果:" + content); //获取请求内容,如果token过期则重新获取,如果出错则抛出错误 JSONObject jsonObject = new JSONObject(content); - if (jsonObject.get("errcode").equals("0")) { + if (jsonObject.get("media_id") != null) { return jsonObject; } else if (jsonObject.get("errcode").equals("40001")) { wechatAccessTokenUtil.removeAccessToken(ClientTypeEnum.WECHAT_MP); From 4b3c2cbea5d5a491c3e1f5c4f856050552a8b04e Mon Sep 17 00:00:00 2001 From: lifenlong Date: Fri, 25 Jun 2021 17:34:00 +0800 Subject: [PATCH 22/55] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E6=8E=A5=E5=8F=A3=EF=BC=8C=E8=B0=83=E7=94=A8=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E7=BB=9F=E4=B8=80=E5=A4=84=E7=90=86=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/modules/broadcast/util/WechatLivePlayerUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4d6d8501..0c0ac9fd 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 @@ -201,7 +201,7 @@ public class WechatLivePlayerUtil { log.info("微信小程序请求结果:" + content); //获取请求内容,如果token过期则重新获取,如果出错则抛出错误 JSONObject jsonObject = new JSONObject(content); - if (jsonObject.get("media_id") != null) { + if (jsonObject.get("errcode").equals("0")) { return jsonObject; } else if (jsonObject.get("errcode").equals("40001")) { wechatAccessTokenUtil.removeAccessToken(ClientTypeEnum.WECHAT_MP); From df44a7ae30727fc6decf470a991378ffb7c287d0 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 25 Jun 2021 18:29:58 +0800 Subject: [PATCH 23/55] =?UTF-8?q?=E4=B8=8D=E8=83=BD=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E4=BD=99=E9=A2=9D=E6=94=AF=E4=BB=98=E8=BF=9B=E8=A1=8C=E5=85=85?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/lili/common/enums/ResultCode.java | 2 ++ .../order/trade/serviceimpl/RechargeServiceImpl.java | 2 -- .../modules/payment/kit/plugin/wallet/WalletPlugin.java | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) 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 395cf364..bb92dd6f 100644 --- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java +++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java @@ -228,6 +228,8 @@ public enum ResultCode { PAY_NOT_EXIST_ORDER(32011, "支付订单不存在"), + CAN_NOT_RECHARGE_WALLET(32012, "不能使用余额进行充值"), + /** * 售后 */ diff --git a/framework/src/main/java/cn/lili/modules/order/trade/serviceimpl/RechargeServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/trade/serviceimpl/RechargeServiceImpl.java index c0b8684a..dffa172a 100644 --- a/framework/src/main/java/cn/lili/modules/order/trade/serviceimpl/RechargeServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/trade/serviceimpl/RechargeServiceImpl.java @@ -62,8 +62,6 @@ public class RechargeServiceImpl extends ServiceImpl i queryWrapper.eq(!StringUtils.isEmpty(rechargeQueryVO.getRechargeSn()), "recharge_sn", rechargeQueryVO.getRechargeSn()); //会员id queryWrapper.eq(!StringUtils.isEmpty(rechargeQueryVO.getMemberId()), "member_id", rechargeQueryVO.getMemberId()); - //已付款的充值订单 - queryWrapper.eq("pay_status", PayStatusEnum.PAID.name()); //支付时间 开始时间和结束时间 if (!StringUtils.isEmpty(rechargeQueryVO.getStartDate()) && !StringUtils.isEmpty(rechargeQueryVO.getEndDate())) { Date start = cn.hutool.core.date.DateUtil.parse(rechargeQueryVO.getStartDate()); diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wallet/WalletPlugin.java b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wallet/WalletPlugin.java index 6caca9ef..2f3a2749 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wallet/WalletPlugin.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wallet/WalletPlugin.java @@ -1,9 +1,9 @@ package cn.lili.modules.payment.kit.plugin.wallet; import cn.lili.common.enums.ResultCode; +import cn.lili.common.enums.ResultUtil; import cn.lili.common.exception.ServiceException; import cn.lili.common.security.context.UserContext; -import cn.lili.common.enums.ResultUtil; import cn.lili.common.vo.ResultMessage; import cn.lili.modules.member.service.MemberWalletService; import cn.lili.modules.order.trade.entity.enums.DepositServiceTypeEnum; @@ -12,6 +12,7 @@ import cn.lili.modules.payment.kit.CashierSupport; import cn.lili.modules.payment.kit.Payment; import cn.lili.modules.payment.kit.dto.PayParam; import cn.lili.modules.payment.kit.dto.PaymentSuccessParams; +import cn.lili.modules.payment.kit.enums.CashierEnum; import cn.lili.modules.payment.kit.enums.PaymentMethodEnum; import cn.lili.modules.payment.kit.params.dto.CashierParam; import cn.lili.modules.payment.service.PaymentService; @@ -68,6 +69,9 @@ public class WalletPlugin implements Payment { @Override public ResultMessage nativePay(HttpServletRequest request, PayParam payParam) { + if(payParam.getOrderType().equals(CashierEnum.RECHARGE.name())){ + throw new ServiceException(ResultCode.CAN_NOT_RECHARGE_WALLET); + } savePaymentLog(payParam); return ResultUtil.success(ResultCode.PAY_SUCCESS); } From 4939e31e7156308800f6cfb540001a4d7814123d Mon Sep 17 00:00:00 2001 From: lifenlong Date: Sat, 26 Jun 2021 11:02:42 +0800 Subject: [PATCH 24/55] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=B5=E8=AF=9D?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/common/validation/{Mobile.java => Phone.java} | 6 +++--- .../impl/{MobileValidator.java => PhoneValidator.java} | 6 +++--- .../lili/modules/broadcast/util/WechatLivePlayerUtil.java | 2 +- .../cn/lili/modules/member/entity/dos/MemberAddress.java | 4 ++-- .../cn/lili/modules/member/entity/dto/MemberAddressDTO.java | 4 ++-- .../java/cn/lili/modules/store/entity/dos/StoreDetail.java | 3 ++- .../lili/modules/store/entity/dto/AdminStoreApplyDTO.java | 2 ++ 7 files changed, 15 insertions(+), 12 deletions(-) rename framework/src/main/java/cn/lili/common/validation/{Mobile.java => Phone.java} (83%) rename framework/src/main/java/cn/lili/common/validation/impl/{MobileValidator.java => PhoneValidator.java} (75%) diff --git a/framework/src/main/java/cn/lili/common/validation/Mobile.java b/framework/src/main/java/cn/lili/common/validation/Phone.java similarity index 83% rename from framework/src/main/java/cn/lili/common/validation/Mobile.java rename to framework/src/main/java/cn/lili/common/validation/Phone.java index 374b37f0..9acdd3b9 100644 --- a/framework/src/main/java/cn/lili/common/validation/Mobile.java +++ b/framework/src/main/java/cn/lili/common/validation/Phone.java @@ -1,6 +1,6 @@ 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; @@ -19,8 +19,8 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; @Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER}) @Retention(RUNTIME) @Documented -@Constraint(validatedBy = {MobileValidator.class}) -public @interface Mobile { +@Constraint(validatedBy = {PhoneValidator.class}) +public @interface Phone { String regexp() default "1[3|4|5|7|8]\\d{9}"; diff --git a/framework/src/main/java/cn/lili/common/validation/impl/MobileValidator.java b/framework/src/main/java/cn/lili/common/validation/impl/PhoneValidator.java similarity index 75% rename from framework/src/main/java/cn/lili/common/validation/impl/MobileValidator.java rename to framework/src/main/java/cn/lili/common/validation/impl/PhoneValidator.java index add99847..731e9fe2 100644 --- a/framework/src/main/java/cn/lili/common/validation/impl/MobileValidator.java +++ b/framework/src/main/java/cn/lili/common/validation/impl/PhoneValidator.java @@ -1,6 +1,6 @@ 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; @@ -8,7 +8,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -public class MobileValidator implements ConstraintValidator { +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}$"); @@ -19,7 +19,7 @@ public class MobileValidator implements ConstraintValidator { } @Override - public void initialize(Mobile constraintAnnotation) { + public void initialize(Phone constraintAnnotation) { } } 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 0c0ac9fd..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 @@ -201,7 +201,7 @@ public class WechatLivePlayerUtil { log.info("微信小程序请求结果:" + content); //获取请求内容,如果token过期则重新获取,如果出错则抛出错误 JSONObject jsonObject = new JSONObject(content); - if (jsonObject.get("errcode").equals("0")) { + if (jsonObject.get("errcode").toString().equals("0")) { return jsonObject; } else if (jsonObject.get("errcode").equals("40001")) { wechatAccessTokenUtil.removeAccessToken(ClientTypeEnum.WECHAT_MP); diff --git a/framework/src/main/java/cn/lili/modules/member/entity/dos/MemberAddress.java b/framework/src/main/java/cn/lili/modules/member/entity/dos/MemberAddress.java index 84d436d4..ad78c35b 100644 --- a/framework/src/main/java/cn/lili/modules/member/entity/dos/MemberAddress.java +++ b/framework/src/main/java/cn/lili/modules/member/entity/dos/MemberAddress.java @@ -1,7 +1,7 @@ package cn.lili.modules.member.entity.dos; import cn.lili.base.BaseEntity; -import cn.lili.common.validation.Mobile; +import cn.lili.common.validation.Phone; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -34,7 +34,7 @@ public class MemberAddress extends BaseEntity { @ApiModelProperty(value = "收货人姓名") private String name; - @Mobile + @Phone @ApiModelProperty(value = "手机号码") private String mobile; diff --git a/framework/src/main/java/cn/lili/modules/member/entity/dto/MemberAddressDTO.java b/framework/src/main/java/cn/lili/modules/member/entity/dto/MemberAddressDTO.java index 3fe583f9..ad07b84b 100644 --- a/framework/src/main/java/cn/lili/modules/member/entity/dto/MemberAddressDTO.java +++ b/framework/src/main/java/cn/lili/modules/member/entity/dto/MemberAddressDTO.java @@ -1,6 +1,6 @@ package cn.lili.modules.member.entity.dto; -import cn.lili.common.validation.Mobile; +import cn.lili.common.validation.Phone; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -20,7 +20,7 @@ public class MemberAddressDTO { @ApiModelProperty(value = "收货人姓名") private String consigneeName; - @Mobile + @Phone @ApiModelProperty(value = "手机号码") private String consigneeMobile; diff --git a/framework/src/main/java/cn/lili/modules/store/entity/dos/StoreDetail.java b/framework/src/main/java/cn/lili/modules/store/entity/dos/StoreDetail.java index e1ac24c8..df4deef9 100644 --- a/framework/src/main/java/cn/lili/modules/store/entity/dos/StoreDetail.java +++ b/framework/src/main/java/cn/lili/modules/store/entity/dos/StoreDetail.java @@ -4,6 +4,7 @@ package cn.lili.modules.store.entity.dos; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; import cn.lili.common.validation.Mobile; +import cn.lili.common.validation.Phone; import cn.lili.modules.store.entity.dto.AdminStoreApplyDTO; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; @@ -93,7 +94,7 @@ public class StoreDetail { private String linkName; @NotBlank(message = "手机号不能为空") - @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误") + @Phone @ApiModelProperty(value = "联系人电话") private String linkPhone; diff --git a/framework/src/main/java/cn/lili/modules/store/entity/dto/AdminStoreApplyDTO.java b/framework/src/main/java/cn/lili/modules/store/entity/dto/AdminStoreApplyDTO.java index a8d63597..3c43d7e3 100644 --- a/framework/src/main/java/cn/lili/modules/store/entity/dto/AdminStoreApplyDTO.java +++ b/framework/src/main/java/cn/lili/modules/store/entity/dto/AdminStoreApplyDTO.java @@ -1,5 +1,6 @@ package cn.lili.modules.store.entity.dto; +import cn.lili.common.validation.Mobile; import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -57,6 +58,7 @@ public class AdminStoreApplyDTO { @ApiModelProperty(value = "公司名称") private String companyName; + @Mobile @ApiModelProperty(value = "公司电话") private String companyPhone; From 788e9ca2397e591288368935924bb6dc39c4bb1e Mon Sep 17 00:00:00 2001 From: lifenlong Date: Sat, 26 Jun 2021 11:04:20 +0800 Subject: [PATCH 25/55] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=B5=E8=AF=9D?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/common/validation/Mobile.java | 33 +++++++++++++++++ .../validation/impl/MobileValidator.java | 35 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 framework/src/main/java/cn/lili/common/validation/Mobile.java create mode 100644 framework/src/main/java/cn/lili/common/validation/impl/MobileValidator.java diff --git a/framework/src/main/java/cn/lili/common/validation/Mobile.java b/framework/src/main/java/cn/lili/common/validation/Mobile.java new file mode 100644 index 00000000..578888bc --- /dev/null +++ b/framework/src/main/java/cn/lili/common/validation/Mobile.java @@ -0,0 +1,33 @@ +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; +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 = {MobileValidator.class}) +public @interface Mobile { + + String regexp() default ""; + + String message() default "电话号码格式不正确"; + + Class[] groups() default {}; + + Class[] 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 new file mode 100644 index 00000000..2b21b32c --- /dev/null +++ b/framework/src/main/java/cn/lili/common/validation/impl/MobileValidator.java @@ -0,0 +1,35 @@ +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; +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; + 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 + public void initialize(Mobile constraintAnnotation) { + + } +} From d0475463742f52dda25ed70a33dd49f4dd63e8ee Mon Sep 17 00:00:00 2001 From: lifenlong Date: Sat, 26 Jun 2021 11:18:14 +0800 Subject: [PATCH 26/55] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E9=97=B4=E5=8E=BB?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/lili/common/enums/ResultCode.java | 5 +++++ .../modules/broadcast/serviceimpl/StudioServiceImpl.java | 8 ++++++++ 2 files changed, 13 insertions(+) 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 bb92dd6f..26490d88 100644 --- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java +++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java @@ -320,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/modules/broadcast/serviceimpl/StudioServiceImpl.java b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java index 18f9d74c..7d81c7a4 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 @@ -152,6 +152,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)); From 2d5c0d6a1fd7d5bd06685227b79303cbd3b88aa5 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Sat, 26 Jun 2021 14:07:21 +0800 Subject: [PATCH 27/55] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=EF=BC=8C=E5=88=A0=E9=99=A4=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/CouponServiceImpl.java | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java index de3683db..14444691 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java @@ -15,18 +15,12 @@ import cn.lili.common.vo.PageVO; import cn.lili.config.rocketmq.RocketmqCustomProperties; import cn.lili.modules.goods.entity.dos.GoodsSku; import cn.lili.modules.goods.service.GoodsSkuService; -import cn.lili.modules.promotion.entity.dos.Coupon; -import cn.lili.modules.promotion.entity.dos.FullDiscount; -import cn.lili.modules.promotion.entity.dos.MemberCoupon; -import cn.lili.modules.promotion.entity.dos.PromotionGoods; +import cn.lili.modules.promotion.entity.dos.*; import cn.lili.modules.promotion.entity.enums.*; import cn.lili.modules.promotion.entity.vos.CouponSearchParams; import cn.lili.modules.promotion.entity.vos.CouponVO; import cn.lili.modules.promotion.mapper.CouponMapper; -import cn.lili.modules.promotion.service.CouponService; -import cn.lili.modules.promotion.service.FullDiscountService; -import cn.lili.modules.promotion.service.MemberCouponService; -import cn.lili.modules.promotion.service.PromotionGoodsService; +import cn.lili.modules.promotion.service.*; import cn.lili.modules.promotion.tools.PromotionTools; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -76,6 +70,9 @@ public class CouponServiceImpl extends ServiceImpl impleme //满额活动 @Autowired private FullDiscountService fullDiscountService; + //优惠券活动-优惠券关联 + @Autowired + private CouponActivityItemService couponActivityItemService; @Override public CouponVO add(CouponVO coupon) { @@ -159,15 +156,31 @@ public class CouponServiceImpl extends ServiceImpl impleme @Override public boolean deleteCoupon(String id) { CouponVO couponVO = checkStatus(id); - LambdaUpdateWrapper couponUpdateWrapper = new LambdaUpdateWrapper().eq(Coupon::getId, id).set(Coupon::getPromotionStatus, PromotionStatusEnum.CLOSE.name()).set(Coupon::getDeleteFlag, true); + //更新优惠券状态为关闭,标示删除标志 + LambdaUpdateWrapper couponUpdateWrapper = new LambdaUpdateWrapper().eq(Coupon::getId, id) + .set(Coupon::getPromotionStatus, PromotionStatusEnum.CLOSE.name()).set(Coupon::getDeleteFlag, true); boolean result = this.update(couponUpdateWrapper); - LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper().eq(PromotionGoods::getPromotionId, id).set(PromotionGoods::getPromotionStatus, PromotionStatusEnum.CLOSE.name()).set(PromotionGoods::getDeleteFlag, true); + //更新促销商品记录信息为删除 + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() + .eq(PromotionGoods::getPromotionId, id) + .set(PromotionGoods::getPromotionStatus, PromotionStatusEnum.CLOSE.name()) + .set(PromotionGoods::getDeleteFlag, true); this.promotionGoodsService.update(updateWrapper); - LambdaUpdateWrapper memberCouponLambdaUpdateWrapper = new LambdaUpdateWrapper().eq(MemberCoupon::getCouponId, id).set(MemberCoupon::getMemberCouponStatus, MemberCouponStatusEnum.CLOSED.name()); + + //删除mongo优惠券信息 + LambdaUpdateWrapper memberCouponLambdaUpdateWrapper = new LambdaUpdateWrapper() + .eq(MemberCoupon::getCouponId, id) + .set(MemberCoupon::getMemberCouponStatus, MemberCouponStatusEnum.CLOSED.name()); memberCouponService.update(memberCouponLambdaUpdateWrapper); this.mongoTemplate.remove(new Query().addCriteria(Criteria.where("id").is(id)), CouponVO.class); + + //删除优惠券活动关联优惠券 + couponActivityItemService.remove(new LambdaQueryWrapper() + .eq(CouponActivityItem::getCouponId,id)); + + //删除延时任务 this.timeTrigger.delete(TimeExecuteConstant.PROMOTION_EXECUTOR, couponVO.getStartTime().getTime(), DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.PROMOTION, (PromotionTypeEnum.COUPON.name() + couponVO.getId())), From 467e9887d01ad7dcb0c83497c726f6a9b5131994 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Sat, 26 Jun 2021 14:38:27 +0800 Subject: [PATCH 28/55] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E7=9B=B4=E6=92=AD=E9=97=B4=E5=BC=80=E5=A7=8B=E3=80=81=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../broadcast/serviceimpl/StudioServiceImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 7d81c7a4..c751a61a 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 @@ -61,9 +61,9 @@ public class StudioServiceImpl 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(Integer.parseInt(roomMap.get("roomId"))); +// studio.setQrCodeUrl(roomMap.get("qrcodeUrl")); studio.setStoreId(UserContext.getCurrentUser().getStoreId()); studio.setStatus(StudioStatusEnum.NEW.name()); //直播间添加成功发送直播间开启、关闭延时任务 @@ -71,7 +71,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()), + broadcastMessage, DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()), rocketmqCustomProperties.getPromotionTopic()); @@ -81,7 +82,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()) * 1000L, broadcastMessage, + Long.parseLong(studio.getEndTime()), broadcastMessage, DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()), rocketmqCustomProperties.getPromotionTopic()); //发送促销活动开始的延时任务 From 80007a6b8629078241062c44ba4fedffe2a5c95b Mon Sep 17 00:00:00 2001 From: lifenlong Date: Sat, 26 Jun 2021 14:44:55 +0800 Subject: [PATCH 29/55] =?UTF-8?q?=E8=AE=BE=E5=AE=9A=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=95=86=E5=AE=B6=E7=BB=93=E7=AE=97=E6=97=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/modules/store/serviceimpl/StoreServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreServiceImpl.java b/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreServiceImpl.java index 687b9eb5..c6706df1 100644 --- a/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreServiceImpl.java @@ -177,7 +177,10 @@ public class StoreServiceImpl extends ServiceImpl implements member.setHaveStore(true); member.setStoreId(id); memberService.updateById(member); - + //设定商家的结算日 + storeDetailService.update(new LambdaUpdateWrapper() + .eq(StoreDetail::getStoreId,id) + .set(StoreDetail::getSettlementDay,new DateTime())); } else { store.setStoreDisable(StoreStatusEnum.REFUSED.value()); } From 873a960d3a1eb9905ca9e714122db6da629c2b3c Mon Sep 17 00:00:00 2001 From: lifenlong Date: Sat, 26 Jun 2021 15:23:00 +0800 Subject: [PATCH 30/55] =?UTF-8?q?=E5=BA=97=E9=93=BA=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=8C=E5=B1=95=E7=A4=BA=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E5=BA=97=E9=93=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../broadcast/serviceimpl/StudioServiceImpl.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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 c751a61a..990dd0cd 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; @@ -155,9 +156,9 @@ public class StudioServiceImpl extends ServiceImpl impleme public Boolean push(Integer roomId, Integer goodsId) { //判断直播间是否已添加商品 - if(studioCommodityService.getOne( - new LambdaQueryWrapper().eq(StudioCommodity::getRoomId,roomId) - .eq(StudioCommodity::getGoodsId,goodsId))!=null){ + if (studioCommodityService.getOne( + new LambdaQueryWrapper().eq(StudioCommodity::getRoomId, roomId) + .eq(StudioCommodity::getGoodsId, goodsId)) != null) { throw new ServiceException(ResultCode.STODIO_GOODS_EXIST_ERROR); } @@ -195,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().getRole().equals(UserEnums.STORE)) { + queryWrapper.eq("store_id", UserContext.getCurrentUser().getStoreId()); + } + return this.page(PageUtil.initPage(pageVO), queryWrapper); } From 1cbab4a219801fd87b857f02f5e97e895ab5b76b Mon Sep 17 00:00:00 2001 From: lifenlong Date: Sat, 26 Jun 2021 15:24:59 +0800 Subject: [PATCH 31/55] =?UTF-8?q?=E5=BA=97=E9=93=BA=E8=AF=84=E4=BB=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=8C=E5=B1=95=E7=A4=BA=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E5=BA=97=E9=93=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/member/entity/dto/EvaluationQueryParams.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/framework/src/main/java/cn/lili/modules/member/entity/dto/EvaluationQueryParams.java b/framework/src/main/java/cn/lili/modules/member/entity/dto/EvaluationQueryParams.java index 63881cd3..0e8f093a 100644 --- a/framework/src/main/java/cn/lili/modules/member/entity/dto/EvaluationQueryParams.java +++ b/framework/src/main/java/cn/lili/modules/member/entity/dto/EvaluationQueryParams.java @@ -1,5 +1,7 @@ package cn.lili.modules.member.entity.dto; +import cn.lili.common.security.context.UserContext; +import cn.lili.common.security.enums.UserEnums; import cn.lili.common.utils.StringUtils; import cn.lili.common.vo.PageVO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -85,6 +87,9 @@ public class EvaluationQueryParams extends PageVO { if (StringUtils.isNotEmpty(status)) { queryWrapper.eq("status", status); } + if (UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) { + queryWrapper.eq("store_id", UserContext.getCurrentUser().getStoreId()); + } queryWrapper.eq("delete_flag", false); queryWrapper.orderByDesc("create_time"); return queryWrapper; From 5786cb9e550717831ac56216427fa8b9b75e0d3f Mon Sep 17 00:00:00 2001 From: pikachu <1321288662@qq.com> Date: Sat, 26 Jun 2021 16:48:06 +0800 Subject: [PATCH 32/55] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=A0=A1=E9=AA=8C=E4=BB=A5=E5=8F=8A=E5=85=85?= =?UTF-8?q?=E5=80=BC=E5=9B=9E=E8=B0=83=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trade/WalletLogBuyerController.java | 3 +- .../entity/dos/CategoryParameterGroup.java | 2 +- .../goods/serviceimpl/GoodsServiceImpl.java | 54 +++++++++++++++++++ .../order/trade/service/RechargeService.java | 3 +- .../serviceimpl/RechargeServiceImpl.java | 9 +++- .../kit/params/impl/RechargeCashier.java | 2 +- 6 files changed, 67 insertions(+), 6 deletions(-) diff --git a/buyer-api/src/main/java/cn/lili/controller/trade/WalletLogBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/trade/WalletLogBuyerController.java index 3da33ba4..aabb6b58 100644 --- a/buyer-api/src/main/java/cn/lili/controller/trade/WalletLogBuyerController.java +++ b/buyer-api/src/main/java/cn/lili/controller/trade/WalletLogBuyerController.java @@ -37,7 +37,8 @@ public class WalletLogBuyerController { //获取当前登录用户 AuthUser authUser = UserContext.getCurrentUser(); //构建查询 返回数据 - IPage depositLogPage = walletLogService.page(PageUtil.initPage(page), new QueryWrapper().eq("member_id", authUser.getId())); + IPage depositLogPage = walletLogService.page(PageUtil.initPage(page), + new QueryWrapper().eq("member_id", authUser.getId()).orderByDesc("create_time")); return ResultUtil.data(depositLogPage); } } 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/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index b93dbeca..a2560973 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,13 +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; @@ -84,6 +87,8 @@ public class GoodsServiceImpl extends ServiceImpl implements //rocketMq配置 @Autowired private RocketmqCustomProperties rocketmqCustomProperties; + @Autowired + private CategoryParameterGroupService categoryParameterGroupService; @Override @@ -108,6 +113,9 @@ public class GoodsServiceImpl extends ServiceImpl implements 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())); } //添加商品 @@ -323,6 +331,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/order/trade/service/RechargeService.java b/framework/src/main/java/cn/lili/modules/order/trade/service/RechargeService.java index c8919ded..a4b51e39 100644 --- a/framework/src/main/java/cn/lili/modules/order/trade/service/RechargeService.java +++ b/framework/src/main/java/cn/lili/modules/order/trade/service/RechargeService.java @@ -37,8 +37,9 @@ public interface RechargeService extends IService { * * @param sn 充值订单编号 * @param receivableNo 流水no + * @param paymentMethod 支付方式 */ - void paySuccess(String sn, String receivableNo); + void paySuccess(String sn, String receivableNo,String paymentMethod); /** * 根据充值订单号查询充值信息 diff --git a/framework/src/main/java/cn/lili/modules/order/trade/serviceimpl/RechargeServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/trade/serviceimpl/RechargeServiceImpl.java index dffa172a..8504ac30 100644 --- a/framework/src/main/java/cn/lili/modules/order/trade/serviceimpl/RechargeServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/trade/serviceimpl/RechargeServiceImpl.java @@ -1,9 +1,11 @@ package cn.lili.modules.order.trade.serviceimpl; +import cn.hutool.core.date.DateTime; import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.security.AuthUser; import cn.lili.common.security.context.UserContext; +import cn.lili.common.utils.DateUtil; import cn.lili.common.utils.PageUtil; import cn.lili.common.utils.SnowFlake; import cn.lili.common.utils.StringUtils; @@ -68,19 +70,22 @@ public class RechargeServiceImpl extends ServiceImpl i Date end = cn.hutool.core.date.DateUtil.parse(rechargeQueryVO.getEndDate()); queryWrapper.between("pay_time", start, end); } + queryWrapper.orderByDesc("create_time"); //查询返回数据 return this.page(PageUtil.initPage(page), queryWrapper); } @Override - public void paySuccess(String sn, String receivableNo) { + public void paySuccess(String sn, String receivableNo,String paymentMethod) { //根据sn获取支付账单 Recharge recharge = this.getOne(new QueryWrapper().eq("recharge_sn", sn)); //如果支付账单不为空则进行一下逻辑 - if (recharge != null) { + if (recharge != null && !recharge.getPayStatus().equals(PayStatusEnum.PAID.name())) { //将此账单支付状态更改为已支付 recharge.setPayStatus(PayStatusEnum.PAID.name()); recharge.setReceivableNo(receivableNo); + recharge.setPayTime(new DateTime()); + recharge.setRechargeWay(paymentMethod); //执行保存操作 this.updateById(recharge); //增加预存款余额 diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/RechargeCashier.java b/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/RechargeCashier.java index f60bd762..75fc952e 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/RechargeCashier.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/RechargeCashier.java @@ -45,7 +45,7 @@ public class RechargeCashier implements CashierExecute { public void paymentSuccess(PaymentSuccessParams paymentSuccessParams) { PayParam payParam = paymentSuccessParams.getPayParam(); if (payParam.getOrderType().equals(CashierEnum.RECHARGE.name())) { - rechargeService.paySuccess(payParam.getSn(), paymentSuccessParams.getReceivableNo()); + rechargeService.paySuccess(payParam.getSn(), paymentSuccessParams.getReceivableNo(),paymentSuccessParams.getPaymentMethod()); log.info("会员充值-订单号{},第三方流水:{}", payParam.getSn(), paymentSuccessParams.getReceivableNo()); } } From 84f6f0e7ee00c1d0724a1a7cb7425f7715493d9d Mon Sep 17 00:00:00 2001 From: Chopper Date: Mon, 28 Jun 2021 11:28:09 +0800 Subject: [PATCH 33/55] =?UTF-8?q?=E8=AF=84=E4=BB=B7=E5=88=A4=E5=AE=9A?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/modules/member/entity/dto/EvaluationQueryParams.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/main/java/cn/lili/modules/member/entity/dto/EvaluationQueryParams.java b/framework/src/main/java/cn/lili/modules/member/entity/dto/EvaluationQueryParams.java index 0e8f093a..d132d7c7 100644 --- a/framework/src/main/java/cn/lili/modules/member/entity/dto/EvaluationQueryParams.java +++ b/framework/src/main/java/cn/lili/modules/member/entity/dto/EvaluationQueryParams.java @@ -87,7 +87,7 @@ public class EvaluationQueryParams extends PageVO { if (StringUtils.isNotEmpty(status)) { queryWrapper.eq("status", status); } - if (UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) { + if (UserContext.getCurrentUser() != null && UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) { queryWrapper.eq("store_id", UserContext.getCurrentUser().getStoreId()); } queryWrapper.eq("delete_flag", false); From 63802a596b6570e95a4dcda1a630f6b0da3e8b4c Mon Sep 17 00:00:00 2001 From: lifenlong Date: Mon, 28 Jun 2021 11:30:37 +0800 Subject: [PATCH 34/55] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A7=92=E6=9D=80?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/member/entity/dto/EvaluationQueryParams.java | 3 --- .../cn/lili/modules/store/entity/dto/StoreCompanyDTO.java | 5 +++++ .../controller/trade/MemberEvaluationStoreController.java | 3 +++ update-sql/version4.0to4.1.sql | 4 +++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/member/entity/dto/EvaluationQueryParams.java b/framework/src/main/java/cn/lili/modules/member/entity/dto/EvaluationQueryParams.java index 0e8f093a..5ff36340 100644 --- a/framework/src/main/java/cn/lili/modules/member/entity/dto/EvaluationQueryParams.java +++ b/framework/src/main/java/cn/lili/modules/member/entity/dto/EvaluationQueryParams.java @@ -87,9 +87,6 @@ public class EvaluationQueryParams extends PageVO { if (StringUtils.isNotEmpty(status)) { queryWrapper.eq("status", status); } - if (UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) { - queryWrapper.eq("store_id", UserContext.getCurrentUser().getStoreId()); - } queryWrapper.eq("delete_flag", false); queryWrapper.orderByDesc("create_time"); return queryWrapper; diff --git a/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreCompanyDTO.java b/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreCompanyDTO.java index 90b62404..3219f465 100644 --- a/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreCompanyDTO.java +++ b/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreCompanyDTO.java @@ -1,5 +1,6 @@ package cn.lili.modules.store.entity.dto; +import cn.lili.common.validation.Mobile; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -38,6 +39,10 @@ public class StoreCompanyDTO { @ApiModelProperty(value = "公司地址") private String companyAddress; + @Mobile + @ApiModelProperty(value = "公司电话") + private String companyPhone; + @Email @ApiModelProperty(value = "电子邮箱") private String companyEmail; diff --git a/seller-api/src/main/java/cn/lili/controller/trade/MemberEvaluationStoreController.java b/seller-api/src/main/java/cn/lili/controller/trade/MemberEvaluationStoreController.java index 71b77c08..79279fc3 100644 --- a/seller-api/src/main/java/cn/lili/controller/trade/MemberEvaluationStoreController.java +++ b/seller-api/src/main/java/cn/lili/controller/trade/MemberEvaluationStoreController.java @@ -1,6 +1,8 @@ package cn.lili.controller.trade; import cn.lili.common.enums.ResultUtil; +import cn.lili.common.security.context.UserContext; +import cn.lili.common.security.enums.UserEnums; import cn.lili.common.vo.ResultMessage; import cn.lili.modules.member.entity.dto.EvaluationQueryParams; import cn.lili.modules.member.entity.vo.MemberEvaluationListVO; @@ -31,6 +33,7 @@ public class MemberEvaluationStoreController { @ApiOperation(value = "分页获取会员评论列表") @GetMapping public ResultMessage> getByPage(EvaluationQueryParams evaluationQueryParams) { + evaluationQueryParams.setStoreId(UserContext.getCurrentUser().getStoreId()); return ResultUtil.data(memberEvaluationService.queryPage(evaluationQueryParams)); } diff --git a/update-sql/version4.0to4.1.sql b/update-sql/version4.0to4.1.sql index 3bb510a4..a9a48e72 100644 --- a/update-sql/version4.0to4.1.sql +++ b/update-sql/version4.0to4.1.sql @@ -116,4 +116,6 @@ CREATE TABLE `li_coupon_activity_item` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /** 修改商品模板详情字段类型**/ -ALTER TABLE `li_draft_goods` MODIFY COLUMN `intro` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL; \ No newline at end of file +ALTER TABLE `li_draft_goods` MODIFY COLUMN `intro` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL; +/** 添加秒杀设置**/ +INSERT INTO `li_setting` ( `id`, `create_by`, `create_time`, `delete_flag`, `update_by`, `update_time`, `setting_value` ) VALUES ( 'SECKILL_SETTING', NULL, NULL, NULL, 'admin', '2021-06-04 09:58:39.384000', '{\"seckillRule\":\"秒杀规则\",\"hours\":\"9,10,11,12,13,14,15,21,22,23\"}' ); \ No newline at end of file From c628c0ebb26fe0c1bf8f9d87b8e0cab9ba71a714 Mon Sep 17 00:00:00 2001 From: Chopper Date: Mon, 28 Jun 2021 14:56:34 +0800 Subject: [PATCH 35/55] =?UTF-8?q?=E5=BA=97=E9=93=BA=E5=85=A5=E9=A9=BB?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=BC=BA=E5=A4=B1=E9=97=AE=E9=A2=98=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/modules/store/mapper/StoreDetailMapper.java | 2 +- .../modules/store/serviceimpl/StoreServiceImpl.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/store/mapper/StoreDetailMapper.java b/framework/src/main/java/cn/lili/modules/store/mapper/StoreDetailMapper.java index 0c33996b..4253411e 100644 --- a/framework/src/main/java/cn/lili/modules/store/mapper/StoreDetailMapper.java +++ b/framework/src/main/java/cn/lili/modules/store/mapper/StoreDetailMapper.java @@ -24,7 +24,7 @@ public interface StoreDetailMapper extends BaseMapper { "d.* from li_store s inner join li_store_detail d on s.id=d.store_id where s.id=#{storeId}") StoreDetailVO getStoreDetail(String storeId); - @Select("select s.member_name,s.store_name,s.store_disable,s.self_operated,s.store_center,s.store_logo,s.store_desc,d.* " + + @Select("select s.member_name,s.store_name,s.store_disable,s.self_operated,s.store_center,s.store_logo,s.store_desc,s.store_address_detail,s.store_address_path,s.store_address_id_path,d.* " + "from li_store s inner join li_store_detail d on s.id=d.store_id where s.member_id=#{memberId}") StoreDetailVO getStoreDetailByMemberId(String memberId); diff --git a/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreServiceImpl.java b/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreServiceImpl.java index c6706df1..3900662a 100644 --- a/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreServiceImpl.java @@ -179,8 +179,8 @@ public class StoreServiceImpl extends ServiceImpl implements memberService.updateById(member); //设定商家的结算日 storeDetailService.update(new LambdaUpdateWrapper() - .eq(StoreDetail::getStoreId,id) - .set(StoreDetail::getSettlementDay,new DateTime())); + .eq(StoreDetail::getStoreId, id) + .set(StoreDetail::getSettlementDay, new DateTime())); } else { store.setStoreDisable(StoreStatusEnum.REFUSED.value()); } @@ -220,11 +220,17 @@ public class StoreServiceImpl extends ServiceImpl implements if (!Optional.ofNullable(store).isPresent()) { Member member = memberService.getById(UserContext.getCurrentUser().getId()); store = new Store(member); + BeanUtil.copyProperties(storeCompanyDTO, store); this.save(store); StoreDetail storeDetail = new StoreDetail(); storeDetail.setStoreId(store.getId()); BeanUtil.copyProperties(storeCompanyDTO, storeDetail); return storeDetailService.save(storeDetail); + } else { + store.setStoreAddressDetail(storeCompanyDTO.getStoreAddressDetail()); + store.setStoreAddressIdPath(storeCompanyDTO.getStoreAddressIdPath()); + store.setStoreAddressPath(storeCompanyDTO.getStoreAddressPath()); + this.saveOrUpdate(store); } //判断是否存在店铺详情,如果没有则进行新建,如果存在则进行修改 StoreDetail storeDetail = storeDetailService.getStoreDetail(store.getId()); From cf9e6a659a371a9812a9b392eb2ba973fa73ef3c Mon Sep 17 00:00:00 2001 From: Chopper Date: Mon, 28 Jun 2021 15:16:32 +0800 Subject: [PATCH 36/55] =?UTF-8?q?qq=E8=81=94=E5=90=88=E7=99=BB=E5=BD=95ope?= =?UTF-8?q?nid=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/lili/modules/connect/util/ConnectUtil.java | 2 ++ 1 file changed, 2 insertions(+) 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); } } From fe06555a0b405793ac554dadf329566a42888065 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Mon, 28 Jun 2021 16:09:03 +0800 Subject: [PATCH 37/55] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=9630=E5=A4=A9?= =?UTF-8?q?=E7=9A=84=E7=A7=92=E6=9D=80=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promotion/serviceimpl/SeckillApplyServiceImpl.java | 2 +- .../modules/promotion/serviceimpl/SeckillServiceImpl.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillApplyServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillApplyServiceImpl.java index 7cec4571..64aa1db9 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillApplyServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillApplyServiceImpl.java @@ -185,7 +185,7 @@ public class SeckillApplyServiceImpl extends ServiceImpl impl //检查秒杀活动参数 checkSeckillParam(seckillVO, seckill.getStoreId()); //保存到MYSQL中 - boolean result = this.save(seckill); + boolean result = this.save(seckillVO); //保存到MONGO中 this.mongoTemplate.save(seckillVO); //添加秒杀延时任务 @@ -245,7 +245,7 @@ public class SeckillServiceImpl extends ServiceImpl impl public Integer getApplyNum() { LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); //秒杀申请时间未超过当前时间 - queryWrapper.le(Seckill::getApplyEndTime, cn.hutool.core.date.DateUtil.date()); + queryWrapper.ge(Seckill::getApplyEndTime, cn.hutool.core.date.DateUtil.date()); queryWrapper.eq(Seckill::getPromotionStatus, PromotionStatusEnum.NEW.name()); return this.count(queryWrapper); } @@ -296,7 +296,7 @@ public class SeckillServiceImpl extends ServiceImpl impl int sameNum = this.count(queryWrapper); //当前时间段是否存在同类活动 if (sameNum > 0) { - throw new ServiceException("当前时间内已存在同类活动"); + throw new ServiceException("当前时间内已存在同类活动:"+seckill.getStartTime()); } } } \ No newline at end of file From d5fab95707f7421f7e42130cba73c48bbe4c747f Mon Sep 17 00:00:00 2001 From: lifenlong Date: Mon, 28 Jun 2021 18:18:23 +0800 Subject: [PATCH 38/55] =?UTF-8?q?1.=E4=BC=98=E6=83=A0=E5=88=B8=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E7=94=B1=E5=AE=9A=E6=97=B6=E5=99=A8=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=BB=B6=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E3=80=82=202.=E4=BF=AE=E6=94=B9shopEditDTO,=E4=B8=8D=E7=BB=A7?= =?UTF-8?q?=E6=89=BFShopDetail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/coupon/CouponActivityExecute.java | 80 --------- .../CouponActivityServiceImpl.java | 28 +++- .../serviceimpl/PromotionServiceImpl.java | 20 ++- .../store/entity/dto/StoreEditDTO.java | 154 +++++++++++++++++- 4 files changed, 189 insertions(+), 93 deletions(-) delete mode 100644 consumer/src/main/java/cn/lili/timetask/handler/impl/coupon/CouponActivityExecute.java 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/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponActivityServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponActivityServiceImpl.java index 03f56f14..9fbd6e88 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponActivityServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponActivityServiceImpl.java @@ -2,7 +2,14 @@ package cn.lili.modules.promotion.serviceimpl; import cn.hutool.json.JSONUtil; import cn.lili.common.exception.ServiceException; +import cn.lili.common.trigger.enums.DelayTypeEnums; +import cn.lili.common.trigger.interfaces.TimeTrigger; +import cn.lili.common.trigger.message.PromotionMessage; +import cn.lili.common.trigger.model.TimeExecuteConstant; +import cn.lili.common.trigger.model.TimeTriggerMsg; +import cn.lili.common.trigger.util.DelayQueueTools; import cn.lili.common.utils.DateUtil; +import cn.lili.config.rocketmq.RocketmqCustomProperties; import cn.lili.modules.member.entity.dos.Member; import cn.lili.modules.member.service.MemberService; import cn.lili.modules.promotion.entity.dos.Coupon; @@ -10,9 +17,7 @@ import cn.lili.modules.promotion.entity.dos.CouponActivity; import cn.lili.modules.promotion.entity.dos.CouponActivityItem; import cn.lili.modules.promotion.entity.dos.MemberCoupon; import cn.lili.modules.promotion.entity.dto.CouponActivityDTO; -import cn.lili.modules.promotion.entity.enums.CouponActivitySendTypeEnum; -import cn.lili.modules.promotion.entity.enums.MemberCouponStatusEnum; -import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum; +import cn.lili.modules.promotion.entity.enums.*; import cn.lili.modules.promotion.entity.vos.CouponActivityVO; import cn.lili.modules.promotion.mapper.CouponActivityMapper; import cn.lili.modules.promotion.service.CouponActivityItemService; @@ -47,6 +52,12 @@ public class CouponActivityServiceImpl extends ServiceImpl() + .eq(CouponActivity::getId,promotionMessage.getPromotionId()) + .set(CouponActivity::getPromotionStatus,promotionMessage.getPromotionStatus())); } /** diff --git a/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreEditDTO.java b/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreEditDTO.java index 6b6bfe50..3a814565 100644 --- a/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreEditDTO.java +++ b/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreEditDTO.java @@ -1,11 +1,23 @@ package cn.lili.modules.store.entity.dto; +import cn.lili.common.validation.Mobile; +import cn.lili.common.validation.Phone; import cn.lili.modules.store.entity.dos.StoreDetail; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.hibernate.validator.constraints.Length; +import org.springframework.format.annotation.DateTimeFormat; +import javax.persistence.Column; +import javax.persistence.Id; +import javax.validation.constraints.Email; +import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; +import java.util.Date; /** * 店铺修改DTO @@ -14,7 +26,147 @@ import javax.validation.constraints.Size; * @date 2020-08-22 15:10:51 */ @Data -public class StoreEditDTO extends StoreDetail { +public class StoreEditDTO { + + + @Id + @TableId + @TableField + @Column(columnDefinition = "bigint(20)") + @ApiModelProperty(value = "唯一标识", hidden = true) + private String id; + + @NotBlank(message = "店铺不能为空") + @ApiModelProperty(value = "店铺id") + private String storeId; + + @Size(min = 2, max = 200, message = "店铺名称长度为2-200位") + @NotBlank(message = "店铺名称不能为空") + @ApiModelProperty(value = "店铺名称") + private String storeName; + + @NotBlank(message = "公司名称不能为空") + @Size(min = 2, max = 100, message = "公司名称错误") + @ApiModelProperty(value = "公司名称") + private String companyName; + + @NotBlank(message = "公司地址不能为空") + @Size(min = 1, max = 200, message = "公司地址,长度为1-200字符") + @ApiModelProperty(value = "公司地址") + private String companyAddress; + + @ApiModelProperty(value = "公司地址地区Id") + private String companyAddressIdPath; + + @ApiModelProperty(value = "公司地址地区") + private String companyAddressPath; + + @Mobile + @ApiModelProperty(value = "公司电话") + private String companyPhone; + + @Email + @ApiModelProperty(value = "电子邮箱") + private String companyEmail; + + @Min(value = 1, message = "员工总数,至少一位") + @ApiModelProperty(value = "员工总数") + private Integer employeeNum; + + @Min(value = 1, message = "注册资金,至少一位") + @ApiModelProperty(value = "注册资金") + private Double registeredCapital; + + @NotBlank(message = "联系人姓名为空") + @Length(min = 2, max = 20, message = "联系人长度为:2-20位字符") + @ApiModelProperty(value = "联系人姓名") + private String linkName; + + @NotBlank(message = "手机号不能为空") + @Phone + @ApiModelProperty(value = "联系人电话") + private String linkPhone; + + @Size(min = 18, max = 18, message = "营业执照长度为18位字符") + @ApiModelProperty(value = "营业执照号") + private String licenseNum; + + @Size(min = 1, max = 200, message = "法定经营范围长度为1-200位字符") + @ApiModelProperty(value = "法定经营范围") + private String scope; + + @NotBlank(message = "营业执照电子版不能为空") + @ApiModelProperty(value = "营业执照电子版") + private String licencePhoto; + + @NotBlank(message = "法人姓名不能为空") + @Size(min = 2, max = 20, message = "法人姓名长度为2-20位字符") + @ApiModelProperty(value = "法人姓名") + private String legalName; + + @NotBlank(message = "法人身份证不能为空") + @Size(min = 18, max = 18, message = "法人身份证号长度为18位") + @ApiModelProperty(value = "法人身份证") + private String legalId; + + @NotBlank(message = "法人身份证不能为空") + @ApiModelProperty(value = "法人身份证照片") + private String legalPhoto; + + @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; + + @Size(min = 1, max = 50, message = "结算银行支行联行号长度为1-200位") + @NotBlank(message = "结算银行支行联行号不能为空") + @ApiModelProperty(value = "结算银行支行联行号") + private String settlementBankJointName; + + @NotBlank(message = "店铺经营类目不能为空") + @ApiModelProperty(value = "店铺经营类目") + @Column(columnDefinition = "TEXT") + private String goodsManagementCategory; + + @ApiModelProperty(value = "结算周期") + private String settlementCycle; + + + @ApiModelProperty(value = "库存预警数量") + private Integer stockWarning; + + /** + * 同城配送达达店铺编码 + */ + @ApiModelProperty(value = "同城配送达达店铺编码") + @TableField(value = "dd_code") + private String ddCode; + + //店铺退货收件地址 + @ApiModelProperty(value = "收货人姓名") + private String salesConsigneeName; + + @ApiModelProperty(value = "收件人手机") + private String salesConsigneeMobile; + + @ApiModelProperty(value = "地址Id, ','分割") + private String salesConsigneeAddressId; + + @ApiModelProperty(value = "地址名称, ','分割") + private String salesConsigneeAddressPath; + + @ApiModelProperty(value = "详细地址") + private String salesConsigneeDetail; @ApiModelProperty(value = "店铺状态") private String storeDisable; From 8ed54e061f735b594d9b7f0fcc4ae40e8b1dfe76 Mon Sep 17 00:00:00 2001 From: pikachu <1321288662@qq.com> Date: Tue, 29 Jun 2021 08:25:54 +0800 Subject: [PATCH 39/55] =?UTF-8?q?=E4=BC=9A=E5=91=98=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/MemberMessageBuyerController.java | 15 +++++++++------ .../lili/listener/NoticeSendMessageListener.java | 2 +- .../modules/message/entity/dos/MemberMessage.java | 2 +- .../serviceimpl/MemberMessageServiceImpl.java | 8 +++++--- 4 files changed, 16 insertions(+), 11 deletions(-) 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/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/framework/src/main/java/cn/lili/modules/message/entity/dos/MemberMessage.java b/framework/src/main/java/cn/lili/modules/message/entity/dos/MemberMessage.java index 378e35b6..4ccb3fdd 100644 --- a/framework/src/main/java/cn/lili/modules/message/entity/dos/MemberMessage.java +++ b/framework/src/main/java/cn/lili/modules/message/entity/dos/MemberMessage.java @@ -43,7 +43,7 @@ public class MemberMessage extends BaseEntity { /** * @see MessageStatusEnum */ - @ApiModelProperty(value = "状态 0默认未读 1已读 2回收站") + @ApiModelProperty(value = "状态") private String status = MessageStatusEnum.UN_READY.name(); } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/message/serviceimpl/MemberMessageServiceImpl.java b/framework/src/main/java/cn/lili/modules/message/serviceimpl/MemberMessageServiceImpl.java index 7b9a78ae..e5dfed67 100644 --- a/framework/src/main/java/cn/lili/modules/message/serviceimpl/MemberMessageServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/message/serviceimpl/MemberMessageServiceImpl.java @@ -31,13 +31,15 @@ public class MemberMessageServiceImpl extends ServiceImpl getPage(MemberMessageQueryVO memberMessageQueryVO, PageVO pageVO) { QueryWrapper queryWrapper = new QueryWrapper<>(); //消息id - queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getMessageId()), "message_id", memberMessageQueryVO.getMessageId()); + queryWrapper.eq(StringUtils.isNotEmpty(memberMessageQueryVO.getMessageId()), "message_id", memberMessageQueryVO.getMessageId()); //消息标题 queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getTitle()), "title", memberMessageQueryVO.getTitle()); //会员id - queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getMemberId()), "member_id", memberMessageQueryVO.getMemberId()); + queryWrapper.eq(StringUtils.isNotEmpty(memberMessageQueryVO.getMemberId()), "member_id", memberMessageQueryVO.getMemberId()); //消息状态 - queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getStatus()), "status", memberMessageQueryVO.getStatus()); + queryWrapper.eq(StringUtils.isNotEmpty(memberMessageQueryVO.getStatus()), "status", memberMessageQueryVO.getStatus()); + //倒序 + queryWrapper.orderByDesc("create_time"); //构建查询 return this.page(PageUtil.initPage(pageVO), queryWrapper); } From fcfa140a0ab47d8d3335109014422668276c08f3 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Tue, 29 Jun 2021 09:23:22 +0800 Subject: [PATCH 40/55] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/StudioServiceImpl.java | 6 +- .../order/cart/render/TradeBuilder.java | 6 + .../order/cart/service/CartService.java | 7 + .../order/order/service/OrderService.java | 4 +- .../order/order/service/TradeService.java | 7 + .../order/serviceimpl/TradeServiceImpl.java | 192 +----------------- 6 files changed, 27 insertions(+), 195 deletions(-) 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 990dd0cd..b48a6047 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 @@ -62,9 +62,9 @@ public class StudioServiceImpl 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(Integer.parseInt(roomMap.get("roomId"))); + studio.setQrCodeUrl(roomMap.get("qrcodeUrl")); studio.setStoreId(UserContext.getCurrentUser().getStoreId()); studio.setStatus(StudioStatusEnum.NEW.name()); //直播间添加成功发送直播间开启、关闭延时任务 diff --git a/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java b/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java index 9a69a2a7..4454c8f9 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java @@ -80,6 +80,10 @@ public class TradeBuilder { /** * 构造一笔交易 + * 1.从缓存中读取交易数据 + * 2.从购物车列表中筛选出已选择的SKU列表存入交易中 + * 3.渲染整个交易(0-> 校验商品 1-》 满优惠渲染 2->渲染优惠 3->优惠券渲染 4->计算运费 5->计算价格 6->分销渲染 7->其他渲染) + * 4.将已选择的购物车列表存入交易中 * * @param checkedWay 购物车类型 * @return 购物车展示信息 @@ -114,6 +118,8 @@ public class TradeBuilder { /** * 创建一笔交易 + * 1.构造交易 + * 2.创建交易 * * @param checkedWay 购物车类型 * @return 交易信息 diff --git a/framework/src/main/java/cn/lili/modules/order/cart/service/CartService.java b/framework/src/main/java/cn/lili/modules/order/cart/service/CartService.java index 2d997b3f..c47b37e9 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/service/CartService.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/service/CartService.java @@ -162,6 +162,13 @@ public interface CartService { /** * 创建交易 + * 1.获取购物车类型,不同的购物车类型有不同的订单逻辑 + * 购物车类型:购物车、立即购买、虚拟商品、拼团、积分 + * 2.校验用户的收件人信息 + * 3.设置交易的基础参数 + * 4.交易信息存储到缓存中 + * 5.创建交易 + * 6.清除购物车选择数据 * * @param tradeParams 创建交易参数 * @return 交易信息 diff --git a/framework/src/main/java/cn/lili/modules/order/order/service/OrderService.java b/framework/src/main/java/cn/lili/modules/order/order/service/OrderService.java index a44078ff..fbc45510 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/service/OrderService.java +++ b/framework/src/main/java/cn/lili/modules/order/order/service/OrderService.java @@ -70,7 +70,9 @@ public interface OrderService extends IService { OrderDetailVO queryDetail(String orderSn); /** - * 创建交易 + * 创建订单 + * 1.检查交易信息 + * 2.循环交易购物车列表,创建订单以及相关信息 * * @param tradeDTO 交易DTO */ diff --git a/framework/src/main/java/cn/lili/modules/order/order/service/TradeService.java b/framework/src/main/java/cn/lili/modules/order/order/service/TradeService.java index 91457521..21fcfe5b 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/service/TradeService.java +++ b/framework/src/main/java/cn/lili/modules/order/order/service/TradeService.java @@ -14,6 +14,13 @@ public interface TradeService extends IService { /** * 创建交易 + * 1.订单数据校验 + * 2.积分预处理 + * 3.优惠券预处理 + * 4.添加交易 + * 5.添加订单 + * 6.将交易写入缓存供消费者调用 + * 7.发送交易创建消息 * * @param tradeDTO 购物车视图 * @return 交易 diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/TradeServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/TradeServiceImpl.java index ed5d50b3..f1b66b6e 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/TradeServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/TradeServiceImpl.java @@ -1,191 +1 @@ -package cn.lili.modules.order.order.serviceimpl; - -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.rocketmq.RocketmqSendCallbackBuilder; -import cn.lili.common.rocketmq.tags.MqOrderTagsEnum; -import cn.lili.config.rocketmq.RocketmqCustomProperties; -import cn.lili.modules.member.entity.dos.Member; -import cn.lili.modules.member.entity.dos.MemberAddress; -import cn.lili.modules.member.service.MemberService; -import cn.lili.modules.order.cart.entity.dto.MemberCouponDTO; -import cn.lili.modules.order.cart.entity.dto.TradeDTO; -import cn.lili.modules.order.cart.entity.vo.CartVO; -import cn.lili.modules.order.order.entity.dos.Order; -import cn.lili.modules.order.order.entity.dos.Trade; -import cn.lili.modules.order.order.entity.enums.PayStatusEnum; -import cn.lili.modules.order.order.mapper.TradeMapper; -import cn.lili.modules.order.order.service.OrderService; -import cn.lili.modules.order.order.service.TradeService; -import cn.lili.modules.promotion.service.CouponService; -import cn.lili.modules.promotion.service.MemberCouponService; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.apache.rocketmq.spring.core.RocketMQTemplate; -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.Collection; -import java.util.List; -import java.util.stream.Collectors; - -/** - * 交易业务层实现 - * - * @author Chopper - * @date 2020/11/17 7:39 下午 - */ -@Service -@Transactional -public class TradeServiceImpl extends ServiceImpl implements TradeService { - - //缓存 - @Autowired - private Cache cache; - //订单 - @Autowired - private OrderService orderService; - //会员 - @Autowired - private MemberService memberService; - //优惠券 - @Autowired - private CouponService couponService; - //会员优惠券 - @Autowired - private MemberCouponService memberCouponService; - //RocketMQ - @Autowired - private RocketMQTemplate rocketMQTemplate; - //RocketMQ 配置 - @Autowired - private RocketmqCustomProperties rocketmqCustomProperties; - - - @Override - @Transactional(rollbackFor = Exception.class) - public Trade createTrade(TradeDTO tradeDTO) { - - //创建订单预校验 - createTradeCheck(tradeDTO); - - - Trade trade = new Trade(tradeDTO); - String key = CachePrefix.TRADE.getPrefix() + trade.getSn(); - //积分预处理 - pointPretreatment(tradeDTO); - //优惠券预处理 - couponPretreatment(tradeDTO); - //添加交易 - this.save(trade); - //添加订单 - orderService.intoDB(tradeDTO); - //写入缓存,给消费者调用 - cache.put(key, tradeDTO); - //构建订单创建消息 - String destination = rocketmqCustomProperties.getOrderTopic() + ":" + MqOrderTagsEnum.ORDER_CREATE.name(); - //发送订单创建消息 - rocketMQTemplate.asyncSend(destination, key, RocketmqSendCallbackBuilder.commonCallback()); - return trade; - } - - /** - * 创建订单最后一步校验 - * - * @param tradeDTO - */ - private void createTradeCheck(TradeDTO tradeDTO) { - - //创建订单如果没有收获地址, - MemberAddress memberAddress = tradeDTO.getMemberAddress(); - if (memberAddress == null) { - throw new ServiceException(ResultCode.MEMBER_ADDRESS_NOT_EXIST); - } - - /** - * 订单配送区域校验 - */ - if (tradeDTO.getNotSupportFreight() != null && tradeDTO.getNotSupportFreight().size() > 0) { - StringBuilder stringBuilder = new StringBuilder("包含商品有-"); - tradeDTO.getNotSupportFreight().forEach(sku -> { - stringBuilder.append(sku.getGoodsSku().getGoodsName()); - }); - throw new ServiceException(ResultCode.ORDER_NOT_SUPPORT_DISTRIBUTION, stringBuilder.toString()); - } - } - - @Override - public Trade getBySn(String sn) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(Trade::getSn, sn); - return this.getOne(queryWrapper); - } - - - @Override - public void payTrade(String tradeSn, String paymentName, String receivableNo) { - LambdaQueryWrapper orderQueryWrapper = new LambdaQueryWrapper<>(); - orderQueryWrapper.eq(Order::getTradeSn, tradeSn); - List orders = orderService.list(orderQueryWrapper); - for (Order order : orders) { - orderService.payOrder(order.getSn(), paymentName, receivableNo); - } - Trade trade = this.getBySn(tradeSn); - trade.setPayStatus(PayStatusEnum.PAID.name()); - this.saveOrUpdate(trade); - } - - /** - * 积分预处理 - * 下单同时,使用积分 - * - * @param tradeDTO - */ - private void pointPretreatment(TradeDTO tradeDTO) { - StringBuilder orderSns = new StringBuilder(); - for (CartVO item : tradeDTO.getCartList()) { - orderSns.append(item.getSn()).append(","); - } - if (tradeDTO.getPriceDetailDTO() != null && tradeDTO.getPriceDetailDTO().getPayPoint() != null && tradeDTO.getPriceDetailDTO().getPayPoint() > 0) { - Member userInfo = memberService.getUserInfo(); - if (userInfo.getPoint() < tradeDTO.getPriceDetailDTO().getPayPoint()) { - throw new ServiceException(ResultCode.PAY_POINT_ENOUGH); - } - boolean result = memberService.updateMemberPoint(tradeDTO.getPriceDetailDTO(). - getPayPoint().longValue(), false, tradeDTO.getMemberId(), - "订单【" + orderSns + "】创建,积分扣减"); - - if (!result) { - throw new ServiceException(ResultCode.PAY_POINT_ENOUGH); - } - } - } - - - /** - * 优惠券预处理 - * 下单同时,扣除优惠券 - * - * @param tradeDTO - */ - private void couponPretreatment(TradeDTO tradeDTO) { - List memberCouponDTOList = new ArrayList<>(); - if (null != tradeDTO.getPlatformCoupon()) { - memberCouponDTOList.add(tradeDTO.getPlatformCoupon()); - } - Collection storeCoupons = tradeDTO.getStoreCoupons().values(); - if (!storeCoupons.isEmpty()) { - memberCouponDTOList.addAll(storeCoupons); - } - List ids = memberCouponDTOList.stream().map(e -> e.getMemberCoupon().getId()).collect(Collectors.toList()); - memberCouponService.used(ids); - memberCouponDTOList.forEach(e -> couponService.usedCoupon(e.getMemberCoupon().getCouponId(), 1)); - - } - - -} \ No newline at end of file +package cn.lili.modules.order.order.serviceimpl; 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.rocketmq.RocketmqSendCallbackBuilder; import cn.lili.common.rocketmq.tags.MqOrderTagsEnum; import cn.lili.config.rocketmq.RocketmqCustomProperties; import cn.lili.modules.member.entity.dos.Member; import cn.lili.modules.member.entity.dos.MemberAddress; import cn.lili.modules.member.service.MemberService; import cn.lili.modules.order.cart.entity.dto.MemberCouponDTO; import cn.lili.modules.order.cart.entity.dto.TradeDTO; import cn.lili.modules.order.cart.entity.vo.CartVO; import cn.lili.modules.order.order.entity.dos.Order; import cn.lili.modules.order.order.entity.dos.Trade; import cn.lili.modules.order.order.entity.enums.PayStatusEnum; import cn.lili.modules.order.order.mapper.TradeMapper; import cn.lili.modules.order.order.service.OrderService; import cn.lili.modules.order.order.service.TradeService; import cn.lili.modules.promotion.service.CouponService; import cn.lili.modules.promotion.service.MemberCouponService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.rocketmq.spring.core.RocketMQTemplate; 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.Collection; import java.util.List; import java.util.stream.Collectors; /** * 交易业务层实现 * * @author Chopper * @date 2020/11/17 7:39 下午 */ @Service @Transactional public class TradeServiceImpl extends ServiceImpl implements TradeService { //缓存 @Autowired private Cache cache; //订单 @Autowired private OrderService orderService; //会员 @Autowired private MemberService memberService; //优惠券 @Autowired private CouponService couponService; //会员优惠券 @Autowired private MemberCouponService memberCouponService; //RocketMQ @Autowired private RocketMQTemplate rocketMQTemplate; //RocketMQ 配置 @Autowired private RocketmqCustomProperties rocketmqCustomProperties; @Override @Transactional(rollbackFor = Exception.class) public Trade createTrade(TradeDTO tradeDTO) { //创建订单预校验 createTradeCheck(tradeDTO); Trade trade = new Trade(tradeDTO); String key = CachePrefix.TRADE.getPrefix() + trade.getSn(); //积分预处理 pointPretreatment(tradeDTO); //优惠券预处理 couponPretreatment(tradeDTO); //添加交易 this.save(trade); //添加订单 orderService.intoDB(tradeDTO); //写入缓存,给消费者调用 cache.put(key, tradeDTO); //构建订单创建消息 String destination = rocketmqCustomProperties.getOrderTopic() + ":" + MqOrderTagsEnum.ORDER_CREATE.name(); //发送订单创建消息 rocketMQTemplate.asyncSend(destination, key, RocketmqSendCallbackBuilder.commonCallback()); return trade; } /** * 创建订单最后一步校验 * * @param tradeDTO */ private void createTradeCheck(TradeDTO tradeDTO) { //创建订单如果没有收获地址, MemberAddress memberAddress = tradeDTO.getMemberAddress(); if (memberAddress == null) { throw new ServiceException(ResultCode.MEMBER_ADDRESS_NOT_EXIST); } /** * 订单配送区域校验 */ if (tradeDTO.getNotSupportFreight() != null && tradeDTO.getNotSupportFreight().size() > 0) { StringBuilder stringBuilder = new StringBuilder("包含商品有-"); tradeDTO.getNotSupportFreight().forEach(sku -> { stringBuilder.append(sku.getGoodsSku().getGoodsName()); }); throw new ServiceException(ResultCode.ORDER_NOT_SUPPORT_DISTRIBUTION, stringBuilder.toString()); } } @Override public Trade getBySn(String sn) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(Trade::getSn, sn); return this.getOne(queryWrapper); } @Override public void payTrade(String tradeSn, String paymentName, String receivableNo) { LambdaQueryWrapper orderQueryWrapper = new LambdaQueryWrapper<>(); orderQueryWrapper.eq(Order::getTradeSn, tradeSn); List orders = orderService.list(orderQueryWrapper); for (Order order : orders) { orderService.payOrder(order.getSn(), paymentName, receivableNo); } Trade trade = this.getBySn(tradeSn); trade.setPayStatus(PayStatusEnum.PAID.name()); this.saveOrUpdate(trade); } /** * 积分预处理 * 下单同时,使用积分 * * @param tradeDTO */ private void pointPretreatment(TradeDTO tradeDTO) { StringBuilder orderSns = new StringBuilder(); for (CartVO item : tradeDTO.getCartList()) { orderSns.append(item.getSn()).append(","); } if (tradeDTO.getPriceDetailDTO() != null && tradeDTO.getPriceDetailDTO().getPayPoint() != null && tradeDTO.getPriceDetailDTO().getPayPoint() > 0) { Member userInfo = memberService.getUserInfo(); if (userInfo.getPoint() < tradeDTO.getPriceDetailDTO().getPayPoint()) { throw new ServiceException(ResultCode.PAY_POINT_ENOUGH); } boolean result = memberService.updateMemberPoint(tradeDTO.getPriceDetailDTO(). getPayPoint().longValue(), false, tradeDTO.getMemberId(), "订单【" + orderSns + "】创建,积分扣减"); if (!result) { throw new ServiceException(ResultCode.PAY_POINT_ENOUGH); } } } /** * 优惠券预处理 * 下单同时,扣除优惠券 * * @param tradeDTO */ private void couponPretreatment(TradeDTO tradeDTO) { List memberCouponDTOList = new ArrayList<>(); if (null != tradeDTO.getPlatformCoupon()) { memberCouponDTOList.add(tradeDTO.getPlatformCoupon()); } Collection storeCoupons = tradeDTO.getStoreCoupons().values(); if (!storeCoupons.isEmpty()) { memberCouponDTOList.addAll(storeCoupons); } List ids = memberCouponDTOList.stream().map(e -> e.getMemberCoupon().getId()).collect(Collectors.toList()); memberCouponService.used(ids); memberCouponDTOList.forEach(e -> couponService.usedCoupon(e.getMemberCoupon().getCouponId(), 1)); } } \ No newline at end of file From d96d5edcd523a5ce66deca8768083b4c7ff708ff Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 10:13:18 +0800 Subject: [PATCH 41/55] =?UTF-8?q?=E4=BC=9A=E5=91=98=E6=8F=90=E7=8E=B0api?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/member/MemberWithdrawApplyManagerController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manager-api/src/main/java/cn/lili/controller/member/MemberWithdrawApplyManagerController.java b/manager-api/src/main/java/cn/lili/controller/member/MemberWithdrawApplyManagerController.java index eff087ba..57f2112d 100644 --- a/manager-api/src/main/java/cn/lili/controller/member/MemberWithdrawApplyManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/member/MemberWithdrawApplyManagerController.java @@ -47,7 +47,7 @@ public class MemberWithdrawApplyManagerController { @ApiOperation(value = "提现申请审核") @PostMapping @ApiImplicitParams({ - @ApiImplicitParam(name = "apply_id", value = "审核记录id", required = true, paramType = "query"), + @ApiImplicitParam(name = "applyId", value = "审核记录id", required = true, paramType = "query"), @ApiImplicitParam(name = "result", value = "审核结果", required = true, paramType = "query", dataType = "boolean"), @ApiImplicitParam(name = "remark", value = "审核备注", paramType = "query") }) From 5a415ffc7779e5d546ea3d52de8638d88a7c6850 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 10:25:45 +0800 Subject: [PATCH 42/55] =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=88=A4=E5=AE=9A?= =?UTF-8?q?=E8=AF=AD=E5=8F=A5=E9=A1=BA=E5=BA=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/lili/event/impl/NoticeMessageExecute.java | 4 ++-- .../modules/order/order/serviceimpl/OrderServiceImpl.java | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) 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..5a038765 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); } diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java index c0b02ebc..f423e6ea 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java @@ -203,8 +203,7 @@ public class OrderServiceImpl extends ServiceImpl implements public Order cancel(String orderSn, String reason) { Order order = OperationalJudgment.judgment(this.getBySn(orderSn)); //如果订单促销类型不为空&&订单是拼团订单,并且订单未成团,则抛出异常 - if (StringUtils.isNotEmpty(order.getOrderPromotionType()) - && order.getOrderPromotionType().equals(OrderPromotionTypeEnum.PINTUAN.name()) + if (OrderPromotionTypeEnum.PINTUAN.name().equals(order.getOrderPromotionType()) && !order.getOrderStatus().equals(OrderStatusEnum.UNDELIVERED.name())) { throw new ServiceException(ResultCode.ORDER_CAN_NOT_CANCEL); } @@ -286,7 +285,7 @@ public class OrderServiceImpl extends ServiceImpl implements Order order = this.getBySn(orderSn); //判断是否为拼团订单,进行特殊处理 //判断订单类型进行不同的订单确认操作 - if (order.getOrderPromotionType() != null && order.getOrderPromotionType().equals(OrderPromotionTypeEnum.PINTUAN.name())) { + if (OrderPromotionTypeEnum.PINTUAN.name().equals(order.getOrderPromotionType())) { this.checkPintuanOrder(order.getPromotionId(), order.getParentOrderSn()); } else { //判断订单类型 From 39e851ee789c714900cdb59e4d45de6aac5ec75f Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 11:15:27 +0800 Subject: [PATCH 43/55] =?UTF-8?q?aop=E7=A7=AF=E5=88=86=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=85=BC=E5=AE=B9=E9=97=AE=E9=A2=98=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/lili/event/impl/NoticeMessageExecute.java | 5 ++++- .../entity/aop/interceptor/PointLogInterceptor.java | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) 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 5a038765..e3346136 100644 --- a/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java +++ b/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java @@ -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/framework/src/main/java/cn/lili/modules/member/entity/aop/interceptor/PointLogInterceptor.java b/framework/src/main/java/cn/lili/modules/member/entity/aop/interceptor/PointLogInterceptor.java index 7d6708ab..425fcb72 100644 --- a/framework/src/main/java/cn/lili/modules/member/entity/aop/interceptor/PointLogInterceptor.java +++ b/framework/src/main/java/cn/lili/modules/member/entity/aop/interceptor/PointLogInterceptor.java @@ -40,9 +40,9 @@ public class PointLogInterceptor { point = Long.valueOf(obj[0].toString()); } //变动类型 - Integer type = 0; + Boolean type = false; if (obj[1] != null) { - type = Integer.valueOf(obj[1].toString()); + type = Boolean.valueOf(obj[1].toString()); } //会员ID String memberId = ""; @@ -55,7 +55,7 @@ public class PointLogInterceptor { MemberPointsHistory memberPointsHistory = new MemberPointsHistory(); memberPointsHistory.setMemberId(member.getId()); memberPointsHistory.setMemberName(member.getUsername()); - memberPointsHistory.setPointType(type); + memberPointsHistory.setPointType(type ? 1 : 0); memberPointsHistory.setVariablePoint(point); memberPointsHistory.setBeforePoint(new Double(CurrencyUtil.sub(member.getPoint(), point)).longValue()); memberPointsHistory.setPoint(member.getPoint()); @@ -64,7 +64,7 @@ public class PointLogInterceptor { memberPointsHistoryService.save(memberPointsHistory); } } catch (Exception e) { - log.error("积分操作错误",e); + log.error("积分操作错误", e); } From 50f96727b3c77eb197392d053604635a4ff109dc Mon Sep 17 00:00:00 2001 From: lifenlong Date: Tue, 29 Jun 2021 11:24:53 +0800 Subject: [PATCH 44/55] =?UTF-8?q?=E5=88=86=E9=94=80=E5=95=86=E5=93=81VO?= =?UTF-8?q?=E8=BF=94=E5=9B=9EGoodsId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/distribution/entity/vos/DistributionGoodsVO.java | 3 +++ 1 file changed, 3 insertions(+) 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; From 5e54b2f179b171ce177b06f412350d4a682625d1 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 11:56:40 +0800 Subject: [PATCH 45/55] =?UTF-8?q?=E8=A7=84=E6=A0=BC=E5=80=BC=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update-sql/version4.0to4.1.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/update-sql/version4.0to4.1.sql b/update-sql/version4.0to4.1.sql index a9a48e72..8570eda7 100644 --- a/update-sql/version4.0to4.1.sql +++ b/update-sql/version4.0to4.1.sql @@ -10,6 +10,7 @@ ALTER TABLE li_goods DROP COLUMN freight_payer; /**添加商品类型**/ ALTER TABLE li_goods ADD goods_type VARCHAR ( 32 ); ALTER TABLE li_goods_sku ADD goods_type VARCHAR ( 32 ); +ALTER TABLE li_specification ADD spec_value text; UPDATE li_goods SET goods_type = "PHYSICAL_GOODS"; UPDATE li_goods_sku SET goods_type = "PHYSICAL_GOODS"; /**增加优惠券有效期类型**/ From 3ee3e49d0b46f8ef42662548f50c0506f5c11072 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 15:40:37 +0800 Subject: [PATCH 46/55] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=9C=A8=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E7=9B=B4=E6=92=AD=E6=97=B6=E6=B2=A1=E6=9C=89=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=8A=9B=E5=87=BA=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=A4=84=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/modules/broadcast/serviceimpl/StudioServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b48a6047..ce2823ce 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 @@ -200,7 +200,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); From c1b9f287c7c8d764a0fd2e2089d31418a562daab Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 16:26:52 +0800 Subject: [PATCH 47/55] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=8D=B3=E8=B5=8B=E4=BA=88=E6=9D=83=E9=99=90=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= =?UTF-8?q?=E3=80=82=E7=9B=B4=E6=92=AD=E9=97=B4=E6=9C=AA=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/broadcast/serviceimpl/StudioServiceImpl.java | 2 +- .../permission/serviceimpl/AdminUserServiceImpl.java | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) 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 ce2823ce..bc677669 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 @@ -200,7 +200,7 @@ public class StudioServiceImpl extends ServiceImpl impleme .eq(recommend != null, "recommend", true) .eq(status != null, "status", status) .orderByDesc("create_time"); - if (UserContext.getCurrentUser()!=null&&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/permission/serviceimpl/AdminUserServiceImpl.java b/framework/src/main/java/cn/lili/modules/permission/serviceimpl/AdminUserServiceImpl.java index d28b664e..831aec4b 100644 --- a/framework/src/main/java/cn/lili/modules/permission/serviceimpl/AdminUserServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/permission/serviceimpl/AdminUserServiceImpl.java @@ -199,13 +199,12 @@ public class AdminUserServiceImpl extends ServiceImpl 10) { throw new ServiceException(ResultCode.PERMISSION_BEYOND_TEN); } - if (roles != null && roles.size() > 0) { + if (roles.size() > 0) { dbUser.setRoleIds(StringUtils.join(",", roles)); } - - this.save(dbUser); - updateRole(adminUser.getId(), roles); + dbUser = this.findByUsername(dbUser.getUsername()); + updateRole(dbUser.getId(), roles); } From f509b8745d90b9f5b284d7eef388b09e31f43275 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 16:43:38 +0800 Subject: [PATCH 48/55] =?UTF-8?q?token=E7=94=9F=E6=88=90=E6=97=B6=E6=9D=83?= =?UTF-8?q?=E9=99=90=E8=BF=87=E6=BB=A4=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/common/token/base/generate/ManagerTokenGenerate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 1431d990f97c60e72f58e8fe5386e70dae842412 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Tue, 29 Jun 2021 16:58:54 +0800 Subject: [PATCH 49/55] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E9=97=B4=E6=97=B6=E9=97=B4=E4=B8=8D=E6=AD=A3=E7=A1=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../broadcast/serviceimpl/StudioServiceImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 b48a6047..4ef48de1 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 @@ -72,7 +72,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 +83,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 +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()); @@ -119,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()); From a60a535708db8a8dead6cd8dcbb8ed7adc570203 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Wed, 30 Jun 2021 08:41:04 +0800 Subject: [PATCH 50/55] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E9=94=80?= =?UTF-8?q?=E5=8F=AF=E6=8F=90=E7=8E=B0=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../other/distribution/DistributionBuyerController.java | 2 +- .../entity/vos/DistributionOrderSearchParams.java | 4 ++-- .../lili/modules/distribution/mapper/DistributionMapper.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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/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 From 46f216c19165f2bd73819090938fe027827e7b40 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Wed, 30 Jun 2021 10:26:32 +0800 Subject: [PATCH 51/55] =?UTF-8?q?1.=E5=BA=97=E9=93=BA=E5=85=B3=E9=97=AD?= =?UTF-8?q?=EF=BC=8C=E6=89=B9=E9=87=8F=E4=B8=8B=E6=9E=B6=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E5=95=86=E5=93=81=E9=97=AE=E9=A2=98=E3=80=82=202.=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=AE=9E=E7=89=A9/=E8=99=9A=E6=8B=9F=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=8F=91=E8=B4=A7=E9=80=BB=E8=BE=91=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/goods/mapper/GoodsMapper.java | 10 ++++---- .../goods/serviceimpl/GoodsServiceImpl.java | 5 +++- .../modules/order/order/entity/dos/Order.java | 24 +++++++++---------- .../order/entity/enums/OrderTypeEnum.java | 11 +-------- .../order/order/entity/vo/AllowOperation.java | 7 +++--- 5 files changed, 26 insertions(+), 31 deletions(-) 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/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index a2560973..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 @@ -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 diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java index 09903e68..daafdca9 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java @@ -219,27 +219,25 @@ public class Order extends BaseEntity { BeanUtil.copyProperties(tradeDTO, this); BeanUtil.copyProperties(cartVO.getPriceDetailDTO(), this); BeanUtil.copyProperties(cartVO, this); - //订单类型判断--普通订单,活动订单。 + //订单类型判断--普通订单,虚拟订单。 if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.CART) || tradeDTO.getCartTypeEnum().equals(CartTypeEnum.BUY_NOW)) { this.setOrderType(OrderTypeEnum.NORMAL.name()); } else if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.VIRTUAL)) { this.setOrderType(tradeDTO.getCartTypeEnum().name()); - } else { - this.setOrderType(OrderTypeEnum.NORMAL.name()); } this.setId(oldId); //促销信息填充 - if (cartVO.getSkuList().get(0).getPromotions() != null && tradeDTO.getCartTypeEnum().equals(CartTypeEnum.PINTUAN)) { - Optional pintuanId = cartVO.getSkuList().get(0).getPromotions().stream().filter(i -> i.getPromotionType().equals(PromotionTypeEnum.PINTUAN.name())).map(PromotionGoods::getPromotionId).findFirst(); - if (pintuanId.isPresent()) { - promotionId = pintuanId.get(); - this.setOrderType(OrderTypeEnum.PINTUAN.name()); - if (tradeDTO.getParentOrderSn() == null) { - this.setParentOrderSn(""); - } - } - } +// if (cartVO.getSkuList().get(0).getPromotions() != null && tradeDTO.getCartTypeEnum().equals(CartTypeEnum.PINTUAN)) { +// Optional pintuanId = cartVO.getSkuList().get(0).getPromotions().stream().filter(i -> i.getPromotionType().equals(PromotionTypeEnum.PINTUAN.name())).map(PromotionGoods::getPromotionId).findFirst(); +// if (pintuanId.isPresent()) { +// promotionId = pintuanId.get(); +// this.setOrderType(OrderTypeEnum.PINTUAN.name()); +// if (tradeDTO.getParentOrderSn() == null) { +// this.setParentOrderSn(""); +// } +// } +// } //设置默认支付状态 this.setOrderStatus(OrderStatusEnum.UNPAID.name()); diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/enums/OrderTypeEnum.java b/framework/src/main/java/cn/lili/modules/order/order/entity/enums/OrderTypeEnum.java index e670e523..8fba1a49 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/enums/OrderTypeEnum.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/enums/OrderTypeEnum.java @@ -13,17 +13,8 @@ public enum OrderTypeEnum { */ NORMAL, - /** - * 赠品订单 - */ - GIFT, - /** * 虚拟订单 */ - VIRTUAL, - /** - * 拼团订单 - */ - PINTUAN + VIRTUAL } diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java b/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java index 29a956e5..2e39d768 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java @@ -69,9 +69,10 @@ public class AllowOperation implements Serializable { //新订单,允许支付 this.pay = status.equals(OrderStatusEnum.UNPAID.name()) && payStatus.equals(PayStatusEnum.UNPAID.name()); - //订单未发货,就可以编辑收货人信息(实物订单) - this.editConsignee = order.getOrderType().equals(OrderTypeEnum.VIRTUAL.name()) && - order.getDeliverStatus().equals(DeliverStatusEnum.UNDELIVERED.name()) && !status.equals(OrderStatusEnum.CANCELLED.name()); + //可编辑订单收件人信息=实物订单 && 订单未发货 && 订单未取消 + this.editConsignee = order.getOrderType().equals(OrderTypeEnum.NORMAL.name()) + && order.getDeliverStatus().equals(DeliverStatusEnum.UNDELIVERED.name()) + && !status.equals(OrderStatusEnum.CANCELLED.name()); //是否允许被发货 this.ship = editConsignee && status.equals(OrderStatusEnum.UNDELIVERED.name()); From 23388eff6b21976428c114a2f850af76c88d7d74 Mon Sep 17 00:00:00 2001 From: Chopper Date: Wed, 30 Jun 2021 14:53:26 +0800 Subject: [PATCH 52/55] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/pom.xml | 2 +- buyer-api/pom.xml | 2 +- common-api/pom.xml | 2 +- config/application.yml | 8 ++++---- consumer/pom.xml | 2 +- framework/pom.xml | 2 +- manager-api/pom.xml | 2 +- pom.xml | 4 ++-- seller-api/pom.xml | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) 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..59b2d693 100644 --- a/buyer-api/pom.xml +++ b/buyer-api/pom.xml @@ -10,7 +10,7 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 diff --git a/common-api/pom.xml b/common-api/pom.xml index 4e5c7d8d..510c6865 100644 --- a/common-api/pom.xml +++ b/common-api/pom.xml @@ -7,7 +7,7 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 cn.lili 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..da93e1f6 100644 --- a/consumer/pom.xml +++ b/consumer/pom.xml @@ -8,7 +8,7 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 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/manager-api/pom.xml b/manager-api/pom.xml index bf583500..6aefa5f4 100644 --- a/manager-api/pom.xml +++ b/manager-api/pom.xml @@ -8,7 +8,7 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 diff --git a/pom.xml b/pom.xml index 44ab8a88..c40ec9a4 100644 --- a/pom.xml +++ b/pom.xml @@ -12,11 +12,11 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 registry.cn-beijing.aliyuncs.com/lili-images - 0.0.5 + 0.0.1 framework diff --git a/seller-api/pom.xml b/seller-api/pom.xml index 934079d4..946b6eb2 100644 --- a/seller-api/pom.xml +++ b/seller-api/pom.xml @@ -8,7 +8,7 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 From 1a77b3cec7f0291a7e26841e688dc58dee4cdcd6 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Wed, 30 Jun 2021 15:46:52 +0800 Subject: [PATCH 53/55] =?UTF-8?q?=E5=95=86=E5=93=81=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/lili/modules/goods/entity/dos/Goods.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 e4f8eefa..efa1b8af 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 @@ -234,15 +234,15 @@ 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()) || Double.parseDouble( sku.get("price").toString()) <= 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()) || Double.parseDouble( sku.get("cost").toString()) <= 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 (StringUtil.isEmpty(sku.get("weight").toString()) || Double.parseDouble(sku.get("weight").toString()) < 0) { throw new ServiceException(ResultCode.GOODS_SKU_WEIGHT_ERROR); } } From d7ce709ce6120ed877910843453e84b80f8d58d6 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Wed, 30 Jun 2021 16:29:19 +0800 Subject: [PATCH 54/55] =?UTF-8?q?=E4=BD=BF=E7=94=A8hutool=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=A0=BC=E5=BC=8F=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/lili/modules/goods/entity/dos/Goods.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 efa1b8af..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; @@ -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()) || Double.parseDouble( 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()) || Double.parseDouble( 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()) || Double.parseDouble(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); } From 079437100d440ac3e2b0dd68704067c6c0dc4a90 Mon Sep 17 00:00:00 2001 From: Chopper Date: Wed, 30 Jun 2021 19:59:36 +0800 Subject: [PATCH 55/55] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=A5=BD=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buyer-api/pom.xml | 2 +- common-api/pom.xml | 2 +- consumer/pom.xml | 2 +- manager-api/pom.xml | 2 +- seller-api/pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/buyer-api/pom.xml b/buyer-api/pom.xml index 59b2d693..22afda90 100644 --- a/buyer-api/pom.xml +++ b/buyer-api/pom.xml @@ -17,7 +17,7 @@ cn.lili framework - 1.0.1 + 4.2.0 diff --git a/common-api/pom.xml b/common-api/pom.xml index 510c6865..fe5a4ae7 100644 --- a/common-api/pom.xml +++ b/common-api/pom.xml @@ -17,7 +17,7 @@ cn.lili framework - 1.0.1 + 4.2.0 diff --git a/consumer/pom.xml b/consumer/pom.xml index da93e1f6..b9b34c24 100644 --- a/consumer/pom.xml +++ b/consumer/pom.xml @@ -15,7 +15,7 @@ cn.lili framework - 1.0.1 + 4.2.0 diff --git a/manager-api/pom.xml b/manager-api/pom.xml index 6aefa5f4..f896a62f 100644 --- a/manager-api/pom.xml +++ b/manager-api/pom.xml @@ -15,7 +15,7 @@ cn.lili framework - 1.0.1 + 4.2.0 diff --git a/seller-api/pom.xml b/seller-api/pom.xml index 946b6eb2..9efa6d45 100644 --- a/seller-api/pom.xml +++ b/seller-api/pom.xml @@ -15,7 +15,7 @@ cn.lili framework - 1.0.1 + 4.2.0