yangys
2024-08-23 2a6e0d70ed75ba561d0415edc5182f1f0b993219
固定点1
已重命名3个文件
已修改15个文件
已删除10个文件
已添加19个文件
2820 ■■■■ 文件已修改
.mvn/wrapper/MavenWrapperDownloader.java 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.mvn/wrapper/maven-wrapper.properties 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/pom.xml 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/MdcTansApplication.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/cache/WorkstationCache.java 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/config/MqttConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/config/RedisConfig.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/constants/CommonConstant.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/controller/CollectTestController.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/controller/MqttController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/dto/CalendarShiftInfoDTO.java 255 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/dto/WorkstationDTO.java 156 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/entity/iotdb/DeviceState.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/entity/mgr/ProductionCalendar.java 138 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/entity/mgr/Workstation.java 272 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/enums/FeedbackTimePointEnum.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/handler/DeviceStatusDataHandler.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/job/StateFixPointJob.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/mapper/iotdb/DeviceStateMapper.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/mapper/iotdb/ProcessParamMapper.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/mapper/mgr/CalendarMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/mapper/mgr/WorkstationMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/runner/InitRunner.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/service/CollectDataService.java 121 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/service/DeviceStateFixPointService.java 249 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/service/IOTMqttReceiveService.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/service/WorkstationService.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/utils/LocalDateTimeUtils.java 139 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/utils/SpringUtil.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collect/utils/redis/RedisUtil.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/collector/DataCollector.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/java/com/qianwen/mdc/domain/Machine.java 175 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/resources/application.yml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/resources/com/qianwen/mdc/collect/mapper/iotdb/OutputMapper.xml 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/resources/com/qianwen/mdc/collect/mapper/iotdb/ProcessParamMapper.xml 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/resources/com/qianwen/mdc/collect/mapper/mgr/CalendarMapper.xml 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/resources/mapper/MachineMapper.xml 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/resources/nativelib/focas/Fwlib32.dll 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/resources/nativelib/focas/Fwlib64.dll 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/resources/nativelib/focas/HxFocasApi.dll 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/resources/nativelib/focas/HxFocasApi.lib 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/resources/nativelib/focas/fwlibe1.dll 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/main/resources/nativelib/focas/fwlibe64.dll 补丁 | 查看 | 原始文档 | blame | 历史
collect/src/test/java/com/qianwen/mdc/collect/service/CollectDataServiceTest.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mvnw 310 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mvnw.cmd 185 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.mvn/wrapper/MavenWrapperDownloader.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,117 @@
/*
 * Copyright 2007-present the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
    private static final String WRAPPER_VERSION = "0.5.5";
    /**
     * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
     */
    private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
        + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
    /**
     * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
     * use instead of the default one.
     */
    private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
            ".mvn/wrapper/maven-wrapper.properties";
    /**
     * Path where the maven-wrapper.jar will be saved to.
     */
    private static final String MAVEN_WRAPPER_JAR_PATH =
            ".mvn/wrapper/maven-wrapper.jar";
    /**
     * Name of the property which should be used to override the default download url for the wrapper.
     */
    private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
    public static void main(String args[]) {
        System.out.println("- Downloader started");
        File baseDirectory = new File(args[0]);
        System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
        // If the maven-wrapper.properties exists, read it and check if it contains a custom
        // wrapperUrl parameter.
        File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
        String url = DEFAULT_DOWNLOAD_URL;
        if(mavenWrapperPropertyFile.exists()) {
            FileInputStream mavenWrapperPropertyFileInputStream = null;
            try {
                mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
                Properties mavenWrapperProperties = new Properties();
                mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
                url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
            } catch (IOException e) {
                System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
            } finally {
                try {
                    if(mavenWrapperPropertyFileInputStream != null) {
                        mavenWrapperPropertyFileInputStream.close();
                    }
                } catch (IOException e) {
                    // Ignore ...
                }
            }
        }
        System.out.println("- Downloading from: " + url);
        File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
        if(!outputFile.getParentFile().exists()) {
            if(!outputFile.getParentFile().mkdirs()) {
                System.out.println(
                        "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
            }
        }
        System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
        try {
            downloadFileFromURL(url, outputFile);
            System.out.println("Done");
            System.exit(0);
        } catch (Throwable e) {
            System.out.println("- Error downloading");
            e.printStackTrace();
            System.exit(1);
        }
    }
    private static void downloadFileFromURL(String urlString, File destination) throws Exception {
        if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
            String username = System.getenv("MVNW_USERNAME");
            char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
            Authenticator.setDefault(new Authenticator() {
                @Override
                protected PasswordAuthentication getPasswordAuthentication() {
                    return new PasswordAuthentication(username, password);
                }
            });
        }
        URL website = new URL(urlString);
        ReadableByteChannel rbc;
        rbc = Channels.newChannel(website.openStream());
        FileOutputStream fos = new FileOutputStream(destination);
        fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
        fos.close();
        rbc.close();
    }
}
.mvn/wrapper/maven-wrapper.properties
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,2 @@
distributionUrl=https://mirrors.huaweicloud.com/repository/maven//org/apache/maven/apache-maven/3.9.8/apache-maven-3.9.8-bin.zip
wrapperUrl=https://mirrors.huaweicloud.com/repository/maven//io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar
collect/pom.xml
@@ -100,6 +100,21 @@
            <groupId>io.github.lmlx66</groupId>
            <artifactId>yitter-idgenerator-spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>com.qianwen</groupId>
            <artifactId>smart-starter-tenant</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.qianwen</groupId>
            <artifactId>smart-starter-mybatis</artifactId>
            <version>1.0.0</version>
        </dependency>
       
        <!-- <dependency>
            <groupId>org.opcfoundation</groupId>
@@ -136,12 +151,13 @@
            <version>1.3.2</version>
        </dependency>
        
        <!--  tdengine é©±åЍ -->
        <!--  xxl-job -->
        <dependency>
            <groupId>com.taosdata.jdbc</groupId>
            <artifactId>taos-jdbcdriver</artifactId>
            <version>${tdengine.version}</version>
            <groupId>com.xuxueli</groupId>
            <artifactId>xxl-job-core</artifactId>
            <version>2.1.2</version>
        </dependency>
    </dependencies>
