master:系统bug修复;

pull/1121/head
liujiang 2025-09-27 23:27:49 +08:00
parent 21fb4ae33c
commit e235a67cfe
9 changed files with 58 additions and 11 deletions

View File

@ -19,6 +19,8 @@ public class PCNewMidHotRightVO {
private Integer displayType;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "排序")
@ -28,4 +30,5 @@ public class PCNewMidHotRightVO {
@ApiModelProperty(value = "商品第一张主图路径")
private String mainPicUrl;
}

View File

@ -22,6 +22,8 @@ public class PCNewMidHotRightDTO {
private Integer displayType;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "排序")

View File

@ -38,5 +38,7 @@ public class NoticeResDTO {
private Integer perpetuity;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty(value = "创建人")
private String createBy;
}

View File

@ -158,6 +158,14 @@ public class NoticeServiceImpl implements INoticeService {
}
PageHelper.startPage(pageDTO.getPageNum(), pageDTO.getPageSize());
List<Notice> noticeList = this.noticeMapper.selectList(queryWrapper);
if (CollectionUtils.isNotEmpty(noticeList)) {
List<Long> userIdList = noticeList.stream().map(Notice::getUserId).collect(Collectors.toList());
List<SysUser> userList = this.userMapper.selectList(new LambdaQueryWrapper<SysUser>()
.in(SysUser::getUserId, userIdList).eq(SysUser::getDelFlag, Constants.UNDELETED));
Map<Long, SysUser> userMap = userList.stream().collect(Collectors.toMap(SysUser::getUserId, x -> x));
noticeList.forEach(x -> x.setCreateBy(userMap.containsKey(x.getUserId()) ?
userMap.get(x.getUserId()).getUserName() : ""));
}
return Page.convert(new PageInfo<>(noticeList), BeanUtil.copyToList(noticeList, NoticeResDTO.class));
}

View File

@ -57,14 +57,9 @@ public class StoreCustomerProductDiscountServiceImpl implements IStoreCustomerPr
if (!SecurityUtils.isAdmin() && !SecurityUtils.isStoreManagerOrSub(cusProdDisDTO.getStoreId())) {
throw new ServiceException("当前用户非档口管理者或子账号,无权限操作!", HttpStatus.ERROR);
}
List<StoreCustomer> storeCusList = this.storeCusMapper.selectList(new LambdaQueryWrapper<StoreCustomer>()
.eq(StoreCustomer::getStoreId, cusProdDisDTO.getStoreId()).eq(StoreCustomer::getDelFlag, Constants.UNDELETED)
.eq(StoreCustomer::getCusName, cusProdDisDTO.getStoreCusName()));
if (ObjectUtils.isNotEmpty(storeCusList) && storeCusList.size() > 1) {
throw new ServiceException("客户名称重复,请修改客户名称!", HttpStatus.ERROR);
}
// 若存在,则取第一个;若不存在,则新增
StoreCustomer storeCus = CollectionUtils.isNotEmpty(storeCusList) ? storeCusList.get(0) : this.createStoreCustomer(cusProdDisDTO);
StoreCustomer storeCus = Optional.ofNullable(this.storeCusMapper.selectOne(new LambdaQueryWrapper<StoreCustomer>()
.eq(StoreCustomer::getId, cusProdDisDTO.getStoreCusId()).eq(StoreCustomer::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("当前客户不存在!", HttpStatus.ERROR));
// 获取当前档口客户已有的优惠
List<StoreCustomerProductDiscount> cusProdDiscList = Optional.ofNullable(cusProdDiscMapper.selectList(new LambdaQueryWrapper<StoreCustomerProductDiscount>()
.eq(StoreCustomerProductDiscount::getStoreCusId, cusProdDisDTO.getStoreCusId()).eq(StoreCustomerProductDiscount::getDelFlag, Constants.UNDELETED)

View File

@ -78,6 +78,13 @@ public class StoreCustomerServiceImpl implements IStoreCustomerService {
throw new ServiceException("请输入正确的手机号!", HttpStatus.ERROR);
}
}
// 根据客户名称查询,不允许重复
List<StoreCustomer> storeCusList = this.storeCusMapper.selectList(new LambdaQueryWrapper<StoreCustomer>()
.eq(StoreCustomer::getStoreId, storeCusDTO.getStoreId()).eq(StoreCustomer::getDelFlag, Constants.UNDELETED)
.eq(StoreCustomer::getCusName, storeCusDTO.getCusName()));
if (CollectionUtils.isNotEmpty(storeCusList)) {
throw new ServiceException("客户名称已存在,请修改后重新提交!", HttpStatus.ERROR);
}
return this.storeCusMapper.insert(BeanUtil.toBean(storeCusDTO, StoreCustomer.class));
}
@ -136,11 +143,18 @@ public class StoreCustomerServiceImpl implements IStoreCustomerService {
throw new ServiceException("请输入正确的手机号!", HttpStatus.ERROR);
}
}
BeanUtil.copyProperties(storeCusDTO, storeCus);
// 如果名称变更了,则需要调整关联表中的客户名称
if (!Objects.equals(storeCusDTO.getCusName(), storeCus.getCusName())) {
// 判断客户名称是否已存在
List<StoreCustomer> storeCusList = this.storeCusMapper.selectList(new LambdaQueryWrapper<StoreCustomer>()
.eq(StoreCustomer::getStoreId, storeCus.getStoreId()).eq(StoreCustomer::getDelFlag, Constants.UNDELETED)
.eq(StoreCustomer::getCusName, storeCusDTO.getCusName()).ne(StoreCustomer::getId, storeCus.getId()));
if (CollectionUtils.isNotEmpty(storeCusList)) {
throw new ServiceException("客户名称已存在,请修改后重新提交!", HttpStatus.ERROR);
}
this.updateRelatedCusName(storeCusDTO.getCusName(), storeCus.getId(), storeCus.getStoreId());
}
BeanUtil.copyProperties(storeCusDTO, storeCus);
return storeCusMapper.updateById(storeCus);
}

