退预付款、员工还款推送、作废接口联调

This commit is contained in:
李贵强 2025-03-19 16:29:02 +08:00
parent a1041aa735
commit 33b7b1f6fe
6 changed files with 52 additions and 77 deletions

View File

@ -25,11 +25,13 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin {
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
//this.getView().setVisible(false, RecFieldsInfo.ENTRY_CUSTOMER);
String value = (String) this.getModel().getValue("shjh_qzzt");
if (value.isEmpty()){
DynamicObjectCollection entry = (DynamicObjectCollection) this.getModel().getValue("entry");
if (null != entry && entry.size() != 0) {
setClosingStatus(entry);
}
}
//TODO:分录默认清账状态
//携带规则分录的业务大类,业务小类,成本中心,利润中心到收款处理单头
carryCustomer();

View File

@ -89,15 +89,14 @@ public class LoanPushSapOperation extends AbstractOperationServicePlugIn impleme
HashMap<String, String> responseHead = ApiUtils.buildHead(INTERFACE_ID,RECEIVER_ID);
HashMap<String, Object> responseBody = this.assembleRequest(INTERFACE_ID,billNumber, recBill,message);
//try {
// String response = ApiUtils.sendPost(responseHead, responseBody, "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send");
String response="{ \"rootContextID\": \"8as6dfasd6f98as7d6f9a98sd76f\", \"code\": \"0\", \"msg\": \"成功\", \"data\": { \"ID\": \"ab7a4722-656e-4fdf-bcea-3d40d175fa78\", \"BillConfigID\": 2524, \"RequestCode\": \"JKY2025030400002\" } }";
try {
String response = ApiUtils.sendPost(responseHead, responseBody, "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send");
if (!response.isEmpty()) {
this.parseResponse(recBill,response, billNumber, responseBody, INTERFACE_ID, message);
}
//} catch (IOException ex) {
// message.append("收款处理【").append(billNumber).append("】:").append(ex.getMessage()).append("\n");
//}
} catch (IOException ex) {
message.append("收款处理【").append(billNumber).append("】:").append(ex.getMessage()).append("\n");
}
if (message.length()!=0){
OperateErrorInfo operateErrorInfo = new OperateErrorInfo();
operateErrorInfo.setMessage(String.valueOf(message));
@ -195,14 +194,17 @@ public class LoanPushSapOperation extends AbstractOperationServicePlugIn impleme
//还款人工号
header.put("FM_UserCode", recBill.getDynamicObjectCollection("entry").get(0).getString("shjh_usercode"));
//收款银行账号
header.put("FM_BankCode",recBill.getString("accountbank.number"));
//header.put("FM_BankCode",recBill.getString("accountbank.number"));
header.put("FM_BankCode","11016612133000");
//成本中心编码
header.put("FM_CostCenterCode", recBill.getString("shjh_costcenter.number"));
//header.put("FM_CostCenterCode", recBill.getString("shjh_costcenter.number"));
header.put("FM_CostCenterCode", "100100");
//创建人工号
header.put("FM_CreateUserCode", recBill.getString("creator.number"));
//header.put("FM_CreateUserCode", recBill.getString("creator.number"));
header.put("FM_CreateUserCode", "GH017994");
header.put("FM_CurrencyCode", "RMB");
//单据主题
header.put("FM_RequestName", "退预付款推送测试");
header.put("FM_RequestName", "员工还款推送测试");
//附件URL地址
//HashMap<String, String> url = new HashMap<>(2);
header.put("FM_AttachUr", new ArrayList<>());
@ -259,19 +261,19 @@ public class LoanPushSapOperation extends AbstractOperationServicePlugIn impleme
break;
case "1":
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBPushApi", "服务异常");
message.append("收款处理【").append(billNumber).append("】:").append("服务异常").append("\n");
message.append("收款处理【").append(billNumber).append("】:").append("服务异常:").append(result.getString("msg")).append("\n");
break;
case "2":
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBPushApi", "三方服务异常");
message.append("收款处理【").append(billNumber).append("】:").append("三方服务异常").append("\n");
message.append("收款处理【").append(billNumber).append("】:").append("三方服务异常:").append(result.getString("msg")).append("\n");
break;
case "3":
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBPushApi", "业务异常");
message.append("收款处理【").append(billNumber).append("】:").append("业务异常").append("\n");
message.append("收款处理【").append(billNumber).append("】:").append("业务异常:").append(result.getString("msg")).append("\n");
break;
default:
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBPushApi", "未知异常");
message.append("收款处理【").append(billNumber).append("】:").append("未知异常").append("\n");
message.append("收款处理【").append(billNumber).append("】:").append("异常:").append(result.getString("msg")).append("\n");
break;
}
}

