Commit 541f326c authored by chenzhao's avatar chenzhao

工行代扣接口修改

parent 09c66ffa
...@@ -23,7 +23,7 @@ public enum UploadStatusEnum { ...@@ -23,7 +23,7 @@ public enum UploadStatusEnum {
public static UploadStatusEnum getNodeByCode(String code) { public static UploadStatusEnum getNodeByCode(String code) {
UploadStatusEnum anEnum = null; UploadStatusEnum anEnum = null;
for (UploadStatusEnum type : UploadStatusEnum.values()) { for (UploadStatusEnum type : UploadStatusEnum.values()) {
if (type.getCode() == code) { if (type.getCode().equals(code) ) {
anEnum = type; anEnum = type;
break; break;
} }
......
...@@ -922,9 +922,11 @@ public class SFTPUtil { ...@@ -922,9 +922,11 @@ public class SFTPUtil {
if (!fileName.equals(".") && !fileName.equals("..")) { // 排除当前和上级目录条目 if (!fileName.equals(".") && !fileName.equals("..")) { // 排除当前和上级目录条目
String fileContentAsString = getFileContentAsString(remotePath, fileName); String fileContentAsString = getFileContentAsString(remotePath, fileName);
List<String> contents = Arrays.asList(fileContentAsString.split("\r\n")); List<String> contents = Arrays.asList(fileContentAsString.split("\r\n"));
for (String content : contents) { if (null != contents && contents.size() > 0) {
ResultLinkField resultLinkField = contentHandle(content); for (String content : contents) {
allJsonData.add(resultLinkField); ResultLinkField resultLinkField = contentHandle(content);
allJsonData.add(resultLinkField);
}
} }
} }
} }
......
...@@ -424,17 +424,35 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit ...@@ -424,17 +424,35 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
if (sftp.isExist(downLoadPath)) { if (sftp.isExist(downLoadPath)) {
//获取回盘文件扣款状态 //获取回盘文件扣款状态
List<ResultLinkField> files = sftp.getAllResultFilesContentAsJson(downLoadPath); List<ResultLinkField> files = sftp.getAllResultFilesContentAsJson(downLoadPath);
for (ResultLinkField resultLinkField : files) { if (CollectionUtil.isNotEmpty(files)){
LambdaUpdateWrapper<IcbcWithhold> updateWrapper = new LambdaUpdateWrapper<>(); Map<String, List<ResultLinkField>> collect = files.stream().collect(Collectors.groupingBy(ResultLinkField::getBatchNo));
if (resultLinkField.getStatus().equals("1")) { for (String batchNo : collect.keySet()) {
updateWrapper.set(IcbcWithhold::getPaymentErrorDesc,resultLinkField.getErrMsg()); LambdaQueryWrapper<IcbcWithhold> queryWrapper = new LambdaQueryWrapper<>();
updateWrapper.set(IcbcWithhold::getWithholdStatus,UploadStatusEnum.失败.getName()); queryWrapper.eq(IcbcWithhold::getBatchNo,batchNo);
}else { IcbcWithhold model = this.getBaseMapper().selectOne(queryWrapper);
updateWrapper.set(IcbcWithhold::getWithholdStatus,UploadStatusEnum.成功.getName()); 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 (!isSuccess) {
updateWrapper.set(IcbcWithhold::getPaymentErrorDesc,err);
updateWrapper.set(IcbcWithhold::getWithholdStatus,UploadStatusEnum.失败.getName());
}else {
updateWrapper.set(IcbcWithhold::getWithholdStatus,UploadStatusEnum.成功.getName());
}
updateWrapper.eq(IcbcWithhold::getBatchNo,batchNo);
this.getBaseMapper().update(null,updateWrapper);
} }
updateWrapper.eq(IcbcWithhold::getBatchNo,resultLinkField.getBatchNo());
this.getBaseMapper().update(null,updateWrapper);
} }
} }
} }
...@@ -547,7 +565,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit ...@@ -547,7 +565,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
response = client.execute(request, System.currentTimeMillis() + ""); response = client.execute(request, System.currentTimeMillis() + "");
if (response.isSuccess()) { if (response.isSuccess()) {
List<JftApiPayFeewithholdQuerydetailResponseV1.TradeInfo> tradeList = response.getTradeList(); 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->{ filterList.forEach(e->{
LambdaUpdateWrapper<IcbcWithholdRecord> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<IcbcWithholdRecord> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IcbcWithholdRecord::getBatchNo,e.getBatchNo()); 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