yangys
2024-09-09 84eee637c5f26565c34779a4f00dae48018598e7
产量统计完成
已添加1个文件
已修改31个文件
943 ■■■■■ 文件已修改
smart-man-boot/src/main/java/com/qianwen/smartman/common/typehandlers/NullableSqlTimestampTypeHandler.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/OutputStatisticsController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/StatusRecordController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/TimeUsedAnalysisController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAggregateOutput.java 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAggregateState.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/enums/OpenTypeEnums.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateFeedbackMapper.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IOutputStatisticsService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IStatusRecordService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ISuperAggregateOutputService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ISuperAggregateStateService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ITimeUsedAnalysisService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/OutputStatisticsServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/StatusRecordServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateOutputServiceImpl.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateStateServiceImpl.java 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/TimeUsedAnalysisServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/WorkstationAnalysisServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/WorkstationFeedbackServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/utils/FilterOffUtils.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/vo/AlarmAnalysisWorkstationVO.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/visual/wrapper/OutputWrapper.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/visual/wrapper/VisualCountPulseWrapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/resources/application.yml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.xml 107 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateFeedbackMapper.xml 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.xml 274 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/common/typehandlers/NullableSqlTimestampTypeHandler.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
package com.qianwen.smartman.common.typehandlers;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
@MappedTypes(value = Timestamp.class)
@MappedJdbcTypes(value = {JdbcType.BIGINT,JdbcType.INTEGER})
public class NullableSqlTimestampTypeHandler extends BaseTypeHandler<Timestamp>{
    @Override
    public void setNonNullParameter(PreparedStatement ps, int i, Timestamp parameter, JdbcType jdbcType)
            throws SQLException {
        ps.setTimestamp(i, parameter);
    }
    @Override
    public Timestamp getNullableResult(ResultSet rs, String columnName) throws SQLException {
        Timestamp val = rs.getTimestamp(columnName);
        if(rs.wasNull()) {
            return null;
        }else {
            return val;
        }
        //return rs.getTimestamp(columnName);
    }
    @Override
    public Timestamp getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
        Timestamp val = rs.getTimestamp(columnIndex);
        if(rs.wasNull()) {
            return null;
        }else {
            return val;
        }
        //return rs.getTimestamp(columnIndex);
    }
    @Override
    public Timestamp getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
        Timestamp val = cs.getTimestamp(columnIndex);
        if(cs.wasNull()) {
            return null;
        }else {
            return val;
        }
        //return cs.getTimestamp(columnIndex);
    }
}
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/OutputStatisticsController.java
@@ -14,6 +14,8 @@
import com.qianwen.smartman.modules.mdc.service.IOutputStatisticsService;
import com.qianwen.smartman.modules.mdc.vo.StatisticsAnalysisQueryVO;
import com.qianwen.smartman.modules.mdc.vo.StatisticsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@@ -22,11 +24,12 @@
@ApiResource({"blade-mdc/output"})
@RestController
public class OutputStatisticsController extends BladeController {
    private final IOutputStatisticsService outputStatisticsService;
    @Autowired
    private IOutputStatisticsService outputStatisticsService;
    /*
    public OutputStatisticsController(final IOutputStatisticsService outputStatisticsService) {
        this.outputStatisticsService = outputStatisticsService;
    }
    }*/
    @PostMapping({""})
    @ApiOperation(ExcelConstant.OUTPUT_ACCOUNT)
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/StatusRecordController.java
@@ -49,6 +49,12 @@
        this.feedbackService = feedbackService;
    }
    /**
     * çŠ¶æ€è®°å½•åŠŸèƒ½ä¸­çš„æŸä¸€å¤©çš„çŠ¶æ€æ•°æ®
     * @param statusRecordDateSelectVO
     * @param query
     * @return
     */
    @ApiOperationSupport(order = 1)
    @PostResource({"/status-record-by-date"})
    @ApiOperation(value = "根据日期查询状态记录", notes = "传入statusRecordDateSelectVO")
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/TimeUsedAnalysisController.java
@@ -30,6 +30,12 @@
        this.superAggregateStateService = superAggregateStateService;
    }
    /**
     * ç”¨æ—¶åˆ†æžç»Ÿè®¡
     * @param query
     * @param stationVO
     * @return
     */
    @PostMapping({"/work-stations"})
    @ApiOperationSupport(order = 1)
    @ApiOperation("按多设备统计用时")
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAggregateOutput.java
@@ -4,8 +4,9 @@
public class SuperAggregateOutput extends SuperAggregate {
    private static final long serialVersionUID = 1074211007569731042L;
    private Timestamp ts;
    private Timestamp preTs;
    private Timestamp time;
    private Timestamp preTime;
    private Long output;
    private Long curOutput;
    private Long preOutput;
@@ -58,8 +59,8 @@
                } else if (!this$employeeId.equals(other$employeeId)) {
                    return false;
                }
                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;
