|
|
@ -36,6 +36,7 @@ import com.yxt.common.core.vo.PagerVo; |
|
|
|
import com.yxt.supervise.customer.api.purchaserequisition.PurchaseRequisition; |
|
|
|
import com.yxt.supervise.customer.api.supplierbankinfo.*; |
|
|
|
import com.yxt.supervise.customer.api.suppliercontractinfo.SupplierContractInfoDto; |
|
|
|
import com.yxt.supervise.customer.api.supplierindex.SupplierIndex; |
|
|
|
import com.yxt.supervise.customer.api.supplierindex.SupplierIndexQuery; |
|
|
|
import com.yxt.supervise.customer.biz.purchaserequisition.PurchaseRequisitionService; |
|
|
|
import com.yxt.supervise.customer.biz.suppliercontractinfo.SupplierContractInfoService; |
|
|
@ -62,200 +63,212 @@ import java.util.*; |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class SupplierBankInfoService extends MybatisBaseService<SupplierBankInfoMapper, SupplierBankInfo> { |
|
|
|
@Resource |
|
|
|
private SupplierContractInfoService supplierContractInfoService; |
|
|
|
@Resource |
|
|
|
private SupplierIndexService supplierIndexService; |
|
|
|
@Resource |
|
|
|
private SupplierContractInfoService supplierContractInfoService; |
|
|
|
@Resource |
|
|
|
private SupplierIndexService supplierIndexService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private PurchaseRequisitionService purchaseRequisitionService; |
|
|
|
@Autowired |
|
|
|
private PurchaseRequisitionService purchaseRequisitionService; |
|
|
|
|
|
|
|
private QueryWrapper<SupplierBankInfo> createQueryWrapper(SupplierBankInfoQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
|
QueryWrapper<SupplierBankInfo> qw = new QueryWrapper<>(); |
|
|
|
private QueryWrapper<SupplierBankInfo> createQueryWrapper(SupplierBankInfoQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
|
QueryWrapper<SupplierBankInfo> qw = new QueryWrapper<>(); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getCodeUnified())) { |
|
|
|
qw.like("codeUnified", query.getCodeUnified()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getName())) { |
|
|
|
qw.like("name", query.getName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getContacts())) { |
|
|
|
qw.like("contacts", query.getContacts()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getLegalRepresentative())) { |
|
|
|
qw.like("legalRepresentative", query.getLegalRepresentative()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getBusinessLicenseNo())) { |
|
|
|
qw.like("businessLicenseNo", query.getBusinessLicenseNo()); |
|
|
|
}if (StringUtils.isNotBlank(query.getBankAccountNumber())) { |
|
|
|
qw.like("bankAccountNumber", query.getBankAccountNumber()); |
|
|
|
} |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<SupplierBankInfoVo> listPageVo(PagerQuery<SupplierBankInfoQuery> pq) { |
|
|
|
SupplierBankInfoQuery query = pq.getParams(); |
|
|
|
QueryWrapper<SupplierBankInfo> qw = createQueryWrapper(query); |
|
|
|
SupplierBankInfoQuery params = pq.getParams(); |
|
|
|
String name = params.getName(); |
|
|
|
if(StringUtils.isNotBlank(name)){ |
|
|
|
qw.like("i.name",name); |
|
|
|
} |
|
|
|
IPage<SupplierBankInfo> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<SupplierBankInfoVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<SupplierBankInfoVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public void saveOrUpdateDto(SupplierBankInfoDto dto){ |
|
|
|
if (StringUtils.isNotBlank(query.getCodeUnified())) { |
|
|
|
qw.like("codeUnified", query.getCodeUnified()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getName())) { |
|
|
|
qw.like("name", query.getName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getContacts())) { |
|
|
|
qw.like("contacts", query.getContacts()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getLegalRepresentative())) { |
|
|
|
qw.like("legalRepresentative", query.getLegalRepresentative()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getBusinessLicenseNo())) { |
|
|
|
qw.like("businessLicenseNo", query.getBusinessLicenseNo()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getBankAccountNumber())) { |
|
|
|
qw.like("bankAccountNumber", query.getBankAccountNumber()); |
|
|
|
} |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<SupplierBankInfoVo> listPageVo(PagerQuery<SupplierBankInfoQuery> pq) { |
|
|
|
SupplierBankInfoQuery query = pq.getParams(); |
|
|
|
QueryWrapper<SupplierBankInfo> qw = createQueryWrapper(query); |
|
|
|
SupplierBankInfoQuery params = pq.getParams(); |
|
|
|
String name = params.getName(); |
|
|
|
if (StringUtils.isNotBlank(name)) { |
|
|
|
qw.like("i.name", name); |
|
|
|
} |
|
|
|
IPage<SupplierBankInfo> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<SupplierBankInfoVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<SupplierBankInfoVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public void saveOrUpdateDto(SupplierBankInfoDto dto) { |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
this.insertByDto(dto); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.updateByDto(dto); |
|
|
|
} |
|
|
|
|
|
|
|
public void insertByDto(SupplierBankInfoDto dto){ |
|
|
|
SupplierBankInfo entity = new SupplierBankInfo(); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
baseMapper.insert(entity); |
|
|
|
List<String> codeIndex = dto.getCodeIndex(); |
|
|
|
baseMapper.insertSUpplierIndex(entity.getName(),entity.getCodeUnified(),entity.getSid(),entity.getCodeUnified()); |
|
|
|
for (String index : codeIndex) { |
|
|
|
if (!index.equals(entity.getCodeUnified())){ |
|
|
|
baseMapper.insertSUpplierIndex(entity.getName(),entity.getCodeUnified(),entity.getSid(),index); |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.deleteSupplierFiles(entity.getSid(),"1"); |
|
|
|
String[] businessLicenseFiles = dto.getBusinessLicenseFiles(); |
|
|
|
if(businessLicenseFiles!=null){ |
|
|
|
List<Map<String,String>> maps=new ArrayList<>(); |
|
|
|
for(String s:businessLicenseFiles){ |
|
|
|
Map<String,String>m=new HashMap<>(); |
|
|
|
m.put("mainSid",entity.getSid()); |
|
|
|
m.put("url",s); |
|
|
|
m.put("type","1"); |
|
|
|
m.put("sid", UUID.randomUUID().toString()); |
|
|
|
maps.add(m); |
|
|
|
} |
|
|
|
if(maps.size()>0){ |
|
|
|
baseMapper.insertSupplierFiles(maps); |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.deleteSupplierFiles(entity.getSid(),"2"); |
|
|
|
String[] contractFiles = dto.getContractInfo().getContractFiles(); |
|
|
|
if(contractFiles!=null){ |
|
|
|
List<Map<String,String>> maps=new ArrayList<>(); |
|
|
|
for(String s:contractFiles){ |
|
|
|
Map<String,String>m=new HashMap<>(); |
|
|
|
m.put("mainSid",entity.getSid()); |
|
|
|
m.put("url",s); |
|
|
|
m.put("type","2"); |
|
|
|
m.put("sid", UUID.randomUUID().toString()); |
|
|
|
maps.add(m); |
|
|
|
} |
|
|
|
if(maps.size()>0){ |
|
|
|
baseMapper.insertSupplierFiles(maps); |
|
|
|
} |
|
|
|
} |
|
|
|
SupplierContractInfoDto supplierContractInfoDto = dto.getContractInfo(); |
|
|
|
supplierContractInfoDto.setSupplierSid(entity.getSid()); |
|
|
|
supplierContractInfoService.saveOrUpdateDto(supplierContractInfoDto); |
|
|
|
} |
|
|
|
|
|
|
|
public void updateByDto(SupplierBankInfoDto dto){ |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.updateByDto(dto); |
|
|
|
} |
|
|
|
|
|
|
|
public void insertByDto(SupplierBankInfoDto dto) { |
|
|
|
SupplierBankInfo entity = new SupplierBankInfo(); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
baseMapper.insert(entity); |
|
|
|
List<String> codeIndex = dto.getCodeIndex(); |
|
|
|
baseMapper.insertSUpplierIndex(entity.getName(), entity.getCodeUnified(), entity.getSid(), entity.getCodeUnified()); |
|
|
|
for (String index : codeIndex) { |
|
|
|
if (!index.equals(entity.getCodeUnified())) { |
|
|
|
baseMapper.insertSUpplierIndex(entity.getName(), entity.getCodeUnified(), entity.getSid(), index); |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.deleteSupplierFiles(entity.getSid(), "1"); |
|
|
|
String[] businessLicenseFiles = dto.getBusinessLicenseFiles(); |
|
|
|
if (businessLicenseFiles != null) { |
|
|
|
List<Map<String, String>> maps = new ArrayList<>(); |
|
|
|
for (String s : businessLicenseFiles) { |
|
|
|
Map<String, String> m = new HashMap<>(); |
|
|
|
m.put("mainSid", entity.getSid()); |
|
|
|
m.put("url", s); |
|
|
|
m.put("type", "1"); |
|
|
|
m.put("sid", UUID.randomUUID().toString()); |
|
|
|
maps.add(m); |
|
|
|
} |
|
|
|
if (maps.size() > 0) { |
|
|
|
baseMapper.insertSupplierFiles(maps); |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.deleteSupplierFiles(entity.getSid(), "2"); |
|
|
|
String[] contractFiles = dto.getContractInfo().getContractFiles(); |
|
|
|
if (contractFiles != null) { |
|
|
|
List<Map<String, String>> maps = new ArrayList<>(); |
|
|
|
for (String s : contractFiles) { |
|
|
|
Map<String, String> m = new HashMap<>(); |
|
|
|
m.put("mainSid", entity.getSid()); |
|
|
|
m.put("url", s); |
|
|
|
m.put("type", "2"); |
|
|
|
m.put("sid", UUID.randomUUID().toString()); |
|
|
|
maps.add(m); |
|
|
|
} |
|
|
|
if (maps.size() > 0) { |
|
|
|
baseMapper.insertSupplierFiles(maps); |
|
|
|
} |
|
|
|
} |
|
|
|
SupplierContractInfoDto supplierContractInfoDto = dto.getContractInfo(); |
|
|
|
supplierContractInfoDto.setSupplierSid(entity.getSid()); |
|
|
|
supplierContractInfoService.saveOrUpdateDto(supplierContractInfoDto); |
|
|
|
} |
|
|
|
|
|
|
|
public void updateByDto(SupplierBankInfoDto dto) { |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
SupplierBankInfo entity = baseMapper.selectBySid(dtoSid); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
supplierIndexService.delByMainSid(dtoSid); |
|
|
|
List<String> codeIndex = dto.getCodeIndex(); |
|
|
|
baseMapper.insertSUpplierIndex(entity.getName(),entity.getCodeUnified(),dtoSid,entity.getCodeUnified()); |
|
|
|
for (String index : codeIndex) { |
|
|
|
if (!index.equals(entity.getCodeUnified())){ |
|
|
|
baseMapper.insertSUpplierIndex(entity.getName(),entity.getCodeUnified(),entity.getSid(),index); |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.deleteSupplierFiles(entity.getSid(),"1"); |
|
|
|
String[] businessLicenseFiles = dto.getBusinessLicenseFiles(); |
|
|
|
if(businessLicenseFiles!=null){ |
|
|
|
List<Map<String,String>> maps=new ArrayList<>(); |
|
|
|
for(String s:businessLicenseFiles){ |
|
|
|
Map<String,String>m=new HashMap<>(); |
|
|
|
m.put("mainSid",entity.getSid()); |
|
|
|
m.put("url",s); |
|
|
|
m.put("type","1"); |
|
|
|
m.put("sid", UUID.randomUUID().toString()); |
|
|
|
maps.add(m); |
|
|
|
} |
|
|
|
baseMapper.insertSupplierFiles(maps); |
|
|
|
} |
|
|
|
baseMapper.deleteSupplierFiles(entity.getSid(),"2"); |
|
|
|
String[] contractFiles = dto.getContractInfo().getContractFiles(); |
|
|
|
if(contractFiles!=null){ |
|
|
|
List<Map<String,String>> maps=new ArrayList<>(); |
|
|
|
for(String s:contractFiles){ |
|
|
|
Map<String,String>m=new HashMap<>(); |
|
|
|
m.put("mainSid",entity.getSid()); |
|
|
|
m.put("url",s); |
|
|
|
m.put("type","2"); |
|
|
|
m.put("sid", UUID.randomUUID().toString()); |
|
|
|
maps.add(m); |
|
|
|
} |
|
|
|
baseMapper.insertSupplierFiles(maps); |
|
|
|
} |
|
|
|
SupplierContractInfoDto supplierContractInfoDto = dto.getContractInfo(); |
|
|
|
supplierContractInfoDto.setSupplierSid(entity.getSid()); |
|
|
|
supplierContractInfoService.saveOrUpdateDto(supplierContractInfoDto); |
|
|
|
} |
|
|
|
public ResultBean delBySids(String sids) { |
|
|
|
ResultBean<Object> resultBean = ResultBean.fireFail(); |
|
|
|
String[] split = sids.split(","); |
|
|
|
int i= baseMapper.delBySids(split); |
|
|
|
return resultBean.success().setData("1"); |
|
|
|
} |
|
|
|
public SupplierBankInfoDetailsVo fetchDetailsVoBySid(String sid){ |
|
|
|
SupplierBankInfo entity = baseMapper.selectBySid(sid); |
|
|
|
SupplierBankInfoDetailsVo vo = new SupplierBankInfoDetailsVo(); |
|
|
|
SupplierContractInfoDto contractInfo = new SupplierContractInfoDto(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
String s1=baseMapper.selectSupplierFiles(sid,"1"); |
|
|
|
if(StringUtils.isNotBlank(s1)){ |
|
|
|
vo.setBusinessLicenseFiles(s1.split(",")); |
|
|
|
}else{ |
|
|
|
vo.setBusinessLicenseFiles(new String[]{}); |
|
|
|
} |
|
|
|
String s2=baseMapper.selectSupplierFiles(sid,"2"); |
|
|
|
if(StringUtils.isNotBlank(s2)){ |
|
|
|
contractInfo.setContractFiles(s2.split(",")); |
|
|
|
contractInfo.setContractFiles(s2.split(",")); |
|
|
|
}else{ |
|
|
|
contractInfo.setContractFiles(new String[]{}); |
|
|
|
} |
|
|
|
vo.setContractInfo(contractInfo); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
} |
|
|
|
SupplierBankInfo entity = baseMapper.selectBySid(dtoSid); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
supplierIndexService.delByMainSid(dtoSid); |
|
|
|
List<String> codeIndex = dto.getCodeIndex(); |
|
|
|
baseMapper.insertSUpplierIndex(entity.getName(), entity.getCodeUnified(), dtoSid, entity.getCodeUnified()); |
|
|
|
for (String index : codeIndex) { |
|
|
|
if (!index.equals(entity.getCodeUnified())) { |
|
|
|
baseMapper.insertSUpplierIndex(entity.getName(), entity.getCodeUnified(), entity.getSid(), index); |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.deleteSupplierFiles(entity.getSid(), "1"); |
|
|
|
String[] businessLicenseFiles = dto.getBusinessLicenseFiles(); |
|
|
|
if (businessLicenseFiles != null) { |
|
|
|
List<Map<String, String>> maps = new ArrayList<>(); |
|
|
|
for (String s : businessLicenseFiles) { |
|
|
|
Map<String, String> m = new HashMap<>(); |
|
|
|
m.put("mainSid", entity.getSid()); |
|
|
|
m.put("url", s); |
|
|
|
m.put("type", "1"); |
|
|
|
m.put("sid", UUID.randomUUID().toString()); |
|
|
|
maps.add(m); |
|
|
|
} |
|
|
|
baseMapper.insertSupplierFiles(maps); |
|
|
|
} |
|
|
|
baseMapper.deleteSupplierFiles(entity.getSid(), "2"); |
|
|
|
String[] contractFiles = dto.getContractInfo().getContractFiles(); |
|
|
|
if (contractFiles != null) { |
|
|
|
List<Map<String, String>> maps = new ArrayList<>(); |
|
|
|
for (String s : contractFiles) { |
|
|
|
Map<String, String> m = new HashMap<>(); |
|
|
|
m.put("mainSid", entity.getSid()); |
|
|
|
m.put("url", s); |
|
|
|
m.put("type", "2"); |
|
|
|
m.put("sid", UUID.randomUUID().toString()); |
|
|
|
maps.add(m); |
|
|
|
} |
|
|
|
baseMapper.insertSupplierFiles(maps); |
|
|
|
} |
|
|
|
SupplierContractInfoDto supplierContractInfoDto = dto.getContractInfo(); |
|
|
|
supplierContractInfoDto.setSupplierSid(entity.getSid()); |
|
|
|
supplierContractInfoService.saveOrUpdateDto(supplierContractInfoDto); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean delBySids(String sids) { |
|
|
|
ResultBean<Object> resultBean = ResultBean.fireFail(); |
|
|
|
String[] split = sids.split(","); |
|
|
|
int i = baseMapper.delBySids(split); |
|
|
|
return resultBean.success().setData("1"); |
|
|
|
} |
|
|
|
|
|
|
|
public SupplierBankInfo selectByCode(String codeUnified) { |
|
|
|
return baseMapper.selectByCode(codeUnified); |
|
|
|
} |
|
|
|
public SupplierBankInfoDetailsVo fetchDetailsVoBySid(String sid) { |
|
|
|
SupplierBankInfo entity = baseMapper.selectBySid(sid); |
|
|
|
SupplierBankInfoDetailsVo vo = new SupplierBankInfoDetailsVo(); |
|
|
|
SupplierContractInfoDto contractInfo = new SupplierContractInfoDto(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
String s1 = baseMapper.selectSupplierFiles(sid, "1"); |
|
|
|
if (StringUtils.isNotBlank(s1)) { |
|
|
|
vo.setBusinessLicenseFiles(s1.split(",")); |
|
|
|
} else { |
|
|
|
vo.setBusinessLicenseFiles(new String[]{}); |
|
|
|
} |
|
|
|
String s2 = baseMapper.selectSupplierFiles(sid, "2"); |
|
|
|
if (StringUtils.isNotBlank(s2)) { |
|
|
|
contractInfo.setContractFiles(s2.split(",")); |
|
|
|
contractInfo.setContractFiles(s2.split(",")); |
|
|
|
} else { |
|
|
|
contractInfo.setContractFiles(new String[]{}); |
|
|
|
} |
|
|
|
vo.setContractInfo(contractInfo); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
|
|
|
|
public SupplierBankInfo selectByCode(String codeUnified) { |
|
|
|
return baseMapper.selectByCode(codeUnified); |
|
|
|
} |
|
|
|
|
|
|
|
public List<PurchaseRequisitionCheckVo> checkPurchaseRequisition(String purchaseRequisitionSid) { |
|
|
|
List<PurchaseRequisitionCheckVo> list = new ArrayList<>(); |
|
|
|
PurchaseRequisition pr = purchaseRequisitionService.fetchBySid(purchaseRequisitionSid); |
|
|
|
if(pr==null) |
|
|
|
return list; |
|
|
|
String supplierCode = pr.getSupplierCode(); |
|
|
|
String supplierName = pr.getSupplierName(); |
|
|
|
String supplierOnlyCode = pr.getSupplierOnlyCode(); |
|
|
|
List<PurchaseRequisitionCheckVo> list = new ArrayList<>(); |
|
|
|
PurchaseRequisition pr = purchaseRequisitionService.fetchBySid(purchaseRequisitionSid); |
|
|
|
if (pr == null) |
|
|
|
return list; |
|
|
|
String supplierCode = pr.getSupplierCode(); |
|
|
|
String supplierName = pr.getSupplierName(); |
|
|
|
String supplierOnlyCode = pr.getSupplierOnlyCode(); |
|
|
|
|
|
|
|
SupplierIndex si = supplierIndexService.fetchbyCode(supplierCode); |
|
|
|
if (si == null) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
public void checkInTransitByUniCode(String supplierOnlyCode) { |
|
|
|
|
|
|
|
return list; |
|
|
|
} |
|
|
|
} |