From 3b8f1579d4a4eced3e5547f619b892fa2b7fa96d Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期四, 19 三月 2026 15:06:55 +0800
Subject: [PATCH] 宜搭获取销售发货明细

---
 src/main/resources/mapper/productionPlan/SalesDeliveryMapper.xml                  |   31 +++
 src/main/java/com/ruoyi/productionPlan/task/SalesDeliveryTask.java                |   23 ++
 doc/宁夏-中盛建材.sql                                                                   |   26 +++
 src/main/java/com/ruoyi/framework/config/AliDingConfig.java                       |    5 
 src/main/java/com/ruoyi/productionPlan/mapper/SalesDeliveryMapper.java            |   18 ++
 src/main/java/com/ruoyi/CodeGenerator.java                                        |    2 
 src/main/java/com/ruoyi/productionPlan/pojo/SalesDelivery.java                    |  105 +++++++++++++
 src/main/java/com/ruoyi/basic/task/CustomerTask.java                              |    2 
 src/main/java/com/ruoyi/productionPlan/controller/SalesDeliveryController.java    |   20 ++
 src/main/java/com/ruoyi/productionPlan/service/SalesDeliveryService.java          |   18 ++
 src/main/java/com/ruoyi/productionPlan/service/impl/SalesDeliveryServiceImpl.java |  176 ++++++++++++++++++++++
 src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java               |   11 -
 12 files changed, 426 insertions(+), 11 deletions(-)

diff --git "a/doc/\345\256\201\345\244\217-\344\270\255\347\233\233\345\273\272\346\235\220.sql" "b/doc/\345\256\201\345\244\217-\344\270\255\347\233\233\345\273\272\346\235\220.sql"
index 098fde4..d91f818 100644
--- "a/doc/\345\256\201\345\244\217-\344\270\255\347\233\233\345\273\272\346\235\220.sql"
+++ "b/doc/\345\256\201\345\244\217-\344\270\255\347\233\233\345\273\272\346\235\220.sql"
@@ -375,3 +375,29 @@
   ROW_FORMAT = Dynamic;
 
 SET FOREIGN_KEY_CHECKS = 1;
+
+CREATE TABLE `product-inventory-management-zsjc`.`sales_delivery`  (
+   `id` int NOT NULL AUTO_INCREMENT,
+   `delivery_date` date NULL COMMENT '渚涜揣鏃ユ湡',
+   `delivery_code` varchar(255) NULL COMMENT '鍙戣揣鍗曠紪鍙�',
+    `project_name` varchar(255) NULL COMMENT '椤圭洰鍚嶇О',
+    `delivery_place` varchar(255) NULL COMMENT '閫佽揣鍦扮偣',
+    `link_man` varchar(255) NULL COMMENT '鑱旂郴浜�',
+    `link_phone` varchar(255) NULL COMMENT '鑱旂郴鐢佃瘽',
+    `delivery_remark` varchar(255) NULL COMMENT '鍙戣揣澶囨敞',
+    `material_code` varchar(255) NULL COMMENT '鐗╂枡浠g爜',
+    `product_name` varchar(255) NULL COMMENT '浜у搧鍚嶇О',
+    `model` varchar(255) NULL COMMENT '浜у搧瑙勬牸',
+    `volume` decimal(10, 4) NULL COMMENT '鏂归噺',
+    `unit_price` decimal(10, 2) NULL COMMENT '鍗曚环',
+    `price` decimal(10, 2) NULL COMMENT '浠锋牸',
+    `product_remark` varchar(255) NULL COMMENT '浜у搧澶囨敞',
+    `customer` varchar(255) NULL COMMENT '瀹㈡埛鍚嶇О',
+    `salesman` varchar(255) NULL COMMENT '涓氬姟鍛�',
+    `delivery_method` varchar(255) NULL COMMENT '鍙戣揣鏂瑰紡',
+    `form_instance_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹滄惌琛ㄥ崟瀹炰緥ID',
+    `form_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '瀹滄惌淇敼鏃堕棿',
+    `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
+    `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
+    PRIMARY KEY (`id`)
+    ) COMMENT = '閿�鍞彂璐ф槑缁�(瀹滄惌)';
diff --git a/src/main/java/com/ruoyi/CodeGenerator.java b/src/main/java/com/ruoyi/CodeGenerator.java
index 7960d87..7dcde81 100644
--- a/src/main/java/com/ruoyi/CodeGenerator.java
+++ b/src/main/java/com/ruoyi/CodeGenerator.java
@@ -23,7 +23,7 @@
     public static String database_username = "root";
     public static String database_password= "xd@123456..";
     public static String author = "鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃";
