Commit 50ea7b4a authored by chenzhao's avatar chenzhao

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

parent 5a4cb052
## DB properties hygf
## db1-production database
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.password=Yeejoin_1234
spring.db1.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.db1.datasource.password=Yeejoin@2020
spring.db1.datasource.driver-class-name=com.kingbase8.Driver
## db2-sync_data
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.password=Yeejoin_1234
spring.db2.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.db2.datasource.password=Yeejoin@2020
spring.db2.datasource.driver-class-name=com.kingbase8.Driver
## db3-taosiData
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
......
......@@ -56,7 +56,7 @@ public class HygfIcbcRecordExportDTO {
/**
* 聚富通电子账户账号
*/
@ExcelProperty(value = "银行卡号", index = 4)
@ExcelProperty(value = "聚富通账户", index = 4)
@ApiModelProperty (value = "聚富通电子账户账号")
private String mediumId;
......@@ -74,7 +74,12 @@ public class HygfIcbcRecordExportDTO {
@ApiModelProperty (value = "协议状态, 0-未生效,1-已生效,2-过期,3-作废,4-待短信确认")
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 {
private String paymentErrorDesc;
/**
* 户主icbcid
* 户主icbcid 弃用冗余 传递导出参数使用
*/
@TableField("icbc_id")
private String icbcId;
......
......@@ -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")
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 {
// 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;
Path tempDir = null;
try {
......@@ -336,7 +336,10 @@ public class SFTPUtil {
downloadedFiles.add(localFilePath);
}
}
disconnect();
if (flag){
disconnect();
}
// 确保本地ZIP路径的父目录存在
Path localZipFilePath = Paths.get(localZipPath);
Path parentDir = localZipFilePath.getParent();
......
......@@ -180,10 +180,13 @@
'待短信确认' ELSE''
END
) 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
`hygf_peasant_household` ph
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>
<if test="developerCode != null and developerCode != ''">
AND ph.developer_code = #{developerCode}
......@@ -204,4 +207,67 @@
GROUP BY
ph.amos_user_id
</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>
\ No newline at end of file
......@@ -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.IcbcWithholdRecord;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -16,6 +17,8 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.io.IOException;
import java.util.List;
import java.util.Map;
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.ResponseModel;
......@@ -157,9 +160,11 @@ public class IcbcWithholdController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = " 聚富通代扣信息文件生成", notes = " 聚富通代扣信息文件生成")
@PostMapping(value = "/fileGeneration")
public ResponseModel fileGeneration(@RequestBody IcbcWithhold model ) throws Exception {
icbcWithholdServiceImpl.fileGeneration(model);
@Transactional
public ResponseModel fileGeneration(@RequestBody List<IcbcWithhold> models ) throws Exception {
for (IcbcWithhold model : models) {
icbcWithholdServiceImpl.fileGeneration(model);
}
return CommonResponseNewUtil.success();
}
/**
......@@ -170,9 +175,12 @@ public class IcbcWithholdController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = " 聚富通代扣信息文件上传", notes = " 聚富通代扣信息文件上传")
@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();
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();
}
......@@ -207,7 +215,7 @@ public class IcbcWithholdController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "批次人员信息下载", notes = "批次人员信息下载")
@ApiOperation(httpMethod = "POST",value = "批次明细信息下载", notes = "批次明细信息下载")
@PostMapping(value = "/export")
public void downTemplate(HttpServletResponse response, @RequestBody IcbcWithhold model ) {
......
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