Kaynağa Gözat

电子签个人修改

fengx 9 ay önce
ebeveyn
işleme
8dccdf3b28

+ 6 - 0
src/main/java/com/sunxung/factoring/dict/impl/FileModuleDict.java

@@ -609,6 +609,12 @@ public class FileModuleDict extends Dict {
 
         PROJECT_CORE_ENTERPRISE_CREDIT_REPORT("projectCoreEnterpriseCreditReport", "项目核心企业授信报告"),
 
+        /** 电子签身份证正面 **/
+        ENTERPRISE_CARD_PHOTO("enterpriseCardPhoto", "身份证正面"),
+
+        /** 电子签身份证反面 **/
+        ENTERPRISE_CARD_REV_PHOTO("enterpriseCardRevPhoto", "身份证反面"),
+
         OTHER("other","其他");
 
         /**

+ 64 - 0
src/main/java/com/sunxung/factoring/entity/customerinformation/ElectronicSignaturePersonal.java

@@ -3,6 +3,9 @@ package com.sunxung.factoring.entity.customerinformation;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.sunxung.factoring.entity.BaseEntity;
+import com.sunxung.factoring.entity.sys.FileStorage;
+
+import java.util.List;
 
 /**
  * <p>
@@ -29,6 +32,9 @@ public class ElectronicSignaturePersonal extends BaseEntity {
     @TableField("card_type")
     private String cardType;
 
+    @TableField(exist = false)
+    private String cardTypeName;
+
     /**
      * 证件号码
      */
@@ -71,6 +77,64 @@ public class ElectronicSignaturePersonal extends BaseEntity {
     @TableField("auth_status")
     private Integer authStatus;
 
+    //身份证正面文件
+    @TableField(exist = false)
+    private FileStorage cardPhotoFile;
+
+    //身份证反面文件
+    @TableField(exist = false)
+    private FileStorage cardRevPhotoFile;
+
+
+    //删除文件id
+    @TableField(exist = false)
+    private List<Long> deleteIds;
+
+    //上传文件id
+    @TableField(exist = false)
+    private List<Long> fileIds;
+
+
+    public String getCardTypeName() {
+        return cardTypeName;
+    }
+
+    public void setCardTypeName(String cardTypeName) {
+        this.cardTypeName = cardTypeName;
+    }
+
+    public List<Long> getDeleteIds() {
+        return deleteIds;
+    }
+
+    public void setDeleteIds(List<Long> deleteIds) {
+        this.deleteIds = deleteIds;
+    }
+
+    public List<Long> getFileIds() {
+        return fileIds;
+    }
+
+    public void setFileIds(List<Long> fileIds) {
+        this.fileIds = fileIds;
+    }
+
+    public FileStorage getCardPhotoFile() {
+        return cardPhotoFile;
+    }
+
+    public void setCardPhotoFile(FileStorage cardPhotoFile) {
+        this.cardPhotoFile = cardPhotoFile;
+    }
+
+    public FileStorage getCardRevPhotoFile() {
+        return cardRevPhotoFile;
+    }
+
+    public void setCardRevPhotoFile(FileStorage cardRevPhotoFile) {
+        this.cardRevPhotoFile = cardRevPhotoFile;
+    }
+
     public String getOpenId() {
         return openId;
     }

+ 3 - 0
src/main/java/com/sunxung/factoring/entity/sys/FileStorage.java

@@ -44,6 +44,9 @@ public class FileStorage extends BaseEntity {
         String fileName = FileUtil.randomFileName();
         String path = FileUtil.getFilePath(fileName, suffix, moudleName);
         String absolutePath = FileUtil.getAbsolutePath(fileName, suffix, moudleName);
+        Belong belong = new Belong();
+        belong.setBelongType(moudleName);
+        setBelong(belong);
         setOriginalName(multipartFile.getOriginalFilename());
         setSize(multipartFile.getSize());
         setName(fileName + suffix);

+ 1 - 0
src/main/java/com/sunxung/factoring/mapper/sys/FileStorageMapper.java

@@ -34,4 +34,5 @@ public interface FileStorageMapper {
 
     List<Long> selectInvalidFileStorage();
 
+    void updateBusinessId(@Param("fileId")Long fileId, @Param("businessId")Long businessId);
 }

+ 2 - 0
src/main/java/com/sunxung/factoring/service/customerinformation/IElectronicSignaturePersonalService.java

@@ -75,4 +75,6 @@ public interface IElectronicSignaturePersonalService extends IService<Electronic
     GridPage findByComName(String name,Integer status, Integer page, Integer rows);
 
     void flush(Long id);
+
+    ElectronicSignaturePersonal getDetail(Long id);
 }

+ 47 - 0
src/main/java/com/sunxung/factoring/service/customerinformation/impl/ElectronicSignaturePersonalServiceImpl.java

@@ -6,15 +6,21 @@ import com.github.pagehelper.Page;
 import com.github.pagehelper.PageHelper;
 import com.sunxung.factoring.component.exception.ValidatorException;
 import com.sunxung.factoring.component.util.*;
+import com.sunxung.factoring.dict.impl.FileModuleDict;
 import com.sunxung.factoring.entity.GridPage;
 import com.sunxung.factoring.entity.acceptance.AcceptanceSignConfirmationElectronicInfo;
 import com.sunxung.factoring.entity.customerinformation.ElectronicSignaturePersonal;
 import com.sunxung.factoring.entity.entprise.Enterprise;
 import com.sunxung.factoring.entity.signconfirmation.SignConfirmationElectronicInfo;
+import com.sunxung.factoring.entity.sys.Dictionary;
+import com.sunxung.factoring.entity.sys.FileStorage;
 import com.sunxung.factoring.mapper.customerinformation.ElectronicSignaturePersonalMapper;
 import com.sunxung.factoring.service.acceptancesheet.IAcceptanceSignConfirmationElectronicInfoService;
 import com.sunxung.factoring.service.customerinformation.IElectronicSignaturePersonalService;
 import com.sunxung.factoring.service.signconfirmation.ISignConfirmationElectronicInfoService;
+import com.sunxung.factoring.service.sys.DictionaryService;
+import com.sunxung.factoring.service.sys.FileStorageService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -42,10 +48,22 @@ public class ElectronicSignaturePersonalServiceImpl extends ServiceImpl<Electron
     @Autowired
     private ElectronicSignaturePersonalMapper  electronicSignaturePersonalMapper;
 
+    @Autowired
+    private FileStorageService fileStorageService;
+
+    @Autowired
+    private DictionaryService dictionaryService;
+
     @Override
     public GridPage findByName(String name,Integer status, Integer page, Integer rows) {
         Page objectPage = PageHelper.startPage(page, rows);
         List<ElectronicSignaturePersonal> list  = electronicSignaturePersonalMapper.findByName(name,status);
+        for (ElectronicSignaturePersonal personal : list){
+            if (StringUtils.isNotEmpty(personal.getCardType())){
+                Dictionary dictionary = dictionaryService.getByCode(personal.getCardType());
+                personal.setCardTypeName(dictionary.getName());
+            }
+        }
         return new GridPage(rows,page,objectPage.getTotal(),list);
     }
 
@@ -67,6 +85,24 @@ public class ElectronicSignaturePersonalServiceImpl extends ServiceImpl<Electron
         }
     }
 
