Przeglądaj źródła

2024年3月15日17:23:41

纪新园 1 rok temu
rodzic
commit
27fc58584a
26 zmienionych plików z 1468 dodań i 0 usunięć
  1. 20 0
      blade-service-api/blade-data-api/pom.xml
  2. 34 0
      blade-service-api/blade-data-api/src/main/java/org/springblade/data/extemalOrder/dto/ExternalOrderDTO.java
  3. 252 0
      blade-service-api/blade-data-api/src/main/java/org/springblade/data/extemalOrder/entity/ExternalOrder.java
  4. 91 0
      blade-service-api/blade-data-api/src/main/java/org/springblade/data/extemalOrder/entity/ExternalOrderItem.java
  5. 36 0
      blade-service-api/blade-data-api/src/main/java/org/springblade/data/extemalOrder/vo/ExternalOrderVO.java
  6. 66 0
      blade-service/blade-data/pom.xml
  7. 15 0
      blade-service/blade-data/src/main/java/org/springblade/data/bladeDataApplication.java
  8. 74 0
      blade-service/blade-data/src/main/java/org/springblade/data/config/XxlJobConfig.java
  9. 126 0
      blade-service/blade-data/src/main/java/org/springblade/data/extemalOrder/controller/ExternalOrderController.java
  10. 43 0
      blade-service/blade-data/src/main/java/org/springblade/data/extemalOrder/mapper/ExternalOrderMapper.java
  11. 47 0
      blade-service/blade-data/src/main/java/org/springblade/data/extemalOrder/mapper/ExternalOrderMapper.xml
  12. 41 0
      blade-service/blade-data/src/main/java/org/springblade/data/extemalOrder/service/IExternalOrderService.java
  13. 41 0
      blade-service/blade-data/src/main/java/org/springblade/data/extemalOrder/service/impl/ExternalOrderServiceImpl.java
  14. 28 0
      blade-service/blade-data/src/main/java/org/springblade/data/handler/SynchronizeDataJobHandler.java
  15. 79 0
      blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/Utils/HttpsUtils.java
  16. 21 0
      blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/Utils/MichelinValues.java
  17. 32 0
      blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/controller/ApiController.java
  18. 33 0
      blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/dto/AckSalesOrderR.java
  19. 53 0
      blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/dto/LinesDto.java
  20. 121 0
      blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/dto/SalesOrderDto.java
  21. 37 0
      blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/dto/SalesOrderR.java
  22. 15 0
      blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/service/IMichelinService.java
  23. 120 0
      blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/service/impl/MichelinServiceImpl.java
  24. 23 0
      blade-service/blade-data/src/main/resources/application-dev.yml
  25. 10 0
      blade-service/blade-data/src/main/resources/application-prod.yml
  26. 10 0
      blade-service/blade-data/src/main/resources/application-test.yml

+ 20 - 0
blade-service-api/blade-data-api/pom.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springblade</groupId>
+        <artifactId>blade-service-api</artifactId>
+        <version>2.8.2.RELEASE</version>
+    </parent>
+
+    <artifactId>blade-data-api</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+</project>

