From 84eee637c5f26565c34779a4f00dae48018598e7 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期一, 09 九月 2024 15:37:58 +0800
Subject: [PATCH] 产量统计完成
---
smart-man-boot/src/main/java/com/qianwen/smartman/common/typehandlers/NullableSqlTimestampTypeHandler.java | 59 +++
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/OutputStatisticsController.java | 9
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/enums/OpenTypeEnums.java | 6
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.java | 52 ++
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.xml | 274 ++++++----------
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/StatusRecordController.java | 6
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/OutputStatisticsServiceImpl.java | 2
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/WorkstationAnalysisServiceImpl.java | 3
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/WorkstationFeedbackServiceImpl.java | 1
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateOutputServiceImpl.java | 11
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ISuperAggregateOutputService.java | 8
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAggregateState.java | 27 +
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.java | 27 +
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/TimeUsedAnalysisController.java | 6
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/StatusRecordServiceImpl.java | 13
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateStateServiceImpl.java | 71 ++--
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IStatusRecordService.java | 10
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.xml | 107 +++---
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAggregateOutput.java | 41 +-
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/utils/FilterOffUtils.java | 11
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/vo/AlarmAnalysisWorkstationVO.java | 16 +
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/TimeUsedAnalysisServiceImpl.java | 7
smart-man-boot/src/main/java/com/qianwen/smartman/modules/visual/wrapper/VisualCountPulseWrapper.java | 2
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateFeedbackMapper.xml | 70 ++-
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IOutputStatisticsService.java | 6
smart-man-boot/src/main/java/com/qianwen/smartman/modules/visual/wrapper/OutputWrapper.java | 8
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.java | 14
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml | 36 +
smart-man-boot/src/main/resources/application.yml | 1
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateFeedbackMapper.java | 25 +
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ITimeUsedAnalysisService.java | 6
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ISuperAggregateStateService.java | 8
32 files changed, 581 insertions(+), 362 deletions(-)
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/common/typehandlers/NullableSqlTimestampTypeHandler.java b/smart-man-boot/src/main/java/com/qianwen/smartman/common/typehandlers/NullableSqlTimestampTypeHandler.java
new file mode 100644
index 0000000..90bbeed
--- /dev/null
+++ b/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);
+ }
+
+}
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/OutputStatisticsController.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/OutputStatisticsController.java
index 8261ecb..46b413b 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/OutputStatisticsController.java
+++ b/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)
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/StatusRecordController.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/StatusRecordController.java
index b63e248..a3c9bc5 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/StatusRecordController.java
+++ b/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")
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/TimeUsedAnalysisController.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/TimeUsedAnalysisController.java
index 813b166..bb5f619 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/TimeUsedAnalysisController.java
+++ b/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("鎸夊璁惧缁熻鐢ㄦ椂")
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAggregateOutput.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAggregateOutput.java
index 8baceb8..03ceca3 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAggregateOutput.java
+++ b/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() {
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAggregateState.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAggregateState.java
index a16ed34..88c142b 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAggregateState.java
+++ b/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() {
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/enums/OpenTypeEnums.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/enums/OpenTypeEnums.java
index 6021072..624c997 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/enums/OpenTypeEnums.java
+++ b/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("杩愯鐜�"),
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.java
index 1d18017..feb33dd 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.java
+++ b/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);
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateFeedbackMapper.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateFeedbackMapper.java
index 47a4916..2ade957 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateFeedbackMapper.java
+++ b/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);
+ /**
+ * 鎸夌敓浜ф棩鏈熻幏鍙栧弽棣堢姸鎬佽〃鐨勭姸鎬佹暟鎹�,鏃ユ湡鍙傛暟閮借涓篖ocalDateTime
+ * @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);
+ /**
+ * 鑾峰彇鍙嶉鐘舵�佽〃鐨勭姸鎬佹暟鎹�,鏃ユ湡鍙傛暟閮借涓篖ocalDateTime
+ * @param workstationIds
+ * @param startDate
+ * @param endDate
+ * @return
+ */
+ List<SuperAggregateState> getStatusData(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);
}
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.java
index 4982ee5..08dfcee 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.java
+++ b/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);
+ /**
+ * 鏌ヨ鎸囧畾宸ヤ綅绗﹀悎鐝鍜宖actoryDate鐨勬暟鎹紝鐢ㄦ椂鍒嗘瀽涓娇鐢�
+ * @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 鎸囧畾鐨勫伐浣峣d闆嗗悎
+ * @param startDate 寮�濮嬫椂闂�
+ * @param endDate 鎴嚦鏃堕棿
+ * @return 鏁版嵁鍒楄〃
+ */
+ List<SuperAggregateState> getStatusData(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);
/**
* 鏍规嵁宸ヤ綅id鍒楄〃鍜屾椂闂磋妭鐐硅幏鍙栫姸鎬佹暟鎹畒ys,棣栭〉绋煎姩鐜囨椂浣跨敤鐨�
@@ -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);
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.java
index 4cf90f8..d5a7f61 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.java
+++ b/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);
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IOutputStatisticsService.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IOutputStatisticsService.java
index f96d789..adfc4af 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IOutputStatisticsService.java
+++ b/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);
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IStatusRecordService.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IStatusRecordService.java
index 012aa04..13c1e1c 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IStatusRecordService.java
+++ b/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);
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ISuperAggregateOutputService.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ISuperAggregateOutputService.java
index 46e80c7..1021863 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ISuperAggregateOutputService.java
+++ b/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);
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ISuperAggregateStateService.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ISuperAggregateStateService.java
index 6e3166a..2e62203 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ISuperAggregateStateService.java
+++ b/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);
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ITimeUsedAnalysisService.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ITimeUsedAnalysisService.java
index efb4e61..3386790 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/ITimeUsedAnalysisService.java
+++ b/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);
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/OutputStatisticsServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/OutputStatisticsServiceImpl.java
index 4dcf2eb..a150d14 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/OutputStatisticsServiceImpl.java
+++ b/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)) {
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/StatusRecordServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/StatusRecordServiceImpl.java
index e175dae..fd1a666 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/StatusRecordServiceImpl.java
+++ b/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) + "");
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateOutputServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateOutputServiceImpl.java
index 9df33e4..e27f6a9 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateOutputServiceImpl.java
+++ b/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;
}
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateStateServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateStateServiceImpl.java
index dba1f4a..0067d8c 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateStateServiceImpl.java
+++ b/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));//杩欎釜鎵嶈捣浣滅敤锛実etStartTime鑾峰彇鐨勬槸time
}
x.setDurationCollect(LocalDateTimeUtils.betweenTwoTime(x.getStartTime().toLocalDateTime(), x.getEndTime().toLocalDateTime(), ChronoUnit.MILLIS));
- System.out.println(x);
+ //System.out.println(x);
});
return statusDataShift;
}
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/TimeUsedAnalysisServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/TimeUsedAnalysisServiceImpl.java
index 0b495aa..51a8946 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/TimeUsedAnalysisServiceImpl.java
+++ b/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);
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/WorkstationAnalysisServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/WorkstationAnalysisServiceImpl.java
index 6b9b0fe..b140611 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/WorkstationAnalysisServiceImpl.java
+++ b/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;
}
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/WorkstationFeedbackServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/WorkstationFeedbackServiceImpl.java
index e2e994f..24060e2 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/WorkstationFeedbackServiceImpl.java
+++ b/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);
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/utils/FilterOffUtils.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/utils/FilterOffUtils.java
index 6dcdfce..16f31f6 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/utils/FilterOffUtils.java
+++ b/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鏈嶅姟鍣ㄦ湁锛宐lade_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());
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/vo/AlarmAnalysisWorkstationVO.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/vo/AlarmAnalysisWorkstationVO.java
index 6c15aac..5370434 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/vo/AlarmAnalysisWorkstationVO.java
+++ b/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("鎶ヨ浠g爜")
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;
+ }
+
}
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/visual/wrapper/OutputWrapper.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/visual/wrapper/OutputWrapper.java
index e084926..97dc623 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/visual/wrapper/OutputWrapper.java
+++ b/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();
})));
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/visual/wrapper/VisualCountPulseWrapper.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/visual/wrapper/VisualCountPulseWrapper.java
index 0372195..2efbf90 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/visual/wrapper/VisualCountPulseWrapper.java
+++ b/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();
})));
diff --git a/smart-man-boot/src/main/resources/application.yml b/smart-man-boot/src/main/resources/application.yml
index 7b709b6..a42057e 100644
--- a/smart-man-boot/src/main/resources/application.yml
+++ b/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
#瀹炰綋鎵弿锛屽涓猵ackage鐢ㄩ�楀彿鎴栬�呭垎鍙峰垎闅�
diff --git a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.xml b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.xml
index a69da78..bdecc59 100644
--- a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.xml
+++ b/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>
diff --git a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateFeedbackMapper.xml b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateFeedbackMapper.xml
index 5e84995..08d6275 100644
--- a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateFeedbackMapper.xml
+++ b/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>
diff --git a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.xml b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.xml
index 1fac162..1e9fa8e 100644
--- a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.xml
+++ b/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 @@
<!-- 璋冩暣鐨剆ql寮�濮� -->
<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>
+
+
<!-- 鍘熸潵鏄痷nion2涓猻ql锛岀幇鍦ㄥ悎骞舵湭涓�涓� -->
<!--
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>
diff --git a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml
index a6b431e..a3c33fe 100644
--- a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml
+++ b/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搴旇鏄痯ageSize-->
+ <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>
--
Gitblit v1.9.3