|
@@ -76,7 +76,7 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
|
|
public List<ChannelInfo> getChannelInfoByOperator(Integer operator) {
|
|
public List<ChannelInfo> getChannelInfoByOperator(Integer operator) {
|
|
if (operator != null) {
|
|
if (operator != null) {
|
|
LambdaQueryWrapper<ChannelInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<ChannelInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
- lambdaQueryWrapper.eq(ChannelInfo::getOperator,operator);
|
|
|
|
|
|
+ lambdaQueryWrapper.eq(ChannelInfo::getOperator, operator);
|
|
List<ChannelInfo> channelInfos = baseMapper.selectList(lambdaQueryWrapper);
|
|
List<ChannelInfo> channelInfos = baseMapper.selectList(lambdaQueryWrapper);
|
|
if (ObjectUtil.isNotEmpty(channelInfos)) {
|
|
if (ObjectUtil.isNotEmpty(channelInfos)) {
|
|
return channelInfos;
|
|
return channelInfos;
|
|
@@ -100,6 +100,7 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public void updateChannelInfoById(ChannelInfo channelInfo) {
|
|
public void updateChannelInfoById(ChannelInfo channelInfo) {
|
|
if (channelInfo != null) {
|
|
if (channelInfo != null) {
|
|
channelInfo.setUpdator(SecurityUtil.getUser().getUsername());
|
|
channelInfo.setUpdator(SecurityUtil.getUser().getUsername());
|
|
@@ -114,12 +115,13 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
|
|
log.info("添加的通道产品是:【{}】", channelInfo.getChannelProductInfos().toString());
|
|
log.info("添加的通道产品是:【{}】", channelInfo.getChannelProductInfos().toString());
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- throw new BaseException(Status.PARAM_ERROR.status(), Status.PARAM_ERROR.message());
|
|
|
|
|
|
+ throw new BaseException(Status.PARAM_LOSS.status(), Status.PARAM_LOSS.message());
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public void insertChannelInfo(ChannelInfo channelInfo) {
|
|
public void insertChannelInfo(ChannelInfo channelInfo) {
|
|
if (channelInfo != null) {
|
|
if (channelInfo != null) {
|
|
if (channelInfo.getChannelId() == null) {
|
|
if (channelInfo.getChannelId() == null) {
|
|
@@ -138,32 +140,11 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
|
|
log.info("添加的通道是:【{}】", channelInfo);
|
|
log.info("添加的通道是:【{}】", channelInfo);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- throw new BaseException(Status.PARAM_ERROR.status(), Status.PARAM_ERROR.message());
|
|
|
|
|
|
+ throw new BaseException(Status.PARAM_LOSS.status(), Status.PARAM_LOSS.message());
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public void saveOrUpdateChannelInfos(List<ChannelInfo> channelInfos) {
|
|
|
|
- if (ObjectUtil.isNotEmpty(channelInfos)) {
|
|
|
|
- for (ChannelInfo info : channelInfos) {
|
|
|
|
- if (info.getChannelId() == null) {
|
|
|
|
- info.setChannelId(jedisCluster.incr(GLOBAL_ID_INCR.key()));
|
|
|
|
- info.setCreator(SecurityUtil.getUser().getUsername());
|
|
|
|
- info.setCreateTime(new Date());
|
|
|
|
- log.info("添加的通道是:", channelInfos);
|
|
|
|
- } else {
|
|
|
|
- info.setUpdator(SecurityUtil.getUser().getUsername());
|
|
|
|
- info.setUpdateTime(new Date());
|
|
|
|
- log.info("修改的通道是:", channelInfos);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- this.saveOrUpdateBatch(channelInfos);
|
|
|
|
- } else {
|
|
|
|
- throw new BaseException(Status.PARAM_ERROR.status(), Status.PARAM_ERROR.message());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void deleteChannelAndChanProdByChannelId(Long channelId) {
|
|
public void deleteChannelAndChanProdByChannelId(Long channelId) {
|
|
@@ -176,11 +157,12 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
|
|
log.info("通道编号为:【{}】的通道产品删除成功!", channelId);
|
|
log.info("通道编号为:【{}】的通道产品删除成功!", channelId);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- throw new BaseException(Status.PARAM_ERROR.status(), Status.PARAM_ERROR.message());
|
|
|
|
|
|
+ throw new BaseException(Status.PARAM_LOSS.status(), Status.PARAM_LOSS.message());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public int deleteChannelBySupplierId(Long supplierId) {
|
|
public int deleteChannelBySupplierId(Long supplierId) {
|
|
if (supplierId != null) {
|
|
if (supplierId != null) {
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -193,7 +175,7 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- throw new BaseException(Status.PARAM_ERROR.status(), Status.PARAM_ERROR.message());
|
|
|
|
|
|
+ throw new BaseException(Status.PARAM_LOSS.status(), Status.PARAM_LOSS.message());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -206,23 +188,28 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- throw new BaseException(Status.PARAM_ERROR.status(), Status.PARAM_ERROR.message());
|
|
|
|
|
|
+ throw new BaseException(Status.PARAM_LOSS.status(), Status.PARAM_LOSS.message());
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public void setInvalid(Long channelId, Integer isValid) {
|
|
public void setInvalid(Long channelId, Integer isValid) {
|
|
- ChannelInfo channelInfo = ChannelInfo.builder().channelId(channelId)
|
|
|
|
- .isValid(isValid).build();
|
|
|
|
- int result = baseMapper.updateById(channelInfo);
|
|
|
|
- if (result > 0) {
|
|
|
|
- rocketMQTemplate.send(UPDATE_TOPIC + ":" + SUPPLIER_TAG, MessageBuilder.withPayload(SUPPLIER_TAG).build());
|
|
|
|
- if (channelInfo.getIsValid() == 0) {
|
|
|
|
- log.info("编号为【{}】的通道已置无效", channelId);
|
|
|
|
- } else {
|
|
|
|
- log.info("编号为【{}】的通道已置有效", channelId);
|
|
|
|
|
|
+ if (channelId != null && isValid != null) {
|
|
|
|
+ ChannelInfo channelInfo = ChannelInfo.builder().channelId(channelId)
|
|
|
|
+ .isValid(isValid).build();
|
|
|
|
+ int result = baseMapper.updateById(channelInfo);
|
|
|
|
+ if (result > 0) {
|
|
|
|
+ rocketMQTemplate.send(UPDATE_TOPIC + ":" + SUPPLIER_TAG, MessageBuilder.withPayload(SUPPLIER_TAG).build());
|
|
|
|
+ if (channelInfo.getIsValid() == 0) {
|
|
|
|
+ log.info("编号为【{}】的通道已置无效", channelId);
|
|
|
|
+ } else {
|
|
|
|
+ log.info("编号为【{}】的通道已置有效", channelId);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ throw new BaseException(Status.PARAM_LOSS.status(), Status.PARAM_LOSS.message());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|