From 0b8e5e2ee3c47e385816165826754d5cbb86faad Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期五, 05 九月 2025 21:50:07 +0800
Subject: [PATCH] art: 2#装配线设备状态采集模板

---
 src/main/java/com/lxzn/LxznSystemCollectApplication.java                                 |    2 
 src/main/java/com/lxzn/modules/master/service/IAssembly2TcOpstateService.java            |   23 +++
 src/main/java/com/lxzn/modules/master/entity/EquipmentLog.java                           |   38 +++++
 src/main/java/com/lxzn/modules/master/enums/EquipmentStatusEnum.java                     |   20 ++
 src/main/java/com/lxzn/modules/assembly2/controller/AssemblyCollectionJobController.java |    2 
 src/main/java/com/lxzn/modules/master/entity/Assembly2TcOpstate.java                     |   40 +++++
 src/main/java/com/lxzn/modules/master/mapper/EquipmentLogMapper.java                     |   21 +++
 pom.xml                                                                                  |    2 
 src/main/java/com/lxzn/modules/master/service/impl/Assembly2TcOpstateServiceImpl.java    |   40 +++++
 src/main/java/com/lxzn/modules/master/service/IEquipmentLogService.java                  |   22 +++
 src/main/java/com/lxzn/modules/assembly2/entity/T020Boltcheck.java                       |   28 ++-
 src/main/java/com/lxzn/modules/master/job/EquipmentLogCollectJob.java                    |   47 ++++++
 src/main/java/com/lxzn/modules/master/mapper/Assembly2TcOpstateMapper.java               |   16 ++
 src/main/java/com/lxzn/modules/assembly2/entity/TcOpstate.java                           |   16 +
 src/main/java/com/lxzn/modules/master/mapper/xml/Assembly2TcOpstateMapper.xml            |    5 
 src/main/java/com/lxzn/modules/master/enums/Assembly2EquipmentMappingEnum.java           |   29 ++++
 src/main/java/com/lxzn/modules/master/service/impl/EquipmentLogServiceImpl.java          |   35 +++++
 src/main/java/com/lxzn/modules/master/mapper/xml/EquipmentLogMapper.xml                  |   18 ++
 18 files changed, 388 insertions(+), 16 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5d0c957..5004b94 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
     <artifactId>lxzn-system-collect</artifactId>
     <version>1.0.0</version>
     <url>http://maven.apache.org</url>
-    <name>LXZN-SYSTEM-COLLECT  ${project.version}</name>
+    <name>LXZN-SYSTEM-COLLECT ${project.version}</name>
 
     <parent>
         <groupId>org.springframework.boot</groupId>
diff --git a/src/main/java/com/lxzn/LxznSystemCollectApplication.java b/src/main/java/com/lxzn/LxznSystemCollectApplication.java
index 3d65565..6f84a13 100644
--- a/src/main/java/com/lxzn/LxznSystemCollectApplication.java
+++ b/src/main/java/com/lxzn/LxznSystemCollectApplication.java
@@ -9,6 +9,7 @@
 import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.core.env.Environment;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -17,6 +18,7 @@
 * 鍗曚綋鍚姩绫�
 * 鎶ラ敊鎻愰啋: 鏈泦鎴恗ongo鎶ラ敊锛屽彲浠ユ墦寮�鍚姩绫讳笂闈㈢殑娉ㄩ噴 exclude={MongoAutoConfiguration.class}
 */
+@EnableScheduling
 @Slf4j
 @SpringBootApplication(scanBasePackages = "com.lxzn", exclude = { DataSourceAutoConfiguration.class })
 @MapperScan(value={"com.lxzn.modules.**.mapper*"})
diff --git a/src/main/java/com/lxzn/modules/assembly2/controller/AssemblyCollectionJobController.java b/src/main/java/com/lxzn/modules/assembly2/controller/AssemblyCollectionJobController.java
index 7614212..53c633b 100644
--- a/src/main/java/com/lxzn/modules/assembly2/controller/AssemblyCollectionJobController.java
+++ b/src/main/java/com/lxzn/modules/assembly2/controller/AssemblyCollectionJobController.java
@@ -12,7 +12,7 @@
 
 import java.util.List;
 
