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
16 changed files with 91 additions and 21 deletions

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;