Commit 50ea7b4a authored by chenzhao's avatar chenzhao

增加聚富通导出 增加定时获取回盘文件

parent 5a4cb052
## DB properties hygf ## DB properties hygf
## db1-production database ## db1-production database
spring.db1.datasource.type: com.alibaba.druid.pool.DruidDataSource spring.db1.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db1.datasource.url=jdbc:mysql://47.92.234.253:13306/amos_openapi?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db1.datasource.url=jdbc:kingbase8://39.98.224.23:54321/amos_openapi_47?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db1.datasource.username=root spring.db1.datasource.username=root
spring.db1.datasource.password=Yeejoin_1234 spring.db1.datasource.password=Yeejoin@2020
spring.db1.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.db1.datasource.driver-class-name=com.kingbase8.Driver
## db2-sync_data ## db2-sync_data
spring.db2.datasource.type: com.alibaba.druid.pool.DruidDataSource spring.db2.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db2.datasource.url=jdbc:mysql://47.92.234.253:13306/amos_project?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.db2.datasource.url=jdbc:kingbase8://39.98.224.23:54321/amos_project_47?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db2.datasource.username=root spring.db2.datasource.username=root
spring.db2.datasource.password=Yeejoin_1234 spring.db2.datasource.password=Yeejoin@2020
spring.db2.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.db2.datasource.driver-class-name=com.kingbase8.Driver
## db3-taosiData ## db3-taosiData
spring.db3.datasource.type: com.alibaba.druid.pool.DruidDataSource spring.db3.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db3.datasource.url=jdbc:TAOS-RS://47.92.234.253:6041/house_pv_data?user=root&password=taosdata&characterEncoding=utf8 spring.db3.datasource.url=jdbc:TAOS-RS://47.92.234.253:6041/house_pv_data?user=root&password=taosdata&characterEncoding=utf8
......
...@@ -56,7 +56,7 @@ public class HygfIcbcRecordExportDTO { ...@@ -56,7 +56,7 @@ public class HygfIcbcRecordExportDTO {
/** /**
* 聚富通电子账户账号 * 聚富通电子账户账号
*/ */
@ExcelProperty(value = "银行卡号", index = 4) @ExcelProperty(value = "聚富通账户", index = 4)
@ApiModelProperty (value = "聚富通电子账户账号") @ApiModelProperty (value = "聚富通电子账户账号")
private String mediumId; private String mediumId;
...@@ -74,7 +74,12 @@ public class HygfIcbcRecordExportDTO { ...@@ -74,7 +74,12 @@ public class HygfIcbcRecordExportDTO {
@ApiModelProperty (value = "协议状态, 0-未生效,1-已生效,2-过期,3-作废,4-待短信确认") @ApiModelProperty (value = "协议状态, 0-未生效,1-已生效,2-过期,3-作废,4-待短信确认")
private String protocolStatus; private String protocolStatus;
/**
* 协议状态, 0-未生效,1-已生效,2-过期,3-作废,4-待短信确认
*/
@ExcelProperty(value = "扣款总金额", index = 7)
@ApiModelProperty (value = "扣款总金额")
private double paymentAmount;
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* (hygf_icbc_record)实体类
*
* @author yangyang
* @description
* @since 2024-07-18 11:40:46
*/
@Data
@NoArgsConstructor
@ApiModel (value = "HygfIcbcRecordExportDTO", description = "聚富通钱包开户DTO")
public class HygfIcbcWithholdRecordExportDTO {
@ExcelIgnore
private static final long serialVersionUID = 1L;
@ExcelIgnore
protected Long sequenceNbr;
@ExcelProperty(value = "开户名", index = 0)
@ApiModelProperty (value = "开户名")
private String custName;
/**
* 身份证号
*/
@ExcelProperty(value = "项目公司", index = 1)
@ApiModelProperty(value = "项目公司")
private String regionalCompaniesName;
/**
* 手机号码
*/
@ExcelProperty(value = "批次号", index = 2)
@ApiModelProperty (value = "批次号")
private String batchNo;
/**
* 聚富通电子账户账号
*/
@ExcelProperty(value = "聚富通账户", index = 3)
@ApiModelProperty (value = "聚富通电子账户账号")
private String mediumId;
/**
*
*/
@ExcelProperty(value = "扣款金额", index = 4)
@ApiModelProperty (value = "扣款金额")
private double paymentAmount;
@ExcelProperty(value = "扣款状态", index = 5)
@ApiModelProperty (value = "扣款状态")
private String withholdStatus;
@ExcelProperty(value = "扣款时间", index = 6)
@ApiModelProperty (value = "扣款时间")
private Date paymentTime;
@ExcelProperty(value = "操作人", index = 7)
@ApiModelProperty (value = "操作人")
private String uploader;
@ExcelProperty(value = "说明", index =8)
@ApiModelProperty (value = "说明")
private String desc;
}
\ No newline at end of file
...@@ -114,7 +114,7 @@ public class IcbcWithhold extends BaseEntity { ...@@ -114,7 +114,7 @@ public class IcbcWithhold extends BaseEntity {
private String paymentErrorDesc; private String paymentErrorDesc;
/** /**
* 户主icbcid * 户主icbcid 弃用冗余 传递导出参数使用
*/ */
@TableField("icbc_id") @TableField("icbc_id")
private String icbcId; private String icbcId;
......
...@@ -32,4 +32,7 @@ public interface HygfIcbcRecordMapper extends BaseMapper<HygfIcbcRecord> { ...@@ -32,4 +32,7 @@ public interface HygfIcbcRecordMapper extends BaseMapper<HygfIcbcRecord> {
@UserEmpower (field = {"ph.regional_companies_code"}, dealerField = {"ph.developer_code", "ph.regional_companies_code", "ph.developer_user_id"}, fieldConditions = {"in", "in", "in"}, relationship = "and") @UserEmpower (field = {"ph.regional_companies_code"}, dealerField = {"ph.developer_code", "ph.regional_companies_code", "ph.developer_user_id"}, fieldConditions = {"in", "in", "in"}, relationship = "and")
List<HygfIcbcRecordExportDTO> exportTotal(String developerCode, String regionalCompaniesCode, String province, String city, String district); List<HygfIcbcRecordExportDTO> exportTotal(String developerCode, String regionalCompaniesCode, String province, String city, String district);
@UserEmpower (field = {"ph.regional_companies_code"}, dealerField = {"ph.developer_code", "ph.regional_companies_code", "ph.developer_user_id"}, fieldConditions = {"in", "in", "in"}, relationship = "and")
List<HygfIcbcRecordExportDTO> paymentAmountExport(String developerCode, String regionalCompaniesCode, String province, String city, String district);
} }
...@@ -316,7 +316,7 @@ public class SFTPUtil { ...@@ -316,7 +316,7 @@ public class SFTPUtil {
// return success; // return success;
// } // }
public boolean downloadAndZipFiles(String remotePath, String filenamePattern, String localZipPath) { public boolean downloadAndZipFiles(String remotePath, String filenamePattern, String localZipPath,Boolean flag) {
boolean success = false; boolean success = false;
Path tempDir = null; Path tempDir = null;
try { try {
...@@ -336,7 +336,10 @@ public class SFTPUtil { ...@@ -336,7 +336,10 @@ public class SFTPUtil {
downloadedFiles.add(localFilePath); downloadedFiles.add(localFilePath);
} }
} }
if (flag){
disconnect(); disconnect();
}
// 确保本地ZIP路径的父目录存在 // 确保本地ZIP路径的父目录存在
Path localZipFilePath = Paths.get(localZipPath); Path localZipFilePath = Paths.get(localZipPath);
Path parentDir = localZipFilePath.getParent(); Path parentDir = localZipFilePath.getParent();
......
...@@ -180,10 +180,13 @@ ...@@ -180,10 +180,13 @@
'待短信确认' ELSE'' '待短信确认' ELSE''
END END
) AS protocolStatus, ) AS protocolStatus,
MAX( CASE re.open_account_status WHEN 02 THEN '开户成功' WHEN 03 THEN '开户失败' ELSE'未开户' END ) AS openAccountStatus MAX( CASE re.open_account_status WHEN 02 THEN '开户成功' WHEN 03 THEN '开户失败' ELSE'未开户' END ) AS openAccountStatus,
SUM(iw.payment_amount) as paymentAmount
FROM FROM
`hygf_peasant_household` ph `hygf_peasant_household` ph
LEFT JOIN hygf_icbc_record re ON re.amos_user_id = ph.amos_user_id LEFT JOIN hygf_icbc_record re ON re.amos_user_id = ph.amos_user_id
LEFT JOIN hygf_icbc_withhold_record iw ON re.amos_user_id = iw.amos_user_id
<where> <where>
<if test="developerCode != null and developerCode != ''"> <if test="developerCode != null and developerCode != ''">
AND ph.developer_code = #{developerCode} AND ph.developer_code = #{developerCode}
...@@ -204,4 +207,67 @@ ...@@ -204,4 +207,67 @@
GROUP BY GROUP BY
ph.amos_user_id ph.amos_user_id
</select> </select>
<select id="paymentAmountExport" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordExportDTO">
WITH PaymentAmounts AS (
SELECT
iw.amos_user_id,
SUM(iw.payment_amount) AS paymentAmount
FROM
hygf_icbc_withhold_record iw
WHERE
iw.withhold_status = '成功'
GROUP BY
iw.amos_user_id
)
SELECT
MAX(ph.owners_name) AS custName,
MAX(ph.telephone) AS phone,
MAX(ph.id_card) AS idCard,
MAX(ph.regional_companies_name) AS regionalCompaniesName,
MAX(re.medium_id) AS mediumId,
MAX(
CASE re.protocol_status
WHEN 0 THEN '未生效'
WHEN 1 THEN '已生效'
WHEN 2 THEN '过期'
WHEN 3 THEN '作废'
WHEN 4 THEN '待短信确认'
ELSE ''
END
) AS protocolStatus,
MAX(
CASE re.open_account_status
WHEN '02' THEN '开户成功'
WHEN '03' THEN '开户失败'
ELSE '未开户'
END
) AS openAccountStatus,
pa.paymentAmount AS paymentAmount
FROM
`hygf_peasant_household` ph
LEFT JOIN
hygf_icbc_record re ON re.amos_user_id = ph.amos_user_id
LEFT JOIN
PaymentAmounts pa ON pa.amos_user_id = ph.amos_user_id
<where>
<if test="developerCode != null and developerCode != ''">
AND ph.developer_code = #{developerCode}
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND ph.regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="province != null and province != ''">
AND ph.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if test="city != null and city != ''">
AND ph.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if test="district != null and district != ''">
AND ph.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY
ph.amos_user_id, pa.paymentAmount;
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.IcbcWithholdRecordDto; ...@@ -8,6 +8,7 @@ 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.IcbcWithhold;
import com.yeejoin.amos.boot.module.hygf.api.entity.IcbcWithholdRecord; import com.yeejoin.amos.boot.module.hygf.api.entity.IcbcWithholdRecord;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil; import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -16,6 +17,8 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController; ...@@ -16,6 +17,8 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.IcbcWithholdServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.IcbcWithholdServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -157,9 +160,11 @@ public class IcbcWithholdController extends BaseController { ...@@ -157,9 +160,11 @@ public class IcbcWithholdController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = " 聚富通代扣信息文件生成", notes = " 聚富通代扣信息文件生成") @ApiOperation(httpMethod = "POST",value = " 聚富通代扣信息文件生成", notes = " 聚富通代扣信息文件生成")
@PostMapping(value = "/fileGeneration") @PostMapping(value = "/fileGeneration")
public ResponseModel fileGeneration(@RequestBody IcbcWithhold model ) throws Exception { @Transactional
public ResponseModel fileGeneration(@RequestBody List<IcbcWithhold> models ) throws Exception {
for (IcbcWithhold model : models) {
icbcWithholdServiceImpl.fileGeneration(model); icbcWithholdServiceImpl.fileGeneration(model);
}
return CommonResponseNewUtil.success(); return CommonResponseNewUtil.success();
} }
/** /**
...@@ -170,9 +175,12 @@ public class IcbcWithholdController extends BaseController { ...@@ -170,9 +175,12 @@ public class IcbcWithholdController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = " 聚富通代扣信息文件上传", notes = " 聚富通代扣信息文件上传") @ApiOperation(httpMethod = "GET",value = " 聚富通代扣信息文件上传", notes = " 聚富通代扣信息文件上传")
@GetMapping(value = "/sftpUploadAndUnzip") @GetMapping(value = "/sftpUploadAndUnzip")
public ResponseModel sftpUploadAndUnzip( String fileUrl,String batchNo ) throws Exception { @Transactional
public ResponseModel sftpUploadAndUnzip(List<Map<String,String>> maps) throws Exception {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
icbcWithholdServiceImpl.sftpUploadAndUnzip(fileUrl,batchNo,reginParams.getUserModel().getRealName()); for (Map<String, String> map : maps) {
icbcWithholdServiceImpl.sftpUploadAndUnzip(map.get("fileUrl"),map.get("batchNo"),reginParams.getUserModel().getRealName());
}
return CommonResponseNewUtil.success(); return CommonResponseNewUtil.success();
} }
...@@ -207,7 +215,7 @@ public class IcbcWithholdController extends BaseController { ...@@ -207,7 +215,7 @@ public class IcbcWithholdController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "批次人员信息下载", notes = "批次人员信息下载") @ApiOperation(httpMethod = "POST",value = "批次明细信息下载", notes = "批次明细信息下载")
@PostMapping(value = "/export") @PostMapping(value = "/export")
public void downTemplate(HttpServletResponse response, @RequestBody IcbcWithhold model ) { public void downTemplate(HttpServletResponse response, @RequestBody IcbcWithhold model ) {
......
...@@ -91,6 +91,8 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit ...@@ -91,6 +91,8 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
public String sftpIp; public String sftpIp;
@Value("${icbc.Withhold.sftpPort}") @Value("${icbc.Withhold.sftpPort}")
public int sftpPort; public int sftpPort;
@Autowired
IcbcWithholdRecordMapper icbcWithholdRecordMapper;
@Value("${icbc.Withhold.sftpUserName}") @Value("${icbc.Withhold.sftpUserName}")
public String sftpUserName; public String sftpUserName;
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd"); private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
...@@ -125,6 +127,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit ...@@ -125,6 +127,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
* 生成文件 * 生成文件
* *
*/ */
public void fileGeneration(IcbcWithhold model) throws Exception { public void fileGeneration(IcbcWithhold model) throws Exception {
model.setUploadStatus(UploadStatusEnum.未上传.getName()); model.setUploadStatus(UploadStatusEnum.未上传.getName());
int billNo = 0; int billNo = 0;
...@@ -381,7 +384,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit ...@@ -381,7 +384,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
IcbcWithhold model = this.getBaseMapper().selectById(sequenceNbr); IcbcWithhold model = this.getBaseMapper().selectById(sequenceNbr);
if (StringUtils.isNotEmpty(model.getReceiptFile())){ if (StringUtils.isNotEmpty(model.getReceiptFile())){
this.downloadAndSaveZipFile(model.getReceiptFile(),batchNo,"回盘文件",response); this.downloadAndSaveZipFile(model.getReceiptFile(),batchNo,"回盘文件",response);
} }else {
String path = new ClassPathResource(file+"secretKey/登录-gxjrid_rsa").getPath(); String path = new ClassPathResource(file+"secretKey/登录-gxjrid_rsa").getPath();
SFTPUtil sftp = new SFTPUtil(sftpIp, sftpPort, SFTPUtil sftp = new SFTPUtil(sftpIp, sftpPort,
...@@ -409,7 +412,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit ...@@ -409,7 +412,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
} }
System.out.println("Current working directory: " + System.getProperty("user.dir")); System.out.println("Current working directory: " + System.getProperty("user.dir"));
if (sftp.isExist(downLoadPath)) { if (sftp.isExist(downLoadPath)) {
sftp.downloadAndZipFiles(downLoadPath,batchNo,dirPath.toString()+"/"+batchNo+".zip"); sftp.downloadAndZipFiles(downLoadPath,batchNo,dirPath.toString()+"/"+batchNo+".zip",true);
logger.info("文件下载成功"); logger.info("文件下载成功");
} }
try { try {
...@@ -428,10 +431,77 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit ...@@ -428,10 +431,77 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
} finally { } finally {
cleanup(dirPath); cleanup(dirPath);
} }
}
} }
@Scheduled(cron = "${withholdReceiptFileCron}")
void setReceiptFile() throws Exception {
String path = new ClassPathResource(file+"secretKey/登录-gxjrid_rsa").getPath();
SFTPUtil sftp = new SFTPUtil(sftpIp, sftpPort,
sftpUserName,
path, null);
logger.info(String.valueOf(new StringBuffer().append("服务器地址: ")
.append(sftp.getHostName()).append(" 端口:")
.append(sftp.getPort()).append("用户名:")
.append(sftp.getUserName()).append("密钥文件:")
.append(sftp.getPriKeyFile())));
sftp.priKeyConnect();
//获取所有已上传但代扣状态为空的数据
LambdaQueryWrapper<IcbcWithhold> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcbcWithhold::getWithholdStatus,UploadStatusEnum.成功.getName()).or().eq(IcbcWithhold::getWithholdStatus,UploadStatusEnum.失败.getName());
wrapper.isNull(IcbcWithhold::getReceiptFile);
List<IcbcWithhold> icbcWithholds = this.getBaseMapper().selectList(wrapper);
boolean flag = false;
Iterator<IcbcWithhold> iterator = icbcWithholds.iterator();
while (iterator.hasNext()){
IcbcWithhold model = iterator.next();
Path currentWorkingDir = Paths.get("");
Path dirPath = currentWorkingDir.resolve(model.getBatchNo());
//没有下一个元素的时候关闭连接
if (!iterator.hasNext()){
flag = true;
}
try {
if (!Files.exists(dirPath)) {
Files.createDirectories(dirPath);
System.out.println("Directory created: " + dirPath);
} else {
System.out.println("Directory already exists: " + dirPath);
}
} catch (IOException e) {
e.printStackTrace();
System.err.println("Failed to create directory: " + dirPath);
}
System.out.println("Current working directory: " + System.getProperty("user.dir"));
if (sftp.isExist(downLoadPath)) {
sftp.downloadAndZipFiles(downLoadPath,model.getBatchNo(),dirPath.toString()+"/"+model.getBatchNo()+".zip",flag);
logger.info("文件下载成功");
}
try {
MultipartFile multipartFile = fileToMultipartFile(new File(dirPath.toString() + "/" + model.getBatchNo() + ".zip"));
FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFile(multipartFile);
if (result != null) {
for (String url : result.getResult().keySet()) {
model.setReceiptFile(url);
}
this.saveOrUpdate(model);
}
} catch ( Exception e) {
logger.error("平台上传文件失败");
e.printStackTrace();
} finally {
cleanup(dirPath);
}
}
}
@Scheduled(cron = "${withholdStatusCron}") @Scheduled(cron = "${withholdStatusCron}")
public void updateWithholdStatus() throws Exception { public void updateWithholdStatus() throws Exception {
//获取所有已上传但代扣状态为空的数据 //获取所有已上传但代扣状态为空的数据
...@@ -519,6 +589,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit ...@@ -519,6 +589,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
* @param fileUrl 文件url地址 * @param fileUrl 文件url地址
* @param batchNo 批次号 * @param batchNo 批次号
*/ */
@Async
public void sftpUploadAndUnzip(String fileUrl,String batchNo,String uploader ) { public void sftpUploadAndUnzip(String fileUrl,String batchNo,String uploader ) {
Path currentWorkingDir = Paths.get(""); Path currentWorkingDir = Paths.get("");
Path dirPath = currentWorkingDir.resolve(batchNo); Path dirPath = currentWorkingDir.resolve(batchNo);
...@@ -643,18 +714,25 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit ...@@ -643,18 +714,25 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
public void exportData(HttpServletResponse response, IcbcWithhold icbcWithhold ){ public void exportData(HttpServletResponse response, IcbcWithhold icbcWithhold ){
List<HygfIcbcRecordExportDTO> dtos = new ArrayList<>(); List<HygfIcbcWithholdRecordExportDTO> datas = new ArrayList<>();
JSONArray.parseArray(icbcWithhold.getIcbcRecordInfos(),IcbcWithholdRecord.class).forEach(e->{ IcbcWithholdRecordDto dto = new IcbcWithholdRecordDto();
HygfIcbcRecordExportDTO hygfIcbcRecordExportDTO = new HygfIcbcRecordExportDTO(); if (StringUtils.isNotEmpty(icbcWithhold.getBatchNo())){
BeanUtil.copyProperties(e,hygfIcbcRecordExportDTO); dto.setBatchNo(icbcWithhold.getBatchNo());
hygfIcbcRecordExportDTO.setOpenAccountStatus(e.getOpenAccountStatusName()); }
hygfIcbcRecordExportDTO.setProtocolStatus(e.getProtocolStatusName()); if (StringUtils.isNotEmpty(icbcWithhold.getIcbcId())){
dtos.add(hygfIcbcRecordExportDTO); dto.setAmosUserId(icbcWithhold.getIcbcId());
}); }
List<IcbcWithholdRecordDto> dtos = icbcWithholdRecordMapper.exportTotal(null, null, null, null, null,null,null,null,dto);
for (IcbcWithholdRecordDto icbcWithholdRecordDto : dtos) {
HygfIcbcWithholdRecordExportDTO exportDTO = new HygfIcbcWithholdRecordExportDTO();
BeanUtil.copyProperties(icbcWithholdRecordDto,exportDTO);
exportDTO.setDesc(icbcWithhold.getDesc());
datas.add(exportDTO);
}
if (CollectionUtil.isNotEmpty(dtos)){ if (CollectionUtil.isNotEmpty(datas)){
ExcelUtil.createTemplate(response,icbcWithhold.getBatchNo()+"人员信息",icbcWithhold.getBatchNo()+"人员信息",dtos,HygfIcbcRecordExportDTO.class,null,false); ExcelUtil.createTemplate(response,icbcWithhold.getBatchNo()+"人员信息",icbcWithhold.getBatchNo()+"人员信息",datas,HygfIcbcRecordExportDTO.class,null,false);
} }
} }
......
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