|
@@ -1,7 +1,10 @@
|
|
package nckd.jimin.jyyy.fi.webapi;
|
|
package nckd.jimin.jyyy.fi.webapi;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.alibaba.fastjson.JSONPObject;
|
|
|
|
+import fi.er.webService.BankSynReturnModel;
|
|
import kd.bos.config.client.util.StringUtils;
|
|
import kd.bos.config.client.util.StringUtils;
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
@@ -22,6 +25,7 @@ import kd.bos.servicehelper.operation.DeleteServiceHelper;
|
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
import kd.data.rsa.helper.CodeRuleHelper;
|
|
import kd.data.rsa.helper.CodeRuleHelper;
|
|
import kd.fi.cas.helper.CasBotpHelper;
|
|
import kd.fi.cas.helper.CasBotpHelper;
|
|
|
|
+import nckd.jimin.jyyy.fi.common.NstcApiReturnModel;
|
|
|
|
|
|
import java.io.Serializable;
|
|
import java.io.Serializable;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
@@ -50,7 +54,7 @@ public class TransDetailApiPlugin implements Serializable {
|
|
* @return 处理结果
|
|
* @return 处理结果
|
|
*/
|
|
*/
|
|
@ApiPostMapping(value = "/transdetail", desc = "操作九恒星交易明细")
|
|
@ApiPostMapping(value = "/transdetail", desc = "操作九恒星交易明细")
|
|
- public CustomApiResult<Object> oprationTransDetail(
|
|
|
|
|
|
+ public CustomApiResult<JSONObject> oprationTransDetail(
|
|
@ApiParam(value = "操作类型") String operation,
|
|
@ApiParam(value = "操作类型") String operation,
|
|
@ApiParam(value = "交易明细数据", required = true) String jsondata
|
|
@ApiParam(value = "交易明细数据", required = true) String jsondata
|
|
) {
|
|
) {
|
|
@@ -59,10 +63,26 @@ public class TransDetailApiPlugin implements Serializable {
|
|
jsondata
|
|
jsondata
|
|
);
|
|
);
|
|
|
|
|
|
|
|
+ NstcApiReturnModel returnModel = new NstcApiReturnModel();
|
|
|
|
+
|
|
|
|
+ // 解析JSON数据
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(jsondata);
|
|
|
|
+ // 交易流水号ID 关键字
|
|
|
|
+ String number = jsonObject.getString("number");
|
|
|
|
+ String code = "";
|
|
|
|
+ String msg = "";
|
|
|
|
+
|
|
//JSONArray jsonArray =JSONArray.parseArray(jsondata);
|
|
//JSONArray jsonArray =JSONArray.parseArray(jsondata);
|
|
if(jsondata.startsWith("[")){
|
|
if(jsondata.startsWith("[")){
|
|
log.error("保存交易明细失败。操作类型:{},交易明细数据:{},错误信息:{}", operation, jsondata, "只允许接收1条数据,请重新传输!");
|
|
log.error("保存交易明细失败。操作类型:{},交易明细数据:{},错误信息:{}", operation, jsondata, "只允许接收1条数据,请重新传输!");
|
|
- return CustomApiResult.fail("803","操作交易明细失败: 只允许接收1条数据,请重新传输!");
|
|
|
|
|
|
+ returnModel.setNumber(number);
|
|
|
|
+ returnModel.setCode("500");
|
|
|
|
+ returnModel.setMessage("操作交易明细失败: 只允许接收1条数据,请重新传输!");
|
|
|
|
+
|
|
|
|
+ JSONArray dataArray = new JSONArray();
|
|
|
|
+ dataArray.add(JSONObject.parseObject(returnModel.toString()));
|
|
|
|
+
|
|
|
|
+ return returnResult("200","S","接口调用成功,具体信息查看responseData参数", dataArray);
|
|
}
|
|
}
|
|
|
|
|
|
//如果未传operation参数,则默认为sava保存
|
|
//如果未传operation参数,则默认为sava保存
|
|
@@ -76,30 +96,58 @@ public class TransDetailApiPlugin implements Serializable {
|
|
case "save":
|
|
case "save":
|
|
// 添加交易明细逻辑
|
|
// 添加交易明细逻辑
|
|
String errMsg = saveTransDetail(jsondata);
|
|
String errMsg = saveTransDetail(jsondata);
|
|
|
|
+
|
|
if (!EmptyUtils.isEmpty(errMsg)) {
|
|
if (!EmptyUtils.isEmpty(errMsg)) {
|
|
log.error("交易明细添加失败。操作类型:{},交易明细数据:{},错误信息:{}", operation, jsondata, "交易明细添加失败" + errMsg);
|
|
log.error("交易明细添加失败。操作类型:{},交易明细数据:{},错误信息:{}", operation, jsondata, "交易明细添加失败" + errMsg);
|
|
- return CustomApiResult.fail("802","交易明细添加失败" + errMsg);
|
|
|
|
|
|
+
|
|
|
|
+ code = "500";
|
|
|
|
+ msg = "交易明细添加失败," + errMsg;
|
|
} else {
|
|
} else {
|
|
log.info("交易明细添加成功。操作类型:{},交易明细数据:{}", operation, jsondata);
|
|
log.info("交易明细添加成功。操作类型:{},交易明细数据:{}", operation, jsondata);
|
|
- return CustomApiResult.success("交易明细添加成功");
|
|
|
|
|
|
+
|
|
|
|
+ code = "200";
|
|
|
|
+ msg = "交易明细添加成功";
|
|
}
|
|
}
|
|
|
|
+ break;
|
|
case "delete":
|
|
case "delete":
|
|
// 更新交易明细逻辑
|
|
// 更新交易明细逻辑
|
|
String errMsg1 = deleteTransDetail(jsondata);
|
|
String errMsg1 = deleteTransDetail(jsondata);
|
|
if (!EmptyUtils.isEmpty(errMsg1)) {
|
|
if (!EmptyUtils.isEmpty(errMsg1)) {
|
|
log.error("交易明细更新失败。操作类型:{},交易明细数据:{},错误信息:{}", operation, jsondata, errMsg1);
|
|
log.error("交易明细更新失败。操作类型:{},交易明细数据:{},错误信息:{}", operation, jsondata, errMsg1);
|
|
- return CustomApiResult.fail("801","交易明细更新失败" + errMsg1);
|
|
|
|
|
|
+
|
|
|
|
+ code = "500";
|
|
|
|
+ msg = "交易明细删除失败," + errMsg1;
|
|
} else {
|
|
} else {
|
|
log.info("交易明细更新成功。操作类型:{},交易明细数据:{}", operation, jsondata);
|
|
log.info("交易明细更新成功。操作类型:{},交易明细数据:{}", operation, jsondata);
|
|
- return CustomApiResult.success("交易明细更新成功");
|
|
|
|
|
|
+
|
|
|
|
+ code = "200";
|
|
|
|
+ msg = "交易明细删除成功";
|
|
}
|
|
}
|
|
|
|
+ break;
|
|
default:
|
|
default:
|
|
log.error("不支持的操作类型。操作类型:{},交易明细数据:{}", operation, jsondata);
|
|
log.error("不支持的操作类型。操作类型:{},交易明细数据:{}", operation, jsondata);
|
|
- return CustomApiResult.fail("700","不支持的操作类型");
|
|
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ returnModel.setNumber(number);
|
|
|
|
+ returnModel.setCode(code);
|
|
|
|
+ returnModel.setMessage(msg);
|
|
|
|
+
|
|
|
|
+ JSONArray dataArray = new JSONArray();
|
|
|
|
+ dataArray.add(JSONObject.parseObject(JSON.toJSONString(returnModel)));
|
|
|
|
+
|
|
|
|
+ return returnResult("200", "S", "接口调用成功,同步结果请查看responseData参数", dataArray);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("保存交易明细失败。操作类型:{},交易明细数据:{},错误信息:{}", operation, jsondata, e.getMessage());
|
|
log.error("保存交易明细失败。操作类型:{},交易明细数据:{},错误信息:{}", operation, jsondata, e.getMessage());
|
|
- return CustomApiResult.fail("801","操作交易明细失败: " + e.getMessage());
|
|
|
|
|
|
+
|
|
|
|
+ returnModel.setNumber(number);
|
|
|
|
+ returnModel.setCode("500");
|
|
|
|
+ returnModel.setMessage("操作交易明细失败: " + e.getMessage());
|
|
|
|
+
|
|
|
|
+ JSONArray dataArray = new JSONArray();
|
|
|
|
+ dataArray.add(JSONObject.parseObject(JSON.toJSONString(returnModel)));
|
|
|
|
+
|
|
|
|
+ return returnResult("500","E","接口调用异常,同步结果请查看responseData参数", dataArray);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -486,6 +534,26 @@ public class TransDetailApiPlugin implements Serializable {
|
|
return address.substring(lastSlashIndex + 1);
|
|
return address.substring(lastSlashIndex + 1);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 自定义返回data对象
|
|
|
|
+ * @param code 编码
|
|
|
|
+ * @param message 错误信息
|
|
|
|
+ * @return CustomApiResult 返回
|
|
|
|
+ */
|
|
|
|
+ public CustomApiResult<JSONObject> returnResult(String code, String status, String message, JSONArray dataArrary){
|
|
|
|
+ JSONObject reslutData = new JSONObject();
|
|
|
|
+
|
|
|
|
+ JSONArray responseData = new JSONArray();
|
|
|
|
+ JSONObject dataJSON = new JSONObject();
|
|
|
|
+ dataJSON.put("data", dataArrary);
|
|
|
|
+
|
|
|
|
+ responseData.add(dataJSON);
|
|
|
|
|
|
|
|
+ reslutData.put("code", code);
|
|
|
|
+ reslutData.put("status", status);
|
|
|
|
+ reslutData.put("message", message);
|
|
|
|
+ reslutData.put("responseData", responseData);
|
|
|
|
|
|
|
|
+ return CustomApiResult.success(reslutData);
|
|
|
|
+ }
|
|
}
|
|
}
|