Commit 541f326c authored by chenzhao's avatar chenzhao

工行代扣接口修改

parent 09c66ffa
......@@ -23,7 +23,7 @@ public enum UploadStatusEnum {
public static UploadStatusEnum getNodeByCode(String code) {
UploadStatusEnum anEnum = null;
for (UploadStatusEnum type : UploadStatusEnum.values()) {
if (type.getCode() == code) {
if (type.getCode().equals(code) ) {
anEnum = type;
break;
}
......
......@@ -922,12 +922,14 @@ public class SFTPUtil {
if (!fileName.equals(".") && !fileName.equals("..")) { // 排除当前和上级目录条目
String fileContentAsString = getFileContentAsString(remotePath, fileName);
List<String> contents = Arrays.asList(fileContentAsString.split("\r\n"));
if (null != contents && contents.size() > 0) {
for (String content : contents) {
ResultLinkField resultLinkField = contentHandle(content);
allJsonData.add(resultLinkField);
}
}
}
}
} catch (SftpException e) {
logger.error("Failed to list files in directory: {}. Error: {}", remotePath, e.getMessage(), e);
throw e;
......
......@@ -424,18 +424,36 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
if (sftp.isExist(downLoadPath)) {
//获取回盘文件扣款状态
List<ResultLinkField> files = sftp.getAllResultFilesContentAsJson(downLoadPath);
for (ResultLinkField resultLinkField : files) {
if (CollectionUtil.isNotEmpty(files)){
Map<String, List<ResultLinkField>> collect = files.stream().collect(Collectors.groupingBy(ResultLinkField::getBatchNo));
for (String batchNo : collect.keySet()) {
LambdaQueryWrapper<IcbcWithhold> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IcbcWithhold::getBatchNo,batchNo);
IcbcWithhold model = this.getBaseMapper().selectOne(queryWrapper);
List<IcbcWithholdRecord> icbcWithholdRecords = JSONArray.parseArray(model.getIcbcRecordInfos(), IcbcWithholdRecord.class);
Boolean isSuccess = true;
List<ResultLinkField> resultLinkFields = collect.get(batchNo);
//若失败 组装失败农户姓名及原因
String err ="";
for (ResultLinkField resultLinkField : resultLinkFields) {
if (!resultLinkField.getErrMsg().contains("成功")){
err = err+ icbcWithholdRecords.get(Integer.valueOf(resultLinkField.getBillNo())).getCustName() + ":" + resultLinkField.getErrMsg() + ";";
isSuccess = false;
}
}
LambdaUpdateWrapper<IcbcWithhold> updateWrapper = new LambdaUpdateWrapper<>();
if (resultLinkField.getStatus().equals("1")) {
updateWrapper.set(IcbcWithhold::getPaymentErrorDesc,resultLinkField.getErrMsg());
if (!isSuccess) {
updateWrapper.set(IcbcWithhold::getPaymentErrorDesc,err);
updateWrapper.set(IcbcWithhold::getWithholdStatus,UploadStatusEnum.失败.getName());
}else {
updateWrapper.set(IcbcWithhold::getWithholdStatus,UploadStatusEnum.成功.getName());
}
updateWrapper.eq(IcbcWithhold::getBatchNo,resultLinkField.getBatchNo());
updateWrapper.eq(IcbcWithhold::getBatchNo,batchNo);
this.getBaseMapper().update(null,updateWrapper);
}
}
}
}
......@@ -547,7 +565,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
response = client.execute(request, System.currentTimeMillis() + "");
if (response.isSuccess()) {
List<JftApiPayFeewithholdQuerydetailResponseV1.TradeInfo> tradeList = response.getTradeList();
List<JftApiPayFeewithholdQuerydetailResponseV1.TradeInfo> filterList = tradeList.stream().filter(e -> batchNos.contains(e)).collect(Collectors.toList());
List<JftApiPayFeewithholdQuerydetailResponseV1.TradeInfo> filterList = tradeList.stream().filter(e -> batchNos.contains(e.getBatchNo())).collect(Collectors.toList());
filterList.forEach(e->{
LambdaUpdateWrapper<IcbcWithholdRecord> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IcbcWithholdRecord::getBatchNo,e.getBatchNo());
......
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