View File

@ -190,16 +190,20 @@ public class PaymentPushSapOperation extends AbstractOperationServicePlugIn impl
header.put("FM_RequestCode", billNumber);
//公司编码
header.put("FM_CompanyCode", recBill.getString("org.number"));
//header.put("FM_CompanyCode", "C021");//测试用
//部门编码
header.put("FM_DeptCode", recBill.getDynamicObjectCollection("entry").get(0).getString("shjh_deptcode"));
//供应商编码
header.put("FM_SupplierCode", getSupOrCusNumber(recBill));
//header.put("FM_SupplierCode", getSupOrCusNumber(recBill));
header.put("FM_SupplierCode", "6000003");
//员工工号
header.put("FM_UserCode", recBill.getDynamicObjectCollection("entry").get(0).getString("shjh_usercode"));
//成本中心编码
header.put("FM_CostCenterCode", recBill.getString("shjh_costcenter.number"));
//header.put("FM_CostCenterCode", "300100");//测试用
//创建人工号
header.put("FM_CreateUserCode", recBill.getString("creator.number"));
//header.put("FM_CreateUserCode", "GH017994");//测试用
header.put("FM_CurrencyCode", "RMB");
//单据主题
header.put("FM_RequestName", "退预付款推送测试");
@ -259,19 +263,19 @@ public class PaymentPushSapOperation extends AbstractOperationServicePlugIn impl
break;
case "1":
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBPushApi", "服务异常");
message.append("收款处理【").append(billNumber).append("】:").append("服务异常").append("\n");
message.append("收款处理【").append(billNumber).append("】:").append("服务异常:").append(result.getString("msg")).append("\n");
break;
case "2":
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBPushApi", "三方服务异常");
message.append("收款处理【").append(billNumber).append("】:").append("三方服务异常").append("\n");
message.append("收款处理【").append(billNumber).append("】:").append("三方服务异常:").append(result.getString("msg")).append("\n");
break;
case "3":
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBPushApi", "业务异常");
message.append("收款处理【").append(billNumber).append("】:").append("业务异常").append("\n");
message.append("收款处理【").append(billNumber).append("】:").append("业务异常:").append(result.getString("msg")).append("\n");
break;
default:
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBPushApi", "未知异常");
message.append("收款处理【").append(billNumber).append("】:").append("未知异常").append("\n");
message.append("收款处理【").append(billNumber).append("】:").append("异常:").append(result.getString("msg")).append("\n");
break;
}
}

View File

