Browse Source

交回车辆二次销售部分接口

master
dimengzhe 1 year ago
parent
commit
4aad0c3b4c
  1. 4
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loansecondarysalesapply/LoanSecondarySalesApplyDto.java
  2. 7
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanreturninboundapply/LoanReturnInboundApplyMapper.xml
  3. 1
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanreturninboundapply/LoanReturnInboundApplyService.java
  4. 2
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanreturnvehledger/LoanReturnVehLedgerMapper.java
  5. 10
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanreturnvehledger/LoanReturnVehLedgerMapper.xml
  6. 4
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanreturnvehledger/LoanReturnVehLedgerService.java
  7. 114
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansecondarysalesapply/LoanSecondarySalesApplyService.java
  8. 25
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansecondarysalescost/LoanSecondarySalesCostService.java
  9. 14
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansecondarysalesveh/LoanSecondarySalesVehService.java

4
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loansecondarysalesapply/LoanSecondarySalesApplyDto.java

@ -53,7 +53,7 @@ public class LoanSecondarySalesApplyDto {
@ApiModelProperty("其他车况说明")
private String illustrate;
@ApiModelProperty("车辆照片")
private List<UrlQuery> fileList = new ArrayList<>();
private List<UrlQuery> filesList = new ArrayList<>();
@ApiModelProperty("已还金额")
private String alRepaidMoney;
@ApiModelProperty("当前逾期金额")
@ -78,4 +78,6 @@ public class LoanSecondarySalesApplyDto {
private String sid;
private String userSid;
private String orgPath;
}

7
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanreturninboundapply/LoanReturnInboundApplyMapper.xml

@ -144,7 +144,9 @@
la.beOverdueMoneyAndPeriod,
la.busVinSid,
la.files,
la.remarks
la.remarks,
la.useOrgSid,
la.useOrgName
from loan_return_inbound_apply la
where sid = #{sid}
</select>
@ -202,7 +204,8 @@
la.files,
la.remarks,
la.procInstId,
la.taskId,la.orgSidPath orgPath
la.taskId,
la.orgSidPath orgPath
from loan_return_inbound_apply la
where sid = #{sid}
</select>

1
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanreturninboundapply/LoanReturnInboundApplyService.java

@ -307,6 +307,7 @@ public class LoanReturnInboundApplyService extends MybatisBaseService<LoanReturn
if (loanReturnInboundApply == null) {
return rb.setMsg("该申请不存在");
}
dto.setUserSid(loanReturnInboundApply.getUseOrgSid());
BeanUtil.copyProperties(dto, loanReturnInboundApply, "sid");
List<UrlQuery> filss = dto.getFilesList();
if (!filss.isEmpty()) {

2
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanreturnvehledger/LoanReturnVehLedgerMapper.java

@ -23,4 +23,6 @@ public interface LoanReturnVehLedgerMapper extends BaseMapper<LoanReturnVehLedge
BusSalesOrderVehicle selectBusVinSid(String busVinSid);
IPage<LoanReturnVehLedgerVo> selectPageVo(IPage<LoanReturnVehLedger> page, @Param(Constants.WRAPPER) QueryWrapper<LoanReturnVehLedgerQuery> qw);
LoanReturnVehLedger selectByPSid(String sid);
}

10
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanreturnvehledger/LoanReturnVehLedgerMapper.xml

@ -27,11 +27,17 @@
lv.inboundMoney,
DATE_FORMAT(lv.inboundDate, '%Y-%m-%d') AS inboundDate,
DATE_FORMAT(lv.outboundDate, '%Y-%m-%d') AS outboundDate,
lv.stockState vehicleState,
lv.busSid
lv.stockState vehicleState,
lv.busSid
from loan_return_veh_ledger lv
<where>
${ew.sqlSegment}
</where>
</select>
<select id="selectByPSid" resultType="com.yxt.anrui.riskcenter.api.loanreturnvehledger.LoanReturnVehLedger">
select *
from loan_return_veh_ledger
where pSid = #{sid}
</select>
</mapper>

4
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanreturnvehledger/LoanReturnVehLedgerService.java

@ -260,4 +260,8 @@ public class LoanReturnVehLedgerService extends MybatisBaseService<LoanReturnVeh
loanReturnLedgerVo.setVehicleStateKey(loanReturnVehLedger.getStockStateKey());
return rb.success().setData(loanReturnLedgerVo);
}
public LoanReturnVehLedger selectByPSid(String sid) {
return baseMapper.selectByPSid(sid);
}
}

114
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansecondarysalesapply/LoanSecondarySalesApplyService.java

@ -38,6 +38,7 @@ import com.yxt.anrui.riskcenter.api.loansecondarysalesapply.flowable.*;
import com.yxt.anrui.riskcenter.api.loansecondarysalescost.LoanSecondarySalesCostVo;
import com.yxt.anrui.riskcenter.api.loansecondarysalesveh.LoanSecondarySalesVeh;
import com.yxt.anrui.riskcenter.api.loansecondarysalesveh.LoanSecondarySalesVehVo;
import com.yxt.anrui.riskcenter.biz.loanreturninboundapply.LoanReturnInboundApplyService;
import com.yxt.anrui.riskcenter.biz.loanreturnvehledger.LoanReturnVehLedgerService;
import com.yxt.anrui.riskcenter.biz.loansecondarysalescost.LoanSecondarySalesCostService;
import com.yxt.anrui.riskcenter.biz.loansecondarysalesveh.LoanSecondarySalesVehService;
@ -89,6 +90,8 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
private FileUploadComponent fileUploadComponent;
@Autowired
private LoanReturnVehLedgerService loanReturnVehLedgerService;
@Autowired
private LoanReturnInboundApplyService loanReturnInboundApplyService;
public PagerVo<LoanSecondarySalesApplyVo> listPageVo(PagerQuery<LoanSecondarySalesApplyQuery> pq) {
LoanSecondarySalesApplyQuery query = pq.getParams();
@ -488,7 +491,56 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
}
public ResultBean<String> saveOrUpdateSecondarySales(LoanSecondarySalesApplyDto dto) {
return null;
ResultBean<String> rb = ResultBean.fireFail();
String sid = dto.getSid();
if (StringUtils.isBlank(sid)) {//新增
LoanSecondarySalesApply loanSecondarySalesApply = new LoanSecondarySalesApply();
BeanUtil.copyProperties(dto, loanSecondarySalesApply, "sid");
loanSecondarySalesApply.setCreateBySid(dto.getUserSid());
loanSecondarySalesApply.setOrgSidPath(dto.getOrgPath());
String useOrgSid = sysStaffOrgFeign.getOrgSidByPath(dto.getOrgPath()).getData();
loanSecondarySalesApply.setUseOrgSid(useOrgSid);
//创建组织使用组织
ResultBean<SysOrganizationVo> organizationResultBean = sysOrganizationFeign.fetchBySid(useOrgSid);
if (organizationResultBean.getData() != null) {
loanSecondarySalesApply.setUseOrgName(organizationResultBean.getData().getName());
}
//申请部门
List<String> orgList = Arrays.asList(dto.getOrgPath().split("/"));
String deptSid = orgList.get(orgList.size() - 1);
ResultBean<SysOrganizationVo> sysOrganizationVoResultBean = sysOrganizationFeign.fetchBySid(deptSid);
if (sysOrganizationVoResultBean.getData() != null) {
loanSecondarySalesApply.setCreateDept(sysOrganizationVoResultBean.getData().getName());
loanSecondarySalesApply.setCreateDeptSid(deptSid);
}
//根据用户sid查询人员姓名
ResultBean<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(dto.getUserSid());
if (!userVoResultBean.getSuccess()) {
return rb.setMsg(userVoResultBean.getMsg());
}
loanSecondarySalesApply.setCreateByName(userVoResultBean.getData().getName());
List<UrlQuery> filss = dto.getFilesList();
List<String> filesList = filss.stream().map(v -> v.getUrl()).collect(Collectors.toList());
if (!filesList.isEmpty()) {
String files = String.join(",", filesList).replaceAll(fileUploadComponent.getUrlPrefix(), "");
loanSecondarySalesApply.setFiles(files);
}
baseMapper.insert(loanSecondarySalesApply);
sid = loanSecondarySalesApply.getSid();
//保存车辆
List<LoanSecondarySalesVehVo> loanSecondarySalesVehVoList = dto.getLoanSecondarySalesVehVoList();
loanSecondarySalesVehVoList.removeAll(Collections.singleton(null));
if (!loanSecondarySalesVehVoList.isEmpty()) {
loanSecondarySalesVehService.saveVeh(loanSecondarySalesVehVoList, sid);
}
LoanSecondarySalesCostVo loanSecondarySalesCost = dto.getLoanSecondarySalesCost();
if (loanSecondarySalesCost != null) {
loanSecondarySalesCostService.saveCost(loanSecondarySalesCost, sid);
}
} else {
}
return rb.success().setData(sid);
}
private int submitBusinessData(SubmitLoanSecondarySalesApplyDto dto, LoanSecondarySalesApply loanSecondarySalesApply) {
@ -542,13 +594,71 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
}
String busVinSid = "";
String vinNo = "";
String saleOrderSid = "";
List<String> vinNoLists = new ArrayList<>();
List<String> bankContractNoList = new ArrayList<>();
List<LoanSecondarySalesVehVo> loanSecondarySalesVehVoList = new ArrayList<>();
for (int i = 0; i < chooseSidList.size(); i++) {
LoanSecondarySalesVehVo loanSecondarySalesVehVo = new LoanSecondarySalesVehVo();
String s = chooseSidList.get(i);
LoanReturnVehLedger loanReturnVehLedger = loanReturnVehLedgerService.fetchBySid(s);
if ("未处置".equals(loanReturnVehLedger.getDisposal())) {
if (!"未处置".equals(loanReturnVehLedger.getDisposal())) {
vinNoLists.add(loanReturnVehLedger.getVinNo());
}
LoanReturnInboundApply loanReturnInboundApply = loanReturnInboundApplyService.fetchBySid(loanReturnVehLedger.getBusSid());
if (StringUtils.isNotBlank(loanReturnInboundApply.getBankContractNo())) {
bankContractNoList.add(loanReturnInboundApply.getBankContractNo());
}
busVinSid = loanReturnInboundApply.getBusVinSid();
if ("主车".equals(loanReturnVehLedger.getVehType())) {
if ("未处置".equals(loanReturnVehLedger.getVehType())) {
loanSecondarySalesVehVo.setBusVinSid(loanReturnVehLedger.getBusVinSid());
loanSecondarySalesVehVo.setVinNo(loanReturnVehLedger.getVinNo());
loanSecondarySalesVehVo.setVehMark(loanReturnVehLedger.getVehMark());
loanSecondarySalesVehVo.setModelName(loanReturnVehLedger.getVehModel());
loanSecondarySalesVehVo.setModelSid(loanReturnVehLedger.getVehModelSid());
loanSecondarySalesVehVo.setConfigSid(loanReturnVehLedger.getConfigSid());
loanSecondarySalesVehVoList.add(loanSecondarySalesVehVo);
}
//根据主车查询挂车信息
LoanReturnVehLedger loanReturnVehLedgerT = loanReturnVehLedgerService.selectByPSid(loanReturnVehLedger.getSid());
if ("未处置".equals(loanReturnVehLedgerT.getVehType())) {
loanSecondarySalesVehVo = new LoanSecondarySalesVehVo();
loanSecondarySalesVehVo.setVehType(loanReturnVehLedgerT.getVehType());
loanSecondarySalesVehVo.setVehMark(loanReturnVehLedgerT.getVehMark());
loanSecondarySalesVehVo.setVinNo(loanReturnVehLedgerT.getVinNo());
loanSecondarySalesVehVo.setModelName(loanReturnVehLedgerT.getVehModel());
loanSecondarySalesVehVoList.add(loanSecondarySalesVehVo);
}
}
if ("挂车".equals(loanReturnVehLedger.getVehType())) {
if ("未处置".equals(loanReturnVehLedger.getVehType())) {
loanSecondarySalesVehVo = new LoanSecondarySalesVehVo();
loanSecondarySalesVehVo.setVehType(loanReturnVehLedger.getVehType());
loanSecondarySalesVehVo.setVehMark(loanReturnVehLedger.getVehMark());
loanSecondarySalesVehVo.setVinNo(loanReturnVehLedger.getVinNo());
loanSecondarySalesVehVo.setModelName(loanReturnVehLedger.getVehModel());
loanSecondarySalesVehVoList.add(loanSecondarySalesVehVo);
}
}
}
vinNoLists.removeAll(Collections.singleton(null));
if (!vinNoLists.isEmpty()) {
return rb.setMsg(String.join(",", vinNoLists) + "车架号处置方式非未处置,不能二次销售");
}
loanSecondarySalesVehVoList.removeAll(Collections.singleton(null));
//去重车架号
loanSecondarySalesVehVoList = loanSecondarySalesVehVoList.stream()
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getVinNo()))), ArrayList::new));
Set<String> set = new HashSet<>(bankContractNoList); // 创建HashSet对象,自动去重
List<String> distinctList = new ArrayList<>(set);
distinctList.removeAll(Collections.singleton(null));
if (distinctList.size() != 1) {
return rb.setMsg("请选择相同资方合同编号的车辆");
}
loanSecondarySalesApplyDetailsVo.setLoanSecondarySalesVehVoList(loanSecondarySalesVehVoList);
//根据用户查询发起人、发起部门、发起日期为当前日期
String deptName = "";
String deptSid = "";

