Browse Source

融信详情信息(签收成功后弹窗用)

sqg 4 years ago
parent
commit
5fa78c59b1

+ 13 - 7
sc-service/src/main/java/com/huyi/service/credit/controller/OwnCreditController.java

@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import java.lang.reflect.InvocationTargetException;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -387,7 +388,7 @@ public class OwnCreditController extends BaseController {
      * @return
      */
     @GetMapping(value = "getFinanceSign/{zfiId}")
-    public AjaxResult getFinanceSign(@PathVariable("zfiId") String zfiId){
+    public AjaxResult getFinanceSign(@PathVariable("zfiId") String zfiId) throws ParseException{
         //查询当前操作员
         LoginUser userInfo = tokenService.getLoginUser();
         SysUser use = userInfo.getSysUser();
@@ -420,33 +421,38 @@ public class OwnCreditController extends BaseController {
         //计算最长融信期限:intervalTime
         String intervalTime = "";
         //融信有效期
-        Date validity = null;
+        String validity = "";
         if(CommonUtil.isNotEmpty(zfrId)) {
             ZcFinanceRecord zcFinanceRecord = iZcFinanceRecordService.getById(zfrId);
             //签发有效期
             Date zfiEffectiveDate = financeInf.getZfiEffectiveDate();
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            String zfiEffective = simpleDateFormat.format(zfiEffectiveDate);
+            Date zfiEffectives = new SimpleDateFormat("yyyy-MM-dd").parse(zfiEffective);
             //承诺还款日
             Date zfrRepaymentDate = zcFinanceRecord.getZfrRepaymentDate();
+            String zfrRepayment = simpleDateFormat.format(zfrRepaymentDate);
+            Date repaymentDates = new SimpleDateFormat("yyyy-MM-dd").parse(zfrRepayment);
             if (CommonUtil.isNotEmpty(zfrRepaymentDate + "") && CommonUtil.isNotEmpty(zfiEffectiveDate + "")) {
                 Calendar cal = Calendar.getInstance();
-                cal.setTime(zfiEffectiveDate);
+                cal.setTime(zfiEffectives);
                 long effectiveDate = cal.getTimeInMillis();
-                cal.setTime(zfrRepaymentDate);
+                cal.setTime(repaymentDates);
                 long repaymentDate = cal.getTimeInMillis();
                 int betweenDays = (int)(effectiveDate - repaymentDate) / (1000 * 3600 * 24);
-                intervalTime = String.valueOf(betweenDays);
+                intervalTime = String.valueOf(Math.abs(betweenDays));
             }
             //最短账期
             String zfpShortestPeriod = product.getZfpShortestPeriod();
             if(CommonUtil.isNotEmpty(zfrRepaymentDate + "") && CommonUtil.isNotEmpty(zfpShortestPeriod)){
                 Integer period = Integer.parseInt(zfpShortestPeriod);
-                validity = DateUtils.addDays(zfrRepaymentDate,-period);
+                validity = new SimpleDateFormat("yyyy-MM-dd").format(DateUtils.addDays(repaymentDates,-period));
             }
         }
         //最长融信期限
         map.put("intervalTime", intervalTime);
         //融信有效期
-        map.put("validity", validity + "");
+        map.put("validity", validity);
         return AjaxResult.success(map);
     }