View File

@ -15,12 +15,14 @@ import com.ruoyi.xkt.dto.storeFactory.StoreFactoryResDTO;
import com.ruoyi.xkt.mapper.StoreFactoryMapper;
import com.ruoyi.xkt.service.IStoreFactoryService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@ -44,6 +46,12 @@ public class StoreFactoryServiceImpl implements IStoreFactoryService {
@Override
@Transactional
public int insertStoreFactory(StoreFactoryDTO storeFactoryDTO) {
// 判断工厂名称是否已存在
List<StoreFactory> storeFacList = this.storeFactoryMapper.selectList(new LambdaQueryWrapper<StoreFactory>()
.eq(StoreFactory::getFacName, storeFactoryDTO.getFacName()).eq(StoreFactory::getDelFlag, Constants.UNDELETED));
if (CollectionUtils.isNotEmpty(storeFacList)) {
throw new ServiceException("工厂名称已存在,请修改后重新提交!", HttpStatus.ERROR);
}
StoreFactory storeFactory = BeanUtil.toBean(storeFactoryDTO, StoreFactory.class);
return storeFactoryMapper.insert(storeFactory);
}
@ -63,6 +71,15 @@ public class StoreFactoryServiceImpl implements IStoreFactoryService {
StoreFactory storeFactory = Optional.ofNullable(this.storeFactoryMapper.selectOne(new LambdaQueryWrapper<StoreFactory>()
.eq(StoreFactory::getId, storeFactoryDTO.getStoreFactoryId()).eq(StoreFactory::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("档口合作工厂不存在!", HttpStatus.ERROR));
// 如果修改了名称,则判断是否已存在
if (!Objects.equals(storeFactoryDTO.getFacName(), storeFactory.getFacName())) {
List<StoreFactory> storeFacList = this.storeFactoryMapper.selectList(new LambdaQueryWrapper<StoreFactory>()
.ne(StoreFactory::getId, storeFactoryDTO.getStoreFactoryId()).eq(StoreFactory::getFacName, storeFactoryDTO.getFacName())
.eq(StoreFactory::getDelFlag, Constants.UNDELETED));
if (CollectionUtils.isNotEmpty(storeFacList)) {
throw new ServiceException("工厂名称已存在,请修改后重新提交!", HttpStatus.ERROR);
}
}
BeanUtil.copyProperties(storeFactoryDTO, storeFactory);
return storeFactoryMapper.updateById(storeFactory);
}

View File

@ -1213,7 +1213,7 @@ public class WebsitePCServiceImpl implements IWebsitePCService {
newMidHotRightList = launchingList.stream().filter(x -> StringUtils.isNotBlank(x.getProdIdStr())).map(x -> {
final Long storeProdId = Long.parseLong(x.getProdIdStr());
return new PCNewMidHotRightDTO().setDisplayType(AdDisplayType.PRODUCT.getValue())
.setOrderNum(this.positionToNumber(x.getPosition())).setStoreProdId(storeProdId)
.setOrderNum(this.positionToNumber(x.getPosition())).setStoreProdId(storeProdId).setStoreId(x.getStoreId())
.setPrice(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMinPrice() : null)
.setProdArtNum(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getProdArtNum() : "")
.setMainPicUrl(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMainPicUrl() : "");
@ -1794,7 +1794,7 @@ public class WebsitePCServiceImpl implements IWebsitePCService {
.filter(x -> CollectionUtils.isEmpty(existProdIdList) || !existProdIdList.contains(Long.parseLong(x.getProdIdStr()))).findAny().orElse(null);
if (ObjectUtils.isNotEmpty(advertRound)) {
final Long storeProdId = Long.parseLong(advertRound.getProdIdStr());
tempList.add(new PCNewMidHotRightDTO().setDisplayType(AdDisplayType.PRODUCT.getValue()).setStoreProdId(storeProdId)
tempList.add(new PCNewMidHotRightDTO().setDisplayType(AdDisplayType.PRODUCT.getValue()).setStoreProdId(storeProdId).setStoreId(storeId)
.setPrice(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMinPrice() : null)
.setProdArtNum(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getProdArtNum() : "")
.setMainPicUrl(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMainPicUrl() : ""));

View File

@ -20,6 +20,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
JOIN store s ON uf.store_id = s.id
WHERE
uf.del_flag = 0 AND uf.user_id = #{userId}
<if test="statusList != null and statusList.size() > 0">
AND sp.prod_status IN
<foreach item="item" collection="statusList" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
<if test="storeName != null and storeName != ''"> AND s.store_name like concat('%', #{storeName}, '%')</if>
<if test="prodArtNum != null and prodArtNum != ''"> AND sp.prod_art_num like concat('%', #{prodArtNum}, '%')</if>
</select>