|
@@ -20,10 +20,7 @@ import javax.swing.event.ListDataEvent;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Stream;
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
@@ -67,6 +64,16 @@ public class MySQLService {
|
|
@Autowired
|
|
@Autowired
|
|
private FWMapper fwMapper;
|
|
private FWMapper fwMapper;
|
|
|
|
|
|
|
|
+
|
|
|
|
+ public static Date getMonthDay(Date date, Integer month) {
|
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
|
+ cal.setTime(date);
|
|
|
|
+ cal.add(Calendar.MONTH, month);
|
|
|
|
+ Date result = cal.getTime();
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 项目表 数据匹配
|
|
* 项目表 数据匹配
|
|
*/
|
|
*/
|
|
@@ -233,7 +240,7 @@ public class MySQLService {
|
|
|
|
|
|
List<Bxmxy> xmxyList = bxmxyMapper.selectFromBxmxy();
|
|
List<Bxmxy> xmxyList = bxmxyMapper.selectFromBxmxy();
|
|
|
|
|
|
- System.out.println("查询出项目协议信息共"+ xmxyList.size() + "条");
|
|
|
|
|
|
+ System.out.println("查询出项目协议信息共" + xmxyList.size() + "条");
|
|
|
|
|
|
//查询流程信息
|
|
//查询流程信息
|
|
ApprovalFlow approvalFlow = flowMapper.selectFlowByType(1); //托管申请flowType = 1
|
|
ApprovalFlow approvalFlow = flowMapper.selectFlowByType(1); //托管申请flowType = 1
|
|
@@ -1425,14 +1432,14 @@ public class MySQLService {
|
|
StringBuffer str = new StringBuffer();
|
|
StringBuffer str = new StringBuffer();
|
|
str.append(item.getId());
|
|
str.append(item.getId());
|
|
str.append(";").append(item.getAmount());
|
|
str.append(";").append(item.getAmount());
|
|
- for (ProjectAccountTrade balance : projectBalances) {
|
|
|
|
- if (balance.getId().equals(item.getId())) {
|
|
|
|
- str.append(";").append(balance.getAmount())
|
|
|
|
- .append(";").append(item.getAmount().compareTo(balance.getAmount()))
|
|
|
|
- .append(";").append(item.getAmount().subtract(balance.getAmount()));
|
|
|
|
|
|
+ for (ProjectAccountTrade balance : projectBalances) {
|
|
|
|
+ if (balance.getId().equals(item.getId())) {
|
|
|
|
+ str.append(";").append(balance.getAmount())
|
|
|
|
+ .append(";").append(item.getAmount().compareTo(balance.getAmount()))
|
|
|
|
+ .append(";").append(item.getAmount().subtract(balance.getAmount()));
|
|
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
+ }
|
|
strs.add(str.toString());
|
|
strs.add(str.toString());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1444,26 +1451,255 @@ public class MySQLService {
|
|
*/
|
|
*/
|
|
@Transactional
|
|
@Transactional
|
|
public void contractOverdueTo() {
|
|
public void contractOverdueTo() {
|
|
|
|
+ System.out.println("===============逾期合同导入开始=================");
|
|
|
|
+
|
|
List<HtInfo> htInfoList = oracleMapper.selectYqHtInfo();
|
|
List<HtInfo> htInfoList = oracleMapper.selectYqHtInfo();
|
|
List<ContractOverdue> list = new ArrayList<>();
|
|
List<ContractOverdue> list = new ArrayList<>();
|
|
|
|
+ List<Contract> contractList = new ArrayList<>();
|
|
|
|
+ Contract contract = null;
|
|
|
|
+ Date currentDate = new Date();
|
|
|
|
+ Date date = null;
|
|
for (HtInfo yqht : htInfoList) {
|
|
for (HtInfo yqht : htInfoList) {
|
|
- //获取逾期合同
|
|
|
|
- ContractOverdue overdue = mySqlMapper.getOverdueContract(yqht.getHTBH());
|
|
|
|
|
|
+ //获取逾期合同信息
|
|
|
|
+ ContractOverdue overdue = mySqlMapper.getOverdueContractInfo(yqht.getHTBH());
|
|
if (null == overdue) {
|
|
if (null == overdue) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ //校验这些逾期合同是否是真的逾期的情况
|
|
|
|
+ ContractOverdue check = mySqlMapper.checkOverdueContractIsRealOverdue(yqht.getHTBH());
|
|
|
|
+ if (null == check) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (overdue.getContractNumber().equals("sgctys202300326")) {
|
|
|
|
+ int a = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ contract = new Contract();
|
|
//延期次数大于6次的设置成0次
|
|
//延期次数大于6次的设置成0次
|
|
|
|
+ //默认显示逾期
|
|
|
|
+ overdue.setIsOverdue(1);//逾期
|
|
overdue.setOverdueCount(yqht.getCount() > 6 ? 0 : yqht.getCount());
|
|
overdue.setOverdueCount(yqht.getCount() > 6 ? 0 : yqht.getCount());
|
|
overdue.setLoanValidity(yqht.getSdyqdate());
|
|
overdue.setLoanValidity(yqht.getSdyqdate());
|
|
overdue.setAccumulationFundValidity(yqht.getGjjyqdate());
|
|
overdue.setAccumulationFundValidity(yqht.getGjjyqdate());
|
|
- //查看是否已经交完款 交完款的 逾期设置为
|
|
|
|
- overdue.setIsOverdue(0);//逾期
|
|
|
|
|
|
+ overdue.setDelFlag(1);//正常
|
|
|
|
+ overdue.setIsExist(0);//默认期房合同
|
|
|
|
+/* 如果是 当前合同已经交存完成或者不需要交存的 设置为 删除
|
|
|
|
+ if (2 == overdue.getPaymentStatus()) {
|
|
|
|
+ overdue.setDelFlag(0);
|
|
|
|
+ overdue.setIsOverdue(1);//逾期状态为正常
|
|
|
|
+ }*/
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //查看 合同pay_way 付款方式 如果是 商贷 查看商贷逾期时间超过当前时间 设为逾期状态 公积金 查看公积金时间设超过当前时间设为 逾期状态 组合贷 有任何一个时间超过当前时间 设为逾期状态
|
|
|
|
+ if (3 == overdue.getPayWay()) {
|
|
|
|
+ //如果是没有商贷时间的 看首期款交存时间 是否超过三个月
|
|
|
|
+ if (null == overdue.getLoanValidity()) {
|
|
|
|
+ if (cn.hutool.core.date.DateUtil.compare(getMonthDay(overdue.getPaymentTime(), 3), currentDate, "yyyy-MM-dd") >= 0) {
|
|
|
|
+ overdue.setIsOverdue(0);//逾期状态为正常
|
|
|
|
+ } else {
|
|
|
|
+ overdue.setIsOverdue(1);//逾期状态为逾期
|
|
|
|
+ }
|
|
|
|
+ } else if (cn.hutool.core.date.DateUtil.compare(overdue.getLoanValidity(), currentDate, "yyyy-MM-dd") >= 0) {
|
|
|
|
+ overdue.setIsOverdue(0);//逾期状态为正常
|
|
|
|
+ } else {
|
|
|
|
+ overdue.setIsOverdue(1);//逾期状态为逾期
|
|
|
|
+ }
|
|
|
|
+ date = null != overdue.getLoanValidity() ? overdue.getLoanValidity() : overdue.getPaymentTime();
|
|
|
|
+ } else if (4 == overdue.getPayWay()) {
|
|
|
|
+ if (null == overdue.getAccumulationFundValidity()) {
|
|
|
|
+ if (cn.hutool.core.date.DateUtil.compare(getMonthDay(overdue.getPaymentTime(), 3), currentDate, "yyyy-MM-dd") >= 0) {
|
|
|
|
+ overdue.setIsOverdue(0);//逾期状态为正常
|
|
|
|
+ } else {
|
|
|
|
+ overdue.setIsOverdue(1);//逾期状态为逾期
|
|
|
|
+ }
|
|
|
|
+ } else if (cn.hutool.core.date.DateUtil.compare(overdue.getAccumulationFundValidity(), currentDate, "yyyy-MM-dd") >= 0) {
|
|
|
|
+ overdue.setIsOverdue(0);//逾期状态为正常
|
|
|
|
+ } else {
|
|
|
|
+ overdue.setIsOverdue(1);//逾期状态为逾期
|
|
|
|
+ }
|
|
|
|
+ date = null != overdue.getAccumulationFundValidity() ? overdue.getAccumulationFundValidity() : overdue.getPaymentTime();
|
|
|
|
+ } else if (5 == overdue.getPayWay()) {
|
|
|
|
+ if (null == overdue.getLoanValidity() && null == overdue.getAccumulationFundValidity()) {
|
|
|
|
+ if (cn.hutool.core.date.DateUtil.compare(getMonthDay(overdue.getPaymentTime(), 3), currentDate, "yyyy-MM-dd") >= 0) {
|
|
|
|
+ overdue.setIsOverdue(0);//逾期状态为正常
|
|
|
|
+ } else {
|
|
|
|
+ overdue.setIsOverdue(1);//逾期状态为逾期
|
|
|
|
+ }
|
|
|
|
+ } else if (null != overdue.getLoanValidity() && null != overdue.getAccumulationFundValidity()) {
|
|
|
|
+ Date selectOne = cn.hutool.core.date.DateUtil.compare(overdue.getLoanValidity(), overdue.getAccumulationFundValidity(), "yyyy-MM-dd") <= 0 ? overdue.getLoanValidity() : overdue.getAccumulationFundValidity();
|
|
|
|
+ if (cn.hutool.core.date.DateUtil.compare(selectOne, currentDate, "yyyy-MM-dd") >= 0) {
|
|
|
|
+ overdue.setIsOverdue(0);//逾期状态为正常
|
|
|
|
+ } else {
|
|
|
|
+ overdue.setIsOverdue(1);//逾期状态为逾期
|
|
|
|
+ }
|
|
|
|
+ } else if (null == overdue.getLoanValidity() && null != overdue.getAccumulationFundValidity()) {
|
|
|
|
+ if (cn.hutool.core.date.DateUtil.compare(overdue.getAccumulationFundValidity(), currentDate, "yyyy-MM-dd") >= 0) {
|
|
|
|
+ overdue.setIsOverdue(0);//逾期状态为正常
|
|
|
|
+ } else {
|
|
|
|
+ overdue.setIsOverdue(1);//逾期状态为逾期
|
|
|
|
+ }
|
|
|
|
+ } else if (null == overdue.getAccumulationFundValidity() && null != overdue.getLoanValidity()) {
|
|
|
|
+ if (cn.hutool.core.date.DateUtil.compare(overdue.getLoanValidity(), currentDate, "yyyy-MM-dd") >= 0) {
|
|
|
|
+ overdue.setIsOverdue(0);//逾期状态为正常
|
|
|
|
+ } else {
|
|
|
|
+ overdue.setIsOverdue(1);//逾期状态为逾期
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取逾期时间
|
|
|
|
+ if (null != overdue.getLoanValidity() && null != overdue.getAccumulationFundValidity()) {
|
|
|
|
+ date = cn.hutool.core.date.DateUtil.compare(overdue.getLoanValidity(), overdue.getAccumulationFundValidity(), "yyyy-MM-dd") <= 0 ? overdue.getLoanValidity() : overdue.getAccumulationFundValidity();
|
|
|
|
+ } else if (null == overdue.getLoanValidity() && null == overdue.getAccumulationFundValidity()) {
|
|
|
|
+ date = overdue.getPaymentTime();
|
|
|
|
+ } else if (null != overdue.getLoanValidity() && null == overdue.getAccumulationFundValidity()) {
|
|
|
|
+ date = overdue.getLoanValidity();
|
|
|
|
+ } else if (null != overdue.getAccumulationFundValidity() && null == overdue.getLoanValidity()) {
|
|
|
|
+ date = overdue.getAccumulationFundValidity();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ }
|
|
|
|
+ //如果是 现房合同的 删除
|
|
|
|
+ if (null != yqht.getFWTYPE() && 0 == yqht.getFWTYPE()) {
|
|
|
|
+ overdue.setIsExist(1);//现房合同
|
|
|
|
+ overdue.setDelFlag(0);//默认删除
|
|
|
|
+ overdue.setIsOverdue(0);//默认逾期状态为正常
|
|
|
|
+ }
|
|
|
|
+ contract.setId(overdue.getContractId());
|
|
|
|
+ contract.setIsOverdue(overdue.getIsOverdue());
|
|
|
|
+ contract.setPaymentTime(date);
|
|
|
|
+ contractList.add(contract);
|
|
list.add(overdue);
|
|
list.add(overdue);
|
|
}
|
|
}
|
|
|
|
|
|
- if(!list.isEmpty()){
|
|
|
|
|
|
+ //先把合同的逾期状态置0 到初始数据的时候 逾期数据跟随范哥数据库设置了值
|
|
|
|
+ mySqlMapper.updateContractSetOverdue();
|
|
|
|
+
|
|
|
|
+ if (!list.isEmpty()) {
|
|
mySqlMapper.insertBatchContractOverdue(list);
|
|
mySqlMapper.insertBatchContractOverdue(list);
|
|
|
|
+ //根据逾期合同 重置 逾期
|
|
|
|
+ mySqlMapper.updatePaymeTime(contractList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ System.out.println("===============保存逾期合同结束=================");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 更新现有合同的首次交存时间
|
|
|
|
+ */
|
|
|
|
+ @Transactional
|
|
|
|
+ public void updateContractPaymentTime() {
|
|
|
|
+ System.out.println("===============更新首期款交存时间开始=================");
|
|
|
|
+ //获取首期已交存的合同
|
|
|
|
+ List<Contract> list = mySqlMapper.getContractBySqyjc();
|
|
|
|
+ List<Contract> data = new ArrayList<>();
|
|
|
|
+ Contract item = null;
|
|
|
|
+ for (Contract contract : list) {
|
|
|
|
+ //先从 范哥库查首期交存时间
|
|
|
|
+ Date paymentTime = oracleMapper.getTradeDateByBHP_jkbh(contract.getContractNumber());
|
|
|
|
+ if (null != paymentTime) {
|
|
|
|
+ item = new Contract();
|
|
|
|
+ item.setId(contract.getId());
|
|
|
|
+ item.setPaymentTime(paymentTime);
|
|
|
|
+ data.add(item);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ //如果没有 在从自己库里查 首期交存时间
|
|
|
|
+ Date paymentTime2 = mySqlMapper.getFundTradeByContractId(contract.getId());
|
|
|
|
+ if (null != paymentTime2) {
|
|
|
|
+ item = new Contract();
|
|
|
|
+ item.setId(contract.getId());
|
|
|
|
+ item.setPaymentTime(paymentTime2);
|
|
|
|
+ data.add(item);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //处理免存的 初次按照创建时间
|
|
|
|
+ if (null != contract.getIsExempt() && 1 == contract.getIsExempt()) {
|
|
|
|
+ item = new Contract();
|
|
|
|
+ item.setId(contract.getId());
|
|
|
|
+ item.setPaymentTime(contract.getCreateTime());
|
|
|
|
+ data.add(item);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!data.isEmpty()) {
|
|
|
|
+ mySqlMapper.updatePaymeTime(data);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ System.out.println("===============更新合同首次交存时间结束,共处理:" + data.size() + "条。=================");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理 2022年07月之前的合同 处理交存状态为 1 但是贷款已经放款了的 老的合同 变为状态 为交存完成
|
|
|
|
+ */
|
|
|
|
+ public void updateOldContractPaymentStatus() {
|
|
|
|
+ System.out.println("==============更新老合同交存状态=================");
|
|
|
|
+ //获取老合同
|
|
|
|
+ List<Contract> oldContract = mySqlMapper.getOldContract();
|
|
|
|
+ List<Contract> ids = new ArrayList<>();
|
|
|
|
+ Integer status = null;
|
|
|
|
+ for (Contract oc : oldContract) {
|
|
|
|
+ status = oc.getPaymentStatus();
|
|
|
|
+ //商贷
|
|
|
|
+ if (3 == oc.getPayWay()) {
|
|
|
|
+ Integer have = mySqlMapper.checkSdJcByContractId(oc.getId());
|
|
|
|
+ oc.setPaymentStatus(null == have ? oc.getPaymentStatus() : 2);
|
|
|
|
+ }//公积金贷款
|
|
|
|
+ else if (4 == oc.getPayWay()) {
|
|
|
|
+ Integer have = mySqlMapper.checkGjjJcByContractId(oc.getId());
|
|
|
|
+ oc.setPaymentStatus(null == have ? oc.getPaymentStatus() : 2);
|
|
|
|
+ }//组合贷
|
|
|
|
+ else if (5 == oc.getPayWay()) {
|
|
|
|
+ Integer sdhave = mySqlMapper.checkSdJcByContractId(oc.getId());
|
|
|
|
+ Integer gjjhave = mySqlMapper.checkGjjJcByContractId(oc.getId());
|
|
|
|
+ oc.setPaymentStatus((null == sdhave || null == gjjhave) ? oc.getPaymentStatus() : 2);
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (status != oc.getPaymentStatus()) {
|
|
|
|
+ ids.add(oc);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!ids.isEmpty()) {
|
|
|
|
+ mySqlMapper.updatPaymentStatus(ids);
|
|
|
|
+ System.out.println("==============更新老合同交存状态" + ids.size() + "条=================");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理 合同交存首期款交存 但是没有交易的 zjjgflag = 0 的是 改成免存状态
|
|
|
|
+ * 只处理拉取合同产生新的新的交存的数据
|
|
|
|
+ */
|
|
|
|
+ public void checkFundContractChangeIsExempt() {
|
|
|
|
+ System.out.println("==============更新合同免存状态开始=================");
|
|
|
|
+ List<Map<String,Object>> contractNumbers = mySqlMapper.getFundDelflag_0();
|
|
|
|
+ List<Long> numbers = new ArrayList<>();
|
|
|
|
+ for (Map<String,Object> item : contractNumbers) {
|
|
|
|
+ if (item.get("businessNumber").toString().startsWith("ZJ")) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Integer zjjgflag = oracleMapper.getTradeCheckIsZjjgFlag_0(item.get("businessNumber").toString());
|
|
|
|
+ if (null == zjjgflag || zjjgflag == 1) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ numbers.add((Long) item.get("contractId"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(!numbers.isEmpty()){
|
|
|
|
+ mySqlMapper.updateIsExempt(numbers);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ System.out.println("==============更新合同免存状态结束,共处理:"+numbers.size()+"条=================");
|
|
}
|
|
}
|
|
}
|
|
}
|