保后导出优化

master
shijie 4 years ago
parent 751730edb1
commit e1aeeb42d5
  1. 3
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/AlInsuranceListMapper.java
  2. 3
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/AlRepaymentEntryMapper.java
  3. 20
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/AlInsuranceListRes.java
  4. 22
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/AlRepaymentRes.java
  5. 2
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/AlInsuranceListServiceImpl.java
  6. 8
      dq-financial-guarantee/src/main/resources/mapper/guarantee/AlRepaymentEntryMapper.xml
  7. 76
      dq-framework-utils/src/main/java/com/daqing/framework/utils/excel/InsuranceStatusConverter.java
  8. 76
      dq-framework-utils/src/main/java/com/daqing/framework/utils/excel/RepaymentStatusConverter.java

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.daqing.financial.guarantee.model.response.AlInsuranceListRes; import com.daqing.financial.guarantee.model.response.AlInsuranceListRes;
import com.daqing.framework.domain.guarantee.AlInsuranceList; import com.daqing.framework.domain.guarantee.AlInsuranceList;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -22,5 +23,5 @@ public interface AlInsuranceListMapper extends BaseMapper<AlInsuranceList> {
IPage<AlInsuranceListRes> pageByCondition(Page page, String customerNumberOrName,Integer paymentStatus); IPage<AlInsuranceListRes> pageByCondition(Page page, String customerNumberOrName,Integer paymentStatus);
List<AlInsuranceListRes> selectListByIds(List<String> ids); List<AlInsuranceListRes> selectListByIds(@Param("ids")List<String> ids);
} }