+    @Override
+    public ElectronicSignaturePersonal getDetail(Long id) {
+        ElectronicSignaturePersonal electronicSignaturePersonal = getById(id);
+        if (StringUtils.isNotEmpty(electronicSignaturePersonal.getCardType())){
+            Dictionary dictionary = dictionaryService.getByCode(electronicSignaturePersonal.getCardType());
+            electronicSignaturePersonal.setCardTypeName(dictionary.getName());
+        }
+        List<FileStorage> fileStorages = fileStorageService.findByBelongIdAndBelongType(id.toString(), FileModuleDict.ChildEnum.ENTERPRISE_CARD_PHOTO.getCode());
+        if (CollectionUtil.isNotEmpty(fileStorages)){
+            electronicSignaturePersonal.setCardPhotoFile(fileStorages.get(0));
+        }
+        List<FileStorage> list = fileStorageService.findByBelongIdAndBelongType(id.toString(), FileModuleDict.ChildEnum.ENTERPRISE_CARD_REV_PHOTO.getCode());
+        if (CollectionUtil.isNotEmpty(list)){
+            electronicSignaturePersonal.setCardRevPhotoFile(list.get(0));
+        }
+        return electronicSignaturePersonal;
+    }
+
     @Override
     public List<ElectronicSignaturePersonal> findByIdForC(Long id) {
         List<ElectronicSignaturePersonal> list ;
@@ -94,6 +130,17 @@ public class ElectronicSignaturePersonalServiceImpl extends ServiceImpl<Electron
                 throw new ValidatorException(CodeUtil.FAIL, "已认证,不能修改!");
             } else if (oldInfo.getAuthStatus().equals(0)) {
                 electronicSignaturePersonal = getAuthInfo(electronicSignaturePersonal);
+                //更新附件
+                if (CollectionUtil.isNotEmpty(electronicSignaturePersonal.getDeleteIds())){
+                    for (Long id : electronicSignaturePersonal.getDeleteIds()){
+                        fileStorageService.deleteFileStorage(id);
+                    }
+                }
+                if (CollectionUtil.isNotEmpty(electronicSignaturePersonal.getFileIds())){
+                    for (Long id : electronicSignaturePersonal.getFileIds()){
+                        fileStorageService.updateBusinessId(id,electronicSignaturePersonal.getId());
+                    }
+                }
                 updateById(electronicSignaturePersonal);
             } else {
                 throw new ValidatorException(CodeUtil.FAIL, "数据状态错误!");

+ 2 - 1
src/main/java/com/sunxung/factoring/service/sys/FileStorageService.java

@@ -187,4 +187,5 @@ public interface FileStorageService {
      */
     List<FileStorage> saveFileStorage(List<Long> fileIds);
 
-    }
+    void updateBusinessId(Long fileId, Long businessId);
+}

+ 7 - 0
src/main/java/com/sunxung/factoring/service/sys/impl/FileStorageServiceImpl.java

@@ -633,5 +633,12 @@ public class FileStorageServiceImpl implements FileStorageService {
         return list;
     }
 
+    @Override
+    public void updateBusinessId(Long fileId, Long businessId) {
+        if (fileId != null) {
+            fileStorageMapper.updateBusinessId(fileId,businessId);
+        }
+    }
+
 
 }

+ 1 - 1
src/main/java/com/sunxung/factoring/web/customerinformation/ElectronicSignaturePersonalController.java

@@ -77,7 +77,7 @@ public class ElectronicSignaturePersonalController {
     @ResponseBody
     @RequestMapping("get")
     public ResponseJson get(Long id){
-        ElectronicSignaturePersonal electronicSignaturePersonal = electronicSignaturePersonalService.getById(id);
+        ElectronicSignaturePersonal electronicSignaturePersonal = electronicSignaturePersonalService.getDetail(id);
         return new ResponseJson(electronicSignaturePersonal);
     }
 

+ 4 - 0
src/main/resources/mapper/sys/FileStorageMapper.xml

@@ -74,4 +74,8 @@
 
     </select>
 
+	<update id="updateBusinessId">
+		update t_file_storage set belongId = #{businessId}
+		where id = #{fileId}
+	</update>
 </mapper>