From 37a8b4bd1b8a5f09ad9e258733d4d12d6b19c6fa Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期五, 04 八月 2023 16:21:01 +0800
Subject: [PATCH] erp轮询,登录,查询创建物料,查询创建订单,审核
---
/dev/null | 17 --
src/main/java/com/zy/asrs/controller/OpenController.java | 3
src/main/java/com/zy/asrs/task/kingdee/ReviewOrderSyncScheduler.java | 55 +++++++
src/main/java/com/zy/asrs/task/OrderMoveHistoryScheduler.java | 2
src/main/java/com/zy/asrs/task/kingdee/handler/LoginAuthenticationHandler.java | 2
src/main/java/com/zy/asrs/controller/MatController.java | 18 ++
src/main/java/com/zy/asrs/task/kingdee/InboundOrderScheduler.java | 2
src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java | 66 +++++---
src/main/java/com/zy/asrs/task/kingdee/handler/ReviewOrderSyncHandler.java | 204 +++++++++++++++++++++++++++++
9 files changed, 323 insertions(+), 46 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/MatController.java b/src/main/java/com/zy/asrs/controller/MatController.java
index ed235bd..a8eb233 100644
--- a/src/main/java/com/zy/asrs/controller/MatController.java
+++ b/src/main/java/com/zy/asrs/controller/MatController.java
@@ -135,6 +135,24 @@
return R.ok();
}
+ @RequestMapping(value = "/mat/KingDeeadd/auth")
+ @ManagerAuth
+ public R KingDeeadd(Mat mat) {
+ if (null != matService.selectByMatnr(mat.getMatnr())) {
+ return R.error("缂栧彿宸插瓨鍦�");
+ }
+ Date now = new Date();
+ mat.setCreateBy(getUserId());
+ mat.setCreateTime(now);
+ mat.setUpdateBy(getUserId());
+ mat.setUpdateTime(now);
+ mat.setStatus(1);
+ if (!matService.insert(mat)) {
+ throw new CoolException("娣诲姞澶辫触锛岃鑱旂郴绠$悊鍛�");
+ }
+ return R.ok();
+ }
+
@RequestMapping(value = "/mat/update/auth")
@ManagerAuth
public R update(Mat mat){
diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java
index cb34a46..1974537 100644
--- a/src/main/java/com/zy/asrs/controller/OpenController.java
+++ b/src/main/java/com/zy/asrs/controller/OpenController.java
@@ -204,4 +204,7 @@
System.out.println(JSON.toJSONString(param1));
}
+ /*********************************鍚屾鐗╂枡妗f鍜岃鍗�****************************************************/
+
+
}
diff --git a/src/main/java/com/zy/asrs/task/OrderMoveHistoryScheduler.java b/src/main/java/com/zy/asrs/task/OrderMoveHistoryScheduler.java
index 2f1081a..e709d51 100644
--- a/src/main/java/com/zy/asrs/task/OrderMoveHistoryScheduler.java
+++ b/src/main/java/com/zy/asrs/task/OrderMoveHistoryScheduler.java
@@ -14,7 +14,7 @@
/**
* 灏嗗凡瀹屾垚order鍜宱rderDetl绉诲姩鍒發og琛�
*/
- @Scheduled(cron = "0/30 * * * * ?")
+ //@Scheduled(cron = "0/30 * * * * ?")
public void execute(){
orderMoveHistoryHandler.start();
}
diff --git a/src/main/java/com/zy/asrs/task/kingdee/InboundOrderScheduler.java b/src/main/java/com/zy/asrs/task/kingdee/InboundOrderScheduler.java
index d8b3d13..75238f6 100644
--- a/src/main/java/com/zy/asrs/task/kingdee/InboundOrderScheduler.java
+++ b/src/main/java/com/zy/asrs/task/kingdee/InboundOrderScheduler.java
@@ -13,7 +13,7 @@
@Autowired
private InboundOrderHandler inboundOrderHandler;
- @Scheduled(cron = "0/3 * * * * ? ")
+ @Scheduled(cron = "0 * * * * ?")
void login(){
Boolean fig=false;
if(fig){
diff --git a/src/main/java/com/zy/asrs/task/kingdee/OutboundOrderScheduler.java b/src/main/java/com/zy/asrs/task/kingdee/OutboundOrderScheduler.java
deleted file mode 100644
index 1e4b8b7..0000000
--- a/src/main/java/com/zy/asrs/task/kingdee/OutboundOrderScheduler.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package com.zy.asrs.task.kingdee;
-
-public class OutboundOrderScheduler {
-}
diff --git a/src/main/java/com/zy/asrs/task/kingdee/ReviewOrderSyncScheduler.java b/src/main/java/com/zy/asrs/task/kingdee/ReviewOrderSyncScheduler.java
new file mode 100644
index 0000000..1983260
--- /dev/null
+++ b/src/main/java/com/zy/asrs/task/kingdee/ReviewOrderSyncScheduler.java
@@ -0,0 +1,55 @@
+package com.zy.asrs.task.kingdee;
+
+import com.core.common.Cools;
+import com.zy.asrs.entity.Order;
+import com.zy.asrs.service.ApiLogService;
+import com.zy.asrs.service.OrderService;
+import com.zy.asrs.task.core.ReturnT;
+import com.zy.asrs.task.handler.OrderSyncHandler;
+import com.zy.asrs.task.kingdee.handler.ReviewOrderSyncHandler;
+import com.zy.common.entity.Parameter;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * Created by vincent on 2020/7/7
+ */
+@Slf4j
+@Component
+public class ReviewOrderSyncScheduler {
+
+ @Autowired
+ private ReviewOrderSyncHandler reviewOrderSyncHandler;
+ @Autowired
+ private OrderService orderService;
+ @Autowired
+ private ApiLogService apiLogService;
+
+// @Scheduled(cron = "0 0 1 * * ? ")
+ public void clearApiLog(){
+ try {
+ apiLogService.clearWeekBefore();
+ } catch (Exception e) {
+ log.error("绗笁鏂规帴鍙f棩蹇楄嚜鍔ㄦ竻闄ゅけ璐ワ紙鑼冨洿锛氫竴鍛ㄤ箣鍓�", e);
+ }
+ }
+
+ @Scheduled(cron = "0/3 * * * * ? ")
+ @Async("orderThreadPool")
+ public void completeAndReport(){
+ List<Order> orders = orderService.selectComplete();
+ for (Order order : orders) {
+ ReturnT<String> result = reviewOrderSyncHandler.start(order);
+ if (!result.isSuccess()) {
+ log.error("鍗曟嵁[orderNo={}]涓婃姤erp澶辫触", order.getOrderNo());
+ }
+ }
+
+ }
+
+}
diff --git a/src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java b/src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java
index d7b1150..ca000fd 100644
--- a/src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java
+++ b/src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java
@@ -71,7 +71,7 @@
@Transactional
public synchronized ReturnT<String> start() {
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- //鐧诲綍閲戣澏r
+ //鐧诲綍閲戣澏
ReturnT<String> start = loginAuthenticationHandler.start();
for(int i=0;i<14;i++) {
InFormIdParam inFormIdParam = new InFormIdParam();
@@ -89,7 +89,7 @@
//鐢熶骇棰嗘枡
case 3 : inFormIdParam.setFormId("PRD_PickMtrl");docName=22;anfme ="FActualQty"; break;
//鐢熶骇閫�鏂�
- case 4 : inFormIdParam.setFormId("BD_MATERIAL");docName=24;anfme ="FQty"; break;
+ case 4 : inFormIdParam.setFormId("PRD_ReturnMtrl");docName=24;anfme ="FQty"; break;
//鐢熶骇琛ユ枡
case 5 : inFormIdParam.setFormId("PRD_FeedMtrl");docName=25;anfme ="FActualQty"; break;
//鐩存帴璋冩嫧鍗�
@@ -109,7 +109,7 @@
//閿�鍞��璐�
case 13 : inFormIdParam.setFormId("SAL_RETURNSTOCK");docName=33;anfme ="FRealQty"; break;
}
- inFormIdParam.setLimit(10);
+ inFormIdParam.setLimit(100);
inFormIdParam.setStartRow("0");
Date time=new Date();
String FDocumentStatus=null;
@@ -124,9 +124,9 @@
Tag tag = tagService.selectById(20);
//鏈�鏂版椂闂�
time=tag.getCreateTime();
- //鐗╂枡鐘舵��
+ //鐗╂枡鐘舵�� FUseOrgId .FNumber
FDocumentStatus="C";
- jsonObject.put("FilterString", "FCreateDate>'"+sdf.format(time)+"' and FDocumentStatus='"+FDocumentStatus+"'");
+ jsonObject.put("FilterString", "FCreateDate>'"+sdf.format(time)+"' and FDocumentStatus='"+FDocumentStatus+"' and FUseOrgId .FNumber='201'");
jsonObject.put("FieldKeys", "FName,FNumber,FCreateDate,FSpecification,FDocumentStatus");
// FName : 鐗╂枡鍚嶇О 锛�
// FNumber 锛氱墿鏂欑紪鍙凤紱
@@ -137,7 +137,7 @@
//鑾峰彇鏈�鏂版椂闂�
DocType docType= docTypeService.selectById(docName);
//鍗曟嵁鐘舵��
- FDocumentStatus="C";
+ FDocumentStatus="B";
jsonObject.put("FilterString", "FCreateDate>'"+sdf.format(docType.getCreateTime())+"' and FDocumentStatus='"+FDocumentStatus+"'");
jsonObject.put("FieldKeys", "FBillNo,FCreateDate,FMaterialId.FNumber,FMaterialId.FName,FMaterialId.FSpecification,"+anfme+",FDocumentStatus");
// FBillNo :鍗曟嵁缂栧彿锛�
@@ -152,8 +152,6 @@
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("data", jsonObject);
String add = jsonObject1.toJSONString();
- System.out.println(add);
-
//涓婃姤
String response = "";
boolean success = false;
@@ -169,6 +167,9 @@
.build()
.doPost();
JSONArray data = JSON.parseArray(response);
+ if(data.size()>0){
+ success = true;
+ }
if(i==0){
for (int j = 0; j < data.size(); j++) {
JSONArray jsonArray = data.getJSONArray(j);
@@ -181,8 +182,9 @@
mat.setMatnr(jsonArray.get(1).toString());
mat.setMaktx(jsonArray.get(0).toString());
mat.setSpecs(jsonArray.get(3).toString());//瑙勬牸
+ mat.setTagId(20L);
//瀵圭編鍥芥椂闂磋繘琛岃浆鎹�
- DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
LocalDateTime dateTime = LocalDateTime.parse(jsonArray.get(2).toString(), formatter);
String format = dateFormat.format(dateTime);
@@ -192,18 +194,18 @@
mat.setStatus(1);
//鏈�鏂版姄鍙栧晢鍝佹椂闂�
tag.setCreateTime(date);
-// tagService.update(tag,new EntityWrapper<Tag>().eq("id",20));
-// if (!matService.insert(mat)) {
-// throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
-// } else {
-// log.info("鍚屾鏂扮墿鏂橻鍟嗗搧缂栧彿锛歿}]", mat.getMatnr());
-// }
+ tagService.update(tag,new EntityWrapper<Tag>().eq("id",20));
+ if (!matService.insert(mat)) {
+ throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
+ } else {
+ log.info("鍚屾鏂扮墿鏂橻鍟嗗搧缂栧彿锛歿}]", mat.getMatnr());
+ }
}
}
}else {
for(int j=0;j<data.size();j++){
JSONArray jsonArray = data.getJSONArray(j);
- Order order = orderService.selectByNo(jsonArray.get(0).toString());
+ Order order = orderService.selectByNo(jsonArray.get(0).toString());
if (Cools.isEmpty(order)) {
DocType docType = docTypeService.selectById(docName);
Date now = new Date();
@@ -245,23 +247,28 @@
null // 澶囨敞
);
//瀵圭編鍥芥椂闂磋繘琛岃浆鎹�
- DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
LocalDateTime dateTime = LocalDateTime.parse(jsonArray.get(1).toString(), formatter);
String format = dateFormat.format(dateTime);
Date date = sdf.parse(format);
//鏈�鏂版姄鍙栨椂闂�
docType.setCreateTime(date);
-// docTypeService.update(docType,new EntityWrapper<DocType>().eq("doc_id",docName));
-// if (!orderService.insert(order)) {
-// throw new CoolException("鐢熸垚鍗曟嵁涓绘。澶辫触锛岃鑱旂郴绠$悊鍛�");
-// }
+ docTypeService.update(docType,new EntityWrapper<DocType>().eq("doc_id",docName));
+ if (!orderService.insert(order)) {
+ throw new CoolException("鐢熸垚鍗曟嵁涓绘。澶辫触锛岃鑱旂郴绠$悊鍛�");
+ }
}
//鐗╂枡缂栫爜
Mat mat = matService.selectByMatnr(jsonArray.get(2).toString());
if (Cools.isEmpty(mat)) {
throw new CoolException(jsonArray.get(2).toString() + "缂栧彿鍟嗗搧妫�绱㈠け璐ワ紝璇峰厛娣诲姞鍟嗗搧");
}
+ OrderDetl orderDetl1=orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("order_no",jsonArray.get(0).toString()).eq("matnr",jsonArray.get(2).toString()));
+ if(!Cools.isEmpty(orderDetl1)){
+ continue;
+ }
+ DocType docType = docTypeService.selectById(docName);
OrderDetl orderDetl = new OrderDetl();
orderDetl.sync(mat);
orderDetl.setBatch(null);
@@ -274,9 +281,16 @@
orderDetl.setUpdateTime(new Date());
orderDetl.setStatus(1);
orderDetl.setQty(0.0D);
-// if (!orderDetlService.insert(orderDetl)) {
-// throw new CoolException("鐢熸垚鍗曟嵁鏄庣粏澶辫触锛岃鑱旂郴绠$悊鍛�");
-// }
+ DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
+ DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
+ LocalDateTime dateTime = LocalDateTime.parse(jsonArray.get(1).toString(), formatter);
+ String format = dateFormat.format(dateTime);
+ Date date = sdf.parse(format);
+ //鏈�鏂版姄鍙栨椂闂�
+ docType.setCreateTime(date);
+ if (!orderDetlService.insert(orderDetl)) {
+ throw new CoolException("鐢熸垚鍗曟嵁鏄庣粏澶辫触锛岃鑱旂郴绠$悊鍛�");
+ }
}
}
} catch (Exception e) {
@@ -287,8 +301,8 @@
try {
// 淇濆瓨鎺ュ彛鏃ュ織
apiLogService.save(
- "鐧诲綍閲戣澏",
- MesConstant.URL + MesConstant.PAKIN_URL,
+ "杞鏁版嵁",
+ URL + inaddress,
null,
"127.0.0.1",
add,
diff --git a/src/main/java/com/zy/asrs/task/kingdee/handler/LoginAuthenticationHandler.java b/src/main/java/com/zy/asrs/task/kingdee/handler/LoginAuthenticationHandler.java
index 8e32b46..7af1b3b 100644
--- a/src/main/java/com/zy/asrs/task/kingdee/handler/LoginAuthenticationHandler.java
+++ b/src/main/java/com/zy/asrs/task/kingdee/handler/LoginAuthenticationHandler.java
@@ -91,7 +91,7 @@
// 淇濆瓨鎺ュ彛鏃ュ織
apiLogService.save(
"鐧诲綍閲戣澏",
- MesConstant.URL + MesConstant.PAKIN_URL,
+ URL + loginaddress,
null,
"127.0.0.1",
JSON.toJSONString(loginParam),
diff --git a/src/main/java/com/zy/asrs/task/kingdee/handler/OutboundOrderHandler.java b/src/main/java/com/zy/asrs/task/kingdee/handler/OutboundOrderHandler.java
deleted file mode 100644
index f3df4a7..0000000
--- a/src/main/java/com/zy/asrs/task/kingdee/handler/OutboundOrderHandler.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.zy.asrs.task.kingdee.handler;
-
-import com.zy.asrs.task.AbstractHandler;
-import com.zy.asrs.task.core.ReturnT;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-@Service
-@Slf4j
-public class OutboundOrderHandler extends AbstractHandler<String> {
- @Transactional
- public synchronized ReturnT<String> start() {
-
- return SUCCESS;
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/zy/asrs/task/kingdee/handler/ReviewOrderSyncHandler.java b/src/main/java/com/zy/asrs/task/kingdee/handler/ReviewOrderSyncHandler.java
new file mode 100644
index 0000000..c7622db
--- /dev/null
+++ b/src/main/java/com/zy/asrs/task/kingdee/handler/ReviewOrderSyncHandler.java
@@ -0,0 +1,204 @@
+package com.zy.asrs.task.kingdee.handler;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.core.common.Cools;
+import com.core.common.DateUtils;
+import com.core.exception.CoolException;
+import com.zy.asrs.entity.DocType;
+import com.zy.asrs.entity.Order;
+import com.zy.asrs.entity.OrderDetl;
+import com.zy.asrs.entity.Tag;
+import com.zy.asrs.entity.param.InFormIdParam;
+import com.zy.asrs.service.ApiLogService;
+import com.zy.asrs.service.DocTypeService;
+import com.zy.asrs.service.OrderDetlService;
+import com.zy.asrs.service.OrderService;
+import com.zy.asrs.task.AbstractHandler;
+import com.zy.asrs.task.core.ReturnT;
+import com.zy.common.constant.MesConstant;
+import com.zy.common.model.MesPakinParam;
+import com.zy.common.model.MesPakoutParam;
+import com.zy.common.utils.HttpHandler;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Created by vincent on 2020/7/7
+ */
+@Slf4j
+@Service
+public class ReviewOrderSyncHandler extends AbstractHandler<String> {
+ @Value("${erp.address.URL}")
+ //绔彛
+ private String URL;
+
+ @Value("${erp.address.outaddress}")
+ //瀹℃牳鍦板潃
+ private String outaddress;
+
+ @Autowired
+ private JdbcTemplate jdbcTemplate;
+ @Autowired
+ private OrderService orderService;
+ @Autowired
+ private OrderDetlService orderDetlService;
+ @Autowired
+ private ApiLogService apiLogService;
+ @Autowired
+ private DocTypeService docTypeService;
+ @Autowired
+ private LoginAuthenticationHandler loginAuthenticationHandler;
+
+ @Transactional
+ public ReturnT<String> start(Order order) {
+ //鐧诲綍閲戣澏r
+ ReturnT<String> start = loginAuthenticationHandler.start();
+ DocType docType = docTypeService.selectById(order.getDocType());
+ if (null == docType) {
+ return SUCCESS;
+ }
+ InFormIdParam inFormIdParam = new InFormIdParam();
+ int docId = Long.valueOf(docType.getDocId()).intValue();
+ switch (docId) {
+ //閲囪喘鍏ュ簱
+ case 13:
+ inFormIdParam.setFormId("STK_InStock");
+ break;
+ //閲囪喘閫�鏂�
+ case 21:
+ inFormIdParam.setFormId("PUR_MRB");
+ break;
+ //鐢熶骇棰嗘枡
+ case 22:
+ inFormIdParam.setFormId("PRD_PickMtrl");
+ break;
+ //鐢熶骇閫�鏂�
+ case 24:
+ inFormIdParam.setFormId("PRD_ReturnMtrl");
+ break;
+ //鐢熶骇琛ユ枡
+ case 25:
+ inFormIdParam.setFormId("PRD_FeedMtrl");
+ break;
+ //鐩存帴璋冩嫧鍗�
+ case 26:
+ inFormIdParam.setFormId("STK_TransferDirect");
+ break;
+ //鐩樼泩鍗�
+ case 28:
+ inFormIdParam.setFormId("STK_StockCountGain");
+ break;
+ //鐩樹簭鍗�
+ case 29:
+ inFormIdParam.setFormId("STK_StockCountLoss");
+ break;
+ //鍏朵粬鍑哄簱
+ case 30:
+ inFormIdParam.setFormId("STK_MisDelivery");
+ break;
+ //绠�鍗曠敓浜ч鏂�
+ case 31:
+ inFormIdParam.setFormId("SP_PickMtrl");
+ break;
+ //绠�鍗曠敓浜ч��鏂�
+ case 32:
+ inFormIdParam.setFormId("SP_ReturnMtrl");
+ break;
+ //閿�鍞嚭搴�
+ case 14:
+ inFormIdParam.setFormId("SAL_OUTSTOCK");
+ break;
+ //閿�鍞��璐�
+ case 33:
+ inFormIdParam.setFormId("SAL_RETURNSTOCK");
+ break;
+ }
+
+ //鏉′欢鎷兼帴
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("Numbers",order.getOrderNo());
+ JSONObject jsonObject1 = new JSONObject();
+ jsonObject1.put("data", jsonObject);
+ jsonObject1.put("FormId",inFormIdParam.getFormId());
+ String add = jsonObject1.toJSONString();
+ //涓婃姤
+ String response = "";
+ boolean success = false;
+ try {
+ //鑾峰彇Cookie鍊�
+ HashMap<String, Object> headers = new HashMap<>();
+ headers.put("Cookie", start.getContent());
+ response = new HttpHandler.Builder()
+ .setHeaders(headers)
+ .setUri(URL)
+ .setPath(outaddress)
+ .setJson(add)
+ .build()
+ .doPost();
+ JSONObject data = JSON.parseObject(response);
+ Object IsSuccess = findValueByKey(JSON.parseObject(response), "IsSuccess");
+ String bool=IsSuccess.toString();
+ //涓婃姤瀹屾垚璁㈠崟4杞�6
+ if(bool.equals("true")){
+ success = true;
+ order.setSettle(6L);
+ orderService.update(order,new EntityWrapper<Order>().eq("order_no",order.getOrderNo()));
+ }
+ } catch (Exception e) {
+ log.error("fail", e);
+// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ return FAIL.setMsg(e.getMessage());
+ } finally {
+ try {
+ // 淇濆瓨鎺ュ彛鏃ュ織
+ apiLogService.save(
+ "瀹℃牳",
+ URL+ outaddress,
+ null,
+ "127.0.0.1",
+ add,
+ response,
+ success
+ );
+ } catch (Exception e) {
+ log.error("", e);
+ }
+ }
+ return SUCCESS;
+ }
+ public static Object findValueByKey(JSONObject json, String key) {
+ Set<String> keySet = json.keySet();
+ for (String k : keySet) {
+ Object v = json.get(k);
+ if (k.equals(key)) {
+ return v;
+ } else if (v instanceof JSONArray) {
+ int size = ((JSONArray) v).size();
+ for (int i = 0; i <= size - 1; i++) {
+ Object result = findValueByKey((JSONObject) ((JSONArray) v).get(i), key);
+ if (result != null){
+ return result;
+ }
+ }
+ } else if (v instanceof JSONObject){
+ Object result = findValueByKey((JSONObject) v, key);
+ if (result != null){
+ return result;
+ }
+ }
+ }
+ return null;
+ }
+}
--
Gitblit v1.9.1