@ -9,6 +9,7 @@ import com.daqing.financial.guarantee.model.response.AlRepaymentEntryRes;
import com.daqing.financial.guarantee.model.response.AlRepaymentRes; import com.daqing.financial.guarantee.model.response.AlRepaymentRes;
import com.daqing.framework.domain.guarantee.AlRepaymentEntry; import com.daqing.framework.domain.guarantee.AlRepaymentEntry;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -25,7 +26,7 @@ public interface AlRepaymentEntryMapper extends BaseMapper<AlRepaymentEntry> {
IPage<AlRepaymentEntryListRes> pageByCondition(Page page, String customerNumberOrName, Integer status, Integer insuranceId); IPage<AlRepaymentEntryListRes> pageByCondition(Page page, String customerNumberOrName, Integer status, Integer insuranceId);
List<AlRepaymentRes> selectListByIds(List<String> ids); List<AlRepaymentRes> selectListByIds(@Param("ids")List<String> ids);
List<AlRepaymentEntry> listAlRepayment(); List<AlRepaymentEntry> listAlRepayment();

@ -1,9 +1,12 @@
package com.daqing.financial.guarantee.model.response; package com.daqing.financial.guarantee.model.response;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel; import com.alibaba.excel.metadata.BaseRowModel;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.daqing.framework.utils.excel.InsuranceStatusConverter;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -30,6 +33,7 @@ public class AlInsuranceListRes extends BaseRowModel implements Serializable {
/** /**
* 主键id * 主键id
*/ */
@ExcelIgnore
@ApiModelProperty(value = "企业id") @ApiModelProperty(value = "企业id")
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;
@ -37,91 +41,107 @@ public class AlInsuranceListRes extends BaseRowModel implements Serializable {
/** /**
* 业务编号 * 业务编号
*/ */
@ExcelProperty(value = "业务编号",index = 0)
@ApiModelProperty(value = "业务编号") @ApiModelProperty(value = "业务编号")
private String businessCode; private String businessCode;
/** /**
* 客户名称 * 客户名称
*/ */
@ExcelProperty(value = "客户名称",index = 1)
@ApiModelProperty(value = "客户名称") @ApiModelProperty(value = "客户名称")
private String customerName; private String customerName;
/** /**
* 联系电话 * 联系电话
*/ */
@ExcelProperty(value = "联系电话",index = 2)
@ApiModelProperty(value = "联系电话") @ApiModelProperty(value = "联系电话")
private String phone; private String phone;
/** /**
* 业务类别 * 业务类别
*/ */
@ExcelProperty(value = "业务类型",index = 3)
@ApiModelProperty(value = "业务类别") @ApiModelProperty(value = "业务类别")
private String businessType; private String businessType;
/** /**
* 担保额度 * 担保额度
*/ */
@ExcelProperty(value = "担保额度(元)",index = 4)
@ApiModelProperty(value = "担保额度(元)") @ApiModelProperty(value = "担保额度(元)")
private BigDecimal guaranteeAmount; private BigDecimal guaranteeAmount;
/** /**
* 担保期限 * 担保期限
*/ */
@ExcelProperty(value = "担保期限",index = 5)
@ApiModelProperty(value = "担保期限") @ApiModelProperty(value = "担保期限")
private String guaranteeTime; private String guaranteeTime;
/** /**
* 申请日期 * 申请日期
*/ */
@ExcelProperty(value = "申请日期",index = 6)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@ApiModelProperty(value = "申请日期") @ApiModelProperty(value = "申请日期")
private Date applyTime; private Date applyTime;
@ExcelIgnore
@ApiModelProperty(value = "贷款银行(用中划线隔开)") @ApiModelProperty(value = "贷款银行(用中划线隔开)")
private String bank; private String bank;
@ExcelIgnore
@ApiModelProperty(value = "贷款用途") @ApiModelProperty(value = "贷款用途")
private String amountWide; private String amountWide;
/** /**
* 还款额度 * 还款额度
*/ */
@ExcelProperty(value = "还款额度(元)",index = 7)
@ApiModelProperty(value = "还款额度(元)") @ApiModelProperty(value = "还款额度(元)")
private BigDecimal repaymentAmount; private BigDecimal repaymentAmount;
/** /**
* 剩余额度 * 剩余额度
*/ */
@ExcelProperty(value = "剩余额度(元)",index = 8)
@ApiModelProperty(value = "剩余额度(元)") @ApiModelProperty(value = "剩余额度(元)")
private BigDecimal remainAmount; private BigDecimal remainAmount;
/** /**
* 还款期数 * 还款期数
*/ */
@ExcelProperty(value = "还款期数",index = 9)
@ApiModelProperty(value = "还款期数") @ApiModelProperty(value = "还款期数")
private String repaymentTime; private String repaymentTime;
/** /**
* 所属部门 * 所属部门
*/ */
@ExcelProperty(value = "所属部门",index = 10)
@ApiModelProperty(value = "所属部门") @ApiModelProperty(value = "所属部门")
private String department; private String department;
/** /**
* 还款状态1->还款中2->已逾期3->已还清4->已结项 * 还款状态1->还款中2->已逾期3->已还清4->已结项
*/ */
@ExcelProperty(value = "还款状态",index = 11,converter = InsuranceStatusConverter.class)
@ApiModelProperty(value = "还款状态:1->还款中;2->已逾期;3->已还清;4->已结项;") @ApiModelProperty(value = "还款状态:1->还款中;2->已逾期;3->已还清;4->已结项;")
private Integer paymentStatus; private Integer paymentStatus;
/** /**
* 创建时间 * 创建时间
*/ */
@ExcelIgnore
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date createTime; private Date createTime;
/** /**
* 修改时间 * 修改时间
*/ */
@ExcelIgnore
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private Date updateTime; private Date updateTime;
} }

@ -1,7 +1,10 @@
package com.daqing.financial.guarantee.model.response; package com.daqing.financial.guarantee.model.response;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel; import com.alibaba.excel.metadata.BaseRowModel;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.daqing.framework.utils.excel.RepaymentStatusConverter;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -25,83 +28,102 @@ public class AlRepaymentRes extends BaseRowModel implements Serializable {
/** /**
* 主键id * 主键id
*/ */
@ExcelIgnore
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;
/** /**
* 保后外键id * 保后外键id
*/ */
@ExcelIgnore
private Integer insuranceId; private Integer insuranceId;
/** /**
* 应还款日 * 应还款日
*/ */
@ExcelProperty(value = "应还款日",index = 0)
private Date repaymentDate; private Date repaymentDate;
/** /**
* 实际还款日 * 实际还款日
*/ */
@ExcelProperty(value = "实际还款日",index = 1)
private Date actualRepaymentDate; private Date actualRepaymentDate;
@ExcelProperty(value = "担保额度(元)",index = 2)
private BigDecimal guaranteeAmount;
/** /**
* 逾期天数 * 逾期天数
*/ */
@ExcelProperty(value = "逾期天数",index = 8)
private Integer overdueDays; private Integer overdueDays;
/** /**
* 还款总额 * 还款总额
*/ */
@ExcelProperty(value = "还款总额(元)",index = 6)
private BigDecimal totalRepayment; private BigDecimal totalRepayment;
/** /**
* 本次还款 * 本次还款
*/ */
@ExcelProperty(value = "本次还款(元)",index = 3)
private BigDecimal currentRepayment; private BigDecimal currentRepayment;
/** /**
* 利息 * 利息
*/ */
@ExcelProperty(value = "本次利息(元)",index = 4)
private BigDecimal interest; private BigDecimal interest;
/** /**
* 其他费用 * 其他费用
*/ */
@ExcelProperty(value = "其他费用(元)",index = 5)
private BigDecimal otherExpenses; private BigDecimal otherExpenses;
/** /**
* 减免金额 * 减免金额
*/ */
@ExcelProperty(value = "减免金额(元)",index = 7)
private BigDecimal deductionAmount; private BigDecimal deductionAmount;
/** /**
* 还款备注 * 还款备注
*/ */
@ExcelProperty(value = "还款备注",index = 12)
private String repaymentNotes; private String repaymentNotes;
/** /**
* 还款状态1->待还款2->已还款3->已逾期4->未到期 * 还款状态1->待还款2->已还款3->已逾期4->未到期
*/ */
@ExcelProperty(value = "状态",index = 9,converter = RepaymentStatusConverter.class)
private Integer repaymentStatus; private Integer repaymentStatus;
/** /**
* 提交人id * 提交人id
*/ */
@ExcelIgnore
private Integer submitterId; private Integer submitterId;
/** /**
* 提交人名称 * 提交人名称
*/ */
@ExcelProperty(value = "提交人名称",index = 10)
private String submitterName; private String submitterName;
/** /**
* 创建时间 * 创建时间
*/ */
@ExcelIgnore
@TableField(fill= FieldFill.INSERT) @TableField(fill= FieldFill.INSERT)
private Date createTime; private Date createTime;
/** /**
* 修改时间 * 修改时间
*/ */
@ExcelProperty(value = "提交时间",index = 11)
@TableField(fill= FieldFill.INSERT_UPDATE) @TableField(fill= FieldFill.INSERT_UPDATE)
private Date updateTime; private Date updateTime;
} }

