|
|
@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.basic.service.businessinfo.BusinessInfoServiceImp
|
|
|
|
import cn.iocoder.yudao.module.product.api.harvestbatch.HarvestBatchApi;
|
|
|
|
import cn.iocoder.yudao.module.product.api.harvestbatch.HarvestBatchApi;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@ -88,6 +89,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
|
|
|
|
* @param updateReqVO 更新信息
|
|
|
|
* @param updateReqVO 更新信息
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = {Exception.class, RuntimeException.class})
|
|
|
|
public void updateGoodsInfo(GoodsInfoUpdateReqVO updateReqVO) {
|
|
|
|
public void updateGoodsInfo(GoodsInfoUpdateReqVO updateReqVO) {
|
|
|
|
//校验所属商户是否存在
|
|
|
|
//校验所属商户是否存在
|
|
|
|
businessInfoService.validateBusinessInfoExists(updateReqVO.getBelongBusinessId());
|
|
|
|
businessInfoService.validateBusinessInfoExists(updateReqVO.getBelongBusinessId());
|
|
|
@ -101,6 +103,14 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
|
|
|
|
//商品名称发生变化,进行唯一校验
|
|
|
|
//商品名称发生变化,进行唯一校验
|
|
|
|
validateGoodsNameExists(updateReqVO.getGoodsName());
|
|
|
|
validateGoodsNameExists(updateReqVO.getGoodsName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//检查商品所属商户是否发生变化
|
|
|
|
|
|
|
|
if (!Objects.equals(originalGoodsInfo.getBelongBusinessId(), updateReqVO.getBelongBusinessId())) {
|
|
|
|
|
|
|
|
//商品所属商户发生变化,删除原所属商户关联的经销商所绑定的该商品(经销商品)
|
|
|
|
|
|
|
|
dealerGoodsMapper.delete(new QueryWrapperX<DealerGoodsDO>()
|
|
|
|
|
|
|
|
.eq("goods_id", originalGoodsInfo.getGoodsId())
|
|
|
|
|
|
|
|
.eq("belong_business_id", originalGoodsInfo.getBelongBusinessId())
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
// 更新记录
|
|
|
|
// 更新记录
|
|
|
|
GoodsInfoDO newGoodsInfo = GoodsInfoConvert.INSTANCE.convert(updateReqVO);
|
|
|
|
GoodsInfoDO newGoodsInfo = GoodsInfoConvert.INSTANCE.convert(updateReqVO);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|