+ 34 - 0
blade-service-api/blade-data-api/src/main/java/org/springblade/data/extemalOrder/dto/ExternalOrderDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.data.extemalOrder.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.data.extemalOrder.entity.ExternalOrder;
+
+/**
+ * 外部订单信息数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2024-03-11
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ExternalOrderDTO extends ExternalOrder {
+	private static final long serialVersionUID = 1L;
+
+}

+ 252 - 0
blade-service-api/blade-data-api/src/main/java/org/springblade/data/extemalOrder/entity/ExternalOrder.java

@@ -0,0 +1,252 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.data.extemalOrder.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springblade.core.secure.utils.AuthUtil;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 外部订单信息实体类
+ *
+ * @author BladeX
+ * @since 2024-03-11
+ */
+@Data
+@TableName("AppOrder")
+public class ExternalOrder implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * AGENT-NLT代理商非长尾模式  	AGENT-LT 代理商长尾模式	TPLUS-NLT 驰加代管模式
+	 */
+	@ApiModelProperty(value = "AGENT-NLT代理商非长尾模式  	AGENT-LT 代理商长尾模式	TPLUS-NLT 驰加代管模式")
+	@TableField(value = "orderMode")
+	private String orderMode;
+	/**
+	 * OCT订单号
+	 */
+	@ApiModelProperty(value = "OCT订单号")
+	@TableField(value = "salesOrderNo")
+	private String salesOrderNo;
+	/**
+	 * 客户代码
+	 */
+	@ApiModelProperty(value = "客户代码")
+	@TableField(value = "dealerNo")
+	private String dealerNo;
+	/**
+	 * 客户组
+	 */
+	@ApiModelProperty(value = "客户组")
+	@TableField(value = "customerGroup")
+	private String customerGroup;
+	/**
+	 * 是否为特批订单(不需要检查信用)
+	 */
+	@ApiModelProperty(value = "是否为特批订单(不需要检查信用)")
+	@TableField(value = "isSpecialApproval")
+	private String isSpecialApproval;
+	/**
+	 * waiting (待确认),confirm (已确认), shipped(已发运), canceled(已取消)
+	 */
+	@ApiModelProperty(value = "waiting (待确认),confirm (已确认), shipped(已发运), canceled(已取消)")
+	@TableField(value = "salesOrderStatus")
+	private String salesOrderStatus;
+	/**
+	 * 0为非紧急,1为紧急
+	 */
+	@ApiModelProperty(value = "0为非紧急,1为紧急")
+	@TableField(value = "isUrgent")
+	private String isUrgent;
+	/**
+	 * 备注
+	 */
+	@ApiModelProperty(value = "备注")
+	@TableField(value = "orderRemark")
+	private String orderRemark;
+	/**
+	 * 创建时间
+	 */
+	@ApiModelProperty(value = "创建时间")
+	@TableField(value = "creationTime")
+	private Date creationTime;
+	/**
+	 * 客户名称
+	 */
+	@ApiModelProperty(value = "客户名称")
+	@TableField(value = "customerName")
+	private String customerName;
+	/**
+	 * 发货仓库
+	 */
+	@ApiModelProperty(value = "发货仓库")
+	@TableField(value = "shipFromWarehouse")
+	private String shipFromWarehouse;
+	/**
+	 * 运输方式:	standard-普通	urgent-加急	selfpick-自提
+	 */
+	@ApiModelProperty(value = "运输方式:	standard-普通	urgent-加急	selfpick-自提")
+	@TableField(value = "shippingMethod")
+	private String shippingMethod;
+	/**
+	 * 客户联系人
+	 */
+	@ApiModelProperty(value = "客户联系人")
+	@TableField(value = "dealerContacts")
+	private String dealerContacts;
+	/**
+	 * 客户联系人电话
+	 */
+	@ApiModelProperty(value = "客户联系人电话")
+	@TableField(value = "dealerMobile")
+	private String dealerMobile;
+	/**
+	 * 省份
+	 */
+	@ApiModelProperty(value = "省份")
+	@TableField(value = "dealerProvince")
+	private String dealerProvince;
+	/**
+	 * 城市
+	 */
+	@ApiModelProperty(value = "城市")
+	@TableField(value = "dealerCity")
+	private String dealerCity;
+	/**
+	 * 区县
+	 */
+	@ApiModelProperty(value = "区县")
+	@TableField(value = "dealerDistrict")
+	private String dealerDistrict;
+	/**
+	 * 地址
+	 */
+	@ApiModelProperty(value = "地址")
+	@TableField(value = "dealerAddress")
+	private String dealerAddress;
+	/**
+	 * 运费
+	 */
+	@ApiModelProperty(value = "运费")
+	@TableField(value = "freight")
+	private String freight;
+	/**
+	 * 折扣金额
+	 */
+	@ApiModelProperty(value = "折扣金额")
+	@TableField(value = "discountAmount")
+	private String discountAmount;
+	/**
+	 * 返利金额
+	 */
+	@ApiModelProperty(value = "返利金额")
+	@TableField(value = "rebateAmount")
+	private String rebateAmount;
+	/**
+	 * 订单金额小计(不含折扣和返利)
+	 */
+	@ApiModelProperty(value = "订单金额小计(不含折扣和返利)")
+	@TableField(value = "orderSubTotal")
+	private String orderSubTotal;
+	/**
+	 * 订单金额总计
+	 */
+	@ApiModelProperty(value = "订单金额总计")
+	@TableField(value = "orderGrandTotal")
+	private String orderGrandTotal;
+	/**
+	 * 发货日期(yyyy/M/d)
+	 */
+	@ApiModelProperty(value = "发货日期(yyyy/M/d)")
+	@TableField(value = "shipDate")
+	private String shipDate;
+	/**
+	 * OCT订单行号
+	 */
+	@ApiModelProperty(value = "OCT订单行号")
+	@TableField(value = "itemLineNo")
+	private String itemLineNo;
+	/**
+	 * 产品编码,米其林CAI
+	 */
+	@ApiModelProperty(value = "产品编码,米其林CAI")
+	@TableField(value = "sku")
+	private String sku;
+	/**
+	 * 品名
+	 */
+	@ApiModelProperty(value = "品名")
+	@TableField(value = "name")
+	private String name;
+	/**
+	 * 中文品牌名
+	 */
+	@ApiModelProperty(value = "中文品牌名")
+	@TableField(value = "brand")
+	private String brand;
+	/**
+	 * 规格
+	 */
+	@ApiModelProperty(value = "规格")
+	@TableField(value = "itemSize")
+	private String itemSize;
+	/**
+	 * 花纹
+	 */
+	@ApiModelProperty(value = "花纹")
+	@TableField(value = "pattern")
+	private String pattern;
+	/**
+	 * 类型(R为子午线,否则为斜交胎)
+	 */
+	@ApiModelProperty(value = "类型(R为子午线,否则为斜交胎)")
+	@TableField(value = "structure")
+	private String structure;
+	/**
+	 * 计量单位
+	 */
+	@ApiModelProperty(value = "计量单位")
+	@TableField(value = "uom")
+	private String uom;
+	/**
+	 * 数量
+	 */
+	@ApiModelProperty(value = "数量")
+	@TableField(value = "quantity")
+	private String quantity;
+	/**
+	 * 单价
+	 */
+	@ApiModelProperty(value = "单价")
+	@TableField(value = "unitPrice")
+	private String unitPrice;
+	@TableField(exist = false)
+	private List<ExternalOrderItem> externalOrderItemList;
+
+
+}

