Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop into pg

This commit is contained in:
misworga831 2023-03-21 14:39:57 +08:00
commit 4abf2205c1
16 changed files with 91 additions and 21 deletions

View File

@ -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
### 附录
有人有自己的学习视频、学习记录文档、希望宣传关联开源项目等均可以私聊仓库所有者。

View File

@ -436,7 +436,7 @@
<dependency>
<groupId>com.huaweicloud</groupId>
<artifactId>esdk-obs-java</artifactId>
<version>${huaweicloud.version}</version>
<version>${huaweicloud-obs.version}</version>
</dependency>
<dependency>
<groupId>com.qcloud</groupId>

View File

@ -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, "无法在店员管理编辑店员信息"),
/**
* 权限
*/

View File

@ -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);
}

View File

@ -19,8 +19,8 @@ public interface DistributionMapper extends BaseMapper<Distribution> {
* @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<Distribution> {
* @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);
}

View File

@ -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);
}

View File

@ -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());
}
//如果立即上架则

View File

@ -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<GoodsGalleryMapper, Goo
@Transactional(rollbackFor = Exception.class)
public void add(List<String> goodsGalleryList, String goodsId) {
//删除原来商品相册信息
this.baseMapper.delete(new UpdateWrapper<GoodsGallery>().eq("goods_id", goodsId));
this.baseMapper.delete(new QueryWrapper<GoodsGallery>().eq("goods_id", goodsId));
//确定好图片选择器后进行处理
int i = 0;
for (String origin : goodsGalleryList) {
@ -83,6 +82,6 @@ public class GoodsGalleryServiceImpl extends ServiceImpl<GoodsGalleryMapper, Goo
*/
@Override
public void removeByGoodsId(String goodsId) {
this.baseMapper.delete(new UpdateWrapper<GoodsGallery>().eq("goods_id", goodsId));
this.baseMapper.delete(new QueryWrapper<GoodsGallery>().eq("goods_id", goodsId));
}
}

View File

@ -21,6 +21,13 @@ public interface ImTalkService extends IService<ImTalk> {
*/
ImTalk getTalkByUser(String userId1);
/**
* 获取与某人的聊天
* @param userId
* @return
*/
ImTalkVO getTalkByUserId(String userId);
/**
* 置顶消息
*

View File

@ -88,6 +88,50 @@ public class ImTalkServiceImpl extends ServiceImpl<ImTalkMapper, ImTalk> impleme
return imTalk;
}
@Override
public ImTalkVO getTalkByUserId(String userId) {
LambdaQueryWrapper<ImTalk> 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则需要修正
*

View File

@ -149,6 +149,11 @@ public class ClerkServiceImpl extends ServiceImpl<ClerkMapper, Clerk> 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);

View File

@ -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;

View File

@ -46,7 +46,7 @@ public class ImTalkController {
@GetMapping(value = "/by/user/{userId}")
@ApiOperation(value = "查看与某人聊天详情")
public ResultMessage<ImTalkVO> getByUser(@PathVariable String userId) {
return ResultUtil.data(new ImTalkVO(imTalkService.getTalkByUser(userId),userId));
return ResultUtil.data(imTalkService.getTalkByUserId(userId));
}
@GetMapping(value = "/top")

View File

@ -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<IPage<WechatMPMessage>>().setData(data);
}
@DemoSite
@PostMapping
@ApiOperation(value = "新增微信小程序消息订阅")
public ResultMessage<WechatMPMessage> save(WechatMPMessage wechatMPMessage) {
@ -58,6 +61,7 @@ public class WechatMPMessageManagerController {
return new ResultUtil<WechatMPMessage>().setData(wechatMPMessage);
}
@DemoSite
@PutMapping("/{id}")
@ApiOperation(value = "更新微信小程序消息订阅")
public ResultMessage<WechatMPMessage> update(@PathVariable String id, WechatMPMessage wechatMPMessage) {
@ -65,6 +69,7 @@ public class WechatMPMessageManagerController {
return new ResultUtil<WechatMPMessage>().setData(wechatMPMessage);
}
@DemoSite
@DeleteMapping(value = "/{ids}")
@ApiOperation(value = "删除微信小程序消息订阅")
public ResultMessage<Object> delAllByIds(@PathVariable List ids) {

View File

@ -53,6 +53,7 @@ public class WechatMessageManageController {
return ResultUtil.data(data);
}
@DemoSite
@PostMapping
@ApiOperation(value = "新增微信消息")
public ResultMessage<WechatMessage> save(WechatMessage wechatMessage) {
@ -61,6 +62,7 @@ public class WechatMessageManageController {
return ResultUtil.data(wechatMessage);
}
@DemoSite
@PutMapping("/{id}")
@ApiOperation(value = "更新微信消息")
public ResultMessage<WechatMessage> 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<Object> delAllByIds(@PathVariable List ids) {

View File

@ -61,7 +61,7 @@
<spring-boot-admin>2.3.1</spring-boot-admin>
<owasp-java-html-sanitizer>20211018.2</owasp-java-html-sanitizer>
<minio.version>8.0.3</minio.version>
<huaweicloud.version>3.21.8</huaweicloud.version>
<huaweicloud-obs.version>3.20.6.2</huaweicloud-obs.version>
<cos.version>5.6.97</cos.version>
<tencentcloud.version>3.1.693</tencentcloud.version>
<kuaidi100-api.version>1.0.11</kuaidi100-api.version>