25
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansecondarysalescost/LoanSecondarySalesCostService.java

@ -1,10 +1,17 @@
package com.yxt.anrui.riskcenter.biz.loansecondarysalescost;
import cn.hutool.core.bean.BeanUtil;
import com.yxt.anrui.riskcenter.api.loanoverduefin.UrlQuery;
import com.yxt.anrui.riskcenter.api.loansecondarysalescost.LoanSecondarySalesCost;
import com.yxt.anrui.riskcenter.api.loansecondarysalescost.LoanSecondarySalesCostVo;
import com.yxt.common.base.config.component.FileUploadComponent;
import com.yxt.common.base.service.MybatisBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* @description:
* @author: dimengzhe
@ -12,6 +19,10 @@ import org.springframework.stereotype.Service;
**/
@Service
public class LoanSecondarySalesCostService extends MybatisBaseService<LoanSecondarySalesCostMapper, LoanSecondarySalesCost> {
@Autowired
private FileUploadComponent fileUploadComponent;
public int deleteByMainSid(String s) {
return baseMapper.deleteByMainSid(s);
}
@ -19,4 +30,18 @@ public class LoanSecondarySalesCostService extends MybatisBaseService<LoanSecond
public LoanSecondarySalesCostVo selectByMainSid(String sid) {
return baseMapper.selectByMainSid(sid);
}
public void saveCost(LoanSecondarySalesCostVo loanSecondarySalesCost, String sid) {
baseMapper.deleteByMainSid(sid);
LoanSecondarySalesCost loanSecondarySalesCost1 = new LoanSecondarySalesCost();
BeanUtil.copyProperties(loanSecondarySalesCost, loanSecondarySalesCost1);
loanSecondarySalesCost1.setMainSid(sid);
List<UrlQuery> filss = loanSecondarySalesCost.getFiles();
List<String> filesList = filss.stream().map(v -> v.getUrl()).collect(Collectors.toList());
if (!filesList.isEmpty()) {
String files = String.join(",", filesList).replaceAll(fileUploadComponent.getUrlPrefix(), "");
loanSecondarySalesCost1.setFiles(files);
}
baseMapper.insert(loanSecondarySalesCost1);
}
}

