Commit 17e10b01 authored by hongguangwu's avatar hongguangwu

MVP1.7.2 工行5次提交_定时任务

parent 72c5e8f5
...@@ -221,4 +221,10 @@ public class EkpBankGrantDetail { ...@@ -221,4 +221,10 @@ public class EkpBankGrantDetail {
@Schema(description = "MD码") @Schema(description = "MD码")
private String fdMdCode; private String fdMdCode;
@ExcelAttribute(name = "工资明细ID", maxLength = 36)
@Length(max = 36, message = "工资明细ID不能超过36个字符")
@ExcelProperty("工资明细ID")
@Schema(description = "工资明细ID,用来同步中信银行状态")
private String fdSalaryId;
} }
...@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.ekp.entity; ...@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.ekp.entity;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
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.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
...@@ -27,7 +28,10 @@ import lombok.Data; ...@@ -27,7 +28,10 @@ import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/** /**
* 发放日志(银企付款任务) * 发放日志(银企付款任务)
...@@ -64,14 +68,6 @@ public class EkpBankGrantLog { ...@@ -64,14 +68,6 @@ public class EkpBankGrantLog {
@ExcelProperty("代发批次号") @ExcelProperty("代发批次号")
@Schema(description = "代发批次号") @Schema(description = "代发批次号")
private String fdBatchNumber; private String fdBatchNumber;
/**
* 代发批次号ID:跳转使用
*/
@ExcelAttribute(name = "代发批次号ID:跳转使用", maxLength = 36)
@Length(max = 36, message = "代发批次号ID:跳转使用不能超过36个字符")
@ExcelProperty("代发批次号ID:跳转使用")
@Schema(description = "代发批次号ID:跳转使用")
private String fdBatchNumberId;
/** /**
* 批量包名称 * 批量包名称
*/ */
...@@ -125,28 +121,28 @@ public class EkpBankGrantLog { ...@@ -125,28 +121,28 @@ public class EkpBankGrantLog {
@ExcelAttribute(name = "交易时间", isDate = true) @ExcelAttribute(name = "交易时间", isDate = true)
@ExcelProperty("交易时间") @ExcelProperty("交易时间")
@Schema(description = "交易时间") @Schema(description = "交易时间")
private LocalDateTime fdTransactionTime; private Date fdTransactionTime;
/** /**
* 成功总金额 * 成功总金额
*/ */
@ExcelAttribute(name = "成功总金额") @ExcelAttribute(name = "成功总金额")
@ExcelProperty("成功总金额") @ExcelProperty("成功总金额")
@Schema(description = "成功总金额") @Schema(description = "成功总金额")
private Double fdSuccessFee; private BigDecimal fdSuccessFee;
/** /**
* 失败总金额 * 失败总金额
*/ */
@ExcelAttribute(name = "失败总金额") @ExcelAttribute(name = "失败总金额")
@ExcelProperty("失败总金额") @ExcelProperty("失败总金额")
@Schema(description = "失败总金额") @Schema(description = "失败总金额")
private Double fdFailFee; private BigDecimal fdFailFee;
/** /**
* 总金额 * 总金额
*/ */
@ExcelAttribute(name = "总金额") @ExcelAttribute(name = "总金额")
@ExcelProperty("总金额") @ExcelProperty("总金额")
@Schema(description = "总金额") @Schema(description = "总金额")
private Double fdSumFee; private BigDecimal fdSumFee;
/** /**
* 总笔数 * 总笔数
*/ */
......
...@@ -27,6 +27,7 @@ import lombok.Data; ...@@ -27,6 +27,7 @@ import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
/** /**
* 发放日志明细(银企付款任务) * 发放日志明细(银企付款任务)
...@@ -77,7 +78,7 @@ public class EkpBankGrantLogDetail { ...@@ -77,7 +78,7 @@ public class EkpBankGrantLogDetail {
@ExcelAttribute(name = "金额") @ExcelAttribute(name = "金额")
@ExcelProperty("金额") @ExcelProperty("金额")
@Schema(description = "金额") @Schema(description = "金额")
private Double fdMoney; private BigDecimal fdMoney;
/** /**
* 收款银行 * 收款银行
*/ */
......
package com.yifu.cloud.plus.v1.ekp.vo; package com.yifu.cloud.plus.v1.ekp.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -16,5 +17,17 @@ public class EkpBankResultVo implements Serializable { ...@@ -16,5 +17,17 @@ public class EkpBankResultVo implements Serializable {
private String fdId; private String fdId;
private String fdParentId; private String fdParentId;
private String fdWxNo; private String fdWxNo;
private String fdSalaryId;
@Schema(description = "付款银行名称")
private String fdBankName;
@Schema(description = "付款银行开户行")
private String fdBankNo;
@Schema(description = "付款银行账户")
private String fdBankAccount;
@Schema(description = "收款人名称")
private String fdPayeeName;
private Integer fdFailNum;
private Integer num; private Integer num;
} }
...@@ -51,6 +51,11 @@ public interface EkpBankGrantDetailMapper extends BaseMapper<EkpBankGrantDetail> ...@@ -51,6 +51,11 @@ public interface EkpBankGrantDetailMapper extends BaseMapper<EkpBankGrantDetail>
// 主表拒绝授权时,批量更新明细表为发放失败,原因为拒绝授权 // 主表拒绝授权时,批量更新明细表为发放失败,原因为拒绝授权
void updateStatusByGrantFail(@Param("fdParentId") String fdParentId); void updateStatusByGrantFail(@Param("fdParentId") String fdParentId);
// 发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
void updateZhongXinStatus(@Param("salaryIdList") List<String> salaryIdList);
// 发放失败,批量更新中信银行交易流水Model表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
void updateZhongXinMainStatus(@Param("salaryIdList") List<String> salaryIdList);
// 获取明细表ID来更新状态 // 获取明细表ID来更新状态
List<EkpBankGrantDetail> getListByParentId(@Param("fdParentId") String fdParentId); List<EkpBankGrantDetail> getListByParentId(@Param("fdParentId") String fdParentId);
......
...@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.ekp.service; ...@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.ekp.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.ekp.entity.EkpBankGrantDetail; import com.yifu.cloud.plus.v1.ekp.entity.EkpBankGrantDetail;
import com.yifu.cloud.plus.v1.ekp.vo.EkpBankExcelVo; import com.yifu.cloud.plus.v1.ekp.vo.EkpBankExcelVo;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -46,6 +47,11 @@ public interface EkpBankGrantDetailService extends IService<EkpBankGrantDetail> ...@@ -46,6 +47,11 @@ public interface EkpBankGrantDetailService extends IService<EkpBankGrantDetail>
// 主表发放时,更新明细表的发放时间与状态 // 主表发放时,更新明细表的发放时间与状态
void updateStatusByGrant(String fdParentId); void updateStatusByGrant(String fdParentId);
// 发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
void updateZhongXinStatus(List<String> salaryIdList);
void updateZhongXinMainStatus(List<String> salaryIdList);
// 主表拒绝授权时,批量更新明细表为发放失败,原因为拒绝授权 // 主表拒绝授权时,批量更新明细表为发放失败,原因为拒绝授权
void updateStatusByGrantFail(String fdParentId); void updateStatusByGrantFail(String fdParentId);
......
...@@ -62,6 +62,18 @@ public class EkpBankGrantDetailServiceImpl extends ServiceImpl<EkpBankGrantDetai ...@@ -62,6 +62,18 @@ public class EkpBankGrantDetailServiceImpl extends ServiceImpl<EkpBankGrantDetai
baseMapper.updateStatusByGrant(fdParentId); baseMapper.updateStatusByGrant(fdParentId);
} }
// 发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
@Override
public void updateZhongXinStatus(List<String> salaryIdList) {
baseMapper.updateZhongXinStatus(salaryIdList);
}
// 发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
@Override
public void updateZhongXinMainStatus(List<String> salaryIdList) {
baseMapper.updateZhongXinMainStatus(salaryIdList);
}
@Override @Override
public void updateStatusByGrantFail(String fdParentId) { public void updateStatusByGrantFail(String fdParentId) {
baseMapper.updateStatusByGrantFail(fdParentId); baseMapper.updateStatusByGrantFail(fdParentId);
......
...@@ -73,8 +73,26 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn ...@@ -73,8 +73,26 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
@Autowired @Autowired
private EkpBankAttaService ekpBankAttaService; private EkpBankAttaService ekpBankAttaService;
@Autowired @Autowired
private EkpBankGrantLogService ekpBankGrantLogService;
@Autowired
private EkpBankGrantLogDetailService ekpBankGrantLogDetailService;
@Autowired
private OSSUtil ossUtil; private OSSUtil ossUtil;
// 处理状态:00-提交成功,01-待银行处理 02-处理成功 03-处理失败,4-收方行处理中 5-收方行处理成功 6-收方行处理失败 7-收方行无法反馈
protected final static Map<String, String> STATUS_MAP;
static {
STATUS_MAP = new HashMap<>();
STATUS_MAP.put("00", "提交成功");
STATUS_MAP.put("01", "待银行处理");
STATUS_MAP.put("02", "处理成功");
STATUS_MAP.put("03", "处理失败");
STATUS_MAP.put("04", "收方行处理中");
STATUS_MAP.put("05", "收方行处理成功");
STATUS_MAP.put("06", "收方行处理失败");
STATUS_MAP.put("07", "收方行无法反馈");
}
//1、网关公钥 //1、网关公钥
//private static final String APIGW_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB"; //private static final String APIGW_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB";
//2、appid //2、appid
...@@ -726,11 +744,14 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn ...@@ -726,11 +744,14 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
// 1:获取发放中的主表数据,查询工行接口 // 1:获取发放中的主表数据,查询工行接口
List<EkpBankResultVo> mainList = ekpBankPayTaskService.getEkpBankMainByNeedResultMain(); List<EkpBankResultVo> mainList = ekpBankPayTaskService.getEkpBankMainByNeedResultMain();
// 2:获取主表已发放且明细表发放中的明细表数据,查询工行接口
List<EkpBankResultVo> detailList = ekpBankPayTaskService.getEkpBankMainByNeedResultDetail();
JftApiPayrollQueryDetailResponseV1 responseV1; JftApiPayrollQueryDetailResponseV1 responseV1;
// 发放日志
List<EkpBankGrantLog> logList = new ArrayList<>();
List<EkpBankGrantLogDetail> logDetailList = new ArrayList<>();
EkpBankGrantLog logs;
EkpBankGrantLogDetail logDetail;
BigDecimal money;
// 主表 // 主表
if (mainList != null && !mainList.isEmpty()) { if (mainList != null && !mainList.isEmpty()) {
int startNum; int startNum;
...@@ -740,7 +761,13 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn ...@@ -740,7 +761,13 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
EkpBankGrantDetail detailData; EkpBankGrantDetail detailData;
EkpBankPayTask main; EkpBankPayTask main;
List<EkpBankGrantDetail> oldDetailList; List<EkpBankGrantDetail> oldDetailList;
List<String> zhongXinSalaryIdList;
Map<String, EkpBankGrantDetail> oldMap; Map<String, EkpBankGrantDetail> oldMap;
BigDecimal moneySuccess;
BigDecimal moneyFail;
BigDecimal moneyAll;
int numSuccess;
int numFail;
for (EkpBankResultVo vo : mainList) { for (EkpBankResultVo vo : mainList) {
for (int i = 0; i < vo.getNum(); i += 50) { for (int i = 0; i < vo.getNum(); i += 50) {
startNum = i + 1; startNum = i + 1;
...@@ -754,7 +781,10 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn ...@@ -754,7 +781,10 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
if ("0".equals(responseV1.getReturn_code())) { if ("0".equals(responseV1.getReturn_code())) {
// 处理状态: 00-待提交,01-已提交 02-待授权 03-待银行处理, 04-处理成功,05-处理失败 // 处理状态: 00-待提交,01-已提交 02-待授权 03-待银行处理, 04-处理成功,05-处理失败
if ("04".equals(responseV1.getStatus())) { if ("04".equals(responseV1.getStatus())) {
//
// 生成日志主表
logs = saveNewEkpBankGrantLog(responseV1, vo);
dataList = responseV1.getDatalist(); dataList = responseV1.getDatalist();
oldDetailList = ekpBankGrantDetailService.getListByParentId(vo.getFdId()); oldDetailList = ekpBankGrantDetailService.getListByParentId(vo.getFdId());
oldMap = new HashMap<>(); oldMap = new HashMap<>();
...@@ -763,30 +793,72 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn ...@@ -763,30 +793,72 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
oldMap.put(temp.getFdSerialNumber(), temp); oldMap.put(temp.getFdSerialNumber(), temp);
} }
} }
moneyAll = BigDecimal.ZERO;
moneySuccess = BigDecimal.ZERO;
moneyFail = BigDecimal.ZERO;
numSuccess = 0;
numFail = 0;
if (dataList != null && !dataList.isEmpty()) { if (dataList != null && !dataList.isEmpty()) {
detailDataList = new ArrayList<>(); detailDataList = new ArrayList<>();
zhongXinSalaryIdList = new ArrayList<>();
for (JftApiPayrollQueryDetailResponseV1.JftApiPayrollDetail data : dataList) { for (JftApiPayrollQueryDetailResponseV1.JftApiPayrollDetail data : dataList) {
// 交易时间
if (Common.isNotNull(data.getCompanyHandleTime())) {
logs.setFdTransactionTime(DateUtil.stringToDate(data.getCompanyHandleTime(), DateUtil.DATETIME_PATTERN_SECOND));
}
money = BigDecimalUtils.safeDivide(new BigDecimal(data.getPayamt()), new BigDecimal("100"), 2);
moneyAll = BigDecimalUtils.safeAdd(moneyAll, money);
// 初始化日志明细
logDetail = setLogDetailBaseInfo(logs, money, vo, data);
detailData = oldMap.get(data.getPlatDetailId()); detailData = oldMap.get(data.getPlatDetailId());
if (detailData != null) { if (detailData != null) {
// 收款人名称
logDetail.setFdPayee(detailData.getFdPayeeName());
if ("02".equals(data.getResult())) { if ("02".equals(data.getResult())) {
moneySuccess = BigDecimalUtils.safeAdd(moneySuccess, money);
numSuccess++;
detailData.setFdGrantStatus("发放成功"); detailData.setFdGrantStatus("发放成功");
detailData.setFdHandleStatus("已处理");
} else { } else {
moneyFail = BigDecimalUtils.safeAdd(moneyFail, money);
numFail++;
detailData.setFdGrantStatus("发放失败"); detailData.setFdGrantStatus("发放失败");
detailData.setFdHandleStatus("");
detailData.setFdFailureFeedback(data.getCompanyHandlerResult()); detailData.setFdFailureFeedback(data.getCompanyHandlerResult());
// todo-生成发放失败待处理表数据-也可以 批量 生成 // 批量更新中信银行表数据,使发放失败处理有数据出现
zhongXinSalaryIdList.add(detailData.getFdSalaryId());
} }
detailDataList.add(detailData); detailDataList.add(detailData);
} }
logDetailList.add(logDetail);
} }
ekpBankGrantLogDetailService.saveBatch(logDetailList);
main = new EkpBankPayTask(); main = new EkpBankPayTask();
main.setFdId(vo.getFdId()); main.setFdId(vo.getFdId());
main.setFdGrantStatus("已发放"); main.setFdGrantStatus("已发放");
ekpBankPayTaskService.updateById(main); ekpBankPayTaskService.updateById(main);
// 更新明细状态为成功或失败 // 更新明细状态为成功或失败
ekpBankGrantDetailService.updateBatchById(detailDataList); ekpBankGrantDetailService.updateBatchById(detailDataList);
// 生成发放失败待处理表数据-也可以 批量 生成
} if (!zhongXinSalaryIdList.isEmpty()) {
ekpBankGrantDetailService.updateZhongXinStatus(zhongXinSalaryIdList);
ekpBankGrantDetailService.updateZhongXinMainStatus(zhongXinSalaryIdList);
}
}
// 失败总金额
logs.setFdFailFee(moneyFail);
// 成功总金额
logs.setFdSuccessFee(moneySuccess);
// 总金额
logs.setFdSumFee(moneyAll);
// 失败总笔数
logs.setFdTransactionFailToal(numFail);
// 成功总笔数
logs.setFdTransactionSuccessTotal(numSuccess);
ekpBankGrantLogService.updateById(logs);
} else if ("05".equals(responseV1.getStatus())) { } else if ("05".equals(responseV1.getStatus())) {
main = new EkpBankPayTask(); main = new EkpBankPayTask();
main.setFdId(vo.getFdId()); main.setFdId(vo.getFdId());
...@@ -795,7 +867,6 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn ...@@ -795,7 +867,6 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
// 更新明细状态为 发放失败,原因为拒绝授权 // 更新明细状态为 发放失败,原因为拒绝授权
ekpBankGrantDetailService.updateStatusByGrantFail(vo.getFdId()); ekpBankGrantDetailService.updateStatusByGrantFail(vo.getFdId());
} }
} }
return R.ok(); return R.ok();
} }
...@@ -803,42 +874,128 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn ...@@ -803,42 +874,128 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
} }
} }
// 2:获取主表已发放且明细表发放中的明细表数据,查询工行接口
List<EkpBankResultVo> detailList = ekpBankPayTaskService.getEkpBankMainByNeedResultDetail();
// 明细表 // 明细表
if (detailList != null && !detailList.isEmpty()) { if (detailList != null && !detailList.isEmpty()) {
List<JftApiPayrollQueryDetailResponseV1.JftApiPayrollDetail> dataList; List<JftApiPayrollQueryDetailResponseV1.JftApiPayrollDetail> dataList;
List<EkpBankGrantDetail> detailDataList = new ArrayList<>(); List<EkpBankGrantDetail> detailDataList = new ArrayList<>();
EkpBankGrantDetail detailData; EkpBankGrantDetail detailData;
List<String> zhongXinSalaryIdList = new ArrayList<>();
JftApiPayrollQueryDetailResponseV1.JftApiPayrollDetail data;
for (EkpBankResultVo vo : detailList) { for (EkpBankResultVo vo : detailList) {
responseV1 = selectIcbcTransactionFlowInfo(vo.getFdWxNo(), "1", "10"); responseV1 = selectIcbcTransactionFlowInfo(vo.getFdWxNo(), "1", "2");
if (Common.isNotNull(responseV1)) { if (Common.isNotNull(responseV1)) {
// Return_code返回码,交易成功返回0,正表示业务报错,负表示系统报错 // Return_code返回码,交易成功返回0,正表示业务报错,负表示系统报错
// Status处理状态: 00-待提交,01-已提交 02-待授权 03-待银行处理, 04-处理成功,05-处理失败 // Status处理状态: 00-待提交,01-已提交 02-待授权 03-待银行处理, 04-处理成功,05-处理失败
if ("0".equals(responseV1.getReturn_code()) && "04".equals(responseV1.getStatus())) { if ("0".equals(responseV1.getReturn_code()) && "04".equals(responseV1.getStatus())
&& responseV1.getDatalist() != null && !responseV1.getDatalist().isEmpty()) {
dataList = responseV1.getDatalist(); dataList = responseV1.getDatalist();
if (dataList != null && !dataList.isEmpty()) { // 明细只有一条
for (JftApiPayrollQueryDetailResponseV1.JftApiPayrollDetail data : dataList) { data = dataList.get(0);
money = BigDecimalUtils.safeDivide(new BigDecimal(data.getPayamt()), new BigDecimal("100"), 2);
// 生成日志主表
logs = saveNewEkpBankGrantLog(responseV1, vo);
// 失败总金额
logs.setFdFailFee(BigDecimal.ZERO);
// 成功总金额
logs.setFdSuccessFee(BigDecimal.ZERO);
// 总金额
logs.setFdSumFee(money);
// 失败总笔数
logs.setFdTransactionFailToal(0);
// 成功总笔数
logs.setFdTransactionSuccessTotal(0);
// 初始化日志明细
logDetail = setLogDetailBaseInfo(logs, money, vo, data);
// 收款人名称
logDetail.setFdPayee(vo.getFdPayeeName());
ekpBankGrantLogDetailService.save(logDetail);
detailData = new EkpBankGrantDetail(); detailData = new EkpBankGrantDetail();
detailData.setFdParentId(vo.getFdId()); detailData.setFdParentId(vo.getFdId());
detailData.setFdSerialNumber(data.getPlatDetailId()); detailData.setFdSerialNumber(data.getPlatDetailId());
if ("02".equals(data.getResult())) { if ("02".equals(data.getResult())) {
// 失败总笔数
logs.setFdTransactionSuccessTotal(1);
logs.setFdSuccessFee(money);
detailData.setFdGrantStatus("发放成功"); detailData.setFdGrantStatus("发放成功");
detailData.setFdHandleStatus("已处理");
} else { } else {
// 失败总笔数
logs.setFdTransactionFailToal(1);
// 失败总金额
logs.setFdFailFee(money);
detailData.setFdGrantStatus("发放失败"); detailData.setFdGrantStatus("发放失败");
detailData.setFdHandleStatus("");
detailData.setFdFailureFeedback(data.getCompanyHandlerResult()); detailData.setFdFailureFeedback(data.getCompanyHandlerResult());
// todo-生成发放失败待处理表数据-也可以 批量 生成 detailData.setFdFailNum(vo.getFdFailNum() + 1);
// 批量更新中信银行表数据,使发放失败处理有数据出现
zhongXinSalaryIdList.add(vo.getFdSalaryId());
} }
ekpBankGrantLogService.updateById(logs);
detailDataList.add(detailData); detailDataList.add(detailData);
} }
} }
} }
// 更新明细状态为成功或失败
ekpBankGrantDetailService.updateBatchById(detailDataList);
// 生成发放失败待处理表数据-也可以 批量 生成
if (!zhongXinSalaryIdList.isEmpty()) {
ekpBankGrantDetailService.updateZhongXinStatus(zhongXinSalaryIdList);
ekpBankGrantDetailService.updateZhongXinMainStatus(zhongXinSalaryIdList);
} }
} }
// todo-生成发放失败待处理表数据-也可以 批量 生成
// todo-更新明细状态为成功或失败
//ekpBankGrantDetailService.updateStatusByGrant(detailDataList);
}
return R.ok(); return R.ok();
} }
/**
* @Description: 初始化日志明细
* @Author: hgw
* @Date: 2024/11/26 20:08
* @return: com.yifu.cloud.plus.v1.ekp.entity.EkpBankGrantLogDetail
**/
private EkpBankGrantLogDetail setLogDetailBaseInfo(EkpBankGrantLog logs, BigDecimal money, EkpBankResultVo vo, JftApiPayrollQueryDetailResponseV1.JftApiPayrollDetail data) {
EkpBankGrantLogDetail logDetail;
logDetail = new EkpBankGrantLogDetail();
// 指令状态
logDetail.setFdCommandStatus(STATUS_MAP.get(data.getResult()));
logDetail.setFdParentId(logs.getFdId());
// 收款银行
logDetail.setFdRecipientBank(vo.getFdBankName());
logDetail.setFdMoney(money);
// 收款账号
logDetail.setFdPayeeAccount(data.getRecDepAcc());
logDetail.setFdRemark(data.getRemark());
// 汇款用途
logDetail.setFdRemittancePurpose("工资");
return logDetail;
}
/**
* @Description: 初始化生成日志主表
* @Author: hgw
* @Date: 2024/11/26 20:09
* @return: com.yifu.cloud.plus.v1.ekp.entity.EkpBankGrantLog
**/
private EkpBankGrantLog saveNewEkpBankGrantLog(JftApiPayrollQueryDetailResponseV1 responseV1, EkpBankResultVo vo) {
EkpBankGrantLog logs;
logs = new EkpBankGrantLog();
logs.setFdBatchNumber(vo.getFdWxNo());
logs.setFdParentId(vo.getFdId());
logs.setFdBatchPackage(responseV1.getRemark());
logs.setFdBusinessType("代发工资");
logs.setFdCurrency("人民币");
logs.setFdDrawee(vo.getFdBankName());
logs.setFdPaymentAccount(vo.getFdBankAccount());
logs.setFdSubmitTime(LocalDateTime.now());
// 总笔数
logs.setFdTransactionTotal(vo.getNum());
ekpBankGrantLogService.save(logs);
return logs;
}
} }
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
<result property="fdEmpPhone" column="fd_emp_phone"/> <result property="fdEmpPhone" column="fd_emp_phone"/>
<result property="fdWxNo" column="fd_wx_no"/> <result property="fdWxNo" column="fd_wx_no"/>
<result property="fdMdCode" column="fd_md_dcode"/> <result property="fdMdCode" column="fd_md_dcode"/>
<result property="fdSalaryId" column="fd_salary_id"/>
</resultMap> </resultMap>
<sql id="Base_Excel_Sql"> <sql id="Base_Excel_Sql">
...@@ -118,8 +119,35 @@ ...@@ -118,8 +119,35 @@
<select id="getListByParentId" resultMap="ekpBankGrantDetailMap"> <select id="getListByParentId" resultMap="ekpBankGrantDetailMap">
select select
a.fd_id,fd_serial_number a.fd_id,a.fd_salary_id,fd_serial_number
from ekp_bank_grant_detail a where a.fd_parent_id = #{fdParentId} from ekp_bank_grant_detail a where a.fd_parent_id = #{fdParentId}
</select> </select>
<!-- 发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde -->
<update id="updateZhongXinStatus">
update ekp_db4ed54e25543f4b7a9a a
set a.fd_3b148bc0c28e48='失败',a.fd_3c754f2a7125a0 = '1183b0b84ee4f581bba001c47a78b2d9',fd_3c754a976ddde2=now()
where
<if test="salaryIdList != null and salaryIdList.size() > 0">
a.fd_3b1fe00b0f5dde in
<foreach collection="salaryIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</update>
<!-- 发放失败,批量更新中信银行交易流水Model表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde -->
<update id="updateZhongXinMainStatus">
UPDATE modeling_simple_main a
JOIN ekp_db4ed54e25543f4b7a9a b on a.fd_id=b.fd_id
SET a.extend_data_xml=JSON_SET(a.extend_data_xml,'$[1].fd_3b148bc0c28e48', '失败', '$[1].fd_3c754f2a7125a0', '1183b0b84ee4f581bba001c47a78b2d9','$[1].fd_3c754a976ddde2', now())
where
<if test="salaryIdList != null and salaryIdList.size() > 0">
b.fd_3b56782982b8b2 in
<foreach collection="salaryIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</update>
</mapper> </mapper>
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
<resultMap id="ekpBankGrantLogMap" type="com.yifu.cloud.plus.v1.ekp.entity.EkpBankGrantLog"> <resultMap id="ekpBankGrantLogMap" type="com.yifu.cloud.plus.v1.ekp.entity.EkpBankGrantLog">
<id property="fdId" column="fd_id"/> <id property="fdId" column="fd_id"/>
<result property="fdBatchNumber" column="fd_batch_number"/> <result property="fdBatchNumber" column="fd_batch_number"/>
<result property="fdBatchNumberId" column="fd_batch_number_id"/>
<result property="fdBatchPackage" column="fd_batch_package"/> <result property="fdBatchPackage" column="fd_batch_package"/>
<result property="fdPaymentAccount" column="fd_payment_account"/> <result property="fdPaymentAccount" column="fd_payment_account"/>
<result property="fdDrawee" column="fd_drawee"/> <result property="fdDrawee" column="fd_drawee"/>
...@@ -44,7 +43,6 @@ ...@@ -44,7 +43,6 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.fd_id, a.fd_id,
a.fd_batch_number, a.fd_batch_number,
a.fd_batch_number_id,
a.fd_batch_package, a.fd_batch_package,
a.fd_payment_account, a.fd_payment_account,
a.fd_drawee, a.fd_drawee,
......
...@@ -87,7 +87,8 @@ ...@@ -87,7 +87,8 @@
<!-- 获取发放中的主表,查询结果 --> <!-- 获取发放中的主表,查询结果 -->
<select id="getEkpBankMainByNeedResultMain" resultType="com.yifu.cloud.plus.v1.ekp.vo.EkpBankResultVo"> <select id="getEkpBankMainByNeedResultMain" resultType="com.yifu.cloud.plus.v1.ekp.vo.EkpBankResultVo">
select a.fd_id fdId,a.fd_wx_no fdWxNo,count(d.fd_id) num select a.fd_id fdId,a.fd_wx_no fdWxNo
,count(d.fd_id) num,a.fd_bank_name fdBankName,a.fd_bank_no fdBankNo,a.fd_bank_account fdBankAccount,d.fd_payee_name fdPayeeName
from ekp_bank_pay_task a left join ekp_bank_grant_detail d on a.fd_id = d.fd_parent_id from ekp_bank_pay_task a left join ekp_bank_grant_detail d on a.fd_id = d.fd_parent_id
where a.fd_grant_status = '发放中' where a.fd_grant_status = '发放中'
GROUP BY a.fd_id GROUP BY a.fd_id
...@@ -95,7 +96,8 @@ ...@@ -95,7 +96,8 @@
<!-- 获取发放中的明细表,查询结果 --> <!-- 获取发放中的明细表,查询结果 -->
<select id="getEkpBankMainByNeedResultDetail" resultType="com.yifu.cloud.plus.v1.ekp.vo.EkpBankResultVo"> <select id="getEkpBankMainByNeedResultDetail" resultType="com.yifu.cloud.plus.v1.ekp.vo.EkpBankResultVo">
select d.fd_id fdId,d.fd_wx_no fdWxNo,d.fd_parent_id fdParentId,'1' num select d.fd_id fdId,d.fd_wx_no fdWxNo,d.fd_parent_id fdParentId,d.fd_fail_num fdFailNum,d.fd_salary_id fdSalaryId
,'1' num,a.fd_bank_name fdBankName,a.fd_bank_no fdBankNo,a.fd_bank_account fdBankAccount,d.fd_payee_name fdPayeeName
from ekp_bank_grant_detail d left join ekp_bank_pay_task a on a.fd_id = d.fd_parent_id from ekp_bank_grant_detail d left join ekp_bank_pay_task a on a.fd_id = d.fd_parent_id
where a.fd_grant_status = '已发放' and d.fd_grant_status = '发放失败' and d.fd_handle_status = '发放中' where a.fd_grant_status = '已发放' and d.fd_grant_status = '发放失败' and d.fd_handle_status = '发放中'
</select> </select>
......
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