修改
This commit is contained in:
@ -0,0 +1,77 @@
|
||||
package com.xjrsoft.module.fssp.client;
|
||||
|
||||
import com.pictc.enums.BusinessCode;
|
||||
import com.xjrsoft.common.exception.BusinessException;
|
||||
import com.xjrsoft.module.fssp.callback.FsspCallback;
|
||||
import com.xjrsoft.module.fssp.response.BaseResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class FsspHttpClient {
|
||||
|
||||
private static RestTemplate rest = new RestTemplate();
|
||||
|
||||
public static <Req, Resp extends BaseResponse> void post(Req req,
|
||||
String url,
|
||||
Class<Resp> clz,
|
||||
FsspCallback<Resp> callback) {
|
||||
post(req, url, clz, null, callback);
|
||||
}
|
||||
|
||||
public static <Req, Resp extends BaseResponse> void post(Req req,
|
||||
String url,
|
||||
Class<Resp> clz,
|
||||
Map<String, String> headerMap,
|
||||
FsspCallback<Resp> callback) {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
if (headerMap != null) {
|
||||
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
|
||||
headers.add(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
RequestEntity<Req> request = new RequestEntity<Req>(req, headers, HttpMethod.POST, URI.create(url));
|
||||
ResponseEntity<Resp> responseEntity = rest.exchange(request, clz);
|
||||
if(!responseEntity.hasBody()) {
|
||||
throw new BusinessException(BusinessCode.of(10901,"接口请求失败"));
|
||||
}
|
||||
Resp response = responseEntity.getBody();
|
||||
if(response != null && response.isSuccess()) {
|
||||
callback.execute(response);
|
||||
}else {
|
||||
throw new BusinessException(BusinessCode.of(10902,"接口响应失败"));
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] downloadFile(String path, String accessToken, String url) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(url);
|
||||
builder.append("?path=");
|
||||
builder.append(path);
|
||||
builder.append("&accesstoken=");
|
||||
builder.append(accessToken);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_OCTET_STREAM));
|
||||
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
HttpEntity<String> entity = new HttpEntity<>(headers);
|
||||
ResponseEntity<byte[]> response = rest.exchange(
|
||||
url,
|
||||
HttpMethod.GET,
|
||||
entity,
|
||||
byte[].class
|
||||
);
|
||||
if (response.getStatusCode() == HttpStatus.OK) {
|
||||
return response.getBody();
|
||||
} else {
|
||||
throw new BusinessException(BusinessCode.of(10902,"下载失败,HTTP状态码: " + response.getStatusCode()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.xjrsoft.module.fssp.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Data
|
||||
@Component
|
||||
@RefreshScope
|
||||
@ConfigurationProperties("xjrsoft.fssp")
|
||||
public class FsspConfig {
|
||||
|
||||
private String appTokenUrl;
|
||||
|
||||
private String appId;
|
||||
|
||||
private String appSecuret;
|
||||
|
||||
private String tenantid;
|
||||
|
||||
private String accountId;
|
||||
|
||||
private String language;
|
||||
|
||||
private String loginUrl;
|
||||
|
||||
private String user;
|
||||
|
||||
private String usertype;
|
||||
|
||||
private String yhjymxUrl;
|
||||
|
||||
private String orgNumber;
|
||||
|
||||
private String accountbank;
|
||||
|
||||
private String dzhdxxUrl;
|
||||
|
||||
private String dzhdfjUrl;
|
||||
|
||||
private String pzUrl;
|
||||
|
||||
}
|
||||
@ -0,0 +1,233 @@
|
||||
package com.xjrsoft.module.fssp.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 接口-收付款
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-24
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("lng_jk_rp")
|
||||
@ApiModel(value = "接口-收付款对象", description = "接口-收付款")
|
||||
public class LngJkRp implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 交易明细id
|
||||
*/
|
||||
@ApiModelProperty("交易明细id")
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 交易明细编号
|
||||
*/
|
||||
@ApiModelProperty("交易明细编号")
|
||||
private String billno;
|
||||
|
||||
/**
|
||||
* 资金组织编码, 公司三字码
|
||||
*/
|
||||
@ApiModelProperty("资金组织编码(公司三字码)")
|
||||
private String orgNumber;
|
||||
|
||||
/**
|
||||
* 资金组织名称
|
||||
*/
|
||||
@ApiModelProperty("资金组织名称")
|
||||
private String orgName;
|
||||
|
||||
/**
|
||||
* 交易日期
|
||||
*/
|
||||
@ApiModelProperty("交易日期(格式:yyyy-MM-dd)")
|
||||
private LocalDateTime bizdate;
|
||||
|
||||
/**
|
||||
* 记账日期
|
||||
*/
|
||||
@ApiModelProperty("记账日期(格式:yyyy-MM-dd)")
|
||||
private LocalDateTime transdate;
|
||||
|
||||
/**
|
||||
* 币别代码
|
||||
*/
|
||||
@ApiModelProperty("币别代码")
|
||||
private String currencyNumber;
|
||||
|
||||
/**
|
||||
* 币别名称
|
||||
*/
|
||||
@ApiModelProperty("币别名称")
|
||||
private String currency;
|
||||
|
||||
/**
|
||||
* 银行账号
|
||||
*/
|
||||
@ApiModelProperty("银行账号")
|
||||
private String accountbankNumber;
|
||||
|
||||
/**
|
||||
* 银行账户名称
|
||||
*/
|
||||
@ApiModelProperty("银行账户名称")
|
||||
private String accountbank;
|
||||
|
||||
/**
|
||||
* 交易时间
|
||||
*/
|
||||
@ApiModelProperty("交易时间(格式:yyyy-MM-dd HH:mm:ss)")
|
||||
private LocalDateTime biztime;
|
||||
|
||||
/**
|
||||
* 摘要
|
||||
*/
|
||||
@ApiModelProperty("摘要")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 业务类型, 1:普通 2:上划 3:下拨
|
||||
*/
|
||||
@ApiModelProperty("业务类型(1:普通,2:上划,3:下拨)")
|
||||
private String biztype;
|
||||
|
||||
/**
|
||||
* 业务参考号
|
||||
*/
|
||||
@ApiModelProperty("业务参考号")
|
||||
private String bizrefno;
|
||||
|
||||
/**
|
||||
* 付款金额
|
||||
*/
|
||||
@ApiModelProperty("付款金额")
|
||||
private BigDecimal debitamount;
|
||||
|
||||
/**
|
||||
* 收款金额
|
||||
*/
|
||||
@ApiModelProperty("收款金额")
|
||||
private BigDecimal creditamount;
|
||||
|
||||
/**
|
||||
* 余额
|
||||
*/
|
||||
@ApiModelProperty("余额")
|
||||
private BigDecimal transbalance;
|
||||
|
||||
/**
|
||||
* 对方户名
|
||||
*/
|
||||
@ApiModelProperty("对方户名")
|
||||
private String oppunit;
|
||||
|
||||
/**
|
||||
* 对方账号
|
||||
*/
|
||||
@ApiModelProperty("对方账号")
|
||||
private String oppbanknumber;
|
||||
|
||||
/**
|
||||
* 对方开户行
|
||||
*/
|
||||
@ApiModelProperty("对方开户行")
|
||||
private String oppbank;
|
||||
|
||||
/**
|
||||
* 对账标识码
|
||||
*/
|
||||
@ApiModelProperty("对账标识码(可用于匹配付款单)")
|
||||
private String bankcheckflag;
|
||||
|
||||
/**
|
||||
* 电子回单号
|
||||
*/
|
||||
@ApiModelProperty("电子回单号(可用于匹配电子回单)")
|
||||
private String receiptno;
|
||||
|
||||
/**
|
||||
* 明细流水号
|
||||
*/
|
||||
@ApiModelProperty("明细流水号")
|
||||
private String detailid;
|
||||
|
||||
/**
|
||||
* 处理状态(N-未处理;E-错误;S-成功)
|
||||
*/
|
||||
@ApiModelProperty("处理状态(N-未处理;E-错误;S-成功)")
|
||||
private String statusProc;
|
||||
|
||||
/**
|
||||
* 处理日志
|
||||
*/
|
||||
@ApiModelProperty("处理日志")
|
||||
private String msgProc;
|
||||
|
||||
/**
|
||||
* 处理时间
|
||||
*/
|
||||
@ApiModelProperty("处理时间")
|
||||
private LocalDateTime dateProc;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@ApiModelProperty("创建人id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@ApiModelProperty("修改人id")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty("修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime modifyDate;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 数据权限id
|
||||
*/
|
||||
@ApiModelProperty("数据权限id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
}
|
||||
@ -0,0 +1,247 @@
|
||||
package com.xjrsoft.module.fssp.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @title: 接口-收付款-电子回单
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-24
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("lng_jk_rp_bill")
|
||||
@ApiModel(value = "接口-收付款-电子回单对象", description = "接口-收付款-电子回单")
|
||||
public class LngJkRpBill {
|
||||
|
||||
/**
|
||||
* 电子回单id
|
||||
*/
|
||||
@ApiModelProperty("电子回单id")
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 单据编号
|
||||
*/
|
||||
@ApiModelProperty("单据编号")
|
||||
private String billno;
|
||||
|
||||
/**
|
||||
* 资金组织编码(公司三字码)
|
||||
*/
|
||||
@ApiModelProperty("资金组织编码(公司三字码)")
|
||||
private String orgNumber;
|
||||
|
||||
/**
|
||||
* 资金组织名称
|
||||
*/
|
||||
@ApiModelProperty("资金组织名称")
|
||||
private String orgName;
|
||||
|
||||
/**
|
||||
* 交易日期(格式:yyyy-MM-dd)
|
||||
*/
|
||||
@ApiModelProperty("交易日期(格式:yyyy-MM-dd)")
|
||||
private LocalDateTime bizdate;
|
||||
|
||||
/**
|
||||
* 币别代码
|
||||
*/
|
||||
@ApiModelProperty("币别代码")
|
||||
private String currencyNumber;
|
||||
|
||||
/**
|
||||
* 币别名称
|
||||
*/
|
||||
@ApiModelProperty("币别名称")
|
||||
private String currency;
|
||||
|
||||
/**
|
||||
* 银行账号
|
||||
*/
|
||||
@ApiModelProperty("银行账号")
|
||||
private String accountbankNumber;
|
||||
|
||||
/**
|
||||
* 银行账户名称
|
||||
*/
|
||||
@ApiModelProperty("银行账户名称")
|
||||
private String accountbank;
|
||||
|
||||
/**
|
||||
* 明细交易时间(格式:yyyy-MM-dd HH:mm:ss)
|
||||
*/
|
||||
@ApiModelProperty("明细交易时间(格式:yyyy-MM-dd HH:mm:ss)")
|
||||
private LocalDateTime detaildatetime;
|
||||
|
||||
/**
|
||||
* 摘要
|
||||
*/
|
||||
@ApiModelProperty("摘要")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 业务类型(1:普通,2:上划,3:下拨)
|
||||
*/
|
||||
@ApiModelProperty("业务类型(1:普通,2:上划,3:下拨)")
|
||||
private String biztype;
|
||||
|
||||
/**
|
||||
* 业务参考号
|
||||
*/
|
||||
@ApiModelProperty("业务参考号")
|
||||
private String bizrefno;
|
||||
|
||||
/**
|
||||
* 付款金额
|
||||
*/
|
||||
@ApiModelProperty("付款金额")
|
||||
private BigDecimal debitamount;
|
||||
|
||||
/**
|
||||
* 收款金额
|
||||
*/
|
||||
@ApiModelProperty("收款金额")
|
||||
private BigDecimal creditamount;
|
||||
|
||||
/**
|
||||
* 对方单位
|
||||
*/
|
||||
@ApiModelProperty("对方单位")
|
||||
private String oppunit;
|
||||
|
||||
/**
|
||||
* 对方账号
|
||||
*/
|
||||
@ApiModelProperty("对方账号")
|
||||
private String oppbanknumber;
|
||||
|
||||
/**
|
||||
* 对方开户行
|
||||
*/
|
||||
@ApiModelProperty("对方开户行")
|
||||
private String oppbank;
|
||||
|
||||
/**
|
||||
* 明细流水号
|
||||
*/
|
||||
@ApiModelProperty("明细流水号")
|
||||
private String detailid;
|
||||
|
||||
/**
|
||||
* 电子回单号(可用于匹配银行交易明细)
|
||||
*/
|
||||
@ApiModelProperty("电子回单号(可用于匹配银行交易明细)")
|
||||
private String receiptno;
|
||||
|
||||
/**
|
||||
* 对账标识码
|
||||
*/
|
||||
@ApiModelProperty("对账标识码")
|
||||
private String bankcheckflag;
|
||||
|
||||
/**
|
||||
* 回单路径文件名
|
||||
*/
|
||||
@ApiModelProperty("回单路径文件名")
|
||||
private String filepath;
|
||||
|
||||
/**
|
||||
* 处理状态(N-未处理;E-错误;S-成功)
|
||||
*/
|
||||
@ApiModelProperty("处理状态(N-未处理;E-错误;S-成功)")
|
||||
private String statusProc;
|
||||
|
||||
/**
|
||||
* 处理日志
|
||||
*/
|
||||
@ApiModelProperty("处理日志")
|
||||
private String msgProc;
|
||||
|
||||
/**
|
||||
* 处理时间
|
||||
*/
|
||||
@ApiModelProperty("处理时间")
|
||||
private LocalDateTime dateProc;
|
||||
|
||||
/**
|
||||
* 供应链回单路径文件名
|
||||
*/
|
||||
@ApiModelProperty("供应链回单路径文件名")
|
||||
private String filepathAttr;
|
||||
|
||||
/**
|
||||
* 附件处理状态(N-未处理;E-错误;S-成功)
|
||||
*/
|
||||
@ApiModelProperty("附件处理状态(N-未处理;E-错误;S-成功)")
|
||||
private String statusProcAttr;
|
||||
|
||||
/**
|
||||
* 附件处理日志
|
||||
*/
|
||||
@ApiModelProperty("附件处理日志")
|
||||
private String msgProcAttr;
|
||||
|
||||
/**
|
||||
* 附件处理时间
|
||||
*/
|
||||
@ApiModelProperty("附件处理时间")
|
||||
private LocalDateTime dateProcAttr;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@ApiModelProperty("创建人id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@ApiModelProperty("修改人id")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty("修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime modifyDate;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 数据权限id
|
||||
*/
|
||||
@ApiModelProperty("数据权限id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
}
|
||||
@ -0,0 +1,244 @@
|
||||
package com.xjrsoft.module.fssp.handler;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.google.api.client.util.Lists;
|
||||
import com.google.api.client.util.Maps;
|
||||
import com.pictc.enums.BusinessCode;
|
||||
import com.xjrsoft.common.exception.BusinessException;
|
||||
import com.xjrsoft.common.utils.CollectionUtils;
|
||||
import com.xjrsoft.common.utils.RedisUtil;
|
||||
import com.xjrsoft.module.fssp.client.FsspHttpClient;
|
||||
import com.xjrsoft.module.fssp.config.FsspConfig;
|
||||
import com.xjrsoft.module.fssp.dto.LngJkRpBillDto;
|
||||
import com.xjrsoft.module.fssp.dto.LngJkRpDto;
|
||||
import com.xjrsoft.module.fssp.entity.LngJkRp;
|
||||
import com.xjrsoft.module.fssp.entity.LngJkRpBill;
|
||||
import com.xjrsoft.module.fssp.request.*;
|
||||
import com.xjrsoft.module.fssp.response.*;
|
||||
import com.xjrsoft.module.fssp.service.LngJkRpBillService;
|
||||
import com.xjrsoft.module.fssp.service.LngJkRpService;
|
||||
import com.xjrsoft.module.system.client.IFileClient;
|
||||
import com.xjrsoft.module.system.dto.FileUploadDto;
|
||||
import com.xjrsoft.module.system.vo.LngFileUploadVo;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class FsspJobHandler {
|
||||
|
||||
private FsspConfig config;
|
||||
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
private LngJkRpService lngJkRpService;
|
||||
|
||||
private LngJkRpBillService lngJkRpBillService;
|
||||
|
||||
private IFileClient iFileClient;
|
||||
|
||||
private static final String FSSP_APP_TOKEN = "fssp_app_token";
|
||||
|
||||
private static final String FSSP_ACCESS_TOKEN = "fssp_access_token";
|
||||
|
||||
private static final String ACCESSTOKEN = "accesstoken";
|
||||
|
||||
public FsspJobHandler(FsspConfig config,
|
||||
RedisUtil redisUtil,
|
||||
LngJkRpService lngJkRpService,
|
||||
LngJkRpBillService lngJkRpBillService,
|
||||
IFileClient iFileClient) {
|
||||
this.config = config;
|
||||
this.redisUtil = redisUtil;
|
||||
this.lngJkRpService = lngJkRpService;
|
||||
this.lngJkRpBillService = lngJkRpBillService;
|
||||
this.iFileClient = iFileClient;
|
||||
}
|
||||
|
||||
private String getAppToken() {
|
||||
AppTokenReq appTokenReq = new AppTokenReq();
|
||||
appTokenReq.setAppId(config.getAppId());
|
||||
appTokenReq.setAppSecuret(config.getAppSecuret());
|
||||
appTokenReq.setTenantid(config.getTenantid());
|
||||
appTokenReq.setAccountId(config.getAccountId());
|
||||
appTokenReq.setLanguage(config.getLanguage());
|
||||
AtomicReference<String> appToken = new AtomicReference<>();
|
||||
FsspHttpClient.post(appTokenReq, config.getAppTokenUrl(), TokenResp.class, resp -> {
|
||||
AppTokenResp data = (AppTokenResp) resp.getData();
|
||||
if ("0".equals(data.getErrorCode())) {
|
||||
appToken.set(data.getAppToken());
|
||||
redisUtil.set(FSSP_APP_TOKEN, data.getAppToken(), data.getExpireTime());
|
||||
} else {
|
||||
throw new BusinessException(BusinessCode.of(10903,"AppToken已过期"));
|
||||
}
|
||||
});
|
||||
return appToken.toString();
|
||||
}
|
||||
|
||||
private String getAccessToken() {
|
||||
AccessTokenReq accessTokenReq = new AccessTokenReq();
|
||||
accessTokenReq.setUser(config.getUser());
|
||||
String appToken = redisUtil.get(FSSP_APP_TOKEN);
|
||||
accessTokenReq.setApptoken(StringUtils.isNotBlank(appToken) ? appToken : this.getAppToken());
|
||||
accessTokenReq.setTenantid(config.getTenantid());
|
||||
accessTokenReq.setAccountId(config.getAccountId());
|
||||
accessTokenReq.setUsertype(config.getUsertype());
|
||||
accessTokenReq.setLanguage(config.getLanguage());
|
||||
AtomicReference<String> accessToken = new AtomicReference<>();
|
||||
FsspHttpClient.post(accessTokenReq, config.getLoginUrl(), TokenResp.class, resp -> {
|
||||
AccessTokenResp data = (AccessTokenResp) resp.getData();
|
||||
if ("0".equals(data.getErrorCode())) {
|
||||
accessToken.set(data.getAccessToken());
|
||||
redisUtil.set(FSSP_ACCESS_TOKEN, data.getAccessToken(), data.getExpireTime());
|
||||
} else {
|
||||
throw new BusinessException(BusinessCode.of(10903,"AccessToken已过期"));
|
||||
}
|
||||
});
|
||||
return accessToken.toString();
|
||||
}
|
||||
|
||||
@XxlJob("yhjymxJobHandler")
|
||||
public void yhjymxJobHandler(Integer pageNo) {
|
||||
log.info("定时任务---银行交易明细查询---开始");
|
||||
FsspYhjymxReq fsspYhjymxReq = new FsspYhjymxReq();
|
||||
fsspYhjymxReq.setOrgNumber(config.getOrgNumber());
|
||||
fsspYhjymxReq.setAccountbank(config.getAccountbank());
|
||||
fsspYhjymxReq.setBankcheckflag(null);
|
||||
// 开始时间必须小于等于结束时间,且开始时间和结束时间不可相差60天以上
|
||||
fsspYhjymxReq.setBeginDate(LocalDateTime.now());
|
||||
fsspYhjymxReq.setEndDate(LocalDateTime.now());
|
||||
fsspYhjymxReq.setPageSize(100);
|
||||
fsspYhjymxReq.setPageNo(pageNo == null ? 1 : pageNo);
|
||||
List<LngJkRpDto> dtoList = Lists.newArrayList();
|
||||
Map<String, String> headers = Maps.newHashMap();
|
||||
String accesstoken = redisUtil.get(FSSP_ACCESS_TOKEN);
|
||||
headers.put(ACCESSTOKEN, StringUtils.isNotBlank(accesstoken) ? accesstoken : this.getAccessToken());
|
||||
FsspHttpClient.post(fsspYhjymxReq, config.getYhjymxUrl(), FsspResp.class, headers, resp -> {
|
||||
FsspDataResp data = resp.getData();
|
||||
if (data != null) {
|
||||
data.getRows().forEach(row -> {
|
||||
LngJkRpDto lngJkRpDto = (LngJkRpDto) row;
|
||||
lngJkRpDto.setStatusProc("N");
|
||||
lngJkRpDto.setMsgProc("接收成功");
|
||||
lngJkRpDto.setDateProc(LocalDateTime.now());
|
||||
dtoList.add(lngJkRpDto);
|
||||
});
|
||||
List<LngJkRp> list = BeanUtil.copyToList(dtoList, LngJkRp.class);
|
||||
lngJkRpService.saveOrUpdateBatch(list);
|
||||
if (!data.getLastPage()) {
|
||||
yhjymxJobHandler(fsspYhjymxReq.getPageNo() + 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
log.info("定时任务---电子回单信息查询---结束");
|
||||
}
|
||||
|
||||
@XxlJob("dzhdxxJobHandler")
|
||||
public void dzhdxxJobHandler(Integer pageNo) {
|
||||
log.info("定时任务---电子回单信息查询---开始");
|
||||
FsspDzhdxxReq fsspDzhdxxReq = new FsspDzhdxxReq();
|
||||
fsspDzhdxxReq.setOrgNumber(config.getOrgNumber());
|
||||
fsspDzhdxxReq.setAccountbank(config.getAccountbank());
|
||||
fsspDzhdxxReq.setReceiptno(null);
|
||||
// 开始时间必须小于等于结束时间,且开始时间和结束时间不可相差60天以上
|
||||
fsspDzhdxxReq.setBeginDate(LocalDateTime.now());
|
||||
fsspDzhdxxReq.setEndDate(LocalDateTime.now());
|
||||
fsspDzhdxxReq.setPageSize(100);
|
||||
fsspDzhdxxReq.setPageNo(pageNo == null ? 1 : pageNo);
|
||||
List<LngJkRpBillDto> dtoList = Lists.newArrayList();
|
||||
Map<String, String> headers = Maps.newHashMap();
|
||||
String accesstoken = redisUtil.get(FSSP_ACCESS_TOKEN);
|
||||
headers.put(ACCESSTOKEN, StringUtils.isNotBlank(accesstoken) ? accesstoken : this.getAccessToken());
|
||||
FsspHttpClient.post(fsspDzhdxxReq, config.getDzhdxxUrl(), FsspResp.class, headers, resp -> {
|
||||
FsspDataResp data = resp.getData();
|
||||
if (data != null) {
|
||||
data.getRows().forEach(row -> {
|
||||
LngJkRpBillDto lngJkRpBillDto = (LngJkRpBillDto) row;
|
||||
lngJkRpBillDto.setStatusProc("N");
|
||||
lngJkRpBillDto.setMsgProc("接收成功");
|
||||
lngJkRpBillDto.setDateProc(LocalDateTime.now());
|
||||
lngJkRpBillDto.setStatusProcAttr("N");
|
||||
dtoList.add(lngJkRpBillDto);
|
||||
});
|
||||
List<LngJkRpBill> list = BeanUtil.copyToList(dtoList, LngJkRpBill.class);
|
||||
lngJkRpBillService.saveOrUpdateBatch(list);
|
||||
if (!data.getLastPage()) {
|
||||
dzhdxxJobHandler(fsspDzhdxxReq.getPageNo() + 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
log.info("定时任务---电子回单信息查询---结束");
|
||||
}
|
||||
|
||||
@XxlJob("dzhdfjJobHandler")
|
||||
public void dzhdfjJobHandler() {
|
||||
log.info("定时任务---电子回单附件下载---开始");
|
||||
List<String> statusList = Lists.newArrayList();
|
||||
statusList.add("N");
|
||||
statusList.add("E");
|
||||
List<LngJkRpBill> list = lngJkRpBillService.list(new LambdaQueryWrapper<LngJkRpBill>()
|
||||
.in(LngJkRpBill::getStatusProc, statusList));
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
list.forEach(x -> {
|
||||
downloadFile(x);
|
||||
});
|
||||
}
|
||||
log.info("定时任务---批量下载电子回单附件---结束");
|
||||
}
|
||||
|
||||
private void downloadFile(LngJkRpBill lngJkRpBill) {
|
||||
String accesstoken = redisUtil.get(FSSP_ACCESS_TOKEN);
|
||||
if (StringUtils.isBlank(accesstoken)) {
|
||||
accesstoken = this.getAccessToken();
|
||||
}
|
||||
byte[] fileByte = FsspHttpClient.downloadFile(lngJkRpBill.getFilepath(), accesstoken, config.getDzhdfjUrl());
|
||||
FileUploadDto uploadDto = new FileUploadDto();
|
||||
uploadDto.setBuffer(fileByte);
|
||||
uploadDto.setTableName("lng_jk_rp_bill");
|
||||
try {
|
||||
LngFileUploadVo vo = iFileClient.upload(uploadDto);
|
||||
lngJkRpBill.setFilepathAttr(vo.getFilePath());
|
||||
lngJkRpBill.setStatusProcAttr("S");
|
||||
lngJkRpBill.setDateProcAttr(LocalDateTime.now());
|
||||
} catch (Exception e) {
|
||||
lngJkRpBill.setStatusProcAttr("E");
|
||||
lngJkRpBill.setMsgProcAttr(e.getMessage());
|
||||
lngJkRpBill.setDateProcAttr(LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
|
||||
@XxlJob("pzJobHandler")
|
||||
public void pzJobHandler(Integer pageNo) {
|
||||
FsspPzReq fsspPzReq = new FsspPzReq();
|
||||
fsspPzReq.setOrgNumber(config.getOrgNumber());
|
||||
fsspPzReq.setBillno(null);
|
||||
// 开始时间必须小于等于结束时间,且开始时间和结束时间不可相差60天以上
|
||||
fsspPzReq.setBeginDate(LocalDateTime.now());
|
||||
fsspPzReq.setEndDate(LocalDateTime.now());
|
||||
fsspPzReq.setSourcebill(null);
|
||||
fsspPzReq.setPageSize(100);
|
||||
fsspPzReq.setPageNo(pageNo == null ? 1 : pageNo);
|
||||
List<Object> list = Lists.newArrayList();
|
||||
Map<String, String> headers = Maps.newHashMap();
|
||||
String accesstoken = redisUtil.get(FSSP_ACCESS_TOKEN);
|
||||
headers.put(ACCESSTOKEN, StringUtils.isNotBlank(accesstoken) ? accesstoken : this.getAccessToken());
|
||||
FsspHttpClient.post(fsspPzReq, config.getPzUrl(), FsspResp.class, headers, resp -> {
|
||||
FsspDataResp data = resp.getData();
|
||||
data.getRows().forEach(row -> {
|
||||
PzResp pzResp = (PzResp) row;
|
||||
list.add(pzResp);
|
||||
});
|
||||
if (!data.getLastPage()) {
|
||||
pzJobHandler(fsspPzReq.getPageNo() + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.module.fssp.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.fssp.entity.LngJkRpBill;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-24
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngJkRpBillMapper extends MPJBaseMapper<LngJkRpBill>, BaseMapper<LngJkRpBill> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.module.fssp.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.fssp.entity.LngJkRp;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-24
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngJkRpMapper extends MPJBaseMapper<LngJkRp>, BaseMapper<LngJkRp> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.module.fssp.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJDeepService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
||||
import com.xjrsoft.module.fssp.entity.LngJkRpBill;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-24
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface LngJkRpBillService extends MPJBaseService<LngJkRpBill>, MPJDeepService<LngJkRpBill>, MPJRelationService<LngJkRpBill> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.module.fssp.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJDeepService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
||||
import com.xjrsoft.module.fssp.entity.LngJkRp;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-24
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface LngJkRpService extends MPJBaseService<LngJkRp>, MPJDeepService<LngJkRp>, MPJRelationService<LngJkRp> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.xjrsoft.module.fssp.service.impl;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.module.fssp.entity.LngJkRpBill;
|
||||
import com.xjrsoft.module.fssp.mapper.LngJkRpBillMapper;
|
||||
import com.xjrsoft.module.fssp.service.LngJkRpBillService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-24
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class LngJkRpBillServiceImpl extends MPJBaseServiceImpl<LngJkRpBillMapper, LngJkRpBill> implements LngJkRpBillService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.xjrsoft.module.fssp.service.impl;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.module.fssp.entity.LngJkRp;
|
||||
import com.xjrsoft.module.fssp.mapper.LngJkRpMapper;
|
||||
import com.xjrsoft.module.fssp.service.LngJkRpService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-24
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class LngJkRpServiceImpl extends MPJBaseServiceImpl<LngJkRpMapper, LngJkRp> implements LngJkRpService {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user