@ -69,7 +69,7 @@ public class AlInsuranceListServiceImpl extends ServiceImpl<AlInsuranceListMappe
public Boolean excelExport(List<String> ids, HttpServletResponse response) { public Boolean excelExport(List<String> ids, HttpServletResponse response) {
List<AlInsuranceListRes>alInsuranceList = this.baseMapper.selectListByIds(ids); List<AlInsuranceListRes>alInsuranceList = this.baseMapper.selectListByIds(ids);
try { try {
ExcelUtil.writeExcelWithSheets(response, alInsuranceList, "还款记录一览表", "repaymentEntry", new AlInsuranceListRes()) ExcelUtil.writeExcelWithSheets(response, alInsuranceList, "保后管理一览表", "repaymentEntry", new AlInsuranceListRes())
.finish(); .finish();
return true; return true;
} catch (Exception e) { } catch (Exception e) {

@ -37,14 +37,16 @@
</select> </select>
<select id="selectListByIds" resultType="com.daqing.financial.guarantee.model.response.AlRepaymentRes"> <select id="selectListByIds" resultType="com.daqing.financial.guarantee.model.response.AlRepaymentRes">
select * from al_repayment_entry select re.*,il.guarantee_amount as guaranteeAmount
from al_repayment_entry re
left join al_insurance_list il on il.id=re.insurance_id
<where> <where>
id IN re.id IN
<foreach collection="ids" open="(" separator="," close=")" item="id"> <foreach collection="ids" open="(" separator="," close=")" item="id">
#{id} #{id}
</foreach> </foreach>
</where> </where>
order by create_time desc order by re.create_time desc
</select> </select>
<select id="selectRepaymentList" resultType="com.daqing.financial.guarantee.model.response.AlRepaymentCountRes"> <select id="selectRepaymentList" resultType="com.daqing.financial.guarantee.model.response.AlRepaymentCountRes">

@ -0,0 +1,76 @@
package com.daqing.framework.utils.excel;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
/**
* @Author chen
* @DATE 2020/10/19 15:44
* @Version 1.0
* 保后状态转换器
*/
public class InsuranceStatusConverter implements Converter<Integer> {
@Override
public Class supportJavaTypeKey() {
return Integer.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
/**
* 这里读的时候会调用
*
* @param cellData
* NotNull
* @param contentProperty
* Nullable
* @param globalConfiguration
* NotNull
* @return
*/
@Override
public Integer convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
return 0;
}
/**
* 这里是写的时候会调用
*
* @param value
* NotNull
* @param contentProperty
* Nullable
* @param globalConfiguration
* NotNull
* @return
*/
@Override
public CellData convertToExcelData(Integer value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
switch (value){
case 0:
return new CellData("未定义");
case 1:
return new CellData("还款中");
case 2:
return new CellData("已逾期");
case 3:
return new CellData("已还清");
case 4:
return new CellData("已结项");
default:
return new CellData(String.valueOf(value));
}
}
}

@ -0,0 +1,76 @@
package com.daqing.framework.utils.excel;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
/**
* @Author chen
* @DATE 2020/10/19 15:44
* @Version 1.0
* 还款记录状态转换器
*/
public class RepaymentStatusConverter implements Converter<Integer> {
@Override
public Class supportJavaTypeKey() {
return Integer.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
/**
* 这里读的时候会调用
*
* @param cellData
* NotNull
* @param contentProperty
* Nullable
* @param globalConfiguration
* NotNull
* @return
*/
@Override
public Integer convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
return 0;
}
/**
* 这里是写的时候会调用
*
* @param value
* NotNull
* @param contentProperty
* Nullable
* @param globalConfiguration
* NotNull
* @return
*/
@Override
public CellData convertToExcelData(Integer value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
switch (value){
case 0:
return new CellData("未定义");
case 1:
return new CellData("待还款");
case 2:
return new CellData("已还款");
case 3:
return new CellData("已逾期");
case 4:
return new CellData("未到期");
default:
return new CellData(String.valueOf(value));
}
}
}
Loading…
Cancel
Save