luojian 2025-02-13 14:10:47 +08:00
parent f8bcb36269
commit 37a91ca445
2 changed files with 33 additions and 50 deletions

View File

@ -28,6 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.cpxt.biz.service.IBizOrderService; import com.cpxt.biz.service.IBizOrderService;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Validator; import javax.validation.Validator;
@ -38,6 +40,7 @@ import javax.validation.Validator;
* @date 2024-12-16 * @date 2024-12-16
*/ */
@Service @Service
@RestController
public class BizOrderServiceImpl implements IBizOrderService { public class BizOrderServiceImpl implements IBizOrderService {
private static final Logger log = LoggerFactory.getLogger(BizOrderServiceImpl.class); private static final Logger log = LoggerFactory.getLogger(BizOrderServiceImpl.class);
@ -397,7 +400,7 @@ public class BizOrderServiceImpl implements IBizOrderService {
bizOrderSubMapper.insert(bizOrderSub); bizOrderSubMapper.insert(bizOrderSub);
// 同步调用同城急送平台入口 // 同步调用同城急送平台入口
callThirdPartyInterface(bizOrder, subList.get(0), bizOrderSub); callThirdPartyInterface(bizOrder, bizOrderSub);
} }
} }
}else { }else {
@ -420,39 +423,46 @@ public class BizOrderServiceImpl implements IBizOrderService {
bizOrderSubMapper.insert(bizOrderSub); bizOrderSubMapper.insert(bizOrderSub);
// 同步调用同城急送平台入口 // 同步调用同城急送平台入口
callThirdPartyInterface(bizOrder, map1, bizOrderSub); callThirdPartyInterface(bizOrder,bizOrderSub);
} }
} }
} }
} }
private void callThirdPartyInterface(BizOrder bizOrder, Map map1, BizOrderSub bizOrderSub) { @GetMapping("/test9")
String response = cityDelivery.addOrder(bizOrder, bizOrderSub); 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); 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<String, Object> result = (Map<String, Object>) jsonObject.get("result"); Map<String, Object> result = (Map<String, Object>) 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"); Long distance = Helper.FLong(result.get("distance"));
String costFee = (String) result.get("costFee"); int costFee = Helper.FInt(result.get("costFee"));
String tipFee = (String) result.get("tipFee"); int tipFee = Helper.FInt(result.get("tipFee"));
String insuredFee = (String) result.get("insuredFee"); int insuredFee = Helper.FInt(result.get("insuredFee"));
String otherFee1 = (String) result.get("otherFee1"); int otherFee1 = Helper.FInt(result.get("otherFee1"));
String otherFee2 = (String) result.get("otherFee2"); int otherFee2 = Helper.FInt(result.get("otherFee2"));
String totalFee = (String) result.get("totalFee"); int totalFee = Helper.FInt(result.get("totalFee"));
String postageFee = (String) result.get("postageFee"); int postageFee = Helper.FInt(result.get("postageFee"));
orderSub.setExpectTime(new Date(expectTime)); if (expectTime != null && expectTime != 0) orderSub.setExpectTime(new Date(expectTime));
orderSub.setPlatformOrderNo(orderNo);
orderSub.setExpressNbr(expressNbr);
orderSub.setDistance(String.valueOf(distance)); orderSub.setDistance(String.valueOf(distance));
orderSub.setCostFee(costFee); orderSub.setCostFee(Integer.toString(costFee));
orderSub.setTipFee(tipFee); orderSub.setTipFee(String.valueOf(tipFee));
orderSub.setInsuredFee(insuredFee); orderSub.setInsuredFee(String.valueOf(insuredFee));
orderSub.setOtherFee1(otherFee1); orderSub.setOtherFee1(String.valueOf(otherFee1));
orderSub.setOtherFee2(otherFee2); orderSub.setOtherFee2(String.valueOf(otherFee2));
orderSub.setTotalFee(totalFee); orderSub.setTotalFee(String.valueOf(totalFee));
orderSub.setPostageFee(postageFee); orderSub.setPostageFee(String.valueOf(postageFee));
bizOrderSubMapper.updateById(orderSub); bizOrderSubMapper.updateById(orderSub);
} }
} }

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="BizOrderSubStatusChangeLogMapper">
<resultMap id="BaseResultMap" type="com.cpxt.biz.domain.BizOrderSubStatusChangeLog">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="channelOrderNo" column="channel_order_no" jdbcType="VARCHAR"/>
<result property="platformOrderNo" column="platform_order_no" jdbcType="VARCHAR"/>
<result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
<result property="expressNbr" column="express_nbr" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="message" column="message" jdbcType="VARCHAR"/>
<result property="emailNbr" column="email_nbr" jdbcType="VARCHAR"/>
<result property="deliverTime" column="deliver_time" jdbcType="TIMESTAMP"/>
<result property="opTime" column="op_time" jdbcType="TIMESTAMP"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,channel_order_no,platform_order_no,
order_no,express_nbr,status,
message,email_nbr,deliver_time,
op_time,create_time
</sql>
</mapper>