From e8f44ef6f288c47be896085d5284cfe15df942e6 Mon Sep 17 00:00:00 2001 From: Chopper Date: Mon, 20 Dec 2021 09:37:34 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E7=BC=93=E5=AD=98key=E6=9C=AA=E5=8C=85=E5=90=ABuuid?= =?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/sms/impl/SmsUtilAliImplService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/sms/impl/SmsUtilAliImplService.java b/framework/src/main/java/cn/lili/modules/sms/impl/SmsUtilAliImplService.java index 505dd9b0..19e999b9 100644 --- a/framework/src/main/java/cn/lili/modules/sms/impl/SmsUtilAliImplService.java +++ b/framework/src/main/java/cn/lili/modules/sms/impl/SmsUtilAliImplService.java @@ -155,7 +155,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil { try { SendSmsResponse response = client.sendSms(sendSmsRequest); } catch (Exception e) { - log.error("发送短信错误",e); + log.error("发送短信错误", e); } } @@ -191,7 +191,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil { try { client.sendBatchSms(sendBatchSmsRequest); } catch (Exception e) { - log.error("批量发送短信错误",e); + log.error("批量发送短信错误", e); } } @@ -363,7 +363,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil { config.endpoint = "dysmsapi.aliyuncs.com"; return new com.aliyun.dysmsapi20170525.Client(config); } catch (Exception e) { - log.error("短信初始化错误",e); + log.error("短信初始化错误", e); } return null; } @@ -377,6 +377,6 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil { * @return */ static String cacheKey(VerificationEnums verificationEnums, String mobile, String uuid) { - return CachePrefix.SMS_CODE.getPrefix() + verificationEnums.name() + mobile; + return CachePrefix.SMS_CODE.getPrefix() + verificationEnums.name() + uuid + mobile; } } From 23b3e72579684948da2fee9778a9502b28cd7965 Mon Sep 17 00:00:00 2001 From: fengtianyangyang Date: Mon, 20 Dec 2021 14:56:17 +0800 Subject: [PATCH 2/9] =?UTF-8?q?'=E5=95=86=E5=93=81es=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E7=B4=A2=E5=BC=95=E9=97=AE=E9=A2=98'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/search/serviceimpl/EsGoodsIndexServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) 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 5937d0d3..351be83a 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 @@ -291,6 +291,9 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements @Override public void initIndex(List goodsIndexList) { if (goodsIndexList == null || goodsIndexList.isEmpty()) { + //初始化标识 + cache.put(CachePrefix.INIT_INDEX_PROCESS.getPrefix(), null); + cache.put(CachePrefix.INIT_INDEX_FLAG.getPrefix(), false); return; } //索引名称拼接 From 6cd31e630c007bafef44804f6e56caf0bb670c6a Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 21 Dec 2021 10:25:38 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8D=87=E7=BA=A7sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DB/li_promotions.sql | 38 ----------------------------------- DB/version4.2.3to4.2.4.sql | 41 +++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 39 deletions(-) delete mode 100644 DB/li_promotions.sql diff --git a/DB/li_promotions.sql b/DB/li_promotions.sql deleted file mode 100644 index 2e47e554..00000000 --- a/DB/li_promotions.sql +++ /dev/null @@ -1,38 +0,0 @@ - -ALTER TABLE li_coupon DROP COLUMN promotion_status; - -ALTER TABLE li_coupon_activity DROP COLUMN promotion_status; -ALTER TABLE li_coupon_activity ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '范围关联的ID'; -ALTER TABLE li_coupon_activity ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; - -ALTER TABLE li_full_discount DROP COLUMN promotion_status; -ALTER TABLE li_full_discount ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '范围关联的ID'; -ALTER TABLE li_full_discount ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; - -ALTER TABLE li_kanjia_activity_goods DROP COLUMN promotion_status; -ALTER TABLE li_kanjia_activity_goods ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '范围关联的ID'; -ALTER TABLE li_kanjia_activity_goods ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; -ALTER TABLE li_kanjia_activity_goods ADD `goods_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; - -ALTER TABLE li_pintuan DROP COLUMN promotion_status; -ALTER TABLE li_pintuan ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '范围关联的ID'; -ALTER TABLE li_pintuan ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; - -ALTER TABLE li_points_goods DROP COLUMN promotion_status; -ALTER TABLE li_points_goods ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '范围关联的ID'; -ALTER TABLE li_points_goods ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; -ALTER TABLE li_points_goods ADD `original_price` double(10,2) DEFAULT NULL COMMENT '原价'; -ALTER TABLE li_points_goods ADD `thumbnail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '缩略图'; -ALTER TABLE li_points_goods ADD `goods_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '商品编号'; -ALTER TABLE li_points_goods ADD `goods_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '货品名称'; - -ALTER TABLE li_promotion_goods DROP COLUMN promotion_status; -ALTER TABLE li_promotion_goods ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '范围关联的ID'; -ALTER TABLE li_promotion_goods ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; -ALTER TABLE li_promotion_goods ADD `original_price` double(10,2) DEFAULT NULL COMMENT '原价'; -ALTER TABLE li_promotion_goods ADD `points` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '兑换积分'; -ALTER TABLE li_promotion_goods ADD `goods_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '商品编号'; - -ALTER TABLE li_seckill DROP COLUMN promotion_status; -ALTER TABLE li_seckill ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '范围关联的ID'; -ALTER TABLE li_seckill ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; diff --git a/DB/version4.2.3to4.2.4.sql b/DB/version4.2.3to4.2.4.sql index 78764222..3c299b6c 100644 --- a/DB/version4.2.3to4.2.4.sql +++ b/DB/version4.2.3to4.2.4.sql @@ -1,2 +1,41 @@ /** 新增已退货数量 **/ -ALTER TABLE li_order_item ADD return_goods_number int DEFAULT 0 COMMENT '退货数量 '; \ No newline at end of file +ALTER TABLE li_order_item ADD return_goods_number int DEFAULT 0 COMMENT '退货数量 '; + + +ALTER TABLE li_coupon DROP COLUMN promotion_status; + +ALTER TABLE li_coupon_activity DROP COLUMN promotion_status; +ALTER TABLE li_coupon_activity ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '范围关联的ID'; +ALTER TABLE li_coupon_activity ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; + +ALTER TABLE li_full_discount DROP COLUMN promotion_status; +ALTER TABLE li_full_discount ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '范围关联的ID'; +ALTER TABLE li_full_discount ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; + +ALTER TABLE li_kanjia_activity_goods DROP COLUMN promotion_status; +ALTER TABLE li_kanjia_activity_goods ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '范围关联的ID'; +ALTER TABLE li_kanjia_activity_goods ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; +ALTER TABLE li_kanjia_activity_goods ADD `goods_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; + +ALTER TABLE li_pintuan DROP COLUMN promotion_status; +ALTER TABLE li_pintuan ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '范围关联的ID'; +ALTER TABLE li_pintuan ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; + +ALTER TABLE li_points_goods DROP COLUMN promotion_status; +ALTER TABLE li_points_goods ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '范围关联的ID'; +ALTER TABLE li_points_goods ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; +ALTER TABLE li_points_goods ADD `original_price` double(10,2) DEFAULT NULL COMMENT '原价'; +ALTER TABLE li_points_goods ADD `thumbnail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '缩略图'; +ALTER TABLE li_points_goods ADD `goods_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '商品编号'; +ALTER TABLE li_points_goods ADD `goods_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '货品名称'; + +ALTER TABLE li_promotion_goods DROP COLUMN promotion_status; +ALTER TABLE li_promotion_goods ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '范围关联的ID'; +ALTER TABLE li_promotion_goods ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; +ALTER TABLE li_promotion_goods ADD `original_price` double(10,2) DEFAULT NULL COMMENT '原价'; +ALTER TABLE li_promotion_goods ADD `points` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '兑换积分'; +ALTER TABLE li_promotion_goods ADD `goods_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '商品编号'; + +ALTER TABLE li_seckill DROP COLUMN promotion_status; +ALTER TABLE li_seckill ADD `scope_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '范围关联的ID'; +ALTER TABLE li_seckill ADD `scope_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'PORTION_GOODS' COMMENT '关联范围类型'; From 795440850b56e6d1f8a9b62c1aa9691f5920f020 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 21 Dec 2021 10:27:22 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=9B=B4=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DB/{version4.2.3to4.2.4.sql => version4.2.3toMASTER.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename DB/{version4.2.3to4.2.4.sql => version4.2.3toMASTER.sql} (100%) diff --git a/DB/version4.2.3to4.2.4.sql b/DB/version4.2.3toMASTER.sql similarity index 100% rename from DB/version4.2.3to4.2.4.sql rename to DB/version4.2.3toMASTER.sql From 82e773243f4216e4b4d741706a5f6d18f31a8ff2 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 21 Dec 2021 10:38:02 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0readme=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DB/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/DB/README.md b/DB/README.md index d65fbd1c..da94b706 100644 --- a/DB/README.md +++ b/DB/README.md @@ -1,3 +1,6 @@ ## PS:数据库位置 点击跳转 https://gitee.com/beijing_hongye_huicheng/docker/tree/master/init/mysql 这里有与tag版本一致的sql,根据tag获取sql,如果使用master代码,则需要在lilishop项目根目录的update-sql目录中,获取对应的升级sql。 + + +使用master分支代码时,可能会无法运行,执行完初始化sql之后需要执行当前目录下'versiontXXXXtoMASTER.sql'。 \ No newline at end of file From 7572e8d56f5b66c0820b8b7fd7cf99b943fad9e4 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 21 Dec 2021 11:33:55 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E5=95=86=E5=93=81sku=E5=8F=82=E6=95=B0=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E7=AD=89=E5=BC=82=E5=B8=B8=E6=83=85=E5=86=B5=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=8F=91=E5=B8=83=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/lili/modules/goods/entity/dos/Goods.java | 10 +++++----- 1 file changed, 5 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 dc8160e5..4619b76e 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 @@ -171,20 +171,20 @@ public class Goods extends BaseEntity { //循环sku,判定sku是否有效 for (Map sku : goodsOperationDTO.getSkuList()) { //判定参数不能为空 - if (sku.get("sn") == null) { + if (!sku.containsKey("sn") || sku.get("sn") == null) { throw new ServiceException(ResultCode.GOODS_SKU_SN_ERROR); } - if (StringUtil.isEmpty(sku.get("price").toString()) || Convert.toDouble(sku.get("price")) <= 0) { + if (!sku.containsKey("price") || 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()) || Convert.toDouble(sku.get("cost")) <= 0) { + if (!sku.containsKey("cost") || StringUtil.isEmpty(sku.get("cost").toString()) || Convert.toDouble(sku.get("cost")) <= 0) { throw new ServiceException(ResultCode.GOODS_SKU_COST_ERROR); } //虚拟商品没有重量字段 - if (sku.containsKey("weight") && (StringUtil.isEmpty(sku.get("weight").toString()) || Convert.toDouble(sku.get("weight").toString()) < 0)) { + if (!sku.containsKey("weight") || sku.containsKey("weight") && (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()) || Convert.toInt(sku.get("quantity").toString()) < 0) { + if (!sku.containsKey("quantity") || StringUtil.isEmpty(sku.get("quantity").toString()) || Convert.toInt(sku.get("quantity").toString()) < 0) { throw new ServiceException(ResultCode.GOODS_SKU_QUANTITY_ERROR); } From bfa960d80312dc99c22bfe9b246d267386b67286 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 21 Dec 2021 14:47:39 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=AB=AF=E5=95=86?= =?UTF-8?q?=E5=93=81=E4=B8=8A=E4=B8=8B=E6=9E=B6=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/goods/service/GoodsService.java | 9 +++ .../goods/serviceimpl/GoodsServiceImpl.java | 67 +++++++++++++++++-- .../goods/GoodsManagerController.java | 2 +- 3 files changed, 70 insertions(+), 8 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/goods/service/GoodsService.java b/framework/src/main/java/cn/lili/modules/goods/service/GoodsService.java index 09a0bd1b..24f5d6ad 100644 --- a/framework/src/main/java/cn/lili/modules/goods/service/GoodsService.java +++ b/framework/src/main/java/cn/lili/modules/goods/service/GoodsService.java @@ -103,6 +103,15 @@ public interface GoodsService extends IService { */ Boolean updateGoodsMarketAble(List goodsIds, GoodsStatusEnum goodsStatusEnum, String underReason); + /** + * 更新商品上架状态状态 + * + * @param goodsIds 商品ID集合 + * @param goodsStatusEnum 更新的商品状态 + * @param underReason 下架原因 + * @return 更新结果 + */ + Boolean managerUpdateGoodsMarketAble(List goodsIds, GoodsStatusEnum goodsStatusEnum, String underReason); /** * 删除商品 * 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 e8d63ee5..9b1b3d32 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 @@ -298,6 +298,34 @@ public class GoodsServiceImpl extends ServiceImpl implements return result; } + @Override + public Boolean managerUpdateGoodsMarketAble(List goodsIds, GoodsStatusEnum goodsStatusEnum, String underReason) { + boolean result; + + //如果商品为空,直接返回 + if (goodsIds == null || goodsIds.isEmpty()) { + return true; + } + + //检测管理员权限 + this.checkManagerAuthority(); + + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.set(Goods::getMarketEnable, goodsStatusEnum.name()); + updateWrapper.set(Goods::getUnderMessage, underReason); + updateWrapper.in(Goods::getId, goodsIds); + result = this.update(updateWrapper); + + //修改规格商品 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(Goods::getId, goodsIds); + List goodsList = this.list(queryWrapper); + for (Goods goods : goodsList) { + goodsSkuService.updateGoodsSkuStatus(goods); + } + return result; + } + @Override public Boolean deleteGoods(List goodsIds) { @@ -475,6 +503,20 @@ public class GoodsServiceImpl extends ServiceImpl implements return goods; } + + /** + * 获取UpdateWrapper(检查用户越权) + * + * @return updateWrapper + */ + private LambdaUpdateWrapper getUpdateWrapperByStoreAuthority() { + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + AuthUser authUser = this.checkStoreAuthority(); + updateWrapper.eq(Goods::getStoreId, authUser.getStoreId()); + return updateWrapper; + } + + /** * 检查当前登录的店铺 * @@ -490,17 +532,30 @@ public class GoodsServiceImpl extends ServiceImpl implements } } + /** + * 检查当前登录的店铺 + * + * @return 当前登录的店铺 + */ + private AuthUser checkManagerAuthority() { + AuthUser currentUser = UserContext.getCurrentUser(); + //如果当前会员不为空,且为店铺角色 + if (currentUser != null && (currentUser.getRole().equals(UserEnums.MANAGER))) { + return currentUser; + } else { + throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR); + } + } + /** * 获取UpdateWrapper(检查用户越权) * * @return updateWrapper */ - private LambdaUpdateWrapper getUpdateWrapperByStoreAuthority() { + private LambdaUpdateWrapper getUpdateWrapperByManagerAuthority() { LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); AuthUser authUser = this.checkStoreAuthority(); - if (authUser != null) { - updateWrapper.eq(Goods::getStoreId, authUser.getStoreId()); - } + updateWrapper.eq(Goods::getStoreId, authUser.getStoreId()); return updateWrapper; } @@ -512,9 +567,7 @@ public class GoodsServiceImpl extends ServiceImpl implements private LambdaQueryWrapper getQueryWrapperByStoreAuthority() { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); AuthUser authUser = this.checkStoreAuthority(); - if (authUser != null) { - queryWrapper.eq(Goods::getStoreId, authUser.getStoreId()); - } + queryWrapper.eq(Goods::getStoreId, authUser.getStoreId()); return queryWrapper; } diff --git a/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java index 8004783c..cdad8832 100644 --- a/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java @@ -73,7 +73,7 @@ public class GoodsManagerController { @PutMapping(value = "/{goodsId}/under") public ResultMessage underGoods(@PathVariable String goodsId, @NotEmpty(message = "下架原因不能为空") @RequestParam String reason) { List goodsIds = Arrays.asList(goodsId.split(",")); - if (Boolean.TRUE.equals(goodsService.updateGoodsMarketAble(goodsIds, GoodsStatusEnum.DOWN, reason))) { + if (Boolean.TRUE.equals(goodsService.managerUpdateGoodsMarketAble(goodsIds, GoodsStatusEnum.DOWN, reason))) { return ResultUtil.success(); } throw new ServiceException(ResultCode.GOODS_UNDER_ERROR); From 351745d31f11d9e40492d42012adcfa7678033d4 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 21 Dec 2021 16:08:24 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E4=BF=83=E9=94=80=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E5=86=99=E5=85=A5=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E4=BF=83=E9=94=80=E7=8A=B6=E6=80=81=E5=AD=97=E6=AE=B5=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 --- .../lili/modules/promotion/serviceimpl/PintuanServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PintuanServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PintuanServiceImpl.java index dfbcbc78..e5ca01cb 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PintuanServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PintuanServiceImpl.java @@ -243,7 +243,7 @@ public class PintuanServiceImpl extends AbstractPromotionsServiceImpl Date: Tue, 21 Dec 2021 16:59:57 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E9=9D=9E=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/lili/modules/system/token/ManagerTokenGenerate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/main/java/cn/lili/modules/system/token/ManagerTokenGenerate.java b/framework/src/main/java/cn/lili/modules/system/token/ManagerTokenGenerate.java index aa9ec8e3..c58dbbc9 100644 --- a/framework/src/main/java/cn/lili/modules/system/token/ManagerTokenGenerate.java +++ b/framework/src/main/java/cn/lili/modules/system/token/ManagerTokenGenerate.java @@ -74,7 +74,7 @@ public class ManagerTokenGenerate extends AbstractTokenGenerate { initPermission(superPermissions, queryPermissions); //循环权限菜单 - if (userMenuVOList == null || userMenuVOList.isEmpty()) { + if (userMenuVOList != null) { userMenuVOList.forEach(menu -> { //循环菜单,赋予用户权限 if (StrUtil.isNotEmpty(menu.getPermission())) {