|
@@ -10,6 +10,7 @@ import com.fire.admin.mapper.FireProductMapper;
|
|
|
import com.fire.admin.request.ChannelPageParam;
|
|
|
import com.fire.admin.service.ChannelInfoService;
|
|
|
import com.fire.admin.service.ChannelProductService;
|
|
|
+import com.fire.admin.service.DistGroupChannelService;
|
|
|
import com.fire.admin.service.SupplierService;
|
|
|
import com.fire.admin.util.SecurityUtil;
|
|
|
import com.fire.common.exception.BaseException;
|
|
@@ -51,6 +52,9 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
|
|
|
@Resource
|
|
|
private ChannelProductService channelProductService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private DistGroupChannelService distGroupChannelService;
|
|
|
+
|
|
|
@Resource
|
|
|
private FireProductMapper fireProductMapper;
|
|
|
|
|
@@ -147,15 +151,21 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void deleteChannelAndChanProdByChannelId(Long channelId) {
|
|
|
+ public void deleteChannelAndChanProdAndChanMiddByChannelId(Long channelId) {
|
|
|
if (channelId != null) {
|
|
|
int channelResult = baseMapper.deleteById(channelId);
|
|
|
int channelProductResult = channelProductService.deleteChannelProductByChanId(channelId);
|
|
|
- if (channelResult > 0 || channelProductResult > 0) {
|
|
|
+ int channelMiddleResult = distGroupChannelService.removeChannelByChannelId(channelId);
|
|
|
+ if (channelResult > 0) {
|
|
|
rocketMQTemplate.send(UPDATE_TOPIC + ":" + SUPPLIER_TAG, MessageBuilder.withPayload(SUPPLIER_TAG).build());
|
|
|
log.info("编号为:【{}】的通道删除成功!", channelId);
|
|
|
+ }
|
|
|
+ if (channelProductResult > 0) {
|
|
|
log.info("通道编号为:【{}】的通道产品删除成功!", channelId);
|
|
|
}
|
|
|
+ if (channelMiddleResult > 0) {
|
|
|
+ log.info("通道编号为:【{}】的通道删除成功!", channelId);
|
|
|
+ }
|
|
|
} else {
|
|
|
throw new BaseException(Status.PARAM_LOSS.status(), Status.PARAM_LOSS.message());
|
|
|
}
|
|
@@ -169,11 +179,9 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
|
|
|
map.put("supplier_id", supplierId);
|
|
|
int result = baseMapper.deleteByMap(map);
|
|
|
if (result > 0) {
|
|
|
- rocketMQTemplate.send(UPDATE_TOPIC + ":" + SUPPLIER_TAG, MessageBuilder.withPayload(SUPPLIER_TAG).build());
|
|
|
return result;
|
|
|
- } else {
|
|
|
- return 0;
|
|
|
}
|
|
|
+ return 0;
|
|
|
} else {
|
|
|
throw new BaseException(Status.PARAM_LOSS.status(), Status.PARAM_LOSS.message());
|
|
|
}
|
|
@@ -187,10 +195,10 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
|
|
|
log.info("编号为【{}】的通道删除成功!", channelId);
|
|
|
return result;
|
|
|
}
|
|
|
+ return 0;
|
|
|
} else {
|
|
|
throw new BaseException(Status.PARAM_LOSS.status(), Status.PARAM_LOSS.message());
|
|
|
}
|
|
|
- return 0;
|
|
|
}
|
|
|
|
|
|
@Override
|