-@Api(tags = "2#瑁呴厤绾块噰闆�")
+@Api(tags = "2鍙疯閰嶇嚎閲囬泦")
 @RestController
 @RequestMapping("/assembly2/job")
 public class AssemblyCollectionJobController {
diff --git a/src/main/java/com/lxzn/modules/assembly2/entity/T020Boltcheck.java b/src/main/java/com/lxzn/modules/assembly2/entity/T020Boltcheck.java
index 05d6e0b..9af5cbd 100644
--- a/src/main/java/com/lxzn/modules/assembly2/entity/T020Boltcheck.java
+++ b/src/main/java/com/lxzn/modules/assembly2/entity/T020Boltcheck.java
@@ -1,12 +1,17 @@
 package com.lxzn.modules.assembly2.entity;
 
 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.time.LocalDateTime;
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Getter;
 import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * <p>
@@ -26,23 +31,26 @@
     @TableId(value = "RecordID", type = IdType.AUTO)
     private Integer recordID;
 
-    private LocalDateTime recordTime;
-
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+    @TableField(value = "RecordTime")
+    private Date recordTime;
+    @TableField(value = "ModelID")
     private Integer modelID;
-
+    @TableField(value = "Length")
     private Double length;
-
+    @TableField(value = "LengthUL")
     private Double lengthUL;
-
+    @TableField(value = "LengthLL")
     private Double lengthLL;
-
+    @TableField(value = "PitchMAX")
     private Double pitchMAX;
-
+    @TableField(value = "PitchMIN")
     private Double pitchMIN;
-
+    @TableField(value = "PitchUL")
     private Double pitchUL;
-
+    @TableField(value = "PitchLL")
     private Double pitchLL;
-
+    @TableField(value = "Result")
     private String result;
 }
