From fa68e7add2eb49f83736872edf6e0c3fe5d8b46f Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期二, 10 九月 2024 16:41:35 +0800
Subject: [PATCH] 增加一些注释
---
smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/service/impl/WorkstationWcsServiceImpl.java | 19 ++
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/ProcessParameterServiceImpl.java | 72 +++++++++-
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/ProcessParameterController.java | 8
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.java | 28 +++
smart-man-boot/src/main/java/com/qianwen/smartman/common/enums/WcsDataTypeEnums.java | 4
smart-man-boot/src/main/java/com/qianwen/smartman/modules/tdengine/service/impl/WorkstationDynamicCollectServiceImpl.java | 2
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAlarm.java | 22 +-
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.java | 27 +++
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml | 33 ++++
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IProcessParameterService.java | 10 +
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml | 123 +++++++++-------
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/AlarmServiceImpl.java | 10
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/convert/AlarmConvert.java | 2
smart-man-boot/src/main/java/com/qianwen/smartman/modules/fms/service/impl/FmsDeviceAnalysisServiceImpl.java | 2
smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/entity/WorkstationWcs.java | 4
15 files changed, 264 insertions(+), 102 deletions(-)
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/common/enums/WcsDataTypeEnums.java b/smart-man-boot/src/main/java/com/qianwen/smartman/common/enums/WcsDataTypeEnums.java
index ebcbc6f..060fe61 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/common/enums/WcsDataTypeEnums.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/common/enums/WcsDataTypeEnums.java
@@ -4,7 +4,9 @@
import java.util.List;
import java.util.stream.Collectors;
-
+/*
+ * 宸ュ喌鏁版嵁鐨勭被鍨�
+ */
public class WcsDataTypeEnums {
public static List<Integer> ONLY_ONE_LIST = Arrays.stream(WcsDataType.values()).filter((v0) -> {
return v0.isOnly();
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/entity/WorkstationWcs.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/entity/WorkstationWcs.java
index a39a36a..cc846a7 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/entity/WorkstationWcs.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/entity/WorkstationWcs.java
@@ -2,7 +2,9 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.qianwen.core.tenant.mp.TenantEntity;
-
+/**
+ * 宸ュ喌鍙傛暟锛坵cs锛�
+ */
@TableName("blade_workstation_wcs")
public class WorkstationWcs extends TenantEntity {
private static final long serialVersionUID = 6406569428341022321L;
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/service/impl/WorkstationWcsServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/service/impl/WorkstationWcsServiceImpl.java
index ef80713..624ed74 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/service/impl/WorkstationWcsServiceImpl.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/service/impl/WorkstationWcsServiceImpl.java
@@ -89,7 +89,7 @@
if (Func.isNotEmpty(ids)) {
workstationWcsIdList.addAll(ids);
} else {
- checkWorkstationWcs(workstationWcs);
+ checkWorkstationWcs(workstationWcs);//妫�鏌ユ暟鎹槸鍚﹀瓨鍦�
setCrc(workstationWcs);
}
MachineDmpVariablesVO machineDmpVariablesVO = this.dmpVariablesService.listByWorkstationId(workstationWcs.getWorkstationId());
@@ -133,14 +133,17 @@
validWorkstationExistsWcs(checkedVoList);
List<DmpVariables> dmpVariablesList = validDmpName(workstationId, checkedVoList);
List<WorkstationWcs> saveWorkstationWcsList = WorkstationWcsConvert.INSTANCE.convertVOToEntity(checkedVoList);
+
+ //鍒犻櫎tdengine涓殑count_data_${workstationId}_${usageCode}鍜宎ggregate_count_data_${workstationId}_${usageCode},瀹為檯涓婅繖2涓〃涓嶅瓨鍦�
this.dynamicCollectService.removeTableUpdateWcs(saveWorkstationWcsList);
+ //涔熸槸鍒犻櫎浠ヤ笂2涓〃锛屼篃鏄笉瀛樺湪鐨勮〃
this.dynamicCollectService.removeTableDeleteWcs(list(Lambda.eq(WorkstationWcs::getWorkstationId, workstationId)
.notIn(Func.isNotEmpty(saveWorkstationWcsList), WorkstationWcs::getCollectSettingItem, saveWorkstationWcsList
.stream().map(WorkstationWcs::getCollectSettingItem)
.collect(Collectors.toList()))));
- deleteByWorkstationIdList(Collections.singletonList(workstationId));
+ deleteByWorkstationIdList(Collections.singletonList(workstationId));//鍒犻櫎workstation_wsc鐨勮�佹暟鎹�
for (WorkstationWcs workstationWcs : saveWorkstationWcsList) {
checkWorkstationWcs(workstationWcs);
setCrc(workstationWcs);
@@ -149,15 +152,19 @@
return Func.isNotEmpty(w.getDataItem());
}).collect(Collectors.toList());
saveOrUpdateBatch(collect);
+
+ //涓嬩竴姝ユ洿鏂版帓搴忥紙idx)
Map<Long, Integer> idToIdx = workstationWcsSaveVOList.stream().collect(Collectors.toMap((v0) -> {
return v0.getDmpVariablesId();
}, (v0) -> {
return v0.getSort();
}));
dmpVariablesList.forEach(dmpVariables -> {
- dmpVariables.setIdx((Integer) idToIdx.get(dmpVariables.getId()));
+ dmpVariables.setIdx(idToIdx.get(dmpVariables.getId()));//鏇存柊绱㈠紩搴忓彿
});
this.dmpVariablesService.updateBatchById(dmpVariablesList);
+
+ //鏇存柊缂撳瓨
List<Long> workstationIds = workstationWcsSaveVOList.stream().map((v0) -> {
return v0.getWorkstationId();
}).collect(Collectors.toList());
@@ -166,6 +173,8 @@
WorkstationCache.clearWorkstationWcs(String.valueOf(id));
});
clearWorkstationParamTypeCacheByWorkstationId(workstationIds);
+
+ //杩斿洖鎵�鏈夋暟鎹殑VO鍒楄〃
return WorkstationWcsConvert.INSTANCE.convert(saveWorkstationWcsList);
}
@@ -429,6 +438,10 @@
return Func.isNotEmpty(name) ? name.substring(1) : name.toString();
}
+ /***
+ * 妫�鏌ュ伐鍐靛弬鏁伴厤缃殑鏁版嵁绫诲瀷dataType,鍜屽搴旂殑鏁版嵁鏄惁瀛樺湪
+ * @param workstationWcs
+ */
private void checkWorkstationWcs(WorkstationWcs workstationWcs) {
if (WcsDataTypeEnums.ONLY_ONE_LIST.contains(workstationWcs.getDataType())) {
Long count = Long.valueOf(count(Wrappers.<WorkstationWcs>lambdaQuery()
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/fms/service/impl/FmsDeviceAnalysisServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/fms/service/impl/FmsDeviceAnalysisServiceImpl.java
index 28b6414..449cd75 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/fms/service/impl/FmsDeviceAnalysisServiceImpl.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/fms/service/impl/FmsDeviceAnalysisServiceImpl.java
@@ -256,7 +256,7 @@
List<SuperAlarm> superAlarms = this.superAlarmMapper.pageAlarm(query.getCurrent(), query.getSize(), workstationId);
List<FmsAlarmVO> fmsAlarmVOS = new ArrayList<>();
for (SuperAlarm alarm : superAlarms) {
- Timestamp ts = alarm.getTs();
+ Timestamp ts = alarm.getTime();
FmsAlarmVO fmsAlarmVO = new FmsAlarmVO();
fmsAlarmVO.setDate(DateUtil.format(new Date(ts.getTime()), DateConstant.PATTERN_DATE_TIME));
fmsAlarmVO.setCode(alarm.getCode());
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/ProcessParameterController.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/ProcessParameterController.java
index b09b735..9a43c65 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/ProcessParameterController.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/controller/ProcessParameterController.java
@@ -29,6 +29,8 @@
import com.qianwen.smartman.modules.mdc.vo.ShiftTimeVO;
import com.qianwen.smartman.modules.mdc.vo.WorkstationShiftSearchVO;
import com.qianwen.smartman.modules.mdc.vo.excel.ProcessParamExcelVO;
+
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@@ -37,11 +39,9 @@
@ApiResource({"blade-mdc/process-parameter"})
@RestController
public class ProcessParameterController {
- private final IProcessParameterService processParameterService;
+ @Autowired
+ private IProcessParameterService processParameterService;
- public ProcessParameterController(final IProcessParameterService processParameterService) {
- this.processParameterService = processParameterService;
- }
@ApiOperationSupport(order = 1)
@PostResource({"/chart"})
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/convert/AlarmConvert.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/convert/AlarmConvert.java
index 227b61f..84de128 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/convert/AlarmConvert.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/convert/AlarmConvert.java
@@ -14,7 +14,7 @@
public interface AlarmConvert {
public static final AlarmConvert INSTANCE = (AlarmConvert) Mappers.getMapper(AlarmConvert.class);
- @Mappings({@Mapping(target = "alarmTime", expression = "java(ConvertUtils.format(alarm.getTs()))"), @Mapping(target = "alarmCode", source = "code"), @Mapping(target = "alarmMsg", source = "message"), @Mapping(target = "count", expression = "java(ConvertUtils.defaultValue())")})
+ @Mappings({@Mapping(target = "alarmTime", expression = "java(ConvertUtils.format(alarm.getTime()))"), @Mapping(target = "alarmCode", source = "code"), @Mapping(target = "alarmMsg", source = "message"), @Mapping(target = "count", expression = "java(ConvertUtils.defaultValue())")})
AlarmDataSheetVO convert(SuperAlarm alarm);
@Mappings({})
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAlarm.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAlarm.java
index 557ae36..9f447b2 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAlarm.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/entity/SuperAlarm.java
@@ -7,13 +7,13 @@
*/
public class SuperAlarm extends SuperAggregate implements Serializable {
private static final long serialVersionUID = 1123326427413588953L;
- private Timestamp ts;
+ private Timestamp time;
private String code;
private String message;
private String level;
- public void setTs(final Timestamp ts) {
- this.ts = ts;
+ public void setTime(final Timestamp time) {
+ this.time = time;
}
public void setCode(final String code) {
@@ -30,14 +30,14 @@
@Override // org.springblade.modules.mdc.entity.SuperAggregate
public String toString() {
- return "SuperAlarm(ts=" + getTs() + ", code=" + getCode() + ", message=" + getMessage() + ", level=" + getLevel() + ")";
+ return "SuperAlarm(time=" + getTime() + ", code=" + getCode() + ", message=" + getMessage() + ", level=" + getLevel() + ")";
}
public SuperAlarm() {
}
- public SuperAlarm(final Timestamp ts, final String code, final String message, final String level) {
- this.ts = ts;
+ public SuperAlarm(final Timestamp time, final String code, final String message, final String level) {
+ this.time = time;
this.code = code;
this.message = message;
this.level = level;
@@ -51,8 +51,8 @@
if (o instanceof SuperAlarm) {
SuperAlarm other = (SuperAlarm) o;
if (other.canEqual(this) && super.equals(o)) {
- Object this$ts = getTs();
- Object other$ts = other.getTs();
+ Object this$ts = getTime();
+ Object other$ts = other.getTime();
if (this$ts == null) {
if (other$ts != null) {
return false;
@@ -95,7 +95,7 @@
@Override // org.springblade.modules.mdc.entity.SuperAggregate
public int hashCode() {
int result = super.hashCode();
- Object $ts = getTs();
+ Object $ts = getTime();
int result2 = (result * 59) + ($ts == null ? 43 : $ts.hashCode());
Object $code = getCode();
int result3 = (result2 * 59) + ($code == null ? 43 : $code.hashCode());
@@ -105,8 +105,8 @@
return (result4 * 59) + ($level == null ? 43 : $level.hashCode());
}
- public Timestamp getTs() {
- return this.ts;
+ public Timestamp getTime() {
+ return this.time;
}
public String getCode() {
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 d5a7f61..25163d8 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
@@ -41,13 +41,32 @@
Long countAlarm(@Param("vo") AlarmShiftSearchVO vo, @Param("queryTime") String queryTime);
- List<SuperAlarm> selectListAlarm(@Param("vo") AlarmShiftSearchVO vo, @Param("queryTime") String queryTime);
+ /**
+ * 鎶ヨ鐨勫垪琛ㄦ煡璇紝鎸夋椂闂�
+ * @param vo 鏌ヨ鍙傛暟
+ * @param queryTime
+ * @return
+ */
+ List<SuperAlarm> selectListAlarm(@Param("vo") AlarmShiftSearchVO vo, @Param("factoryDate") int factoryDate);
- List<SuperAlarm> queryAlarm(@Param("query") Query query, @Param("vo") AlarmShiftSearchVO vo, @Param("queryTime") String queryTime);
+ /**
+ * 鏌ヨ鎶ヨ鍒嗛〉鏁版嵁
+ * @param query
+ * @param vo
+ * @param factoryDate
+ * @return
+ */
+ List<SuperAlarm> queryAlarm(@Param("query") Query query, @Param("vo") AlarmShiftSearchVO vo, @Param("factoryDate") int factoryDate);
List<SuperAlarm> selectAllAlarm(@Param("vo") AlarmShiftSearchExcelVO vo, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("year") Integer year, @Param("list") List<Integer> list);
-
- List<SuperAlarm> selectListAlarmByShift(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("workstationId") Long workstationId);
+ /**
+ * 鎸夌彮娆℃煡璇㈡姤璀︽暟鎹�
+ * @param startDate
+ * @param endDate
+ * @param workstationId
+ * @return
+ */
+ List<SuperAlarm> selectListAlarmByShift(@Param("startFactoryDate") int startFactoryDate, @Param("endFactoryDate") int endFactoryDate, @Param("workstationId") Long workstationId);
List<WorkstaionAlarmByTimeReportVO> alarmReportByTime(@Param("ids") List<Long> workstationIds, @Param("beginTime") String startDate, @Param("endTime") String endDate);
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.java
index dfeddc6..01ef236 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.java
@@ -31,9 +31,29 @@
List<ProcessParameterVO> processParameterListByShift(@Param("times") List<TimeDTO> times, @Param("collectItems") List<String> collectItems, @Param("workstationId") String workstationId);
- List<ProcessParameterVO> oldOneCollectList(@Param("workstationId") String workstationId, @Param("item") String item, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
+ List<ProcessParameterVO> oldOneCollectList(@Param("workstationId") Long workstationId, @Param("item") String item, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
- ProcessParameterVO oldFirstStatue(@Param("workstationId") String workstationId, @Param("item") String item, @Param("startTime") Long startTime);
-
- ProcessParameterVO oldLastStatue(@Param("workstationId") String workstationId, @Param("item") String item, @Param("endTime") Long endTime);
+ /**
+ * ???
+ * @param workstationId
+ * @param item
+ * @param startTime
+ * @return
+ */
+ //ProcessParameterVO oldFirstStatue(@Param("workstationId") String workstationId, @Param("item") String item, @Param("startTime") Long startTime);
+ LastProcessParam lastParameterLessThanTime(@Param("workstationId") Long workstationId, @Param("item") String item, @Param("startTime") Long startTime);
+
+ /**
+ *
+ * @param workstationId
+ * @param item
+ * @param startTime
+ * @return
+ */
+ //ProcessParameterVO oldLastStatue(@Param("workstationId") String workstationId, @Param("item") String item, @Param("endTime") Long endTime);
+ LastProcessParam lastParameterGreaterThanTime(@Param("workstationId") Long workstationId, @Param("item") String item, @Param("endTime") Long endTime);
+
+
+
+
}
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IProcessParameterService.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IProcessParameterService.java
index f2a4d34..591b69b 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IProcessParameterService.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/IProcessParameterService.java
@@ -26,6 +26,11 @@
IPage<ProcessParameterRealVO> pageProcessParameter(Query query, ProcessParameterItemSearchVO vo);
+ /**
+ * 鑾峰彇宸ヤ綅鐨勬墍鏈夐噰闆嗗弬鏁板垪琛�
+ * @param workstationId
+ * @return
+ */
List<WorkstationWcsDmpDTO> processParam(String workstationId);
ProParamSheetVO queryProcessParameterSheet(ProcessParameterSearchVO vo, Boolean isFilterProcessParameter);
@@ -34,6 +39,11 @@
ShiftTimeVO getShiftTime(ProcessParameterSearchVO vo);
+ /**
+ * 鏌ヨ鍗曚釜杩囩▼鍙傛暟鐨勫浘琛ㄦ暟鎹�
+ * @param vo
+ * @return
+ */
CollectParamResVO<?> queryProcessParameterOneChart(CollectParamSearchVO vo);
List<AllShiftTimeDetail> getAllShiftTime(WorkstationShiftSearchVO vo);
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/AlarmServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/AlarmServiceImpl.java
index ae94770..326e643 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/AlarmServiceImpl.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/AlarmServiceImpl.java
@@ -80,7 +80,7 @@
return new Page<>();
}
LocalDate queryTime = vo.getQueryTime();
- List<SuperAlarm> list = this.alarmMapper.selectListAlarm(vo, DateUtil.format(queryTime, "yyyyMMdd"));
+ List<SuperAlarm> list = this.alarmMapper.selectListAlarm(vo,Integer.parseInt(DateUtil.format(queryTime, "yyyyMMdd")));
Map<String, List<SuperAlarm>> map = FilterOffUtils.filterOffDay(list, OpenTypeEnums.ALARM_ANALYSIS).stream().collect(Collectors.groupingBy(c -> {
return c.getCode() + c.getMessage();
}));
@@ -90,14 +90,14 @@
if (map.size() == 0) {
return page;
}
- List<SuperAlarm> alarms = this.alarmMapper.selectListAlarm(vo, DateUtil.format(queryTime, "yyyyMMdd"));
+ List<SuperAlarm> alarms = this.alarmMapper.selectListAlarm(vo, Integer.parseInt(DateUtil.format(queryTime, "yyyyMMdd")));
List<AlarmDataSheetVO> res = AlarmConvert.INSTANCE.convert(FilterOffUtils.filterOffDay(alarms, OpenTypeEnums.ALARM_ANALYSIS));
List<AlarmDataSheetVO> alarmDataSheetVOS = new ArrayList<>();
Map<String, List<AlarmDataSheetVO>> resMap = res.stream().collect(Collectors.groupingBy(c2 -> {
return c2.getAlarmCode() + c2.getAlarmMsg();
}));
resMap.values().forEach(alarmDataSheetVOList -> {
- ((AlarmDataSheetVO) alarmDataSheetVOList.get(0)).setCount(Integer.valueOf(alarmDataSheetVOList.size()));
+ ((AlarmDataSheetVO) alarmDataSheetVOList.get(0)).setCount(alarmDataSheetVOList.size());
alarmDataSheetVOS.add(alarmDataSheetVOList.get(0));
});
if (query.getSize().intValue() == -1) {
@@ -114,7 +114,7 @@
public BladeFile exportAlarm(AlarmShiftSearchExcelVO vo) {
BladeFile bladeFile;
- List<SuperAlarm> superAlarms = this.alarmMapper.selectListAlarmByShift(LocalDateTimeUtils.formatTimeLocalDate(vo.getStartTime(), "yyyyMMdd"), LocalDateTimeUtils.formatTimeLocalDate(vo.getEndTime(), "yyyyMMdd"), vo.getWorkstationId());
+ List<SuperAlarm> superAlarms = this.alarmMapper.selectListAlarmByShift(Integer.parseInt(LocalDateTimeUtils.formatTimeLocalDate(vo.getStartTime(), "yyyyMMdd")) , Integer.parseInt(LocalDateTimeUtils.formatTimeLocalDate(vo.getEndTime(), "yyyyMMdd")), vo.getWorkstationId());
superAlarms = FilterOffUtils.filterOffDay(superAlarms, OpenTypeEnums.ALARM_ANALYSIS);
superAlarms.sort(Comparator.comparing(SuperAggregate::getFactoryDate));
Collections.reverse(superAlarms);
@@ -246,7 +246,7 @@
if (Func.isNull(vo.getWorkstationId())) {
return new AlarmSummaryGraphVO();
}
- List<SuperAlarm> alarms = this.alarmMapper.queryAlarm(null, vo, DateUtil.format(vo.getQueryTime(), "yyyyMMdd"));
+ List<SuperAlarm> alarms = this.alarmMapper.queryAlarm(null, vo,Integer.parseInt(DateUtil.format(vo.getQueryTime(), "yyyyMMdd")) );
Map<String, Integer> map = FilterOffUtils.filterOffDay(alarms, OpenTypeEnums.ALARM_ANALYSIS).stream().collect(Collectors.groupingBy((v0) -> {
return v0.getCode();
}, Collectors.reducing(0, e -> {
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/ProcessParameterServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/ProcessParameterServiceImpl.java
index df5260f..077ac14 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/ProcessParameterServiceImpl.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/ProcessParameterServiceImpl.java
@@ -8,6 +8,8 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+
+import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
@@ -198,7 +200,8 @@
if (startTime.after(now)) {
return new CollectParamResVO<>();
}
- String workstationId = vo.getWorkstationId();
+ //String workstationId = vo.getWorkstationId();
+ Long workstationId = Long.parseLong(vo.getWorkstationId());
List<ProcessParameterVO> processParameterList = getProcessParameterList(startTime, endTime, workstationId, vo.getDmpDTO());
return getCollectParamResVO(vo.getDmpDTO(), processParameterList);
}
@@ -246,7 +249,15 @@
}
}
- private List<ProcessParameterVO> getProcessParameterList(Date startTime, Date endTime, String workstationId, WorkstationWcsDmpDTO dmpDTO) {
+ /**
+ * 鑾峰彇杩囩▼鍙傛暟鍒楄〃
+ * @param startTime
+ * @param endTime
+ * @param workstationId
+ * @param dmpDTO
+ * @return
+ */
+ private List<ProcessParameterVO> getProcessParameterList(Date startTime, Date endTime, Long workstationId, WorkstationWcsDmpDTO dmpDTO) {
ProcessParameterVO firstStatue = oldFirstStatue(startTime, dmpDTO.getName(), workstationId);
ProcessParameterVO endStatue = oldLastStatue(endTime, dmpDTO.getName(), workstationId);
List<ProcessParameterVO> processParameterList = oldOneCollectList(startTime, endTime, dmpDTO.getName(), workstationId);
@@ -506,23 +517,25 @@
return this.parameterMapper.queryProcessParameter(workstationId, collectItems, Long.valueOf(startTime.getTime()), Long.valueOf(endTime.getTime()));
}
- private ProcessParameterVO oldFirstStatue(Date startTime, String item, String workstationId) {
- ProcessParameterVO vo = this.parameterMapper.oldFirstStatue(workstationId, item, Long.valueOf(startTime.getTime()));
+ private ProcessParameterVO oldFirstStatue(Date startTime, String item, Long workstationId) {
+ //ProcessParameterVO vo = this.parameterMapper.oldFirstStatue(workstationId, item, Long.valueOf(startTime.getTime()));
+ ProcessParameterVO vo = this.getLastParameterLessThanTime(workstationId, item, startTime.getTime());
if (Func.notNull(vo)) {
vo.setCollectItem(item);
}
return vo;
}
- private ProcessParameterVO oldLastStatue(Date endTime, String item, String workstationId) {
- ProcessParameterVO vo = this.parameterMapper.oldLastStatue(workstationId, item, Long.valueOf(endTime.getTime()));
+ private ProcessParameterVO oldLastStatue(Date endTime, String item, Long workstationId) {
+ //ProcessParameterVO vo = this.parameterMapper.oldLastStatue(workstationId, item, Long.valueOf(endTime.getTime()));
+ ProcessParameterVO vo = this.getLastParameterGreaterThenTime(workstationId, item, Long.valueOf(endTime.getTime()));
if (Func.notNull(vo)) {
vo.setCollectItem(item);
}
return vo;
}
- private List<ProcessParameterVO> oldOneCollectList(Date startTime, Date endTime, String item, String workstationId) {
+ private List<ProcessParameterVO> oldOneCollectList(Date startTime, Date endTime, String item, Long workstationId) {
return this.parameterMapper.oldOneCollectList(workstationId, item, Long.valueOf(startTime.getTime()), Long.valueOf(endTime.getTime()));
}
@@ -660,4 +673,49 @@
return result;
}
+
+
+ public ProcessParameterVO getLastParameterLessThanTime(long workstationId,String item,Long time) {
+ //yys
+ LastProcessParam lp = this.parameterMapper.lastParameterLessThanTime(workstationId,item,time);
+ if(lp == null) {
+ return null;
+ }
+ ProcessParameterVO vo = new ProcessParameterVO();
+ //瑙f瀽json涓哄璞″垪琛�
+ JSONObject paramsObj = JSONObject.parseObject(lp.getParamJson());
+
+ if(paramsObj.containsKey(item)) {
+ JSONObject itemObj = paramsObj.getJSONObject(item);
+
+ Long lastTime = itemObj.getLong("time");
+ vo.setTime(new Timestamp(lastTime));
+ vo.setRealTime(lastTime);
+ vo.setValueCollect(itemObj.getString("value"));
+ }
+
+ return vo;
+ }
+
+ public ProcessParameterVO getLastParameterGreaterThenTime(long workstationId,String item,Long time) {
+ //yys
+ LastProcessParam lp = this.parameterMapper.lastParameterGreaterThanTime(workstationId,item,time);
+ if(lp == null) {
+ return null;
+ }
+ ProcessParameterVO vo = new ProcessParameterVO();
+ //瑙f瀽json涓哄璞″垪琛�
+ JSONObject paramsObj = JSONObject.parseObject(lp.getParamJson());
+
+ if(paramsObj.containsKey(item)) {
+ JSONObject itemObj = paramsObj.getJSONObject(item);
+
+ Long lastTime = itemObj.getLong("time");
+ vo.setTime(new Timestamp(lastTime));
+ vo.setRealTime(lastTime);
+ vo.setValueCollect(itemObj.getString("value"));
+ }
+
+ return vo;
+ }
}
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/tdengine/service/impl/WorkstationDynamicCollectServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/tdengine/service/impl/WorkstationDynamicCollectServiceImpl.java
index 4e67bd9..ff62a77 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/tdengine/service/impl/WorkstationDynamicCollectServiceImpl.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/tdengine/service/impl/WorkstationDynamicCollectServiceImpl.java
@@ -81,7 +81,7 @@
@Override
public void removeTableUpdateWcs(List<WorkstationWcs> updateWcsList) {
Map<Long, WorkstationWcs> current = new HashMap<>();
-
+ //鍒犻櫎鏃跺簭鏁版嵁搴撲腑鐨勮〃
updateWcsList.stream().filter(it -> Func.isNotEmpty(it.getUsageId())).peek(it -> current.put(it.getWorkstationId(),it)).map(it ->{
return this.workstationWcsService.getOne(Lambda.<WorkstationWcs>eq(WorkstationWcs::getWorkstationId, it.getWorkstationId()).eq(WorkstationWcs::getCollectSettingItem, it.getCollectSettingItem()).ne(WorkstationWcs::getDataType, WcsDataTypeEnums.WcsDataType.OTHER.getCode()));
}) .filter(Func::notNull)
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 a3c33fe..a9d7326 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
@@ -44,55 +44,9 @@
</select>
- <select id="selectListAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
- select *
- from iot_data.super_alarm
- where workstation_id = #{vo.workstationId}
- /*鎸夌収鐝鏌ヨ*/
- <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@SHIFT == vo.enums">
- and shift_index = #{vo.shiftIndex}
- and factory_date = #{queryTime}
- </if>
- /*鎸夌収鏃ユ煡璇�*/
- <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@DAY == vo.enums">
- and factory_date = #{queryTime}
- </if>
- /*鎸夌収鏈堟煡璇�*/
- <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@MONTH == vo.enums">
- and factory_year = #{vo.year}
- and factory_month = #{vo.month}
- </if>
- /*鎸夌収鍛ㄨ*/
- <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@WEEK == vo.enums">
- and factory_year = #{vo.year}
- and factory_week = #{vo.week}
- </if>
- </select>
+
- <select id="queryAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
- select *
- from iot_data.super_alarm
- where workstation_id = #{vo.workstationId}
- <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@SHIFT == vo.enums">
- and shift_index = #{vo.shiftIndex}
- and factory_date = #{queryTime}
- </if>
- <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@DAY == vo.enums">
- and factory_date = #{queryTime}
- </if>
- <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@MONTH == vo.enums">
- and factory_year = #{vo.year}
- and factory_month = #{vo.month}
- </if>
- <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@WEEK == vo.enums">
- and factory_year = #{vo.year}
- and factory_week = #{vo.week}
- </if>
- order by ts desc
- <if test="query != null">
- limit ${(query.current - 1) * query.size}, ${query.size}
- </if>
- </select>
+
<select id="selectAllAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
select *
@@ -122,13 +76,7 @@
order by ts desc
</select>
- <select id="selectListAlarmByShift" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
- select *
- from iot_data.super_alarm
- where workstation_id = #{workstationId}
- and factory_date <![CDATA[>=]]> #{startDate}
- and factory_date <![CDATA[<=]]> #{endDate}
- </select>
+
<select id="alarmReportByTime" resultType="com.qianwen.smartman.modules.report.vo.WorkstaionAlarmByTimeReportVO">
select
@@ -275,7 +223,72 @@
select count(workstation_id)
from root.f2.alarm_*
where workstation_id = #{workstationId}
+ </select>
+
+ <!-- , -->
+ <sql id="alarmColumns">
+ code,message,level,workstation_id as workstationId,calendar_code as calendarCode,factory_year as factoryYear,factory_month as factoryMonth,factory_week as factoryWeek,factory_date as factoryDate,shift_index as shiftIndex,shift_time_type as shiftTimeType
+ </sql>
+
+ <select id="selectListAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
+ select <include refid="alarmColumns"/>
+ from root.f2.alarm_*
+ where workstation_id = #{vo.workstationId}
+ <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@SHIFT == vo.enums">
+ and shift_index = #{vo.shiftIndex}
+ and factory_date = #{factoryDate}
+ </if>
+
+ <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@DAY == vo.enums">
+ and factory_date = #{factoryDate}
+ </if>
+
+ <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@MONTH == vo.enums">
+ and factory_year = #{vo.year}
+ and factory_month = #{vo.month}
+ </if>
+
+ <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@WEEK == vo.enums">
+ and factory_year = #{vo.year}
+ and factory_week = #{vo.week}
+ </if>
+ align by device
+ </select>
+
+ <select id="queryAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
+ select <include refid="alarmColumns"/>
+ from root.f2.alarm_*
+ where workstation_id = #{vo.workstationId}
+ <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@SHIFT == vo.enums">
+ and shift_index = #{vo.shiftIndex}
+ and factory_date = #{factoryDate}
+ </if>
+ <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@DAY == vo.enums">
+ and factory_date = #{factoryDate}
+ </if>
+ <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@MONTH == vo.enums">
+ and factory_year = #{vo.year}
+ and factory_month = #{vo.month}
+ </if>
+ <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@WEEK == vo.enums">
+ and factory_year = #{vo.year}
+ and factory_week = #{vo.week}
+ </if>
+ order by time desc
+ <if test="query != null">
+ limit ${query.size} offset ${(query.current - 1) * query.size}
+ </if>
+ align by device
+ </select>
+
+ <select id="selectListAlarmByShift" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
+ select <include refid="alarmColumns"/>
+ from root.f2.alarm_*
+ where workstation_id = #{workstationId}
+ and factory_date <![CDATA[>=]]> #{startFactoryDate}
+ and factory_date <![CDATA[<=]]> #{endFactoryDate}
+ align by device
</select>
</mapper>
diff --git a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml
index 4e85743..2130bba 100644
--- a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml
+++ b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml
@@ -16,9 +16,7 @@
group by workstation_id,n
</select>
- <select id="getLastParameters" resultType="com.qianwen.smartman.modules.mdc.entity.LastProcessParam">
- select workstation_id as workstationId,update_time as updateTime, param_json as paramJson from root.f2.last_process_param where workstation_id = #{workstationId}
- </select>
+
<select id="queryProcessParameter" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
select ts as time,
@@ -117,6 +115,7 @@
order by ts
</select>
+ <!--
<select id="oldFirstStatue" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
select last(ts) as realTime,
last(v) as value_collect
@@ -125,7 +124,8 @@
and ts < #{startTime}
and workstation_id = #{workstationId}
</select>
-
+ -->
+ <!--
<select id="oldLastStatue" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
select last(ts) as realTime,
last(v) as value_collect
@@ -134,5 +134,30 @@
and ts > #{endTime}
and workstation_id = #{workstationId}
</select>
+ -->
+
+ <!-- sql淇敼寮�濮� -->
+ <select id="getLastParameters" resultType="com.qianwen.smartman.modules.mdc.entity.LastProcessParam">
+ select workstation_id as workstationId,update_time as updateTime, param_json as paramJson from root.f2.last_process_param where workstation_id = #{workstationId}
+ </select>
+
+
+
+ <!-- 鏍规嵁oldFirstStatue 鏀归�犵殑-->
+ <select id="lastParameterLessThanTime" resultType="com.qianwen.smartman.modules.mdc.entity.LastProcessParam">
+ select workstation_id as workstationId,update_time as updateTime, param_json as paramJson
+ from root.f2.last_process_param
+ where n = #{item}
+ and time < #{startTime}
+ and workstation_id = #{workstationId}
+ </select>
+ <!-- 鏍规嵁oldLastStatue鏀圭殑 -->
+ <select id="lastParameterGreaterThanTime" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
+ select workstation_id as workstationId,update_time as updateTime, param_json as paramJson
+ from root.f2.last_process_param
+ where n = #{item}
+ and ts > #{endTime}
+ and workstation_id = #{workstationId}
+ </select>
</mapper>
--
Gitblit v1.9.3