From 37a91ca4455e5ae3d1a8141d16fdda2c4662d18d Mon Sep 17 00:00:00 2001 From: luojian <1327479187@qq.com> Date: Thu, 13 Feb 2025 14:10:47 +0800 Subject: [PATCH] 1 --- .../biz/service/impl/BizOrderServiceImpl.java | 56 +++++++++++-------- .../mapper/BizOrderStatusChangeLogMapper.xml | 27 --------- 2 files changed, 33 insertions(+), 50 deletions(-) delete mode 100644 cpxt-system/src/main/resources/mapper/BizOrderStatusChangeLogMapper.xml diff --git a/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizOrderServiceImpl.java b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizOrderServiceImpl.java index a986a12..a8766df 100644 --- a/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizOrderServiceImpl.java +++ b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizOrderServiceImpl.java @@ -28,6 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.cpxt.biz.service.IBizOrderService; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; import javax.validation.Validator; @@ -38,6 +40,7 @@ import javax.validation.Validator; * @date 2024-12-16 */ @Service +@RestController public class BizOrderServiceImpl implements IBizOrderService { private static final Logger log = LoggerFactory.getLogger(BizOrderServiceImpl.class); @@ -397,7 +400,7 @@ public class BizOrderServiceImpl implements IBizOrderService { bizOrderSubMapper.insert(bizOrderSub); // 同步调用同城急送平台入口 - callThirdPartyInterface(bizOrder, subList.get(0), bizOrderSub); + callThirdPartyInterface(bizOrder, bizOrderSub); } } }else { @@ -420,39 +423,46 @@ public class BizOrderServiceImpl implements IBizOrderService { bizOrderSubMapper.insert(bizOrderSub); // 同步调用同城急送平台入口 - callThirdPartyInterface(bizOrder, map1, bizOrderSub); + callThirdPartyInterface(bizOrder,bizOrderSub); } } } } - private void callThirdPartyInterface(BizOrder bizOrder, Map map1, BizOrderSub bizOrderSub) { - String response = cityDelivery.addOrder(bizOrder, bizOrderSub); + @GetMapping("/test9") + private void callThirdPartyInterface(BizOrder bizOrder,BizOrderSub bizOrderSub) { +// String response = cityDelivery.addOrder(bizOrder, bizOrderSub); + String response = "{\"success\":true,\"message\":\"\",\"code\":200,\"result\":{\"insuredFee\":0,\"otherFee2\":0,\"orderNo\":\"202502130138279376949\",\"costFee\":0,\"expressNbr\":\"1158127631667\",\"totalFee\":800,\"expectTime\":null,\"tipFee\":0,\"otherFee1\":0,\"postageFee\":800},\"timestamp\":1739419238706}"; JSONObject jsonObject = JSON.parseObject(response); - if (jsonObject.get("code").equals("200")) { + if ((Integer) jsonObject.get("code") == 200) { // 同步更新运单信息 - BizOrderSub orderSub = bizOrderSubMapper.selectBySubOrderSn((String) map1.get("subOrderSn")); + BizOrderSub orderSub = bizOrderSubMapper.selectBySubOrderSn(bizOrderSub.getSubOrderSn()); Map result = (Map) jsonObject.get("result"); + + String orderNo = Helper.NStr(result.get("orderNo")); + String expressNbr = Helper.NStr(result.get("expressNbr")); // 预计送达时间(时间戳) - Long expectTime = (Long) result.get("expectTime"); + Long expectTime = Helper.FLong(result.get("expectTime")); // 配送距离 - Long distance = (Long) result.get("distance"); - String costFee = (String) result.get("costFee"); - String tipFee = (String) result.get("tipFee"); - String insuredFee = (String) result.get("insuredFee"); - String otherFee1 = (String) result.get("otherFee1"); - String otherFee2 = (String) result.get("otherFee2"); - String totalFee = (String) result.get("totalFee"); - String postageFee = (String) result.get("postageFee"); - orderSub.setExpectTime(new Date(expectTime)); + Long distance = Helper.FLong(result.get("distance")); + int costFee = Helper.FInt(result.get("costFee")); + int tipFee = Helper.FInt(result.get("tipFee")); + int insuredFee = Helper.FInt(result.get("insuredFee")); + int otherFee1 = Helper.FInt(result.get("otherFee1")); + int otherFee2 = Helper.FInt(result.get("otherFee2")); + int totalFee = Helper.FInt(result.get("totalFee")); + int postageFee = Helper.FInt(result.get("postageFee")); + if (expectTime != null && expectTime != 0) orderSub.setExpectTime(new Date(expectTime)); + orderSub.setPlatformOrderNo(orderNo); + orderSub.setExpressNbr(expressNbr); orderSub.setDistance(String.valueOf(distance)); - orderSub.setCostFee(costFee); - orderSub.setTipFee(tipFee); - orderSub.setInsuredFee(insuredFee); - orderSub.setOtherFee1(otherFee1); - orderSub.setOtherFee2(otherFee2); - orderSub.setTotalFee(totalFee); - orderSub.setPostageFee(postageFee); + orderSub.setCostFee(Integer.toString(costFee)); + orderSub.setTipFee(String.valueOf(tipFee)); + orderSub.setInsuredFee(String.valueOf(insuredFee)); + orderSub.setOtherFee1(String.valueOf(otherFee1)); + orderSub.setOtherFee2(String.valueOf(otherFee2)); + orderSub.setTotalFee(String.valueOf(totalFee)); + orderSub.setPostageFee(String.valueOf(postageFee)); bizOrderSubMapper.updateById(orderSub); } } diff --git a/cpxt-system/src/main/resources/mapper/BizOrderStatusChangeLogMapper.xml b/cpxt-system/src/main/resources/mapper/BizOrderStatusChangeLogMapper.xml deleted file mode 100644 index 0364bf6..0000000 --- a/cpxt-system/src/main/resources/mapper/BizOrderStatusChangeLogMapper.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - id,channel_order_no,platform_order_no, - order_no,express_nbr,status, - message,email_nbr,deliver_time, - op_time,create_time - -