|
@@ -9,24 +9,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.sunxung.factoring.component.config.FileUploadProperties;
|
|
import com.sunxung.factoring.component.config.FileUploadProperties;
|
|
-import com.sunxung.factoring.component.exception.ServiceException;
|
|
|
|
import com.sunxung.factoring.component.exception.ValidatorException;
|
|
import com.sunxung.factoring.component.exception.ValidatorException;
|
|
import com.sunxung.factoring.component.util.ElectronicSignatureUtil;
|
|
import com.sunxung.factoring.component.util.ElectronicSignatureUtil;
|
|
-import com.sunxung.factoring.component.util.FileUtil;
|
|
|
|
-import com.sunxung.factoring.component.util.HttpClientUtil;
|
|
|
|
import com.sunxung.factoring.dict.impl.FileModuleDict;
|
|
import com.sunxung.factoring.dict.impl.FileModuleDict;
|
|
import com.sunxung.factoring.entity.GridPage;
|
|
import com.sunxung.factoring.entity.GridPage;
|
|
import com.sunxung.factoring.entity.credit.CreditDetail;
|
|
import com.sunxung.factoring.entity.credit.CreditDetail;
|
|
import com.sunxung.factoring.entity.credit.CreditInfo;
|
|
import com.sunxung.factoring.entity.credit.CreditInfo;
|
|
-import com.sunxung.factoring.entity.customerinformation.ElectronicSignaturePersonal;
|
|
|
|
import com.sunxung.factoring.entity.entprise.Enterprise;
|
|
import com.sunxung.factoring.entity.entprise.Enterprise;
|
|
-import com.sunxung.factoring.entity.sys.FileStorageDO;
|
|
|
|
|
|
+import com.sunxung.factoring.entity.sys.FileStorage;
|
|
import com.sunxung.factoring.mapper.credit.CreditInfoMapper;
|
|
import com.sunxung.factoring.mapper.credit.CreditInfoMapper;
|
|
import com.sunxung.factoring.mapper.customerinformation.ElectronicSignaturePersonalMapper;
|
|
import com.sunxung.factoring.mapper.customerinformation.ElectronicSignaturePersonalMapper;
|
|
import com.sunxung.factoring.service.credit.CreditDetailService;
|
|
import com.sunxung.factoring.service.credit.CreditDetailService;
|
|
import com.sunxung.factoring.service.credit.CreditService;
|
|
import com.sunxung.factoring.service.credit.CreditService;
|
|
-import com.sunxung.factoring.service.customerinformation.IElectronicSignaturePersonalService;
|
|
|
|
-import com.sunxung.factoring.service.sys.FileService;
|
|
|
|
|
|
+import com.sunxung.factoring.service.sys.FileStorageService;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -54,7 +50,7 @@ public class CreditServiceImpl extends ServiceImpl<CreditInfoMapper, CreditInfo>
|
|
private ElectronicSignaturePersonalMapper electronicSignaturePersonalMapper;
|
|
private ElectronicSignaturePersonalMapper electronicSignaturePersonalMapper;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private FileService fileService;
|
|
|
|
|
|
+ private FileStorageService fileStorageService;
|
|
|
|
|
|
@Value("${sop.getBusinessByKeyWordUrl}")
|
|
@Value("${sop.getBusinessByKeyWordUrl}")
|
|
private String getBusinessByKeyWordUrl;
|
|
private String getBusinessByKeyWordUrl;
|
|
@@ -63,10 +59,10 @@ public class CreditServiceImpl extends ServiceImpl<CreditInfoMapper, CreditInfo>
|
|
public GridPage findByName(String name, Integer type, Integer page, Integer rows) {
|
|
public GridPage findByName(String name, Integer type, Integer page, Integer rows) {
|
|
Page objectPage = PageHelper.startPage(page, rows);
|
|
Page objectPage = PageHelper.startPage(page, rows);
|
|
List<CreditInfo> list ;
|
|
List<CreditInfo> list ;
|
|
- list = lambdaQuery().eq(CreditInfo::getType,type).like(CreditInfo::getName, name).list();
|
|
|
|
|
|
+ list = lambdaQuery().eq(CreditInfo::getType,type).like(CreditInfo::getName, name).orderByDesc(CreditInfo::getGmtCreate).list();
|
|
return new GridPage(rows,page,objectPage.getTotal(),list);
|
|
return new GridPage(rows,page,objectPage.getTotal(),list);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void add(CreditInfo creditInfo) {
|
|
public void add(CreditInfo creditInfo) {
|
|
CreditInfo creditInfo1 = this.getOne(new QueryWrapper<CreditInfo>().eq("card_no", creditInfo.getCardNo()));
|
|
CreditInfo creditInfo1 = this.getOne(new QueryWrapper<CreditInfo>().eq("card_no", creditInfo.getCardNo()));
|
|
@@ -86,8 +82,36 @@ public class CreditServiceImpl extends ServiceImpl<CreditInfoMapper, CreditInfo>
|
|
@Override
|
|
@Override
|
|
public CreditInfo get(Long id) {
|
|
public CreditInfo get(Long id) {
|
|
CreditInfo creditInfo = getById(id);
|
|
CreditInfo creditInfo = getById(id);
|
|
|
|
+ if (StringUtils.isNotEmpty(creditInfo.getCardPhoto())){
|
|
|
|
+ FileStorage fileStorage = fileStorageService.get(Long.valueOf(creditInfo.getCardPhoto()));
|
|
|
|
+ creditInfo.setCardPhotoFile(fileStorage);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(creditInfo.getCardRevPhoto())){
|
|
|
|
+ FileStorage fileStorage = fileStorageService.get(Long.valueOf(creditInfo.getCardRevPhoto()));
|
|
|
|
+ creditInfo.setCardRevPhotoFile(fileStorage);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(creditInfo.getAuthAddress())){
|
|
|
|
+ FileStorage fileStorage = fileStorageService.get(Long.valueOf(creditInfo.getAuthAddress()));
|
|
|
|
+ creditInfo.setAuthAddressFile(fileStorage);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(creditInfo.getCreditAddress())){
|
|
|
|
+ FileStorage fileStorage = fileStorageService.get(Long.valueOf(creditInfo.getCreditAddress()));
|
|
|
|
+ creditInfo.setCreditAddressFile(fileStorage);
|
|
|
|
+ }
|
|
List<CreditDetail> creditDetails = creditDetailService.getByCreditId(id);
|
|
List<CreditDetail> creditDetails = creditDetailService.getByCreditId(id);
|
|
- creditInfo.setCreditDetails(creditDetails);
|
|
|
|
|
|
+ if (CollectionUtil.isNotEmpty(creditDetails)){
|
|
|
|
+ for (CreditDetail creditDetail : creditDetails){
|
|
|
|
+ if (StringUtils.isNotEmpty(creditDetail.getAuthAddress())){
|
|
|
|
+ FileStorage fileStorage = fileStorageService.get(Long.valueOf(creditDetail.getAuthAddress()));
|
|
|
|
+ creditDetail.setAuthAddressFile(fileStorage);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(creditDetail.getCreditAddress())){
|
|
|
|
+ FileStorage fileStorage = fileStorageService.get(Long.valueOf(creditDetail.getCreditAddress()));
|
|
|
|
+ creditDetail.setCreditAddressFile(fileStorage);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ creditInfo.setCreditDetails(creditDetails);
|
|
|
|
+ }
|
|
return creditInfo;
|
|
return creditInfo;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -95,17 +119,20 @@ public class CreditServiceImpl extends ServiceImpl<CreditInfoMapper, CreditInfo>
|
|
public void update(CreditInfo creditInfo) {
|
|
public void update(CreditInfo creditInfo) {
|
|
//更新最近查询时间
|
|
//更新最近查询时间
|
|
updateById(creditInfo);
|
|
updateById(creditInfo);
|
|
- CreditDetail creditDetail = new CreditDetail();
|
|
|
|
- creditDetail.setCreditId(creditInfo.getId());
|
|
|
|
- creditDetail.setAuthAddress(creditInfo.getAuthAddress());
|
|
|
|
- creditDetail.setCreditAddress(creditInfo.getCreditAddress());
|
|
|
|
- creditDetail.setSearchDate(creditInfo.getSearchDate());
|
|
|
|
- creditDetailService.add(creditDetail);
|
|
|
|
|
|
+ if ((creditInfo.getType() == 1 && StringUtils.isNotEmpty(creditInfo.getCreditAddress()) ) ||
|
|
|
|
+ (creditInfo.getType() == 0 && (StringUtils.isNotEmpty(creditInfo.getCreditAddress()) || creditInfo.getSearchDate() != null))){
|
|
|
|
+ CreditDetail creditDetail = new CreditDetail();
|
|
|
|
+ creditDetail.setCreditId(creditInfo.getId());
|
|
|
|
+ creditDetail.setAuthAddress(creditInfo.getAuthAddress());
|
|
|
|
+ creditDetail.setCreditAddress(creditInfo.getCreditAddress());
|
|
|
|
+ creditDetail.setSearchDate(creditInfo.getSearchDate());
|
|
|
|
+ creditDetailService.add(creditDetail);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public FileStorageDO getAuthAddress(String cardNo) throws Exception {
|
|
|
|
- FileStorageDO result = null;
|
|
|
|
|
|
+ public FileStorage getAuthAddress(String cardNo) throws Exception {
|
|
|
|
+ FileStorage result = null;
|
|
List<Enterprise> list = electronicSignaturePersonalMapper.findByComName(cardNo, null);
|
|
List<Enterprise> list = electronicSignaturePersonalMapper.findByComName(cardNo, null);
|
|
for (Enterprise enterprise : list) {
|
|
for (Enterprise enterprise : list) {
|
|
if (enterprise.getCertificateSignStatus() == 1){
|
|
if (enterprise.getCertificateSignStatus() == 1){
|
|
@@ -113,7 +140,7 @@ public class CreditServiceImpl extends ServiceImpl<CreditInfoMapper, CreditInfo>
|
|
String url = ElectronicSignatureUtil.downloadContract(contractId);
|
|
String url = ElectronicSignatureUtil.downloadContract(contractId);
|
|
//下载征信授权书
|
|
//下载征信授权书
|
|
result = createFileStorage("征信授权书", ".pdf", FileModuleDict.ChildEnum.CREDIT_AUTH.getCode());
|
|
result = createFileStorage("征信授权书", ".pdf", FileModuleDict.ChildEnum.CREDIT_AUTH.getCode());
|
|
- fileService.save(result);
|
|
|
|
|
|
+ fileStorageService.add(result);
|
|
downloadFile(url,result.getAbsolutePath());
|
|
downloadFile(url,result.getAbsolutePath());
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -122,18 +149,20 @@ public class CreditServiceImpl extends ServiceImpl<CreditInfoMapper, CreditInfo>
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public static FileStorageDO createFileStorage(String name,String suffix,
|
|
|
|
|
|
+ public static FileStorage createFileStorage(String name,String suffix,
|
|
String fileBusinessEnum) {
|
|
String fileBusinessEnum) {
|
|
- FileStorageDO fileStorageDO = new FileStorageDO();
|
|
|
|
|
|
+ FileStorage fileStorageDO = new FileStorage();
|
|
fileStorageDO.setOriginalName(name);
|
|
fileStorageDO.setOriginalName(name);
|
|
- fileStorageDO.setType(suffix);
|
|
|
|
|
|
+ fileStorageDO.setFileType(suffix);
|
|
String newFileName = IdUtil.fastSimpleUUID() + suffix;
|
|
String newFileName = IdUtil.fastSimpleUUID() + suffix;
|
|
FileUploadProperties bean = SpringUtil.getBean(FileUploadProperties.class);
|
|
FileUploadProperties bean = SpringUtil.getBean(FileUploadProperties.class);
|
|
fileStorageDO.setPath(fileBusinessEnum + File.separator + newFileName);
|
|
fileStorageDO.setPath(fileBusinessEnum + File.separator + newFileName);
|
|
File file = new File(bean.getStoragePath() + File.separator + fileBusinessEnum + File.separator
|
|
File file = new File(bean.getStoragePath() + File.separator + fileBusinessEnum + File.separator
|
|
+ newFileName);
|
|
+ newFileName);
|
|
fileStorageDO.setAbsolutePath(file.getAbsolutePath());
|
|
fileStorageDO.setAbsolutePath(file.getAbsolutePath());
|
|
- fileStorageDO.setBusinessType(fileBusinessEnum);
|
|
|
|
|
|
+ FileStorage.Belong belong = new FileStorage.Belong();
|
|
|
|
+ belong.setBelongType(fileBusinessEnum);
|
|
|
|
+ fileStorageDO.setBelong(belong);
|
|
return fileStorageDO;
|
|
return fileStorageDO;
|
|
}
|
|
}
|
|
|
|
|