|
@@ -9,6 +9,7 @@ import com.huyi.service.constant.FileConstants;
|
|
|
import com.huyi.service.credit.service.OwnCreditService;
|
|
|
import com.huyi.service.util.DocumentConstant;
|
|
|
import com.keao.tianhu.core.util.AmtUtil;
|
|
|
+import com.tianhu.common.core.exception.BaseException;
|
|
|
import com.tianhu.common.core.utils.CommonUtil;
|
|
|
import com.tianhu.common.core.utils.DateUtils;
|
|
|
import com.tianhu.common.core.utils.pdf.WordPdfUtil;
|
|
@@ -59,6 +60,9 @@ public class CreditHandleController extends BaseController {
|
|
|
//产品和合同的关系表
|
|
|
@Autowired
|
|
|
private IZcFinanceProConRelService proConRelService;
|
|
|
+ //产品和合同的关系表
|
|
|
+ @Autowired
|
|
|
+ private IZcFinanceProductService financeProductService;
|
|
|
//合同服务类
|
|
|
@Autowired
|
|
|
private IZcFinanceContractService contractService;
|
|
@@ -175,23 +179,42 @@ public class CreditHandleController extends BaseController {
|
|
|
String zfiExpireDate = CommonUtil.objToString(map.get("zfiExpireDate"));
|
|
|
//签发有效期
|
|
|
String zfiEffectiveDate = CommonUtil.objToString(map.get("zfiEffectiveDate"));
|
|
|
+ //最短账期
|
|
|
+ String zfpShortestPeriod = CommonUtil.objToString(map.get("zfpShortestPeriod"));
|
|
|
if(CommonUtil.isEmpty(zfiEffectiveDate)){
|
|
|
throw new Exception("请选择签发有效期");
|
|
|
}
|
|
|
if(CommonUtil.isEmpty(zfiExpireDate)){
|
|
|
throw new Exception("请选择承诺付款日");
|
|
|
}
|
|
|
+ Date date =null;
|
|
|
+ Date signDate = null;
|
|
|
if(!CommonUtil.isEmpty(zfiEffectiveDate)){
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date date = simpleDateFormat.parse(zfiEffectiveDate);
|
|
|
+ date = simpleDateFormat.parse(zfiEffectiveDate);
|
|
|
financeInf.setZfiEffectiveDate(date);
|
|
|
|
|
|
}
|
|
|
if(!CommonUtil.isEmpty(zfiExpireDate)){
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date signDate = simpleDateFormat.parse(zfiExpireDate);
|
|
|
+ signDate = simpleDateFormat.parse(zfiExpireDate);
|
|
|
financeInf.setZfiExpireDate(signDate);
|
|
|
}
|
|
|
+ if(!CommonUtil.isEmpty(zfiExpireDate)&&!CommonUtil.isEmpty(zfiEffectiveDate)) {
|
|
|
+ //取得指定时间间隔后的系统时间
|
|
|
+ GregorianCalendar cal = new GregorianCalendar();
|
|
|
+ cal.setTime(date);
|
|
|
+ cal.add(Calendar.DATE, Integer.valueOf(zfpShortestPeriod));
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ System.out.println("签发有效期=========>" + formatter.format(date));
|
|
|
+ System.out.println("承诺付款日=========>" + formatter.format(signDate));
|
|
|
+ System.out.println("最短账期=========>" + Integer.valueOf(zfpShortestPeriod));
|
|
|
+ System.out.println("修改日期=========>" + cal.getTime());
|
|
|
+ System.out.println("当前时间=========>" + new Date());
|
|
|
+ if (formatter.format(cal.getTime()).compareTo(formatter.format(signDate)) > 0) {
|
|
|
+ throw new BaseException("签发有效期不可大于承诺付款日减最短账期!");
|
|
|
+ }
|
|
|
+ }
|
|
|
//签发金额
|
|
|
financeInf.setZfiAmount(zfiAmount);
|
|
|
financeInf.setUpdateTime(createTime);
|
|
@@ -203,14 +226,44 @@ public class CreditHandleController extends BaseController {
|
|
|
financeInf.setZfiId(zfiId);
|
|
|
//承诺付款日
|
|
|
String zfiExpireDate = CommonUtil.objToString(map.get("zfiExpireDate"));
|
|
|
+ //签发有效期
|
|
|
+ String zfiEffectiveDate = CommonUtil.objToString(map.get("zfiEffectiveDate"));
|
|
|
+ //最短账期
|
|
|
+ ZcFinanceInf finances = financeInfService.getById(zfiId);
|
|
|
+ ZcFinanceProduct prodct = financeProductService.getById(finances.getZfiProductId());
|
|
|
+ String zfpShortestPeriod = prodct.getZfpShortestPeriod();
|
|
|
+ Date date =null;
|
|
|
+ Date signDate = null;
|
|
|
+ if(!CommonUtil.isEmpty(zfiEffectiveDate)){
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ date = simpleDateFormat.parse(zfiEffectiveDate);
|
|
|
+ financeInf.setZfiEffectiveDate(date);
|
|
|
+
|
|
|
+ }
|
|
|
if(CommonUtil.isEmpty(zfiExpireDate)){
|
|
|
throw new Exception("请选择承诺付款日");
|
|
|
}
|
|
|
if(!CommonUtil.isEmpty(zfiExpireDate)){
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date signDate = simpleDateFormat.parse(zfiExpireDate);
|
|
|
+ signDate = simpleDateFormat.parse(zfiExpireDate);
|
|
|
financeInf.setZfiExpireDate(signDate);
|
|
|
}
|
|
|
+
|
|
|
+ if(!CommonUtil.isEmpty(zfiExpireDate)&&!CommonUtil.isEmpty(zfiEffectiveDate)) {
|
|
|
+ //取得指定时间间隔后的系统时间
|
|
|
+ GregorianCalendar cal = new GregorianCalendar();
|
|
|
+ cal.setTime(date);
|
|
|
+ cal.add(Calendar.DATE, Integer.valueOf(zfpShortestPeriod));
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ System.out.println("签发有效期=========>" + formatter.format(date));
|
|
|
+ System.out.println("承诺付款日=========>" + formatter.format(signDate));
|
|
|
+ System.out.println("最短账期=========>" + Integer.valueOf(zfpShortestPeriod));
|
|
|
+ System.out.println("修改日期=========>" + cal.getTime());
|
|
|
+ System.out.println("当前时间=========>" + new Date());
|
|
|
+ if (formatter.format(cal.getTime()).compareTo(formatter.format(signDate)) > 0) {
|
|
|
+ throw new BaseException("签发有效期不可大于承诺付款日减最短账期!");
|
|
|
+ }
|
|
|
+ }
|
|
|
//签发金额
|
|
|
financeInf.setZfiAmount(zfiAmount);
|
|
|
financeInf.setUpdateTime(createTime);
|