collect/src/main/java/com/qianwen/mdc/collect/MdcTansApplication.java
@@ -9,9 +9,11 @@
import org.springframework.scheduling.annotation.EnableScheduling;
@ServletComponentScan(basePackages = {"com.qianwen.mdc.listener"})
//@ServletComponentScan(basePackages = {"com.qianwen.mdc.listener"})
@SpringBootApplication
@MapperScan(value = {"com.qianwen.mdc.collect.mapper", "com.qianwen.mdc.collect.mapper.rdbms"})
//@MapperScan(value = {"com.qianwen.mdc.collect.mapper", "com.qianwen.mdc.collect.mapper.mgr"})
//mapperscan使用starter-mybatis中的
@EnableScheduling
public class MdcTansApplication {
    private static final Logger logger = LoggerFactory.getLogger(MdcTansApplication.class);
collect/src/main/java/com/qianwen/mdc/collect/cache/WorkstationCache.java
@@ -2,8 +2,10 @@
import java.time.Duration;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
@@ -14,12 +16,16 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
//import com.qianwen.core.redis.cache.BladeRedis;
import com.qianwen.mdc.collect.dto.WorkstationDTO;
import com.qianwen.mdc.collect.entity.mgr.GlobalWcsOfRps;
import com.qianwen.mdc.collect.entity.mgr.Workstation;
import com.qianwen.mdc.collect.mapper.mgr.GlobalWcsOfRpsMapper;
import com.qianwen.mdc.collect.service.WorkstationService;
import com.qianwen.mdc.collect.utils.redis.RedisUtil;
import cn.hutool.core.util.ObjectUtil;
//import com.qianwen.posting.convert.WorkstationConvert;
//import com.qianwen.posting.dto.WorkStationDTO;
//import com.qianwen.posting.entity.mysql.EmployeeOnOffWork;
//import com.qianwen.posting.entity.mysql.Workstation;
@@ -41,32 +47,64 @@
    //private static final IWorkstationService workStationService = (IWorkstationService) SpringUtil.getBean(IWorkstationService.class);
    @Autowired
    private GlobalWcsOfRpsMapper globalWcsOfRpsMapper;
    @Autowired
    private WorkstationService workStationService;
    //private static final EmployeeOnOffWorkMapper employeeOnOffWorkMapper = (EmployeeOnOffWorkMapper) SpringUtil.getBean(EmployeeOnOffWorkMapper.class);
    /*
    public static Map<String, WorkStationDTO> getWorkStations() {
    public Map<Long, WorkstationDTO> getWorkStations() {
        String redisKey = "posting:workstation".concat("::").concat(WORKSTATION_ALL);
        Map<String, WorkStationDTO> map = bladeRedis.hGetAll(redisKey);
        /*Map<String, WorkstationDTO> map = bladeRedis.hGetAll(redisKey);
        if (Func.isEmpty(map)) {
            map = setWorkStations();
        }
        return map;
    }
        */
        Map<Long, WorkstationDTO> map = convertMap(redisUtil.hmget(redisKey));
        if (ObjectUtil.isEmpty(map)) {
            map = setWorkStations();
        }
    private static Map<String, WorkStationDTO> setWorkStations() {
        return map;
    }
    private Map<Long, WorkstationDTO> setWorkStations() {
        List<Workstation> list = workStationService.list();
        String redisKey = "posting:workstation".concat("::").concat(WORKSTATION_ALL);
        if (Func.isNotEmpty(list)) {
            list.forEach(workStation -> {
                WorkStationDTO workStationDTO = WorkstationConvert.INSTANCE.convertDTO(workStation);
                bladeRedis.hSet(redisKey, workStation.getId(), workStationDTO);
            });
            bladeRedis.expire(redisKey, 259200L);
        }
        return bladeRedis.hGetAll(redisKey);
        list.forEach(ws -> {
            /*
            WorkStationDTO workStationDTO = WorkstationConvert.INSTANCE.convertDTO(workStation);
            bladeRedis.hSet(redisKey, workStation.getId(), workStationDTO);
            */
            WorkstationDTO dto = new WorkstationDTO();
            dto.setCalendarCode(ws.getCalendarCode());
            dto.setCode(ws.getCode());
            dto.setId(ws.getId());
            dto.setName(ws.getName());
            redisUtil.hset(redisKey, ws.getId(), dto);
        });
        //bladeRedis.expire(redisKey, 259200L);
        redisUtil.expire(redisKey, 259200L);
        //return bladeRedis.hGetAll(redisKey);
        return convertMap(redisUtil.hmget(redisKey));
    }
    static <K,V> Map<K,V> convertMap(Map<?,?> map){
        Map<K,V> result = new HashMap<>();
        for(Map.Entry<?,?> entry : map.entrySet()) {
            result.put((K)entry.getKey(), (V)entry.getValue());
        }
        return result;
    }
    /*
    public static Boolean clearWorkStationCache() {
        String redisKey = "posting:workstation".concat("::").concat(WORKSTATION_ALL);
        return bladeRedis.del(redisKey);
collect/src/main/java/com/qianwen/mdc/collect/config/MqttConfig.java
@@ -19,7 +19,7 @@
import com.qianwen.mdc.collect.service.IOTMqttReceiveService;
@Configuration
public class MqttConfig extends CachingConfigurerSupport {
public class MqttConfig {
    
    @Autowired
    private IOTMqttReceiveService recService;
collect/src/main/java/com/qianwen/mdc/collect/config/RedisConfig.java
@@ -18,6 +18,7 @@
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@@ -32,14 +33,20 @@
        //Jackson2JsonRedisSerializer<Object> jacksonSeial = new Jackson2JsonRedisSerializer<>(Object.class);
        ObjectMapper om = new ObjectMapper();
        om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
        om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
        //om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
        om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
        //om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL,JsonTypeInfo.As.WRAPPER_ARRAY);
        
        jacksonSeial.setObjectMapper(om);
        template.setValueSerializer(jacksonSeial);
        template.setKeySerializer(new StringRedisSerializer());
        template.setHashKeySerializer(new StringRedisSerializer());
        //new JdkSerializationRedisSerializer(classLoader);
        //template.setHashKeySerializer(new StringRedisSerializer());
        ClassLoader classLoader = getClass().getClassLoader();
        template.setHashKeySerializer(new JdkSerializationRedisSerializer(classLoader));
        template.setHashValueSerializer(jacksonSeial);
        template.afterPropertiesSet();
        return template;
collect/src/main/java/com/qianwen/mdc/collect/constants/CommonConstant.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
package com.qianwen.mdc.collect.constants;
public interface CommonConstant {
    public static final String APPLICATION_NAME = "posting";
    public static final String ALARM_CODE = "code";
    public static final String ALARM_TIME = "timestamp";
    public static final String ALARM_MSG = "msg";
    public static final String ALARM_LEVEL = "level";
    public static final String ALARM_ARRAY = "AlarmArray";
    public static final String OUTPUT = "output";
    public static final String STATE = "state";
    public static final String BIZ_SPLIT = "::";
    public static final String DEFAULT_CODE = "#default#";
    public static final String GLOBAL_WORKSTATION_FEEDBACK_ANALYSE_LOCK = "lock:posting:state:{}";
    public static final long WAIT_TIME = 10;
    public static final long REDIS_LOCK_LEASE_TIME = 240;
    public static final Integer DEFAULT_SHIFT_INDEX = 1;
    public static final Integer DEFAULT_SHIFT_TYPE = 1;
    public static final Integer IOT_STATE_START = 1;
    public static final Integer IOT_STATE_END = 5;
    public static final Long DEFAULT_SYNC_MESSAGE_TIME_OUT = 30000L;
    public static final Boolean ISSYNC = true;
    public static final Boolean ISNOTSYNC = false;
    public static final Integer ENABLE = 1;
    public static final Integer DIS_ENABLE = 0;
    public static final Integer MINUTE_STOP = 1439;
    public static final Integer MAX_RECORDS_FOR_SQL_LENGTH = 1000;
}
collect/src/main/java/com/qianwen/mdc/collect/controller/CollectTestController.java
@@ -1,4 +1,5 @@
package com.qianwen.mdc.collect.controller;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
@@ -7,15 +8,22 @@
import com.baomidou.dynamic.datasource.annotation.DS;
import com.qianwen.mdc.collect.config.IotDBSessionConfig;
import com.qianwen.mdc.collect.dto.CalendarShiftInfoDTO;
import com.qianwen.mdc.collect.entity.iotdb.Output;
import com.qianwen.mdc.collect.entity.iotdb.ProcessParam;
import com.qianwen.mdc.collect.mapper.iotdb.OutputMapper;
import com.qianwen.mdc.collect.mapper.iotdb.ProcessParamMapper;
import com.qianwen.mdc.collect.mapper.mgr.CalendarMapper;
import com.qianwen.mdc.collect.mqtt.MqttMessageSender;
import com.qianwen.mdc.collect.service.DeviceStateFixPointService;
import com.qianwen.mdc.collect.service.IOTMqttReceiveService;
import com.qianwen.mdc.collect.service.IotDBCommonService;
import com.qianwen.mdc.collect.service.OutputAggregateService;
import com.qianwen.mdc.collect.utils.redis.RedisUtil;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
@RestController
public class CollectTestController {
@@ -37,6 +45,11 @@
    private OutputMapper outmapper;
    @Autowired
    private  RedisUtil redisUtil;
    @Autowired
    private DeviceStateFixPointService fpService;
    @Autowired
    private CalendarMapper calendarMapper;
    
    @GetMapping("/last")
    public Object last() {
@@ -56,4 +69,17 @@
        redisUtil.hset("workstation-appid-map", "174", 1656819188967653378L);
        return 1;
    }
    @GetMapping("/fixpoint")
    public Object fixpoint() {
        //DateTime dateTime = DateTime.now().offset(DateField.DAY_OF_MONTH, 1);//+1天,即明天的数据
        DateTime dateTime = DateTime.now();
        fpService.deviceStateFixPoint(dateTime, null);
        return 1;
    }
    @GetMapping("/shift")
    public Object shift() {
        Long val = calendarMapper.t1();
        return val;
    }
}
collect/src/main/java/com/qianwen/mdc/collect/controller/MqttController.java
@@ -53,7 +53,7 @@
    public void testRec2() {
        //数据格式:{"174":[{"values":{"d1":12},"ts":"1721978780449"}]} 174是应用id
        //多条格式:{"174":[{"values":{"DeviceStatus":2},"ts":"1722478128278"},{"values":{"spindleSpeed":22},"ts":"1722478128281"}]}
        String payload = "{\"174\":[{\"values\":{\"DeviceStatus\":2,\"Output\":34},\"ts\":\"1721978780449\"}]}";
        String payload = "{\"174\":[{\"values\":{\"DeviceStatus\":2,\"Output\":34},\"ts\":\"1723709061525\"}]}";
        //payload = "{\"174\":[{\"values\":{\"Output\":11},\"ts\":\"1722478128278\"},{\"values\":{\"SpindleSpeed\":22},\"ts\":\"1722478128281\"}]}";
        recService.handle(payload);
    }
collect/src/main/java/com/qianwen/mdc/collect/dto/CalendarShiftInfoDTO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,255 @@
package com.qianwen.mdc.collect.dto;
import java.util.Date;
public class CalendarShiftInfoDTO {
    private Long workstationId;
    private String code;
    private Integer factoryYear;
    private Integer factoryMonth;
    private Integer factoryWeek;
    private String factoryDate;
    private Date startTime;
    private Date endTime;
    private String calendarDay;
    private Integer shiftIndex;
    private Integer shiftTimeType;
    public CalendarShiftInfoDTO setWorkstationId(final Long workstationId) {
        this.workstationId = workstationId;
        return this;
    }
    public CalendarShiftInfoDTO setCode(final String code) {
        this.code = code;
        return this;
    }
    public CalendarShiftInfoDTO setFactoryYear(final Integer factoryYear) {
        this.factoryYear = factoryYear;
        return this;
    }
    public CalendarShiftInfoDTO setFactoryMonth(final Integer factoryMonth) {
        this.factoryMonth = factoryMonth;
        return this;
    }
    public CalendarShiftInfoDTO setFactoryWeek(final Integer factoryWeek) {
        this.factoryWeek = factoryWeek;
        return this;
    }
    public CalendarShiftInfoDTO setFactoryDate(final String factoryDate) {
        this.factoryDate = factoryDate;
        return this;
    }
    public CalendarShiftInfoDTO setStartTime(final Date startTime) {
        this.startTime = startTime;
        return this;
    }
    public CalendarShiftInfoDTO setEndTime(final Date endTime) {
        this.endTime = endTime;
        return this;
    }
    public CalendarShiftInfoDTO setCalendarDay(final String calendarDay) {
        this.calendarDay = calendarDay;
        return this;
    }
    public CalendarShiftInfoDTO setShiftIndex(final Integer shiftIndex) {
        this.shiftIndex = shiftIndex;
        return this;
    }
    public CalendarShiftInfoDTO setShiftTimeType(final Integer shiftTimeType) {
        this.shiftTimeType = shiftTimeType;
        return this;
    }
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        }
        if (o instanceof CalendarShiftInfoDTO) {
            CalendarShiftInfoDTO other = (CalendarShiftInfoDTO) o;
            if (other.canEqual(this)) {
                Object this$workStationId = getWorkstationId();
                Object other$workStationId = other.getWorkstationId();
                if (this$workStationId == null) {
                    if (other$workStationId != null) {
                        return false;
                    }
                } else if (!this$workStationId.equals(other$workStationId)) {
                    return false;
                }
                Object this$factoryYear = getFactoryYear();
                Object other$factoryYear = other.getFactoryYear();
                if (this$factoryYear == null) {
                    if (other$factoryYear != null) {
                        return false;
                    }
                } else if (!this$factoryYear.equals(other$factoryYear)) {
                    return false;
                }
                Object this$factoryMonth = getFactoryMonth();
                Object other$factoryMonth = other.getFactoryMonth();
                if (this$factoryMonth == null) {
                    if (other$factoryMonth != null) {
                        return false;
                    }
                } else if (!this$factoryMonth.equals(other$factoryMonth)) {
                    return false;
                }
                Object this$factoryWeek = getFactoryWeek();
                Object other$factoryWeek = other.getFactoryWeek();
                if (this$factoryWeek == null) {
                    if (other$factoryWeek != null) {
                        return false;
                    }
                } else if (!this$factoryWeek.equals(other$factoryWeek)) {
                    return false;
                }
                Object this$shiftIndex = getShiftIndex();
                Object other$shiftIndex = other.getShiftIndex();
                if (this$shiftIndex == null) {
                    if (other$shiftIndex != null) {
                        return false;
                    }
                } else if (!this$shiftIndex.equals(other$shiftIndex)) {
                    return false;
                }
                Object this$shiftTimeType = getShiftTimeType();
                Object other$shiftTimeType = other.getShiftTimeType();
                if (this$shiftTimeType == null) {
                    if (other$shiftTimeType != null) {
                        return false;
                    }
                } else if (!this$shiftTimeType.equals(other$shiftTimeType)) {
                    return false;
                }
                Object this$code = getCode();
                Object other$code = other.getCode();
                if (this$code == null) {
                    if (other$code != null) {
                        return false;
                    }
                } else if (!this$code.equals(other$code)) {
                    return false;
                }
                Object this$factoryDate = getFactoryDate();
                Object other$factoryDate = other.getFactoryDate();
                if (this$factoryDate == null) {
                    if (other$factoryDate != null) {
                        return false;
                    }
                } else if (!this$factoryDate.equals(other$factoryDate)) {
                    return false;
                }
                Object this$startTime = getStartTime();
                Object other$startTime = other.getStartTime();
                if (this$startTime == null) {
                    if (other$startTime != null) {
                        return false;
                    }
                } else if (!this$startTime.equals(other$startTime)) {
                    return false;
                }
                Object this$endTime = getEndTime();
                Object other$endTime = other.getEndTime();
                if (this$endTime == null) {
                    if (other$endTime != null) {
                        return false;
                    }
                } else if (!this$endTime.equals(other$endTime)) {
                    return false;
                }
                Object this$calendarDay = getCalendarDay();
                Object other$calendarDay = other.getCalendarDay();
                return this$calendarDay == null ? other$calendarDay == null : this$calendarDay.equals(other$calendarDay);
            }
            return false;
        }
        return false;
    }
    protected boolean canEqual(final Object other) {
        return other instanceof CalendarShiftInfoDTO;
    }
    public int hashCode() {
        Object $workStationId = getWorkstationId();
        int result = (1 * 59) + ($workStationId == null ? 43 : $workStationId.hashCode());
        Object $factoryYear = getFactoryYear();
        int result2 = (result * 59) + ($factoryYear == null ? 43 : $factoryYear.hashCode());
        Object $factoryMonth = getFactoryMonth();
        int result3 = (result2 * 59) + ($factoryMonth == null ? 43 : $factoryMonth.hashCode());
        Object $factoryWeek = getFactoryWeek();
        int result4 = (result3 * 59) + ($factoryWeek == null ? 43 : $factoryWeek.hashCode());
        Object $shiftIndex = getShiftIndex();
        int result5 = (result4 * 59) + ($shiftIndex == null ? 43 : $shiftIndex.hashCode());
        Object $shiftTimeType = getShiftTimeType();
        int result6 = (result5 * 59) + ($shiftTimeType == null ? 43 : $shiftTimeType.hashCode());
        Object $code = getCode();
        int result7 = (result6 * 59) + ($code == null ? 43 : $code.hashCode());
        Object $factoryDate = getFactoryDate();
        int result8 = (result7 * 59) + ($factoryDate == null ? 43 : $factoryDate.hashCode());
        Object $startTime = getStartTime();
        int result9 = (result8 * 59) + ($startTime == null ? 43 : $startTime.hashCode());
        Object $endTime = getEndTime();
        int result10 = (result9 * 59) + ($endTime == null ? 43 : $endTime.hashCode());
        Object $calendarDay = getCalendarDay();
        return (result10 * 59) + ($calendarDay == null ? 43 : $calendarDay.hashCode());
    }
    public String toString() {
        return "CalendarShiftInfoDTO(workStationId=" + getWorkstationId() + ", code=" + getCode() + ", factoryYear=" + getFactoryYear() + ", factoryMonth=" + getFactoryMonth() + ", factoryWeek=" + getFactoryWeek() + ", factoryDate=" + getFactoryDate() + ", startTime=" + getStartTime() + ", endTime=" + getEndTime() + ", calendarDay=" + getCalendarDay() + ", shiftIndex=" + getShiftIndex() + ", shiftTimeType=" + getShiftTimeType() + ")";
    }
    public Long getWorkstationId() {
        return this.workstationId;
    }
    public String getCode() {
        return this.code;
    }
    public Integer getFactoryYear() {
        return this.factoryYear;
    }
    public Integer getFactoryMonth() {
        return this.factoryMonth;
    }
    public Integer getFactoryWeek() {
        return this.factoryWeek;
    }
    public String getFactoryDate() {
        return this.factoryDate;
    }
    public Date getStartTime() {
        return this.startTime;
    }
    public Date getEndTime() {
        return this.endTime;
    }
    public String getCalendarDay() {
        return this.calendarDay;
    }
    public Integer getShiftIndex() {
        return this.shiftIndex;
    }
    public Integer getShiftTimeType() {
        return this.shiftTimeType;
    }
}
collect/src/main/java/com/qianwen/mdc/collect/dto/WorkstationDTO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,156 @@
package com.qianwen.mdc.collect.dto;
import java.io.Serializable;
public class WorkstationDTO implements Serializable {
    private Long id;
    private String code;
    private String name;
    private String calendarCode;
    public static class WorkStationDTOBuilder {
        private Long id;
        private String code;
        private String name;
        private String calendarCode;
        WorkStationDTOBuilder() {
        }
        public WorkStationDTOBuilder id(final Long id) {
            this.id = id;
            return this;
        }
        public WorkStationDTOBuilder code(final String code) {
            this.code = code;
            return this;
        }
        public WorkStationDTOBuilder name(final String name) {
            this.name = name;
            return this;
        }
        public WorkStationDTOBuilder calendarCode(final String calendarCode) {
            this.calendarCode = calendarCode;
            return this;
        }
        public WorkstationDTO build() {
            return new WorkstationDTO(this.id, this.code, this.name, this.calendarCode);
        }
        public String toString() {
            return "WorkStationDTO.WorkStationDTOBuilder(id=" + this.id + ", code=" + this.code + ", name=" + this.name + ", calendarCode=" + this.calendarCode + ")";
        }
    }
    public void setId(final Long id) {
        this.id = id;
    }
    public void setCode(final String code) {
        this.code = code;
    }
    public void setName(final String name) {
        this.name = name;
    }
    public void setCalendarCode(final String calendarCode) {
        this.calendarCode = calendarCode;
    }
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        }
        if (o instanceof WorkstationDTO) {
            WorkstationDTO other = (WorkstationDTO) o;
            if (other.canEqual(this)) {
                Object this$id = getId();
                Object other$id = other.getId();
                if (this$id == null) {
                    if (other$id != null) {
                        return false;
                    }
                } else if (!this$id.equals(other$id)) {
                    return false;
                }
                Object this$code = getCode();
                Object other$code = other.getCode();
                if (this$code == null) {
                    if (other$code != null) {
                        return false;
                    }
                } else if (!this$code.equals(other$code)) {
                    return false;
                }
                Object this$name = getName();
                Object other$name = other.getName();
                if (this$name == null) {
                    if (other$name != null) {
                        return false;
                    }
                } else if (!this$name.equals(other$name)) {
                    return false;
                }
                Object this$calendarCode = getCalendarCode();
                Object other$calendarCode = other.getCalendarCode();
                return this$calendarCode == null ? other$calendarCode == null : this$calendarCode.equals(other$calendarCode);
            }
            return false;
        }
        return false;
    }
    protected boolean canEqual(final Object other) {
        return other instanceof WorkstationDTO;
    }
    public int hashCode() {
        Object $id = getId();
        int result = (1 * 59) + ($id == null ? 43 : $id.hashCode());
        Object $code = getCode();
        int result2 = (result * 59) + ($code == null ? 43 : $code.hashCode());
        Object $name = getName();
        int result3 = (result2 * 59) + ($name == null ? 43 : $name.hashCode());
        Object $calendarCode = getCalendarCode();
        return (result3 * 59) + ($calendarCode == null ? 43 : $calendarCode.hashCode());
    }
    public String toString() {
        return "WorkStationDTO(id=" + getId() + ", code=" + getCode() + ", name=" + getName() + ", calendarCode=" + getCalendarCode() + ")";
    }
    public static WorkStationDTOBuilder builder() {
        return new WorkStationDTOBuilder();
    }
    public WorkstationDTO(final Long id, final String code, final String name, final String calendarCode) {
        this.id = id;
        this.code = code;
        this.name = name;
        this.calendarCode = calendarCode;
    }
    public WorkstationDTO() {
    }
    public Long getId() {
        return this.id;
    }
    public String getCode() {
        return this.code;
    }
    public String getName() {
        return this.name;
    }
    public String getCalendarCode() {
        return this.calendarCode;
    }
}
collect/src/main/java/com/qianwen/mdc/collect/entity/iotdb/DeviceState.java
ÎļþÃû´Ó collect/src/main/java/com/qianwen/mdc/collect/entity/iotdb/State.java ÐÞ¸Ä
@@ -4,7 +4,7 @@
/**
 * è®¾å¤‡çŠ¶æ€
 */
public class State {
public class DeviceState {
    private Long time;
    private Long workstationId;
    private Integer valueCollect;
@@ -76,7 +76,7 @@
    
