28 changed files with 593 additions and 21 deletions
@ -0,0 +1,55 @@ |
|||||
|
package com.yxt.anrui.riskcenter.api.loansettlevehicle; |
||||
|
|
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/2/18 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class LoanSettleVehicle extends BaseEntity { |
||||
|
private static final long serialVersionUID = -155930989121686367L; |
||||
|
@ApiModelProperty("结清类型key") |
||||
|
private String typeState; |
||||
|
@ApiModelProperty("结清类型value") |
||||
|
private String typeStateValue; |
||||
|
@ApiModelProperty("分公司") |
||||
|
private String useOrgName; |
||||
|
@ApiModelProperty("分公司sid") |
||||
|
private String useOrgSid; |
||||
|
@ApiModelProperty("销售部门") |
||||
|
private String createDept; |
||||
|
@ApiModelProperty("销售部门sid") |
||||
|
private String createDeptSid; |
||||
|
@ApiModelProperty("机构全路径sid") |
||||
|
private String orgSidPath; |
||||
|
@ApiModelProperty("贷款合同编号") |
||||
|
private String loanContractNo; |
||||
|
@ApiModelProperty("车架号") |
||||
|
private String vinNo; |
||||
|
@ApiModelProperty("销售订单车辆sid") |
||||
|
private String busVinSid; |
||||
|
@ApiModelProperty("车牌号") |
||||
|
private String vehMark; |
||||
|
@ApiModelProperty("贷款人") |
||||
|
private String loanName; |
||||
|
@ApiModelProperty("贷款人sid") |
||||
|
private String loanSid; |
||||
|
@ApiModelProperty("期数") |
||||
|
private String peroid; |
||||
|
@ApiModelProperty("结清日期") |
||||
|
private String settingDate; |
||||
|
@ApiModelProperty("资方结清金额") |
||||
|
private BigDecimal bankSettlePrice; |
||||
|
@ApiModelProperty("公司正常结清合计") |
||||
|
private BigDecimal settleAll; |
||||
|
@ApiModelProperty("公司减免后结清合计") |
||||
|
private BigDecimal amountTo; |
||||
|
@ApiModelProperty("结清利润") |
||||
|
private BigDecimal profit; |
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
package com.yxt.anrui.riskcenter.api.loansettlevehicle; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/2/18 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class LoanSettleVehicleDto { |
||||
|
private String createBySid; |
||||
|
@ApiModelProperty("结清类型key") |
||||
|
private String typeState; |
||||
|
@ApiModelProperty("结清类型value") |
||||
|
private String typeStateValue; |
||||
|
@ApiModelProperty("分公司") |
||||
|
private String useOrgName; |
||||
|
@ApiModelProperty("分公司sid") |
||||
|
private String useOrgSid; |
||||
|
@ApiModelProperty("销售部门") |
||||
|
private String createDept; |
||||
|
@ApiModelProperty("销售部门sid") |
||||
|
private String createDeptSid; |
||||
|
@ApiModelProperty("机构全路径sid") |
||||
|
private String orgSidPath; |
||||
|
@ApiModelProperty("贷款合同编号") |
||||
|
private String loanContractNo; |
||||
|
@ApiModelProperty("车架号") |
||||
|
private String vinNo; |
||||
|
@ApiModelProperty("销售订单车辆sid") |
||||
|
private String busVinSid; |
||||
|
@ApiModelProperty("车牌号") |
||||
|
private String vehMark; |
||||
|
@ApiModelProperty("贷款人") |
||||
|
private String loanName; |
||||
|
@ApiModelProperty("贷款人sid") |
||||
|
private String loanSid; |
||||
|
@ApiModelProperty("期数") |
||||
|
private String peroid; |
||||
|
@ApiModelProperty("结清日期") |
||||
|
private String settingDate; |
||||
|
@ApiModelProperty("资方结清金额") |
||||
|
private String bankSettlePrice; |
||||
|
@ApiModelProperty("公司正常结清合计") |
||||
|
private String settleAll; |
||||
|
@ApiModelProperty("公司减免后结清合计") |
||||
|
private String amountTo; |
||||
|
@ApiModelProperty("结清利润") |
||||
|
private String profit; |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package com.yxt.anrui.riskcenter.api.loansettlevehicle; |
||||
|
|
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/2/18 |
||||
|
**/ |
||||
|
@FeignClient( |
||||
|
contextId = "anrui-riskcenter-LoanSettleVehicle", |
||||
|
name = "anrui-riskcenter", |
||||
|
path = "v1/LoanSettleVehicle", |
||||
|
fallback = LoanSettleVehicleFeignFallback.class) |
||||
|
public interface LoanSettleVehicleFeign { |
||||
|
|
||||
|
@ApiOperation("分页列表") |
||||
|
@PostMapping("/listPage") |
||||
|
ResultBean<PagerVo<LoanSettleVehicleVo>> pageList(@RequestBody PagerQuery<LoanSettleVehicleQuery> pagerQuery); |
||||
|
|
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.yxt.anrui.riskcenter.api.loansettlevehicle; |
||||
|
|
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/2/18 |
||||
|
**/ |
||||
|
@Component |
||||
|
public class LoanSettleVehicleFeignFallback { |
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
package com.yxt.anrui.riskcenter.api.loansettlevehicle; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/2/18 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class LoanSettleVehicleQuery implements Query { |
||||
|
private static final long serialVersionUID = -7116738252164609661L; |
||||
|
|
||||
|
@ApiModelProperty("分公司") |
||||
|
private String useOrgName; |
||||
|
@ApiModelProperty("销售部门") |
||||
|
private String createDept; |
||||
|
@ApiModelProperty("贷款合同编号") |
||||
|
private String loanContractNo; |
||||
|
@ApiModelProperty("车架号") |
||||
|
private String vinNo; |
||||
|
@ApiModelProperty("车牌号") |
||||
|
private String vehMark; |
||||
|
@ApiModelProperty("贷款人") |
||||
|
private String loanName; |
||||
|
@ApiModelProperty("结清类型") |
||||
|
private String typeStateKey; |
||||
|
|
||||
|
private String menuUrl; |
||||
|
private String orgPath; |
||||
|
private String userSid; |
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
package com.yxt.anrui.riskcenter.api.loansettlevehicle; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/2/18 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class LoanSettleVehicleVo { |
||||
|
|
||||
|
private String sid; |
||||
|
@ApiModelProperty("结清类型value") |
||||
|
private String typeStateValue; |
||||
|
@ApiModelProperty("分公司") |
||||
|
private String useOrgName; |
||||
|
|
||||
|
@ApiModelProperty("销售部门") |
||||
|
private String createDept; |
||||
|
|
||||
|
@ApiModelProperty("贷款合同编号") |
||||
|
private String loanContractNo; |
||||
|
@ApiModelProperty("车架号") |
||||
|
private String vinNo; |
||||
|
@ApiModelProperty("销售订单车辆sid") |
||||
|
private String busVinSid; |
||||
|
@ApiModelProperty("车牌号") |
||||
|
private String vehMark; |
||||
|
@ApiModelProperty("贷款人") |
||||
|
private String loanName; |
||||
|
|
||||
|
@ApiModelProperty("期数") |
||||
|
private String peroid; |
||||
|
@ApiModelProperty("结清日期") |
||||
|
private String settingDate; |
||||
|
@ApiModelProperty("资方结清金额") |
||||
|
private String bankSettlePrice; |
||||
|
@ApiModelProperty("公司正常结清合计") |
||||
|
private String settleAll; |
||||
|
@ApiModelProperty("公司减免后结清合计") |
||||
|
private String amountTo; |
||||
|
@ApiModelProperty("结清利润") |
||||
|
private String profit; |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.yxt.anrui.riskcenter.biz.loansettlevehicle; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetails; |
||||
|
import com.yxt.anrui.riskcenter.api.loansettlevehicle.LoanSettleVehicle; |
||||
|
import com.yxt.anrui.riskcenter.api.loansettlevehicle.LoanSettleVehicleVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/2/18 |
||||
|
**/ |
||||
|
@Mapper |
||||
|
public interface LoanSettleVehicleMapper extends BaseMapper<LoanSettleVehicle> { |
||||
|
LoanSettleVehicle selectByBusVinSid(String busVinSid); |
||||
|
|
||||
|
IPage<LoanSettleVehicleVo> selectPageVo(IPage<LoanSettleVehicle> page, @Param(Constants.WRAPPER)QueryWrapper<LoanSettleVehicle> qw); |
||||
|
|
||||
|
LoanRepaymentPlanDetails selectOneByBusVinSid(String busVinSid); |
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.anrui.riskcenter.biz.loansettlevehicle.LoanSettleVehicleMapper"> |
||||
|
<select id="selectByBusVinSid" resultType="com.yxt.anrui.riskcenter.api.loansettlevehicle.LoanSettleVehicle"> |
||||
|
select * |
||||
|
from loan_settle_vehicle |
||||
|
where busVinSid = #{busVinSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectPageVo" resultType="com.yxt.anrui.riskcenter.api.loansettlevehicle.LoanSettleVehicleVo"> |
||||
|
select lv.sid, |
||||
|
lv.typeStateValue, |
||||
|
lv.useOrgName, |
||||
|
lv.createDept, |
||||
|
lv.loanContractNo, |
||||
|
lv.vinNo, |
||||
|
lv.busVinSid, |
||||
|
lv.vehMark, |
||||
|
lv.loanName, |
||||
|
lv.peroid, |
||||
|
lv.settingDate, |
||||
|
lv.bankSettlePrice, |
||||
|
lv.settleAll, |
||||
|
lv.amountTo, |
||||
|
lv.profit |
||||
|
from loan_settle_vehicle lv |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
order by lv.useOrgName desc, lv.typeStateValue desc, lv.loanContractNo desc, lv.vinNo desc |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectOneByBusVinSid" |
||||
|
resultType="com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetails"> |
||||
|
select * |
||||
|
from loan_repayment_plan_details |
||||
|
where busVinSid = #{busVinSid} |
||||
|
order by period desc |
||||
|
limit 1 |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,32 @@ |
|||||
|
package com.yxt.anrui.riskcenter.biz.loansettlevehicle; |
||||
|
|
||||
|
import com.yxt.anrui.riskcenter.api.loansettlevehicle.LoanSettleVehicleFeign; |
||||
|
import com.yxt.anrui.riskcenter.api.loansettlevehicle.LoanSettleVehicleQuery; |
||||
|
import com.yxt.anrui.riskcenter.api.loansettlevehicle.LoanSettleVehicleVo; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/2/18 |
||||
|
**/ |
||||
|
@RestController |
||||
|
@RequestMapping("v1/LoanSettleVehicle") |
||||
|
@Api(tags = "结清车辆台账") |
||||
|
public class LoanSettleVehicleRest implements LoanSettleVehicleFeign { |
||||
|
@Autowired |
||||
|
private LoanSettleVehicleService loanSettleVehicleService; |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean<PagerVo<LoanSettleVehicleVo>> pageList(PagerQuery<LoanSettleVehicleQuery> pagerQuery) { |
||||
|
ResultBean<PagerVo<LoanSettleVehicleVo>> rb = ResultBean.fireFail(); |
||||
|
PagerVo<LoanSettleVehicleVo> pv = loanSettleVehicleService.listPageVo(pagerQuery); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
} |
@ -0,0 +1,136 @@ |
|||||
|
package com.yxt.anrui.riskcenter.biz.loansettlevehicle; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.anrui.portal.api.sysuser.PrivilegeQuery; |
||||
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
||||
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetails; |
||||
|
import com.yxt.anrui.riskcenter.api.loansettleapply.LoanSettleApply; |
||||
|
import com.yxt.anrui.riskcenter.api.loansettleapply.LoanSettleApplyQuery; |
||||
|
import com.yxt.anrui.riskcenter.api.loansettleapply.LoanSettleApplyVo; |
||||
|
import com.yxt.anrui.riskcenter.api.loansettlevehicle.LoanSettleVehicle; |
||||
|
import com.yxt.anrui.riskcenter.api.loansettlevehicle.LoanSettleVehicleDto; |
||||
|
import com.yxt.anrui.riskcenter.api.loansettlevehicle.LoanSettleVehicleQuery; |
||||
|
import com.yxt.anrui.riskcenter.api.loansettlevehicle.LoanSettleVehicleVo; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.Collections; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/2/18 |
||||
|
**/ |
||||
|
@Service |
||||
|
public class LoanSettleVehicleService extends MybatisBaseService<LoanSettleVehicleMapper, LoanSettleVehicle> { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private SysUserFeign sysUserFeign; |
||||
|
|
||||
|
public ResultBean saveSettleVehicle(LoanSettleVehicleDto dto) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
String busVinSid = dto.getBusVinSid(); |
||||
|
//查询
|
||||
|
LoanSettleVehicle loanSettleVehicle = baseMapper.selectByBusVinSid(busVinSid); |
||||
|
if (loanSettleVehicle == null) { |
||||
|
loanSettleVehicle = new LoanSettleVehicle(); |
||||
|
BeanUtil.copyProperties(dto, loanSettleVehicle, "sid"); |
||||
|
LoanRepaymentPlanDetails loanRepaymentPlanDetails = baseMapper.selectOneByBusVinSid(busVinSid); |
||||
|
if (loanRepaymentPlanDetails != null) { |
||||
|
loanSettleVehicle.setPeroid(loanRepaymentPlanDetails.getPeriod()); |
||||
|
} |
||||
|
baseMapper.insert(loanSettleVehicle); |
||||
|
} |
||||
|
|
||||
|
return rb.success(); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public PagerVo<LoanSettleVehicleVo> listPageVo(PagerQuery<LoanSettleVehicleQuery> pagerQuery) { |
||||
|
LoanSettleVehicleQuery query = pagerQuery.getParams(); |
||||
|
QueryWrapper<LoanSettleVehicle> qw = new QueryWrapper<>(); |
||||
|
if (query != null) { |
||||
|
//分公司
|
||||
|
if (StringUtils.isNotBlank(query.getUseOrgName())) { |
||||
|
qw.like("lv.useOrgName", query.getUseOrgName()); |
||||
|
} |
||||
|
//申请部门
|
||||
|
if (StringUtils.isNotBlank(query.getCreateDept())) { |
||||
|
qw.like("lv.createDept", query.getCreateDept()); |
||||
|
} |
||||
|
//贷款合同编号
|
||||
|
if (StringUtils.isNotBlank(query.getLoanContractNo())) { |
||||
|
qw.like("lv.loanContractNo", query.getLoanContractNo()); |
||||
|
} |
||||
|
//贷款人
|
||||
|
if (StringUtils.isNotBlank(query.getLoanName())) { |
||||
|
qw.like("lv.loanName", query.getLoanName()); |
||||
|
} |
||||
|
//车架号
|
||||
|
if (StringUtils.isNotBlank(query.getVinNo())) { |
||||
|
qw.like("lv.vinNo", query.getVinNo()); |
||||
|
} |
||||
|
//车牌号
|
||||
|
if (StringUtils.isNotBlank(query.getVehMark())) { |
||||
|
qw.like("lv.vehMark", query.getVehMark()); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(query.getTypeStateKey())) { |
||||
|
qw.eq("lv.typeState", query.getTypeStateKey()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getMenuUrl())) { |
||||
|
//=======================
|
||||
|
PrivilegeQuery privilegeQuery = new PrivilegeQuery(); |
||||
|
privilegeQuery.setOrgPath(query.getOrgPath()); |
||||
|
privilegeQuery.setMenuUrl(query.getMenuUrl()); |
||||
|
privilegeQuery.setUserSid(query.getUserSid()); |
||||
|
ResultBean<String> defaultIdReltBean = sysUserFeign.selectPrivilegeLevel(privilegeQuery); |
||||
|
if (StringUtils.isNotBlank(defaultIdReltBean.getData())) { |
||||
|
//数据权限ID(1集团、2事业部、3分公司、4部门、5个人)
|
||||
|
String orgSidPath = query.getOrgPath(); |
||||
|
orgSidPath = orgSidPath + "/"; |
||||
|
int i1 = orgSidPath.indexOf("/"); |
||||
|
int i2 = orgSidPath.indexOf("/", i1 + 1); |
||||
|
int i3 = orgSidPath.indexOf("/", i2 + 1); |
||||
|
int i4 = orgSidPath.indexOf("/", i3 + 1); |
||||
|
String orgLevelKey = defaultIdReltBean.getData(); |
||||
|
if ("1".equals(orgLevelKey)) { |
||||
|
orgSidPath = orgSidPath.substring(0, i1); |
||||
|
qw.like("lv.orgSidPath", orgSidPath); |
||||
|
} else if ("2".equals(orgLevelKey)) { |
||||
|
orgSidPath = orgSidPath.substring(0, i2); |
||||
|
qw.like("lv.orgSidPath", orgSidPath); |
||||
|
} else if ("3".equals(orgLevelKey)) { |
||||
|
orgSidPath = orgSidPath.substring(0, i3); |
||||
|
qw.like("lv.orgSidPath", orgSidPath); |
||||
|
} else if ("4".equals(orgLevelKey)) { |
||||
|
orgSidPath = orgSidPath.substring(0, i4); |
||||
|
qw.like("lv.orgSidPath", orgSidPath); |
||||
|
} else if ("5".equals(orgLevelKey)) { |
||||
|
qw.eq("lv.createBySid", query.getUserSid()); |
||||
|
} else { |
||||
|
PagerVo<LoanSettleVehicleVo> p = new PagerVo<>(); |
||||
|
return p; |
||||
|
} |
||||
|
} else { |
||||
|
PagerVo<LoanSettleVehicleVo> p = new PagerVo<>(); |
||||
|
return p; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
IPage<LoanSettleVehicle> page = PagerUtil.queryToPage(pagerQuery); |
||||
|
IPage<LoanSettleVehicleVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<LoanSettleVehicleVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue