diff --git a/yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierbankinfo/SupplierBankInfoService.java b/yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierbankinfo/SupplierBankInfoService.java index a70231f5..7a0e4eb9 100644 --- a/yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierbankinfo/SupplierBankInfoService.java +++ b/yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierbankinfo/SupplierBankInfoService.java @@ -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 { - @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 createQueryWrapper(SupplierBankInfoQuery query) { - // todo: 这里根据具体业务调整查询条件 - // 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName())); - QueryWrapper qw = new QueryWrapper<>(); + private QueryWrapper createQueryWrapper(SupplierBankInfoQuery query) { + // todo: 这里根据具体业务调整查询条件 + // 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName())); + QueryWrapper 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 listPageVo(PagerQuery pq) { - SupplierBankInfoQuery query = pq.getParams(); - QueryWrapper qw = createQueryWrapper(query); - SupplierBankInfoQuery params = pq.getParams(); - String name = params.getName(); - if(StringUtils.isNotBlank(name)){ - qw.like("i.name",name); - } - IPage page = PagerUtil.queryToPage(pq); - IPage pagging = baseMapper.selectPageVo(page, qw); - PagerVo 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 listPageVo(PagerQuery pq) { + SupplierBankInfoQuery query = pq.getParams(); + QueryWrapper qw = createQueryWrapper(query); + SupplierBankInfoQuery params = pq.getParams(); + String name = params.getName(); + if (StringUtils.isNotBlank(name)) { + qw.like("i.name", name); + } + IPage page = PagerUtil.queryToPage(pq); + IPage pagging = baseMapper.selectPageVo(page, qw); + PagerVo 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 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> maps=new ArrayList<>(); - for(String s:businessLicenseFiles){ - Mapm=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> maps=new ArrayList<>(); - for(String s:contractFiles){ - Mapm=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 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> maps = new ArrayList<>(); + for (String s : businessLicenseFiles) { + Map 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> maps = new ArrayList<>(); + for (String s : contractFiles) { + Map 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 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> maps=new ArrayList<>(); - for(String s:businessLicenseFiles){ - Mapm=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> maps=new ArrayList<>(); - for(String s:contractFiles){ - Mapm=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 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 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> maps = new ArrayList<>(); + for (String s : businessLicenseFiles) { + Map 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> maps = new ArrayList<>(); + for (String s : contractFiles) { + Map 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 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 checkPurchaseRequisition(String purchaseRequisitionSid) { - List 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 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; } } \ No newline at end of file diff --git a/yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierindex/SupplierIndexService.java b/yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierindex/SupplierIndexService.java index c4252688..b10cbd30 100644 --- a/yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierindex/SupplierIndexService.java +++ b/yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierindex/SupplierIndexService.java @@ -62,8 +62,8 @@ public class SupplierIndexService extends ServiceImpl qw = new QueryWrapper<>(); SupplierIndexQuery params = pq.getParams(); String name = params.getName(); - if(StringUtils.isNotBlank(name)){ - qw.like("i.name",name); + if (StringUtils.isNotBlank(name)) { + qw.like("i.name", name); } IPage page = PagerUtil.queryToPage(pq); IPage pagging = baseMapper.selectPageVo(page, qw); @@ -114,4 +114,10 @@ public class SupplierIndexService extends ServiceImpl qw = new QueryWrapper<>(); + qw.eq("code", supplierCode); + return baseMapper.selectOne(qw); + } }