yangys
2024-09-10 fa68e7add2eb49f83736872edf6e0c3fe5d8b46f
增加一些注释
已修改15个文件
366 ■■■■ 文件已修改
smart-man-boot/src/main/java/com/qianwen/smartman/common/enums/WcsDataTypeEnums.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/entity/WorkstationWcs.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/service/impl/WorkstationWcsServiceImpl.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/fms/service/impl/FmsDeviceAnalysisServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/ProcessParameterController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/convert/AlarmConvert.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAlarm.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IProcessParameterService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/AlarmServiceImpl.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/ProcessParameterServiceImpl.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/tdengine/service/impl/WorkstationDynamicCollectServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/common/enums/WcsDataTypeEnums.java
@@ -4,7 +4,9 @@
import java.util.List;
import java.util.stream.Collectors;
/*
 * 工况数据的类型
 */
public class WcsDataTypeEnums {
    public static List<Integer> ONLY_ONE_LIST = Arrays.stream(WcsDataType.values()).filter((v0) -> {
        return v0.isOnly();
smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/entity/WorkstationWcs.java
@@ -2,7 +2,9 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.qianwen.core.tenant.mp.TenantEntity;
/**
 * 工况参数(wcs)
 */
@TableName("blade_workstation_wcs")
public class WorkstationWcs extends TenantEntity {
    private static final long serialVersionUID = 6406569428341022321L;
smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/service/impl/WorkstationWcsServiceImpl.java
@@ -89,7 +89,7 @@
            if (Func.isNotEmpty(ids)) {
                workstationWcsIdList.addAll(ids);
            } else {
                checkWorkstationWcs(workstationWcs);
                checkWorkstationWcs(workstationWcs);//检查数据是否存在
                setCrc(workstationWcs);
            }
            MachineDmpVariablesVO machineDmpVariablesVO = this.dmpVariablesService.listByWorkstationId(workstationWcs.getWorkstationId());
@@ -133,14 +133,17 @@
        validWorkstationExistsWcs(checkedVoList);
        List<DmpVariables> dmpVariablesList = validDmpName(workstationId, checkedVoList);
        List<WorkstationWcs> saveWorkstationWcsList = WorkstationWcsConvert.INSTANCE.convertVOToEntity(checkedVoList);
      //删除tdengine中的count_data_${workstationId}_${usageCode}和aggregate_count_data_${workstationId}_${usageCode},实际上这2个表不存在
        this.dynamicCollectService.removeTableUpdateWcs(saveWorkstationWcsList);
        
        //也是删除以上2个表,也是不存在的表
        this.dynamicCollectService.removeTableDeleteWcs(list(Lambda.eq(WorkstationWcs::getWorkstationId, workstationId)
                .notIn(Func.isNotEmpty(saveWorkstationWcsList), WorkstationWcs::getCollectSettingItem, saveWorkstationWcsList
                  .stream().map(WorkstationWcs::getCollectSettingItem)
                  .collect(Collectors.toList()))));
        
        deleteByWorkstationIdList(Collections.singletonList(workstationId));
        deleteByWorkstationIdList(Collections.singletonList(workstationId));//删除workstation_wsc的老数据
        for (WorkstationWcs workstationWcs : saveWorkstationWcsList) {
            checkWorkstationWcs(workstationWcs);
            setCrc(workstationWcs);
@@ -149,15 +152,19 @@
            return Func.isNotEmpty(w.getDataItem());
        }).collect(Collectors.toList());
        saveOrUpdateBatch(collect);
        //下一步更新排序(idx)
        Map<Long, Integer> idToIdx = workstationWcsSaveVOList.stream().collect(Collectors.toMap((v0) -> {
            return v0.getDmpVariablesId();
        }, (v0) -> {
            return v0.getSort();
        }));
        dmpVariablesList.forEach(dmpVariables -> {
            dmpVariables.setIdx((Integer) idToIdx.get(dmpVariables.getId()));
            dmpVariables.setIdx(idToIdx.get(dmpVariables.getId()));//更新索引序号
        });
        this.dmpVariablesService.updateBatchById(dmpVariablesList);
        //更新缓存
        List<Long> workstationIds = workstationWcsSaveVOList.stream().map((v0) -> {
            return v0.getWorkstationId();
        }).collect(Collectors.toList());
@@ -166,6 +173,8 @@
            WorkstationCache.clearWorkstationWcs(String.valueOf(id));
        });
        clearWorkstationParamTypeCacheByWorkstationId(workstationIds);
        //返回所有数据的VO列表
        return WorkstationWcsConvert.INSTANCE.convert(saveWorkstationWcsList);
    }