@@ -67,8 +68,8 @@
                } else if (!this$ts.equals(other$ts)) {
                    return false;
                }
                Object this$preTs = getPreTs();
                Object other$preTs = other.getPreTs();
                Object this$preTs = getPreTime();
                Object other$preTs = other.getPreTime();
                if (this$preTs == null) {
                    if (other$preTs != null) {
                        return false;
@@ -119,9 +120,9 @@
        int result4 = (result3 * 59) + ($preOutput == null ? 43 : $preOutput.hashCode());
        Object $employeeId = getEmployeeId();
        int result5 = (result4 * 59) + ($employeeId == null ? 43 : $employeeId.hashCode());
        Object $ts = getTs();
        Object $ts = getTime();
        int result6 = (result5 * 59) + ($ts == null ? 43 : $ts.hashCode());
        Object $preTs = getPreTs();
        Object $preTs = getPreTime();
        int result7 = (result6 * 59) + ($preTs == null ? 43 : $preTs.hashCode());
        Object $program = getProgram();
        int result8 = (result7 * 59) + ($program == null ? 43 : $program.hashCode());
@@ -131,12 +132,12 @@
        return (result9 * 59) + ($productName == null ? 43 : $productName.hashCode());
    }
    public void setTs(final Timestamp ts) {
        this.ts = ts;
    public void setTime(final Timestamp time) {
        this.time = time;
    }
    public void setPreTs(final Timestamp preTs) {
        this.preTs = preTs;
    public void setPreTs(final Timestamp preTime) {
        this.preTime = preTime;
    }
    public void setOutput(final Long output) {
@@ -169,15 +170,15 @@
    @Override // org.springblade.modules.mdc.entity.SuperAggregate
    public String toString() {
        return "SuperAggregateOutput(ts=" + getTs() + ", preTs=" + getPreTs() + ", output=" + getOutput() + ", curOutput=" + getCurOutput() + ", preOutput=" + getPreOutput() + ", program=" + getProgram() + ", productCode=" + getProductCode() + ", productName=" + getProductName() + ", employeeId=" + getEmployeeId() + ")";
        return "SuperAggregateOutput(ts=" + getTime() + ", preTs=" + getPreTime() + ", output=" + getOutput() + ", curOutput=" + getCurOutput() + ", preOutput=" + getPreOutput() + ", program=" + getProgram() + ", productCode=" + getProductCode() + ", productName=" + getProductName() + ", employeeId=" + getEmployeeId() + ")";
    }
    public SuperAggregateOutput() {
    }
    public SuperAggregateOutput(final Timestamp ts, final Timestamp preTs, final Long output, final Long curOutput, final Long preOutput, final String program, final String productCode, final String productName, final Long employeeId) {
        this.ts = ts;
        this.preTs = preTs;
    public SuperAggregateOutput(final Timestamp time, final Timestamp preTime, final Long output, final Long curOutput, final Long preOutput, final String program, final String productCode, final String productName, final Long employeeId) {
        this.time = time;
        this.preTime = preTime;
        this.output = output;
        this.curOutput = curOutput;
        this.preOutput = preOutput;
@@ -187,12 +188,12 @@
        this.employeeId = employeeId;
    }
    public Timestamp getTs() {
        return this.ts;
    public Timestamp getTime() {
        return this.time;
    }
    public Timestamp getPreTs() {
        return this.preTs;
    public Timestamp getPreTime() {
        return this.preTime;
    }
    public Long getOutput() {
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAggregateState.java
@@ -1,11 +1,17 @@
package com.qianwen.smartman.modules.mdc.entity;
import java.sql.Timestamp;
import java.util.Date;
import org.apache.commons.lang.builder.ToStringBuilder;
public class SuperAggregateState extends SuperAggregate {
    private Timestamp time;
    private Timestamp startTime;
    private Timestamp endTime;
    private Long endL;
    private Date endD;
    /**
     * é‡‡é›†çš„æœŸé—´/时长。单位秒?
     */
@@ -152,7 +158,23 @@
        return (result10 * 59) + ($endTime == null ? 43 : $endTime.hashCode());
    }
    public Timestamp getTime() {
    public Long getEndL() {
        return endL;
    }
    public void setEndL(Long endL) {
        this.endL = endL;
    }
    public Date getEndD() {
        return endD;
    }
    public void setEndD(Date endD) {
        this.endD = endD;
    }
    public Timestamp getTime() {
        return time;
    }
@@ -202,7 +224,8 @@
    @Override // org.springblade.modules.mdc.entity.SuperAggregate
    public String toString() {
        return "SuperAggregateState(startTime=" + getStartTime() + ", endTime=" + getEndTime() + ", durationCollect=" + getDurationCollect() + ", valueCollect=" + getValueCollect() + ", wcs=" + getWcs() + ", rps=" + getRps() + ", isDeleted=" + getIsDeleted() + ", isPlan=" + getIsPlan() + ", employeeId=" + getEmployeeId() + ", feedbackId=" + getFeedbackId() + ")";
        return ToStringBuilder.reflectionToString(this);
        //return "SuperAggregateState(startTime=" + getStartTime() + ", endTime=" + getEndTime() + ", durationCollect=" + getDurationCollect() + ", valueCollect=" + getValueCollect() + ", wcs=" + getWcs() + ", rps=" + getRps() + ", isDeleted=" + getIsDeleted() + ", isPlan=" + getIsPlan() + ", employeeId=" + getEmployeeId() + ", feedbackId=" + getFeedbackId() + ")";
    }
    public SuperAggregateState() {
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/enums/OpenTypeEnums.java
@@ -4,7 +4,13 @@
import com.qianwen.smartman.common.constant.ExcelConstant;
public enum OpenTypeEnums {
    /**
     * "mdc_open_type"
     */
    PARAM_KEY_TYPE("mdc_open_type"),
    /**
     * "mdc_open_shift"
     */
    PARAM_KEY_SHIFT("mdc_open_shift"),
    TIME_USED_ANALYSIS(ExcelConstant.TIME_USED),
    RUNNING("运行率"),
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.java
@@ -1,15 +1,34 @@
package com.qianwen.smartman.modules.mdc.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import java.time.LocalDateTime;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput;
@DS("tdengine")
@DS("iotdb")
@InterceptorIgnore(tenantLine = "true")
public interface SuperAggregateOutputMapper {
    List<SuperAggregateOutput> getOutputDataByNaturalDate(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
    /**
     * è‡ªç„¶æ—¥äº§é‡
     * @param workstationIds
     * @param startDate
     * @param endDate
     * @return
     */
    List<SuperAggregateOutput> getOutputDataByNaturalDate(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);
    List<SuperAggregateOutput> getOutputDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
    /**
     * æ ¹æ®èµ·æ­¢æ—¥æœŸï¼ŒèŽ·å–äº§é‡æ•°æ®
     * @param workstationIds
     * @param startFatoryDate
     * @param endFatoryDate
     * @return
     */
    List<SuperAggregateOutput> getOutputDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startFatoryDate") int startFatoryDate, @Param("endFatoryDate") int endFatoryDate);
    List<SuperAggregateOutput> getOutputDataByWorkstationAndFactoryDate(@Param("workstationId") Long workstationId, @Param("startDate") String startDate, @Param("endDate") String endDate);
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateFeedbackMapper.java
@@ -2,15 +2,34 @@
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.qianwen.smartman.common.constant.FmsConstant;
import com.qianwen.smartman.modules.mdc.entity.SuperAggregateState;
@DS("tdengine")
//@DS("tdengine")
@DS("iotdb")
@InterceptorIgnore(tenantLine = FmsConstant.AUTOMATIC)
public interface SuperAggregateStateFeedbackMapper {
    List<SuperAggregateState> getStatusDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
    /**
     * æŒ‰ç”Ÿäº§æ—¥æœŸèŽ·å–åé¦ˆçŠ¶æ€è¡¨çš„çŠ¶æ€æ•°æ®,日期参数都该为LocalDateTime
     * @param workstationIds
     * @param startDate
     * @param endDate
     * @return
     */
    List<SuperAggregateState> getStatusDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startFactoryDate") int startFactoryDate, @Param("endFactoryDate") int endFactoryDate);
    //List<SuperAggregateState> getStatusDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
    List<SuperAggregateState> getStatusData(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
    /**
     * èŽ·å–åé¦ˆçŠ¶æ€è¡¨çš„çŠ¶æ€æ•°æ®,日期参数都该为LocalDateTime
     * @param workstationIds
     * @param startDate
     * @param endDate
     * @return
     */
    List<SuperAggregateState> getStatusData(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);
}
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.java
@@ -3,6 +3,7 @@
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@@ -27,13 +28,40 @@
    List<StatusAnalysisWorkstationVO> statusByWorkstationByNull(@Param("workstationId") String workstationId, @Param("startTime") String startTime);
    List<SuperAggregateState> dateState(@Param("factoryDate") String factoryDate, @Param("ids") List<Long> ids);
    /**
     * æŸ¥è¯¢æŒ‡å®šå·¥ä½ç¬¦åˆfactoryDate的数据 ç”¨æ—¶åˆ†æž
     * @param factoryDate
     * @param ids
     * @return
     */
    List<SuperAggregateState> dateState(@Param("factoryDate") int factoryDate, @Param("ids") List<Long> ids);
    /**
     * æŸ¥è¯¢æŒ‡å®šå·¥ä½ç¬¦åˆæ˜ŸæœŸçš„æ•°æ® ç”¨æ—¶åˆ†æž
     * @param ids
     * @param year
     * @param week
     * @return
     */
    List<SuperAggregateState> weekState(@Param("ids") List<Long> ids, @Param("year") Integer year, @Param("week") Integer week);
    /**
     * æŸ¥è¯¢æŒ‡å®šå·¥ä½ç¬¦åˆå¹´ä»½å’Œæœˆä»½çš„æ•°æ® ç”¨æ—¶åˆ†æž
     * @param ids
     * @param year
     * @param month
     * @return
     */
    List<SuperAggregateState> yearState(@Param("ids") List<Long> ids, @Param("year") Integer year, @Param("month") Integer month);
    List<SuperAggregateState> shiftState(@Param("ids") List<Long> workStationIds, @Param("factoryDate") String factoryDate, @Param("shiftIndex") Integer shiftIndex, @Param("calendarCode") String calendarCode);
    /**
     * æŸ¥è¯¢æŒ‡å®šå·¥ä½ç¬¦åˆç­æ¬¡å’ŒfactoryDate的数据,用时分析中使用
     * @param workStationIds
     * @param factoryDate
     * @param shiftIndex
     * @param calendarCode
     * @return
     */
    List<SuperAggregateState> shiftState(@Param("ids") List<Long> workStationIds, @Param("factoryDate") Integer factoryDate, @Param("shiftIndex") Integer shiftIndex, @Param("calendarCode") String calendarCode);
    List<StatusAnalysisWorkstationVO> statusByWorkstationList(@Param("workstationIdList") List<Long> workstationIdList, @Param("startTime") String startTime, @Param("endTime") String endTime);
@@ -51,7 +79,14 @@
    List<SuperAggregateState> getStatusByFactory(@Param("factoryDate") Integer factoryDate, @Param("shiftIndex") Integer shiftIndex, @Param("workstationIds") List<Long> workstationIds);
    List<SuperAggregateState> getStatusData(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
    /**
     * æŸ¥è¯¢çŠ¶æ€æ•°æ®
     * @param workstationIds æŒ‡å®šçš„工位id集合
     * @param startDate å¼€å§‹æ—¶é—´
     * @param endDate æˆªè‡³æ—¶é—´
     * @return æ•°æ®åˆ—表
     */
    List<SuperAggregateState> getStatusData(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);
    /**
     * æ ¹æ®å·¥ä½id列表和时间节点获取状态数据yys,首页稼动率时使用的
@@ -62,7 +97,14 @@
     */
    List<SuperAggregateState> getStatusDataByTimeSection(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);
    List<SuperAggregateState> getStatusDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
    /**
     * æ ¹æ®å·¥åŽ‚æ—¥æœŸèŽ·å–èšåˆçŠ¶æ€æ•°æ®
     * @param workstationIds
     * @param startDate
     * @param endDate
     * @return
     */
    List<SuperAggregateState> getStatusDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startFactoryDate") int startFactoryDate, @Param("endFactoryDate") int endFactoryDate);
    List<SuperAggregateState> getStatusDataByFactoryDateAndWorkstationId(@Param("workstationId") Long workstationId, @Param("startDate") String startDate, @Param("endDate") String endDate);
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.java
@@ -16,11 +16,23 @@
import com.qianwen.smartman.modules.report.vo.WorkstaionAlarmByShiftReportVO;
import com.qianwen.smartman.modules.report.vo.WorkstaionAlarmByTimeReportVO;
@DS("tdengine")
@DS("iotdb")
@InterceptorIgnore(tenantLine = FmsConstant.AUTOMATIC)
public interface SuperAlarmMapper extends BaseMapper<SuperAlarm> {
    /**
     * æŸ¥è¯¢å‘Šè­¦åˆ†é¡µæ•°æ®
     * @param workstationId
     * @param start
     * @param end
     * @return
     */
    List<AlarmAnalysisWorkstationVO> alarmByWorkstation(@Param("workstationId") String workstationId, @Param("start") Integer start, @Param("end") Integer end);
    /**
     * æŸ¥è¯¢å‘Šè­¦æ•°æ®æ¡æ•°
     * @param workstationId
     * @return
     */
    Integer alarmByWorkstationTotal(@Param("workstationId") String workstationId);
    void createTable(Long workstationId);
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IOutputStatisticsService.java
@@ -6,6 +6,12 @@
import com.qianwen.smartman.modules.mdc.vo.StatisticsVO;
public interface IOutputStatisticsService {
    /**
     * äº§é‡ç»Ÿè®¡
     * @param statisticsAnalysisQueryVO
     * @param query
     * @return
     */
    StatisticsVO outputStatistics(StatisticsAnalysisQueryVO statisticsAnalysisQueryVO, Query query);
    BladeFile export(StatisticsAnalysisQueryVO analysisQueryVO);
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IStatusRecordService.java
@@ -23,10 +23,20 @@
    List<ChartDataVO> getTimeDistribution(StatusRecordDetailSelectVO statusRecordDetailSelectVO);
    /**
     * æŸ¥è¯¢è®¾å¤‡æ•ˆçŽ‡ï¼Œåœ¨å·¥ä½æ•°æ®ç•Œé¢ï¼ˆè®¾å¤‡æ•ˆçŽ‡ç»Ÿè®¡å›¾ï¼‰ï¼Œç‚¹å‡»æŸä¸€ä¸ªæœºå™¨çš„æ—¶å€™è°ƒç”¨
     * @param statusRecordDetailSelectVO æŸ¥è¯¢å‚æ•°
     * @return
     */
    List<ChartDataVO> getEquipmentEfficiency(StatusRecordDetailSelectVO statusRecordDetailSelectVO);
    List<StatusRecordShiftIndexChartVO> getShiftIndexStatusRecordChart(StatusRecordDetailSelectVO statusRecordDetailSelectVO);
    /**
     * æŸ¥è¯¢ç­æ¬¡çŠ¶æ€è®°å½•è¡¨æ ¼
     * @param statusRecordDetailSelectVO
     * @return
     */
    List<HashMap<String, String>> getShiftIndexStatusRecordTable(StatusRecordDetailSelectVO statusRecordDetailSelectVO);
    BladeFile exportStatusRecord(StatusRecordExcelVO vo);
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ISuperAggregateOutputService.java
@@ -6,6 +6,14 @@
import com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum;
public interface ISuperAggregateOutputService {
    /**
     * äº§é‡æ•°æ®
     * @param workstationIds
     * @param statisticalMethod
     * @param startDate
     * @param endDate
     * @return
     */
    List<SuperAggregateOutput> getOutputData(List<Long> workstationIds, StatisticalMethodEnum statisticalMethod, LocalDate startDate, LocalDate endDate);
    List<SuperAggregateOutput> queryPerfByDay(Long workstationId, String startTime, String endTime, Long employeeId);
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ISuperAggregateStateService.java
@@ -8,6 +8,14 @@
import com.qianwen.smartman.modules.mdc.vo.StatusTimeTopVO;
public interface ISuperAggregateStateService {
    /**
     * æ ¹æ®æ—¥æœŸèŽ·å–å·¥ä½çŠ¶æ€æ•°æ®
     * @param workstationIds
     * @param statisticalMethod
     * @param startDate
     * @param endDate
     * @return
     */
    List<SuperAggregateState> getStatusData(List<Long> workstationIds, StatisticalMethodEnum statisticalMethod, LocalDate startDate, LocalDate endDate);
    List<SuperAggregateState> getStatusDataWithFeedback(List<Long> workstationIds, StatisticalMethodEnum statisticalMethod, LocalDate startDate, LocalDate endDate);
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ITimeUsedAnalysisService.java
@@ -13,6 +13,12 @@
import com.qianwen.smartman.modules.mdc.vo.excel.TimeUsedExcelVO;
public interface ITimeUsedAnalysisService {
    /**
     * ç”¨æ—¶åˆ†æžç»Ÿè®¡
     * @param stationVO
     * @param query
     * @return
     */
    TimeUsedAnalysisWorkstationVO timeUsedStatisticsByWorkstation(TimeUsedStatisticsByWorkstationVO stationVO, Query query);
    WorkstationBandShiftVO queryWorkStationShiftIndexName(QueryShiftIndexNameVO vo);
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/OutputStatisticsServiceImpl.java
@@ -80,6 +80,8 @@
    }
    
    @Override
    public StatisticsVO outputStatistics(StatisticsAnalysisQueryVO statisticsAnalysisQueryVO, Query query) {
        List<String> workStationIdList = statisticsAnalysisQueryVO.getWorkStationIdList();
        if (Func.isEmpty(workStationIdList)) {
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/StatusRecordServiceImpl.java
@@ -91,7 +91,7 @@
        List<StatusRecordDateVO> result = new ArrayList<>();
        List<WorkstationInfoVO> workstationList = statusRecordDateSelectVO.getWorkstationInfoList();
        if (Func.isEmpty(workstationList)) {
            workstationList = (List<WorkstationInfoVO>)this.workstationService.list(Wrappers.<Workstation>lambdaQuery().eq(Workstation::getType, WorkstationTypeEnum.MACHINE.getCode()).eq(BaseEntity::getStatus, CommonConstant.ENABLE)).stream().map(s -> {
            workstationList = this.workstationService.list(Wrappers.<Workstation>lambdaQuery().eq(Workstation::getType, WorkstationTypeEnum.MACHINE.getCode()).eq(BaseEntity::getStatus, CommonConstant.ENABLE)).stream().map(s -> {
                WorkstationInfoVO workstationInfoVO = new WorkstationInfoVO();
                workstationInfoVO.setId(s.getId());
                workstationInfoVO.setName(s.getName());
@@ -113,13 +113,10 @@
        }
        page.setTotal(workstationList.size());
        List<WorkstationInfoVO> workstationList2 = workstationList.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList());
        List<Long> workstationIdList = workstationList2.stream().map((v0) -> {
            return v0.getId();
        }).collect(Collectors.toList());
        List<Long> workstationIdList = workstationList2.stream().map(WorkstationInfoVO::getId).collect(Collectors.toList());
        List<SuperAggregateState> superAggregateStateList = this.superAggregateStateService.getStatusData(workstationIdList, null, statusRecordDateSelectVO.getDate(), statusRecordDateSelectVO.getDate());
        Map<Long, List<SuperAggregateState>> workstationStatusMap = superAggregateStateList.stream().collect(Collectors.groupingBy((v0) -> {
            return v0.getWorkstationId();
        }));
        Map<Long, List<SuperAggregateState>> workstationStatusMap = superAggregateStateList.stream().collect(Collectors.groupingBy(SuperAggregateState::getWorkstationId));
        workstationList2.forEach(x -> {
            StatusRecordDateVO statusRecord = new StatusRecordDateVO().setWorkstationInfo(x).setStatusRecordList(StatusRecordConvert.INSTANCE.convert(workstationStatusMap.get(x.getId())));
            result.add(statusRecord);
@@ -227,7 +224,7 @@
                HashMap<String, String> hashMap = new HashMap<>(16);
                hashMap.put("shiftIndex", x.getShiftIndex() + "");
                hashMap.put("shiftIndexName", x.getShiftIndexName());
                List<SuperAggregateState> shiftIndexStatusList = shiftIndexStatusMap.get(x.getShiftIndex());
                List<SuperAggregateState> shiftIndexStatusList = shiftIndexStatusMap.get(x.getShiftIndex());//null
                if (Func.isNotEmpty(shiftIndexStatusList)) {
                    hashMap.put("oee", EifficiencyUtils.calculationResults(shiftIndexStatusList, ProductivityTypeEnum.OEE) + "");
                    hashMap.put("fault", EifficiencyUtils.calculationResults(shiftIndexStatusList, ProductivityTypeEnum.ALARM) + "");
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateOutputServiceImpl.java
@@ -2,6 +2,8 @@
import cn.hutool.core.date.LocalDateTimeUtil;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;
import com.qianwen.smartman.common.constant.DateConstant;
import com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput;
@@ -22,9 +24,14 @@
    public List<SuperAggregateOutput> getOutputData(List<Long> workstationIds, StatisticalMethodEnum statisticalMethodEnum, LocalDate startDate, LocalDate endDate) {
        List<SuperAggregateOutput> superAggregateOutputList;
        if (StatisticalMethodEnum.SHIFT.equals(statisticalMethodEnum) || StatisticalMethodEnum.DAY.equals(statisticalMethodEnum) || StatisticalMethodEnum.WEEK.equals(statisticalMethodEnum) || StatisticalMethodEnum.MONTH.equals(statisticalMethodEnum)) {
            superAggregateOutputList = this.baseMapper.getOutputDataByFactoryDate(workstationIds, LocalDateTimeUtil.format(startDate, "yyyyMMdd"), LocalDateTimeUtil.format(endDate, "yyyyMMdd"));
            superAggregateOutputList = this.baseMapper.getOutputDataByFactoryDate(workstationIds, Integer.parseInt(LocalDateTimeUtil.format(startDate, "yyyyMMdd")) , Integer.parseInt(LocalDateTimeUtil.format(endDate, "yyyyMMdd")));
        } else {
            superAggregateOutputList = this.baseMapper.getOutputDataByNaturalDate(workstationIds, LocalDateTimeUtil.format(startDate, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endDate.plusDays(1L), DateConstant.PATTERN_DATE_TIME));
            //好像界面上没有调用
            //superAggregateOutputList = this.baseMapper.getOutputDataByNaturalDate(workstationIds, LocalDateTimeUtil.format(startDate, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endDate.plusDays(1L), DateConstant.PATTERN_DATE_TIME));
            LocalDateTime startTime = LocalDateTime.of(startDate, LocalTime.MIN);
            LocalDateTime endTime = LocalDateTime.of(endDate.plusDays(1L), LocalTime.MIN);
            superAggregateOutputList = this.baseMapper.getOutputDataByNaturalDate(workstationIds, startTime,endTime );
        }
        return superAggregateOutputList;
    }
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateStateServiceImpl.java
@@ -5,6 +5,7 @@
import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Comparator;
@@ -24,7 +25,6 @@
import com.qianwen.smartman.common.constant.CommonConstant;
import com.qianwen.smartman.common.constant.DateConstant;
import com.qianwen.smartman.common.utils.LocalDateTimeUtils;
import com.qianwen.smartman.common.utils.LocalDateUtil;
import com.qianwen.smartman.modules.cps.entity.Workstation;
import com.qianwen.smartman.modules.cps.service.IWorkstationService;
import com.qianwen.smartman.modules.mdc.entity.SuperAggregate;
@@ -56,9 +56,13 @@
    public List<SuperAggregateState> getStatusData(List<Long> workstationIds, StatisticalMethodEnum statisticalMethod, LocalDate startDate, LocalDate endDate) {
        List<SuperAggregateState> statusDataList;
        if (StatisticalMethodEnum.SHIFT.equals(statisticalMethod) || StatisticalMethodEnum.DAY.equals(statisticalMethod) || StatisticalMethodEnum.WEEK.equals(statisticalMethod) || StatisticalMethodEnum.MONTH.equals(statisticalMethod)) {
            statusDataList = this.baseMapper.getStatusDataByFactoryDate(workstationIds, LocalDateTimeUtil.format(startDate, "yyyyMMdd"), LocalDateTimeUtil.format(endDate, "yyyyMMdd"));
            statusDataList = this.baseMapper.getStatusDataByFactoryDate(workstationIds, Integer.parseInt(LocalDateTimeUtil.format(startDate, "yyyyMMdd")), Integer.parseInt(LocalDateTimeUtil.format(endDate, "yyyyMMdd")));
        } else {
            statusDataList = this.baseMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startDate, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endDate.plusDays(1L), DateConstant.PATTERN_DATE_TIME));
            //statusDataList = this.baseMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startDate, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endDate.plusDays(1L), DateConstant.PATTERN_DATE_TIME));
            LocalDateTime startTime = LocalDateTime.of(startDate, LocalTime.MIN);
            LocalDateTime endTime = LocalDateTime.of(endDate.plusDays(1L), LocalTime.MIN);
            //statusDataList = this.baseMapper.getStatusData(workstationIds, startDate,endDate.plusDays(1L));
            statusDataList = this.baseMapper.getStatusData(workstationIds, startTime,endTime);
        }
        return buildDuration(statusDataList);
    }
@@ -66,18 +70,28 @@
    @Override
    public List<SuperAggregateState> getStatusDataWithFeedback(List<Long> workstationIds, StatisticalMethodEnum statisticalMethod, LocalDate startDate, LocalDate endDate) {
        //稼动率查询
         //LocalDate startTime = LocalDateTime, LocalDate endDate
        List<SuperAggregateState> statusDataList;
        if (StatisticalMethodEnum.SHIFT.equals(statisticalMethod) || StatisticalMethodEnum.DAY.equals(statisticalMethod) || StatisticalMethodEnum.WEEK.equals(statisticalMethod) || StatisticalMethodEnum.MONTH.equals(statisticalMethod)) {
            statusDataList = this.aggregateStateFeedbackMapper.getStatusDataByFactoryDate(workstationIds, LocalDateTimeUtil.format(startDate, "yyyyMMdd"), LocalDateTimeUtil.format(endDate, "yyyyMMdd"));
            //statusDataList = this.aggregateStateFeedbackMapper.getStatusDataByFactoryDate(workstationIds, LocalDateTimeUtil.format(startDate, "yyyyMMdd"), LocalDateTimeUtil.format(endDate, "yyyyMMdd"));
            int startFactoryDate = Integer.parseInt(LocalDateTimeUtil.format(startDate, "yyyyMMdd"));
            int endFactoryDate = Integer.parseInt(LocalDateTimeUtil.format(endDate, "yyyyMMdd"));
            statusDataList = this.aggregateStateFeedbackMapper.getStatusDataByFactoryDate(workstationIds, startFactoryDate, endFactoryDate);
        } else {
            statusDataList = this.aggregateStateFeedbackMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startDate, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endDate.plusDays(1L), DateConstant.PATTERN_DATE_TIME));
            //statusDataList = this.aggregateStateFeedbackMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startDate, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endDate.plusDays(1L), DateConstant.PATTERN_DATE_TIME));
            LocalDateTime startTime = LocalDateTime.of(startDate, LocalTime.MIN);
            LocalDateTime endTime = LocalDateTime.of(endDate.plusDays(1L), LocalTime.MIN);
            statusDataList = this.aggregateStateFeedbackMapper.getStatusData(workstationIds, startTime,endTime);
        }
        return buildDuration(statusDataList);
    }
    @Override
    public List<SuperAggregateState> getStatusByCondition(List<Long> workstationIds, LocalDateTime startTime, LocalDateTime endTime) {
        List<SuperAggregateState> statusDataList = this.baseMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startTime, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endTime, DateConstant.PATTERN_DATE_TIME));
        //List<SuperAggregateState> statusDataList = this.baseMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startTime, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endTime, DateConstant.PATTERN_DATE_TIME));
        List<SuperAggregateState> statusDataList = this.baseMapper.getStatusData(workstationIds, startTime,endTime);
        return buildDuration(statusDataList);
    }
@@ -91,6 +105,7 @@
    @Override
    public List<StatusTimeTopVO> getStatusTimeByWcs(List<Long> workstationIds, LocalDateTime startTime, LocalDateTime endTime, Integer status, Integer top) {
        List<StatusTimeTopVO> voList = new ArrayList<>();
        Map<Long, Workstation> workstationMap = this.workstationService.list(Wrappers.<Workstation>lambdaQuery()
                .eq(Workstation::getStatus, CommonConstant.ENABLE)).stream().collect(Collectors.toMap(Workstation::getId, Function.identity()));
        /*
@@ -101,17 +116,16 @@
        }, Function.identity()));*/
        //List<SuperAggregateState> equipmentStatusDuration = this.baseMapper.getEquipmentStatusDuration(workstationIds, LocalDateTimeUtil.format(startTime, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endTime, DateConstant.PATTERN_DATE_TIME), status);
        
        Date startTimeD = LocalDateUtil.localDateTimeToDate(startTime);
        startTimeD = new Date(124,8,2);
        Date endTimeD = LocalDateUtil.localDateTimeToDate(endTime);
        endTimeD = new Date(124,8,3);
       // Date startTimeD = LocalDateUtil.localDateTimeToDate(startTime);
        //startTimeD = new Date(124,8,2);
        //Date endTimeD = LocalDateUtil.localDateTimeToDate(endTime);
        //endTimeD = new Date(124,8,3);
        
        LocalDateTime startTime2 = LocalDateTime.of(2024, 9, 2, 1, 0);
        LocalDateTime endTime2 = LocalDateTime.of(2024, 9, 3, 1, 0);
        List<SuperAggregateState> equipmentStatusDuration = this.baseMapper.getEquipmentStatusDuration(workstationIds, startTime2, endTime2, status);
        List<SuperAggregateState> equipmentStatusDuration = this.baseMapper.getEquipmentStatusDuration(workstationIds, startTime, endTime, status);
        
        List<SuperAggregateState> equipmentStatusDuration2 = FilterOffUtils.filterOffDay(equipmentStatusDuration, OpenTypeEnums.TIME_USED_ANALYSIS);
        Map<Long, Long> timeMap = buildDuration(startTime2, equipmentStatusDuration2).stream().collect(Collectors.groupingBy(SuperAggregate::getWorkstationId, Collectors.summingLong(SuperAggregateState::getDurationCollect))).entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(top.intValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, java.util.LinkedHashMap::new));
        Map<Long, Long> timeMap = buildDuration(startTime, equipmentStatusDuration2).stream().collect(Collectors.groupingBy(SuperAggregate::getWorkstationId, Collectors.summingLong(SuperAggregateState::getDurationCollect))).entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(top.intValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, java.util.LinkedHashMap::new));
        //yangys改了buildDuration,去掉了startTime参数
        //Map<Long, Long> timeMap = buildDuration(equipmentStatusDuration2,ChronoUnit.SECONDS).stream().collect(Collectors.groupingBy(SuperAggregate::getWorkstationId, Collectors.summingLong(SuperAggregateState::getDurationCollect))).entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(top.intValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, java.util.LinkedHashMap::new));
        /*
@@ -137,8 +151,8 @@
    @Override
    public List<SuperAggregateState> getOeeAnalysis(List<Long> workStationIdList, LocalDateTime startTime, LocalDateTime endTime) {
        Date startTimeD = LocalDateUtil.localDateTimeToDate(startTime);
        Date endTimeD = LocalDateUtil.localDateTimeToDate(endTime);
        //Date startTimeD = LocalDateUtil.localDateTimeToDate(startTime);
        //Date endTimeD = LocalDateUtil.localDateTimeToDate(endTime);
        //List<SuperAggregateState> statusDataList = this.baseMapper.getEquipmentStatusDuration(workStationIdList, LocalDateTimeUtil.format(startTime, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endTime, DateConstant.PATTERN_DATE_TIME), null);
        List<SuperAggregateState> statusDataList = this.baseMapper.getEquipmentStatusDuration(workStationIdList, startTime, endTime, null);
        return buildDuration(startTime, FilterOffUtils.filterOffDay(statusDataList, OpenTypeEnums.OEE));
@@ -306,32 +320,16 @@
    private List<SuperAggregateState> buildDuration(List<SuperAggregateState> statusDataShift) {
        Date now = DateUtil.now();
        statusDataShift.forEach(x -> {
            if (Func.isEmpty(x.getEndTime()) || x.getEndTime().toLocalDateTime().getYear()==1970) {
            if (Func.isEmpty(x.getEndTime()) ) {//|| x.getEndTime().toLocalDateTime().getYear()==1970
                x.setEndTime(new Timestamp(now.getTime()));
            }
            x.setDurationCollect(LocalDateTimeUtils.betweenTwoTime(x.getStartTime().toLocalDateTime(), x.getEndTime().toLocalDateTime(), ChronoUnit.MILLIS));
            System.out.println(x);
            //System.out.println(x);
        });
        return statusDataShift;
    }
    /**
     * è®¾ç½®æ—¶é—´å·®
     * @param statusDataShift
     * @param chUnit
     * @return
     */
    private List<SuperAggregateState> buildDuration(List<SuperAggregateState> statusDataShift, ChronoUnit chUnit) {
        Date now = DateUtil.now();
        statusDataShift.forEach(x -> {
            if (Func.isEmpty(x.getEndTime()) || x.getEndTime().toLocalDateTime().getYear()==1970) {
                x.setEndTime(new Timestamp(now.getTime()));
            }
            x.setDurationCollect(LocalDateTimeUtils.betweenTwoTime(x.getStartTime().toLocalDateTime(), x.getEndTime().toLocalDateTime(), chUnit));
            System.out.println("s="+x);
        });
        return statusDataShift;
    }
    
    private List<SuperAggregateState> buildDuration(LocalDateTime startTime, List<SuperAggregateState> statusDataShift) {
        Date now = DateUtil.now();
@@ -341,9 +339,10 @@
            }
            if (x.getStartTime().toLocalDateTime().isBefore(startTime)) {
                x.setStartTime(Timestamp.valueOf(startTime));
                x.setTime(Timestamp.valueOf(startTime));//这个才起作用,getStartTime获取的是time
            }
            x.setDurationCollect(LocalDateTimeUtils.betweenTwoTime(x.getStartTime().toLocalDateTime(), x.getEndTime().toLocalDateTime(), ChronoUnit.MILLIS));
            System.out.println(x);
            //System.out.println(x);
        });
        return statusDataShift;
    }
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/TimeUsedAnalysisServiceImpl.java
@@ -136,6 +136,7 @@
                res.setTotal(Long.valueOf(total));
                break;
            default:
                //按班次统计
                res = buildTimeUsedAnalysisShift(ids, queryTime, stationVO.getShiftIndex(), query);
                break;
        }
@@ -152,7 +153,7 @@
            return Integer.parseInt(c.getCode());
        }).collect(Collectors.toSet());
        
        List<SuperAggregateState> stateList = this.baseMapper.dateState(DateUtil.format(queryTime, "yyyyMMdd"), ids);
        List<SuperAggregateState> stateList = this.baseMapper.dateState(Integer.parseInt(DateUtil.format(queryTime, "yyyyMMdd")) , ids);
        Map<Long, Map<Integer, Long>> map = buildStateMap(wcsSet, stateList);
        for (Workstation workstation : workstations) {
            workStationDetails.add(NameIdDTO.builder().id(workstation.getId()).name(workstation.getName() + "\n" + workstation.getCode()).build());
@@ -216,7 +217,7 @@
        LinkedHashMap<String, List<Workstation>> calendarMap = workstationPages.getRecords().stream().collect(Collectors.groupingBy(Workstation::getCalendarCode, LinkedHashMap::new, Collectors.toList()));
        calendarMap.forEach((calendarCode, workStationsList) -> {
            List<Long> workStationIds =  workStationsList.stream().map(Workstation::getId).collect(Collectors.toList());
            List<SuperAggregateState> stateList = this.baseMapper.shiftState(workStationIds, DateUtil.format(queryTime, "yyyyMMdd"), shiftIndex, calendarCode);
            List<SuperAggregateState> stateList = this.baseMapper.shiftState(workStationIds, Integer.parseInt(DateUtil.format(queryTime, "yyyyMMdd")), shiftIndex, calendarCode);
            Map<Long, Map<Integer, Long>> map = buildStateMap(wcsSet, stateList);
            Iterator<Workstation> it = workStationsList.iterator();
            while (it.hasNext()) {
@@ -289,7 +290,7 @@
                Set<Integer> wcsList = listGlobalWcs().stream().map(c -> {
                    return Integer.valueOf(Integer.parseInt(c.getCode()));
                }).collect(Collectors.toSet());
                List<SuperAggregateState> stateEndTimeNotNullList = this.baseMapper.dateState(DateUtil.format(queryTime, "yyyyMMdd"), Lists.newArrayList(workstationIds));
                List<SuperAggregateState> stateEndTimeNotNullList = this.baseMapper.dateState(Integer.parseInt(DateUtil.format(queryTime, "yyyyMMdd")) , Lists.newArrayList(workstationIds));
                Map<Integer, Long> map = buildStateGroupMap(wcsList, FilterOffUtils.filterOffDay(stateEndTimeNotNullList, OpenTypeEnums.TIME_USED_ANALYSIS));
                Map<Integer, Long> countResults = mergeMap(map, wcsList);
                log.info("groupDay:{}", countResults);
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/WorkstationAnalysisServiceImpl.java
@@ -101,9 +101,10 @@
        IPage<AlarmAnalysisWorkstationVO> page = Condition.getPage(query);
        List<AlarmAnalysisWorkstationVO> result;
        try {
            result = this.superAlarmMapper.alarmByWorkstation(workstationId, Integer.valueOf((query.getCurrent().intValue() - 1) * query.getSize().intValue()), query.getSize());
            result = this.superAlarmMapper.alarmByWorkstation(workstationId, Integer.valueOf((query.getCurrent() - 1) * query.getSize()), query.getSize());
            total = this.superAlarmMapper.alarmByWorkstationTotal(workstationId);
        } catch (Exception e) {
            log.error("查询报警异常",e);
            result = new ArrayList<>();
            total = 0;
        }
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/WorkstationFeedbackServiceImpl.java
@@ -345,6 +345,7 @@
            t.setWcs(-1);
            return t;
        }).collect(Collectors.toList());
        String key = String.join(":", workstationId + "", statusTime.toString());
        if (statusTime.compareTo((ChronoLocalDate) LocalDate.now()) == 0) {
            List<StatusRecordVO> statusRecordVOList = groupStatusRecordWithFeedback(statusTime, workstationId, statusRecordList, cancelList);
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/utils/FilterOffUtils.java
@@ -14,7 +14,7 @@
    /**
     * è¿‡æ»¤ä¼‘息日?
     * @param <R>
     * @param data çŠ¶æ€æ•°æ®åˆ—è¡¨
     * @param data èšåˆçŠ¶æ€æ•°æ®åˆ—è¡¨
     * @param openTypeEnums RUNNING/ALARM/OEE等
     * @return
     */
@@ -22,13 +22,16 @@
        if (Func.isEmpty(data)) {
            return data;
        }
        boolean filterType = whetherToFilter(OpenTypeEnums.PARAM_KEY_TYPE, openTypeEnums);//mdc_open_type
        boolean filterShift = whetherToFilter(OpenTypeEnums.PARAM_KEY_SHIFT, openTypeEnums);//mdc_open_shift
        //boolean filterType = whetherToFilter(OpenTypeEnums.PARAM_KEY_TYPE, openTypeEnums);//mdc_open_type,是否过滤该类型
        //boolean filterShift = whetherToFilter(OpenTypeEnums.PARAM_KEY_SHIFT, openTypeEnums);//mdc_open_shift,是否过滤班制
        //这里简化,不过滤了,数据在win服务器有,blade_boot_blade_param-0418bak.sql有,是个json数组
        boolean filterType = false;
        boolean filterShift = false;
        if (!filterType && !filterShift) {
            return data;
        }
        return data.stream().filter(item -> {
            return (filterType && item.getShiftTimeType().equals(2)) ? false : true;
            return (filterType && item.getShiftTimeType().equals(2)) ? false : true;//2:休息时间段,这里是去掉休息的状态数据
        }).filter(item2 -> {
            return !filterShift || item2.getShiftIndex().intValue() > 0;
        }).collect(Collectors.toList());
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/vo/AlarmAnalysisWorkstationVO.java
@@ -2,15 +2,21 @@
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.sql.Timestamp;
public class AlarmAnalysisWorkstationVO implements Serializable {
    private static final long serialVersionUID = -530938150418043787L;
    @ApiModelProperty("报警时间")
    private Timestamp time;
    @ApiModelProperty("报警代码")
    private String alarmCode;
    @ApiModelProperty("报警信息")
    private String alarmMsg;
    @ApiModelProperty("报警时间")
    private String alarmTime;
   
    public static class AlarmAnalysisWorkstationVOBuilder {
@@ -104,6 +110,7 @@
        return (result2 * 59) + ($alarmTime == null ? 43 : $alarmTime.hashCode());
    }
    @Override
    public String toString() {
        return "AlarmAnalysisWorkstationVO(alarmCode=" + getAlarmCode() + ", alarmMsg=" + getAlarmMsg() + ", alarmTime=" + getAlarmTime() + ")";
    }
@@ -132,4 +139,13 @@
    public String getAlarmTime() {
        return this.alarmTime;
    }
    public Timestamp getTime() {
        return time;
    }
    public void setTime(Timestamp time) {
        this.time = time;
    }
}
smart-man-boot/src/main/java/com/qianwen/smartman/modules/visual/wrapper/OutputWrapper.java
@@ -31,17 +31,17 @@
            ArrayList arrayList2 = new ArrayList();
            if (CommonConstant.VERSION_NUM.equals(type)) {
                map = (Map) outputList2.stream().filter(o -> {
                    return Func.isNotEmpty(o.getTs());
                    return Func.isNotEmpty(o.getTime());
                }).collect(Collectors.groupingBy(o2 -> {
                    return o2.getTs().toLocalDateTime().getDayOfMonth() + "-" + o2.getTs().toLocalDateTime().getHour();
                    return o2.getTime().toLocalDateTime().getDayOfMonth() + "-" + o2.getTime().toLocalDateTime().getHour();
                }, Collectors.summingLong((v0) -> {
                    return v0.getOutput();
                })));
            } else {
                map = (Map) outputList2.stream().filter(o3 -> {
                    return o3.getTs() != null;
                    return o3.getTime() != null;
                }).collect(Collectors.groupingBy(o4 -> {
                    return DateUtil.format(o4.getTs(), DateConstant.PATTERN_DATE);
                    return DateUtil.format(o4.getTime(), DateConstant.PATTERN_DATE);
                }, Collectors.summingLong((v0) -> {
                    return v0.getOutput();
                })));
smart-man-boot/src/main/java/com/qianwen/smartman/modules/visual/wrapper/VisualCountPulseWrapper.java
@@ -91,7 +91,7 @@
            return v0.getWorkstationId();
        })).forEach((id, aggregateOutputs) -> {
            Map<String, Long> collectMap = aggregateOutputs.stream().collect(Collectors.groupingBy(aggregate -> {
                return (String) categoriesFormat.apply(aggregate.getTs().toLocalDateTime());
                return (String) categoriesFormat.apply(aggregate.getTime().toLocalDateTime());
            }, Collectors.summingLong((v0) -> {
                return v0.getOutput();
            })));
smart-man-boot/src/main/resources/application.yml
@@ -92,6 +92,7 @@
mybatis-plus:
  tenant-model: false
  mapper-locations: classpath:com/qianwen/**/mapper/*Mapper.xml
  type-handlers-package: com.qianwen.smartman.common.typehandlers
  #oracle环境mapper映射
#  mapper-locations: classpath:com/qianwen/**/mapperOracle/*Mapper.xml,classpath:com/qianwen/**/mapper/*Mapper.xml
  #实体扫描,多个package用逗号或者分号分隔
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.xml
@@ -2,62 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qianwen.smartman.modules.mdc.mapper.SuperAggregateOutputMapper">
    <select id="getOutputDataByNaturalDate" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput">
        select ts as startTime,
        pre_ts as endTime,
        output,
        cur_output as curOutput,
        pre_output as preOutput,
        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,
        program,
        product_code as productCode,
        product_name as productName,
        workstation_id as workstationId
        from iot_data.super_aggregate_output
        where ts <![CDATA[>=]]> #{startDate} and ts <![CDATA[<]]> #{endDate}
            AND output <![CDATA[>=]]> 0
        <if test="workstationIds != null and workstationIds.size() > 0">
            AND workstation_id IN
            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
    </select>
    <select id="getOutputDataByFactoryDate"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput">
        select ts as startTime,
        pre_ts as endTime,
        output,
        cur_output as curOutput,
        pre_output as preOutput,
        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,
        program,
        product_code as productCode,
        product_name as productName,
        workstation_id as workstationId
        from iot_data.super_aggregate_output
        where output <![CDATA[>=]]> 0
        and factory_date <![CDATA[>=]]> #{startDate} and factory_date <![CDATA[<=]]> #{endDate}
        <if test="workstationIds != null and workstationIds.size() > 0">
            AND workstation_id IN
            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
    </select>
    <select id="getOutputDataByWorkstationAndFactoryDate"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput">
@@ -400,6 +347,54 @@
        and output > 0
        and factory_month = #{month}
    </select>
    <!-- sql修改开始 -->
    <!-- åˆ—名中,program和已下的实际上都没有 -->
    <sql id="aggregateOutputColumns">
        pre_time as preTime,
        output,
        cur_output as curOutput,
        pre_output as preOutput,
        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,
        program,
        product_code as productCode,
        product_name as productName,
        workstation_id as workstationId
    </sql>
    <select id="getOutputDataByFactoryDate"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput">
        select <include refid="aggregateOutputColumns"/>
        from root.f2.aggregate_output_*
        where output <![CDATA[>=]]> 0
        and factory_date <![CDATA[>=]]> #{startFatoryDate} and factory_date <![CDATA[<=]]> #{endFatoryDate}
        <if test="workstationIds != null and workstationIds.size() > 0">
            AND workstation_id IN
            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
         align by device
    </select>
    <select id="getOutputDataByNaturalDate" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput">
        select <include refid="aggregateOutputColumns"/>
        from root.f2.aggregate_output_*
        where time <![CDATA[>=]]> #{startDate} and time <![CDATA[<]]> #{endDate}
            AND output <![CDATA[>=]]> 0
        <if test="workstationIds != null and workstationIds.size() > 0">
            AND workstation_id IN
            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
         align by device
    </select>
</mapper>
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateFeedbackMapper.xml
@@ -24,12 +24,19 @@
    </sql>
    <select id="getStatusDataByFactoryDate"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select ts as startTime,
    <!-- ä¿®æ”¹sql开始 -->
    <sql id="aggregateStateColumnSql">
        end_time as endTime,
        duration_collect,
        value_collect,
        duration_collect as durationCollect,
        value_collect as valueCollect,
        calendar_code as calendarCode,
        factory_year as factoryYear,
        factory_month as factoryMonth,
@@ -39,39 +46,42 @@
        shift_time_type as shiftTimeType,
        wcs,
        rps,
        is_deleted as isDeleted,
        workstation_id as workstationId,
        is_plan as isPlan,
        feedback_id as feedbackId
        from iot_data.super_aggregate_state_with_feedback
        where factory_date <![CDATA[>=]]> #{startDate} and factory_date <![CDATA[<=]]> #{endDate}
        and wcs > 0 and is_deleted = false
        <if test="workstationIds != null and workstationIds.size() > 0">
            AND workstation_id IN
            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
    </select>
    <select id="getStatusData" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        is_plan as isPlan
    </sql>
    <!-- ç”±äºŽè¡¨æ•°æ®ä¸€æ ·ï¼ˆiot_data.super_aggregate_state_with_feedback),我们也没有反馈,所以暂时都查一个表 -->
    <select id="getStatusData" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select
        <include refid="superAggregateStateColumnSql"/>
        from iot_data.super_aggregate_state_with_feedback
        where is_deleted = 0
        and wcs > 0 and is_deleted = false
        and ts <![CDATA[>=]]> #{startDate} and ts <![CDATA[<=]]> #{endDate}
        <include refid="aggregateStateColumnSql"/>
        from root.f2.aggregate_state_*
        where is_deleted = false
        and wcs > 0
        and time <![CDATA[>=]]> #{startDate} and time <![CDATA[<=]]> #{endDate}
        <if test="workstationIds != null and workstationIds.size() > 0">
            AND workstation_id IN
            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
        align by device
    </select>
    <select id="getStatusDataByFactoryDate"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select
        <include refid="aggregateStateColumnSql"/>
        from root.f2.aggregate_state_*
        where factory_date <![CDATA[>=]]> #{startFactoryDate} and factory_date <![CDATA[<=]]> #{endFactoryDate}
        and wcs > 0 and is_deleted = false
        <if test="workstationIds != null and workstationIds.size() > 0">
            AND workstation_id IN
            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
         align by device
    </select>
</mapper>
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.xml
@@ -112,129 +112,13 @@
    </select>
    <select id="dateState"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select ts as startTime,
        end_time as endTime,
        duration_collect,
        value_collect,
        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,
        wcs,
        rps,
        is_deleted as isDeleted,
        workstation_id as workstationId,
        is_plan as isPlan
        from iot_data.super_aggregate_state
        where is_deleted = 0
        and wcs > 0
        and factory_date = #{factoryDate}
        <if test="ids != null and ids.size() > 0">
            AND workstation_id IN
            <foreach collection="ids" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
    </select>
    <select id="weekState"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select ts as startTime,
        end_time as endTime,
        duration_collect,
        value_collect,
        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,
        wcs,
        rps,
        is_deleted as isDeleted,
        workstation_id as workstationId,
        is_plan as isPlan
        from iot_data.super_aggregate_state
        where factory_year = #{year}
        and factory_week = #{week}
        and is_deleted = 0
        and wcs > 0
        <if test="ids != null and ids.size() > 0">
            AND workstation_id IN
            <foreach collection="ids" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
    </select>
    <select id="yearState"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select ts as startTime,
        end_time as endTime,
        duration_collect,
        value_collect,
        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,
        wcs,
        rps,
        is_deleted as isDeleted,
        workstation_id as workstationId,
        is_plan as isPlan
        from iot_data.super_aggregate_state
        where factory_year = #{year}
        and factory_month = #{month}
        and is_deleted = 0
        and wcs > 0
        <if test="ids != null and ids.size() > 0">
            AND workstation_id IN
            <foreach collection="ids" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
    </select>
    <select id="shiftState"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select ts as startTime,
        end_time as endTime,
        duration_collect,
        value_collect,
        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,
        wcs,
        rps,
        is_deleted as isDeleted,
        workstation_id as workstationId,
        is_plan as isPlan
        from iot_data.super_aggregate_state
        where factory_date = #{factoryDate}
        and wcs > 0
        and shift_index = #{shiftIndex}
        and calendar_code = #{calendarCode}
        and is_deleted = 0
        <if test="ids != null and ids.size() > 0">
            AND workstation_id IN
            <foreach collection="ids" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
    </select>
    <select id="deviceStatusStatisticsList"
            resultType="com.qianwen.smartman.modules.mdc.vo.DeviceStatusStatisticsVO">
@@ -394,20 +278,7 @@
        </if>
    </select>
    <select id="getStatusData" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select
        <include refid="superAggregateStateColumnSql"/>
        from iot_data.super_aggregate_state
        where is_deleted = 0
        and wcs > 0
        and ts <![CDATA[>=]]> #{startDate} and ts <![CDATA[<]]> #{endDate}
        <if test="workstationIds != null and workstationIds.size() > 0">
            AND workstation_id IN
            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
    </select>
    <sql id="superAggregateStateColumnSql">
        ts as startTime,
@@ -430,35 +301,7 @@
    
    <select id="getStatusDataByFactoryDate"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select ts as startTime,
        end_time as endTime,
        duration_collect,
        value_collect,
        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,
        wcs,
        rps,
        workstation_id as workstationId,
        is_plan as isPlan
        from iot_data.super_aggregate_state
        where factory_date <![CDATA[>=]]> #{startDate} and factory_date <![CDATA[<=]]> #{endDate}
        and rps > 0
        and wcs > 0
        and is_deleted = false
        <if test="workstationIds != null and workstationIds.size() > 0">
            AND workstation_id IN
            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
    </select>
    
@@ -1064,7 +907,6 @@
    <!-- è°ƒæ•´çš„sql开始 -->
    <sql id="aggregateStateColumnSql">
        end_time as endTime,
        duration_collect as durationCollect,
        value_collect as valueCollect,
@@ -1081,6 +923,8 @@
        workstation_id as workstationId,
        is_plan as isPlan
    </sql>
    <!-- åŽŸæ¥æ˜¯union2个sql,现在合并未一个 -->
    <!-- 
    OK: where ((time <![CDATA[<]]> #{startDate} and end_time <![CDATA[>=]]> #{startDate.time}) or (time <![CDATA[>=]]> #{startDate} and time <![CDATA[<=]]> #{endDate.time}))
@@ -1122,5 +966,107 @@
        </if>
          align by device
    </select>
    <select id="getStatusData" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select
        <include refid="aggregateStateColumnSql"/>
        from root.f2.aggregate_state_*
        where is_deleted = false
        and wcs > 0
        and time <![CDATA[>=]]> #{startDate} and time <![CDATA[<]]> #{endDate}
        <if test="workstationIds != null and workstationIds.size() > 0">
            AND workstation_id IN
            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
         align by device
    </select>
    <select id="getStatusDataByFactoryDate"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select <include refid="aggregateStateColumnSql"/>
        from root.f2.aggregate_state_*
        where factory_date <![CDATA[>=]]> #{startFactoryDate} and factory_date <![CDATA[<=]]> #{endFactoryDate}
        and rps > 0
        and wcs > 0
        and is_deleted = false
        <if test="workstationIds != null and workstationIds.size() > 0">
            AND workstation_id IN
            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
        align by device
    </select>
    <!-- æŸ¥è¯¢æŒ‰ç­æ¬¡çš„状态数据,在用时分析中使用 and calendar_code = #{calendarCode,jdbcType=VARCHAR} -->
    <select id="shiftState"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select <include refid="aggregateStateColumnSql"/>
        from root.f2.aggregate_state_*
        where factory_date = #{factoryDate}
        and wcs > 0
        and shift_index = #{shiftIndex}
        and calendar_code = '${calendarCode}'
        and is_deleted = false
        <if test="ids != null and ids.size() > 0">
            AND workstation_id IN
            <foreach collection="ids" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
         align by device
    </select>
    <select id="weekState"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select <include refid="aggregateStateColumnSql"/>
        from root.f2.aggregate_state_*
        where factory_year = #{year}
        and factory_week = #{week}
        and is_deleted = false
        and wcs > 0
        <if test="ids != null and ids.size() > 0">
            AND workstation_id IN
            <foreach collection="ids" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
         align by device
    </select>
    <select id="yearState"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select <include refid="aggregateStateColumnSql"/>
        from root.f2.aggregate_state_*
        where factory_year = #{year}
        and factory_month = #{month}
        and is_deleted = false
        and wcs > 0
        <if test="ids != null and ids.size() > 0">
            AND workstation_id IN
            <foreach collection="ids" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
         align by device
    </select>
    <select id="dateState"
            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
        select <include refid="aggregateStateColumnSql"/>
        from root.f2.aggregate_state_*
        where is_deleted = false
        and wcs > 0
        and factory_date = #{factoryDate}
        <if test="ids != null and ids.size() > 0">
            AND workstation_id IN
            <foreach collection="ids" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
         align by device
    </select>
</mapper>
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml
@@ -14,21 +14,9 @@
        )
    </update>
    <select id="alarmByWorkstation" resultType="com.qianwen.smartman.modules.mdc.vo.AlarmAnalysisWorkstationVO">
        select code    as alarmCode,
               message as alarmMsg,
               ts      as alarmTime
        from iot_data.super_alarm
        where workstation_id = #{workstationId}
        order by ts desc
            limit #{start}, #{end}
    </select>
    <select id="alarmByWorkstationTotal" resultType="java.lang.Integer">
        select count(*)
        from iot_data.super_alarm
        where workstation_id = #{workstationId}
    </select>
    <select id="countAlarm" resultType="java.lang.Long">
        select * count(*)
@@ -270,6 +258,24 @@
    </select>
    <!-- sql修改开始 -->
    <!-- åŽŸå§‹limit limit #{start}, #{end} ï¼Œå®žé™…上end应该是pageSize-->
    <select id="alarmByWorkstation" resultType="com.qianwen.smartman.modules.mdc.vo.AlarmAnalysisWorkstationVO">
        select code    as alarmCode,
               message as alarmMsg
        from root.f2.alarm_*
        where workstation_id = #{workstationId}
        order by time desc
            limit #{end} offset #{start}
          align by device
    </select>
    <select id="alarmByWorkstationTotal" resultType="java.lang.Integer">
        select count(workstation_id)
        from root.f2.alarm_*
        where workstation_id = #{workstationId}
    </select>
</mapper>