@ -138,15 +138,14 @@ public class RebReversalFiOperation extends AbstractOperationServicePlugIn imple
HashMap<String, String> responseHead = ApiUtils.buildHead(INTERFACE_ID,RECEIVER_ID);
HashMap<String, Object> responseBody = this.assembleRequest(INTERFACE_ID,billNumber, recBill,message);
//try {
// String response = ApiUtils.sendPost(responseHead, responseBody, "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send");
String response="{ \"rootContextID\": \"8as6dfasd6f98as7d6f9a98sd76f\", \"code\": \"0\", \"msg\": \"红冲作废单据处理成功\", \"data\": null }";
try {
String response = ApiUtils.sendPost(responseHead, responseBody, "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send");
if (!response.isEmpty()) {
ApiUtils.parseResponse(response, billNumber, responseBody, INTERFACE_ID, message);
}
//} catch (IOException ex) {
// message.append("收款处理【").append(billNumber).append("】:").append(ex.getMessage()).append("\n");
//}
} catch (IOException ex) {
message.append("收款处理【").append(billNumber).append("】:").append(ex.getMessage()).append("\n");
}
//错误消息
if (message.length()!=0){
OperateErrorInfo operateErrorInfo = new OperateErrorInfo();
@ -181,8 +180,11 @@ public class RebReversalFiOperation extends AbstractOperationServicePlugIn imple
HashMap<String, Object> data = new HashMap<>(10);
//员工工号(操作人)
data.put("UserCode", SysUtils.getUserNumber());
//data.put("UserCode", "GH017994");//测试用
//单据标识(2:预付款退回,3:员工还款)
data.put("BillType", "109".equals(recBill.getString(ReversalValidator.KEY_RECEIVING_TYPE)) ? 2:3);
DynamicObject type = recBill.getDynamicObject(ReversalValidator.KEY_RECEIVING_TYPE);
String number = type.getString("number");
data.put("BillType", "103".equals(number) ? 2:3);
//单据编号生成接口返回的RequestCode
data.put("BillCode",recBill.getString("shjh_returncode"));
//单据编号生成接口返回的ID
@ -195,40 +197,5 @@ public class RebReversalFiOperation extends AbstractOperationServicePlugIn imple
return responseBody;
}
/**
* 日志记录
*
* @param response 响应参数
* @param billNumber 本单单号
* @param body 请求体
* @param apiName 接口名
*/
public void parseResponse(String response, String billNumber, HashMap<String, Object> body, String apiName, StringBuilder message) {
JSONObject result = JSONObject.parseObject(response);
if (null != result) {
String formattedBody = JSON.toJSONString(body);
String code = result.getString("code");
switch (code) {
case "0":
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, true, "ESBReversalApi", "推送成功");
break;
case "1":
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBReversalApi", "服务异常");
message.append("收款处理【").append(billNumber).append("】:").append("服务异常").append("\n");
break;
case "2":
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBReversalApi", "三方服务异常");
message.append("收款处理【").append(billNumber).append("】:").append("三方服务异常").append("\n");
break;
case "3":
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBReversalApi", "业务异常");
message.append("收款处理【").append(billNumber).append("】:").append("业务异常").append("\n");
break;
default:
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBReversalApi", "未知异常");
message.append("收款处理【").append(billNumber).append("】:").append("未知异常").append("\n");
break;
}
}
}
}

View File

@ -54,7 +54,7 @@ public class ClaimSubmitValidator extends AbstractValidator {
}
/**
* 判断金额是否有效
* 判断金额是否超额
*
* @param type 收款类型
* @param reAmount 收款金额
@ -66,14 +66,14 @@ public class ClaimSubmitValidator extends AbstractValidator {
private boolean isAmountInvalid(String type, BigDecimal reAmount, BigDecimal receivableAll, BigDecimal refundedAll, BigDecimal repaymentAll) {
switch (type) {
case "100":
//当收款类型=销售回款时校验分录行应收金额合计收款金额
return reAmount.compareTo(receivableAll) <= 0;
//当收款类型=销售回款时分录行应收金额合计>收款金额
return receivableAll.compareTo(reAmount) > 0;
case "103":
//当收款类型=预付款退回时校验分录行本次退还本位币金额合计收款金额
return reAmount.compareTo(refundedAll) <= 0;
//当收款类型=预付款退回时分录行本次退还本位币金额合计>收款金额
return refundedAll.compareTo(reAmount) > 0;
case "109":
//当收款类型=员工还款时校验分录行本次还款金额合计收款金额
return reAmount.compareTo(repaymentAll) <= 0;
//当收款类型=员工还款时分录行本次还款金额合计>收款金额
return repaymentAll.compareTo(reAmount) > 0;
default:
return false;
}

View File

@ -110,19 +110,19 @@ public class ApiUtils {
break;
case "1":
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBReversalApi", "服务异常");
message.append("收款处理【").append(billNumber).append("】:").append("服务异常").append("\n");
message.append("收款处理【").append(billNumber).append("】:").append("服务异常:").append(result.getString("msg")).append("\n");
break;
case "2":
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBReversalApi", "三方服务异常");
message.append("收款处理【").append(billNumber).append("】:").append("三方服务异常").append("\n");
message.append("收款处理【").append(billNumber).append("】:").append("三方服务异常:").append(result.getString("msg")).append("\n");
break;
case "3":
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBReversalApi", "业务异常");
message.append("收款处理【").append(billNumber).append("】:").append("业务异常").append("\n");
message.append("收款处理【").append(billNumber).append("】:").append("业务异常:").append(result.getString("msg")).append("\n");
break;
default:
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBReversalApi", "未知异常");
message.append("收款处理【").append(billNumber).append("】:").append("未知异常").append("\n");
message.append("收款处理【").append(billNumber).append("】:").append("异常:").append(result.getString("msg")).append("\n");
break;
}
}