Forráskód Böngészése

融信签收成功详情

sqg 3 éve
szülő
commit
32f43e0965

+ 71 - 0
sc-service/src/main/java/com/huyi/service/credit/controller/OwnCreditController.java

@@ -380,6 +380,77 @@ public class OwnCreditController extends BaseController {
         return AjaxResult.success(map);
     }
 
+
+    /**
+     * 获取融信详情
+     * @param zfiId
+     * @return
+     */
+    @GetMapping(value = "getFinanceSign/{zfiId}")
+    public AjaxResult getFinanceSign(@PathVariable("zfiId") String zfiId){
+        //查询当前操作员
+        LoginUser userInfo = tokenService.getLoginUser();
+        SysUser use = userInfo.getSysUser();
+        //查询融信详情
+        ZcFinanceInf financeInf =  financeInfService.getById(zfiId);
+        if(financeInf == null){
+            return AjaxResult.error("获取融信信息失败");
+        }
+        Map map = new HashMap();
+        //融信
+        map.put("financeInf",financeInf);
+        //融信编号
+        map.put("zfiNumber",financeInf.getZfiNumber());
+        //融信金额
+        map.put("zfiAmount",financeInf.getZfiAmount());
+        //利率
+        map.put("zfiRate",financeInf.getZfiRate());
+        //产品
+        String productId = financeInf.getZfiProductId();
+        ZcFinanceProduct product = productService.getById(productId);
+        //查询融资薪资
+        LambdaQueryWrapper<ZcFinanceRecord> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(ZcFinanceRecord::getZfrFinanceId,zfiId);
+        queryWrapper.and(i -> i.eq(ZcFinanceRecord::getZfrStatus,"01").or().eq(ZcFinanceRecord::getZfrStatus,"03"));
+        List<ZcFinanceRecord> recordList = iZcFinanceRecordService.findZcFinanceRecords(queryWrapper);
+        String zfrId = "";
+        if (recordList.size() > 0) {
+            zfrId = recordList.get(0).getZfrId();
+        }
+        //计算最长融信期限:intervalTime
+        String intervalTime = "";
+        //融信有效期
+        Date validity = null;
+        if(CommonUtil.isNotEmpty(zfrId)) {
+            ZcFinanceRecord zcFinanceRecord = iZcFinanceRecordService.getById(zfrId);
+            //签发有效期
+            Date zfiEffectiveDate = financeInf.getZfiEffectiveDate();
+            //承诺还款日
+            Date zfrRepaymentDate = zcFinanceRecord.getZfrRepaymentDate();
+            if (CommonUtil.isNotEmpty(zfrRepaymentDate + "") && CommonUtil.isNotEmpty(zfiEffectiveDate + "")) {
+                Calendar cal = Calendar.getInstance();
+                cal.setTime(zfiEffectiveDate);
+                long effectiveDate = cal.getTimeInMillis();
+                cal.setTime(zfrRepaymentDate);
+                long repaymentDate = cal.getTimeInMillis();
+                long betweenDays = (effectiveDate - repaymentDate) / (1000 * 3600 * 24);
+                intervalTime = String.valueOf(betweenDays);
+            }
+            //最短账期
+            String zfpShortestPeriod = product.getZfpShortestPeriod();
+            if(CommonUtil.isNotEmpty(zfrRepaymentDate + "") && CommonUtil.isNotEmpty(zfpShortestPeriod)){
+                Integer period = Integer.parseInt(zfpShortestPeriod);
+                validity = DateUtils.addDays(zfrRepaymentDate,-period);
+            }
+        }
+        //最长融信期限
+        map.put("intervalTime", intervalTime);
+        //融信有效期
+        map.put("validity", validity + "");
+        return AjaxResult.success(map);
+    }
+
+
     /**
      * 修改融信
      * @param map