yangys
2024-10-08 ba9557b5edf7f31ab8bce0ae57aaaaefd6459bb4
collect/src/main/java/com/qianwen/mdc/collect/runner/InitRunner.java
@@ -15,6 +15,7 @@
import com.qianwen.mdc.collect.dto.CacheBuildDTO;
import com.qianwen.mdc.collect.mapper.iotdb.DeviceStateMapper;
import com.qianwen.mdc.collect.service.DeviceStateFixPointService;
import com.qianwen.mdc.collect.service.WorkstationAppMappingService;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
@@ -29,9 +30,14 @@
    private TimeSliceCache timeSliceCache;
    @Autowired
    private DeviceStateMapper deviceStateMapper;
    @Autowired
    private WorkstationAppMappingService mappingService;;
    @Override
    public void run(ApplicationArguments args) throws Exception {
       mappingService.saveToCache();
       //生成时间切片
        CacheBuildDTO cacheBuildDTO = CacheBuildDTO.builder().tenantIds(Sets.newHashSet(new String[]{"000000"})).targetDate(LocalDate.now()).build();
        timeSliceCache.build(cacheBuildDTO);
@@ -44,14 +50,15 @@
        DateTime dateTime = DateTime.now();
        log.info("进入程序启动校验是否存在工位打过固定点....... ");
       
        long count = deviceStateMapper.fixPointCountByDate(Integer.valueOf(DatePattern.PURE_DATE_FORMAT.format(dateTime)));
        Long count = deviceStateMapper.fixPointCountByDate(Integer.valueOf(DatePattern.PURE_DATE_FORMAT.format(dateTime)));
        /*
        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 (count <= 0) {
        if(count == null || count == 0) {
        //if (count <= 0) {
            log.info("设备未打过锚点,启动时打点....... ");
            //this.workStationStateFixPointService.workStationStateFixPoint(dateTime, null);
            stateFixPointService.deviceStateFixPoint(dateTime, null);