Commit 247a3280 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.7.2' into MVP1.7.2

parents 5edb7e25 b207ea5d
......@@ -301,6 +301,23 @@ public class DateUtil {
}
}
public static Date stringToDateByFormat(String dateText, String format) {
if (dateText == null) {
return null;
}
try {
// 兼容多格式,格式化为没有分隔符的格式:
if (format == null) {
format = ISO_DATE_FORMAT;
}
DateFormat df = new SimpleDateFormat(format);
df.setLenient(false);
return df.parse(dateText);
} catch (ParseException e) {
return null;
}
}
/**
* @Description: 格式化字符串日期
* @Author: hgw
......
......@@ -259,6 +259,12 @@ public class EkpBankPayTask {
@Schema(description = "MD码")
private String fdMdCode;
@ExcelAttribute(name = "失败原因", maxLength = 500)
@Length(max = 500, message = "失败原因不能超过500个字符")
@ExcelProperty("失败原因")
@Schema(description = "失败原因")
private String fdErrorMsg;
// 明细条数
@TableField(exist = false)
private String num;
......
......@@ -26,13 +26,13 @@ public class EkpBankExcelVo implements Serializable {
private String baoXiaoNumber;
@ExcelProperty("单据张数")
private String danJuNumber;
@ExcelProperty("付款账号名称/卡名称")
private String fdBankName;
@ExcelProperty("付款账号开户行")
private String fdBankNo;
@ExcelProperty("付款账号/卡号")
private String fdBankAccount;
@ExcelProperty("付款账号名称/卡名称")
private String fdBankName;
// 收款银行
@ExcelProperty("收款账号开户行")
private String fdRecipientBank;
......
......@@ -27,6 +27,8 @@ public class EkpBankResultVo implements Serializable {
private String fdBankAccount;
@Schema(description = "收款人名称")
private String fdPayeeName;
@Schema(description = "收款银行")
private String fdRecipientBank;
private Integer fdGrantNum;
private Integer fdFailNum;
......
......@@ -52,9 +52,9 @@ public interface EkpBankGrantDetailMapper extends BaseMapper<EkpBankGrantDetail>
void updateStatusByGrantFail(@Param("fdParentId") String fdParentId);
// 发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
void updateZhongXinStatus(@Param("salaryIdList") List<String> salaryIdList);
void updateZhongXinStatus(@Param("salaryId") String salaryId, @Param("detailId") String detailId);
// 发放失败,批量更新中信银行交易流水Model表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
void updateZhongXinMainStatus(@Param("salaryIdList") List<String> salaryIdList);
void updateZhongXinMainStatus(@Param("salaryId") String salaryId, @Param("detailId") String detailId);
// 发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
void updateZhongXinStatusAndBankInfo(@Param("salaryIdList") List<String> salaryIdList);
......
......@@ -48,8 +48,8 @@ public interface EkpBankGrantDetailService extends IService<EkpBankGrantDetail>
void updateStatusByGrant(String fdParentId);
// 发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
void updateZhongXinStatus(List<String> salaryIdList);
void updateZhongXinMainStatus(List<String> salaryIdList);
void updateZhongXinStatus(String salaryId, String detailId);
void updateZhongXinMainStatus(String salaryId, String detailId);
// 明细再次-发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
void updateZhongXinStatusAndBankInfo(List<String> salaryIdList);
......
......@@ -64,14 +64,14 @@ public class EkpBankGrantDetailServiceImpl extends ServiceImpl<EkpBankGrantDetai
// 发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
@Override
public void updateZhongXinStatus(List<String> salaryIdList) {
baseMapper.updateZhongXinStatus(salaryIdList);
public void updateZhongXinStatus(String salaryId, String detailId) {
baseMapper.updateZhongXinStatus(salaryId, detailId);
}
// 发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
@Override
public void updateZhongXinMainStatus(List<String> salaryIdList) {
baseMapper.updateZhongXinMainStatus(salaryIdList);
public void updateZhongXinMainStatus(String salaryId, String detailId) {
baseMapper.updateZhongXinMainStatus(salaryId, detailId);
}
// 明细再次-发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
......
......@@ -803,7 +803,6 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
EkpBankGrantDetail detailData;
EkpBankPayTask main;
List<EkpBankGrantDetail> oldDetailList;
List<String> zhongXinSalaryIdList;
Map<String, EkpBankGrantDetail> oldMap;
BigDecimal moneySuccess;
BigDecimal moneyFail;
......@@ -825,7 +824,8 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
// 返回码,交易成功返回0,正表示业务报错,负表示系统报错
if ("0".equals(responseV1.getReturn_code())) {
// 处理状态: 00-待提交,01-已提交 02-待授权 03-待银行处理, 04-处理成功,05-处理失败
if ("04".equals(responseV1.getStatus())) {
if ("04".equals(responseV1.getStatus())
|| ("05".equals(responseV1.getStatus()) && responseV1.getDatalist() != null && !responseV1.getDatalist().isEmpty() )) {
// 生成日志主表
logs = saveNewEkpBankGrantLog(responseV1, vo);
......@@ -845,12 +845,11 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
numFail = 0;
if (dataList != null && !dataList.isEmpty()) {
detailDataList = new ArrayList<>();
zhongXinSalaryIdList = new ArrayList<>();
for (JftApiPayrollQueryDetailResponseV1.JftApiPayrollDetail data : dataList) {
// 交易时间
if (Common.isNotNull(data.getCompanyHandleTime())) {
logs.setFdTransactionTime(DateUtil.stringToDate(data.getCompanyHandleTime(), DateUtil.DATETIME_PATTERN_SECOND));
logs.setFdTransactionTime(DateUtil.stringToDateByFormat(data.getCompanyHandleTime(), DateUtil.DATETIME_PATTERN_SECOND));
}
money = BigDecimalUtils.safeDivide(new BigDecimal(data.getPayamt()), new BigDecimal("100"), 2);
moneyAll = BigDecimalUtils.safeAdd(moneyAll, money);
......@@ -861,19 +860,22 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
if (detailData != null) {
// 收款人名称
logDetail.setFdPayee(detailData.getFdPayeeName());
// 收款银行
logDetail.setFdRecipientBank(detailData.getFdRecipientBank());
if ("02".equals(data.getResult())) {
moneySuccess = BigDecimalUtils.safeAdd(moneySuccess, money);
numSuccess++;
detailData.setFdGrantStatus("发放成功");
detailData.setFdHandleStatus("已处理");
} else {
moneyFail = BigDecimalUtils.safeAdd(moneyFail, money);
numFail++;
detailData.setFdGrantStatus("发放失败");
detailData.setFdHandleStatus("");
detailData.setFdFailureFeedback(data.getCompanyHandlerResult());
detailData.setFdFailNum(detailData.getFdFailNum() + 1);
// 批量更新中信银行表数据,使发放失败处理有数据出现
zhongXinSalaryIdList.add(detailData.getFdSalaryId());
ekpBankGrantDetailService.updateZhongXinStatus(detailData.getFdSalaryId(), detailData.getFdId());
ekpBankGrantDetailService.updateZhongXinMainStatus(detailData.getFdSalaryId(), detailData.getFdId());
}
detailDataList.add(detailData);
}
......@@ -883,15 +885,10 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
main = new EkpBankPayTask();
main.setFdId(vo.getFdId());
main.setFdGrantStatus("已发放");
main.setFdGrantNum(vo.getFdGrantNum()+1);
ekpBankPayTaskService.updateById(main);
// 更新明细状态为成功或失败
ekpBankGrantDetailService.updateBatchById(detailDataList);
// 生成发放失败待处理表数据-也可以 批量 生成
if (!zhongXinSalaryIdList.isEmpty()) {
ekpBankGrantDetailService.updateZhongXinStatus(zhongXinSalaryIdList);
ekpBankGrantDetailService.updateZhongXinMainStatus(zhongXinSalaryIdList);
}
}
if (numSuccess > 0) {
......@@ -913,6 +910,7 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
main = new EkpBankPayTask();
main.setFdId(vo.getFdId());
main.setFdGrantStatus("拒绝授权");
main.setFdErrorMsg(responseV1.getErrordesc());
ekpBankPayTaskService.updateById(main);
// 更新明细状态为 发放失败,原因为拒绝授权
//ekpBankGrantDetailService.updateStatusByGrantFail(vo.getFdId())
......@@ -933,7 +931,6 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
List<JftApiPayrollQueryDetailResponseV1.JftApiPayrollDetail> dataList;
List<EkpBankGrantDetail> detailDataList = new ArrayList<>();
EkpBankGrantDetail detailData;
List<String> zhongXinSalaryIdList = new ArrayList<>();
JftApiPayrollQueryDetailResponseV1.JftApiPayrollDetail data;
List<EkpBankIcbcLog> icbcLogList = new ArrayList<>();
for (EkpBankResultVo vo : detailList) {
......@@ -943,7 +940,7 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
setIcbcLogBaseInfo(responseV1, icbcLogList, vo.getFdWxNo(), vo.getFdId());
// Return_code返回码,交易成功返回0,正表示业务报错,负表示系统报错
// 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()) || "05".equals(responseV1.getStatus()))
&& responseV1.getDatalist() != null && !responseV1.getDatalist().isEmpty()) {
dataList = responseV1.getDatalist();
......@@ -963,12 +960,16 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
logs.setFdTransactionFailTotal(0);
// 成功总笔数
logs.setFdTransactionSuccessTotal(0);
// 交易时间
if (Common.isNotNull(data.getCompanyHandleTime())) {
logs.setFdTransactionTime(DateUtil.stringToDateByFormat(data.getCompanyHandleTime(), DateUtil.DATETIME_PATTERN_SECOND));
}
// 初始化日志明细
logDetail = setLogDetailBaseInfo(logs, money, vo, data);
// 收款人名称
logDetail.setFdPayee(vo.getFdPayeeName());
logDetail.setFdRecipientBank(vo.getFdRecipientBank());
ekpBankGrantLogDetailService.save(logDetail);
detailData = new EkpBankGrantDetail();
detailData.setFdParentId(vo.getFdId());
......@@ -979,7 +980,6 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
logs.setFdSuccessFee(money);
detailData.setFdGrantStatus("发放成功");
detailData.setFdHandleStatus("已处理");
detailData.setFdGrantNum(vo.getFdGrantNum() + 1);
} else {
// 失败总笔数
logs.setFdTransactionFailTotal(1);
......@@ -990,7 +990,8 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
detailData.setFdFailureFeedback(data.getCompanyHandlerResult());
detailData.setFdFailNum(vo.getFdFailNum() + 1);
// 批量更新中信银行表数据,使发放失败处理有数据出现
zhongXinSalaryIdList.add(vo.getFdSalaryId());
ekpBankGrantDetailService.updateZhongXinStatus(vo.getFdSalaryId(), vo.getFdId());
ekpBankGrantDetailService.updateZhongXinMainStatus(vo.getFdSalaryId(), vo.getFdId());
}
ekpBankGrantLogService.updateById(logs);
detailDataList.add(detailData);
......@@ -999,11 +1000,6 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
}
// 更新明细状态为成功或失败
ekpBankGrantDetailService.updateBatchById(detailDataList);
// 生成发放失败待处理表数据-也可以 批量 生成
if (!zhongXinSalaryIdList.isEmpty()) {
ekpBankGrantDetailService.updateZhongXinStatusAndBankInfo(zhongXinSalaryIdList);
ekpBankGrantDetailService.updateZhongXinMainStatusAndBankInfo(zhongXinSalaryIdList);
}
if (!icbcLogList.isEmpty()) {
ekpBankIcbcLogService.saveBatch(icbcLogList);
}
......@@ -1057,8 +1053,6 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
// 指令状态
logDetail.setFdCommandStatus(STATUS_MAP.get(data.getResult()));
logDetail.setFdParentId(logs.getFdId());
// 收款银行
logDetail.setFdRecipientBank(vo.getFdBankName());
logDetail.setFdMoney(money);
// 收款账号
logDetail.setFdPayeeAccount(data.getRecDepAcc());
......
......@@ -110,8 +110,8 @@ public class IcbcTransactionFlowQueryServiceImpl extends ServiceImpl<EkpSocialIn
try {
//到账通知交易流水查询
response = client.execute(request);
log.error("到账通知交易流水状态" + response.getStatus());
log.error("到账通知交易流水结果" + response.getErrordesc());
log.info("到账通知交易流水状态" + response.getStatus());
log.info("到账通知交易流水结果" + response.getErrordesc());
if ("00".equals(response.getStatus())) {
return R.ok(response.getDatalist());
} else {
......@@ -141,12 +141,8 @@ public class IcbcTransactionFlowQueryServiceImpl extends ServiceImpl<EkpSocialIn
log.info("开始推昨日新增网银到账明细条数");
String tranDate = DateUtil.addDay(-1).replace("-","");
// todo 原代码
//String beginDate = tranDate;
//String endDate = tranDate;
String beginDate = "20241122";
String endDate = "20241122";
String beginDate = tranDate;
String endDate = tranDate;
return getIcbcTransactionFlowCommon(tranDate,beginDate,endDate);
}
......
......@@ -88,7 +88,7 @@
</springProfile>
<springProfile name="test">
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="error">
<root level="info">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
......
......@@ -119,35 +119,25 @@
<select id="getListByParentId" resultMap="ekpBankGrantDetailMap">
select
a.fd_id,a.fd_salary_id,a.fd_serial_number,a.fd_payee_name
a.fd_id,a.fd_salary_id,a.fd_serial_number,a.fd_payee_name,a.fd_recipient_bank,a.fd_fail_num
from ekp_bank_grant_detail a where a.fd_parent_id = #{fdParentId}
</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>
set a.fd_3b148bc0c28e48='失败',a.fd_tbankempid = #{detailId}
where a.fd_3b1fe00b0f5dde = #{salaryId}
</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>
SET a.extend_data_xml=JSON_SET(a.extend_data_xml,'$[1].fd_3b148bc0c28e48', '失败','$[1].fd_tbankempid', #{detailId})
where b.fd_3b56782982b8b2 = #{salaryId}
</update>
......
......@@ -53,6 +53,7 @@
<result property="fdWxNo" column="fd_wx_no"/>
<result property="fdMdCode" column="fd_md_dcode"/>
<result property="fdErrorMsg" column="fd_error_msg"/>
</resultMap>
<sql id="Base_Column_List">
a.fd_id,
......@@ -82,7 +83,8 @@
a.fd_fail_num,
a.fd_grant_num,
a.fd_wx_no,
a.fd_md_dcode
a.fd_md_dcode,
a.fd_error_msg
</sql>
<!-- 获取发放中的主表,查询结果 -->
......@@ -99,7 +101,7 @@
<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,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
,d.fd_grant_num fdGrantNum
,d.fd_grant_num fdGrantNum,d.fd_recipient_bank fdRecipientBank
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 = '发放中'
</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