|
@@ -1,5 +1,6 @@
|
|
|
package com.fire.admin.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -8,7 +9,6 @@ import com.fire.admin.mapper.ChannelSupplierMapper;
|
|
|
import com.fire.admin.request.SupplierPageParam;
|
|
|
import com.fire.admin.service.BankCardService;
|
|
|
import com.fire.admin.service.SupplierService;
|
|
|
-import com.fire.admin.util.SecurityUtil;
|
|
|
import com.fire.common.exception.BaseException;
|
|
|
import com.fire.dto.ChannelSupplier;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -16,6 +16,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author: admin
|
|
@@ -39,20 +42,23 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
|
|
|
IPage<ChannelSupplier> supplierList = baseMapper.selectPage(supplierPageParam, lambdaQueryWrapper);
|
|
|
|
|
|
if (supplierList != null) {
|
|
|
-
|
|
|
for (ChannelSupplier supplier : supplierList.getRecords()) {
|
|
|
supplier.setBankCards(bankCardService.getBankCardList(supplier.getSupplierId()));
|
|
|
}
|
|
|
-
|
|
|
return supplierList;
|
|
|
} else {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<ChannelSupplier> getSupplierInfo() {
|
|
|
+ return baseMapper.selectList(null);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void updateSupplierBySupplierId(ChannelSupplier channelSupplier) {
|
|
|
- channelSupplier.setUpdator(SecurityUtil.getUser().getUsername());
|
|
|
+ channelSupplier.setUpdator("admin");
|
|
|
channelSupplier.setUpdateTime(new Date());
|
|
|
LambdaUpdateWrapper<ChannelSupplier> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
lambdaUpdateWrapper.eq(channelSupplier.getSupplierId() != null, ChannelSupplier::getSupplierId, channelSupplier.getSupplierId());
|
|
@@ -60,7 +66,7 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
|
|
|
if (result > 0) {
|
|
|
// TODO: 2021/5/18 向MQ推送消息
|
|
|
}
|
|
|
- if (channelSupplier.getBankCards() != null) {
|
|
|
+ if (ObjectUtil.isNotEmpty(channelSupplier.getBankCards())) {
|
|
|
bankCardService.saveBankCards(channelSupplier.getBankCards());
|
|
|
}
|
|
|
|
|
@@ -68,7 +74,7 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
|
|
|
|
|
|
@Override
|
|
|
public void saveSupplier(ChannelSupplier channelSupplier) {
|
|
|
- channelSupplier.setCreator(SecurityUtil.getUser().getUsername());
|
|
|
+ channelSupplier.setCreator("admin");
|
|
|
channelSupplier.setCreateTime(new Date());
|
|
|
int result = baseMapper.insert(channelSupplier);
|
|
|
if (result > 0) {
|
|
@@ -77,7 +83,7 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void deleteSupplierBySupplierId(Integer id) {
|
|
|
+ public void deleteSupplierById(Integer id) {
|
|
|
if (id != null) {
|
|
|
int result = baseMapper.deleteById(id);
|
|
|
if (result > 0) {
|
|
@@ -88,4 +94,18 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void deleteBankCardById(Integer bankId) {
|
|
|
+ if (bankId != null) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("id", bankId);
|
|
|
+ int result = baseMapper.deleteByMap(map);
|
|
|
+ if (result > 0) {
|
|
|
+ // TODO:2021/5/18 向MQ推送消息
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new BaseException("非法参数!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|