diff --git a/productionboard/src/main/java/com/productionboard/controller/TankShellDeviceController.java b/productionboard/src/main/java/com/productionboard/controller/TankShellDeviceController.java index fe15b3e..636cd76 100644 --- a/productionboard/src/main/java/com/productionboard/controller/TankShellDeviceController.java +++ b/productionboard/src/main/java/com/productionboard/controller/TankShellDeviceController.java @@ -39,4 +39,17 @@ public class TankShellDeviceController { System.out.println("打印JSON:"+energyConsumptionJson); return energyConsumptionJson; } + + /** + * 获取OEE统计数据 + * @author WenJY + * @date 2022-06-08 18:23 + * @return java.lang.String + */ + @GetMapping("/getOeeStatistics") + @ResponseBody + public String getOeeStatisticsJson(){ + String oeeStatisticsJson = iTankShellDeviceInfoService.getOeeStatisticsJson(); + return oeeStatisticsJson; + } } diff --git a/productionboard/src/main/java/com/productionboard/entity/TankShellDevice/TankShellEnergyConsumption.java b/productionboard/src/main/java/com/productionboard/entity/TankShellDevice/TankShellEnergyConsumption.java index 1422d50..33d2230 100644 --- a/productionboard/src/main/java/com/productionboard/entity/TankShellDevice/TankShellEnergyConsumption.java +++ b/productionboard/src/main/java/com/productionboard/entity/TankShellDevice/TankShellEnergyConsumption.java @@ -10,6 +10,7 @@ import java.io.Serializable; import java.util.Date; /** + * 能耗产量对比 * @author WenJY * @date 2022年06月08日 18:02 */ diff --git a/productionboard/src/main/java/com/productionboard/entity/TankShellDevice/TankShellOeeStatistics.java b/productionboard/src/main/java/com/productionboard/entity/TankShellDevice/TankShellOeeStatistics.java new file mode 100644 index 0000000..203be55 --- /dev/null +++ b/productionboard/src/main/java/com/productionboard/entity/TankShellDevice/TankShellOeeStatistics.java @@ -0,0 +1,32 @@ +package com.productionboard.entity.TankShellDevice; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * OEE统计 + * @author WenJY + * @date 2022年06月08日 18:16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("SCADA_UK_DEVICEINFO_2") +public class TankShellOeeStatistics implements Serializable { + + @TableField(exist = false) + private String xValue; + + @TableField("OEE") + public String yValue; + + @TableField("createtime") + private Date createTime; + +} diff --git a/productionboard/src/main/java/com/productionboard/mapper/TankShellOeeStatisticsMapper.java b/productionboard/src/main/java/com/productionboard/mapper/TankShellOeeStatisticsMapper.java new file mode 100644 index 0000000..7c2f7a0 --- /dev/null +++ b/productionboard/src/main/java/com/productionboard/mapper/TankShellOeeStatisticsMapper.java @@ -0,0 +1,13 @@ +package com.productionboard.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.productionboard.entity.TankShellDevice.TankShellOeeStatistics; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author WenJY + * @date 2022年06月08日 18:17 + */ +@Mapper +public interface TankShellOeeStatisticsMapper extends BaseMapper { +} diff --git a/productionboard/src/main/java/com/productionboard/service/ITankShellDeviceInfoService.java b/productionboard/src/main/java/com/productionboard/service/ITankShellDeviceInfoService.java index 14a827a..ca5261e 100644 --- a/productionboard/src/main/java/com/productionboard/service/ITankShellDeviceInfoService.java +++ b/productionboard/src/main/java/com/productionboard/service/ITankShellDeviceInfoService.java @@ -14,4 +14,12 @@ public interface ITankShellDeviceInfoService { * @return java.lang.String */ public String getEnergyConsumptionJson(); + + /** + * OEE统计 + * @author WenJY + * @date 2022-06-08 18:18 + * @return java.lang.String + */ + public String getOeeStatisticsJson(); } diff --git a/productionboard/src/main/java/com/productionboard/service/impl/TankShellDeviceInfoServiceImpl.java b/productionboard/src/main/java/com/productionboard/service/impl/TankShellDeviceInfoServiceImpl.java index 3c412f2..5f2ffd1 100644 --- a/productionboard/src/main/java/com/productionboard/service/impl/TankShellDeviceInfoServiceImpl.java +++ b/productionboard/src/main/java/com/productionboard/service/impl/TankShellDeviceInfoServiceImpl.java @@ -3,7 +3,9 @@ package com.productionboard.service.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.productionboard.entity.TankShellDevice.TankShellEnergyConsumption; +import com.productionboard.entity.TankShellDevice.TankShellOeeStatistics; import com.productionboard.mapper.TankShellEnergyConsumptionMapper; +import com.productionboard.mapper.TankShellOeeStatisticsMapper; import com.productionboard.service.ITankShellDeviceInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -21,8 +23,13 @@ public class TankShellDeviceInfoServiceImpl implements ITankShellDeviceInfoServi @Autowired private TankShellEnergyConsumptionMapper tankShellEnergyConsumptionMapper; + @Autowired + private TankShellOeeStatisticsMapper tankShellOeeStatisticsMapper; + private SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd"); + private SimpleDateFormat hourFormat = new SimpleDateFormat("HH"); + @Override public String getEnergyConsumptionJson() { List tankShellEnergyConsumptions = tankShellEnergyConsumptionMapper.selectList(null); @@ -43,4 +50,16 @@ public class TankShellDeviceInfoServiceImpl implements ITankShellDeviceInfoServi } return JSONArray.toJSONString(jsonObject); } + + @Override + public String getOeeStatisticsJson() { + List tankShellOeeStatistics = tankShellOeeStatisticsMapper.selectList(null); + if(tankShellOeeStatistics.size()>0){ + tankShellOeeStatistics.forEach(x->{ + x.setXValue(hourFormat.format(x.getCreateTime())); + }); + } + String s = JSONArray.toJSONString(tankShellOeeStatistics); + return s; + } } diff --git a/productionboard/target/classes/com/productionboard/controller/TankShellDeviceController.class b/productionboard/target/classes/com/productionboard/controller/TankShellDeviceController.class index 50d2793..71a8040 100644 Binary files a/productionboard/target/classes/com/productionboard/controller/TankShellDeviceController.class and b/productionboard/target/classes/com/productionboard/controller/TankShellDeviceController.class differ