parent
7f7c6fcbf4
commit
63a0a083eb
|
@ -29,8 +29,6 @@ import java.util.Map;
|
|||
public class PayBillApiSavePlugin implements ApiSavePlugin {
|
||||
private static final Log logger = LogFactory.getLog(PayBillApiSavePlugin.class);
|
||||
private static final long serialVersionUID = 7055073356277386444L;
|
||||
private String shkd_businessid;
|
||||
private String shkd_businessnumber;
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> preHandleRequestData(List<Map<String, Object>> reqData) {
|
||||
|
@ -58,99 +56,70 @@ public class PayBillApiSavePlugin implements ApiSavePlugin {
|
|||
logger.info("进入付款处理单API");
|
||||
//收款人类型
|
||||
objectType = payeetype.toString();
|
||||
//收款人编码
|
||||
objectNumber = map.get("payeenumber").toString();
|
||||
//收款人ID
|
||||
fieldName1 = "payee";
|
||||
if (!"other".equals(objectType)) {
|
||||
//收款人编码
|
||||
objectNumber = map.get("payeenumber").toString();
|
||||
//收款人ID
|
||||
fieldName1 = "payee";
|
||||
|
||||
Map<String, Object> payeebankObj = (Map<String, Object>) map.get("payeebank");
|
||||
bankNumber = (String) payeebankObj.get("number");
|
||||
logger.info("付款处理 → \nobjectType:{}\nobjectNumber:{}\nbankNumber:{}", objectType, objectNumber, bankNumber);
|
||||
|
||||
fieldName2 = "payerbank";
|
||||
DynamicObject[] dynamicObjects = BusinessDataServiceHelper.load(objectType, "id,number", new QFilter("number", QCP.equals, objectNumber).toArray());
|
||||
logger.info("dynamicObjects.length:{}", dynamicObjects.length);
|
||||
if (dynamicObjects.length > 0) {
|
||||
map.put(fieldName1, dynamicObjects[0].getPkValue());
|
||||
logger.info("dynamicObjects[0]:{}", dynamicObjects[0]);
|
||||
Map<String, Object> payeebankObj = (Map<String, Object>) map.get("payeebank");
|
||||
bankNumber = (String) payeebankObj.get("number");
|
||||
logger.info("付款处理 → \nobjectType:{}\nobjectNumber:{}\nbankNumber:{}", objectType, objectNumber, bankNumber);
|
||||
DynamicObject[] dynamicObjects = BusinessDataServiceHelper.load(objectType, "id,number", new QFilter("number", QCP.equals, objectNumber).toArray());
|
||||
logger.info("dynamicObjects.length:{}", dynamicObjects.length);
|
||||
if (dynamicObjects.length > 0) {
|
||||
map.put(fieldName1, dynamicObjects[0].getPkValue());
|
||||
logger.info("dynamicObjects[0]:{}", dynamicObjects[0]);
|
||||
}
|
||||
}
|
||||
|
||||
DynamicObject[] amAccountbanks = BusinessDataServiceHelper.load("am_accountbank", "id,bank,bank.number", new QFilter("number", QCP.equals, bankNumber).toArray());
|
||||
logger.info("amAccountbanks.length:{}", amAccountbanks.length);
|
||||
Map<String, Object> payerbank = new HashMap<>();
|
||||
if (amAccountbanks.length > 0) {
|
||||
payerbank.put("number", amAccountbanks[0].getDynamicObject("bank").getString("number"));
|
||||
logger.info("amAccountbanks[0]:{}", amAccountbanks[0]);
|
||||
if ("bos_org".equals(objectType)) {
|
||||
fieldName2 = "payerbank";
|
||||
DynamicObject[] amAccountbanks = BusinessDataServiceHelper.load("am_accountbank", "id,bank,bank.number", new QFilter("number", QCP.equals, bankNumber).toArray());
|
||||
logger.info("amAccountbanks.length:{}", amAccountbanks.length);
|
||||
Map<String, Object> payerbank = new HashMap<>();
|
||||
if (amAccountbanks.length > 0) {
|
||||
payerbank.put("number", amAccountbanks[0].getDynamicObject("bank").getString("number"));
|
||||
logger.info("amAccountbanks[0]:{}", amAccountbanks[0]);
|
||||
}
|
||||
logger.info("payerbank:{}", payerbank);
|
||||
map.put(fieldName2, payerbank);
|
||||
}
|
||||
logger.info("payerbank:{}", payerbank);
|
||||
map.put(fieldName2, payerbank);
|
||||
}
|
||||
|
||||
if (payertype != null) {
|
||||
objectType = payertype.toString();
|
||||
objectNumber = map.get("payernumber").toString();
|
||||
fieldName1 = "payer";
|
||||
if (!"other".equals(objectType)) {
|
||||
objectNumber = map.get("payernumber").toString();
|
||||
fieldName1 = "payer";
|
||||
|
||||
|
||||
Map<String, Object> accountbank = (Map<String, Object>) map.get("accountbank");
|
||||
bankNumber = (String) accountbank.get("number");
|
||||
logger.info("收款处理 → \nobjectType:{}\nobjectNumber:{}\nbankNumber:{}", objectType, objectNumber, bankNumber);
|
||||
fieldName2 = "payeebank";
|
||||
DynamicObject[] dynamicObjects = BusinessDataServiceHelper.load(objectType, "id,number", new QFilter("number", QCP.equals, objectNumber).toArray());
|
||||
logger.info("dynamicObjects.length:{}", dynamicObjects.length);
|
||||
if (dynamicObjects.length > 0) {
|
||||
map.put(fieldName1, dynamicObjects[0].getPkValue());
|
||||
logger.info("dynamicObjects[0]:{}", dynamicObjects[0]);
|
||||
Map<String, Object> accountbank = (Map<String, Object>) map.get("accountbank");
|
||||
bankNumber = (String) accountbank.get("number");
|
||||
logger.info("收款处理 → \nobjectType:{}\nobjectNumber:{}\nbankNumber:{}", objectType, objectNumber, bankNumber);
|
||||
|
||||
DynamicObject[] dynamicObjects = BusinessDataServiceHelper.load(objectType, "id,number", new QFilter("number", QCP.equals, objectNumber).toArray());
|
||||
logger.info("dynamicObjects.length:{}", dynamicObjects.length);
|
||||
if (dynamicObjects.length > 0) {
|
||||
map.put(fieldName1, dynamicObjects[0].getPkValue());
|
||||
logger.info("dynamicObjects[0]:{}", dynamicObjects[0]);
|
||||
}
|
||||
}
|
||||
|
||||
DynamicObject[] amAccountbanks = BusinessDataServiceHelper.load("am_accountbank", "id,bank,bank.number", new QFilter("number", QCP.equals, bankNumber).toArray());
|
||||
logger.info("amAccountbanks.length:{}", amAccountbanks.length);
|
||||
Map<String, Object> payeebank = new HashMap<>();
|
||||
if (amAccountbanks.length > 0) {
|
||||
payeebank.put("number", amAccountbanks[0].getDynamicObject("bank").getString("number"));
|
||||
if ("bos_org".equals(objectType)) {
|
||||
fieldName2 = "payeebank";
|
||||
DynamicObject[] amAccountbanks = BusinessDataServiceHelper.load("am_accountbank", "id,bank,bank.number", new QFilter("number", QCP.equals, bankNumber).toArray());
|
||||
logger.info("amAccountbanks.length:{}", amAccountbanks.length);
|
||||
Map<String, Object> payeebank = new HashMap<>();
|
||||
if (amAccountbanks.length > 0) {
|
||||
payeebank.put("number", amAccountbanks[0].getDynamicObject("bank").getString("number"));
|
||||
}
|
||||
logger.info("payerbank:{}", payeebank);
|
||||
map.put(fieldName2, payeebank);
|
||||
}
|
||||
logger.info("payerbank:{}", payeebank);
|
||||
map.put(fieldName2, payeebank);
|
||||
}
|
||||
shkd_businessid = map.get("shkd_businessid").toString();
|
||||
shkd_businessnumber = map.get("shkd_businessnumber").toString();
|
||||
// shkd_businessid
|
||||
// shkd_businessnumber
|
||||
// shkd_businessname
|
||||
logger.info("最终处理 → 调用接口参数:{}", reqData);
|
||||
}
|
||||
return reqData;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public SerializerResult serialize(Object response, String accept, String contentType) {
|
||||
logger.info("进入serialize方法");
|
||||
try {
|
||||
if (contentType.contains(MediaType.APPLICATION_JSON)) {
|
||||
logger.info("进入if");
|
||||
//返回text文本
|
||||
String responseStr = new ObjectMapper().writeValueAsString(response);
|
||||
JSONObject jsonObject = JSON.parseObject(responseStr);
|
||||
// 获取 data 节点
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
|
||||
// 获取 result 节点
|
||||
JSONArray result = data.getJSONArray("result");
|
||||
result.getJSONObject(0).put("shkd_businessid", shkd_businessid);
|
||||
result.getJSONObject(0).put("shkd_businessnumber", shkd_businessnumber);
|
||||
return new SerializerResult(MediaType.TEXT_PLAIN, jsonObject.toJSONString());
|
||||
} else {
|
||||
logger.info("进入else");
|
||||
//其他类型的出参序列化
|
||||
String responseStr = new ObjectMapper().writeValueAsString(response);
|
||||
JSONObject jsonObject = JSON.parseObject(responseStr);
|
||||
return new SerializerResult(MediaType.TEXT_PLAIN, jsonObject.toJSONString());
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
logger.info("catch");
|
||||
//处理异常时严禁抛出异常,可以定义自己的错误返回信息
|
||||
String result = "...";
|
||||
return new SerializerResult(MediaType.TEXT_PLAIN, result);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue