Przeglądaj źródła

个贷产品一键生成

wucl 11 miesięcy temu
rodzic
commit
1f93565276

+ 9 - 0
biz-base/src/main/java/com/dayou/controller/PersonalProductionController.java

@@ -52,6 +52,15 @@ public class PersonalProductionController extends BaseController {
      }
 
     /**
+     * 个贷产品文档一键生成
+     */
+    @GetMapping("/gen/{personalId}")
+    public RestResponse<Boolean> genFile(@PathVariable("personalId") Long personalId){
+        Boolean ret = personalProductionService.genFile(personalId);
+        return RestResponse.data(ret);
+    }
+
+    /**
      * 产品包
      * @param targetId
      * @return

+ 2 - 0
service/src/main/java/com/dayou/service/IPersonalProductionService.java

@@ -45,4 +45,6 @@ public interface IPersonalProductionService extends IService<PersonalProduction>
 
     OrderProductionsBag productionBag(Long id);
 
+    Boolean genFile(Long personalId);
+
 }

+ 51 - 0
service/src/main/java/com/dayou/service/impl/PersonalProductionServiceImpl.java

@@ -166,6 +166,56 @@ public class PersonalProductionServiceImpl extends ServiceImpl<PersonalProductio
         return Boolean.FALSE;
     }
 
+
+
+    @Override
+    public Boolean genFile(Long personalId) {
+        try {
+            //获取提供的证件信息
+            Personal personal = personalService.getOne(new LambdaQueryWrapper<Personal>().select(Personal::getCredentials).eq(BaseEntity::getId, personalId).eq(BaseEntity::getDeleted, Boolean.FALSE));
+            String orderId = personalService.getOne(new LambdaQueryWrapper<Personal>().eq(BaseEntity::getId, personalId).select(Personal::getOrderId).eq(BaseEntity::getDeleted, Boolean.FALSE)).getOrderId();
+            PersonalTarget target = personalTargetService.getOne(new LambdaQueryWrapper<PersonalTarget>().eq(PersonalTarget::getPersonalId, personalId).eq(BaseEntity::getDeleted, Boolean.FALSE));
+            List<CertificateEnum> certificates = JSON.parseArray(personal.getCredentials(), CertificateEnum.class);
+            CertificateEnum certificateEnum = determineCertificate(certificates);
+            Map<String,Object> textMap = new HashMap();
+
+            PersonalSellingAbilityVO sell = JSON.parseObject(target.getSellingAbility(), PersonalSellingAbilityVO.class);
+            PersonalBackgroundInfo bg = JSON.parseObject(target.getBackgroundInfo(), PersonalBackgroundInfo.class);
+            PersonalEntityInfoVO en = JSON.parseObject(target.getEntityInfo(), PersonalEntityInfoVO.class);
+            Field[] sellFields = sell.getClass().getDeclaredFields();
+            Field[] bgFields = bg.getClass().getDeclaredFields();
+            Field[] enFields = en.getClass().getDeclaredFields();
+            for (Field field :sellFields){
+                textMap.put(field.getName(),ReflectUtils.getFieldValue(sell,field.getName()));
+            }
+            for (Field field :bgFields){
+                textMap.put(field.getName(),ReflectUtils.getFieldValue(bg,field.getName()));
+            }
+            for (Field field :enFields){
+                textMap.put(field.getName(),ReflectUtils.getFieldValue(en,field.getName()));
+            }
+            textMap.put("orderId",orderId);
+            textMap.put("nAcreage",target.getAcreage());
+            textMap.put("nPrice",((BigDecimal)target.getPrice()).setScale(0, RoundingMode.HALF_UP));
+            textMap.put("nAmount",target.getAmount());
+            textMap.put("validateCode",target.getValidateCode());
+            addEnvironment(bg,textMap);
+
+            PersonalCalculate calculate = personalCalculateMapper.getByTargetId(target.getId());
+            textMap.put("rightsType",calculate.getRightsType());
+
+            NameUrlDTO statementPath = genStatement(orderId,target,textMap,certificateEnum);
+            createPro(target.getId(),statementPath,1,true);
+            NameUrlDTO technicPath = genTechnic(orderId,target,textMap,calculate,certificateEnum);
+            createPro(target.getId(),technicPath,2,true);
+            NameUrlDTO finalPath = genFinal(orderId,target,textMap,certificateEnum);
+            createPro(target.getId(),finalPath,3,true);
+            return Boolean.TRUE;
+        } catch (SecurityException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
     private CertificateEnum determineCertificate(List<CertificateEnum> certificates){
         if (CollectionUtil.isEmpty(certificates)){
             ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"请完善不动产权证或房产证其中一种证件");
@@ -473,6 +523,7 @@ public class PersonalProductionServiceImpl extends ServiceImpl<PersonalProductio
     }
 
 
+
     /**
      * 创建文档
      * @param originFilePath