    protected boolean canEqual(final Object other) {
        return other instanceof State;
        return other instanceof DeviceState;
    }
    
@@ -84,7 +84,7 @@
        return ToStringBuilder.reflectionToString(this);
    }
    public State() {
    public DeviceState() {
    }
    public Long getTime() {
collect/src/main/java/com/qianwen/mdc/collect/entity/mgr/ProductionCalendar.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,138 @@
package com.qianwen.mdc.collect.entity.mgr;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.qianwen.core.mp.base.BaseEntity;
@ApiModel(value = "生产日历基础信息entity", description = "生产日历基础信息entity")
@TableName("blade_production_calendar")
public class ProductionCalendar extends BaseEntity {
    private static final long serialVersionUID = -899603875425492916L;
    @TableField("code")
    @ApiModelProperty("日历编号")
    private String code;
    @TableField("name")
    @ApiModelProperty("日历名称")
    private String name;
    @TableField("year")
    @ApiModelProperty("应用年份")
    private Integer year;
    @TableField("status")
    @ApiModelProperty("启用禁用")
    private Integer status;
    @TableField("tenant_id")
    @ApiModelProperty("租户id")
    private String tenantId;
    public static class ProductionCalendarBuilder {
        private String code;
        private String name;
        private Integer year;
        private Integer status;
        private String tenantId;
        ProductionCalendarBuilder() {
        }
        public ProductionCalendarBuilder code(final String code) {
            this.code = code;
            return this;
        }
        public ProductionCalendarBuilder name(final String name) {
            this.name = name;
            return this;
        }
        public ProductionCalendarBuilder year(final Integer year) {
            this.year = year;
            return this;
        }
        public ProductionCalendarBuilder status(final Integer status) {
            this.status = status;
            return this;
        }
        public ProductionCalendarBuilder tenantId(final String tenantId) {
            this.tenantId = tenantId;
            return this;
        }
        public ProductionCalendar build() {
            return new ProductionCalendar(this.code, this.name, this.year, this.status, this.tenantId);
        }
        public String toString() {
            return "ProductionCalendar.ProductionCalendarBuilder(code=" + this.code + ", name=" + this.name + ", year=" + this.year + ", status=" + this.status + ", tenantId=" + this.tenantId + ")";
        }
    }
    public void setCode(final String code) {
        this.code = code;
    }
    public void setName(final String name) {
        this.name = name;
    }
    public void setYear(final Integer year) {
        this.year = year;
    }
    public void setStatus(final Integer status) {
        this.status = status;
    }
    public void setTenantId(final String tenantId) {
        this.tenantId = tenantId;
    }
    public String toString() {
        return "ProductionCalendar(code=" + getCode() + ", name=" + getName() + ", year=" + getYear() + ", status=" + getStatus() + ", tenantId=" + getTenantId() + ")";
    }
    public static ProductionCalendarBuilder builder() {
        return new ProductionCalendarBuilder();
    }
    public ProductionCalendar() {
    }
    public ProductionCalendar(final String code, final String name, final Integer year, final Integer status, final String tenantId) {
        this.code = code;
        this.name = name;
        this.year = year;
        this.status = status;
        this.tenantId = tenantId;
    }
    protected boolean canEqual(final Object other) {
        return other instanceof ProductionCalendar;
    }
    public String getCode() {
        return this.code;
    }
    public String getName() {
        return this.name;
    }
    public Integer getYear() {
        return this.year;
    }
    public Integer getStatus() {
        return this.status;
    }
    public String getTenantId() {
        return this.tenantId;
    }
}
collect/src/main/java/com/qianwen/mdc/collect/entity/mgr/Workstation.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,272 @@
package com.qianwen.mdc.collect.entity.mgr;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import com.qianwen.core.tenant.mp.TenantEntity;
@TableName("blade_workstation")
public class Workstation  extends TenantEntity{// æš‚时不要租户了,就一个tenantid
    private static final long serialVersionUID = -883848031177958203L;
    private String avatar;
    private String code;
    private String name;
    private Integer type;
    @TableField("calendar_code")
    private String calendarCode;
    @TableField("calendar_code_waiting")
    private String calendarCodeWaiting;
    @TableField("standard_efficiency")
    private BigDecimal standardEfficiency;
    private Long productionCapacityGroup;
    public void setAvatar(final String avatar) {
        this.avatar = avatar;
    }
    public void setCode(final String code) {
        this.code = code;
    }
    public void setName(final String name) {
        this.name = name;
    }
    public void setType(final Integer type) {
        this.type = type;
    }
    public void setCalendarCode(final String calendarCode) {
        this.calendarCode = calendarCode;
    }
    public void setCalendarCodeWaiting(final String calendarCodeWaiting) {
        this.calendarCodeWaiting = calendarCodeWaiting;
    }
    public void setStandardEfficiency(final BigDecimal standardEfficiency) {
        this.standardEfficiency = standardEfficiency;
    }
    public void setProductionCapacityGroup(final Long productionCapacityGroup) {
        this.productionCapacityGroup = productionCapacityGroup;
    }
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        }
        if (o instanceof Workstation) {
            Workstation other = (Workstation) o;
            if (other.canEqual(this)) {
                Object this$type = getType();
                Object other$type = other.getType();
                if (this$type == null) {
                    if (other$type != null) {
                        return false;
                    }
                } else if (!this$type.equals(other$type)) {
                    return false;
                }
                Object this$productionCapacityGroup = getProductionCapacityGroup();
                Object other$productionCapacityGroup = other.getProductionCapacityGroup();
                if (this$productionCapacityGroup == null) {
                    if (other$productionCapacityGroup != null) {
                        return false;
                    }
                } else if (!this$productionCapacityGroup.equals(other$productionCapacityGroup)) {
                    return false;
                }
                Object this$avatar = getAvatar();
                Object other$avatar = other.getAvatar();
                if (this$avatar == null) {
                    if (other$avatar != null) {
                        return false;
                    }
                } else if (!this$avatar.equals(other$avatar)) {
                    return false;
                }
                Object this$code = getCode();
                Object other$code = other.getCode();
                if (this$code == null) {
                    if (other$code != null) {
                        return false;
                    }
                } else if (!this$code.equals(other$code)) {
                    return false;
                }
                Object this$name = getName();
                Object other$name = other.getName();
                if (this$name == null) {
                    if (other$name != null) {
                        return false;
                    }
                } else if (!this$name.equals(other$name)) {
                    return false;
                }
                Object this$calendarCode = getCalendarCode();
                Object other$calendarCode = other.getCalendarCode();
                if (this$calendarCode == null) {
                    if (other$calendarCode != null) {
                        return false;
                    }
                } else if (!this$calendarCode.equals(other$calendarCode)) {
                    return false;
                }
                Object this$calendarCodeWaiting = getCalendarCodeWaiting();
                Object other$calendarCodeWaiting = other.getCalendarCodeWaiting();
                if (this$calendarCodeWaiting == null) {
                    if (other$calendarCodeWaiting != null) {
                        return false;
                    }
                } else if (!this$calendarCodeWaiting.equals(other$calendarCodeWaiting)) {
                    return false;
                }
                Object this$standardEfficiency = getStandardEfficiency();
                Object other$standardEfficiency = other.getStandardEfficiency();
                return this$standardEfficiency == null ? other$standardEfficiency == null : this$standardEfficiency.equals(other$standardEfficiency);
            }
            return false;
        }
        return false;
    }
    protected boolean canEqual(final Object other) {
        return other instanceof Workstation;
    }
    public int hashCode() {
        Object $type = getType();
        int result = (1 * 59) + ($type == null ? 43 : $type.hashCode());
        Object $productionCapacityGroup = getProductionCapacityGroup();
        int result2 = (result * 59) + ($productionCapacityGroup == null ? 43 : $productionCapacityGroup.hashCode());
        Object $avatar = getAvatar();
        int result3 = (result2 * 59) + ($avatar == null ? 43 : $avatar.hashCode());
        Object $code = getCode();
        int result4 = (result3 * 59) + ($code == null ? 43 : $code.hashCode());
        Object $name = getName();
        int result5 = (result4 * 59) + ($name == null ? 43 : $name.hashCode());
        Object $calendarCode = getCalendarCode();
        int result6 = (result5 * 59) + ($calendarCode == null ? 43 : $calendarCode.hashCode());
        Object $calendarCodeWaiting = getCalendarCodeWaiting();
        int result7 = (result6 * 59) + ($calendarCodeWaiting == null ? 43 : $calendarCodeWaiting.hashCode());
        Object $standardEfficiency = getStandardEfficiency();
        return (result7 * 59) + ($standardEfficiency == null ? 43 : $standardEfficiency.hashCode());
    }
    public String toString() {
        return "Workstation(avatar=" + getAvatar() + ", code=" + getCode() + ", name=" + getName() + ", type=" + getType() + ", calendarCode=" + getCalendarCode() + ", calendarCodeWaiting=" + getCalendarCodeWaiting() + ", standardEfficiency=" + getStandardEfficiency() + ", productionCapacityGroup=" + getProductionCapacityGroup() + ")";
    }
    public static class WorkstationBuilder {
        private String avatar;
        private String code;
        private String name;
        private Integer type;
        private String calendarCode;
        private String calendarCodeWaiting;
        private BigDecimal standardEfficiency;
        private Long productionCapacityGroup;
        WorkstationBuilder() {
        }
        public WorkstationBuilder avatar(final String avatar) {
            this.avatar = avatar;
            return this;
        }
        public WorkstationBuilder code(final String code) {
            this.code = code;
            return this;
        }
        public WorkstationBuilder name(final String name) {
            this.name = name;
            return this;
        }
        public WorkstationBuilder type(final Integer type) {
            this.type = type;
            return this;
        }
        public WorkstationBuilder calendarCode(final String calendarCode) {
            this.calendarCode = calendarCode;
            return this;
        }
        public WorkstationBuilder calendarCodeWaiting(final String calendarCodeWaiting) {
            this.calendarCodeWaiting = calendarCodeWaiting;
            return this;
        }
        public WorkstationBuilder standardEfficiency(final BigDecimal standardEfficiency) {
            this.standardEfficiency = standardEfficiency;
            return this;
        }
        public WorkstationBuilder productionCapacityGroup(final Long productionCapacityGroup) {
            this.productionCapacityGroup = productionCapacityGroup;
            return this;
        }
        public Workstation build() {
            return new Workstation(this.avatar, this.code, this.name, this.type, this.calendarCode, this.calendarCodeWaiting, this.standardEfficiency, this.productionCapacityGroup);
        }
        public String toString() {
            return "Workstation.WorkstationBuilder(avatar=" + this.avatar + ", code=" + this.code + ", name=" + this.name + ", type=" + this.type + ", calendarCode=" + this.calendarCode + ", calendarCodeWaiting=" + this.calendarCodeWaiting + ", standardEfficiency=" + this.standardEfficiency + ", productionCapacityGroup=" + this.productionCapacityGroup + ")";
        }
    }
    public static WorkstationBuilder builder() {
        return new WorkstationBuilder();
    }
    public Workstation(final String avatar, final String code, final String name, final Integer type, final String calendarCode, final String calendarCodeWaiting, final BigDecimal standardEfficiency, final Long productionCapacityGroup) {
        this.avatar = avatar;
        this.code = code;
        this.name = name;
        this.type = type;
        this.calendarCode = calendarCode;
        this.calendarCodeWaiting = calendarCodeWaiting;
        this.standardEfficiency = standardEfficiency;
        this.productionCapacityGroup = productionCapacityGroup;
    }
    public Workstation() {
    }
    public String getAvatar() {
        return this.avatar;
    }
    public String getCode() {
        return this.code;
    }
    public String getName() {
        return this.name;
    }
    public Integer getType() {
        return this.type;
    }
    public String getCalendarCode() {
        return this.calendarCode;
    }
    public String getCalendarCodeWaiting() {
        return this.calendarCodeWaiting;
    }
    public BigDecimal getStandardEfficiency() {
        return this.standardEfficiency;
    }
    public Long getProductionCapacityGroup() {
        return this.productionCapacityGroup;
    }
}
collect/src/main/java/com/qianwen/mdc/collect/enums/FeedbackTimePointEnum.java
@@ -1,9 +1,24 @@
package com.qianwen.mdc.collect.enums;
/**
 * åé¦ˆæ—¶é—´ç‚¹ç±»åž‹æžšä¸¾
 */
public enum FeedbackTimePointEnum {
    /**
     * 0,非反馈点(普通的采集点/固定点,不是人工反馈的点)
     */
    NO_FEED_BACK_POINT(0, "非反馈点"),
    /**
     * 1,开始时间点(人工反馈)
     */
    START_POINT(1, "开始时间点"),
    /**
     * 2, ç»“束时间点(人工反馈)
     */
    END_POINT(2, "结束时间点"),
    /**
     * 3, äº¤å‰æ—¶é—´ç‚¹ï¼ˆäººå·¥åé¦ˆï¼‰
     */
    CROSS_POINT(3, "交叉时间点");
    
