夜笙歌 2 years ago
commit 3eb373b893

@ -39,4 +39,17 @@ public class TankShellDeviceController {
System.out.println("打印JSON"+energyConsumptionJson); System.out.println("打印JSON"+energyConsumptionJson);
return 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;
}
} }

@ -10,6 +10,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
*
* @author WenJY * @author WenJY
* @date 20220608 18:02 * @date 20220608 18:02
*/ */

@ -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 20220608 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;
}

@ -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 20220608 18:17
*/
@Mapper
public interface TankShellOeeStatisticsMapper extends BaseMapper<TankShellOeeStatistics> {
}

@ -14,4 +14,12 @@ public interface ITankShellDeviceInfoService {
* @return java.lang.String * @return java.lang.String
*/ */
public String getEnergyConsumptionJson(); public String getEnergyConsumptionJson();
/**
* OEE
* @author WenJY
* @date 2022-06-08 18:18
* @return java.lang.String
*/
public String getOeeStatisticsJson();
} }

@ -3,7 +3,9 @@ package com.productionboard.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.productionboard.entity.TankShellDevice.TankShellEnergyConsumption; import com.productionboard.entity.TankShellDevice.TankShellEnergyConsumption;
import com.productionboard.entity.TankShellDevice.TankShellOeeStatistics;
import com.productionboard.mapper.TankShellEnergyConsumptionMapper; import com.productionboard.mapper.TankShellEnergyConsumptionMapper;
import com.productionboard.mapper.TankShellOeeStatisticsMapper;
import com.productionboard.service.ITankShellDeviceInfoService; import com.productionboard.service.ITankShellDeviceInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -21,8 +23,13 @@ public class TankShellDeviceInfoServiceImpl implements ITankShellDeviceInfoServi
@Autowired @Autowired
private TankShellEnergyConsumptionMapper tankShellEnergyConsumptionMapper; private TankShellEnergyConsumptionMapper tankShellEnergyConsumptionMapper;
@Autowired
private TankShellOeeStatisticsMapper tankShellOeeStatisticsMapper;
private SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd"); private SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd");
private SimpleDateFormat hourFormat = new SimpleDateFormat("HH");
@Override @Override
public String getEnergyConsumptionJson() { public String getEnergyConsumptionJson() {
List<TankShellEnergyConsumption> tankShellEnergyConsumptions = tankShellEnergyConsumptionMapper.selectList(null); List<TankShellEnergyConsumption> tankShellEnergyConsumptions = tankShellEnergyConsumptionMapper.selectList(null);
@ -43,4 +50,16 @@ public class TankShellDeviceInfoServiceImpl implements ITankShellDeviceInfoServi
} }
return JSONArray.toJSONString(jsonObject); return JSONArray.toJSONString(jsonObject);
} }
@Override
public String getOeeStatisticsJson() {
List<TankShellOeeStatistics> tankShellOeeStatistics = tankShellOeeStatisticsMapper.selectList(null);
if(tankShellOeeStatistics.size()>0){
tankShellOeeStatistics.forEach(x->{
x.setXValue(hourFormat.format(x.getCreateTime()));
});
}
String s = JSONArray.toJSONString(tankShellOeeStatistics);
return s;
}
} }

Loading…
Cancel
Save