Browse Source

供应商接口copy

master
God 2 years ago
parent
commit
ef93b91e85
  1. 9
      yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/supplierbankinfo/SupplierBankInfoDetailsVo.java
  2. 9
      yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/supplierbankinfo/SupplierBankInfoDto.java
  3. 10
      yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/supplierbankinfo/SupplierBankInfoFeign.java
  4. 4
      yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/suppliercontractinfo/SupplierContractInfoDto.java
  5. 24
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierbankinfo/SupplierBankInfoMapper.java
  6. 21
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierbankinfo/SupplierBankInfoRest.java
  7. 36
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierbankinfo/SupplierBankInfoService.java
  8. 3
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierindex/SupplierIndexMapper.java
  9. 4
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierindex/SupplierIndexService.java

9
yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/supplierbankinfo/SupplierBankInfoDetailsVo.java

@ -32,6 +32,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/** /**
* Project: supervise(supervise) <br/> * Project: supervise(supervise) <br/>
* File: SupplierBankInfoVo.java <br/> * File: SupplierBankInfoVo.java <br/>
@ -81,8 +84,8 @@ public class SupplierBankInfoDetailsVo implements Vo {
private String bankRemarks; // 银行审批意见 private String bankRemarks; // 银行审批意见
@ApiModelProperty("营业执照附件") @ApiModelProperty("营业执照附件")
private String[] businessLicenseFiles; // 营业执照附件 private String[] businessLicenseFiles; // 营业执照附件
@ApiModelProperty("合同照片") @ApiModelProperty("第二编码")
private String[] contractFiles; // 合同照片 private List<String> codeIndex = new ArrayList<>(); // 第二编码
@ApiModelProperty("合同信息") @ApiModelProperty("合同信息")
private SupplierContractInfoDto supplierContractInfoDto; // 合同信息 private SupplierContractInfoDto contractInfo; // 合同信息
} }

9
yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/supplierbankinfo/SupplierBankInfoDto.java

@ -32,6 +32,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/** /**
* Project: supervise(supervise) <br/> * Project: supervise(supervise) <br/>
* File: SupplierBankInfoDto.java <br/> * File: SupplierBankInfoDto.java <br/>
@ -81,8 +84,8 @@ public class SupplierBankInfoDto implements Dto {
private String bankRemarks; // 银行审批意见 private String bankRemarks; // 银行审批意见
@ApiModelProperty("营业执照附件") @ApiModelProperty("营业执照附件")
private String[] businessLicenseFiles; // 营业执照附件 private String[] businessLicenseFiles; // 营业执照附件
@ApiModelProperty("合同照片") @ApiModelProperty("第二编码")
private String[] contractFiles; // 合同照片 private List<String> codeIndex = new ArrayList<>(); // 第二编码
@ApiModelProperty("合同信息") @ApiModelProperty("合同信息")
private SupplierContractInfoDto supplierContractInfoDto; // 合同信息 private SupplierContractInfoDto contractInfo; // 合同信息
} }

10
yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/supplierbankinfo/SupplierBankInfoFeign.java

@ -48,9 +48,9 @@ import org.springframework.web.bind.annotation.*;
*/ */
@Api(tags = "供应商信息") @Api(tags = "供应商信息")
@FeignClient( @FeignClient(
contextId = "supervise-SupplierBankInfo", contextId = "supervise-customer-SupplierBankInfo",
name = "supervise", name = "supervise-customer",
path = "v1/supplier", path = "v1/supplierbankinfo",
fallback = SupplierBankInfoFeignFallback.class) fallback = SupplierBankInfoFeignFallback.class)
public interface SupplierBankInfoFeign { public interface SupplierBankInfoFeign {
@ -60,14 +60,14 @@ public interface SupplierBankInfoFeign {
public ResultBean<PagerVo<SupplierBankInfoVo>> listPage(@RequestBody PagerQuery<SupplierBankInfoQuery> pq); public ResultBean<PagerVo<SupplierBankInfoVo>> listPage(@RequestBody PagerQuery<SupplierBankInfoQuery> pq);
@ApiOperation("新增或修改") @ApiOperation("新增或修改")
@PostMapping("/saveSupplier") @PostMapping("/save")
@ResponseBody @ResponseBody
public ResultBean save(@RequestBody SupplierBankInfoDto dto); public ResultBean save(@RequestBody SupplierBankInfoDto dto);
@ApiOperation("根据sid删除记录") @ApiOperation("根据sid删除记录")
@DeleteMapping("/delBySids") @DeleteMapping("/delBySids")
@ResponseBody @ResponseBody
public ResultBean delBySids(@RequestBody String[] sids); public ResultBean delBySids(@RequestBody String[] sids);
@ApiOperation("根据SID获取一条记录") @ApiOperation("根据SID获取一条记录")
@GetMapping("/fetchDetailsBySid/{sid}") @GetMapping("/fetchDetailsBySid/{sid}")

4
yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/suppliercontractinfo/SupplierContractInfoDto.java

@ -66,6 +66,6 @@ public class SupplierContractInfoDto implements Dto {
private String contractPrice; // 合同金额 private String contractPrice; // 合同金额
@ApiModelProperty("供应商sid") @ApiModelProperty("供应商sid")
private String supplierSid; // 供应商sid private String supplierSid; // 供应商sid
@ApiModelProperty("合同照片")
private String[] contractFiles; // 合同照片
} }

24
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierbankinfo/SupplierBankInfoMapper.java

@ -52,24 +52,24 @@ import java.util.Map;
@Mapper @Mapper
public interface SupplierBankInfoMapper extends BaseMapper<SupplierBankInfo> { public interface SupplierBankInfoMapper extends BaseMapper<SupplierBankInfo> {
IPage<SupplierBankInfoVo> selectPageVo(IPage<SupplierBankInfo> page, @Param(Constants.WRAPPER) Wrapper<SupplierBankInfo> qw); IPage<SupplierBankInfoVo> selectPageVo(IPage<SupplierBankInfo> page, @Param(Constants.WRAPPER) Wrapper<SupplierBankInfo> qw);
int delBySids(@Param("list") String[] split); int delBySids(@Param("list") String[] split);
@Delete("delete from supplier_files where mainSid=#{mainSid} and type=#{type}") @Delete("delete from supplier_files where mainSid=#{mainSid} and type=#{type}")
void deleteSupplierFiles(@Param("mainSid")String sid, @Param("type") String type); void deleteSupplierFiles(@Param("mainSid") String sid, @Param("type") String type);
void insertSupplierFiles(List<Map<String, String>> maps); void insertSupplierFiles(List<Map<String, String>> maps);
@Select("select * from supplier_bank_info where sid=#{sid}") @Select("select * from supplier_bank_info where sid=#{sid}")
SupplierBankInfo selectBySid(@Param("sid")String sid); SupplierBankInfo selectBySid(@Param("sid") String sid);
@Select("select GROUP_CONCAT(url) url from supplier_files where mainSid=#{mainSid} and type=#{type}") @Select("select GROUP_CONCAT(url) url from supplier_files where mainSid=#{mainSid} and type=#{type}")
String selectSupplierFiles(@Param("mainSid")String mainSid, @Param("type") String type); String selectSupplierFiles(@Param("mainSid") String mainSid, @Param("type") String type);
@Select("select * from supplier_bank_info where codeUnified=#{codeUnified}") @Select("select * from supplier_bank_info where codeUnified=#{codeUnified}")
SupplierBankInfo selectByCode(@Param("codeUnified") String codeUnified); SupplierBankInfo selectByCode(@Param("codeUnified") String codeUnified);
@Insert("insert INTO supplier_index(code, name,PSid) values (#{code},#{name},#{sid})") @Insert("insert INTO supplier_index(sid, codeUnified, name ,PSid ,code , nameUnified) values (UUID(),#{name},#{codeUnified},#{sid},#{code},#{name})")
void insertSUpplierIndex( @Param("code")String code,@Param("name") String name,@Param("sid")String sid); void insertSUpplierIndex(@Param("name") String name, @Param("codeUnified") String codeUnified, @Param("sid") String sid, @Param("code") String code);
} }

21
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierbankinfo/SupplierBankInfoRest.java

@ -30,12 +30,17 @@ import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo; import com.yxt.common.core.vo.PagerVo;
import com.yxt.supervise.customer.api.supplierbankinfo.*; import com.yxt.supervise.customer.api.supplierbankinfo.*;
import com.yxt.supervise.customer.api.suppliercontractinfo.SupplierContractInfoDto; import com.yxt.supervise.customer.api.suppliercontractinfo.SupplierContractInfoDto;
import com.yxt.supervise.customer.api.supplierindex.SupplierIndexDetailsVo;
import com.yxt.supervise.customer.biz.suppliercontractinfo.SupplierContractInfoService; import com.yxt.supervise.customer.biz.suppliercontractinfo.SupplierContractInfoService;
import com.yxt.supervise.customer.biz.supplierindex.SupplierIndexService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/** /**
* Project: supervise(supervise) <br/> * Project: supervise(supervise) <br/>
* File: SupplierBankInfoFeignFallback.java <br/> * File: SupplierBankInfoFeignFallback.java <br/>
@ -58,6 +63,9 @@ public class SupplierBankInfoRest implements SupplierBankInfoFeign {
private SupplierBankInfoService supplierBankInfoService; private SupplierBankInfoService supplierBankInfoService;
@Autowired @Autowired
private SupplierContractInfoService supplierContractInfoService; private SupplierContractInfoService supplierContractInfoService;
@Autowired
private SupplierIndexService supplierIndexService;
@Override @Override
@ApiOperation("根据条件分页查询数据的列表") @ApiOperation("根据条件分页查询数据的列表")
@PostMapping("/listPage") @PostMapping("/listPage")
@ -91,8 +99,19 @@ public class SupplierBankInfoRest implements SupplierBankInfoFeign {
public ResultBean<SupplierBankInfoDetailsVo> fetchDetailsBySid(@PathVariable("sid") String sid){ public ResultBean<SupplierBankInfoDetailsVo> fetchDetailsBySid(@PathVariable("sid") String sid){
ResultBean rb = ResultBean.fireFail(); ResultBean rb = ResultBean.fireFail();
SupplierBankInfoDetailsVo vo = supplierBankInfoService.fetchDetailsVoBySid(sid); SupplierBankInfoDetailsVo vo = supplierBankInfoService.fetchDetailsVoBySid(sid);
String[] contractFiles = vo.getContractInfo().getContractFiles();
SupplierContractInfoDto supplierContractInfo=supplierContractInfoService.fetchByMainSid(sid); SupplierContractInfoDto supplierContractInfo=supplierContractInfoService.fetchByMainSid(sid);
vo.setSupplierContractInfoDto(supplierContractInfo); supplierContractInfo.setContractFiles(contractFiles);
vo.setContractInfo(supplierContractInfo);
List<SupplierIndexDetailsVo> supplierIndexDetailsVos = supplierIndexService.fetchDetailsVosBycodeUnified(vo.getCodeUnified());
List<String> codeIndex = new ArrayList<>();
for (SupplierIndexDetailsVo supplierIndexDetailsVo : supplierIndexDetailsVos) {
String code = supplierIndexDetailsVo.getCode();
if (!code.equals(vo.getCodeUnified())){
codeIndex.add(code);
}
}
vo.setCodeIndex(codeIndex);
return rb.success().setData(vo); return rb.success().setData(vo);
} }
} }

36
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.supplierbankinfo.*; import com.yxt.supervise.customer.api.supplierbankinfo.*;
import com.yxt.supervise.customer.api.suppliercontractinfo.SupplierContractInfoDto; import com.yxt.supervise.customer.api.suppliercontractinfo.SupplierContractInfoDto;
import com.yxt.supervise.customer.biz.suppliercontractinfo.SupplierContractInfoService; import com.yxt.supervise.customer.biz.suppliercontractinfo.SupplierContractInfoService;
import com.yxt.supervise.customer.biz.supplierindex.SupplierIndexService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -59,6 +60,9 @@ import java.util.*;
public class SupplierBankInfoService extends MybatisBaseService<SupplierBankInfoMapper, SupplierBankInfo> { public class SupplierBankInfoService extends MybatisBaseService<SupplierBankInfoMapper, SupplierBankInfo> {
@Resource @Resource
private SupplierContractInfoService supplierContractInfoService; private SupplierContractInfoService supplierContractInfoService;
@Resource
private SupplierIndexService supplierIndexService;
private QueryWrapper<SupplierBankInfo> createQueryWrapper(SupplierBankInfoQuery query) { private QueryWrapper<SupplierBankInfo> createQueryWrapper(SupplierBankInfoQuery query) {
// todo: 这里根据具体业务调整查询条件 // todo: 这里根据具体业务调整查询条件
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName())); // 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
@ -106,7 +110,13 @@ public class SupplierBankInfoService extends MybatisBaseService<SupplierBankInfo
SupplierBankInfo entity = new SupplierBankInfo(); SupplierBankInfo entity = new SupplierBankInfo();
BeanUtil.copyProperties(dto, entity, "id", "sid"); BeanUtil.copyProperties(dto, entity, "id", "sid");
baseMapper.insert(entity); baseMapper.insert(entity);
baseMapper.insertSUpplierIndex(entity.getName(),entity.getCodeUnified(),entity.getSid()); 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"); baseMapper.deleteSupplierFiles(entity.getSid(),"1");
String[] businessLicenseFiles = dto.getBusinessLicenseFiles(); String[] businessLicenseFiles = dto.getBusinessLicenseFiles();
if(businessLicenseFiles!=null){ if(businessLicenseFiles!=null){
@ -124,7 +134,7 @@ public class SupplierBankInfoService extends MybatisBaseService<SupplierBankInfo
} }
} }
baseMapper.deleteSupplierFiles(entity.getSid(),"2"); baseMapper.deleteSupplierFiles(entity.getSid(),"2");
String[] contractFiles = dto.getContractFiles(); String[] contractFiles = dto.getContractInfo().getContractFiles();
if(contractFiles!=null){ if(contractFiles!=null){
List<Map<String,String>> maps=new ArrayList<>(); List<Map<String,String>> maps=new ArrayList<>();
for(String s:contractFiles){ for(String s:contractFiles){
@ -139,7 +149,7 @@ public class SupplierBankInfoService extends MybatisBaseService<SupplierBankInfo
baseMapper.insertSupplierFiles(maps); baseMapper.insertSupplierFiles(maps);
} }
} }
SupplierContractInfoDto supplierContractInfoDto = dto.getSupplierContractInfoDto(); SupplierContractInfoDto supplierContractInfoDto = dto.getContractInfo();
supplierContractInfoDto.setSupplierSid(entity.getSid()); supplierContractInfoDto.setSupplierSid(entity.getSid());
supplierContractInfoService.saveOrUpdateDto(supplierContractInfoDto); supplierContractInfoService.saveOrUpdateDto(supplierContractInfoDto);
} }
@ -152,6 +162,14 @@ public class SupplierBankInfoService extends MybatisBaseService<SupplierBankInfo
SupplierBankInfo entity = baseMapper.selectBySid(dtoSid); SupplierBankInfo entity = baseMapper.selectBySid(dtoSid);
BeanUtil.copyProperties(dto, entity, "id", "sid"); BeanUtil.copyProperties(dto, entity, "id", "sid");
baseMapper.updateById(entity); 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"); baseMapper.deleteSupplierFiles(entity.getSid(),"1");
String[] businessLicenseFiles = dto.getBusinessLicenseFiles(); String[] businessLicenseFiles = dto.getBusinessLicenseFiles();
if(businessLicenseFiles!=null){ if(businessLicenseFiles!=null){
@ -167,7 +185,7 @@ public class SupplierBankInfoService extends MybatisBaseService<SupplierBankInfo
baseMapper.insertSupplierFiles(maps); baseMapper.insertSupplierFiles(maps);
} }
baseMapper.deleteSupplierFiles(entity.getSid(),"2"); baseMapper.deleteSupplierFiles(entity.getSid(),"2");
String[] contractFiles = dto.getContractFiles(); String[] contractFiles = dto.getContractInfo().getContractFiles();
if(contractFiles!=null){ if(contractFiles!=null){
List<Map<String,String>> maps=new ArrayList<>(); List<Map<String,String>> maps=new ArrayList<>();
for(String s:contractFiles){ for(String s:contractFiles){
@ -180,7 +198,7 @@ public class SupplierBankInfoService extends MybatisBaseService<SupplierBankInfo
} }
baseMapper.insertSupplierFiles(maps); baseMapper.insertSupplierFiles(maps);
} }
SupplierContractInfoDto supplierContractInfoDto = dto.getSupplierContractInfoDto(); SupplierContractInfoDto supplierContractInfoDto = dto.getContractInfo();
supplierContractInfoDto.setSupplierSid(entity.getSid()); supplierContractInfoDto.setSupplierSid(entity.getSid());
supplierContractInfoService.saveOrUpdateDto(supplierContractInfoDto); supplierContractInfoService.saveOrUpdateDto(supplierContractInfoDto);
} }
@ -193,6 +211,7 @@ public class SupplierBankInfoService extends MybatisBaseService<SupplierBankInfo
public SupplierBankInfoDetailsVo fetchDetailsVoBySid(String sid){ public SupplierBankInfoDetailsVo fetchDetailsVoBySid(String sid){
SupplierBankInfo entity = baseMapper.selectBySid(sid); SupplierBankInfo entity = baseMapper.selectBySid(sid);
SupplierBankInfoDetailsVo vo = new SupplierBankInfoDetailsVo(); SupplierBankInfoDetailsVo vo = new SupplierBankInfoDetailsVo();
SupplierContractInfoDto contractInfo = new SupplierContractInfoDto();
BeanUtil.copyProperties(entity, vo); BeanUtil.copyProperties(entity, vo);
String s1=baseMapper.selectSupplierFiles(sid,"1"); String s1=baseMapper.selectSupplierFiles(sid,"1");
if(StringUtils.isNotBlank(s1)){ if(StringUtils.isNotBlank(s1)){
@ -200,13 +219,14 @@ public class SupplierBankInfoService extends MybatisBaseService<SupplierBankInfo
}else{ }else{
vo.setBusinessLicenseFiles(new String[]{}); vo.setBusinessLicenseFiles(new String[]{});
} }
String s2=baseMapper.selectSupplierFiles(sid,"2"); String s2=baseMapper.selectSupplierFiles(sid,"2");
if(StringUtils.isNotBlank(s2)){ if(StringUtils.isNotBlank(s2)){
vo.setContractFiles(s2.split(",")); contractInfo.setContractFiles(s2.split(","));
contractInfo.setContractFiles(s2.split(","));
}else{ }else{
vo.setContractFiles(new String[]{}); contractInfo.setContractFiles(new String[]{});
} }
vo.setContractInfo(contractInfo);
return vo; return vo;
} }

3
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierindex/SupplierIndexMapper.java

@ -69,4 +69,7 @@ public interface SupplierIndexMapper extends BaseMapper<SupplierIndex> {
void insertSupplierIndex(SupplierIndex si); void insertSupplierIndex(SupplierIndex si);
@Select("select * from supplier_index where code=#{code} or name=#{name}") @Select("select * from supplier_index where code=#{code} or name=#{name}")
List<SupplierIndex> selectByCodeAndName(@Param("code") String code, @Param("name") String name); List<SupplierIndex> selectByCodeAndName(@Param("code") String code, @Param("name") String name);
@Delete("delete from supplier_index where PSid = #{dtoSid}")
void delByMainSid(String dtoSid);
} }

4
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/supplierindex/SupplierIndexService.java

@ -104,4 +104,8 @@ public class SupplierIndexService extends MybatisBaseService<SupplierIndexMapper
public static void clearCache() { public static void clearCache() {
cacheCodeMap = null; cacheCodeMap = null;
} }
public void delByMainSid(String dtoSid) {
baseMapper.delByMainSid(dtoSid);
}
} }

Loading…
Cancel
Save