diff --git a/README.md b/README.md index f058df13..41d30105 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ ##### 交流 qq 1群 961316482(已满) ##### 交流 qq 2群 875294241(已满) ##### 交流 qq 3群 263785057(已满) -##### 交流 qq 4群 674617534 +##### 交流 qq 4群 674617534 (已满) +##### 交流 qq 5群 594675235 ##### 体验 公众号/小程序/APP 体验,扫描二维码 @@ -164,8 +165,8 @@ PS:手机验证码为 ‘111111’ ##### 交流 qq 1群 961316482(已满) ##### 交流 qq 2群 875294241(已满) ##### 交流 qq 3群 263785057(已满) -##### 交流 qq 4群 674617534 - +##### 交流 qq 4群 674617534(已满) +##### 交流 qq 5群 594675235 ### 附录 有人有自己的学习视频、学习记录文档、希望宣传关联开源项目等均可以私聊仓库所有者。 diff --git a/framework/pom.xml b/framework/pom.xml index c14cf371..8e631d65 100644 --- a/framework/pom.xml +++ b/framework/pom.xml @@ -436,7 +436,7 @@ com.huaweicloud esdk-obs-java - ${huaweicloud.version} + ${huaweicloud-obs.version} com.qcloud 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 13de72db..d04690f5 100644 --- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java +++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java @@ -148,6 +148,7 @@ public enum ResultCode { CLERK_ALREADY_EXIT_ERROR(20030, "店员已经存在"), CLERK_DISABLED_ERROR(20031, "店员已禁用"), CLERK_CURRENT_SUPPER(20032, "无法删除当前登录店员"), + CANT_EDIT_CLERK_SHOPKEEPER(20033, "无法在店员管理编辑店员信息"), /** * 权限 */ diff --git a/framework/src/main/java/cn/lili/modules/distribution/entity/dos/Distribution.java b/framework/src/main/java/cn/lili/modules/distribution/entity/dos/Distribution.java index 3a24e867..96599e32 100644 --- a/framework/src/main/java/cn/lili/modules/distribution/entity/dos/Distribution.java +++ b/framework/src/main/java/cn/lili/modules/distribution/entity/dos/Distribution.java @@ -32,10 +32,11 @@ public class Distribution extends BaseEntity { public Distribution(String memberId, String memberName, DistributionApplyDTO distributionApplyDTO) { this.memberId = memberId; this.memberName = memberName; - distributionOrderCount=0; + this.distributionOrderCount=0; + this.rebateTotal=0D; + this.canRebate=0D; + this.commissionFrozen=0D; this.distributionStatus = DistributionStatusEnum.APPLY.name(); - commissionFrozen=0D; - canRebate=0D; BeanUtil.copyProperties(distributionApplyDTO, this); } 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 2068e1ed..d8ceab1c 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 @@ -19,8 +19,8 @@ public interface DistributionMapper extends BaseMapper { * @param commissionFrozen 分销金额 * @param distributionId 分销员ID */ - @Update("UPDATE li_distribution set commission_frozen = (commission_frozen+#{commissionFrozen}) " + - ", rebate_total=(rebate_total+#{commissionFrozen}) WHERE id = #{distributionId}") + @Update("UPDATE li_distribution set commission_frozen = (IFNULL(commission_frozen,0)+#{commissionFrozen}) " + + ", rebate_total=(IFNULL(rebate_total,0)+#{commissionFrozen}) WHERE id = #{distributionId}") void subCanRebate(Double commissionFrozen, String distributionId); /** @@ -29,9 +29,9 @@ public interface DistributionMapper extends BaseMapper { * @param commissionFrozen 分销金额 * @param distributionId 分销员ID */ - @Update("UPDATE li_distribution set commission_frozen = (commission_frozen+#{commissionFrozen}) " + - ", rebate_total=(rebate_total+#{commissionFrozen}) " + - ", distribution_order_count=(distribution_order_count+1) WHERE id = #{distributionId}") + @Update("UPDATE li_distribution set commission_frozen = (IFNULL(commission_frozen,0)+#{commissionFrozen}) " + + ", rebate_total=(IFNULL(rebate_total,0)+#{commissionFrozen}) " + + ", distribution_order_count=(IFNULL(distribution_order_count,0)+1) WHERE id = #{distributionId}") void addCanRebate(Double commissionFrozen, String distributionId); } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/file/plugin/impl/HuaweiFilePlugin.java b/framework/src/main/java/cn/lili/modules/file/plugin/impl/HuaweiFilePlugin.java index 62e2c64d..9e1fb32b 100644 --- a/framework/src/main/java/cn/lili/modules/file/plugin/impl/HuaweiFilePlugin.java +++ b/framework/src/main/java/cn/lili/modules/file/plugin/impl/HuaweiFilePlugin.java @@ -44,7 +44,7 @@ public class HuaweiFilePlugin implements FilePlugin { * @return */ private ObsClient getObsClient() { - return new ObsClient(ossSetting.getHuaweicloudOBSAccessKey(), ossSetting.getHuaweicloudOBSSecretKey(), ossSetting.getAliyunOSSEndPoint()); + return new ObsClient(ossSetting.getHuaweicloudOBSAccessKey(), ossSetting.getHuaweicloudOBSSecretKey(), ossSetting.getHuaweicloudOBSEndPoint()); } @@ -72,14 +72,17 @@ public class HuaweiFilePlugin implements FilePlugin { public String inputStreamUpload(InputStream inputStream, String key) { ObsClient obsClient = getObsClient(); try { - obsClient.putObject(new PutObjectRequest(ossSetting.getHuaweicloudOBSBucketName(), key, inputStream)); + PutObjectRequest putObjectRequest=new PutObjectRequest(ossSetting.getHuaweicloudOBSBucketName(), key, inputStream); + obsClient.putObject(putObjectRequest); } catch (ObsException obsException) { + obsException.printStackTrace(); throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR); } finally { try { // 关闭OBS连接 obsClient.close(); } catch (IOException e) { + e.printStackTrace(); log.error("OBS关闭连接报错!" + e.getMessage()); throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR); } 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 6f175250..029a66c9 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.collection.CollectionUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.http.HtmlUtil; @@ -219,7 +220,7 @@ public class Goods extends BaseEntity { this.mobileIntro = goodsDTO.getMobileIntro(); this.goodsVideo = goodsDTO.getGoodsVideo(); this.price = goodsDTO.getPrice(); - if (goodsDTO.getGoodsParamsDTOList() != null && goodsDTO.getGoodsParamsDTOList().isEmpty()) { + if (CollectionUtil.isNotEmpty(goodsDTO.getGoodsParamsDTOList())){ this.params = JSONUtil.toJsonStr(goodsDTO.getGoodsParamsDTOList()); } //如果立即上架则 diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsGalleryServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsGalleryServiceImpl.java index a6493be4..34b71e08 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsGalleryServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsGalleryServiceImpl.java @@ -10,7 +10,6 @@ import cn.lili.modules.system.entity.dto.GoodsSetting; import cn.lili.modules.system.entity.enums.SettingEnum; import cn.lili.modules.system.service.SettingService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -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; @@ -39,7 +38,7 @@ public class GoodsGalleryServiceImpl extends ServiceImpl goodsGalleryList, String goodsId) { //删除原来商品相册信息 - this.baseMapper.delete(new UpdateWrapper().eq("goods_id", goodsId)); + this.baseMapper.delete(new QueryWrapper().eq("goods_id", goodsId)); //确定好图片选择器后进行处理 int i = 0; for (String origin : goodsGalleryList) { @@ -83,6 +82,6 @@ public class GoodsGalleryServiceImpl extends ServiceImpl().eq("goods_id", goodsId)); + this.baseMapper.delete(new QueryWrapper().eq("goods_id", goodsId)); } } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/im/service/ImTalkService.java b/framework/src/main/java/cn/lili/modules/im/service/ImTalkService.java index 3b6f92ea..b648a393 100644 --- a/framework/src/main/java/cn/lili/modules/im/service/ImTalkService.java +++ b/framework/src/main/java/cn/lili/modules/im/service/ImTalkService.java @@ -21,6 +21,13 @@ public interface ImTalkService extends IService { */ ImTalk getTalkByUser(String userId1); + /** + * 获取与某人的聊天 + * @param userId + * @return + */ + ImTalkVO getTalkByUserId(String userId); + /** * 置顶消息 * diff --git a/framework/src/main/java/cn/lili/modules/im/serviceimpl/ImTalkServiceImpl.java b/framework/src/main/java/cn/lili/modules/im/serviceimpl/ImTalkServiceImpl.java index c03f4c01..b5a4b17f 100644 --- a/framework/src/main/java/cn/lili/modules/im/serviceimpl/ImTalkServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/im/serviceimpl/ImTalkServiceImpl.java @@ -88,6 +88,50 @@ public class ImTalkServiceImpl extends ServiceImpl impleme return imTalk; } + @Override + public ImTalkVO getTalkByUserId(String userId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser()); + //登录用户的Id + String selfId = ""; + //查看当前用户角色对Id进行赋值 + if(UserEnums.STORE.equals(currentUser.getRole())){ + selfId = currentUser.getStoreId(); + }else if(UserEnums.MEMBER.equals(currentUser.getRole())){ + selfId = currentUser.getId(); + } + //小数在前保证永远是同一个对话 + String finalSelfId = selfId; + queryWrapper.and(wq-> wq.eq(ImTalk::getUserId2, userId).eq(ImTalk::getUserId1, finalSelfId).or().eq(ImTalk::getUserId2, finalSelfId).eq(ImTalk::getUserId1, userId)); + ImTalk imTalk = this.getOne(queryWrapper); + //如果没有聊天,则创建聊天 + if (imTalk == null) { + //当自己为店铺时 + if(UserEnums.STORE.equals(currentUser.getRole())){ + Store selfStore = storeService.getById(selfId); + //没有这个用户信息 + Member other = memberService.getById(userId); + if(other == null){ + return null; + } + //自己为店铺其他人必定为用户 + imTalk = new ImTalk(other,selfStore); + }else if(UserEnums.MEMBER.equals(currentUser.getRole())){ + //没有这个店铺信息 + Member self = memberService.getById(selfId); + Member otherMember = memberService.getById(userId); + Store otherStore = storeService.getById(userId); + if(otherStore != null){ + imTalk = new ImTalk(self, otherStore); + }else if (otherMember != null){ + imTalk = new ImTalk(self, otherMember); + } + } + this.save(imTalk); + } + return new ImTalkVO(imTalk,currentUser.getId()); + } + /** * 发起聊天后,如果聊天不可见为true,则需要修正 * diff --git a/framework/src/main/java/cn/lili/modules/member/serviceimpl/ClerkServiceImpl.java b/framework/src/main/java/cn/lili/modules/member/serviceimpl/ClerkServiceImpl.java index 730890ac..00558f93 100644 --- a/framework/src/main/java/cn/lili/modules/member/serviceimpl/ClerkServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/member/serviceimpl/ClerkServiceImpl.java @@ -149,6 +149,11 @@ public class ClerkServiceImpl extends ServiceImpl implements public Clerk updateClerk(ClerkEditDTO clerkEditDTO) { Clerk clerk = this.getById(clerkEditDTO.getId()); if (clerk != null) { + //编辑店主限制 + if(clerk.getShopkeeper()){ + throw new ServiceException(ResultCode.CANT_EDIT_CLERK_SHOPKEEPER); + } + //校验当前店员是否是当前店铺的 if (!clerk.getStoreId().equals(UserContext.getCurrentUser().getStoreId())) { throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR); 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 9601eb25..13617a89 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 @@ -179,7 +179,7 @@ public class WechatPlugin implements Payment { try { Connect connect = connectService.queryConnect( - ConnectQueryDTO.builder().userId(UserContext.getCurrentUser().getId()).unionType(ConnectEnum.WECHAT.name()).build() + ConnectQueryDTO.builder().userId(UserContext.getCurrentUser().getId()).unionType(SourceEnum.WECHAT_OFFIACCOUNT_OPEN_ID.name()).build() ); if (connect == null) { return null; diff --git a/im-api/src/main/java/cn/lili/controller/im/ImTalkController.java b/im-api/src/main/java/cn/lili/controller/im/ImTalkController.java index 3ecbcd35..eee31a4a 100644 --- a/im-api/src/main/java/cn/lili/controller/im/ImTalkController.java +++ b/im-api/src/main/java/cn/lili/controller/im/ImTalkController.java @@ -46,7 +46,7 @@ public class ImTalkController { @GetMapping(value = "/by/user/{userId}") @ApiOperation(value = "查看与某人聊天详情") public ResultMessage getByUser(@PathVariable String userId) { - return ResultUtil.data(new ImTalkVO(imTalkService.getTalkByUser(userId),userId)); + return ResultUtil.data(imTalkService.getTalkByUserId(userId)); } @GetMapping(value = "/top") diff --git a/manager-api/src/main/java/cn/lili/controller/wechat/WechatMPMessageManagerController.java b/manager-api/src/main/java/cn/lili/controller/wechat/WechatMPMessageManagerController.java index df40f95a..2310bfdc 100644 --- a/manager-api/src/main/java/cn/lili/controller/wechat/WechatMPMessageManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/wechat/WechatMPMessageManagerController.java @@ -1,5 +1,6 @@ package cn.lili.controller.wechat; +import cn.lili.common.aop.annotation.DemoSite; import cn.lili.common.enums.ResultUtil; import cn.lili.common.vo.PageVO; import cn.lili.common.vo.ResultMessage; @@ -26,6 +27,7 @@ public class WechatMPMessageManagerController { @Autowired private WechatMPMessageService wechatMPMessageService; + @DemoSite @GetMapping(value = "/init") @ApiOperation(value = "初始化微信小程序消息订阅") public ResultMessage init() { @@ -50,6 +52,7 @@ public class WechatMPMessageManagerController { return new ResultUtil>().setData(data); } + @DemoSite @PostMapping @ApiOperation(value = "新增微信小程序消息订阅") public ResultMessage save(WechatMPMessage wechatMPMessage) { @@ -58,6 +61,7 @@ public class WechatMPMessageManagerController { return new ResultUtil().setData(wechatMPMessage); } + @DemoSite @PutMapping("/{id}") @ApiOperation(value = "更新微信小程序消息订阅") public ResultMessage update(@PathVariable String id, WechatMPMessage wechatMPMessage) { @@ -65,6 +69,7 @@ public class WechatMPMessageManagerController { return new ResultUtil().setData(wechatMPMessage); } + @DemoSite @DeleteMapping(value = "/{ids}") @ApiOperation(value = "删除微信小程序消息订阅") public ResultMessage delAllByIds(@PathVariable List ids) { diff --git a/manager-api/src/main/java/cn/lili/controller/wechat/WechatMessageManageController.java b/manager-api/src/main/java/cn/lili/controller/wechat/WechatMessageManageController.java index 3bac3257..d46f6070 100644 --- a/manager-api/src/main/java/cn/lili/controller/wechat/WechatMessageManageController.java +++ b/manager-api/src/main/java/cn/lili/controller/wechat/WechatMessageManageController.java @@ -53,6 +53,7 @@ public class WechatMessageManageController { return ResultUtil.data(data); } + @DemoSite @PostMapping @ApiOperation(value = "新增微信消息") public ResultMessage save(WechatMessage wechatMessage) { @@ -61,6 +62,7 @@ public class WechatMessageManageController { return ResultUtil.data(wechatMessage); } + @DemoSite @PutMapping("/{id}") @ApiOperation(value = "更新微信消息") public ResultMessage update(@PathVariable String id, WechatMessage wechatMessage) { @@ -68,6 +70,7 @@ public class WechatMessageManageController { return ResultUtil.data(wechatMessage); } + @DemoSite @DeleteMapping(value = "/{ids}") @ApiOperation(value = "删除微信消息") public ResultMessage delAllByIds(@PathVariable List ids) { diff --git a/pom.xml b/pom.xml index e4706366..29fcaf50 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ 2.3.1 20211018.2 8.0.3 - 3.21.8 + 3.20.6.2 5.6.97 3.1.693 1.0.11