|
@@ -11,6 +11,7 @@ import com.fire.admin.service.BankCardService;
|
|
|
import com.fire.admin.service.SupplierService;
|
|
|
import com.fire.common.exception.BaseException;
|
|
|
import com.fire.dto.ChannelSupplier;
|
|
|
+import com.fire.dto.enums.Status;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -38,13 +39,12 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
|
|
|
LambdaQueryWrapper<ChannelSupplier> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
lambdaQueryWrapper.
|
|
|
like(supplierPageParam.getSupplierName() != null, ChannelSupplier::getSupplierName, supplierPageParam.getSupplierName())
|
|
|
- .eq(ChannelSupplier::getIsDelete, 0)
|
|
|
.orderByDesc(ChannelSupplier::getBalance, ChannelSupplier::getIsValid);
|
|
|
IPage<ChannelSupplier> supplierList = baseMapper.selectPage(supplierPageParam, lambdaQueryWrapper);
|
|
|
|
|
|
if (supplierList != null) {
|
|
|
for (ChannelSupplier supplier : supplierList.getRecords()) {
|
|
|
- supplier.setBankCards(bankCardService.getBankCardList(supplier.getSupplierId(),1));
|
|
|
+ supplier.setBankCards(bankCardService.getBankCardList(supplier.getSupplierId(), 1));
|
|
|
}
|
|
|
return supplierList;
|
|
|
} else {
|
|
@@ -66,13 +66,14 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
|
|
|
LambdaUpdateWrapper<ChannelSupplier> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
lambdaUpdateWrapper.eq(channelSupplier.getSupplierId() != null, ChannelSupplier::getSupplierId, channelSupplier.getSupplierId());
|
|
|
int result = baseMapper.update(channelSupplier, lambdaUpdateWrapper);
|
|
|
+ log.info("供应商已修改为:【{}】", channelSupplier);
|
|
|
if (result > 0) {
|
|
|
// TODO: 2021/5/18 向MQ推送消息
|
|
|
}
|
|
|
if (ObjectUtil.isNotEmpty(channelSupplier.getBankCards())) {
|
|
|
- // TODO 把通道编号写入添加的银行里面
|
|
|
- channelSupplier.getBankCards().forEach(c->{
|
|
|
- c.setRelationId(channelSupplier.getSupplierId());
|
|
|
+ // TODO 把供应商编号写入添加的银行里面
|
|
|
+ channelSupplier.getBankCards().forEach(bankCard -> {
|
|
|
+ bankCard.setRelationId(channelSupplier.getSupplierId());
|
|
|
});
|
|
|
|
|
|
bankCardService.saveBankCards(channelSupplier.getBankCards());
|
|
@@ -85,6 +86,7 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
|
|
|
channelSupplier.setCreator("admin");
|
|
|
channelSupplier.setCreateTime(new Date());
|
|
|
int result = baseMapper.insert(channelSupplier);
|
|
|
+ log.info("添加的供应商是:【{}】", channelSupplier);
|
|
|
if (result > 0) {
|
|
|
// TODO:2021/5/18 向MQ推送消息
|
|
|
}
|
|
@@ -94,11 +96,12 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
|
|
|
public void deleteSupplierById(Integer id) {
|
|
|
if (id != null) {
|
|
|
int result = baseMapper.deleteById(id);
|
|
|
+ log.info("编号为:【{}】的供应商删除成功!", id);
|
|
|
if (result > 0) {
|
|
|
// TODO:2021/5/18 向MQ推送消息
|
|
|
}
|
|
|
} else {
|
|
|
- throw new BaseException("非法参数!");
|
|
|
+ throw new BaseException(Status.REQUEST_PARAM_ERROR.status(),Status.REQUEST_PARAM_ERROR.message());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -112,7 +115,7 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
|
|
|
// TODO:2021/5/18 向MQ推送消息
|
|
|
}
|
|
|
} else {
|
|
|
- throw new BaseException("非法参数!");
|
|
|
+ throw new BaseException(Status.REQUEST_PARAM_ERROR.status(),Status.REQUEST_PARAM_ERROR.message());
|
|
|
}
|
|
|
}
|
|
|
|