@@ -429,6 +438,10 @@
        return Func.isNotEmpty(name) ? name.substring(1) : name.toString();
    }
    /***
     * 检查工况参数配置的数据类型dataType,和对应的数据是否存在
     * @param workstationWcs
     */
    private void checkWorkstationWcs(WorkstationWcs workstationWcs) {
        if (WcsDataTypeEnums.ONLY_ONE_LIST.contains(workstationWcs.getDataType())) {
            Long count = Long.valueOf(count(Wrappers.<WorkstationWcs>lambdaQuery()
smart-man-boot/src/main/java/com/qianwen/smartman/modules/fms/service/impl/FmsDeviceAnalysisServiceImpl.java
@@ -256,7 +256,7 @@
        List<SuperAlarm> superAlarms = this.superAlarmMapper.pageAlarm(query.getCurrent(), query.getSize(), workstationId);
        List<FmsAlarmVO> fmsAlarmVOS = new ArrayList<>();
        for (SuperAlarm alarm : superAlarms) {
            Timestamp ts = alarm.getTs();
            Timestamp ts = alarm.getTime();
            FmsAlarmVO fmsAlarmVO = new FmsAlarmVO();
            fmsAlarmVO.setDate(DateUtil.format(new Date(ts.getTime()), DateConstant.PATTERN_DATE_TIME));
            fmsAlarmVO.setCode(alarm.getCode());
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/ProcessParameterController.java
@@ -29,6 +29,8 @@
import com.qianwen.smartman.modules.mdc.vo.ShiftTimeVO;
import com.qianwen.smartman.modules.mdc.vo.WorkstationShiftSearchVO;
import com.qianwen.smartman.modules.mdc.vo.excel.ProcessParamExcelVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@@ -37,11 +39,9 @@
@ApiResource({"blade-mdc/process-parameter"})
@RestController
public class ProcessParameterController {
    private final IProcessParameterService processParameterService;
    @Autowired
    private IProcessParameterService processParameterService;
    public ProcessParameterController(final IProcessParameterService processParameterService) {
        this.processParameterService = processParameterService;
    }
    @ApiOperationSupport(order = 1)
    @PostResource({"/chart"})
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/convert/AlarmConvert.java
@@ -14,7 +14,7 @@
public interface AlarmConvert {
    public static final AlarmConvert INSTANCE = (AlarmConvert) Mappers.getMapper(AlarmConvert.class);
    @Mappings({@Mapping(target = "alarmTime", expression = "java(ConvertUtils.format(alarm.getTs()))"), @Mapping(target = "alarmCode", source = "code"), @Mapping(target = "alarmMsg", source = "message"), @Mapping(target = "count", expression = "java(ConvertUtils.defaultValue())")})
    @Mappings({@Mapping(target = "alarmTime", expression = "java(ConvertUtils.format(alarm.getTime()))"), @Mapping(target = "alarmCode", source = "code"), @Mapping(target = "alarmMsg", source = "message"), @Mapping(target = "count", expression = "java(ConvertUtils.defaultValue())")})
    AlarmDataSheetVO convert(SuperAlarm alarm);
    @Mappings({})
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAlarm.java
@@ -7,13 +7,13 @@
 */
public class SuperAlarm extends SuperAggregate implements Serializable {
    private static final long serialVersionUID = 1123326427413588953L;
    private Timestamp ts;
    private Timestamp time;
    private String code;
    private String message;
    private String level;
    public void setTs(final Timestamp ts) {
        this.ts = ts;
    public void setTime(final Timestamp time) {
        this.time = time;
    }
    public void setCode(final String code) {
@@ -30,14 +30,14 @@
    @Override // org.springblade.modules.mdc.entity.SuperAggregate
    public String toString() {
        return "SuperAlarm(ts=" + getTs() + ", code=" + getCode() + ", message=" + getMessage() + ", level=" + getLevel() + ")";
        return "SuperAlarm(time=" + getTime() + ", code=" + getCode() + ", message=" + getMessage() + ", level=" + getLevel() + ")";
    }
    public SuperAlarm() {
    }
    public SuperAlarm(final Timestamp ts, final String code, final String message, final String level) {
        this.ts = ts;
    public SuperAlarm(final Timestamp time, final String code, final String message, final String level) {
        this.time = time;
        this.code = code;
        this.message = message;
        this.level = level;
@@ -51,8 +51,8 @@
        if (o instanceof SuperAlarm) {
            SuperAlarm other = (SuperAlarm) o;
            if (other.canEqual(this) && super.equals(o)) {
                Object this$ts = getTs();
                Object other$ts = other.getTs();
                Object this$ts = getTime();
                Object other$ts = other.getTime();
                if (this$ts == null) {
                    if (other$ts != null) {
                        return false;
@@ -95,7 +95,7 @@
    @Override // org.springblade.modules.mdc.entity.SuperAggregate
    public int hashCode() {
        int result = super.hashCode();
        Object $ts = getTs();
        Object $ts = getTime();
        int result2 = (result * 59) + ($ts == null ? 43 : $ts.hashCode());
        Object $code = getCode();
        int result3 = (result2 * 59) + ($code == null ? 43 : $code.hashCode());
@@ -105,8 +105,8 @@
        return (result4 * 59) + ($level == null ? 43 : $level.hashCode());
    }
    public Timestamp getTs() {
        return this.ts;
    public Timestamp getTime() {
        return this.time;
    }
    public String getCode() {
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.java
@@ -41,13 +41,32 @@
    Long countAlarm(@Param("vo") AlarmShiftSearchVO vo, @Param("queryTime") String queryTime);
    List<SuperAlarm> selectListAlarm(@Param("vo") AlarmShiftSearchVO vo, @Param("queryTime") String queryTime);
    /**
     * 报警的列表查询,按时间
     * @param vo 查询参数
     * @param queryTime
     * @return
     */
    List<SuperAlarm> selectListAlarm(@Param("vo") AlarmShiftSearchVO vo, @Param("factoryDate") int factoryDate);
    List<SuperAlarm> queryAlarm(@Param("query") Query query, @Param("vo") AlarmShiftSearchVO vo, @Param("queryTime") String queryTime);
    /**
     * 查询报警分页数据
     * @param query
     * @param vo
     * @param factoryDate
     * @return
     */
    List<SuperAlarm> queryAlarm(@Param("query") Query query, @Param("vo") AlarmShiftSearchVO vo, @Param("factoryDate") int factoryDate);
    List<SuperAlarm> selectAllAlarm(@Param("vo") AlarmShiftSearchExcelVO vo, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("year") Integer year, @Param("list") List<Integer> list);
    List<SuperAlarm> selectListAlarmByShift(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("workstationId") Long workstationId);
    /**
     * 按班次查询报警数据
     * @param startDate
     * @param endDate
     * @param workstationId
     * @return
     */
    List<SuperAlarm> selectListAlarmByShift(@Param("startFactoryDate") int startFactoryDate, @Param("endFactoryDate") int endFactoryDate, @Param("workstationId") Long workstationId);
    List<WorkstaionAlarmByTimeReportVO> alarmReportByTime(@Param("ids") List<Long> workstationIds, @Param("beginTime") String startDate, @Param("endTime") String endDate);
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.java
@@ -31,9 +31,29 @@
    List<ProcessParameterVO> processParameterListByShift(@Param("times") List<TimeDTO> times, @Param("collectItems") List<String> collectItems, @Param("workstationId") String workstationId);
    List<ProcessParameterVO> oldOneCollectList(@Param("workstationId") String workstationId, @Param("item") String item, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
    List<ProcessParameterVO> oldOneCollectList(@Param("workstationId") Long workstationId, @Param("item") String item, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
    ProcessParameterVO oldFirstStatue(@Param("workstationId") String workstationId, @Param("item") String item, @Param("startTime") Long startTime);
    ProcessParameterVO oldLastStatue(@Param("workstationId") String workstationId, @Param("item") String item, @Param("endTime") Long endTime);
    /**
     * ???
     * @param workstationId
     * @param item
     * @param startTime
     * @return
     */
    //ProcessParameterVO oldFirstStatue(@Param("workstationId") String workstationId, @Param("item") String item, @Param("startTime") Long startTime);
    LastProcessParam lastParameterLessThanTime(@Param("workstationId") Long workstationId, @Param("item") String item, @Param("startTime") Long startTime);
    /**
     *
     * @param workstationId
     * @param item
     * @param startTime
     * @return
     */
    //ProcessParameterVO oldLastStatue(@Param("workstationId") String workstationId, @Param("item") String item, @Param("endTime") Long endTime);
    LastProcessParam lastParameterGreaterThanTime(@Param("workstationId") Long workstationId, @Param("item") String item, @Param("endTime") Long endTime);
}
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IProcessParameterService.java
@@ -26,6 +26,11 @@
    IPage<ProcessParameterRealVO> pageProcessParameter(Query query, ProcessParameterItemSearchVO vo);
    /**
     * 获取工位的所有采集参数列表
     * @param workstationId
     * @return
     */
    List<WorkstationWcsDmpDTO> processParam(String workstationId);
    ProParamSheetVO queryProcessParameterSheet(ProcessParameterSearchVO vo, Boolean isFilterProcessParameter);
@@ -34,6 +39,11 @@
    ShiftTimeVO getShiftTime(ProcessParameterSearchVO vo);
    /**
     * 查询单个过程参数的图表数据
     * @param vo
     * @return
     */
    CollectParamResVO<?> queryProcessParameterOneChart(CollectParamSearchVO vo);
    List<AllShiftTimeDetail> getAllShiftTime(WorkstationShiftSearchVO vo);
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/AlarmServiceImpl.java
@@ -80,7 +80,7 @@
            return new Page<>();
        }
        LocalDate queryTime = vo.getQueryTime();
        List<SuperAlarm> list = this.alarmMapper.selectListAlarm(vo, DateUtil.format(queryTime, "yyyyMMdd"));
        List<SuperAlarm> list = this.alarmMapper.selectListAlarm(vo,Integer.parseInt(DateUtil.format(queryTime, "yyyyMMdd")));
        Map<String, List<SuperAlarm>> map = FilterOffUtils.filterOffDay(list, OpenTypeEnums.ALARM_ANALYSIS).stream().collect(Collectors.groupingBy(c -> {
            return c.getCode() + c.getMessage();
        }));
@@ -90,14 +90,14 @@
        if (map.size() == 0) {
            return page;
        }
        List<SuperAlarm> alarms = this.alarmMapper.selectListAlarm(vo, DateUtil.format(queryTime, "yyyyMMdd"));
        List<SuperAlarm> alarms = this.alarmMapper.selectListAlarm(vo, Integer.parseInt(DateUtil.format(queryTime, "yyyyMMdd")));
        List<AlarmDataSheetVO> res = AlarmConvert.INSTANCE.convert(FilterOffUtils.filterOffDay(alarms, OpenTypeEnums.ALARM_ANALYSIS));
        List<AlarmDataSheetVO> alarmDataSheetVOS = new ArrayList<>();
        Map<String, List<AlarmDataSheetVO>> resMap = res.stream().collect(Collectors.groupingBy(c2 -> {
            return c2.getAlarmCode() + c2.getAlarmMsg();
        }));
        resMap.values().forEach(alarmDataSheetVOList -> {
            ((AlarmDataSheetVO) alarmDataSheetVOList.get(0)).setCount(Integer.valueOf(alarmDataSheetVOList.size()));
            ((AlarmDataSheetVO) alarmDataSheetVOList.get(0)).setCount(alarmDataSheetVOList.size());
            alarmDataSheetVOS.add(alarmDataSheetVOList.get(0));
        });
        if (query.getSize().intValue() == -1) {
@@ -114,7 +114,7 @@
    public BladeFile exportAlarm(AlarmShiftSearchExcelVO vo) {
        BladeFile bladeFile;
        
        List<SuperAlarm> superAlarms = this.alarmMapper.selectListAlarmByShift(LocalDateTimeUtils.formatTimeLocalDate(vo.getStartTime(), "yyyyMMdd"), LocalDateTimeUtils.formatTimeLocalDate(vo.getEndTime(), "yyyyMMdd"), vo.getWorkstationId());
        List<SuperAlarm> superAlarms = this.alarmMapper.selectListAlarmByShift(Integer.parseInt(LocalDateTimeUtils.formatTimeLocalDate(vo.getStartTime(), "yyyyMMdd")) , Integer.parseInt(LocalDateTimeUtils.formatTimeLocalDate(vo.getEndTime(), "yyyyMMdd")), vo.getWorkstationId());
        superAlarms = FilterOffUtils.filterOffDay(superAlarms, OpenTypeEnums.ALARM_ANALYSIS);
        superAlarms.sort(Comparator.comparing(SuperAggregate::getFactoryDate));
        Collections.reverse(superAlarms);
@@ -246,7 +246,7 @@
        if (Func.isNull(vo.getWorkstationId())) {
            return new AlarmSummaryGraphVO();
        }
        List<SuperAlarm> alarms = this.alarmMapper.queryAlarm(null, vo, DateUtil.format(vo.getQueryTime(), "yyyyMMdd"));
        List<SuperAlarm> alarms = this.alarmMapper.queryAlarm(null, vo,Integer.parseInt(DateUtil.format(vo.getQueryTime(), "yyyyMMdd")) );
        Map<String, Integer> map = FilterOffUtils.filterOffDay(alarms, OpenTypeEnums.ALARM_ANALYSIS).stream().collect(Collectors.groupingBy((v0) -> {
            return v0.getCode();
        }, Collectors.reducing(0, e -> {
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/ProcessParameterServiceImpl.java
@@ -8,6 +8,8 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
@@ -198,7 +200,8 @@
        if (startTime.after(now)) {
            return new CollectParamResVO<>();
        }
        String workstationId = vo.getWorkstationId();
        //String workstationId = vo.getWorkstationId();
        Long workstationId = Long.parseLong(vo.getWorkstationId());
        List<ProcessParameterVO> processParameterList = getProcessParameterList(startTime, endTime, workstationId, vo.getDmpDTO());
        return getCollectParamResVO(vo.getDmpDTO(), processParameterList);
    }
@@ -246,7 +249,15 @@
        }
    }
    private List<ProcessParameterVO> getProcessParameterList(Date startTime, Date endTime, String workstationId, WorkstationWcsDmpDTO dmpDTO) {
    /**
     * 获取过程参数列表
     * @param startTime
     * @param endTime
     * @param workstationId
     * @param dmpDTO
     * @return
     */
    private List<ProcessParameterVO> getProcessParameterList(Date startTime, Date endTime, Long workstationId, WorkstationWcsDmpDTO dmpDTO) {
        ProcessParameterVO firstStatue = oldFirstStatue(startTime, dmpDTO.getName(), workstationId);
        ProcessParameterVO endStatue = oldLastStatue(endTime, dmpDTO.getName(), workstationId);
        List<ProcessParameterVO> processParameterList = oldOneCollectList(startTime, endTime, dmpDTO.getName(), workstationId);
@@ -506,23 +517,25 @@
        return this.parameterMapper.queryProcessParameter(workstationId, collectItems, Long.valueOf(startTime.getTime()), Long.valueOf(endTime.getTime()));
    }
    private ProcessParameterVO oldFirstStatue(Date startTime, String item, String workstationId) {
        ProcessParameterVO vo = this.parameterMapper.oldFirstStatue(workstationId, item, Long.valueOf(startTime.getTime()));
    private ProcessParameterVO oldFirstStatue(Date startTime, String item, Long workstationId) {
        //ProcessParameterVO vo = this.parameterMapper.oldFirstStatue(workstationId, item, Long.valueOf(startTime.getTime()));
        ProcessParameterVO vo = this.getLastParameterLessThanTime(workstationId, item, startTime.getTime());
        if (Func.notNull(vo)) {
            vo.setCollectItem(item);
        }
        return vo;
    }
    private ProcessParameterVO oldLastStatue(Date endTime, String item, String workstationId) {
        ProcessParameterVO vo = this.parameterMapper.oldLastStatue(workstationId, item, Long.valueOf(endTime.getTime()));
    private ProcessParameterVO oldLastStatue(Date endTime, String item, Long workstationId) {
        //ProcessParameterVO vo = this.parameterMapper.oldLastStatue(workstationId, item, Long.valueOf(endTime.getTime()));
        ProcessParameterVO vo = this.getLastParameterGreaterThenTime(workstationId, item, Long.valueOf(endTime.getTime()));
        if (Func.notNull(vo)) {
            vo.setCollectItem(item);
        }
        return vo;
    }
    private List<ProcessParameterVO> oldOneCollectList(Date startTime, Date endTime, String item, String workstationId) {
    private List<ProcessParameterVO> oldOneCollectList(Date startTime, Date endTime, String item, Long workstationId) {
        return this.parameterMapper.oldOneCollectList(workstationId, item, Long.valueOf(startTime.getTime()), Long.valueOf(endTime.getTime()));
    }
@@ -660,4 +673,49 @@
        
        return result;
    }
    public ProcessParameterVO getLastParameterLessThanTime(long workstationId,String item,Long time) {
        //yys
        LastProcessParam lp = this.parameterMapper.lastParameterLessThanTime(workstationId,item,time);
        if(lp == null) {
            return null;
        }
        ProcessParameterVO vo = new ProcessParameterVO();
        //解析json为对象列表
        JSONObject paramsObj = JSONObject.parseObject(lp.getParamJson());
        if(paramsObj.containsKey(item)) {
            JSONObject itemObj = paramsObj.getJSONObject(item);
            Long lastTime = itemObj.getLong("time");
            vo.setTime(new Timestamp(lastTime));
            vo.setRealTime(lastTime);
            vo.setValueCollect(itemObj.getString("value"));
        }
        return vo;
    }
    public ProcessParameterVO getLastParameterGreaterThenTime(long workstationId,String item,Long time) {
        //yys
        LastProcessParam lp = this.parameterMapper.lastParameterGreaterThanTime(workstationId,item,time);
        if(lp == null) {
            return null;
        }
        ProcessParameterVO vo = new ProcessParameterVO();
        //解析json为对象列表
        JSONObject paramsObj = JSONObject.parseObject(lp.getParamJson());
        if(paramsObj.containsKey(item)) {
            JSONObject itemObj = paramsObj.getJSONObject(item);
            Long lastTime = itemObj.getLong("time");
            vo.setTime(new Timestamp(lastTime));
            vo.setRealTime(lastTime);
            vo.setValueCollect(itemObj.getString("value"));
        }
        return vo;
    }
}
smart-man-boot/src/main/java/com/qianwen/smartman/modules/tdengine/service/impl/WorkstationDynamicCollectServiceImpl.java
@@ -81,7 +81,7 @@
    @Override 
    public void removeTableUpdateWcs(List<WorkstationWcs> updateWcsList) {
        Map<Long, WorkstationWcs> current = new HashMap<>();
        //删除时序数据库中的表
        updateWcsList.stream().filter(it -> Func.isNotEmpty(it.getUsageId())).peek(it -> current.put(it.getWorkstationId(),it)).map(it ->{
            return this.workstationWcsService.getOne(Lambda.<WorkstationWcs>eq(WorkstationWcs::getWorkstationId, it.getWorkstationId()).eq(WorkstationWcs::getCollectSettingItem, it.getCollectSettingItem()).ne(WorkstationWcs::getDataType, WcsDataTypeEnums.WcsDataType.OTHER.getCode()));
        }) .filter(Func::notNull)
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml
@@ -44,55 +44,9 @@
    </select>
    <select id="selectListAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
        select *
        from iot_data.super_alarm
        where workstation_id = #{vo.workstationId}
        /*按照班次查询*/
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@SHIFT == vo.enums">
            and shift_index = #{vo.shiftIndex}
            and factory_date = #{queryTime}
        </if>
        /*按照日查询*/
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@DAY == vo.enums">
            and factory_date = #{queryTime}
        </if>
        /*按照月查询*/
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@MONTH == vo.enums">
            and factory_year = #{vo.year}
            and factory_month = #{vo.month}
        </if>
        /*按照周询*/
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@WEEK == vo.enums">
            and factory_year = #{vo.year}
            and factory_week = #{vo.week}
        </if>
    </select>
    <select id="queryAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
        select *
        from iot_data.super_alarm
        where workstation_id = #{vo.workstationId}
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@SHIFT == vo.enums">
            and shift_index = #{vo.shiftIndex}
            and factory_date = #{queryTime}
        </if>
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@DAY == vo.enums">
            and factory_date = #{queryTime}
        </if>
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@MONTH == vo.enums">
            and factory_year = #{vo.year}
            and factory_month = #{vo.month}
        </if>
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@WEEK == vo.enums">
            and factory_year = #{vo.year}
            and factory_week = #{vo.week}
        </if>
        order by ts desc
        <if test="query != null">
            limit ${(query.current - 1) * query.size}, ${query.size}
        </if>
    </select>
    <select id="selectAllAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
        select *
@@ -122,13 +76,7 @@
        order by ts desc
    </select>
    <select id="selectListAlarmByShift" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
        select *
        from iot_data.super_alarm
        where workstation_id = #{workstationId}
          and factory_date <![CDATA[>=]]> #{startDate}
          and factory_date <![CDATA[<=]]> #{endDate}
    </select>
    <select id="alarmReportByTime" resultType="com.qianwen.smartman.modules.report.vo.WorkstaionAlarmByTimeReportVO">
        select
@@ -275,7 +223,72 @@
        select count(workstation_id)
        from root.f2.alarm_*
        where workstation_id = #{workstationId}
    </select>
    <!-- , -->
    <sql id="alarmColumns">
        code,message,level,workstation_id as workstationId,calendar_code as calendarCode,factory_year as factoryYear,factory_month as factoryMonth,factory_week as factoryWeek,factory_date as factoryDate,shift_index as shiftIndex,shift_time_type as shiftTimeType
    </sql>
        
    <select id="selectListAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
        select <include refid="alarmColumns"/>
        from root.f2.alarm_*
        where workstation_id = #{vo.workstationId}
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@SHIFT == vo.enums">
            and shift_index = #{vo.shiftIndex}
            and factory_date = #{factoryDate}
        </if>
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@DAY == vo.enums">
            and factory_date = #{factoryDate}
        </if>
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@MONTH == vo.enums">
            and factory_year = #{vo.year}
            and factory_month = #{vo.month}
        </if>
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@WEEK == vo.enums">
            and factory_year = #{vo.year}
            and factory_week = #{vo.week}
        </if>
         align by device
    </select>
    <select id="queryAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
        select <include refid="alarmColumns"/>
        from root.f2.alarm_*
        where workstation_id = #{vo.workstationId}
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@SHIFT == vo.enums">
            and shift_index = #{vo.shiftIndex}
            and factory_date = #{factoryDate}
        </if>
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@DAY == vo.enums">
            and factory_date = #{factoryDate}
        </if>
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@MONTH == vo.enums">
            and factory_year = #{vo.year}
            and factory_month = #{vo.month}
        </if>
        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@WEEK == vo.enums">
            and factory_year = #{vo.year}
            and factory_week = #{vo.week}
        </if>
        order by time desc
        <if test="query != null">
            limit ${query.size} offset ${(query.current - 1) * query.size}
        </if>
         align by device
    </select>
    <select id="selectListAlarmByShift" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
        select <include refid="alarmColumns"/>
        from root.f2.alarm_*
        where workstation_id = #{workstationId}
          and factory_date <![CDATA[>=]]> #{startFactoryDate}
          and factory_date <![CDATA[<=]]> #{endFactoryDate}
          align by device
    </select>
</mapper>
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml
@@ -16,9 +16,7 @@
        group by workstation_id,n
    </select>
 
     <select id="getLastParameters" resultType="com.qianwen.smartman.modules.mdc.entity.LastProcessParam">
        select workstation_id as workstationId,update_time as updateTime, param_json as paramJson from root.f2.last_process_param where workstation_id = #{workstationId}
    </select>
    
    <select id="queryProcessParameter" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
        select ts as time,
@@ -117,6 +115,7 @@
        order by ts
    </select>
      <!--
    <select id="oldFirstStatue" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
        select last(ts) as realTime,
               last(v)  as value_collect
@@ -125,7 +124,8 @@
          and ts &lt; #{startTime}
          and workstation_id = #{workstationId}
    </select>
     -->
    <!--
    <select id="oldLastStatue" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
        select last(ts) as realTime,
               last(v)  as value_collect
@@ -134,5 +134,30 @@
          and ts &gt; #{endTime}
          and workstation_id = #{workstationId}
    </select>
     -->
    <!-- sql修改开始 -->
    <select id="getLastParameters" resultType="com.qianwen.smartman.modules.mdc.entity.LastProcessParam">
        select workstation_id as workstationId,update_time as updateTime, param_json as paramJson from root.f2.last_process_param where workstation_id = #{workstationId}
    </select>
     <!-- 根据oldFirstStatue 改造的-->
    <select id="lastParameterLessThanTime" resultType="com.qianwen.smartman.modules.mdc.entity.LastProcessParam">
        select workstation_id as workstationId,update_time as updateTime, param_json as paramJson
        from root.f2.last_process_param
        where n = #{item}
          and time &lt; #{startTime}
          and workstation_id = #{workstationId}
    </select>
    <!-- 根据oldLastStatue改的 -->
    <select id="lastParameterGreaterThanTime" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
        select workstation_id as workstationId,update_time as updateTime, param_json as paramJson
        from root.f2.last_process_param
        where n = #{item}
          and ts &gt; #{endTime}
          and workstation_id = #{workstationId}
    </select>
</mapper>