Commit 6829b7b6 authored by fangxinjiang's avatar fangxinjiang

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

parents dc876985 360749cd
......@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.ekp.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
......@@ -258,4 +259,8 @@ public class EkpBankPayTask {
@Schema(description = "MD码")
private String fdMdCode;
// 明细条数
@TableField(exist = false)
private String num;
}
package com.yifu.cloud.plus.v1.ekp.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @Author hgw
* @Date 2024-11-25 10:32:26
* @Description EKP银企付款获取待查询结果的VO
* @Version 1.0
*/
@Data
public class EkpBankResultVo implements Serializable {
private String fdId;
private String fdParentId;
private String fdWxNo;
private String num;
}
package com.yifu.cloud.plus.v1.ekp.controller;
import com.yifu.cloud.plus.v1.ekp.entity.EkpBankAtta;
import com.yifu.cloud.plus.v1.ekp.service.IcbcTransactionFlowIssueService;
import com.yifu.cloud.plus.v1.ekp.vo.EkpBankAttaReturnVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
......@@ -27,7 +23,7 @@ import javax.servlet.http.HttpServletResponse;
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/icbcIssue" )
@RequestMapping("/icbcIssue")
@Tag(name = "聚富通代发工资相关")
public class IcbcTransactionFlowIssueController {
......@@ -131,4 +127,11 @@ public class IcbcTransactionFlowIssueController {
icbcTransactionFlowIssueService.exportAll(response);
}
@Operation(summary = "每小时获取银企付款结果", description = "每小时获取银企付款结果")
@Inner
@PostMapping("/inner/doGetEkpBankStatus")
public R<String> doGetEkpBankStatus() {
return icbcTransactionFlowIssueService.doGetEkpBankStatus();
}
}
......@@ -42,5 +42,10 @@ public interface EkpBankGrantDetailMapper extends BaseMapper<EkpBankGrantDetail>
// 查询详情里的1条数据
List<EkpBankExcelVo> getEkpBankExcelVoByIdAndDetail(@Param("fdId") String fdId);
// 编号查重
String getWxNoByWxNo(@Param("wxNo") String wxNo);
// 主表发放时,更新明细表的发放时间与状态
void updateStatusByGrant(@Param("fdParentId") String fdParentId);
}
......@@ -19,8 +19,11 @@ package com.yifu.cloud.plus.v1.ekp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.ekp.entity.EkpBankPayTask;
import com.yifu.cloud.plus.v1.ekp.vo.EkpBankResultVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 银企付款任务主表信息
*
......@@ -29,4 +32,11 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface EkpBankPayTaskMapper extends BaseMapper<EkpBankPayTask> {
// 获取发放中的主表,查询结果
List<EkpBankResultVo> getEkpBankMainByNeedResultMain();
// 获取发放中的明细表,查询结果
List<EkpBankResultVo> getEkpBankMainByNeedResultDetail();
}
......@@ -43,4 +43,7 @@ public interface EkpBankGrantDetailService extends IService<EkpBankGrantDetail>
// 查询编码是否重复
String getWxNoByWxNo(String wxNo);
// 主表发放时,更新明细表的发放时间与状态
void updateStatusByGrant(String fdParentId);
}
......@@ -19,6 +19,9 @@ package com.yifu.cloud.plus.v1.ekp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.ekp.entity.EkpBankPayTask;
import com.yifu.cloud.plus.v1.ekp.vo.EkpBankResultVo;
import java.util.List;
/**
* 银企付款任务主表信息
......@@ -28,4 +31,20 @@ import com.yifu.cloud.plus.v1.ekp.entity.EkpBankPayTask;
*/
public interface EkpBankPayTaskService extends IService<EkpBankPayTask> {
/**
* @Description: 获取发放中的主表,查询结果
* @Author: hgw
* @Date: 2024-11-25 10:25:58
* @return: com.yifu.cloud.plus.v1.ekp.entity.EkpBankPayTask
**/
List<EkpBankResultVo> getEkpBankMainByNeedResultMain();
/**
* @Description: 获取发放中的明细表,查询结果
* @Author: hgw
* @Date: 2024/11/25 10:38
* @return: java.util.List<com.yifu.cloud.plus.v1.ekp.vo.EkpBankResultVo>
**/
List<EkpBankResultVo> getEkpBankMainByNeedResultDetail();
}
......@@ -66,4 +66,12 @@ public interface IcbcTransactionFlowIssueService extends IService<EkpSocialInfo>
void exportAll(HttpServletResponse response);
/**
* @Description: 每小时获取银企付款结果
* @Author: hgw
* @Date: 2024/11/22 16:56
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> doGetEkpBankStatus();
}
......@@ -56,4 +56,9 @@ public class EkpBankGrantDetailServiceImpl extends ServiceImpl<EkpBankGrantDetai
public String getWxNoByWxNo(String wxNo) {
return baseMapper.getWxNoByWxNo(wxNo);
}
@Override
public void updateStatusByGrant(String fdParentId) {
baseMapper.updateStatusByGrant(fdParentId);
}
}
......@@ -20,9 +20,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.ekp.entity.EkpBankPayTask;
import com.yifu.cloud.plus.v1.ekp.mapper.EkpBankPayTaskMapper;
import com.yifu.cloud.plus.v1.ekp.service.EkpBankPayTaskService;
import com.yifu.cloud.plus.v1.ekp.vo.EkpBankResultVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 银企付款任务主表信息
*
......@@ -33,4 +36,25 @@ import org.springframework.stereotype.Service;
@Service
public class EkpBankPayTaskServiceImpl extends ServiceImpl<EkpBankPayTaskMapper, EkpBankPayTask> implements EkpBankPayTaskService {
/**
* @Description: 获取发放中的主表,查询结果
* @Author: hgw
* @Date: 2024/11/25 10:26
* @return: java.util.List<com.yifu.cloud.plus.v1.ekp.entity.EkpBankPayTask>
**/
@Override
public List<EkpBankResultVo> getEkpBankMainByNeedResultMain() {
return baseMapper.getEkpBankMainByNeedResultMain();
}
/**
* @Description: 获取发放中的明细表,查询结果
* @Author: hgw
* @Date: 2024/11/25 10:39
* @return: java.util.List<com.yifu.cloud.plus.v1.ekp.vo.EkpBankResultVo>
**/
@Override
public List<EkpBankResultVo> getEkpBankMainByNeedResultDetail() {
return baseMapper.getEkpBankMainByNeedResultDetail();
}
}
......@@ -21,6 +21,7 @@ import com.yifu.cloud.plus.v1.ekp.mapper.EkpSocialInfoMapper;
import com.yifu.cloud.plus.v1.ekp.service.*;
import com.yifu.cloud.plus.v1.ekp.vo.EkpBankAttaReturnVo;
import com.yifu.cloud.plus.v1.ekp.vo.EkpBankExcelVo;
import com.yifu.cloud.plus.v1.ekp.vo.EkpBankResultVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import lombok.RequiredArgsConstructor;
......@@ -135,7 +136,7 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
return R.ok(result);
}
} catch (IcbcApiException e) {
e.printStackTrace();
log.error("银企付款发放失败", e);
return R.failed("发放失败");
}
return R.failed("发放失败!");
......@@ -379,6 +380,7 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
EkpBankAttaReturnVo vo = new EkpBankAttaReturnVo();
List<EkpBankExcelVo> list;
// 1主表整体下载
if (CommonConstants.ONE_STRING.equals(type)) {
EkpBankPayTask main = ekpBankPayTaskService.getById(fdId);
......@@ -528,7 +530,7 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
InputStream templateIs = this.getClass().getResourceAsStream("/template/ekpBankTemplat.xls");
String filePath = "ekpBankDownFile";
String fileName = "020101190_" + batchNo + "_0_" + DateUtil.getThisDay() + CommonConstants.XLS;
String fileName = icbcConfigProperties.getCompanyNo() + "_" + batchNo + "_0_" + DateUtil.getThisDay() + CommonConstants.XLS;
String key = filePath + "/" + fileName;
EasyExcelFactory.write(filePath).withTemplate(templateIs).excelType(ExcelTypeEnum.XLS)
......@@ -594,7 +596,7 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
response.setCharacterEncoding("utf-8");
String batchNo = "WX203";
String fileName = "020101190_" + 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");
......@@ -664,6 +666,8 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
main.setFdGrantStatus("发放中");
main.setFdGrantNum(main.getFdGrantNum() + 1);
ekpBankPayTaskService.updateById(main);
// 同步更新明细的发放时间、发放状态
ekpBankGrantDetailService.updateStatusByGrant(fdId);
}
return returnR;
} else {
......@@ -694,7 +698,7 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
R<String> returnR = submitIcbcTransactionFlow(totalAmt, totalCount, wxNo, url, mdCode);
if (returnR.getCode() == CommonConstants.SUCCESS) {
// 发放次数+1,改主表或明细表“发放状态”为“发放中”
detail.setFdGrantStatus("发放中");
detail.setFdHandleStatus("发放中");
detail.setFdGrantNum(detail.getFdGrantNum() + 1);
ekpBankGrantDetailService.updateById(detail);
}
......@@ -708,4 +712,54 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
}
}
/**
* @Description: 每小时获取银企付款结果
* @Author: hgw
* @Date: 2024/11/22 17:00
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> doGetEkpBankStatus() {
// 1:获取发放中的主表数据,查询工行接口
List<EkpBankResultVo> mainList = ekpBankPayTaskService.getEkpBankMainByNeedResultMain();
// 2:获取主表已发放且明细表发放中的明细表数据,查询工行接口
List<EkpBankResultVo> detailList = ekpBankPayTaskService.getEkpBankMainByNeedResultDetail();
DefaultIcbcClient client = new DefaultIcbcClient(icbcConfigProperties.getAppId(), IcbcConstants.SIGN_TYPE_RSA2,
icbcConfigProperties.getAppPrivateKey(), IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON,
icbcConfigProperties.getApigwPublicKey(), IcbcConstants.ENCRYPT_TYPE_AES, icbcConfigProperties.getAesKey()
, null, null);
JftApiPayrollQueryDetailRequestV1 request = new JftApiPayrollQueryDetailRequestV1();
request.setServiceUrl("https://gw.open.icbc.com.cn/api/jft/api/payroll/querydetail/V1");
JftApiPayrollQueryDetailRequestV1.JftApiPayrollQueryDetailRequestV1Biz bizContent = new
JftApiPayrollQueryDetailRequestV1.JftApiPayrollQueryDetailRequestV1Biz();
bizContent.setAppId(icbcConfigProperties.getAppId());
//企业编号
bizContent.setOutVendorId(icbcConfigProperties.getCompanyNo());
//查询类型:1 批次 2 批次明细
bizContent.setType("2");
//批次号,appSerialno为空时,必输
bizContent.setAppBatserialno("WX203");
//内部批次号,组成规则:批次号-顺序号,appBatserialno为空时必输
// bizContent.setAppSerialno("WX04-1");
//开始条数,如果送1,则返回排序的第一条开始,appBatserialno不为空时必输
bizContent.setStartId("0");
//结束条数,每次最多返回50条,返回条数按照结束-开始+1,appBatserialno不为空时必输
bizContent.setEndId("10");
request.setBizContent(bizContent);
try {
JftApiPayrollQueryDetailResponseV1 responseV1 = client.execute(request);
if (Common.isNotNull(responseV1)) {
return R.ok();
}
} catch (IcbcApiException e) {
e.printStackTrace();
return R.failed();
}
return R.ok();
}
}
......@@ -106,4 +106,9 @@
) a limit 1
</select>
<!-- 主表发放时,更新明细表的发放时间与状态 -->
<update id="updateStatusByGrant">
update ekp_bank_grant_detail a set a.fd_create_time = NOW(),a.fd_grant_status='发放中' where a.fd_parent_id = #{fdParentId}
</update>
</mapper>
......@@ -85,4 +85,19 @@
a.fd_md_dcode
</sql>
<!-- 获取发放中的主表,查询结果 -->
<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
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 = '发放中'
GROUP BY a.fd_id
</select>
<!-- 获取发放中的明细表,查询结果 -->
<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
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>
</mapper>
......@@ -49,5 +49,16 @@ public class EkpTask {
log.info("------------定时生成昨日未生成的入账明细数据-定时任务结束------------");
}
/**
* @Author hgw
* @Description 每小时获取银企付款结果
* @Date 2024-11-22 16:52:28
**/
public void doGetEkpBankStatus() {
log.info("------------每小时获取银企付款结果-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprEkpProperties.getAppUrl(),daprEkpProperties.getAppId(),"/icbcIssue/inner/doGetEkpBankStatus","", Object.class, SecurityConstants.FROM_IN);
log.info("------------每小时获取银企付款结果-定时任务结束------------");
}
}
\ No newline at end of file
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