-    public static String model = "energy"; // 妯″潡
+    public static String model = "productionPlan"; // 妯″潡
     public static String setParent = "com.ruoyi."+ model; // 鍖呰矾寰�
     public static String tablePrefix = ""; // 璁剧疆杩囨护琛ㄥ墠缂�
     public static void main(String[] args) {
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
index 080314c..d30beb3 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -276,7 +276,7 @@
 
     @Override
     public void syncCustomerJob() {
-        syncCustomerData(2);
+        syncCustomerData();
     }
 
     @Override
@@ -322,11 +322,7 @@
      * 鍚屾鏁版嵁
      */
     @Transactional(rollbackFor = Exception.class)
-    public void syncCustomerData(Integer dataSyncType) {
-        if (!syncLock.tryLock()) {
-            log.warn("鍚屾姝e湪杩涜涓紝鏈 {} 鍚屾璇锋眰琚烦杩�", dataSyncType == 1 ? "鎵嬪姩" : "瀹氭椂浠诲姟");
-            return;
-        }
+    public void syncCustomerData() {
         try {
             JSONArray searchConditions = new JSONArray();
             JSONObject statusCondition = new JSONObject();
@@ -368,9 +364,6 @@
 
         } catch (Exception e) {
             log.error("鍚屾瀹㈡埛淇℃伅寮傚父", e);
-        } finally {
-            // 閲婃斁閿�
-            syncLock.unlock();
         }
     }
 
diff --git a/src/main/java/com/ruoyi/basic/task/CustomerTask.java b/src/main/java/com/ruoyi/basic/task/CustomerTask.java
index 53c1976..d26b6be 100644
--- a/src/main/java/com/ruoyi/basic/task/CustomerTask.java
+++ b/src/main/java/com/ruoyi/basic/task/CustomerTask.java
@@ -11,7 +11,7 @@
     @Autowired
     private ICustomerService customerService;
 
-    @Scheduled(cron = "0 0 * * * ?")
+    @Scheduled(cron = "0 0 0 * * ?")
     public void syncCustomerDataJob() {
         customerService.syncCustomerJob();
     }
diff --git a/src/main/java/com/ruoyi/framework/config/AliDingConfig.java b/src/main/java/com/ruoyi/framework/config/AliDingConfig.java
index 8903d90..48c3453 100644
--- a/src/main/java/com/ruoyi/framework/config/AliDingConfig.java
+++ b/src/main/java/com/ruoyi/framework/config/AliDingConfig.java
@@ -58,6 +58,11 @@
     private String customerCodeFormUuid;
 
     /**
+     * 閿�鍞彂璐ф槑缁�-瀹滄惌琛ㄥ崟ID
+     */
+    private String salesDeliveryFormUuid;
+
+    /**
      * 瀹滄惌搴旂敤瀵嗛挜
      * 鐢ㄤ簬璁块棶瀹滄惌琛ㄥ崟 API
      */
diff --git a/src/main/java/com/ruoyi/productionPlan/controller/SalesDeliveryController.java b/src/main/java/com/ruoyi/productionPlan/controller/SalesDeliveryController.java
new file mode 100644
index 0000000..ed76ec3
--- /dev/null
+++ b/src/main/java/com/ruoyi/productionPlan/controller/SalesDeliveryController.java
@@ -0,0 +1,20 @@
+package com.ruoyi.productionPlan.controller;
+
+import io.swagger.annotations.Api;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 閿�鍞彂璐ф槑缁�(瀹滄惌) 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-03-19 11:49:57
+ */
+@RestController
+@RequestMapping("/salesDelivery")
+@Api(tags = "閿�鍞彂璐ф槑缁�")
+public class SalesDeliveryController {
+
+}
diff --git a/src/main/java/com/ruoyi/productionPlan/mapper/SalesDeliveryMapper.java b/src/main/java/com/ruoyi/productionPlan/mapper/SalesDeliveryMapper.java
new file mode 100644
index 0000000..d318ef5
--- /dev/null
+++ b/src/main/java/com/ruoyi/productionPlan/mapper/SalesDeliveryMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.productionPlan.mapper;
+
+import com.ruoyi.productionPlan.pojo.SalesDelivery;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 閿�鍞彂璐ф槑缁�(瀹滄惌) Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-03-19 11:49:57
+ */
+@Mapper
+public interface SalesDeliveryMapper extends BaseMapper<SalesDelivery> {
+
+}
diff --git a/src/main/java/com/ruoyi/productionPlan/pojo/SalesDelivery.java b/src/main/java/com/ruoyi/productionPlan/pojo/SalesDelivery.java
new file mode 100644
index 0000000..4db34ad
--- /dev/null
+++ b/src/main/java/com/ruoyi/productionPlan/pojo/SalesDelivery.java
@@ -0,0 +1,105 @@
+package com.ruoyi.productionPlan.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ * <p>
+ * 閿�鍞彂璐ф槑缁�(瀹滄惌)
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-03-19 11:49:57
+ */
+@Getter
+@Setter
+@TableName("sales_delivery")
+@ApiModel(value = "SalesDelivery瀵硅薄", description = "閿�鍞彂璐ф槑缁�(瀹滄惌)")
+public class SalesDelivery implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty("渚涜揣鏃ユ湡")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private LocalDate deliveryDate;
+
+    @ApiModelProperty("鍙戣揣鍗曠紪鍙�")
+    private String deliveryCode;
+
+    @ApiModelProperty("椤圭洰鍚嶇О")
+    private String projectName;
+
+    @ApiModelProperty("閫佽揣鍦扮偣")
+    private String deliveryPlace;
+
+    @ApiModelProperty("鑱旂郴浜�")
+    private String linkMan;
+
+    @ApiModelProperty("鑱旂郴鐢佃瘽")
+    private String linkPhone;
+
+    @ApiModelProperty("鍙戣揣澶囨敞")
+    private String deliveryRemark;
+
+    @ApiModelProperty("鐗╂枡浠g爜")
+    private String materialCode;
+
+    @ApiModelProperty("浜у搧鍚嶇О")
+    private String productName;
+
+    @ApiModelProperty("浜у搧瑙勬牸")
+    private String model;
+
+    @ApiModelProperty("鏂归噺")
+    private BigDecimal volume;
+
+    @ApiModelProperty("鍗曚环")
+    private BigDecimal unitPrice;
+
+    @ApiModelProperty("浠锋牸")
+    private BigDecimal price;
+
+    @ApiModelProperty("浜у搧澶囨敞")
+    private String productRemark;
+
+    @ApiModelProperty("瀹㈡埛鍚嶇О")
+    private String customer;
+
+    @ApiModelProperty("涓氬姟鍛�")
+    private String salesman;
+
+    @ApiModelProperty("鍙戣揣鏂瑰紡")
+    private String deliveryMethod;
+
+    @ApiModelProperty("瀹滄惌琛ㄥ崟瀹炰緥ID")
+    private String formInstanceId;
+
+    @ApiModelProperty("瀹滄惌淇敼鏃堕棿")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime formModifiedTime;
+
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createTime;
+
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private LocalDateTime updateTime;
+}
diff --git a/src/main/java/com/ruoyi/productionPlan/service/SalesDeliveryService.java b/src/main/java/com/ruoyi/productionPlan/service/SalesDeliveryService.java
new file mode 100644
index 0000000..bbde423
--- /dev/null
+++ b/src/main/java/com/ruoyi/productionPlan/service/SalesDeliveryService.java
@@ -0,0 +1,18 @@
+package com.ruoyi.productionPlan.service;
+
+import com.ruoyi.productionPlan.pojo.SalesDelivery;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 閿�鍞彂璐ф槑缁�(瀹滄惌) 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-03-19 11:49:57
+ */
+public interface SalesDeliveryService extends IService<SalesDelivery> {
+
+    void syncSalesDeliveryJob();
+
+}
diff --git a/src/main/java/com/ruoyi/productionPlan/service/impl/SalesDeliveryServiceImpl.java b/src/main/java/com/ruoyi/productionPlan/service/impl/SalesDeliveryServiceImpl.java
new file mode 100644
index 0000000..084b249
--- /dev/null
+++ b/src/main/java/com/ruoyi/productionPlan/service/impl/SalesDeliveryServiceImpl.java
@@ -0,0 +1,176 @@
+package com.ruoyi.productionPlan.service.impl;
+
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.config.AliDingConfig;
+import com.ruoyi.framework.util.AliDingUtils;
+import com.ruoyi.production.pojo.ProductMaterialSku;
+import com.ruoyi.productionPlan.enums.DataSourceTypeEnum;
+import com.ruoyi.productionPlan.pojo.ProductionPlan;
+import com.ruoyi.productionPlan.pojo.SalesDelivery;
+import com.ruoyi.productionPlan.mapper.SalesDeliveryMapper;
+import com.ruoyi.productionPlan.service.SalesDeliveryService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * 閿�鍞彂璐ф槑缁�(瀹滄惌) 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-03-19 11:49:57
+ */
+@Service
+@Slf4j
+public class SalesDeliveryServiceImpl extends ServiceImpl<SalesDeliveryMapper, SalesDelivery> implements SalesDeliveryService {
+
+    @Autowired
+    private SalesDeliveryMapper salesDeliveryMapper;
+
+    @Autowired
+    private AliDingConfig aliDingConfig;
+
+    @Override
+    public void syncSalesDeliveryJob() {
+        syncSalesDelivery();
+    }
+
+    /**
+     * 鍚屾鏁版嵁
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void syncSalesDelivery() {
+        try {
+            JSONArray searchConditions = new JSONArray();
+            JSONObject condition = new JSONObject();
+            condition.put("key", "processApprovedResult");
+            JSONArray valueArray = new JSONArray();
+            valueArray.add("agree");
+            condition.put("value", valueArray);
+            condition.put("type", "ARRAY");
+            condition.put("operator", "in");
+            condition.put("componentName", "SelectField");
+            searchConditions.add(condition);
+
+            JSONObject statusCondition = new JSONObject();
+            statusCondition.put("key", "processInstanceStatus");
+            JSONArray statusValueArray = new JSONArray();
+            statusValueArray.add("COMPLETED");
+            statusCondition.put("value", statusValueArray);
+            statusCondition.put("type", "ARRAY");
+            statusCondition.put("operator", "in");
+            statusCondition.put("componentName", "SelectField");
+            searchConditions.add(statusCondition);
+
+            String searchFieldJson = searchConditions.toJSONString();
+
+            JSONArray dataArr = AliDingUtils.getFormDataList(aliDingConfig, aliDingConfig.getSalesDeliveryFormUuid(), searchFieldJson, this, SalesDelivery::getFormModifiedTime);
+
+            if (dataArr.isEmpty()) {
+                return;
+            }
+
+            //  瑙f瀽骞朵繚瀛樻暟鎹�
+            List<SalesDelivery> list = parseSalesDeliverys(dataArr);
+            if (!list.isEmpty()) {
+                //  澶勭悊鏇存柊鎴栨柊澧�
+                int affected = processSaveOrUpdate(list);
+                log.info("鏁版嵁鍚屾瀹屾垚锛屽叡鍚屾 {} 鏉℃暟鎹�", affected);
+            }
+
+        } catch (Exception e) {
+            log.error("鍚屾鐢熶骇璁″垝寮傚父", e);
+        }
+    }
+
+    private List<SalesDelivery> parseSalesDeliverys(JSONArray dataArr) {
+        List<SalesDelivery> list = new ArrayList<>();
+        for (int i = 0; i < dataArr.size(); i++) {
+            JSONObject item = dataArr.getJSONObject(i);
+            String formInstanceId = item.getString("formInstanceId");
+            JSONObject formData = item.getJSONObject("formData");
+            JSONArray tableArr = formData.getJSONArray("tableField_kt8b0qse");
+            if (tableArr == null || tableArr.isEmpty()) {
+                continue;
+            }
+            for (int j = 0; j < tableArr.size(); j++) {
+                JSONObject row = tableArr.getJSONObject(j);
+                SalesDelivery salesDelivery = new SalesDelivery();
+                salesDelivery.setFormInstanceId(formInstanceId);
+                Long time = formData.getLong("dateField_kt8b0qsm");
+                LocalDate date = Instant.ofEpochMilli(time).atZone(ZoneId.of("Asia/Shanghai")).toLocalDate();
+                salesDelivery.setDeliveryDate(date);//渚涜揣鏃ユ湡
+                salesDelivery.setDeliveryCode(formData.getString("textField_kt8b0qrp"));//鍙戣揣鍗曠紪鍙�
+                salesDelivery.setProjectName(formData.getString("textField_l92dg1tg"));//椤圭洰鍚嶇О
+                salesDelivery.setDeliveryPlace(formData.getString("textField_kt8b0qsd"));//閫佽揣鍦扮偣
+                salesDelivery.setLinkMan(formData.getString("textField_kt8b0qsb"));//鑱旂郴浜�
+                salesDelivery.setLinkPhone(formData.getString("textField_kt8b0qsc"));//鑱旂郴鐢佃瘽
+                salesDelivery.setDeliveryRemark(formData.getString("textareaField_kt8b0qsl"));//鍙戣揣澶囨敞
+                salesDelivery.setCustomer(formData.getString("textField_la98q3sg"));//瀹㈡埛鍚嶇О
+                salesDelivery.setSalesman(formData.getString("textField_ladnkyu1"));//涓氬姟鍛�
+                salesDelivery.setDeliveryMethod(formData.getString("radioField_ldoc0027"));//鍙戣揣鏂瑰紡
+                String materialCode = row.getString("textField_l92dg1tc");
+                // 鏍规嵁鐗╂枡缂栫爜鏌ヨ鐗╂枡淇℃伅琛紝鍏宠仈鐗╂枡ID
+//                if (StringUtils.isNotEmpty(materialCode)) {
+//                    LambdaQueryWrapper<ProductMaterialSku> skuQueryWrapper = new LambdaQueryWrapper<>();
+//                    skuQueryWrapper.eq(ProductMaterialSku::getMaterialCode, materialCode);
+//                    ProductMaterialSku sku = productMaterialSkuService.getOne(skuQueryWrapper);
+//                    if (sku != null) {
+//                        salesDelivery.setProductMaterialSkuId(sku.getId());
+//                    }
+//                }
+                salesDelivery.setMaterialCode(materialCode);//鐗╂枡缂栫爜
+                salesDelivery.setProductName(row.getString("textField_l96srw8x"));//浜у搧鍚嶇О
+                salesDelivery.setModel(row.getString("textField_l9tljfl8"));//浜у搧瑙勬牸
+                salesDelivery.setVolume(row.getBigDecimal("numberField_kt8b0qsg_value"));//鏂归噺
+                salesDelivery.setUnitPrice(row.getBigDecimal("numberField_la0tb2x9_value"));//鍗曚环
+                salesDelivery.setPrice(row.getBigDecimal("numberField_l9w2piwf"));//浠锋牸
+                salesDelivery.setProductRemark(row.getString("textField_kt8b0qsi"));//浜у搧澶囨敞
+                salesDelivery.setFormModifiedTime(AliDingUtils.parseUtcTime(item.getString("modifiedTimeGMT")));
+                list.add(salesDelivery);
+            }
+        }
+        return list;
+    }
+
+    private int processSaveOrUpdate(List<SalesDelivery> list) {
+        if (list == null || list.isEmpty()) {
+            return 0;
+        }
+        int affected = 0;
+
+        for (SalesDelivery salesDelivery : list) {
+
+            LambdaQueryWrapper<SalesDelivery> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(SalesDelivery::getFormInstanceId, salesDelivery.getFormInstanceId());
+
+            SalesDelivery exist = this.getOne(wrapper);
+            if (exist == null) {
+                this.save(salesDelivery);
+                affected++;
+            } else {
+                if (exist.getFormModifiedTime() == null || !exist.getFormModifiedTime().equals(salesDelivery.getFormModifiedTime())) {
+                    salesDelivery.setId(exist.getId());
+                    this.updateById(salesDelivery);
+                    affected++;
+                }
+            }
+        }
+        return affected;
+    }
+}
diff --git a/src/main/java/com/ruoyi/productionPlan/task/SalesDeliveryTask.java b/src/main/java/com/ruoyi/productionPlan/task/SalesDeliveryTask.java
new file mode 100644
index 0000000..6720e01
--- /dev/null
+++ b/src/main/java/com/ruoyi/productionPlan/task/SalesDeliveryTask.java
@@ -0,0 +1,23 @@
+package com.ruoyi.productionPlan.task;
+
+
+import com.ruoyi.productionPlan.service.ProductionPlanService;
+import com.ruoyi.productionPlan.service.SalesDeliveryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+
+//閿�鍞彂璐ф槑缁嗗鎺ュ疁鎼畾鏃朵换鍔�
+@Component
+public class SalesDeliveryTask {
+
+
+    @Autowired
+    private SalesDeliveryService salesDeliveryService;
+
+    @Scheduled(cron = "0 04 15 * * ?")
+    public void syncSalesDeliveryJob() {
+        salesDeliveryService.syncSalesDeliveryJob();
+    }
+}
diff --git a/src/main/resources/mapper/productionPlan/SalesDeliveryMapper.xml b/src/main/resources/mapper/productionPlan/SalesDeliveryMapper.xml
new file mode 100644
index 0000000..e3f91d1
--- /dev/null
+++ b/src/main/resources/mapper/productionPlan/SalesDeliveryMapper.xml
@@ -0,0 +1,31 @@
+<?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="com.ruoyi.productionPlan.mapper.SalesDeliveryMapper">
+
+    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+    <resultMap id="BaseResultMap" type="com.ruoyi.productionPlan.pojo.SalesDelivery">
+        <id column="id" property="id" />
+        <result column="delivery_date" property="deliveryDate" />
+        <result column="delivery_code" property="deliveryCode" />
+        <result column="project_name" property="projectName" />
+        <result column="delivery_place" property="deliveryPlace" />
+        <result column="link_man" property="linkMan" />
+        <result column="link_phone" property="linkPhone" />
+        <result column="delivery_remark" property="deliveryRemark" />
+        <result column="material_code" property="materialCode" />
+        <result column="product_name" property="productName" />
+        <result column="model" property="model" />
+        <result column="volume" property="volume" />
+        <result column="unit_price" property="unitPrice" />
+        <result column="price" property="price" />
+        <result column="product_remark" property="productRemark" />
+        <result column="customer" property="customer" />
+        <result column="salesman" property="salesman" />
+        <result column="delivery_method" property="deliveryMethod" />
+        <result column="form_instance_id" property="formInstanceId" />
+        <result column="form_modified_time" property="formModifiedTime" />
+        <result column="create_time" property="createTime" />
+        <result column="update_time" property="updateTime" />
+    </resultMap>
+
+</mapper>

--
Gitblit v1.9.3