Commit b00f76d2 authored by hezhuozhi's avatar hezhuozhi

聚富通导出excel

parent f7a18731
package com.yeejoin.amos.boot.module.hygf.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@Data
@ApiModel(value="IcbcExcelDto", description=" 聚富通导出ExcelDto类")
public class IcbcExcelDto {
@ApiModelProperty("选中的主键")
private List<String> sequenceNbrList;
@ApiModelProperty("上传人员")
private String uploader;
@ApiModelProperty("上传时间(开始时间)")
private String uploadStartTime;
@ApiModelProperty("上传时间(结束时间)")
private String uploadEndTime;
@ApiModelProperty("上传状态")
private String uploadStatus;
@ApiModelProperty("确认人员")
private String confirmator;
@ApiModelProperty("确认时间(开始时间)")
private String confirmationStartTime;
@ApiModelProperty("确认时间(结束时间)")
private String confirmationEndTime;
@ApiModelProperty("代扣状态")
private String withholdStatus;
@ApiModelProperty("说明")
private String desc;
}
package com.yeejoin.amos.boot.module.hygf.api.mapper;
import com.yeejoin.amos.boot.module.hygf.api.dto.IcbcExcelDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.IcbcWithholdDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.IcbcWithhold;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.swagger.annotations.ApiParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -15,4 +18,8 @@ import java.util.List;
public interface IcbcWithholdMapper extends BaseMapper<IcbcWithhold> {
public List<IcbcWithholdDto> queryForIcbcWithholdPage( String uploader, String uploadStartTime, String uploadEndTime, String uploadStatus, String confirmator, String confirmationStartTime, String confirmationEndTime,String desc, String withholdStatus);
List<IcbcWithholdDto> queryForIcbcWithhold(@Param("dto") IcbcExcelDto icbcExcelDto);
List<IcbcWithholdDto> queryForIcbcWithholdBySequenceNbrs(@Param("list") List<String> sequenceNbrList);
}
......@@ -39,4 +39,56 @@
order by hygf_icbc_withhold.sequence_nbr desc
</select>
<select id="queryForIcbcWithhold" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.IcbcWithholdDto">
select *,
content as desc
from hygf_icbc_withhold
<where>
is_delete = 0
<if test="dto.uploader != null and dto.uploader != ''">
and uploader like concat('%',#{dto.uploader},'%')
</if>
<if test="dto.uploadStartTime != null and dto.uploadStartTime != ''">
and upload_time > #{dto.uploadStartTime}
</if>
<if test="dto.uploadEndTime != null and dto.uploadEndTime != ''">
and upload_time <![CDATA[<]]> #{dto.uploadEndTime}
</if>
<if test="dto.uploadStatus != null and dto.uploadStatus != ''">
and upload_status = #{dto.uploadStatus}
</if>
<if test="dto.withholdStatus != null and dto.withholdStatus != ''">
and withhold_status = #{dto.withholdStatus}
</if>
<if test="dto.confirmator != null and dto.confirmator != ''">
and confirmator like concat('%',#{dto.confirmator},'%')
</if>
<if test="dto.desc != null and dto.desc != ''">
and content like concat('%',#{dto.desc},'%')
</if>
<if test="dto.confirmationStartTime != null and dto.confirmationStartTime != ''">
and confirmation_time > #{dto.confirmationStartTime}
</if>
<if test="dto.confirmationEndTime != null and dto.confirmationEndTime != ''">
and confirmation_time <![CDATA[<]]> #{dto.confirmationEndTime}
</if>
</where>
order by hygf_icbc_withhold.sequence_nbr desc
</select>
<select id="queryForIcbcWithholdBySequenceNbrs"
resultType="com.yeejoin.amos.boot.module.hygf.api.dto.IcbcWithholdDto">
select *,
content as desc
from hygf_icbc_withhold
<where>
sequence_nbr in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</where>
order by hygf_icbc_withhold.sequence_nbr desc
</select>
</mapper>
......@@ -873,10 +873,10 @@
and amos_company_code = #{dto.amosCompanyCode}
</if>
<if test="dto.bindType == '未绑定'">
and (amos_company_code is null or regional_companies_code is null )
and (amos_company_code is null or regional_companies_code is null or amos_company_code='' or regional_companies_code='' )
</if>
<if test="dto.bindType == '已绑定'">
and (amos_company_code is not null and regional_companies_code is not null )
and (amos_company_code is not null and regional_companies_code is not null and amos_company_code!='' and regional_companies_code!='' )
</if>
</where>
order by sequence_nbr DESC
......
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordDTO;
import com.yeejoin.amos.boot.module.hygf.api.dto.IcbcExcelDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.IcbcWithholdRecordDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.IcbcWithhold;
import com.yeejoin.amos.boot.module.hygf.api.entity.IcbcWithholdRecord;
......@@ -125,7 +126,17 @@ public class IcbcWithholdController extends BaseController {
@RequestParam(value = "desc",required = false) String desc) {
return ResponseHelper.buildResponse(icbcWithholdServiceImpl.queryForIcbcWithholdPage(current,size,uploader,uploadStartTime,uploadEndTime,uploadStatus,confirmator,confirmationStartTime,confirmationEndTime,desc,withholdStatus));
} /**
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/exportIcbcExcel")
@ApiOperation(httpMethod = "POST",value = " 导出IcbcExcel", notes = " 导出IcbcExcel")
public ResponseModel<?> exportIcbcExcel(@RequestBody IcbcExcelDto icbcExcelDto, HttpServletResponse response) {
icbcWithholdServiceImpl.exportIcbcExcel(icbcExcelDto,response);
return ResponseHelper.buildResponse(null);
}
/**
* 列表分页查询
*
......
......@@ -19,6 +19,7 @@ import com.icbc.api.response.JftApiPayFeewithholdQuerydetailResponseV1;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.ExcelUtils;
import com.yeejoin.amos.boot.module.hygf.api.Enum.UploadStatusEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.HistoryPeasantHousehold;
......@@ -30,7 +31,9 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.IcbcWithholdRecordMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IIcbcWithholdService;
import com.yeejoin.amos.boot.module.hygf.api.util.RSASignUtils;
import com.yeejoin.amos.boot.module.hygf.api.util.SFTPUtil;
import com.yeejoin.amos.boot.module.hygf.biz.vo.IcbcExcelVO;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.robot.BadRequest;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
......@@ -58,6 +61,7 @@ import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.ParseException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
......@@ -748,5 +752,36 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
unzipAndUpload(dirPath.toString()+ "/" + fileUrl.substring(fileUrl.lastIndexOf('/') + 1),response);
}
public void exportIcbcExcel(IcbcExcelDto icbcExcelDto, HttpServletResponse response) {
List<String> sequenceNbrList = icbcExcelDto.getSequenceNbrList();
List<IcbcWithholdDto> icbcWithholdDtoList;
//如果为空导出全部
if(CollectionUtil.isEmpty(sequenceNbrList)){
icbcWithholdDtoList = this.getBaseMapper().queryForIcbcWithhold(icbcExcelDto);
}else {
icbcWithholdDtoList = this.getBaseMapper().queryForIcbcWithholdBySequenceNbrs(sequenceNbrList);
}
List<IcbcExcelVO> excelVOList = new ArrayList<>();
if(CollectionUtil.isNotEmpty(icbcWithholdDtoList)){
Integer index=1;
for (IcbcWithholdDto icbcWithholdDto : icbcWithholdDtoList) {
IcbcExcelVO icbcExcelVO = BeanUtil.copyProperties(icbcWithholdDto, IcbcExcelVO.class);
try {
icbcExcelVO.setConfirmationTime(DateUtils.dateFormat(icbcWithholdDto.getConfirmationTime(), DateUtils.DATE_TIME_PATTERN));
icbcExcelVO.setUploadTime(DateUtils.dateFormat(icbcWithholdDto.getUploadTime(), DateUtils.DATE_TIME_PATTERN));
} catch (ParseException e) {
log.error(e.getMessage(),e);
}
icbcExcelVO.setIndex(index++);
excelVOList.add(icbcExcelVO);
}
}
try {
ExcelUtils.exportExcelDefaultGroundColor(excelVOList, null, "批扣管理", IcbcExcelVO.class, "批扣管理" + DateUtils.dateFormat(new Date(), "YYYY-MM-dd-HH-mm") + ".xlsx", response);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new BadRequest("导出失败,失败原因[" + e.getMessage() + "]");
}
}
}
\ No newline at end of file
......@@ -1077,6 +1077,12 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
@Transactional(rollbackFor = Exception.class)
public void updateCompanyCode(JpStationDto reviewDto) {
if(Objects.nonNull(reviewDto.getSequenceNbr())){
if(StringUtils.isEmpty(reviewDto.getRegionalCompaniesCode())){
reviewDto.setRegionalCompaniesCode(null);
}
if(StringUtils.isEmpty(reviewDto.getAmosCompanyCode())){
reviewDto.setAmosCompanyCode(null);
}
LambdaUpdateWrapper<JpStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(JpStation::getRecDate,new Date())
.set(JpStation::getRegionalCompaniesCode,reviewDto.getRegionalCompaniesCode())
......@@ -1153,6 +1159,12 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
public void updateBatchCompanyCode(JpStationBatchDto jpStationBatchDto) {
if(CollectionUtil.isNotEmpty(jpStationBatchDto.getSequenceNbrList())){
if(StringUtils.isEmpty(jpStationBatchDto.getRegionalCompaniesCode())){
jpStationBatchDto.setRegionalCompaniesCode(null);
}
if(StringUtils.isEmpty(jpStationBatchDto.getAmosCompanyCode())){
jpStationBatchDto.setAmosCompanyCode(null);
}
LambdaUpdateWrapper<JpStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(JpStation::getRegionalCompaniesCode,jpStationBatchDto.getRegionalCompaniesCode())
.set(JpStation::getAmosCompanyCode,jpStationBatchDto.getAmosCompanyCode())
......
package com.yeejoin.amos.boot.module.hygf.biz.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value = "IcbcExcelVO", description = "聚富通管理ExcelVO")
public class IcbcExcelVO implements Serializable {
private static final long serialVersionUID = 1L;
@Excel(name = "序号", width = 20, orderNum = "1")
private Integer index;
@ApiModelProperty(value = "批次号")
@Excel(name = "批次号", width = 50, orderNum = "2")
private String batchNo;
@ApiModelProperty(value = "付款目标")
@Excel(name = "付款目标", width = 50, orderNum = "3")
private String paymentTarget;
@ApiModelProperty(value = "项目编号")
@Excel(name = "项目编号", width = 50, orderNum = "4")
private String projectNumber;
@ApiModelProperty(value = "付款总金额")
@Excel(name = "付款总金额", width = 30, orderNum = "5")
private String paymentAmount;
@ApiModelProperty(value = "确认人员")
@Excel(name = "确认人员", width = 30, orderNum = "6")
private String confirmator;
@ApiModelProperty(value = "确认时间")
@Excel(name = "确认时间", width = 50, orderNum = "7")
private String confirmationTime;
@ApiModelProperty(value = "说明")
@Excel(name = "说明", width = 50, orderNum = "8")
private String desc;
@ApiModelProperty(value = "上传状态")
@Excel(name = "上传状态", width = 30, orderNum = "9")
private String uploadStatus;
@ApiModelProperty(value = "上传人员")
@Excel(name = "上传人员", width = 30, orderNum = "10")
private String uploader;
@ApiModelProperty(value = "上传时间")
@Excel(name = "上传时间", width = 50, orderNum = "11")
private String uploadTime;
@ApiModelProperty(value = "代扣状态")
@Excel(name = "代扣状态", width = 30, orderNum = "12")
private String withholdStatus;
@ApiModelProperty(value = "失败原因")
@Excel(name = "失败原因", width = 50, orderNum = "13")
private String paymentErrorDesc;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment