Commit f2546ac1 authored by hongguangwu's avatar hongguangwu

MVP1.7.2 工行4次提交_发放

parent 0ec07fc8
......@@ -27,6 +27,7 @@ import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
......@@ -101,7 +102,7 @@ public class EkpBankPayTask {
@ExcelAttribute(name = "金额")
@ExcelProperty("金额")
@Schema(description = "金额")
private Double fdMoney;
private BigDecimal fdMoney;
/**
* 支付类别:工资、社保
*/
......@@ -245,12 +246,6 @@ public class EkpBankPayTask {
@Schema(description = "发放次数")
private Integer fdGrantNum;
// 工资支出结算单上的封面备注
@ExcelAttribute(name = "备注信息")
@ExcelProperty("备注信息")
@Schema(description = "备注信息")
private String fdCoverRemark;
@ExcelAttribute(name = "批次号", maxLength = 36)
@Length(max = 36, message = "批次号不能超过36个字符")
@ExcelProperty("批次号")
......
......@@ -42,8 +42,17 @@ public class IcbcTransactionFlowIssueController {
*/
@Operation(summary = "聚富通代发工资确认提交接口", description = "聚富通代发工资确认提交接口")
@PostMapping("/submit")
public R submitIcbcTransactionFlow() {
return icbcTransactionFlowIssueService.submitIcbcTransactionFlow();
public R<String> submitIcbcTransactionFlow(@RequestParam(required = false) String totalAmt
, @RequestParam(required = false) String totalCount, @RequestParam(required = false) String wxNo
, @RequestParam(required = false) String url, @RequestParam(required = false) String mdCode) {
if (Common.isEmpty(totalAmt) || !CommonConstants.ONE_STRING.equals(totalAmt)) {
totalAmt = "1";
totalCount = "1";
wxNo = "WX202411201649110001732092551023";
url = "020101190_WX202411201649110001732092551023_0_20241120.xls";
mdCode = "49003789330801136756328772184671605624443424719041259624457722383503273821290";
}
return icbcTransactionFlowIssueService.submitIcbcTransactionFlow(totalAmt, totalCount, wxNo, url, mdCode);
}
/**
......@@ -88,18 +97,33 @@ public class IcbcTransactionFlowIssueController {
/**
* @param fdId 主键ID
* @param type 类型 1:主表附件;2:明细表附件
* @Description:
* @Description: 下载代发任务附件
* @Author: hgw
* @Date: 2024/11/15 14:51
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.ekp.entity.EkpBankAtta>
**/
@Operation(summary = "获取代发任务附件--EKP调用接口", description = "获取代发任务附件--EKP调用接口")
@SysLog("获取代发任务附件--EKP调用接口")
@Operation(summary = "下载代发任务附件--EKP调用接口", description = "下载代发任务附件--EKP调用接口")
@SysLog("下载代发任务附件--EKP调用接口")
@GetMapping("/getIssueFileByFdId")
public R<EkpBankAttaReturnVo> getIssueFileByFdId(@RequestParam String fdId, @RequestParam String type) {
return icbcTransactionFlowIssueService.getIssueFileByFdId(fdId, type);
}
/**
* @param fdId 主键ID
* @param type 类型 1:主表附件;2:明细表附件
* @Description: 发放
* @Author: hgw
* @Date: 2024-11-22 11:32:21
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.ekp.entity.EkpBankAtta>
**/
@Operation(summary = "发放银企付款--EKP调用接口", description = "发放银企付款--EKP调用接口")
@SysLog("发放银企付款--EKP调用接口")
@GetMapping("/submitBankTask")
public R<String> submitBankTask(@RequestParam String fdId, @RequestParam String type) {
return icbcTransactionFlowIssueService.submitBankTask(fdId, type);
}
@Operation(description = "下载文件测试")
@PostMapping("/exportAll")
@SysLog("下载文件测试")
......
......@@ -34,6 +34,8 @@ import java.util.List;
@Mapper
public interface EkpBankGrantDetailMapper extends BaseMapper<EkpBankGrantDetail> {
// 查询待发放条数
int getCountByIdAndMain(@Param("fdParentId") String fdParentId);
// 查询主表下的全部数据
List<EkpBankExcelVo> getEkpBankExcelVoByIdAndMain(@Param("fdParentId") String fdParentId);
......
......@@ -31,10 +31,16 @@ import java.util.List;
*/
public interface EkpBankGrantDetailService extends IService<EkpBankGrantDetail> {
// 查询待发条数
int getCountByIdAndMain(String fdParentId);
// 查询下载的待发 明细数据
List<EkpBankExcelVo> getEkpBankExcelVoByIdAndMain(String fdParentId);
// 查询下载的待发 明细数据
List<EkpBankExcelVo> getEkpBankExcelVoByIdAndDetail(String fdId);
// 查询编码是否重复
String getWxNoByWxNo(String wxNo);
}
......@@ -23,7 +23,8 @@ public interface IcbcTransactionFlowIssueService extends IService<EkpSocialInfo>
* @Date: 2024-11-12
* @return: R
**/
R submitIcbcTransactionFlow();
R<String> submitIcbcTransactionFlow(String totalAmt, String totalCount, String wxNo
, String url, String mdCode);
/**
* @Description: 代发任务批次明细查询
......@@ -44,15 +45,25 @@ public interface IcbcTransactionFlowIssueService extends IService<EkpSocialInfo>
R querybankinfo();
/**
* @param fdId
* @param fdId 主键ID
* @param type 类型 1:主表附件;2:明细表附件
* @Description:
* @Description: 下载银企付款
* @Author: hgw
* @Date: 2024/11/18 10:18
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.ekp.entity.EkpBankAtta>
**/
R<EkpBankAttaReturnVo> getIssueFileByFdId(String fdId, String type);
/**
* @param fdId 主键ID
* @param type 类型 1:主表附件;2:明细表附件
* @Description: 发放银企付款
* @Author: hgw
* @Date: 2024/11/22 11:32
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> submitBankTask(String fdId, String type);
void exportAll(HttpServletResponse response);
}
......@@ -37,6 +37,11 @@ import java.util.List;
public class EkpBankGrantDetailServiceImpl extends ServiceImpl<EkpBankGrantDetailMapper, EkpBankGrantDetail> implements EkpBankGrantDetailService {
@Override
public int getCountByIdAndMain(String fdParentId) {
return baseMapper.getCountByIdAndMain(fdParentId);
}
@Override
public List<EkpBankExcelVo> getEkpBankExcelVoByIdAndMain(String fdParentId) {
return baseMapper.getEkpBankExcelVoByIdAndMain(fdParentId);
......
......@@ -22,10 +22,7 @@ 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.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.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -40,6 +37,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URL;
import java.net.URLDecoder;
......@@ -89,7 +87,8 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
* @Date: 2024-11-12
* @return: R
**/
public R submitIcbcTransactionFlow() {
public R<String> submitIcbcTransactionFlow(String totalAmt, String totalCount, String wxNo
, String url, String mdCode) {
//应用方加密串
UiIcbcClient client = new UiIcbcClient(icbcConfigProperties.getAppId(), IcbcConstants.SIGN_TYPE_RSA2,
icbcConfigProperties.getAppPrivateKey(), IcbcConstants.CHARSET_UTF8);
......@@ -106,19 +105,23 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
//操作类型:1-受理 2-审核
bizContent.setOprType("1");
//总金额 oprType 为2时,非必输,金额单位分
bizContent.setTotalAmt("2");
//bizContent.setTotalAmt("2")
bizContent.setTotalAmt(totalAmt);
//总笔数 oprType 为2时,非必输
bizContent.setTotalCount("2");
//bizContent.setTotalCount("2");
bizContent.setTotalCount(totalCount);
//批次号--每日批号不能重复,系统生成批次号
bizContent.setAppSerialno("WX203");
//bizContent.setAppSerialno("WX203")
bizContent.setAppSerialno(wxNo);
//文件校验方式 1:sha256校验、2:sm3校验;上送为空默认按照sha256校验
bizContent.setFileCheckSign("1");
//客户本地文件路径 {企业编号}_{批次号}_{代发方式}_yyyyMMdd.xls 拼接起来总长不能超过36位
//{平台编号}_{企业编号}_{批次号}_{代发方式}_yyyyMMdd .zip 压缩文件中,包含代发工资指令文件信息,为xls格式,xls文件名称同zip包文件名称
bizContent.setLocalFilepath("D:/icbcFile/020101190_WX203_0_20241112.xls");
bizContent.setLocalFilepath("D:/icbcFile/" + url);
//文件md码
// TODO-直接取值mdCode
bizContent.setFileMdcode(getMdCode("D:/icbcFile/020101190_WX203_0_20241112.xls"));
//bizContent.setFileMdcode(getMdCode("D:/icbcFile/020101190_WX203_0_20241112.xls"));
bizContent.setFileMdcode(mdCode);
//文件类型:1-代发工资 2-报销
bizContent.setFileType("1");
......@@ -130,7 +133,7 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
try {
String result = client.buildPostForm(request);
if (Common.isNotNull(result)) {
return R.ok();
return R.ok(result);
}
} catch (IcbcApiException e) {
e.printStackTrace();
......@@ -621,4 +624,75 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
}
}
/**
* @param fdId 主键
* @param type 类型 1:主表;2明细表
* @Description: 发放银企付款
* @Author: hgw
* @Date: 2024/11/22 14:13
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
@Transactional
public synchronized R<String> submitBankTask(String fdId, String type) {
if (Common.isNotNull(fdId) && Common.isNotNull(type)) {
// 1主表
if (CommonConstants.ONE_STRING.equals(type)) {
EkpBankPayTask main = ekpBankPayTaskService.getById(fdId);
if (main == null) {
return R.failed("未找到表数据!");
}
if (!"待发放".equals(main.getFdGrantStatus())) {
return R.failed("状态不是待发放!");
}
if (Common.isNotNull(main.getFdDownloadNum()) && Common.isNotNull(main.getFdGrantNum())
&& main.getFdDownloadNum() > main.getFdFailNum()) {
if (Common.isEmpty(main.getFdMoney())) {
return R.failed("数据错误,无金额!");
}
int count = ekpBankGrantDetailService.getCountByIdAndMain(fdId);
String totalAmt = String.valueOf(BigDecimalUtils.safeMultiply(main.getFdMoney(), new BigDecimal("100"), 0));
if (!"1".equals(totalAmt)) {
return R.failed("测试阶段,金额不是1分钱,请联系hgw解除禁止!");
}
String totalCount = String.valueOf(count);
String wxNo = main.getFdWxNo();
String url = main.getFdAttaName();
String mdCode = main.getFdMdCode();
return submitIcbcTransactionFlow(totalAmt, totalCount, wxNo, url, mdCode);
} else {
return R.failed("请检查状态!");
}
} else {
// 2明细表
EkpBankGrantDetail detail = ekpBankGrantDetailService.getById(fdId);
if (detail == null) {
return R.failed("未找到明细表数据!");
}
if (!"待发放".equals(detail.getFdGrantStatus())) {
return R.failed("状态不是待发放!");
}
if (Common.isNotNull(detail.getFdDownloadNum()) && Common.isNotNull(detail.getFdGrantNum())
&& detail.getFdDownloadNum() > detail.getFdFailNum()) {
if (Common.isEmpty(detail.getFdMoney())) {
return R.failed("数据错误,无金额!");
}
String totalAmt = String.valueOf(BigDecimalUtils.safeMultiply(detail.getFdMoney(), new BigDecimal("100"), 0));
if (!"1".equals(totalAmt)) {
return R.failed("测试阶段,金额不是1分钱,请联系hgw解除禁止!");
}
String totalCount = "1";
String wxNo = detail.getFdWxNo();
String url = detail.getFdAttaName();
String mdCode = detail.getFdMdCode();
return submitIcbcTransactionFlow(totalAmt, totalCount, wxNo, url, mdCode);
} else {
return R.failed("请检查状态!");
}
}
} else {
return R.failed("传参错误!");
}
}
}
......@@ -69,7 +69,7 @@
a.fd_payee_name fdPayeeName,
concat('',round(a.fd_money * 100,0)) fdMoney,
a.fd_remittance_purpose fdRemittancePurpose,
ifnull(m.fd_cover_remark,'') fdCoverRemark,
ifnull(a.fd_remark,'工资') fdCoverRemark,
a.fd_emp_phone fdEmpPhone
from ekp_bank_grant_detail a
left join ekp_bank_pay_task m on a.fd_parent_id=m.fd_id
......@@ -77,6 +77,14 @@
where a.fd_handle_status = '待发放'
</sql>
<!-- 查询待发放条数 -->
<select id="getCountByIdAndMain" resultType="java.lang.Integer">
select count(1)
from ekp_bank_grant_detail a
where a.fd_handle_status = '待发放'
and a.fd_parent_id = #{fdParentId}
</select>
<!-- 查询主表下的所有待发放数据 -->
<select id="getEkpBankExcelVoByIdAndMain" resultType="com.yifu.cloud.plus.v1.ekp.vo.EkpBankExcelVo">
<include refid="Base_Excel_Sql"/>
......
......@@ -51,7 +51,6 @@
<result property="fdFailNum" column="fd_fail_num"/>
<result property="fdGrantNum" column="fd_grant_num"/>
<result property="fdCoverRemark" column="fd_cover_remark"/>
<result property="fdWxNo" column="fd_wx_no"/>
<result property="fdMdCode" column="fd_md_dcode"/>
</resultMap>
......@@ -82,7 +81,6 @@
a.fd_download_num,
a.fd_fail_num,
a.fd_grant_num,
a.fd_cover_remark,
a.fd_wx_no,
a.fd_md_dcode
</sql>
......
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