diff --git a/src/main/java/com/lxzn/modules/assembly2/entity/TcOpstate.java b/src/main/java/com/lxzn/modules/assembly2/entity/TcOpstate.java
index fb68f98..4368c1a 100644
--- a/src/main/java/com/lxzn/modules/assembly2/entity/TcOpstate.java
+++ b/src/main/java/com/lxzn/modules/assembly2/entity/TcOpstate.java
@@ -1,12 +1,16 @@
 package com.lxzn.modules.assembly2.entity;
 
 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.time.LocalDateTime;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Getter;
 import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
 
 /**
  * <p>
@@ -23,10 +27,14 @@
 
     private static final long serialVersionUID = 1L;
 
-    private LocalDateTime recordTime;
-
     @TableId(value = "OPName", type = IdType.AUTO)
     private String oPName;
 
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+    @TableField(value = "RecordTime")
+    private Date recordTime;
+
+    @TableField(value = "State")
     private String state;
 }
diff --git a/src/main/java/com/lxzn/modules/master/entity/Assembly2TcOpstate.java b/src/main/java/com/lxzn/modules/master/entity/Assembly2TcOpstate.java
new file mode 100644
index 0000000..be7acc4
--- /dev/null
+++ b/src/main/java/com/lxzn/modules/master/entity/Assembly2TcOpstate.java
@@ -0,0 +1,40 @@
+package com.lxzn.modules.master.entity;
+
+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 com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author baomidou
+ * @since 2025-09-03
+ */
+@Getter
+@Setter
+@TableName("Assembly2_TC_OPState")
+public class Assembly2TcOpstate implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "OPName", type = IdType.AUTO)
+    private String oPName;
+
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+    @TableField(value = "RecordTime")
+    private Date recordTime;
+
+    @TableField(value = "State")
+    private String state;
+}
diff --git a/src/main/java/com/lxzn/modules/master/entity/EquipmentLog.java b/src/main/java/com/lxzn/modules/master/entity/EquipmentLog.java
new file mode 100644
index 0000000..5c11cff
--- /dev/null
+++ b/src/main/java/com/lxzn/modules/master/entity/EquipmentLog.java
@@ -0,0 +1,38 @@
+package com.lxzn.modules.master.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class EquipmentLog implements Serializable {
+    private static final long serialVersionUID = 6978749606363390023L;
+    /**
+     * 璁惧缂栧彿
+     */
+    private String equipmentId;
+    /**
+     * 璁惧鍚嶇О
+     */
+    private String equipmentName;
+
+    /**
+     * 閲囬泦鏃堕棿
+     */
+    private Date collectTime;
+    /**
+     * 鐘舵��
+     * 0 鍏虫満
+     * 1 寮�鏈�
+     * 2 寰呮満
+     * 3 杩愯
+     * 22 鎶ヨ寮�濮�
+     * 23 鎶ヨ缁撴潫
+     */
+    private Integer oporation;
+    /**
+     * 鎶ヨ鍙�
+     */
+    private String alarm;
+}
diff --git a/src/main/java/com/lxzn/modules/master/enums/Assembly2EquipmentMappingEnum.java b/src/main/java/com/lxzn/modules/master/enums/Assembly2EquipmentMappingEnum.java
new file mode 100644
index 0000000..2c2a587
--- /dev/null
+++ b/src/main/java/com/lxzn/modules/master/enums/Assembly2EquipmentMappingEnum.java
@@ -0,0 +1,29 @@
+package com.lxzn.modules.master.enums;
+
+public enum Assembly2EquipmentMappingEnum {
+    OP020(new String[]{"", "", ""}), //OP020娴嬮噺鍒嗛�夋娴嬫満
+    OP030(new String[]{"", "", ""}), //OP030鏂欏簱
+    OP040(new String[]{"", ""}), //OP040鍚堝鍔犵悆1
+    OP050(new String[]{"", ""}), //OP050鍚堝鍔犵悆2
+    OP090(new String[]{"", ""}), //OP090閾嗘帴妫�娴嬫満
+    OP100(new String[]{"", ""}), //OP100鎸姩妫�鏌ユ満
+    OP110(new String[]{"", ""}), //OP110瀵嗗皝浠�&绔洊鍘嬭妫�娴嬫満
+    OP120(new String[]{"", ""}), //OP120鎵煩&ABS淇″彿妫�娴嬫満
+    OP150(new String[]{"", ""}), //OP150鑺遍敭妫�娴嬫満
+    OP160(new String[]{"", ""}), //OP160绔緞璺虫娴嬫満
+    OP170(new String[]{"", ""}), //OP170婵�鍏夋墦鏍�&闆惧寲娑傛补
+    ;
+
+    /**
+     * code:name
+     */
+    private final String[] equipmentCodes;
+
+    private Assembly2EquipmentMappingEnum(String[] equipmentCodes) {
+        this.equipmentCodes = equipmentCodes;
+    }
+
+    public String[] getEquipmentCodes() {
+        return equipmentCodes;
+    }
+}
diff --git a/src/main/java/com/lxzn/modules/master/enums/EquipmentStatusEnum.java b/src/main/java/com/lxzn/modules/master/enums/EquipmentStatusEnum.java
new file mode 100644
index 0000000..1727eea
--- /dev/null
+++ b/src/main/java/com/lxzn/modules/master/enums/EquipmentStatusEnum.java
@@ -0,0 +1,20 @@
+package com.lxzn.modules.master.enums;
+
+public enum EquipmentStatusEnum {
+    Running(3), //杩愯
+    Standby(2), //寰呮枡
+    Error(22), //鎶ヨ
+    Stop(2), //鍋滄
+    Disconnected(0), //鏈繛鎺�
+    ;
+
+    private final Integer operation;
+
+    private EquipmentStatusEnum(Integer operation) {
+        this.operation = operation;
+    }
+
+    public Integer getOperation() {
+        return operation;
+    }
+}
diff --git a/src/main/java/com/lxzn/modules/master/job/EquipmentLogCollectJob.java b/src/main/java/com/lxzn/modules/master/job/EquipmentLogCollectJob.java
new file mode 100644
index 0000000..04e5868
--- /dev/null
+++ b/src/main/java/com/lxzn/modules/master/job/EquipmentLogCollectJob.java
@@ -0,0 +1,47 @@
+package com.lxzn.modules.master.job;
+
+import com.lxzn.modules.assembly2.entity.TcOpstate;
+import com.lxzn.modules.assembly2.service.ITcOpstateService;
+import com.lxzn.modules.master.entity.Assembly2TcOpstate;
+import com.lxzn.modules.master.service.IAssembly2TcOpstateService;
+import com.lxzn.modules.master.service.IEquipmentLogService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Component
+public class EquipmentLogCollectJob {
+    @Autowired
+    private IAssembly2TcOpstateService assembly2TcOpstateService;
+    @Autowired
+    private ITcOpstateService tcOpstateService;
+    @Autowired
+    private IEquipmentLogService equipmentLogService;
+
+    @Scheduled(initialDelay = 10000, fixedDelay = 15000)
+    public void equipmentLogCollect() {
+        log.info("------------2#瑁呴厤绾块噰闆嗚澶囩姸鎬佸紑濮�------------");
+        long startTime = System.currentTimeMillis();
+        try {
+            //涓婃閲囬泦鏁版嵁
+            Map<String, Assembly2TcOpstate> oldStateMap = assembly2TcOpstateService.listStateMap();
+            //鏈璇诲彇
+            List<TcOpstate> nevStateList = tcOpstateService.list();
+            if (CollectionUtils.isEmpty(nevStateList)) {
+                return;
+            }
+
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+        long endTime = System.currentTimeMillis();
+        long duration = (endTime - startTime) / 1000;
+        log.info("------------2#瑁呴厤绾块噰闆嗚澶囩姸鎬佺粨鏉燂細娑堣�楁椂闀匡細{}S------------", duration);
+    }
+}
diff --git a/src/main/java/com/lxzn/modules/master/mapper/Assembly2TcOpstateMapper.java b/src/main/java/com/lxzn/modules/master/mapper/Assembly2TcOpstateMapper.java
new file mode 100644
index 0000000..ddfd0ed
--- /dev/null
+++ b/src/main/java/com/lxzn/modules/master/mapper/Assembly2TcOpstateMapper.java
@@ -0,0 +1,16 @@
+package com.lxzn.modules.master.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.lxzn.modules.master.entity.Assembly2TcOpstate;
+
+/**
+ * <p>
+ *  Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author baomidou
+ * @since 2025-09-03
+ */
+public interface Assembly2TcOpstateMapper extends BaseMapper<Assembly2TcOpstate> {
+
+}
diff --git a/src/main/java/com/lxzn/modules/master/mapper/EquipmentLogMapper.java b/src/main/java/com/lxzn/modules/master/mapper/EquipmentLogMapper.java
new file mode 100644
index 0000000..c4fca74
--- /dev/null
+++ b/src/main/java/com/lxzn/modules/master/mapper/EquipmentLogMapper.java
@@ -0,0 +1,21 @@
+package com.lxzn.modules.master.mapper;
+
+import com.lxzn.modules.master.entity.EquipmentLog;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+public interface EquipmentLogMapper {
+    /**
+     * 鏃ュ織鎻掑叆
+     * @param logs
+     */
+    void insertBatch(@Param("log") List<EquipmentLog> logs);
+    /**
+     * 鏇存柊璁惧涓夎壊鐏姸鎬�
+     * @param equipmentCode 璁惧缂栧彿
+     * @param operation 涓夎壊鐏姸鎬�
+     */
+    void updateEquipmentStatus(@Param("id") String equipmentCode, @Param("operation") int operation, @Param("collectTime") Date collectTime);
+}
diff --git a/src/main/java/com/lxzn/modules/master/mapper/xml/Assembly2TcOpstateMapper.xml b/src/main/java/com/lxzn/modules/master/mapper/xml/Assembly2TcOpstateMapper.xml
new file mode 100644
index 0000000..3b19450
--- /dev/null
+++ b/src/main/java/com/lxzn/modules/master/mapper/xml/Assembly2TcOpstateMapper.xml
@@ -0,0 +1,5 @@
+<?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.lxzn.modules.master.mapper.Assembly2TcOpstateMapper">
+
+</mapper>
diff --git a/src/main/java/com/lxzn/modules/master/mapper/xml/EquipmentLogMapper.xml b/src/main/java/com/lxzn/modules/master/mapper/xml/EquipmentLogMapper.xml
new file mode 100644
index 0000000..32e9ff0
--- /dev/null
+++ b/src/main/java/com/lxzn/modules/master/mapper/xml/EquipmentLogMapper.xml
@@ -0,0 +1,18 @@
+<?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.lxzn.modules.master.mapper.EquipmentLogMapper">
+    <insert id="insertBatch">
+        INSERT INTO EquipmentLog(EquipmentID, EquipmentName, CollectTime, Oporation, Alarm)
+        VALUES
+        <foreach collection="logs" item="log" separator=",">
+            (#{log.equipmentId}, #{log.equipmentName}, #{log.collectTime}, #{log.oporation}, #{log.alarm})
+        </foreach>
+    </insert>
+
+    <update id="updateEquipmentStatus">
+        UPDATE Equipment
+        set oporation = #{operation}
+          , collectTime = #{collectTime}
+        where EquipmentID = #{equipmentCode}
+    </update>
+</mapper>
diff --git a/src/main/java/com/lxzn/modules/master/service/IAssembly2TcOpstateService.java b/src/main/java/com/lxzn/modules/master/service/IAssembly2TcOpstateService.java
new file mode 100644
index 0000000..1b7e620
--- /dev/null
+++ b/src/main/java/com/lxzn/modules/master/service/IAssembly2TcOpstateService.java
@@ -0,0 +1,23 @@
+package com.lxzn.modules.master.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.lxzn.modules.master.entity.Assembly2TcOpstate;
+
+import java.util.Map;
+
+/**
+ * <p>
+ *  鏈嶅姟绫�
+ * </p>
+ *
+ * @author baomidou
+ * @since 2025-09-03
+ */
+public interface IAssembly2TcOpstateService extends IService<Assembly2TcOpstate> {
+    /**
+     * 鏌ヨ涓婃閲囬泦鐨勮澶囩姸鎬�
+     * @return
+     */
+    Map<String, Assembly2TcOpstate> listStateMap();
+
+}
diff --git a/src/main/java/com/lxzn/modules/master/service/IEquipmentLogService.java b/src/main/java/com/lxzn/modules/master/service/IEquipmentLogService.java
new file mode 100644
index 0000000..ba1c7b5
--- /dev/null
+++ b/src/main/java/com/lxzn/modules/master/service/IEquipmentLogService.java
@@ -0,0 +1,22 @@
+package com.lxzn.modules.master.service;
+
+import com.lxzn.modules.master.entity.EquipmentLog;
+
+import java.util.Date;
+import java.util.List;
+
+public interface IEquipmentLogService {
+    /**
+     * 鏃ュ織鎻掑叆
+     * @param logs
+     */
+    void insertBatch(List<EquipmentLog> logs);
+
+    /**
+     * 鏇存柊璁惧涓夎壊鐏姸鎬�
+     * @param equipmentCode 璁惧缂栧彿
+     * @param operation 涓夎壊鐏姸鎬�
+     * @param collectTime 閲囬泦鏃堕棿
+     */
+    void updateEquipmentStatus(String equipmentCode, int operation, Date collectTime);
+}
diff --git a/src/main/java/com/lxzn/modules/master/service/impl/Assembly2TcOpstateServiceImpl.java b/src/main/java/com/lxzn/modules/master/service/impl/Assembly2TcOpstateServiceImpl.java
new file mode 100644
index 0000000..c449186
--- /dev/null
+++ b/src/main/java/com/lxzn/modules/master/service/impl/Assembly2TcOpstateServiceImpl.java
@@ -0,0 +1,40 @@
+package com.lxzn.modules.master.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.lxzn.modules.master.entity.Assembly2TcOpstate;
+import com.lxzn.modules.master.mapper.Assembly2TcOpstateMapper;
+import com.lxzn.modules.master.service.IAssembly2TcOpstateService;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ *  鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author baomidou
+ * @since 2025-09-03
+ */
+@Service
+@DS("master")
+public class Assembly2TcOpstateServiceImpl extends ServiceImpl<Assembly2TcOpstateMapper, Assembly2TcOpstate> implements IAssembly2TcOpstateService {
+
+    @Override
+    public Map<String, Assembly2TcOpstate> listStateMap() {
+        List<Assembly2TcOpstate> list = super.list();
+        if(CollectionUtils.isEmpty(list)){
+            return Collections.emptyMap();
+        }
+        return list.stream().collect(Collectors.toMap(Assembly2TcOpstate::getOPName,
+                state -> state,
+                (oldVal, newVal) -> oldVal,
+                HashMap::new));
+    }
+}
diff --git a/src/main/java/com/lxzn/modules/master/service/impl/EquipmentLogServiceImpl.java b/src/main/java/com/lxzn/modules/master/service/impl/EquipmentLogServiceImpl.java
new file mode 100644
index 0000000..8c67169
--- /dev/null
+++ b/src/main/java/com/lxzn/modules/master/service/impl/EquipmentLogServiceImpl.java
@@ -0,0 +1,35 @@
+package com.lxzn.modules.master.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.lxzn.modules.master.entity.EquipmentLog;
+import com.lxzn.modules.master.mapper.EquipmentLogMapper;
+import com.lxzn.modules.master.service.IEquipmentLogService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+
+@Service
+@Slf4j
+public class EquipmentLogServiceImpl implements IEquipmentLogService {
+    @Resource
+    private EquipmentLogMapper equipmentLogMapper;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void insertBatch(List<EquipmentLog> logs) {
+        if(CollectionUtils.isEmpty(logs)){
+            return;
+        }
+        equipmentLogMapper.insertBatch(logs);
+        log.info("鎴愬姛鎻掑叆鏃ュ織鏁版嵁EquipmentLog:{}鏉�", logs.size());
+    }
+
+    @Override
+    public void updateEquipmentStatus(String equipmentCode, int operation, Date collectTime) {
+        equipmentLogMapper.updateEquipmentStatus(equipmentCode, operation, collectTime);
+    }
+}

--
Gitblit v1.9.3