Browse Source

完善案件进程管理,执行历史记录、详情接口开发

zhanglei
fanzongzhe 1 year ago
parent
commit
f50484663a
  1. 8
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loancaseprogress/LoanCaseProgressFeign.java
  2. 11
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loancaseprogress/LoanCaseProgressFeignFallback.java
  3. 2
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loancaseprogress/zhixing/ExecuteVo.java
  4. 33
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loancaseprogress/zhixing/ExecuteVoList.java
  5. 3
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loancaseprogress/LoanCaseProgressMapper.java
  6. 18
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loancaseprogress/LoanCaseProgressMapper.xml
  7. 11
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loancaseprogress/LoanCaseProgressRest.java
  8. 100
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loancaseprogress/LoanCaseProgressService.java
  9. 81
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentplandetails/LoanRepaymentPlanDetailsMapper.xml

8
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loancaseprogress/LoanCaseProgressFeign.java

@ -3,6 +3,7 @@ package com.yxt.anrui.riskcenter.api.loancaseprogress;
import com.yxt.anrui.riskcenter.api.loancaseprogress.jiean.JieAnVo;
import com.yxt.anrui.riskcenter.api.loancaseprogress.tingshen.ReviewVo;
import com.yxt.anrui.riskcenter.api.loancaseprogress.zhixing.ExecuteVo;
import com.yxt.anrui.riskcenter.api.loancaseprogress.zhixing.ExecuteVoList;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo;
@ -167,6 +168,13 @@ public interface LoanCaseProgressFeign {
@PostMapping("/saveEndCaseInfo")
public ResultBean saveEndCaseInfo(@RequestBody ExecuteVo dto);
@ApiOperation("查询执行历史记录列表")
@GetMapping("/getExecuteList")
public ResultBean<List<ExecuteVoList>> getExecuteList(@RequestParam("sid") String sid);
@ApiOperation("查询执行历史记录列表")
@GetMapping("/getHistoryExecuteDetail")
public ResultBean<ExecuteVo> getHistoryExecuteDetail(@RequestParam("recordSid") String recordSid);
//-------------------结案-----------------------------
@ApiOperation("结案详情")

11
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loancaseprogress/LoanCaseProgressFeignFallback.java

@ -3,6 +3,7 @@ package com.yxt.anrui.riskcenter.api.loancaseprogress;
import com.yxt.anrui.riskcenter.api.loancaseprogress.jiean.JieAnVo;
import com.yxt.anrui.riskcenter.api.loancaseprogress.tingshen.ReviewVo;
import com.yxt.anrui.riskcenter.api.loancaseprogress.zhixing.ExecuteVo;
import com.yxt.anrui.riskcenter.api.loancaseprogress.zhixing.ExecuteVoList;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo;
@ -173,6 +174,16 @@ public class LoanCaseProgressFeignFallback implements LoanCaseProgressFeign {
return null;
}
@Override
public ResultBean<List<ExecuteVoList>> getExecuteList(String sid) {
return null;
}
@Override
public ResultBean<ExecuteVo> getHistoryExecuteDetail(String recordSid) {
return null;
}
@Override
public ResultBean<JieAnVo> getEndCaseDetails(String sid) {
return null;

2
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loancaseprogress/zhixing/ExecuteVo.java

@ -11,7 +11,7 @@ import lombok.Data;
public class ExecuteVo {
private String sid;
private String recordSid; //执行记录sid
// private String recordSid; //执行记录sid
private ReadyInfo readyInfo = new ReadyInfo(); //准备执行材料
private YiZhiXingInfo yiZhiXingInfo = new YiZhiXingInfo(); //已执行立案
private CloseInfo closeInfo = new CloseInfo(); //查封、冻结财产

33
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loancaseprogress/zhixing/ExecuteVoList.java

@ -0,0 +1,33 @@
package com.yxt.anrui.riskcenter.api.loancaseprogress.zhixing;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author Fan
* @description
* @date 2024/3/5 9:20
*/
@Data
public class ExecuteVoList {
private String recordSid;
@ApiModelProperty("准备执行材料-转执行日期")
private String prepareTime;
@ApiModelProperty("已执行立案-执行立案日期")
private String executeTime;
@ApiModelProperty("已执行立案-执行案件号")
private String executeCaseNo;
@ApiModelProperty("已执行立案-执行立案金额")
private String executeMoney;
@ApiModelProperty("已执行立案-执行回款总金额")
private String executeAmountAll;
@ApiModelProperty("终止本次执行-终止日期")
private String endTime;
@ApiModelProperty("终止本次执行-终止原因")
private String endReason;
}

3
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loancaseprogress/LoanCaseProgressMapper.java

@ -10,6 +10,7 @@ import com.yxt.anrui.riskcenter.api.loancaseprogress.LoanCaseProgress;
import com.yxt.anrui.riskcenter.api.loancaseprogress.LoanCaseProgressVo;
import com.yxt.anrui.riskcenter.api.loancaseprogress.tingshen.DelegateInfo;
import com.yxt.anrui.riskcenter.api.loancaseprogress.tingshen.ShangSuApplyVo;
import com.yxt.anrui.riskcenter.api.loancaseprogress.zhixing.ExecuteVoList;
import com.yxt.anrui.riskcenter.api.loancaseprogressexecute.LoanCaseProgressExecute;
import com.yxt.anrui.riskcenter.api.loanreturnvehledger.LoanReturnVehLedger;
import org.apache.ibatis.annotations.Mapper;
@ -52,4 +53,6 @@ public interface LoanCaseProgressMapper extends BaseMapper<LoanCaseProgress> {
LoanCaseProgressExecute getExecuteDetailsBySid(@Param("sid") String sid);
LoanCaseCloseApply selCloseApplyBySid(@Param("sid") String sid);
List<ExecuteVoList> getExecuteList(@Param("sid") String sid);
}

18
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loancaseprogress/LoanCaseProgressMapper.xml

@ -110,5 +110,23 @@
resultType="com.yxt.anrui.riskcenter.api.loancasecloseapply.LoanCaseCloseApply">
SELECT * FROM loan_case_close_apply WHERE busSid = #{sid} and nodeState = '已办结'
</select>
<select id="getExecuteList"
resultType="com.yxt.anrui.riskcenter.api.loancaseprogress.zhixing.ExecuteVoList">
SELECT
sid AS recordSid,
date_format( prepareTime, '%Y-%m-%d' ) AS prepareTime,
date_format( executeTime, '%Y-%m-%d' ) AS executeTime,
executeCaseNo,
executeMoney,
executeAmountAll,
date_format( endTime, '%Y-%m-%d' ) AS endTime,
endReason
FROM
loan_case_progress_execute
WHERE
mainSid = '0a4c63e2-9f06-4840-9305-c66246e04416'
AND terminate = 1
ORDER BY endTime DESC
</select>
</mapper>

11
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loancaseprogress/LoanCaseProgressRest.java

@ -5,6 +5,7 @@ import com.yxt.anrui.riskcenter.api.loancaseprogress.*;
import com.yxt.anrui.riskcenter.api.loancaseprogress.jiean.JieAnVo;
import com.yxt.anrui.riskcenter.api.loancaseprogress.tingshen.ReviewVo;
import com.yxt.anrui.riskcenter.api.loancaseprogress.zhixing.ExecuteVo;
import com.yxt.anrui.riskcenter.api.loancaseprogress.zhixing.ExecuteVoList;
import com.yxt.anrui.riskcenter.api.loanlawsuitapply.LoanLawsuitApplyVo;
import com.yxt.anrui.riskcenter.api.loanparameter.*;
import com.yxt.common.core.query.PagerQuery;
@ -192,6 +193,16 @@ public class LoanCaseProgressRest implements LoanCaseProgressFeign {
return loanCaseProgressService.saveEndCaseInfo(dto);
}
@Override
public ResultBean<List<ExecuteVoList>> getExecuteList(String sid) {
return loanCaseProgressService.getExecuteList(sid);
}
@Override
public ResultBean<ExecuteVo> getHistoryExecuteDetail(String recordSid) {
return loanCaseProgressService.getHistoryExecuteDetail(recordSid);
}
@Override
public ResultBean<JieAnVo> getEndCaseDetails(String sid) {
return loanCaseProgressService.getEndCaseDetails(sid);

100
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loancaseprogress/LoanCaseProgressService.java

@ -2298,7 +2298,7 @@ public class LoanCaseProgressService extends MybatisBaseService<LoanCaseProgress
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if (null != execute) {
vo.setSid(execute.getMainSid());
vo.setRecordSid(execute.getSid());
// vo.setRecordSid(execute.getSid());
//准备执行材料
ReadyInfo readyInfo = new ReadyInfo();
BeanUtil.copyProperties(execute, readyInfo);
@ -2415,8 +2415,8 @@ public class LoanCaseProgressService extends MybatisBaseService<LoanCaseProgress
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String sid = dto.getSid();
ReadyInfo readyInfo = dto.getReadyInfo();
if (StringUtils.isNotBlank(dto.getRecordSid())) {
LoanCaseProgressExecute execute = loanCaseProgressExecuteService.fetchBySid(dto.getRecordSid());
LoanCaseProgressExecute execute = baseMapper.getExecuteDetailsBySid(sid);
if (execute != null) {
BeanUtil.copyProperties(readyInfo, execute);
if (StringUtils.isBlank(execute.getCaseTache())) {
execute.setCaseTacheNo("1");
@ -2467,11 +2467,11 @@ public class LoanCaseProgressService extends MybatisBaseService<LoanCaseProgress
}
}
} else {
LoanCaseProgressExecute execute = new LoanCaseProgressExecute();
BeanUtil.copyProperties(readyInfo, execute);
execute.setMainSid(sid);
execute.setCaseTacheNo("1");
execute.setCaseTache("准备执行材料");
LoanCaseProgressExecute executeEntity = new LoanCaseProgressExecute();
BeanUtil.copyProperties(readyInfo, executeEntity);
executeEntity.setMainSid(sid);
executeEntity.setCaseTacheNo("1");
executeEntity.setCaseTache("准备执行材料");
//保存附件
List<UrlQuery> filss = readyInfo.getFile();
filss.removeAll(Collections.singleton(null));
@ -2480,10 +2480,10 @@ public class LoanCaseProgressService extends MybatisBaseService<LoanCaseProgress
filesList.removeAll(Collections.singleton(null));
if (!filesList.isEmpty()) {
String files = String.join(",", filesList).replaceAll(fileUploadComponent.getUrlPrefix(), "");
execute.setPrepareFiles(files);
executeEntity.setPrepareFiles(files);
}
}
loanCaseProgressExecuteService.insert(execute);
loanCaseProgressExecuteService.insert(executeEntity);
LoanCaseProgress progress = fetchBySid(sid);
if (null != progress) {
String caseStage = progress.getCaseStageNo();
@ -2527,26 +2527,26 @@ public class LoanCaseProgressService extends MybatisBaseService<LoanCaseProgress
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
YiZhiXingInfo yiZhiXingInfo = dto.getYiZhiXingInfo();
List<ExecuteMeasureVo> executeMeasure = yiZhiXingInfo.getExecuteMeasure();
if (StringUtils.isNotBlank(dto.getRecordSid())) {
LoanCaseProgressExecute execute = loanCaseProgressExecuteService.fetchBySid(dto.getRecordSid());
BeanUtil.copyProperties(yiZhiXingInfo, execute);
if (StringUtils.isBlank(execute.getCaseTache())) {
execute.setCaseTacheNo("2");
execute.setCaseTache("已执行立案");
LoanCaseProgressExecute updateEntity = baseMapper.getExecuteDetailsBySid(sid);
if (updateEntity != null) {
BeanUtil.copyProperties(yiZhiXingInfo, updateEntity);
if (StringUtils.isBlank(updateEntity.getCaseTache())) {
updateEntity.setCaseTacheNo("2");
updateEntity.setCaseTache("已执行立案");
} else {
String caseTacheNo = execute.getCaseTacheNo();
String caseTacheNo = updateEntity.getCaseTacheNo();
int i = Integer.parseInt(caseTacheNo);
if (i < 2) {
execute.setCaseTacheNo("2");
execute.setCaseTache("已执行立案");
updateEntity.setCaseTacheNo("2");
updateEntity.setCaseTache("已执行立案");
}
}
loanCaseProgressExecuteService.updateById(execute);
loanCaseProgressExecuteMeasureService.delByMainSid(dto.getRecordSid());
loanCaseProgressExecuteService.updateById(updateEntity);
loanCaseProgressExecuteMeasureService.delByMainSid(updateEntity.getSid());
if (!executeMeasure.isEmpty()) {
for (ExecuteMeasureVo measureVo : executeMeasure) {
LoanCaseProgressExecuteMeasure measure = new LoanCaseProgressExecuteMeasure();
measure.setMainSid(execute.getSid());
measure.setMainSid(updateEntity.getSid());
BeanUtil.copyProperties(measureVo, measure);
//保存附件
List<UrlQuery> filss = measureVo.getFile();
@ -2691,9 +2691,9 @@ public class LoanCaseProgressService extends MybatisBaseService<LoanCaseProgress
ResultBean rb = ResultBean.fireFail();
String sid = dto.getSid();
PromiseInfo promiseInfo = dto.getPromiseInfo();
if (StringUtils.isNotBlank(dto.getRecordSid())) {
LoanCaseProgressExecute execute = loanCaseProgressExecuteService.fetchBySid(dto.getRecordSid());
BeanUtil.copyProperties(promiseInfo, execute);
LoanCaseProgressExecute updateEntity = baseMapper.getExecuteDetailsBySid(sid);
if (null != updateEntity) {
BeanUtil.copyProperties(promiseInfo, updateEntity);
//保存附件
List<UrlQuery> filss = promiseInfo.getFile();
filss.removeAll(Collections.singleton(null));
@ -2702,10 +2702,10 @@ public class LoanCaseProgressService extends MybatisBaseService<LoanCaseProgress
filesList.removeAll(Collections.singleton(null));
if (!filesList.isEmpty()) {
String files = String.join(",", filesList).replaceAll(fileUploadComponent.getUrlPrefix(), "");
execute.setPromiseFiles(files);
updateEntity.setPromiseFiles(files);
}
}
loanCaseProgressExecuteService.updateById(execute);
loanCaseProgressExecuteService.updateById(updateEntity);
} else {
LoanCaseProgressExecute execute = new LoanCaseProgressExecute();
BeanUtil.copyProperties(promiseInfo, execute);
@ -2731,9 +2731,9 @@ public class LoanCaseProgressService extends MybatisBaseService<LoanCaseProgress
ResultBean rb = ResultBean.fireFail();
String sid = dto.getSid();
CloseInfo closeInfo = dto.getCloseInfo();
if (StringUtils.isNotBlank(dto.getRecordSid())) {
LoanCaseProgressExecute execute = loanCaseProgressExecuteService.fetchBySid(dto.getRecordSid());
BeanUtil.copyProperties(closeInfo, execute);
LoanCaseProgressExecute updateEntity = baseMapper.getExecuteDetailsBySid(sid);
if (null != updateEntity) {
BeanUtil.copyProperties(closeInfo, updateEntity);
//保存附件
List<UrlQuery> filss = closeInfo.getFile();
filss.removeAll(Collections.singleton(null));
@ -2742,10 +2742,10 @@ public class LoanCaseProgressService extends MybatisBaseService<LoanCaseProgress
filesList.removeAll(Collections.singleton(null));
if (!filesList.isEmpty()) {
String files = String.join(",", filesList).replaceAll(fileUploadComponent.getUrlPrefix(), "");
execute.setCloseFiles(files);
updateEntity.setCloseFiles(files);
}
}
loanCaseProgressExecuteService.updateById(execute);
loanCaseProgressExecuteService.updateById(updateEntity);
} else {
LoanCaseProgressExecute execute = new LoanCaseProgressExecute();
BeanUtil.copyProperties(closeInfo, execute);
@ -2770,13 +2770,11 @@ public class LoanCaseProgressService extends MybatisBaseService<LoanCaseProgress
@Transactional(rollbackFor = Exception.class)
public ResultBean saveEndCaseInfo(ExecuteVo dto) {
ResultBean rb = ResultBean.fireFail();
if (StringUtils.isNotBlank(dto.getRecordSid())) {
LoanCaseProgressExecute updateEntity = baseMapper.getExecuteDetailsBySid(dto.getSid());
if (null != updateEntity) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String sid = dto.getSid();
String recordSid = dto.getRecordSid();
EndCaseInfo endCaseInfo = dto.getEndCaseInfo();
LoanCaseProgressExecute execute = loanCaseProgressExecuteService.fetchBySid(recordSid);
BeanUtil.copyProperties(endCaseInfo, execute);
BeanUtil.copyProperties(endCaseInfo, updateEntity);
//保存附件
List<UrlQuery> filss = endCaseInfo.getFile();
filss.removeAll(Collections.singleton(null));
@ -2785,17 +2783,17 @@ public class LoanCaseProgressService extends MybatisBaseService<LoanCaseProgress
filesList.removeAll(Collections.singleton(null));
if (!filesList.isEmpty()) {
String files = String.join(",", filesList).replaceAll(fileUploadComponent.getUrlPrefix(), "");
execute.setEndFiles(files);
updateEntity.setEndFiles(files);
}
}
execute.setTerminate(1);
loanCaseProgressExecuteService.updateById(execute);
updateEntity.setTerminate(1);
loanCaseProgressExecuteService.updateById(updateEntity);
LoanCaseProgressExecute newExecute = new LoanCaseProgressExecute();
newExecute.setMainSid(sid);
newExecute.setMainSid(dto.getSid());
newExecute.setCaseTache("准备执行材料");
newExecute.setCaseTacheNo("1");
loanCaseProgressExecuteService.insert(newExecute);
LoanCaseProgress progress = fetchBySid(sid);
LoanCaseProgress progress = fetchBySid(dto.getSid());
if (null != progress) {
String caseStage = progress.getCaseStageNo();
int i = Integer.parseInt(caseStage);
@ -2989,4 +2987,22 @@ public class LoanCaseProgressService extends MybatisBaseService<LoanCaseProgress
}
return rb.success();
}
public ResultBean<List<ExecuteVoList>> getExecuteList(String sid) {
ResultBean rb = ResultBean.fireFail();
List<ExecuteVoList> voLists = baseMapper.getExecuteList(sid);
return rb.success().setData(voLists);
}
public ResultBean<ExecuteVo> getHistoryExecuteDetail(String recordSid) {
ResultBean rb = ResultBean.fireFail();
LoanCaseProgressExecute loanCaseProgressExecute = loanCaseProgressExecuteService.fetchBySid(recordSid);
if (null != loanCaseProgressExecute) {
ExecuteVo executeVo = returnExecuteVo(loanCaseProgressExecute);
return rb.success().setData(executeVo);
} else {
ExecuteVo vo = new ExecuteVo();
return rb.success().setData(vo);
}
}
}

81
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentplandetails/LoanRepaymentPlanDetailsMapper.xml

@ -141,23 +141,30 @@
'1'
END AS overdueState
FROM (
SELECT a.*
SELECT a.*,
(SELECT (fjj.reveivableMoney - fjj.m)
FROM (SELECT IFNULL((SELECT SUM(subscriptionMoney)
FROM anrui_fin.fin_selected_receivables_detailed as s
WHERE s.auditState = '3'
and s.receivablesSid = fj.sid), 0) as m,
fj.*
FROM (SELECT j.busSid, j.sid, j.reveivableMoney
FROM anrui_fin.fin_uncollected_receivables_detailed_jr as j
WHERE j.payCostTitleKey = '006') as fj) as fjj
WHERE fjj.busSid = a.sid) as fund
FROM (
SELECT pd.dueDate,
pd.useOrgSid,
pd.sid,
IFNULL(pd.fund, 0) AS fund,
pd.dueMoney,
pd.overdue,
t.repaidMoney,
t.outstandingMoney,
-- IFNULL(v.bankBeInter, 0) AS bankBeInter,
IFNULL(pd.paymentInterest, 0) AS bankBeInter,
pd.overdue AS dueOverdue,
pd.updateTime AS updateDate
FROM loan_repayment_plan_details AS pd
LEFT JOIN anrui_buscenter.bus_sales_order AS s ON s.sid = pd.salesOrderSid
-- LEFT JOIN loan_be_padsincere_veh AS v ON v.saleVehSid = pd.busVinSid
LEFT JOIN (
SELECT p.sid,
IFNULL((
@ -262,7 +269,17 @@
b.busVinSid,
b.salesOrderSid
FROM (
SELECT a.*
SELECT a.*,
(SELECT (fjj.reveivableMoney - fjj.m)
FROM (SELECT IFNULL((SELECT SUM(subscriptionMoney)
FROM anrui_fin.fin_selected_receivables_detailed as s
WHERE s.auditState = '3'
and s.receivablesSid = fj.sid), 0) as m,
fj.*
FROM (SELECT j.busSid, j.sid, j.reveivableMoney
FROM anrui_fin.fin_uncollected_receivables_detailed_jr as j
WHERE j.payCostTitleKey = '006') as fj) as fjj
WHERE fjj.busSid = a.sid) as fund
FROM (
SELECT pd.loanContractNo,
pd.oweState,
@ -271,19 +288,16 @@
pd.deptSid,
pd.busVinSid,
pd.sid,
IFNULL(pd.fund, 0) AS fund,
pd.dueMoney,
pd.overdue,
pd.salesOrderSid,
t.repaidMoney,
t.outstandingMoney,
-- IFNULL( v.bankBeInter, 0 ) AS bankBeInter,
IFNULL(pd.paymentInterest, 0) AS bankBeInter,
pd.overdue AS dueOverdue,
pd.updateTime AS updateDate
FROM loan_repayment_plan_details AS pd
LEFT JOIN anrui_buscenter.bus_sales_order AS s ON s.sid = pd.salesOrderSid
-- LEFT JOIN loan_be_padsincere_veh AS v ON v.saleVehSid = pd.busVinSid
LEFT JOIN (
SELECT p.sid,
IFNULL((
@ -319,29 +333,40 @@
</select>
<select id="selForPushBuckleVoucher" resultType="java.lang.String">
SELECT c.overdueState
FROM (SELECT b.sid AS planSid,
FROM (
SELECT b.sid AS planSid,
b.paymentMoney,
b.dueDate,
b.updateDate,
b.fund,
b.bankBeInter,
CASE
WHEN (b.outstandingMoney + b.bankBeInter + b.fund) > 0
AND b.dueDate &lt;= b.updateDate
AND IFNULL(b.paymentMoney, 0) > 0
THEN '0'
AND b.dueDate &lt;= b.updateDate AND IFNULL(b.paymentMoney, 0) > 0 THEN
'0'
WHEN (b.outstandingMoney + b.bankBeInter + b.fund) > 0
AND b.dueDate &lt;= b.updateDate
AND IFNULL(b.paymentMoney, 0) &lt;= 0
THEN '1'
AND IFNULL(b.paymentMoney, 0) &lt;= 0 THEN
'1'
ELSE '2'
END AS overdueState,
-- 0逾期已垫款1逾期未垫款2正常
END AS overdueState,-- 0逾期已垫款1逾期未垫款2正常
b.outstandingMoney,
b.useOrgSid,
b.deptSid,
b.busVinSid,
b.salesOrderSid
FROM (
SELECT a.*
SELECT a.*,
(SELECT (fjj.reveivableMoney - fjj.m)
FROM (SELECT IFNULL((SELECT SUM(subscriptionMoney)
FROM anrui_fin.fin_selected_receivables_detailed as s
WHERE s.auditState = '3'
and s.receivablesSid = fj.sid), 0) as m,
fj.*
FROM (SELECT j.busSid, j.sid, j.reveivableMoney
FROM anrui_fin.fin_uncollected_receivables_detailed_jr as j
WHERE j.payCostTitleKey = '006') as fj) as fjj
WHERE fjj.busSid = a.sid) as fund
FROM (
SELECT pd.paymentMoney,
pd.oweState,
@ -350,19 +375,15 @@
pd.deptSid,
pd.busVinSid,
pd.sid,
IFNULL(pd.fund, 0) AS fund,
pd.dueMoney,
pd.overdue,
pd.salesOrderSid,
t.repaidMoney,
t.outstandingMoney,
-- IFNULL( v.bankBeInter, 0 ) AS bankBeInter,
IFNULL(pd.paymentInterest, 0) AS bankBeInter,
pd.overdue AS dueOverdue,
pd.updateTime AS updateDate
FROM loan_repayment_plan_details AS pd
LEFT JOIN anrui_buscenter.bus_sales_order AS s ON s.sid = pd.salesOrderSid
-- LEFT JOIN loan_be_padsincere_veh AS v ON v.saleVehSid = pd.busVinSid
LEFT JOIN (
SELECT p.sid,
IFNULL((
@ -390,7 +411,8 @@
FROM loan_repayment_plan_details AS p
) AS t ON pd.sid = t.sid
) AS a
) AS b) as c
) AS b
) AS c
WHERE c.planSid = #{planDetailSid}
</select>
<select id="getMainBankName" resultType="java.lang.String">
@ -434,7 +456,17 @@
b.busVinSid,
b.salesOrderSid
FROM (
SELECT a.*
SELECT a.*,
(SELECT (fjj.reveivableMoney - fjj.m)
FROM (SELECT IFNULL((SELECT SUM(subscriptionMoney)
FROM anrui_fin.fin_selected_receivables_detailed as s
WHERE s.auditState = '3'
and s.receivablesSid = fj.sid), 0) as m,
fj.*
FROM (SELECT j.busSid, j.sid, j.reveivableMoney
FROM anrui_fin.fin_uncollected_receivables_detailed_jr as j
WHERE j.payCostTitleKey = '006') as fj) as fjj
WHERE fjj.busSid = a.sid) as fund
FROM (
SELECT pd.paymentMoney,
pd.oweState,
@ -443,19 +475,16 @@
pd.deptSid,
pd.busVinSid,
pd.sid,
IFNULL(pd.fund, 0) AS fund,
pd.dueMoney,
pd.overdue,
pd.salesOrderSid,
t.repaidMoney,
t.outstandingMoney,
-- IFNULL( v.bankBeInter, 0 ) AS bankBeInter,
IFNULL(pd.paymentInterest, 0) AS bankBeInter,
pd.overdue AS dueOverdue,
pd.updateTime AS updateDate
FROM loan_repayment_plan_details AS pd
LEFT JOIN anrui_buscenter.bus_sales_order AS s ON s.sid = pd.salesOrderSid
-- LEFT JOIN loan_be_padsincere_veh AS v ON v.saleVehSid = pd.busVinSid
LEFT JOIN (
SELECT p.sid,
IFNULL((

Loading…
Cancel
Save