+ 91 - 0
blade-service-api/blade-data-api/src/main/java/org/springblade/data/extemalOrder/entity/ExternalOrderItem.java

@@ -0,0 +1,91 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.data.extemalOrder.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springblade.core.secure.utils.AuthUtil;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 外部订单明细实体类
+ *
+ * @author BladeX
+ * @since 2024-03-11
+ */
+@Data
+public class ExternalOrderItem implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+	/**
+	 * OCT订单行号
+	 */
+	@ApiModelProperty(value = "OCT订单行号")
+	private String lineNo;
+	/**
+	 * 产品编码,米其林CAI
+	 */
+	@ApiModelProperty(value = "产品编码,米其林CAI")
+	private String sku;
+	/**
+	 * 品名
+	 */
+	@ApiModelProperty(value = "品名")
+	private String name;
+	/**
+	 * 中文品牌名
+	 */
+	@ApiModelProperty(value = "中文品牌名")
+	private String brand;
+	/**
+	 * 规格
+	 */
+	@ApiModelProperty(value = "规格")
+	private String size;
+	/**
+	 * 花纹
+	 */
+	@ApiModelProperty(value = "花纹")
+	private String pattern;
+	/**
+	 * 类型(R为子午线,否则为斜交胎)
+	 */
+	@ApiModelProperty(value = "类型(R为子午线,否则为斜交胎)")
+	private String structure;
+	/**
+	 * 计量单位
+	 */
+	@ApiModelProperty(value = "计量单位")
+	private String uom;
+	/**
+	 * 数量
+	 */
+	@ApiModelProperty(value = "数量")
+	private String quantity;
+	/**
+	 * 单价
+	 */
+	@ApiModelProperty(value = "单价")
+	private String unitPrice;
+
+
+}

+ 36 - 0
blade-service-api/blade-data-api/src/main/java/org/springblade/data/extemalOrder/vo/ExternalOrderVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.data.extemalOrder.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.data.extemalOrder.entity.ExternalOrder;
+
+/**
+ * 外部订单信息视图实体类
+ *
+ * @author BladeX
+ * @since 2024-03-11
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "ExternalOrderVO对象", description = "外部订单信息")
+public class ExternalOrderVO extends ExternalOrder {
+	private static final long serialVersionUID = 1L;
+
+}

+ 66 - 0
blade-service/blade-data/pom.xml

@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springblade</groupId>
+        <artifactId>blade-service</artifactId>
+        <version>2.8.2.RELEASE</version>
+    </parent>
+
+    <artifactId>blade-data</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.microsoft</groupId>
+            <artifactId>sqljdbc4</artifactId>
+            <version>3.0</version>
+        </dependency>
+        <!--动态数据源配置-->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
+            <version>3.1.1</version>
+        </dependency>
+        <!--Job-->
+        <dependency>
+            <groupId>com.xuxueli</groupId>
+            <artifactId>xxl-job-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.github.binarywang</groupId>
+            <artifactId>weixin-java-mp</artifactId>
+            <version>2.9.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-core-boot</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-starter-excel</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-starter-swagger</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-starter-transaction</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-data-api</artifactId>
+            <version>2.8.2.RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+</project>

+ 15 - 0
blade-service/blade-data/src/main/java/org/springblade/data/bladeDataApplication.java

@@ -0,0 +1,15 @@
+package org.springblade.data;
+
+import org.springblade.core.cloud.feign.EnableBladeFeign;
+import org.springblade.core.launch.BladeApplication;
+import org.springblade.core.transaction.annotation.SeataCloudApplication;
+import org.springframework.cloud.client.SpringCloudApplication;
+
+@EnableBladeFeign
+@SpringCloudApplication
+@SeataCloudApplication
+public class bladeDataApplication {
+	public static void main(String[] args) {
+		BladeApplication.run("blade-data", bladeDataApplication.class, args);
+	}
+}

+ 74 - 0
blade-service/blade-data/src/main/java/org/springblade/data/config/XxlJobConfig.java

@@ -0,0 +1,74 @@
+package org.springblade.data.config;
+
+import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * xxl-job config
+ *
+ * @author xuxueli 2017-04-28
+ */
+@Configuration
+public class XxlJobConfig {
+	private final Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
+
+	@Value("${xxl.job.admin.addresses}")
+	private String adminAddresses;
+
+	@Value("${xxl.job.executor.appname}")
+	private String appName;
+
+	@Value("${xxl.job.executor.ip}")
+	private String ip;
+
+	@Value("${xxl.job.executor.port}")
+	private int port;
+
+	@Value("${xxl.job.accessToken}")
+	private String accessToken;
+
+	@Value("${xxl.job.executor.logpath}")
+	private String logPath;
+
+	@Value("${xxl.job.executor.logretentiondays}")
+	private int logRetentionDays;
+
+
+	@Bean
+	public XxlJobSpringExecutor xxlJobExecutor() {
+		logger.info(">>>>>>>>>>> xxl-job config init.");
+		XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
+		xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
+		xxlJobSpringExecutor.setAppName(appName);
+		xxlJobSpringExecutor.setIp(ip);
+		xxlJobSpringExecutor.setPort(port);
+		xxlJobSpringExecutor.setAccessToken(accessToken);
+		xxlJobSpringExecutor.setLogPath(logPath);
+		xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
+
+		return xxlJobSpringExecutor;
+	}
+
+	/**
+	 * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
+	 *
+	 *      1、引入依赖:
+	 *          <dependency>
+	 *             <groupId>org.springframework.cloud</groupId>
+	 *             <artifactId>spring-cloud-commons</artifactId>
+	 *             <version>${version}</version>
+	 *         </dependency>
+	 *
+	 *      2、配置文件,或者容器启动变量
+	 *          spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
+	 *
+	 *      3、获取IP
+	 *          String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
+	 */
+
+
+}

