Commit 3be9b635 authored by hongguangwu's avatar hongguangwu

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

parent 2389a0b4
......@@ -56,6 +56,11 @@ public interface EkpBankGrantDetailMapper extends BaseMapper<EkpBankGrantDetail>
// 发放失败,批量更新中信银行交易流水Model表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
void updateZhongXinMainStatus(@Param("salaryIdList") List<String> salaryIdList);
// 发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
void updateZhongXinStatusAndBankInfo(@Param("salaryIdList") List<String> salaryIdList);
// 发放失败,批量更新中信银行交易流水Model表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
void updateZhongXinMainStatusAndBankInfo(@Param("salaryIdList") List<String> salaryIdList);
// 获取明细表ID来更新状态
List<EkpBankGrantDetail> getListByParentId(@Param("fdParentId") String fdParentId);
......
......@@ -49,9 +49,12 @@ public interface EkpBankGrantDetailService extends IService<EkpBankGrantDetail>
// 发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
void updateZhongXinStatus(List<String> salaryIdList);
void updateZhongXinMainStatus(List<String> salaryIdList);
// 明细再次-发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
void updateZhongXinStatusAndBankInfo(List<String> salaryIdList);
void updateZhongXinMainStatusAndBankInfo(List<String> salaryIdList);
// 主表拒绝授权时,批量更新明细表为发放失败,原因为拒绝授权
void updateStatusByGrantFail(String fdParentId);
......
......@@ -74,6 +74,18 @@ public class EkpBankGrantDetailServiceImpl extends ServiceImpl<EkpBankGrantDetai
baseMapper.updateZhongXinMainStatus(salaryIdList);
}
// 明细再次-发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
@Override
public void updateZhongXinStatusAndBankInfo(List<String> salaryIdList) {
baseMapper.updateZhongXinStatusAndBankInfo(salaryIdList);
}
// 明细再次-发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde
@Override
public void updateZhongXinMainStatusAndBankInfo(List<String> salaryIdList) {
baseMapper.updateZhongXinMainStatusAndBankInfo(salaryIdList);
}
@Override
public void updateStatusByGrantFail(String fdParentId) {
baseMapper.updateStatusByGrantFail(fdParentId);
......
......@@ -78,9 +78,11 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
private EkpBankGrantLogDetailService ekpBankGrantLogDetailService;
@Autowired
private OSSUtil ossUtil;
@Autowired
private RedisUtil redisUtil;
// 处理状态: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", "提交成功");
......@@ -394,8 +396,9 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
**/
@Override
@Transactional
public synchronized R<EkpBankAttaReturnVo> getIssueFileByFdId(String fdId, String type) {
public R<EkpBankAttaReturnVo> getIssueFileByFdId(String fdId, String type) {
if (Common.isNotNull(fdId) && Common.isNotNull(type)) {
String redisKey = "DOWN_BANK_"+fdId;
// 返回EKP的Vo
EkpBankAttaReturnVo vo = new EkpBankAttaReturnVo();
......@@ -408,9 +411,16 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
return R.failed("未找到表数据!");
} else if (Common.isNotNull(main.getFdDownloadNum()) && Common.isNotNull(main.getFdFailNum())
&& (CommonConstants.ZERO_INT == main.getFdDownloadNum() || main.getFdDownloadNum().equals(main.getFdFailNum()))) {
if (Common.isNotNull(redisUtil.get(redisKey))) {
return R.failed("数据下载中,请耐心等待!");
} else {
redisUtil.set(redisKey, 600L);
}
// 新下载
list = ekpBankGrantDetailService.getEkpBankExcelVoByIdAndMain(fdId);
return getNewFileByMain(fdId, type, vo, list, main);
R<EkpBankAttaReturnVo> returnVoR = getNewFileByMain(fdId, type, vo, list, main);
redisUtil.remove(redisKey);
return returnVoR;
} else if (Common.isNotNull(main.getFdAttaSrc())) {
// 取URL数据返回
return getOldAttaUrl(vo, main.getFdAttaSrc(), main.getFdAttaName());
......@@ -422,9 +432,16 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
return R.failed("未找到表数据!");
} else if (Common.isNotNull(detail.getFdDownloadNum()) && Common.isNotNull(detail.getFdFailNum())
&& (CommonConstants.ZERO_INT == detail.getFdDownloadNum() || detail.getFdDownloadNum().equals(detail.getFdFailNum()))) {
if (Common.isNotNull(redisUtil.get(redisKey))) {
return R.failed("数据下载中,请耐心等待!");
} else {
redisUtil.set(redisKey, 600L);
}
// 新下载
list = ekpBankGrantDetailService.getEkpBankExcelVoByIdAndDetail(fdId);
return getNewFileByDetail(fdId, type, vo, list, detail);
R<EkpBankAttaReturnVo> returnVoR = getNewFileByDetail(fdId, type, vo, list, detail);
redisUtil.remove(redisKey);
return returnVoR;
} else if (Common.isNotNull(detail.getFdAttaSrc())) {
// 取URL数据返回
return getOldAttaUrl(vo, detail.getFdAttaSrc(), detail.getFdAttaName());
......@@ -616,7 +633,7 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
response.setCharacterEncoding("utf-8");
String batchNo = "WX203";
String fileName = icbcConfigProperties.getCompanyNo() + "_" + batchNo + "_0_" + DateUtil.getThisDay() + CommonConstants.XLS;
String fileName = icbcConfigProperties.getCompanyNo() + "_" + batchNo + "_0_" + DateUtil.getThisDay() + CommonConstants.XLS;
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, "UTF-8"));
templateIs = this.getClass().getResourceAsStream("/template/ekpBankTemplat.xls");
......@@ -655,25 +672,35 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
**/
@Override
@Transactional
public synchronized R<String> submitBankTask(String fdId, String type) {
public R<String> submitBankTask(String fdId, String type) {
if (Common.isNotNull(fdId) && Common.isNotNull(type)) {
String redisKey = "SUBMIT_BANK_"+fdId;
if (Common.isNotNull(redisUtil.get(redisKey))) {
return R.failed("数据下载中,请耐心等待!");
} else {
redisUtil.set(redisKey, 600L);
}
// 1主表
if (CommonConstants.ONE_STRING.equals(type)) {
EkpBankPayTask main = ekpBankPayTaskService.getById(fdId);
if (main == null) {
redisUtil.remove(redisKey);
return R.failed("未找到表数据!");
}
if (!"待发放".equals(main.getFdGrantStatus())) {
redisUtil.remove(redisKey);
return R.failed("状态不是待发放!");
}
if (Common.isNotNull(main.getFdDownloadNum()) && Common.isNotNull(main.getFdGrantNum())
&& main.getFdDownloadNum() > main.getFdGrantNum()) {
if (Common.isEmpty(main.getFdMoney())) {
redisUtil.remove(redisKey);
return R.failed("数据错误,无金额!");
}
int count = ekpBankGrantDetailService.getCountByIdAndMain(fdId);
String totalAmt = String.valueOf(BigDecimalUtils.safeMultiply(main.getFdMoney(), new BigDecimal("100"), 0));
if (!"1".equals(totalAmt)) {
redisUtil.remove(redisKey);
return R.failed("测试阶段,金额不是1分钱,请联系hgw解除禁止!");
}
String totalCount = String.valueOf(count);
......@@ -689,26 +716,32 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
// 同步更新明细的发放时间、发放状态
ekpBankGrantDetailService.updateStatusByGrant(fdId);
}
redisUtil.remove(redisKey);
return returnR;
} else {
redisUtil.remove(redisKey);
return R.failed("请检查状态!");
}
} else {
// 2明细表
EkpBankGrantDetail detail = ekpBankGrantDetailService.getById(fdId);
if (detail == null) {
redisUtil.remove(redisKey);
return R.failed("未找到明细表数据!");
}
if (!"待发放".equals(detail.getFdGrantStatus())) {
redisUtil.remove(redisKey);
return R.failed("状态不是待发放!");
}
if (Common.isNotNull(detail.getFdDownloadNum()) && Common.isNotNull(detail.getFdGrantNum())
&& detail.getFdDownloadNum() > detail.getFdGrantNum()) {
if (Common.isEmpty(detail.getFdMoney())) {
redisUtil.remove(redisKey);
return R.failed("数据错误,无金额!");
}
String totalAmt = String.valueOf(BigDecimalUtils.safeMultiply(detail.getFdMoney(), new BigDecimal("100"), 0));
if (!"1".equals(totalAmt)) {
redisUtil.remove(redisKey);
return R.failed("测试阶段,金额不是1分钱,请联系hgw解除禁止!");
}
String totalCount = "1";
......@@ -722,8 +755,10 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
detail.setFdGrantNum(detail.getFdGrantNum() + 1);
ekpBankGrantDetailService.updateById(detail);
}
redisUtil.remove(redisKey);
return returnR;
} else {
redisUtil.remove(redisKey);
return R.failed("请检查状态!");
}
}
......@@ -945,8 +980,8 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
ekpBankGrantDetailService.updateBatchById(detailDataList);
// 生成发放失败待处理表数据-也可以 批量 生成
if (!zhongXinSalaryIdList.isEmpty()) {
ekpBankGrantDetailService.updateZhongXinStatus(zhongXinSalaryIdList);
ekpBankGrantDetailService.updateZhongXinMainStatus(zhongXinSalaryIdList);
ekpBankGrantDetailService.updateZhongXinStatusAndBankInfo(zhongXinSalaryIdList);
ekpBankGrantDetailService.updateZhongXinMainStatusAndBankInfo(zhongXinSalaryIdList);
}
}
return R.ok();
......
......@@ -150,4 +150,41 @@
</if>
</update>
<!-- 明细再次-发放失败,批量更新中信银行交易流水表fd_3b148bc0c28e48为失败,根据 工资明细fdId:fd_3b1fe00b0f5dde -->
<update id="updateZhongXinStatusAndBankInfo">
update ekp_db4ed54e25543f4b7a9a a
left join ekp_bank_grant_detail d on a.fd_3b1fe00b0f5dde=d.fd_salary_id
set a.fd_3b148bc0c28e48='失败',a.fd_3c754f2a7125a0 = '1183b0b84ee4f581bba001c47a78b2d9',a.fd_3c754a976ddde2=now(),
a.fd_3afd45029541be=d.fd_payee_name,a.fd_3afd4500f91ae6=d.fd_payee_account,a.fd_3afd4502e34bc0=d.fd_recipient_bank
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="updateZhongXinMainStatusAndBankInfo">
UPDATE modeling_simple_main a
JOIN ekp_db4ed54e25543f4b7a9a b on a.fd_id=b.fd_id
left join ekp_bank_grant_detail d on b.fd_3b1fe00b0f5dde=d.fd_salary_id
SET a.extend_data_xml=JSON_SET(a.extend_data_xml,'$[1].fd_3b148bc0c28e48', '失败'
, '$[1].fd_3c754f2a7125a0', '1183b0b84ee4f581bba001c47a78b2d9'
,'$[1].fd_3c754a976ddde2', now()
,'$[1].fd_3afd45029541be', d.fd_payee_name
,'$[1].fd_3afd4500f91ae6', d.fd_payee_account
,'$[1].fd_3afd4502e34bc0', d.fd_recipient_bank
)
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>
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