14
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansecondarysalesveh/LoanSecondarySalesVehService.java

@ -1,5 +1,6 @@
package com.yxt.anrui.riskcenter.biz.loansecondarysalesveh;
import cn.hutool.core.bean.BeanUtil;
import com.yxt.anrui.riskcenter.api.loansecondarysalesveh.LoanSecondarySalesVeh;
import com.yxt.anrui.riskcenter.api.loansecondarysalesveh.LoanSecondarySalesVehVo;
import com.yxt.common.base.service.MybatisBaseService;
@ -21,4 +22,17 @@ public class LoanSecondarySalesVehService extends MybatisBaseService<LoanSeconda
public List<LoanSecondarySalesVehVo> selectByMainSid(String sid) {
return baseMapper.selectByMainSid(sid);
}
public void saveVeh(List<LoanSecondarySalesVehVo> loanSecondarySalesVehVoList, String sid) {
//先删除
baseMapper.deleteByMainSid(sid);
//保存
for (int i = 0; i < loanSecondarySalesVehVoList.size(); i++) {
LoanSecondarySalesVehVo loanSecondarySalesVehVo = loanSecondarySalesVehVoList.get(i);
LoanSecondarySalesVeh loanSecondarySalesVeh = new LoanSecondarySalesVeh();
BeanUtil.copyProperties(loanSecondarySalesVehVo, loanSecondarySalesVeh, "sid");
loanSecondarySalesVeh.setMainSid(sid);
baseMapper.insert(loanSecondarySalesVeh);
}
}
}

Loading…
Cancel
Save