+ 126 - 0
blade-service/blade-data/src/main/java/org/springblade/data/extemalOrder/controller/ExternalOrderController.java

@@ -0,0 +1,126 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.data.extemalOrder.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.data.extemalOrder.entity.ExternalOrder;
+import org.springblade.data.extemalOrder.service.IExternalOrderService;
+import org.springblade.data.extemalOrder.vo.ExternalOrderVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * 外部订单信息 控制器
+ *
+ * @author BladeX
+ * @since 2024-03-11
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/externalorder")
+@Api(value = "外部订单信息", tags = "外部订单信息接口")
+public class ExternalOrderController extends BladeController {
+
+	private final IExternalOrderService externalOrderService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入externalOrder")
+	public R<ExternalOrder> detail(ExternalOrder externalOrder) {
+		ExternalOrder detail = externalOrderService.getOne(Condition.getQueryWrapper(externalOrder));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 外部订单信息
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入externalOrder")
+	public R<IPage<ExternalOrder>> list(ExternalOrder externalOrder, Query query) {
+		IPage<ExternalOrder> pages = externalOrderService.page(Condition.getPage(query), Condition.getQueryWrapper(externalOrder));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 外部订单信息
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入externalOrder")
+	public R<IPage<ExternalOrderVO>> page(ExternalOrderVO externalOrder, Query query) {
+		IPage<ExternalOrderVO> pages = externalOrderService.selectExternalOrderPage(Condition.getPage(query), externalOrder);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 外部订单信息
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入externalOrder")
+	public R save(@Valid @RequestBody ExternalOrder externalOrder) {
+		return R.status(externalOrderService.save(externalOrder));
+	}
+
+	/**
+	 * 修改 外部订单信息
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入externalOrder")
+	public R update(@Valid @RequestBody ExternalOrder externalOrder) {
+		return R.status(externalOrderService.updateById(externalOrder));
+	}
+
+	/**
+	 * 新增或修改 外部订单信息
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入externalOrder")
+	public R submit(@Valid @RequestBody ExternalOrder externalOrder) {
+		return R.status(externalOrderService.saveOrUpdate(externalOrder));
+	}
+
+
+	/**
+	 * 删除 外部订单信息
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(externalOrderService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}

+ 43 - 0
blade-service/blade-data/src/main/java/org/springblade/data/extemalOrder/mapper/ExternalOrderMapper.java

@@ -0,0 +1,43 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.data.extemalOrder.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.data.extemalOrder.entity.ExternalOrder;
+import org.springblade.data.extemalOrder.vo.ExternalOrderVO;
+
+import java.util.List;
+
+/**
+ * 外部订单信息 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2024-03-11
+ */
+public interface ExternalOrderMapper extends BaseMapper<ExternalOrder> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param externalOrder
+	 * @return
+	 */
+	List<ExternalOrderVO> selectExternalOrderPage(IPage page, ExternalOrderVO externalOrder);
+
+}

+ 47 - 0
blade-service/blade-data/src/main/java/org/springblade/data/extemalOrder/mapper/ExternalOrderMapper.xml

@@ -0,0 +1,47 @@
+<?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="org.springblade.data.extemalOrder.mapper.ExternalOrderMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="externalOrderResultMap" type="org.springblade.data.extemalOrder.entity.ExternalOrder">
+        <result column="orderMode" property="orderMode"/>
+        <result column="salesOrderNo" property="salesOrderNo"/>
+        <result column="dealerNo" property="dealerNo"/>
+        <result column="customerGroup" property="customerGroup"/>
+        <result column="isSpecialApproval" property="isSpecialApproval"/>
+        <result column="salesOrderStatus" property="salesOrderStatus"/>
+        <result column="isUrgent" property="isUrgent"/>
+        <result column="orderRemark" property="orderRemark"/>
+        <result column="creationTime" property="creationTime"/>
+        <result column="customerName" property="customerName"/>
+        <result column="shipFromWarehouse" property="shipFromWarehouse"/>
+        <result column="shippingMethod" property="shippingMethod"/>
+        <result column="dealerContacts" property="dealerContacts"/>
+        <result column="dealerMobile" property="dealerMobile"/>
+        <result column="dealerProvince" property="dealerProvince"/>
+        <result column="dealerCity" property="dealerCity"/>
+        <result column="dealerDistrict" property="dealerDistrict"/>
+        <result column="dealerAddress" property="dealerAddress"/>
+        <result column="freight" property="freight"/>
+        <result column="discountAmount" property="discountAmount"/>
+        <result column="rebateAmount" property="rebateAmount"/>
+        <result column="orderSubTotal" property="orderSubTotal"/>
+        <result column="orderGrandTotal" property="orderGrandTotal"/>
+        <result column="shipDate" property="shipDate"/>
+        <result column="itemLineNo" property="itemLineNo"/>
+        <result column="sku" property="sku"/>
+        <result column="name" property="name"/>
+        <result column="brand" property="brand"/>
+        <result column="itemSize" property="itemSize"/>
+        <result column="pattern" property="pattern"/>
+        <result column="structure" property="structure"/>
+        <result column="uom" property="uom"/>
+        <result column="quantity" property="quantity"/>
+        <result column="unitPrice" property="unitPrice"/>
+    </resultMap>
+
+    <select id="selectExternalOrderPage" resultMap="externalOrderResultMap">
+        select * from pjpf_external_order where is_deleted = 0
+    </select>
+
+</mapper>

+ 41 - 0
blade-service/blade-data/src/main/java/org/springblade/data/extemalOrder/service/IExternalOrderService.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.data.extemalOrder.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.data.extemalOrder.entity.ExternalOrder;
+import org.springblade.data.extemalOrder.vo.ExternalOrderVO;
+
+/**
+ * 外部订单信息 服务类
+ *
+ * @author BladeX
+ * @since 2024-03-11
+ */
+public interface IExternalOrderService extends IService<ExternalOrder> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param externalOrder
+	 * @return
+	 */
+	IPage<ExternalOrderVO> selectExternalOrderPage(IPage<ExternalOrderVO> page, ExternalOrderVO externalOrder);
+
+}

+ 41 - 0
blade-service/blade-data/src/main/java/org/springblade/data/extemalOrder/service/impl/ExternalOrderServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.data.extemalOrder.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.data.extemalOrder.entity.ExternalOrder;
+import org.springblade.data.extemalOrder.mapper.ExternalOrderMapper;
+import org.springblade.data.extemalOrder.service.IExternalOrderService;
+import org.springblade.data.extemalOrder.vo.ExternalOrderVO;
+import org.springframework.stereotype.Service;
+
+/**
+ * 外部订单信息 服务实现类
+ *
+ * @author BladeX
+ * @since 2024-03-11
+ */
+@Service
+public class ExternalOrderServiceImpl extends ServiceImpl<ExternalOrderMapper, ExternalOrder> implements IExternalOrderService {
+
+	@Override
+	public IPage<ExternalOrderVO> selectExternalOrderPage(IPage<ExternalOrderVO> page, ExternalOrderVO externalOrder) {
+		return page.setRecords(baseMapper.selectExternalOrderPage(page, externalOrder));
+	}
+
+}

+ 28 - 0
blade-service/blade-data/src/main/java/org/springblade/data/handler/SynchronizeDataJobHandler.java

@@ -0,0 +1,28 @@
+package org.springblade.data.handler;
+
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.AllArgsConstructor;
+import org.springblade.core.tool.api.R;
+import org.springblade.data.michelinApi.service.IMichelinService;
+import org.springframework.stereotype.Component;
+
+@Component
+@AllArgsConstructor
+public class SynchronizeDataJobHandler {
+
+	private final IMichelinService michelinService;
+
+	/**
+	 * @throws Exception
+	 */
+	@XxlJob("synchronizeDataJobHandler")
+	public ReturnT<String> synchronizeDataJobHandler(String param) throws Exception {
+		System.out.println("==========================请求成功================================");
+		R<String> res = michelinService.getSalesOrder(param);
+		ReturnT<String> returnT = new ReturnT<>();
+		returnT.setMsg(res.getData());
+		return returnT;
+	}
+
+}

+ 79 - 0
blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/Utils/HttpsUtils.java

@@ -0,0 +1,79 @@
+package org.springblade.data.michelinApi.Utils;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Map;
+
+/**
+ * @author :jixinyuan
+ * @date : 2024/3/11
+ */
+@Slf4j
+public class HttpsUtils {
+
+	/*请求url获取返回的内容*/
+	public static String getReturn(HttpURLConnection connection) throws IOException {
+		StringBuffer buffer = new StringBuffer();
+		//将返回的输入流转换成字符串
+		try(InputStream inputStream = connection.getInputStream();
+			InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
+			BufferedReader bufferedReader = new BufferedReader(inputStreamReader);){
+			String str = null;
+			while ((str = bufferedReader.readLine()) != null) {
+				buffer.append(str);
+			}
+			String result = buffer.toString();
+			return result;
+		}
+	}
+
+	//post请求的方法重载
+	public static String getReturn(HttpURLConnection connection,String jsr) {
+		try {
+			StringBuffer buffer = new StringBuffer();
+			byte[] bytes = jsr.getBytes();
+			OutputStream outputStream = connection.getOutputStream();
+			outputStream.write(bytes);
+			outputStream.flush();
+			outputStream.close();
+
+			//将返回的输入流转换成字符串
+			InputStream inputStream = connection.getInputStream();
+			InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
+			BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
+			String str = null;
+			while ((str = bufferedReader.readLine()) != null) {
+				buffer.append(str);
+			}
+			String result = buffer.toString();
+			return result;
+		} catch (Exception e) {
+			log.error("postUrlConnection出错", e);
+		}
+		return null;
+	}
+	public static String sending(String url , Map<String,String> map) throws Exception{
+		URL url1 = new URL(url);    // 把字符串转换为URL请求地址
+		HttpURLConnection connection = (HttpURLConnection) url1.openConnection();// 打开连接
+		// 设置是否向connection输出,因为这个是post请求,参数要放在
+		// http正文内,因此需要设为true
+		connection.setDoOutput(Boolean.TRUE);
+		connection.setDoInput(Boolean.TRUE);
+		connection.setRequestMethod("POST");
+		// Post 请求不能使用缓存
+		connection.setUseCaches(false);
+		// 添加自定义的Header信息
+		connection.addRequestProperty("Content-type", MichelinValues.CONTENT_TYPE);
+		connection.addRequestProperty("Ocp-Apim-Subscription-Key", "03732707a76b48168e628e2abdb5529e");
+		//必须设置false,否则会自动redirect到重定向后的地址
+		connection.setInstanceFollowRedirects(false);
+		connection.connect();// 连接会话
+		String s = JSONObject.toJSONString(map);
+		//获取了返回值
+		return HttpsUtils.getReturn(connection, s);
+	}
+}

+ 21 - 0
blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/Utils/MichelinValues.java

@@ -0,0 +1,21 @@
+package org.springblade.data.michelinApi.Utils;
+
+/**
+ * @author :jixinyuan
+ * @date : 2024/1/18
+ */
+public class MichelinValues {
+
+	public static final String BASE_URL = "https://host:port/AgentAPIs";
+	public static final String BASE_URL_TEXT = "https://apimint-uat.michelin.com.cn/AgentAPIs";
+	public static final String CONTENT_TYPE = "application/json";
+	public static final String OK = "200";
+	public static final String BAD_REQUEST = "400";
+	public static final String INVALID_CREDENTIALS = "401";
+	public static final String UNKNOWN_SERVICE = "404";
+	public static final String INTERNAL_SERVER_ERROR = "500";
+
+	private MichelinValues() {
+	} // 防止外部实例化该类
+
+}

+ 32 - 0
blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/controller/ApiController.java

@@ -0,0 +1,32 @@
+package org.springblade.data.michelinApi.controller;
+
+import io.swagger.annotations.Api;
+import lombok.AllArgsConstructor;
+import org.springblade.core.tool.api.R;
+import org.springblade.data.michelinApi.service.IMichelinService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author :jixinyuan
+ * @date : 2024/3/11
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/api/michelin")
+@Api(value = "米其林相关接口", tags = "米其林相关接口")
+public class ApiController {
+
+	private final IMichelinService michelinService;
+
+
+	/**
+	 * 订单读取接口
+	 */
+	@GetMapping("/getSalesOrder")
+	public R getSalesOrder(String agentId) throws Exception{
+		return michelinService.getSalesOrder(agentId);
+	}
+
+}

+ 33 - 0
blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/dto/AckSalesOrderR.java

@@ -0,0 +1,33 @@
+package org.springblade.data.michelinApi.dto;
+
+import lombok.Data;
+
+/**
+ * @author :jixinyuan
+ * @date : 2024/3/11
+ */
+@Data
+public class AckSalesOrderR {
+
+	/**
+	 * 001为成功,其它值为出错
+	 */
+	private String code;
+
+	/**
+	 * 返回结果,出错为error
+	 */
+	private String result;
+
+	/**
+	 * 出错提示消息
+	 */
+	private String errMsg;
+
+	/**
+	 * 是否有下一个订单待读取
+	 */
+	private String hasNext;
+
+
+}

+ 53 - 0
blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/dto/LinesDto.java

@@ -0,0 +1,53 @@
+package org.springblade.data.michelinApi.dto;
+
+import lombok.Data;
+
+/**
+ * @author :jixinyuan
+ * @date : 2024/3/11
+ */
+@Data
+public class LinesDto {
+
+	/**
+	 * OCT订单行号
+	 */
+	private String lineNo;
+	/**
+	 * 产品编码,米其林CAI
+	 */
+	private String sku;
+	/**
+	 * 品名
+	 */
+	private String name;
+	/**
+	 * 中文品牌名
+	 */
+	private String brand;
+	/**
+	 * 规格
+	 */
+	private String size;
+	/**
+	 * 花纹
+	 */
+	private String pattern;
+	/**
+	 * 类型(R为子午线,否则为斜交胎)
+	 */
+	private String structure;
+	/**
+	 * 计量单位
+	 */
+	private String uom;
+	/**
+	 * 数量
+	 */
+	private String quantity;
+	/**
+	 * 单价
+	 */
+	private String unitPrice;
+
+}

+ 121 - 0
blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/dto/SalesOrderDto.java

@@ -0,0 +1,121 @@
+package org.springblade.data.michelinApi.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author :jixinyuan
+ * @date : 2024/3/11
+ */
+@Data
+public class SalesOrderDto {
+
+	/**
+	 *AGENT-NLT代理商非长尾模式
+	 * AGENT-LT 代理商长尾模式
+	 * TPLUS-NLT 驰加代管模式
+	 */
+	private String orderMode;
+	/**
+	 *OCT订单号
+	 */
+	private String salesOrderNo;
+	/**
+	 *客户代码,等同于dealerId
+	 */
+	private String dealerNo;
+	/**
+	 *客户组
+	 */
+	private String customerGroup;
+	/**
+	 *是否为特批订单(不需要检查信用)
+	 */
+	private String isSpecialApproval;
+	/**
+	 *可以为waiting (待确认),confirm (已确认), shipped(已发运), canceled(已取消)
+	 */
+	private String salesOrderStatus;
+	/**
+	 *0为非紧急,1为紧急
+	 */
+	private String isUrgent;
+	/**
+	 *备注
+	 */
+	private String orderRemark;
+	/**
+	 *创建时间
+	 */
+	private String creationTime;
+	/**
+	 *客户名称
+	 */
+	private String customerName;
+	/**
+	 *发货仓库
+	 */
+	private String shipFromWarehouse;
+	/**
+	 *运输方式:
+	 * standard-普通
+	 * urgent-加急
+	 * selfpick-自提
+	 */
+	private String shippingMethod;
+	/**
+	 *客户联系人
+	 */
+	private String dealerContacts;
+	/**
+	 *客户联系人电话
+	 */
+	private String dealerMobile;
+	/**
+	 *省份
+	 */
+	private String dealerProvince;
+	/**
+	 *城市
+	 */
+	private String dealerCity;
+	/**
+	 *区县
+	 */
+	private String dealerDistrict;
+	/**
+	 *地址
+	 */
+	private String dealerAddress;
+	/**
+	 *运费
+	 */
+	private String freight;
+	/**
+	 *折扣金额
+	 */
+	private String discountAmount;
+	/**
+	 *返利金额
+	 */
+	private String rebateAmount;
+	/**
+	 *订单金额小计(不含折扣和返利)
+	 */
+	private String orderSubTotal;
+	/**
+	 *订单金额总计
+	 */
+	private String orderGrandTotal;
+	/**
+	 *发货日期(yyyy/M/d)
+	 */
+	private String shipDate;
+	/**
+	 * 明细
+	 */
+	private List<LinesDto> lines;
+
+
+}

+ 37 - 0
blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/dto/SalesOrderR.java

@@ -0,0 +1,37 @@
+package org.springblade.data.michelinApi.dto;
+
+import lombok.Data;
+
+/**
+ * @author :jixinyuan
+ * @date : 2024/3/11
+ */
+@Data
+public class SalesOrderR {
+
+	/**
+	 * 001为成功,其它值为出错
+	 */
+	private String code;
+
+	/**
+	 * 返回结果,出错为error
+	 */
+	private String result;
+
+	/**
+	 * 出错提示消息
+	 */
+	private String errMsg;
+
+	/**
+	 * 消息代码,提交回执时需要发回此代码
+	 */
+	private String msgId;
+
+	/**
+	 * 返回结果,出错为error
+	 */
+	private SalesOrderDto salesOrder;
+
+}

+ 15 - 0
blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/service/IMichelinService.java

@@ -0,0 +1,15 @@
+package org.springblade.data.michelinApi.service;
+
+import org.springblade.core.tool.api.R;
+
+/**
+ * @author :jixinyuan
+ * @date : 2024/3/11
+ */
+public interface IMichelinService {
+	/**
+	 * 订单读取接口
+	 * @param agentId  Agent代码
+	 */
+	R<String> getSalesOrder(String agentId)throws Exception;
+}

+ 120 - 0
blade-service/blade-data/src/main/java/org/springblade/data/michelinApi/service/impl/MichelinServiceImpl.java

@@ -0,0 +1,120 @@
+package org.springblade.data.michelinApi.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import io.seata.spring.annotation.GlobalTransactional;
+import lombok.AllArgsConstructor;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.data.extemalOrder.entity.ExternalOrder;
+import org.springblade.data.extemalOrder.service.IExternalOrderService;
+import org.springblade.data.michelinApi.Utils.HttpsUtils;
+import org.springblade.data.michelinApi.Utils.MichelinValues;
+import org.springblade.data.michelinApi.dto.AckSalesOrderR;
+import org.springblade.data.michelinApi.dto.LinesDto;
+import org.springblade.data.michelinApi.dto.SalesOrderDto;
+import org.springblade.data.michelinApi.dto.SalesOrderR;
+import org.springblade.data.michelinApi.service.IMichelinService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author :jixinyuan
+ * @date : 2024/3/11
+ */
+@Service
+@AllArgsConstructor
+public class MichelinServiceImpl implements IMichelinService {
+
+	private final IExternalOrderService externalOrderService;
+
+
+	public static int count = 1;
+
+	@Override
+	public R<String> getSalesOrder(String agentId) throws Exception {
+		System.out.println("==========================请求成功==============第" + count + "次");
+		String geturl = MichelinValues.BASE_URL_TEXT + "/GetSalesOrder";
+		//设置请求体
+		Map<String, String> map = new HashMap<>();
+		//key-value的形式设置请求参数
+		map.put("agentId", agentId);
+		String result = HttpsUtils.sending(geturl, map);
+		System.out.println("==============result===============" + result);
+		//如果返回值是标准的JSON字符串进行转换
+		JSONObject jsonObject = JSONObject.parseObject(result);
+		SalesOrderR salesOrderR = JSONObject.parseObject(jsonObject.get("response").toString(), SalesOrderR.class);
+		if (salesOrderR != null) {
+			if ("001".equals(salesOrderR.getCode())) {
+				SalesOrderDto salesOrderDto = salesOrderR.getSalesOrder();
+				List<ExternalOrder> externalOrderList = new ArrayList<>();
+				if (salesOrderDto != null) {
+					ExternalOrder order = new ExternalOrder();
+					BeanUtil.copyProperties(salesOrderDto, order);
+					boolean res = true;
+					if (!salesOrderDto.getLines().isEmpty()) {
+						for (LinesDto item : salesOrderDto.getLines()) {
+							order.setItemLineNo(item.getLineNo());
+							order.setSku(item.getSku());
+							order.setName(item.getName());
+							order.setBrand(item.getBrand());
+							order.setItemSize(item.getSize());
+							order.setPattern(item.getPattern());
+							order.setStructure(item.getStructure());
+							order.setUom(item.getUom());
+							order.setQuantity(item.getQuantity());
+							order.setUnitPrice(item.getUnitPrice());
+							externalOrderList.add(order);
+						}
+						res = externalOrderService.saveBatch(externalOrderList);
+					}
+					//设置请求体
+					Map<String, String> map1 = new HashMap<>();
+					//key-value的形式设置请求参数
+					map1.put("agentId", agentId);
+					map1.put("msgId", salesOrderR.getMsgId());
+					String geturl1 = MichelinValues.BASE_URL_TEXT + "/AckSalesOrder";
+					if (res) {
+						map1.put("code", "001");
+						map1.put("result", "success");
+						map1.put("errMsg", "");
+					} else {
+						map1.put("code", "002");
+						map1.put("result", "error");
+						map1.put("errMsg", "数据处理失败");
+					}
+					//获取了返回值
+					String result1 = HttpsUtils.sending(geturl1, map1);
+					System.out.println("==============result1===============" + result1);
+					//如果返回值是标准的JSON字符串进行转换
+					JSONObject jsonObject1 = JSONObject.parseObject(result);
+					AckSalesOrderR ackSalesOrderR = JSONObject.parseObject(jsonObject1.get("response").toString(), AckSalesOrderR.class);
+					if (ackSalesOrderR != null) {
+						if ("001".equals(ackSalesOrderR.getCode())) {
+							if ("true".equals(ackSalesOrderR.getHasNext())) {
+								count = count + 1;
+								this.getSalesOrder(agentId);
+							}
+							count = 1;
+							return R.success("同步成功");
+						} else {
+							return R.fail(ackSalesOrderR.getErrMsg());
+						}
+					} else {
+						return R.fail("订单回执接口错误");
+					}
+				} else {
+					return R.fail("单据信息为空");
+				}
+			} else {
+				return R.fail("获取数据错误");
+			}
+		} else {
+			return R.fail("获取数据错误");
+		}
+	}
+}

+ 23 - 0
blade-service/blade-data/src/main/resources/application-dev.yml

@@ -0,0 +1,23 @@
+#服务器端口
+server:
+  port: 8999
+#数据源配置
+spring:
+  datasource:
+        url: jdbc:sqlserver://27.223.90.210:1402;DatabaseName=MichelinRTM2023
+        # 数据库用户名
+        username: sa
+        # 数据库密码
+        password: yn@123
+        driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
+xxl:
+  job:
+    accessToken: ''
+    admin:
+      addresses: http://127.0.0.1:10031/xxl-job-admin
+    executor:
+      appname: blade-data
+      ip: 127.0.0.1
+      logpath: applogs/xxl-job/jobhandler
+      logretentiondays: -1
+      port: 10034

+ 10 - 0
blade-service/blade-data/src/main/resources/application-prod.yml

@@ -0,0 +1,10 @@
+#服务器端口
+server:
+  port: 9010
+
+#数据源配置
+spring:
+  datasource:
+    url: ${blade.datasource.prod.url}
+    username: ${blade.datasource.prod.username}
+    password: ${blade.datasource.prod.password}

+ 10 - 0
blade-service/blade-data/src/main/resources/application-test.yml

@@ -0,0 +1,10 @@
+#服务器端口
+server:
+  port: 9010
+
+#数据源配置
+spring:
+  datasource:
+    url: ${blade.datasource.test.url}
+    username: ${blade.datasource.test.username}
+    password: ${blade.datasource.test.password}