Browse Source

征信管理修改

fengx 8 months ago
parent
commit
834d1e352b

+ 13 - 2
src/main/java/com/sunxung/factoring/entity/credit/CreditDetail.java

@@ -1,6 +1,9 @@
 package com.sunxung.factoring.entity.credit;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.sunxung.factoring.entity.BaseEntity;
+import com.sunxung.factoring.entity.sys.FileStorage;
+import com.sunxung.factoring.entity.sys.FileStorageDO;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -13,12 +16,20 @@ public class CreditDetail extends BaseEntity {
     //征信id
     private Long creditId;
 
-    //授权书地址
+    //授权书Id
     private String authAddress;
 
-    //征信地址
+    //授权书文件
+    @TableField(exist = false)
+    private FileStorage authAddressFile;
+
+    //征信地址id
     private String creditAddress;
 
+    //征信地址文件
+    @TableField(exist = false)
+    private FileStorage creditAddressFile;
+
     //征信查询时间
     private Date searchDate;
 

+ 18 - 0
src/main/java/com/sunxung/factoring/entity/credit/CreditInfo.java

@@ -2,6 +2,8 @@ package com.sunxung.factoring.entity.credit;
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.sunxung.factoring.entity.BaseEntity;
+import com.sunxung.factoring.entity.sys.FileStorage;
+import com.sunxung.factoring.entity.sys.FileStorageDO;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -30,9 +32,17 @@ public class CreditInfo extends BaseEntity {
     //身份证正面
     private String cardPhoto;
 
+    //身份证正面文件
+    @TableField(exist = false)
+    private FileStorage cardPhotoFile;
+
     //身份证反面
     private String cardRevPhoto;
 
+    //身份证反面文件
+    @TableField(exist = false)
+    private FileStorage cardRevPhotoFile;
+
     //最近征信查询时间
     private Date searchDate;
 
@@ -40,10 +50,18 @@ public class CreditInfo extends BaseEntity {
     @TableField(exist = false)
     private String authAddress;
 
+    //授权书地址
+    @TableField(exist = false)
+    private FileStorage authAddressFile;
+
     //征信地址
     @TableField(exist = false)
     private String creditAddress;
 
+    //征信地址
+    @TableField(exist = false)
+    private FileStorage creditAddressFile;
+
     //征信详情
     @TableField(exist = false)
     private List<CreditDetail> creditDetails;

+ 2 - 2
src/main/java/com/sunxung/factoring/service/credit/CreditService.java

@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.sunxung.factoring.entity.GridPage;
 import com.sunxung.factoring.entity.credit.CreditInfo;
 import com.sunxung.factoring.entity.entprise.Enterprise;
-import com.sunxung.factoring.entity.sys.FileStorageDO;
+import com.sunxung.factoring.entity.sys.FileStorage;
 
 import java.util.List;
 
@@ -16,7 +16,7 @@ public interface CreditService extends IService<CreditInfo> {
 
     void update(CreditInfo creditInfo);
 
-    FileStorageDO getAuthAddress(String cardNo) throws Exception;
+    FileStorage getAuthAddress(String cardNo) throws Exception;
 
     List<Enterprise> getBusinessByKeyWord(String keyword);
 

+ 53 - 24
src/main/java/com/sunxung/factoring/service/credit/impl/CreditServiceImpl.java

@@ -9,24 +9,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
 import com.github.pagehelper.PageHelper;
 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.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.entity.GridPage;
 import com.sunxung.factoring.entity.credit.CreditDetail;
 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.sys.FileStorageDO;
+import com.sunxung.factoring.entity.sys.FileStorage;
 import com.sunxung.factoring.mapper.credit.CreditInfoMapper;
 import com.sunxung.factoring.mapper.customerinformation.ElectronicSignaturePersonalMapper;
 import com.sunxung.factoring.service.credit.CreditDetailService;
 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.Value;
 import org.springframework.stereotype.Service;
@@ -54,7 +50,7 @@ public class CreditServiceImpl extends ServiceImpl<CreditInfoMapper, CreditInfo>
     private ElectronicSignaturePersonalMapper electronicSignaturePersonalMapper;
 
     @Autowired
-    private FileService fileService;
+    private FileStorageService fileStorageService;
 
     @Value("${sop.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) {
         Page objectPage = PageHelper.startPage(page, rows);
         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);
     }
-
+                                                                     
     @Override
     public void add(CreditInfo creditInfo) {
         CreditInfo creditInfo1 = this.getOne(new QueryWrapper<CreditInfo>().eq("card_no", creditInfo.getCardNo()));
@@ -86,8 +82,36 @@ public class CreditServiceImpl extends ServiceImpl<CreditInfoMapper, CreditInfo>
     @Override
     public CreditInfo get(Long 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);
-        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;
     }
 
@@ -95,17 +119,20 @@ public class CreditServiceImpl extends ServiceImpl<CreditInfoMapper, CreditInfo>
     public void update(CreditInfo 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
-    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);
         for (Enterprise enterprise : list) {
             if (enterprise.getCertificateSignStatus() == 1){
@@ -113,7 +140,7 @@ public class CreditServiceImpl extends ServiceImpl<CreditInfoMapper, CreditInfo>
                 String url = ElectronicSignatureUtil.downloadContract(contractId);
                 //下载征信授权书
                 result = createFileStorage("征信授权书", ".pdf", FileModuleDict.ChildEnum.CREDIT_AUTH.getCode());
-                fileService.save(result);
+                fileStorageService.add(result);
                 downloadFile(url,result.getAbsolutePath());
                 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) {
-        FileStorageDO fileStorageDO = new FileStorageDO();
+        FileStorage fileStorageDO = new FileStorage();
         fileStorageDO.setOriginalName(name);
-        fileStorageDO.setType(suffix);
+        fileStorageDO.setFileType(suffix);
         String newFileName = IdUtil.fastSimpleUUID() + suffix;
         FileUploadProperties bean = SpringUtil.getBean(FileUploadProperties.class);
         fileStorageDO.setPath(fileBusinessEnum + File.separator + newFileName);
         File file = new File(bean.getStoragePath() + File.separator + fileBusinessEnum + File.separator
                 + newFileName);
         fileStorageDO.setAbsolutePath(file.getAbsolutePath());
-        fileStorageDO.setBusinessType(fileBusinessEnum);
+        FileStorage.Belong belong = new FileStorage.Belong();
+        belong.setBelongType(fileBusinessEnum);
+        fileStorageDO.setBelong(belong);
         return fileStorageDO;
     }
 

+ 2 - 1
src/main/java/com/sunxung/factoring/web/credit/CreditController.java

@@ -8,6 +8,7 @@ import com.sunxung.factoring.entity.ResponseJson;
 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.sys.FileStorage;
 import com.sunxung.factoring.entity.sys.FileStorageDO;
 import com.sunxung.factoring.service.credit.CreditService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -71,7 +72,7 @@ public class CreditController {
     @ResponseBody
     @PostMapping("getAuthAddress")
     public ResponseJson getAuthAddress(String cardNo) throws Exception {
-        FileStorageDO authAddress = creditService.getAuthAddress(cardNo);
+        FileStorage authAddress = creditService.getAuthAddress(cardNo);
         return new ResponseJson(authAddress);
     }
 

+ 2 - 0
src/main/resources/mapper/customerinformation/ElectronicSignaturePersonalMapper.xml

@@ -13,6 +13,7 @@
                 and auth_status = #{status}
             </if>
         </where>
+        order by gmt_create desc
     </select>
 
     <select id="findByName" resultType="com.sunxung.factoring.entity.customerinformation.ElectronicSignaturePersonal">
@@ -25,5 +26,6 @@
                 and auth_status = #{status}
             </if>
         </where>
+        order by gmt_create desc
     </select>
 </mapper>