    private final Integer value;
collect/src/main/java/com/qianwen/mdc/collect/handler/DeviceStatusDataHandler.java
@@ -15,7 +15,7 @@
import com.qianwen.mdc.collect.config.IotDBSessionConfig;
import com.qianwen.mdc.collect.constants.IOTDBConstant;
import com.qianwen.mdc.collect.dto.PackedTelemetryData;
import com.qianwen.mdc.collect.entity.iotdb.State;
import com.qianwen.mdc.collect.entity.iotdb.DeviceState;
import com.qianwen.mdc.collect.entity.mgr.GlobalWcsOfRps;
import com.qianwen.mdc.collect.enums.FeedbackTimePointEnum;
import com.qianwen.mdc.collect.service.IotDBCommonService;
@@ -31,7 +31,7 @@
    private IotDBCommonService iotDBCommonService;
    @Override
    public void handleData(PackedTelemetryData data) {
        State state = new State();
        DeviceState state = new DeviceState();
        state.setTime(data.getTime());
        state.setCalendarCode(data.getCalendarCode());
        
@@ -47,7 +47,7 @@
        //WorkstationState propertyData = (WorkstationState) Objects.requireNonNull(BeanUtil.copy(entity, WorkstationState.class));
        state.setValueCollect(Integer.valueOf(data.getValue()));
        state.setWcs(state.getValueCollect());
        state.setWorkstationId(data.getWorkstationId());
        fillWorkStationCondition(data, state);
       
        insertState(state);
@@ -55,7 +55,7 @@
        log.info("状态聚合聚合完成:数据");
    }
    
