Commit a8751105 authored by hongguangwu's avatar hongguangwu

MVP1.7.2 工行5次提交_测试下载

parent a2ba8684
......@@ -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();
}
}
......@@ -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();
}
......@@ -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();
}
......@@ -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;
......@@ -379,13 +380,20 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
EkpBankAttaReturnVo vo = new EkpBankAttaReturnVo();
List<EkpBankExcelVo> list;
log.error("fdId===" + fdId);
log.error("type===" + type);
log.error("CommonConstants.ONE_STRING.equals(type)===" + CommonConstants.ONE_STRING.equals(type));
log.error("CommonConstants.TWO_STRING.equals(type)===" + CommonConstants.TWO_STRING.equals(type));
// 1主表整体下载
if (CommonConstants.ONE_STRING.equals(type)) {
log.error("111111");
EkpBankPayTask main = ekpBankPayTaskService.getById(fdId);
if (main == null) {
return R.failed("未找到表数据!");
} else if (Common.isNotNull(main.getFdDownloadNum()) && Common.isNotNull(main.getFdFailNum())
&& (CommonConstants.ZERO_INT == main.getFdDownloadNum() || main.getFdDownloadNum().equals(main.getFdFailNum()))) {
log.error("111112");
// 新下载
list = ekpBankGrantDetailService.getEkpBankExcelVoByIdAndMain(fdId);
return getNewFileByMain(fdId, type, vo, list, main);
......@@ -393,7 +401,10 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
// 取URL数据返回
return getOldAttaUrl(vo, main.getFdAttaSrc(), main.getFdAttaName());
}
log.error("main.getFdDownloadNum()="+main.getFdDownloadNum());
log.error("main.getFdFailNum()="+main.getFdFailNum());
} else if (CommonConstants.TWO_STRING.equals(type)) {
log.error("222222");
// 2明细表
EkpBankGrantDetail detail = ekpBankGrantDetailService.getById(fdId);
if (detail == null) {
......@@ -407,6 +418,8 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
// 取URL数据返回
return getOldAttaUrl(vo, detail.getFdAttaSrc(), detail.getFdAttaName());
}
log.error("main.getFdDownloadNum()="+detail.getFdDownloadNum());
log.error("main.getFdFailNum()="+detail.getFdFailNum());
}
return R.failed("请处理表数据的下载次数与失败次数,fdId=" + fdId + ";type=" + type);
} else {
......@@ -528,7 +541,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 +607,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");
......@@ -708,4 +721,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();
}
}
......@@ -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