122 lines
3.5 KiB
Java
122 lines
3.5 KiB
Java
package com.tenwa.reckon.executor;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import com.tenwa.app.manage.qiyuesuo.v2.ContractSignVtwoUtils;
|
|
import jbo.app.tenwa.calc.LC_CALC_CONDITION;
|
|
import jbo.app.tenwa.calc.LC_RENT_INCOME;
|
|
import jbo.app.tenwa.calc.LC_RENT_PLAN;
|
|
import jbo.com.tenwa.lease.comm.LC_CAR_DISPOSE;
|
|
import jbo.com.tenwa.lease.comm.LC_OCCUPY_RENT_LIST;
|
|
|
|
import com.amarsoft.app.awe.config.InitDBType;
|
|
import com.amarsoft.are.jbo.BizObject;
|
|
import com.amarsoft.are.jbo.BizObjectManager;
|
|
import com.amarsoft.are.jbo.BizObjectQuery;
|
|
import com.amarsoft.are.jbo.JBOException;
|
|
import com.amarsoft.are.jbo.JBOFactory;
|
|
import com.amarsoft.are.jbo.JBOTransaction;
|
|
import com.amarsoft.are.util.json.JSONEncoder;
|
|
import com.amarsoft.are.util.json.JSONObject;
|
|
import com.tenwa.reckon.util.Conn;
|
|
import com.tenwa.reckon.util.DateUtil;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
/**
|
|
* 合同测算校验
|
|
* @author tenwapc
|
|
*
|
|
*/
|
|
public class RentCalculateExecutor {
|
|
private static final Logger logger = LoggerFactory.getLogger(RentCalculateExecutor.class);
|
|
private String contractId;
|
|
private String startList;
|
|
private String paydayAdjust;
|
|
private String paymentnumber;
|
|
private String planId;
|
|
|
|
/**
|
|
* 校验中止日期是否合法
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public String checkPaydayAdjust() throws Exception {
|
|
JSONObject jsonObject = JSONObject.createObject();
|
|
JBOTransaction tx=null;
|
|
try{
|
|
tx=JBOFactory.createJBOTransaction();
|
|
String checkSql = " select min(plan_date) mindate from LC_RENT_PLAN where contract_id = ? and payment_number=?";
|
|
Conn conn = new Conn(tx);
|
|
List<Map<String, String>> results = conn.executeQuery(checkSql, this.contractId,this.getPaymentnumber());
|
|
String mindate = results.get(0).get("mindate");
|
|
logger.info("20211104 校验中止日期是否合法 mindate= " + mindate);
|
|
logger.info("20211104 校验中止日期是否合法 paydayAdjust= " + this.paydayAdjust);
|
|
//截取最后两位 字符串
|
|
String minDateStr = mindate.substring(mindate.lastIndexOf("/") + 1);
|
|
String paydayAdjustStr = this.paydayAdjust.substring(this.paydayAdjust.lastIndexOf("/") + 1);
|
|
logger.info("20211104 校验中止日期是否合法 minDateStr= " + minDateStr);
|
|
logger.info("20211104 校验中止日期是否合法 paydayAdjustStr= " + paydayAdjustStr);
|
|
if(minDateStr.equals(paydayAdjustStr)){
|
|
jsonObject.appendElement("result", "false");
|
|
jsonObject.appendElement("msg","约定终止日不能落在已汇款的租金计划的区间段!!!");
|
|
}else {
|
|
jsonObject.appendElement("result", "true");
|
|
}
|
|
}catch(Exception e){
|
|
tx.rollback();
|
|
e.printStackTrace();
|
|
jsonObject.appendElement("result", "false");
|
|
jsonObject.appendElement("msg","服务器正忙,请稍后再试!!!");
|
|
}finally{
|
|
tx.commit();
|
|
}
|
|
return JSONEncoder.encode(jsonObject);
|
|
}
|
|
|
|
public String getContractId() {
|
|
return contractId;
|
|
}
|
|
|
|
public void setContractId(String contractId) {
|
|
this.contractId = contractId;
|
|
}
|
|
|
|
|
|
public String getStartList() {
|
|
return startList;
|
|
}
|
|
|
|
public void setStartList(String startList) {
|
|
this.startList = startList;
|
|
}
|
|
|
|
public String getPaydayAdjust() {
|
|
return paydayAdjust;
|
|
}
|
|
|
|
public void setPaydayAdjust(String paydayAdjust) {
|
|
this.paydayAdjust = paydayAdjust;
|
|
}
|
|
|
|
public String getPaymentnumber() {
|
|
return paymentnumber;
|
|
}
|
|
|
|
public void setPaymentnumber(String paymentnumber) {
|
|
this.paymentnumber = paymentnumber;
|
|
}
|
|
|
|
public String getPlanId() {
|
|
return planId;
|
|
}
|
|
|
|
public void setPlanId(String planId) {
|
|
this.planId = planId;
|
|
}
|
|
|
|
}
|