    private void fillWorkStationCondition(PackedTelemetryData data, State state) {
    private void fillWorkStationCondition(PackedTelemetryData data, DeviceState state) {
        GlobalWcsOfRps wcsOfRps = workstationCache.getWorkstationWcsSetting(data.getWorkstationId(), data.getValue());
        log.info("工况以及绩效信息:{}" ,wcsOfRps);
@@ -65,7 +65,7 @@
       
    }
    
    void insertState(State state){
    void insertState(DeviceState state){
        String deviceId = IOTDBConstant.DB_PREFIX+IOTDBConstant.TEMPLATE_STATE+"_"+state.getWorkstationId();
        try {
            iotDBCommonService.setTemmplateIsNotSet(IOTDBConstant.TEMPLATE_STATE, deviceId);
collect/src/main/java/com/qianwen/mdc/collect/job/StateFixPointJob.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,43 @@
package com.qianwen.mdc.collect.job;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import java.util.Collections;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.mdc.collect.service.DeviceStateFixPointService;
import org.springframework.stereotype.Component;
/*
 * xxlJob æž„建工位状态明日固定点(每小时一个点),外加根据班制和生产日历的时间加入固定点
 */
@Component
public class StateFixPointJob {
    private static final Logger log = LoggerFactory.getLogger(StateFixPointJob.class);
    @Resource
    private DeviceStateFixPointService stateFixPointService;
    @XxlJob("stateFixPointJobHandler")
    public ReturnT<String> stateFixPointJobHandler(String param) throws Exception {
        DateTime dateTime = DateTime.now().offset(DateField.DAY_OF_MONTH, 1);//+1天,即明天的数据
        if (Func.isNotEmpty(param)) {
            dateTime = new DateTime(DateUtil.parse(param));
        }
        try {
            XxlJobLogger.log("设置固定点开始", new Object[]{dateTime.toString()});
            this.stateFixPointService.deviceStateFixPoint(dateTime, Collections.emptyList());
            XxlJobLogger.log("设置固定点结束", new Object[]{dateTime.toString()});
        } catch (Exception ex) {
            log.info("固定打点发生异常" + ex);
        }
        return ReturnT.SUCCESS;
    }
}
collect/src/main/java/com/qianwen/mdc/collect/mapper/iotdb/DeviceStateMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
package com.qianwen.mdc.collect.mapper.iotdb;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qianwen.mdc.collect.entity.iotdb.DeviceState;
import java.util.List;
import org.apache.ibatis.annotations.Param;
@DS("iotdb")
@InterceptorIgnore(tenantLine = "true")
public interface DeviceStateMapper extends BaseMapper<DeviceState> {
    void createSuperTable();
    //void createTable(Long workstationId);
    //int insert(WorkstationState deviceState);
    //int batchInsert(List<WorkstationState> deviceStateList);
    //int batchSave(@Param("workstationId") Long workstationId, @Param("list") List<WorkstationState> list);
    List<DeviceState> getProcessingFeedbackState(@Param("workstationId") Long workstationId);
    DeviceState getLastIsSyncNoFixPointState(@Param("workstationId") Long workstationId);
    DeviceState getLastWorkstationState(@Param("ew") Wrapper query);
    DeviceState getFirstWorkstationState(@Param("ew") Wrapper query);
}
collect/src/main/java/com/qianwen/mdc/collect/mapper/iotdb/ProcessParamMapper.java
@@ -5,14 +5,10 @@
import org.apache.ibatis.annotations.Param;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qianwen.mdc.collect.entity.iotdb.CollectData;
import com.qianwen.mdc.collect.entity.iotdb.Output;
import com.qianwen.mdc.collect.entity.iotdb.ProcessParam;
import com.qianwen.mdc.domain.Machine;
@DS("iotdb")
public interface ProcessParamMapper {//com.qianwen.mdc.collect.mapper.iotdb.OutputMapper
public interface ProcessParamMapper {
    
    List<ProcessParam> mylist(@Param("workstationId") Long workstationId);
collect/src/main/java/com/qianwen/mdc/collect/mapper/mgr/CalendarMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.qianwen.mdc.collect.mapper.mgr;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.qianwen.mdc.collect.dto.CalendarShiftInfoDTO;
import com.qianwen.mdc.collect.entity.mgr.ProductionCalendar;
public interface CalendarMapper extends BaseMapper<ProductionCalendar> {
    //String getShiftIndexNameByCodeAndYear(@Param("calendarCode") String calendarCode, @Param("year") Integer year, @Param("shiftIndex") Integer shiftIndex, @Param("tenantId") String tenantId);
    Long t1();
    List<CalendarShiftInfoDTO> getCalendarShiftInfo(@Param("calendarCodeList") List<String> calendarCodeList, @Param("year") int year, @Param("dateTime") String dateTime);
    List<CalendarShiftInfoDTO> getCalendarShiftInfoToday(@Param("calendarCode") String calendarCode, @Param("dateTime") String dateTime);
}
collect/src/main/java/com/qianwen/mdc/collect/mapper/mgr/WorkstationMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
package com.qianwen.mdc.collect.mapper.mgr;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qianwen.mdc.collect.entity.mgr.Workstation;
public interface WorkstationMapper extends BaseMapper<Workstation> {
}
collect/src/main/java/com/qianwen/mdc/collect/runner/InitRunner.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,64 @@
package com.qianwen.mdc.collect.runner;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Sets;
import java.lang.invoke.SerializedLambda;
import java.time.LocalDate;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.qianwen.mdc.collect.service.DeviceStateFixPointService;
/*
import com.qianwen.core.redis.lock.RedisLock;
import com.qianwen.posting.cache.TimeSliceCache;
import com.qianwen.posting.dto.CacheBuildDTO;
import com.qianwen.posting.entity.tdengine.WorkstationState;
import com.qianwen.posting.mapper.tdengine.WorkstationStateMapper;
import com.qianwen.posting.service.IWorkstationStateFixPointService;
*/
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
@Component
public class InitRunner implements ApplicationRunner {
    private static final Logger log = LoggerFactory.getLogger(InitRunner.class);
    @Resource
    private DeviceStateFixPointService stateFixPointService;
    //@Resource
    //private WorkstationStateMapper workstationStateMapper;
    public void run(ApplicationArguments args) throws Exception {
        /*
        CacheBuildDTO cacheBuildDTO = CacheBuildDTO.builder().tenantIds(Sets.newHashSet(new String[]{"000000"})).targetDate(LocalDate.now()).build();
        TimeSliceCache.build(cacheBuildDTO);
        checkNeedStateFixPoint();
        */
    }
    //@RedisLock("posting:lock:initStateFixPoint")
    public void checkNeedStateFixPoint() {
        DateTime dateTime = DateTime.now();
        log.info("进入程序启动校验是否存在工位打过固定点....... ");
        /*
        Long result = this.workstationStateMapper.selectCount(Wrappers.<WorkstationState>lambdaQuery()
                .eq(WorkstationState::getFactoryDate, Integer.valueOf(DatePattern.PURE_DATE_FORMAT.format(dateTime)))
                .eq(WorkstationState::getIsFixPoint, Boolean.TRUE));
                */
        Long result = 1L;
        if (result == null || result.longValue() <= 0) {
            log.info("工位未打过固定点....... ");
            //this.workStationStateFixPointService.workStationStateFixPoint(dateTime, null);
            stateFixPointService.deviceStateFixPoint(dateTime, null);
            return;
        }
        log.info("工位已存在固定点");
    }
}
collect/src/main/java/com/qianwen/mdc/collect/service/CollectDataService.java
@@ -4,13 +4,14 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Random;
import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.iotdb.isession.pool.SessionDataSetWrapper;
import org.apache.iotdb.rpc.IoTDBConnectionException;
import org.apache.iotdb.rpc.StatementExecutionException;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.read.common.RowRecord;
import org.apache.iotdb.tsfile.write.record.Tablet;
import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
import org.slf4j.Logger;
@@ -18,10 +19,10 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.qianwen.mdc.collect.config.IotDBSessionConfig;
import com.qianwen.mdc.collect.domain.TelemetryData;
import com.qianwen.mdc.collect.domain.TelemetryDataItem;
import com.qianwen.mdc.collect.entity.iotdb.CollectData;
import com.qianwen.mdc.collect.utils.redis.RedisUtil;
/**
@@ -90,7 +91,7 @@
            List<TypedTelemetryData> typeList = processParamsMap.get(name);
            
            deviceId = generateDeviceId(dt.getWorkstationId(),name);
            System.out.println("deivcdid="+deviceId);
            //System.out.println("deivcdid="+deviceId);
            iotDBCommonService.setTemmplateIsNotSet(TEMPLATE_NAME, deviceId);
            Tablet tablet = new Tablet(deviceId, schemas);
            for(TypedTelemetryData tdata : typeList) {
@@ -103,41 +104,101 @@
            
            try {
                iotdbConfig.getSessionPool().insertAlignedTablet(tablet);
                updateLastParam(dt.getWorkstationId(),typeList);
            } catch (Exception e) {
                log.error("IOTDB入库失败",e);
                e.printStackTrace();
            }
            //System.out.println(typeList);
        }
        /*
        for (TelemetryDataItem dataItem : dt.getDataItems()) {
            for (Map<String, String> point : dataItem.getDataPoints()) {
                String[] keys = point.keySet().toArray(new String[0]);
                for(int i=0;i<keys.length;i++) {
                    rowIndex = tablet.rowSize++;
                    tablet.addTimestamp(rowIndex, dataItem.getTime());
                    tablet.addValue("workstation_id",rowIndex,new Long(dt.getWorkstationId()));
                    propertyName = keys[i];
                    deviceId = generateDeviceId(dt.getWorkstationId(),propertyName);//DB_PREFIX+TEMPLATE_NAME + "_" + dt.getWorkstationId()+"_"+propertyName;
                    tablet.addValue("n",rowIndex,propertyName);
                    tablet.addValue("v",rowIndex,point.get(propertyName));
                }
            }
            try {
                iotdbConfig.getSessionPool().insertAlignedTablet(tablet);
            } catch (Exception e) {
                log.error("IOTDB入库失败",e);
                e.printStackTrace();
            }
        }
        */
    }
    
    /**
     * å¡«å……最新参数的数据
     * @param typeList
     * @throws StatementExecutionException
     * @throws IoTDBConnectionException
     */
    void updateLastParam(long workstationId,List<TypedTelemetryData> typeList) throws IoTDBConnectionException, StatementExecutionException {
        if(typeList.isEmpty()){
            return;
        }
        long updateTime = typeList.get(0).getTime();
        List<MeasurementSchema> schemas = new ArrayList<>();
        schemas.add(new MeasurementSchema("update_time", TSDataType.INT64));
        schemas.add(new MeasurementSchema("workstation_id", TSDataType.INT64));
        schemas.add(new MeasurementSchema("param_json", TSDataType.TEXT));
        Tablet tablet = new Tablet("root.f2.last_process_param", schemas);
        for(TypedTelemetryData tdata: typeList) {
        }
        String sql = "select update_time,workstation_id,param_json from root.f2.last_process_param where workstation_id="+workstationId;
        SessionDataSetWrapper dsw = iotdbConfig.getSessionPool().executeQueryStatement(sql);
        if(dsw.hasNext()) {
            RowRecord rec = dsw.next();
            long time = rec.getTimestamp();
            String paramJsonStr = rec.getFields().get(2).getStringValue();
            tablet.rowSize = 1;
            tablet.addTimestamp(0, time);
            tablet.addValue("update_time", 0, updateTime);
            tablet.addValue("workstation_id", 0, workstationId);
            JSONObject paramObj = JSONObject.parseObject(paramJsonStr);
            for(TypedTelemetryData tdata: typeList) {
                if(paramObj.containsKey(tdata.getName())) {
                    JSONObject itemObj = paramObj.getJSONObject(tdata.getName());
                    itemObj.put("value", tdata.getValue());
                    itemObj.put("time", tdata.getTime());//采集时间
                    paramObj.put(tdata.getName(), itemObj);
                }else {
                    JSONObject itemObj = new JSONObject();
                    itemObj.put("value", tdata.getValue());
                    itemObj.put("time", tdata.getTime());//采集时间
                    paramObj.put(tdata.getName(), itemObj);
                }
            }
            tablet.addValue("param_json", 0, paramObj.toJSONString());
            this.iotdbConfig.getSessionPool().insertAlignedTablet(tablet);
        }else {
            //没数据,新加入一条
            tablet.rowSize = 1;
            tablet.addTimestamp(0, updateTime);
            tablet.addValue("update_time", 0, updateTime);
            tablet.addValue("workstation_id", 0, workstationId);
            JSONObject paramObj = new JSONObject();
            for(TypedTelemetryData tdata: typeList) {
                JSONObject itemObj = new JSONObject();
                itemObj.put("value", tdata.getValue());
                itemObj.put("time", tdata.getTime());//采集时间
                paramObj.put(tdata.getName(), itemObj);
            }
            tablet.addValue("param_json", 0,paramObj.toJSONString());
            this.iotdbConfig.getSessionPool().insertAlignedTablet(tablet);
        }
    }
    /**
     * è§£æžæ•°æ®ï¼Œå½¢æˆname - value对类型的数据列表,并用name进行分组
     * @param dt
     * @return æŒ‰name分组后的数据
     */
    Map<String, List<TypedTelemetryData>> parseTelemetryToTypedMapList(TelemetryData dt){
        List<TypedTelemetryData> list = new ArrayList<>();
        
collect/src/main/java/com/qianwen/mdc/collect/service/DeviceStateFixPointService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,249 @@
package com.qianwen.mdc.collect.service;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.core.tool.utils.SpringUtil;
import com.qianwen.mdc.collect.cache.WorkstationCache;
import com.qianwen.mdc.collect.constants.CommonConstant;
import com.qianwen.mdc.collect.dto.CalendarShiftInfoDTO;
import com.qianwen.mdc.collect.dto.WorkstationDTO;
import com.qianwen.mdc.collect.entity.iotdb.DeviceState;
import com.qianwen.mdc.collect.enums.FeedbackTimePointEnum;
import com.qianwen.mdc.collect.mapper.iotdb.DeviceStateMapper;
import com.qianwen.mdc.collect.mapper.mgr.CalendarMapper;
import com.qianwen.mdc.collect.utils.LocalDateTimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class DeviceStateFixPointService{
    private static final Logger log = LoggerFactory.getLogger(DeviceStateFixPointService.class);
    @Autowired
    private DeviceStateMapper deviceStateMapper;
    @Autowired
    private CalendarMapper calendarMapper;
    @Autowired
    private WorkstationCache workstationCache;
    /**
     * åŠ å…¥å›ºå®šç‚¹,原workStationStateFixPoint
     * @param dateTime
     * @param includeWorkstationIds
     */
    public void deviceStateFixPoint(DateTime dateTime, List<String> includeWorkstationIds) {
        List<DeviceState> result;
        //CalendarMapper calendarMapper = SpringUtil.getBean(CalendarMapper.class);
        Map<Long, WorkstationDTO> workStations = workstationCache.getWorkStations();
        if (ObjectUtil.isEmpty(workStations)) {
            return;
        }
        Collection<WorkstationDTO> values = workStations.values();
        //boolean b = ObjectUtil.isAllNotEmpty(includeWorkstationIds);//yys
        //boolean b2 = Func.isNotEmpty(includeWorkstationIds);
        if (ObjectUtil.isNotEmpty(includeWorkstationIds)) {
            /*
            values = (Collection) values.stream().filter(item -> {
                return includeWorkstationIds.contains(item.getId().toString());
            }).collect(Collectors.toList());*/
            values = values.stream().filter(item -> includeWorkstationIds.contains(item.getId().toString())).collect(Collectors.toList());
        }
        List<String> calendarCodeList = workStations.values().stream().map(WorkstationDTO::getCalendarCode).distinct().filter(Func::isNotEmpty).collect(Collectors.toList());
        /*
        List<String> calendarCodeList = (List) workStations.values().stream().map((v0) -> {
            return v0.getCalendarCode();
        }).distinct().filter((v0) -> {
            return Func.isNotEmpty(v0);
        }).collect(Collectors.toList());*/
        Map<String, List<CalendarShiftInfoDTO>> map = new HashMap<>(32);
        String formatDateTime = DateUtil.formatDate(dateTime);
        if (Func.isNotEmpty(calendarCodeList)) {
            /*
            List<CalendarShiftInfoDTO> calendarShiftInfoDTOList = calendarMapper.getCalendarShiftInfo(calendarCodeList, DateUtil.year(dateTime), formatDateTime);
            map = (Map) calendarShiftInfoDTOList.stream().collect(Collectors.groupingBy((v0) -> {
                return v0.getCode();
            }));*/
            List<CalendarShiftInfoDTO> calendarShiftInfoDTOList = calendarMapper.getCalendarShiftInfo(calendarCodeList, DateUtil.year(dateTime), formatDateTime);
            map = calendarShiftInfoDTOList.stream().collect(Collectors.groupingBy(CalendarShiftInfoDTO::getCode));
        }
        List<DeviceState> res = Lists.newArrayList();
        for (WorkstationDTO workstationDTO : values) {
            result = Lists.newArrayList();
            List<CalendarShiftInfoDTO> list = map.getOrDefault(workstationDTO.getCalendarCode(), Collections.singletonList(new CalendarShiftInfoDTO().setCode("0").setCalendarDay(formatDateTime).setFactoryYear(Integer.valueOf(DateUtil.year(dateTime))).setFactoryWeek(LocalDateTimeUtils.getWeek(dateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate())).setFactoryMonth(Integer.valueOf(DateUtil.month(dateTime) + 1)).setFactoryDate(formatDateTime).setStartTime(DateUtil.beginOfDay(dateTime)).setShiftIndex(CommonConstant.DEFAULT_SHIFT_INDEX).setShiftTimeType(CommonConstant.DEFAULT_SHIFT_TYPE)));
            if (map.containsKey(workstationDTO.getCalendarCode())) {
                result = getNoDefaultShift24HourPointDTOS(workstationDTO.getId(), workstationDTO.getCalendarCode(), dateTime);
            } else {
                result = getDefaultShift24HourPointDTOS(workstationDTO.getId(), workstationDTO.getCalendarCode(), list.get(0));
            }
            //将生产日历中的时间节点加入固定点
            for (int i = 0; i < list.size(); i++) {
                //DeviceState workstationState = WorkstationStateConvert.INSTANCE.convert(list.get(i));
                CalendarShiftInfoDTO calendarShiftDTO = list.get(i);
                DeviceState workstationState = new DeviceState();
                workstationState.setIsSync(false);
                workstationState.setIsFixPoint(true);
                workstationState.setValueCollect(0);
                workstationState.setRps(0);
                workstationState.setWcs(0);
                workstationState.setWorkstationId(workstationDTO.getId());
                workstationState.setTime(Long.valueOf(calendarShiftDTO.getStartTime().getTime()));
                workstationState.setIsDeleted(Boolean.FALSE);
                workstationState.setFeedbackPointType(FeedbackTimePointEnum.NO_FEED_BACK_POINT.getValue());
                workstationState.setCalendarCode(workstationDTO.getCalendarCode());
                String factoryDate = calendarShiftDTO.getFactoryDate();
                String[] split = Func.split(factoryDate, "-");
                workstationState.setFactoryDate(Integer.valueOf(String.join("", split)));
                workstationState.setFactoryYear(calendarShiftDTO.getFactoryYear());
                workstationState.setFactoryMonth(calendarShiftDTO.getFactoryMonth());
                workstationState.setFactoryWeek(calendarShiftDTO.getFactoryWeek());
                workstationState.setShiftIndex(calendarShiftDTO.getShiftIndex());
                workstationState.setShiftTimeType(calendarShiftDTO.getShiftTimeType());
               // buildDefaultFactoryDay(dateTime, workstationState);
                result.add(workstationState);
            }
            res.addAll(result);
        }
        /*
        Map<Long, List<DeviceState>> collect = res.stream().distinct().collect(Collectors.groupingBy(DeviceState::getWorkstationId));
        collect.forEach((k, v) -> this.workstationStateMapper.batchSave(k, v));
        */
        //res.stream().distinct().collect(Collectors.toList())
        saveDeviceStates(res);
    }
    void saveDeviceStates(List<DeviceState> stateList) {
    }
    private List<DeviceState> getDefaultShift24HourPointDTOS(Long workStationId, String calendarCode, CalendarShiftInfoDTO shift) {
        List<DeviceState> default24HourPointDTO = new ArrayList<>();
        String factoryDate = shift.getFactoryDate();
        String[] split = Func.split(factoryDate, "-");
        int year = Integer.parseInt(split[0]);
        int month = Integer.parseInt(split[1]);
        int day = Integer.parseInt(split[2]);
        for (int i = 1; i < 24; i++) {
            LocalDateTime time = LocalDateTime.of(year, month, day, i, 0, 0);
            //WorkstationState state = WorkstationStateConvert.INSTANCE.convert(shift);
            DeviceState state = new DeviceState();
            state.setIsSync(false);
            state.setIsFixPoint(true);
            state.setValueCollect(0);
            state.setRps(0);
            state.setWcs(0);
            state.setWorkstationId(workStationId);
            state.setTime(Long.valueOf(time.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
            state.setCalendarCode(calendarCode);
            state.setFeedbackPointType(FeedbackTimePointEnum.NO_FEED_BACK_POINT.getValue());
            state.setFactoryDate(Integer.valueOf(String.join("", Func.split(shift.getFactoryDate(), "-"))));
            state.setFactoryYear(shift.getFactoryYear());
            state.setFactoryMonth(shift.getFactoryMonth());
               state.setFactoryWeek(shift.getFactoryWeek());
            state.setShiftIndex(shift.getShiftIndex());
            state.setShiftTimeType(shift.getShiftTimeType());
            //workstationState.setShiftIndex(calendarShiftDTO.getShiftIndex());
            state.setIsDeleted(Boolean.FALSE);
            default24HourPointDTO.add(state);
        }
        return default24HourPointDTO;
    }
    private List<DeviceState> getNoDefaultShift24HourPointDTOS(Long workStationId, String calendarCode, DateTime dateTime) {
        List<DeviceState> default24HourPointDTO = new ArrayList<>();
        CalendarMapper calendarMapper = (CalendarMapper) SpringUtil.getBean(CalendarMapper.class);
        try {
            List<CalendarShiftInfoDTO> calendarShiftList = calendarMapper.getCalendarShiftInfoToday(calendarCode, DateUtil.formatDate(dateTime));
            for (int i = 0; i < 24; i++) {
                LocalDateTime time = LocalDateTime.of(dateTime.year(), dateTime.month() + 1, dateTime.dayOfMonth(), i, 0, 0);//每小时0分0秒
                DeviceState state = new DeviceState();
                state.setIsSync(false);
                state.setIsFixPoint(true);
                state.setValueCollect(0);
                state.setRps(0);
                state.setWcs(0);
                state.setWorkstationId(workStationId);
                state.setTime(Long.valueOf(time.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
                state.setCalendarCode(calendarCode);
                state.setFeedbackPointType(FeedbackTimePointEnum.NO_FEED_BACK_POINT.getValue());
                state.setIsDeleted(Boolean.FALSE);
              //如果state.ts在calendarShiftList区间内,则填充班制和生产日历信息,并将state加入到default24HourPointDTO中
                packCalendarShiftInfoForTimePoint(calendarShiftList, default24HourPointDTO, state);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return default24HourPointDTO;
    }
    private void packCalendarShiftInfoForTimePoint(List<CalendarShiftInfoDTO> calendarShiftList, List<DeviceState> default24HourPointDTO, DeviceState state) {
        if (Func.isNotEmpty(calendarShiftList)) {
            CalendarShiftInfoDTO relatedShift = calendarShiftList.stream().filter(item -> {
                return item.getStartTime().getTime() <= state.getTime().longValue() && item.getEndTime().getTime() > state.getTime().longValue();
            }).findFirst().orElse(null);
            if (Func.isNotEmpty(relatedShift)) {
                state.setShiftIndex(relatedShift.getShiftIndex());
                state.setShiftTimeType(relatedShift.getShiftTimeType());
                state.setFactoryYear(relatedShift.getFactoryYear());
                state.setFactoryMonth(relatedShift.getFactoryMonth());
                state.setFactoryWeek(relatedShift.getFactoryWeek());
                String factoryDate = relatedShift.getFactoryDate();
                String[] split = Func.split(factoryDate, "-");
                state.setFactoryDate(Integer.valueOf(String.join("", split)));
                state.setIsDeleted(Boolean.FALSE);
                default24HourPointDTO.add(state);
                return;
            }
            log.error("工位{} æ—¥åކ{} æ²¡æœ‰æ•´ç‚¹å¾—班次信息", state.getWorkstationId(), state.getCalendarCode());
            return;
        }
        log.error("工位{} æ—¥åކ{} æ²¡æœ‰è‡ªç„¶å¤©{}得班次信息", new Object[]{state.getWorkstationId(), state.getCalendarCode(), state.getTime()});
    }
    //不一定能用上
    private void buildDefaultFactoryDay(DateTime dateTime, DeviceState workstationState) {
        if ("#default#".equals(workstationState.getCalendarCode()) && Func.isEmpty(workstationState.getFactoryMonth())) {
            workstationState.setFactoryYear(Integer.valueOf(DateUtil.year(dateTime)));
            workstationState.setFactoryWeek(LocalDateTimeUtils.getWeek(dateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()));
            workstationState.setFactoryMonth(Integer.valueOf(DateUtil.month(dateTime) + 1));
            workstationState.setFactoryDate(Integer.valueOf(DatePattern.PURE_DATE_FORMAT.format(dateTime)));
            workstationState.setTime(Long.valueOf(DateUtil.beginOfDay(dateTime).getTime()));
            workstationState.setShiftIndex(CommonConstant.DEFAULT_SHIFT_INDEX);
            workstationState.setShiftTimeType(CommonConstant.DEFAULT_SHIFT_TYPE);
            workstationState.setFeedbackPointType(FeedbackTimePointEnum.NO_FEED_BACK_POINT.getValue());
            workstationState.setIsDeleted(Boolean.FALSE);
        }
    }
}
collect/src/main/java/com/qianwen/mdc/collect/service/IOTMqttReceiveService.java
@@ -87,10 +87,7 @@
    }
    
    public long getWorkstationIdByAppId(String appId) {
        /**
         * 1656818952295661569 461
1656819188967653378  462
         */
        Object wid = redisUtil.hget("workstation-appid-map", appId);
        String workstationId = String.valueOf(Optional.ofNullable(wid).orElse("-1"));
    
collect/src/main/java/com/qianwen/mdc/collect/service/WorkstationService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,81 @@
package com.qianwen.mdc.collect.service;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.lang.invoke.SerializedLambda;
import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.qianwen.core.mp.base.BaseServiceImpl;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.mdc.collect.entity.mgr.Workstation;
import com.qianwen.mdc.collect.mapper.mgr.WorkstationMapper;
/*
import com.qianwen.posting.cache.WorkstationCache;
import com.qianwen.posting.constant.CommonConstant;
import com.qianwen.posting.dto.CalendarShiftInfoDTO;
import com.qianwen.posting.entity.mysql.Workstation;
import com.qianwen.posting.mapper.mysql.CalendarMapper;
import com.qianwen.posting.mapper.mysql.WorkstationMapper;
import com.qianwen.posting.service.IWorkstationService;
import com.qianwen.posting.utils.LocalDateTimeUtils;
*/
import org.springframework.stereotype.Service;
@Service
public class WorkstationService extends BaseServiceImpl<WorkstationMapper, Workstation>{
    //private final CalendarMapper calendarMapper;
    //BaseEntity a;
    /*
    @Override
    public void updateWorkStationCalendar() {
        List<Workstation> list = list((Wrapper) new QueryWrapper().lambda().isNotNull((v0) -> {
            return v0.getCalendarCodeWaiting();
        }));
        List<Workstation> workstationList = new ArrayList<>();
        if (Func.isNotEmpty(list)) {
            list.stream().filter(workStation -> {
                return Func.isNotEmpty(workStation.getCalendarCodeWaiting());
            }).forEach(workStation2 -> {
                workStation2.setCalendarCode(workStation2.getCalendarCodeWaiting());
                workStation2.setCalendarCodeWaiting("");
                workstationList.add(workStation2);
            });
        }
        updateBatchById(workstationList);
        WorkstationCache.clearWorkStationCache();
    }
    @Override
    public CalendarShiftInfoDTO getCalendarShiftInfoForWorkstation(Long workstationId, Date date) {
        Workstation workstationInfo = (Workstation) getById(workstationId);
        CalendarShiftInfoDTO result = null;
        if (Func.isNotEmpty(workstationInfo) && !"#default#".equals(workstationInfo.getCalendarCode())) {
            List<CalendarShiftInfoDTO> calendarShiftInfoDTOList = this.calendarMapper.getCalendarShiftInfoToday(workstationInfo.getCalendarCode(), DateUtil.formatDate(date));
            if (Func.isNotEmpty(calendarShiftInfoDTOList)) {
                CalendarShiftInfoDTO relatedShift = calendarShiftInfoDTOList.stream().filter(x -> {
                    return x.getStartTime().getTime() <= date.getTime() && x.getEndTime().getTime() >= date.getTime();
                }).findFirst().orElse(null);
                if (Func.isNotEmpty(relatedShift)) {
                    result.setCode(relatedShift.getCode());
                    result.setFactoryDate(relatedShift.getFactoryDate()).setFactoryYear(relatedShift.getFactoryYear()).setFactoryWeek(relatedShift.getFactoryWeek()).setFactoryMonth(relatedShift.getFactoryMonth()).setShiftIndex(relatedShift.getShiftIndex()).setShiftTimeType(result.getShiftTimeType());
                }
            }
        }
        if (Func.isEmpty((Object) null)) {
            result = new CalendarShiftInfoDTO();
            LocalDate localDate = Instant.ofEpochMilli(date.getTime()).atZone(ZoneOffset.systemDefault()).toLocalDate();
            result.setCode("#default#");
            result.setFactoryDate(DatePattern.PURE_DATE_FORMAT.format(date)).setFactoryYear(Integer.valueOf(DateUtil.year(date))).setFactoryWeek(LocalDateTimeUtils.getWeek(localDate)).setFactoryMonth(Integer.valueOf(DateUtil.month(date) + 1)).setShiftIndex(CommonConstant.DEFAULT_SHIFT_INDEX).setShiftTimeType(CommonConstant.DEFAULT_SHIFT_TYPE);
        }
        return result;
    }
    */
}
collect/src/main/java/com/qianwen/mdc/collect/utils/LocalDateTimeUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,139 @@
package com.qianwen.mdc.collect.utils;
import java.time.DayOfWeek;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Period;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalAdjusters;
import java.time.temporal.TemporalUnit;
import java.time.temporal.WeekFields;
import java.util.Date;
public class LocalDateTimeUtils {
    public static String pattern = "yyyy-MM-dd";
    public static Long getSecondsByTime(LocalDateTime time) {
        return Long.valueOf(time.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond());
    }
    public static String formatTime(LocalDateTime time, String pattern2) {
        return time.format(DateTimeFormatter.ofPattern(pattern2));
    }
    public static String formatTimeLocalDate(LocalDate date, String pattern2) {
        return date.format(DateTimeFormatter.ofPattern(pattern2));
    }
    public static String formatNow(String pattern2) {
        return formatTime(LocalDateTime.now(), pattern2);
    }
    public static LocalDateTime plus(LocalDate localDate, long number, TemporalUnit field) {
        return localDate.atStartOfDay().plus(number, field);
    }
    public static Integer getWeek(LocalDate time) {
        WeekFields weekFields = WeekFields.of(DayOfWeek.MONDAY, 1);
        return Integer.valueOf(time.get(weekFields.weekOfYear()));
    }
    public static Integer getMonth(LocalDate time) {
        return Integer.valueOf(time.getMonth().getValue());
    }
    public static Integer getYear(LocalDate time) {
        return Integer.valueOf(time.getYear());
    }
    public static long betweenTwoTime(LocalDateTime startTime, LocalDateTime endTime, ChronoUnit field) {
        Period period = Period.between(LocalDate.from((TemporalAccessor) startTime), LocalDate.from((TemporalAccessor) endTime));
        if (field == ChronoUnit.YEARS) {
            return period.getYears();
        }
        if (field == ChronoUnit.MONTHS) {
            return (period.getYears() * 12) + period.getMonths();
        }
        return field.between(startTime, endTime);
    }
    public static LocalDateTime getDayStart(LocalDateTime time) {
        return time.withHour(0).withMinute(0).withSecond(0).withNano(0);
    }
    public static LocalDateTime getDayEnd(LocalDateTime time) {
        return time.withHour(23).withMinute(59).withSecond(59).withNano(999999999);
    }
    public static Integer getDayOfYear(Integer year) {
        return Integer.valueOf(LocalDate.of(year.intValue(), 1, 1).isLeapYear() ? 366 : 365);
    }
    public static Integer getDifference(LocalDate startDate, LocalDate endDate) {
        Long l = Long.valueOf(endDate.toEpochDay() - startDate.toEpochDay());
        Integer difference = Integer.valueOf(Integer.parseInt(l.toString()));
        return difference;
    }
    public static LocalDate getLastDayOfYear(LocalDate date) {
        LocalDate lastDayOfYear = date.with(TemporalAdjusters.lastDayOfYear());
        return lastDayOfYear;
    }
    public static Date LocalDateTimeToDate(LocalDateTime localDateTime) {
        ZoneId zoneId = ZoneId.systemDefault();
        ZonedDateTime zdt = localDateTime.atZone(zoneId);
        Date date = Date.from(zdt.toInstant());
        return date;
    }
    public static Date LocalDateToDate(LocalDate localDate) {
        ZoneId zone = ZoneId.systemDefault();
        Instant instant = localDate.atStartOfDay().atZone(zone).toInstant();
        Date date = Date.from(instant);
        return date;
    }
    public static Date LocalTimeToDate(LocalTime localTime) {
        LocalDate localDate = LocalDate.now();
        LocalDateTime localDateTime = LocalDateTime.of(localDate, localTime);
        ZoneId zone = ZoneId.systemDefault();
        Instant instant = localDateTime.atZone(zone).toInstant();
        Date date = Date.from(instant);
        return date;
    }
    public static LocalDateTime DateToLocalDateTime(Date date) {
        Instant instant = date.toInstant();
        ZoneId zone = ZoneId.systemDefault();
        LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
        return localDateTime;
    }
    public static LocalDate DateToLocalDate(Date date) {
        Instant instant = date.toInstant();
        ZoneId zone = ZoneId.systemDefault();
        LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
        LocalDate localDate = localDateTime.toLocalDate();
        return localDate;
    }
    public static LocalTime DateToLocalTime(Date date) {
        Instant instant = date.toInstant();
        ZoneId zone = ZoneId.systemDefault();
        LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
        LocalTime localTime = localDateTime.toLocalTime();
        return localTime;
    }
    public static LocalDateTime parseLocalDateTime(String time) {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        return LocalDateTime.of(LocalDate.parse(time, formatter), LocalTime.MIN);
    }
}
collect/src/main/java/com/qianwen/mdc/collect/utils/SpringUtil.java
ÎļþÒÑɾ³ý
collect/src/main/java/com/qianwen/mdc/collect/utils/redis/RedisUtil.java
@@ -212,7 +212,7 @@
     * @param value å€¼
     * @return true æˆåŠŸ false失败
     */
    public boolean hset(String key, String item, Object value) {
    public boolean hset(String key, Object item, Object value) {
        try {
            redisTemplate.opsForHash().put(key, item, value);
            return true;
collect/src/main/java/com/qianwen/mdc/collector/DataCollector.java
ÎļþÒÑɾ³ý
collect/src/main/java/com/qianwen/mdc/domain/Machine.java
ÎļþÒÑɾ³ý
collect/src/main/resources/application.yml
@@ -2,6 +2,8 @@
  port: 8099
spring:
  application:
    name: qwcollect
  profiles:
    active: dev
  datasource:
collect/src/main/resources/com/qianwen/mdc/collect/mapper/iotdb/OutputMapper.xml
collect/src/main/resources/com/qianwen/mdc/collect/mapper/iotdb/ProcessParamMapper.xml
collect/src/main/resources/com/qianwen/mdc/collect/mapper/mgr/CalendarMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,105 @@
<?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.qianwen.mdc.collect.mapper.mgr.CalendarMapper">
    <select id="getCalendarShiftInfo" resultType="com.qianwen.mdc.collect.dto.CalendarShiftInfoDTO">
        SELECT pc.CODE AS code,
        pcd.YEAR AS factoryYear,
        pcd.WEEK AS factoryWeek,
        pcd.MONTH AS factoryMonth,
        pcd.calendar_date AS factoryDate,
        pcd.start_time AS startTime,
        pcd.end_time AS endTime,
        DATE_FORMAT(pcd.start_time, '%Y-%m-%d') AS calendarDay,
        pcd.shift_index AS shiftIndex,
        pcd.shift_type AS shiftTimeType
        FROM blade_production_calendar pc
        INNER JOIN blade_production_calendar_daytime pcd ON pc.id = pcd.calendar_id
        WHERE pc.YEAR = #{year}
        and DATE_FORMAT(pcd.start_time, '%Y-%m-%d') = #{dateTime}
        and pc.is_deleted = 0
        and code in
        <foreach collection="calendarCodeList" item="code" open="(" separator="," close=")">
            #{code}
        </foreach>
    </select>
    <!--
    <select id="getCalendarShiftInfo" resultType="com.qianwen.mdc.collect.dto.CalendarShiftInfoDTO" databaseId="oracle">
        SELECT pc.CODE AS code,
        pcd.YEAR AS factoryYear,
        pcd.WEEK AS factoryWeek,
        pcd.MONTH AS factoryMonth,
        to_char(pcd.calendar_date,'yyyy-mm-dd') AS factoryDate,
        pcd.start_time AS startTime,
        pcd.end_time AS endTime,
        to_char(pcd.start_time, 'yyyy-mm-dd') AS calendarDay,
        pcd.shift_index AS shiftIndex,
        pcd.shift_type AS shiftTimeType
        FROM blade_production_calendar pc
        INNER JOIN prod_calendar_daytime pcd ON pc.id = pcd.calendar_id
        WHERE pc.YEAR = #{year}
        and to_char(pcd.start_time, 'yyyy-mm-dd') = #{dateTime}
        and pc.is_deleted = 0
        and code in
        <foreach collection="calendarCodeList" item="code" open="(" separator="," close=")">
            #{code}
        </foreach>
    </select>
 -->
    <!--
    <select id="getShiftIndexNameByCodeAndYear" resultType="java.lang.String">
        SELECT distinct pc.id, pc.CODE, sd.index_name
        FROM blade_production_calendar pc
                 LEFT JOIN blade_production_calendar_day pdc ON pc.id = pdc.calendar_id AND pdc.is_deleted = 0
                 LEFT JOIN blade_shift_detail sd on pdc.model_id = sd.model_id
        WHERE pc.CODE = #{calendarCode}
          AND pc.YEAR = #{year}
          AND pc.tenant_id = #{tenantId}
          AND sd.shift_index = #{shiftIndex}
          AND pc.is_deleted = 0
    </select>
 -->
    <select id="t1" resultType="java.lang.Long" >
        SELECT 1 from dual
    </select>
    <select id="getCalendarShiftInfoToday" resultType="com.qianwen.mdc.collect.dto.CalendarShiftInfoDTO" >
        SELECT pc.CODE AS code,
               pcd.YEAR AS factoryYear,
               pcd.WEEK AS factoryWeek,
               pcd.MONTH AS factoryMonth,
               pcd.calendar_date AS factoryDate,
               pcd.start_time AS startTime,
               pcd.end_time AS endTime,
               DATE_FORMAT(pcd.start_time, '%Y-%m-%d') AS calendarDay,
               pcd.shift_index AS shiftIndex,
               pcd.shift_type AS shiftTimeType
        FROM blade_production_calendar pc
                 INNER JOIN blade_production_calendar_daytime pcd ON pc.id = pcd.calendar_id
        WHERE
            (DATE_FORMAT(pcd.start_time,'%Y-%m-%d')=#{dateTime} or DATE_FORMAT(pcd.end_time,'%Y-%m-%d')=#{dateTime})
          and pc.is_deleted = 0
          and code =#{calendarCode}
    </select>
    <!--
    <select id="getCalendarShiftInfoToday" resultType="com.qianwen.mdc.collect.dto.CalendarShiftInfoDTO"  databaseId="oracle">
        SELECT pc.CODE AS code,
               pcd.YEAR AS factoryYear,
               pcd.WEEK AS factoryWeek,
               pcd.MONTH AS factoryMonth,
               to_char(pcd.calendar_date,'yyyy-mm-dd') AS factoryDate,
               pcd.start_time AS startTime,
               pcd.end_time AS endTime,
               to_char(pcd.start_time, 'yyyy-mm-dd') AS calendarDay,
               pcd.shift_index AS shiftIndex,
               pcd.shift_type AS shiftTimeType
        FROM blade_production_calendar pc
                 INNER JOIN blade_production_calendar_daytime pcd ON pc.id = pcd.calendar_id
        WHERE
            (to_char(pcd.start_time, 'yyyy-mm-dd') = #{dateTime} or  to_char(pcd.end_time, 'yyyy-mm-dd') = #{dateTime})
          and pc.is_deleted = 0
          and code =#{calendarCode}
    </select>
 -->
</mapper>
collect/src/main/resources/mapper/MachineMapper.xml
ÎļþÒÑɾ³ý
collect/src/main/resources/nativelib/focas/Fwlib32.dll
Binary files differ
collect/src/main/resources/nativelib/focas/Fwlib64.dll
Binary files differ
collect/src/main/resources/nativelib/focas/HxFocasApi.dll
Binary files differ
collect/src/main/resources/nativelib/focas/HxFocasApi.lib
Binary files differ
collect/src/main/resources/nativelib/focas/fwlibe1.dll
Binary files differ
collect/src/main/resources/nativelib/focas/fwlibe64.dll
Binary files differ
collect/src/test/java/com/qianwen/mdc/collect/service/CollectDataServiceTest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package com.qianwen.mdc.collect.service;
import org.junit.jupiter.api.Test;
public class CollectDataServiceTest {
    @Test
    public void t1() {
        System.out.println(System.currentTimeMillis());
    }
}
mvnw
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,310 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
#   JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
#   M2_HOME - location of maven2's installed home dir
#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
#     e.g. to debug Maven itself, use
#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
  if [ -f /etc/mavenrc ] ; then
    . /etc/mavenrc
  fi
  if [ -f "$HOME/.mavenrc" ] ; then
    . "$HOME/.mavenrc"
  fi
fi
# OS specific support.  $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
  CYGWIN*) cygwin=true ;;
  MINGW*) mingw=true;;
  Darwin*) darwin=true
    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
    if [ -z "$JAVA_HOME" ]; then
      if [ -x "/usr/libexec/java_home" ]; then
        export JAVA_HOME="`/usr/libexec/java_home`"
      else
        export JAVA_HOME="/Library/Java/Home"
      fi
    fi
    ;;
esac
if [ -z "$JAVA_HOME" ] ; then
  if [ -r /etc/gentoo-release ] ; then
    JAVA_HOME=`java-config --jre-home`
  fi
fi
if [ -z "$M2_HOME" ] ; then
  ## resolve links - $0 may be a link to maven's home
  PRG="$0"
  # need this for relative symlinks
  while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
      PRG="$link"
    else
      PRG="`dirname "$PRG"`/$link"
    fi
  done
  saveddir=`pwd`
  M2_HOME=`dirname "$PRG"`/..
  # make it fully qualified
  M2_HOME=`cd "$M2_HOME" && pwd`
  cd "$saveddir"
  # echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
  [ -n "$M2_HOME" ] &&
    M2_HOME=`cygpath --unix "$M2_HOME"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
  [ -n "$M2_HOME" ] &&
    M2_HOME="`(cd "$M2_HOME"; pwd)`"
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
  javaExecutable="`which javac`"
  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
    # readlink(1) is not available as standard on Solaris 10.
    readLink=`which readlink`
    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
      if $darwin ; then
        javaHome="`dirname \"$javaExecutable\"`"
        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
      else
        javaExecutable="`readlink -f \"$javaExecutable\"`"
      fi
      javaHome="`dirname \"$javaExecutable\"`"
      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
      JAVA_HOME="$javaHome"
      export JAVA_HOME
    fi
  fi
fi
if [ -z "$JAVACMD" ] ; then
  if [ -n "$JAVA_HOME"  ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
      # IBM's JDK on AIX uses strange locations for the executables
      JAVACMD="$JAVA_HOME/jre/sh/java"
    else
      JAVACMD="$JAVA_HOME/bin/java"
    fi
  else
    JAVACMD="`which java`"
  fi
fi
if [ ! -x "$JAVACMD" ] ; then
  echo "Error: JAVA_HOME is not defined correctly." >&2
  echo "  We cannot execute $JAVACMD" >&2
  exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
  echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
  if [ -z "$1" ]
  then
    echo "Path not specified to find_maven_basedir"
    return 1
  fi
  basedir="$1"
  wdir="$1"
  while [ "$wdir" != '/' ] ; do
    if [ -d "$wdir"/.mvn ] ; then
      basedir=$wdir
      break
    fi
    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
    if [ -d "${wdir}" ]; then
      wdir=`cd "$wdir/.."; pwd`
    fi
    # end of workaround
  done
  echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
  if [ -f "$1" ]; then
    echo "$(tr -s '\n' ' ' < "$1")"
  fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
  exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
    if [ "$MVNW_VERBOSE" = true ]; then
      echo "Found .mvn/wrapper/maven-wrapper.jar"
    fi
else
    if [ "$MVNW_VERBOSE" = true ]; then
      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
    fi
    if [ -n "$MVNW_REPOURL" ]; then
      jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
    else
      jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
    fi
    while IFS="=" read key value; do
      case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
      esac
    done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
    if [ "$MVNW_VERBOSE" = true ]; then
      echo "Downloading from: $jarUrl"
    fi
    wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
    if $cygwin; then
      wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
    fi
    if command -v wget > /dev/null; then
        if [ "$MVNW_VERBOSE" = true ]; then
          echo "Found wget ... using wget"
        fi
        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
            wget "$jarUrl" -O "$wrapperJarPath"
        else
            wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
        fi
    elif command -v curl > /dev/null; then
        if [ "$MVNW_VERBOSE" = true ]; then
          echo "Found curl ... using curl"
        fi
        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
            curl -o "$wrapperJarPath" "$jarUrl" -f
        else
            curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
        fi
    else
        if [ "$MVNW_VERBOSE" = true ]; then
          echo "Falling back to using Java to download"
        fi
        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
        # For Cygwin, switch paths to Windows format before running javac
        if $cygwin; then
          javaClass=`cygpath --path --windows "$javaClass"`
        fi
        if [ -e "$javaClass" ]; then
            if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
                if [ "$MVNW_VERBOSE" = true ]; then
                  echo " - Compiling MavenWrapperDownloader.java ..."
                fi
                # Compiling the Java class
                ("$JAVA_HOME/bin/javac" "$javaClass")
            fi
            if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
                # Running the downloader
                if [ "$MVNW_VERBOSE" = true ]; then
                  echo " - Running MavenWrapperDownloader.java ..."
                fi
                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
            fi
        fi
    fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
  echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
  [ -n "$M2_HOME" ] &&
    M2_HOME=`cygpath --path --windows "$M2_HOME"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
  $MAVEN_OPTS \
  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
mvnw.cmd
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,185 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements.  See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership.  The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License.  You may obtain a copy of the License at
@REM
@REM    http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied.  See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM     e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
set MAVEN_OPTS=-Dmaven.repo.local=D:/m2/repository
set JAVA_HOME=D:\Java\jdk1.8.0_221
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
    IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
    if "%MVNW_VERBOSE%" == "true" (
        echo Found %WRAPPER_JAR%
    )
) else (
    if not "%MVNW_REPOURL%" == "" (
        SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
    )
    if "%MVNW_VERBOSE%" == "true" (
        echo Couldn't find %WRAPPER_JAR%, downloading it ...
        echo Downloading from: %DOWNLOAD_URL%
    )
    powershell -Command "&{"^
        "$webclient = new-object System.Net.WebClient;"^
        "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
        "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
        "}"^
        "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
        "}"
    if "%MVNW_VERBOSE%" == "true" (
        echo Finished downloading %WRAPPER_JAR%
    )
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%
pom.xml
@@ -8,7 +8,7 @@
  <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.18</version>
        <version>2.3.12.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
  </parent>
  <modules>
@@ -37,7 +37,9 @@
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.5.5</version>
            <version>3.5.1</version>
            <!--
            <version>3.5.5</version>-->
        </dependency>
      <!--mysql-->
        <dependency>