|
@@ -1,31 +1,17 @@
|
|
|
package com.huyi.service.common.financeInf.controller;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.huyi.service.base.entity.*;
|
|
|
import com.huyi.service.base.service.*;
|
|
|
import com.huyi.service.common.financeInf.service.FinanceInfService;
|
|
|
-import com.huyi.service.credit.service.OwnCreditService;
|
|
|
-import com.keao.tianhu.starter.mybatis.plus.entity.QueryRequest;
|
|
|
-import com.tianhu.common.core.constant.SalaryConstants;
|
|
|
import com.tianhu.common.core.domain.R;
|
|
|
-import com.tianhu.common.core.utils.AmtUtil;
|
|
|
-import com.tianhu.common.core.utils.CommonUtil;
|
|
|
-import com.tianhu.common.core.utils.DateUtils;
|
|
|
-import com.tianhu.common.core.utils.IdUtils;
|
|
|
+import com.tianhu.common.core.utils.*;
|
|
|
import com.tianhu.common.core.web.controller.BaseController;
|
|
|
-import com.tianhu.common.core.web.domain.AjaxResult;
|
|
|
-import com.tianhu.common.log.annotation.Log;
|
|
|
-import com.tianhu.common.log.enums.BusinessType;
|
|
|
-import com.tianhu.common.security.annotation.PreAuthorize;
|
|
|
import com.tianhu.common.security.service.TokenService;
|
|
|
import com.tianhu.system.api.domain.SysUser;
|
|
|
import com.tianhu.system.api.model.LoginUser;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
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.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
@@ -53,7 +39,7 @@ public class FinanceInfController extends BaseController {
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/list/{zfrFinanceId}")
|
|
|
- public R list(@PathVariable String zfrFinanceId) {
|
|
|
+ public R list(@PathVariable String zfrFinanceId) throws Exception{
|
|
|
//查询当前操作员
|
|
|
LoginUser userInfo = tokenService.getLoginUser();
|
|
|
SysUser user = userInfo.getSysUser();
|
|
@@ -63,11 +49,61 @@ public class FinanceInfController extends BaseController {
|
|
|
map.put("companyId",companyId);
|
|
|
map.put("zfiId",zfrFinanceId);
|
|
|
List<Map> list = financeInfService.selectFinanceInfList(map);
|
|
|
+ //申请融资用
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ Map<String,String> m = (Map<String, String>) list.get(i);
|
|
|
+ //当前时间
|
|
|
+ Date nowDate = DateUtils.getNowDate();
|
|
|
+ //承诺付款日期
|
|
|
+ String zfiExpireDate = CommonUtil.objToString(m.get("zfiExpireDate"));
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//注意月份是MM
|
|
|
+ Date expireDate = simpleDateFormat.parse("zfiExpireDate");
|
|
|
+ /*预计融资期限:申请日期(当前日期) 到 承诺付款日期 间隔天数*/
|
|
|
+ String term = DateUtils.getDatePoor(expireDate,nowDate);
|
|
|
+ term = StringUtils.substringBefore(term,"天");
|
|
|
+ if (term.indexOf("-") != -1){
|
|
|
+ term = StringUtils.substringAfter(term,"-");
|
|
|
+ }
|
|
|
+ /*预计融资成本:融资金额*融资费率*预计融资期限 / 365 + 融资金额 * 服务费率*/
|
|
|
+ //申请金额(融资金额)
|
|
|
+ String zfiAmount = m.get("zfiAmount");
|
|
|
+ //利率(融资费率)
|
|
|
+ String zfpcrRate = m.get("zfpcrRate");
|
|
|
+ //平台服务费收取费率(服务费率)
|
|
|
+ String zfpcrChargeRate = m.get("zfpcrChargeRate");
|
|
|
+ //融资金额 * 服务费率
|
|
|
+ String money = AmtUtil.multiply(zfiAmount,zfpcrChargeRate,2);
|
|
|
+ //预计融资成本
|
|
|
+ String cost = AmtUtil.multiply(zfiAmount,zfpcrRate,2);
|
|
|
+ cost = AmtUtil.multiply(cost,term,2);
|
|
|
+ cost = AmtUtil.divide(cost,"365");
|
|
|
+ cost = AmtUtil.add(cost,money,2);
|
|
|
+ /*预计净融资额:融资金额 – 预计融资成本*/
|
|
|
+ String amount = AmtUtil.subtract(zfiAmount,cost,2);
|
|
|
+ //预计融资期限
|
|
|
+ m.put("term",term);
|
|
|
+ //预计融资成本
|
|
|
+ m.put("cost",cost);
|
|
|
+ //预计净融资额
|
|
|
+ m.put("amount",amount);
|
|
|
+ }
|
|
|
// LambdaQueryWrapper<ZcFinanceInf> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
// queryWrapper.eq(ZcFinanceInf::getZfiSupplierId,companyId);
|
|
|
// queryWrapper.eq(ZcFinanceInf::getZfiStatus,"02");
|
|
|
// List<ZcFinanceInf> list = iZcFinanceInfService.findZcFinanceInfs(queryWrapper);
|
|
|
return R.ok(list);
|
|
|
}
|
|
|
-
|
|
|
+ public static void main(String args[]) throws Exception{
|
|
|
+ //当前时间
|
|
|
+ Date nowDate = DateUtils.getNowDate();
|
|
|
+ //承诺付款日期
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//注意月份是MM
|
|
|
+ Date expireDate = simpleDateFormat.parse("2021-10-07 12:23:33");
|
|
|
+ String term = DateUtils.getDatePoor(nowDate,expireDate);
|
|
|
+ term = StringUtils.substringBefore(term,"天");
|
|
|
+ if (term.indexOf("-") != -1){
|
|
|
+ term = StringUtils.substringAfter(term,"-");
|
|
|
+ }
|
|
|
+ System.out.println(term);
|
|
|
+ }
|
|
|
}
|