add - 箱壳设备可视化看板设备运行数据

master
wenjy 2 years ago
parent 8755a96cc0
commit 629b027e9b

@ -53,7 +53,7 @@ public class AluminumLinerkController {
} }
/** /**
* * ,loss
* @author WenJY * @author WenJY
* @date 2022-06-08 15:53 * @date 2022-06-08 15:53
* @return java.lang.String * @return java.lang.String

@ -42,10 +42,21 @@ public class TankShellDeviceController {
@ResponseBody @ResponseBody
public String getEnergyConsumption(){ public String getEnergyConsumption(){
String energyConsumptionJson = iTankShellDeviceInfoService.getEnergyConsumptionJson(); String energyConsumptionJson = iTankShellDeviceInfoService.getEnergyConsumptionJson();
System.out.println("打印JSON"+energyConsumptionJson);
return energyConsumptionJson; return energyConsumptionJson;
} }
/**
* ,loss
* @author WenJY
* @date 2022-06-08 15:53
* @return java.lang.String
*/
@GetMapping("/getRunParameters")
@ResponseBody
public String getRunParameters(){
return iTankShellDeviceInfoService.getRunParameters();
}
/** /**
* OEE * OEE
* @author WenJY * @author WenJY

@ -0,0 +1,26 @@
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;
/**
* @author WenJY
* @date 20220609 10:02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("SCADA_UK_DEVICEINFO_5")
public class TankShellThisMonthEnergy implements Serializable {
@TableField("PRODUCTION")
public String production;
@TableField("HOURENERGY")
public String energy;
}

@ -0,0 +1,13 @@
package com.productionboard.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.productionboard.entity.TankShellDevice.TankShellThisMonthEnergy;
import org.apache.ibatis.annotations.Mapper;
/**
* @author WenJY
* @date 20220609 10:04
*/
@Mapper
public interface TankShellThisMonthEnergyMapper extends BaseMapper<TankShellThisMonthEnergy> {
}

@ -15,6 +15,14 @@ public interface ITankShellDeviceInfoService {
*/ */
public String getDataInformationJson(); public String getDataInformationJson();
/**
* ,loss
* @author WenJY
* @date 2022-06-09 10:09
* @return java.lang.String
*/
public String getRunParameters();
/** /**
* JSON * JSON
* @author WenJY * @author WenJY

@ -2,17 +2,19 @@ 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.TankShellDeviceDataInformation; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.productionboard.entity.TankShellDevice.TankShellEnergyConsumption; import com.productionboard.entity.AluminumDevice.AluminumDeviceDataInformation;
import com.productionboard.entity.TankShellDevice.TankShellOeeStatistics; import com.productionboard.entity.AluminumDevice.AluminumThisMonthEnergy;
import com.productionboard.mapper.TankShellDeviceDataInformationMapper; import com.productionboard.entity.AluminumDevice.AluminumYesterdayEnergy;
import com.productionboard.mapper.TankShellEnergyConsumptionMapper; import com.productionboard.entity.TankShellDevice.*;
import com.productionboard.mapper.TankShellOeeStatisticsMapper; import com.productionboard.mapper.*;
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;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -25,6 +27,9 @@ public class TankShellDeviceInfoServiceImpl implements ITankShellDeviceInfoServi
@Autowired @Autowired
private TankShellDeviceDataInformationMapper tankShellDeviceDataInformationMapper; private TankShellDeviceDataInformationMapper tankShellDeviceDataInformationMapper;
@Autowired
private TankShellThisMonthEnergyMapper tankShellThisMonthEnergyMapper;
@Autowired @Autowired
private TankShellEnergyConsumptionMapper tankShellEnergyConsumptionMapper; private TankShellEnergyConsumptionMapper tankShellEnergyConsumptionMapper;
@ -35,12 +40,53 @@ public class TankShellDeviceInfoServiceImpl implements ITankShellDeviceInfoServi
private SimpleDateFormat hourFormat = new SimpleDateFormat("HH"); private SimpleDateFormat hourFormat = new SimpleDateFormat("HH");
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Override @Override
public String getDataInformationJson() { public String getDataInformationJson() {
List<TankShellDeviceDataInformation> tankShellDeviceDataInformations = tankShellDeviceDataInformationMapper.selectList(null); List<TankShellDeviceDataInformation> tankShellDeviceDataInformations = tankShellDeviceDataInformationMapper.selectList(null);
return JSONArray.toJSONString(tankShellDeviceDataInformations); return JSONArray.toJSONString(tankShellDeviceDataInformations);
} }
@Override
public String getRunParameters() {
String[] result = new String[10];
try{
List<TankShellThisMonthEnergy> tankShellThisMonthEnergies = tankShellThisMonthEnergyMapper.selectList(null);
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,-1);
String lastDate = simpleDateFormat.format(calendar.getTime()).substring(0,10)+" 00:00:00";;
//昨日产量、能耗
QueryWrapper<TankShellEnergyConsumption> wrapper = new QueryWrapper<TankShellEnergyConsumption>();
wrapper.eq("createTime",simpleDateFormat.parse(lastDate));
List<TankShellEnergyConsumption> tankShellYesterdayEnergies = tankShellEnergyConsumptionMapper.selectList(wrapper);
result[0] = tankShellYesterdayEnergies.size() > 0 ? tankShellYesterdayEnergies.get(0).getProduction():"0";
result[1] = tankShellYesterdayEnergies.size() > 0 ? tankShellYesterdayEnergies.get(0).getEnergy():"0";
result[2] = tankShellThisMonthEnergies.size() > 0 ? tankShellThisMonthEnergies.get(0).getProduction():"0";
result[3] = tankShellThisMonthEnergies.size() > 0 ? tankShellThisMonthEnergies.get(0).getEnergy():"0";
List<TankShellDeviceDataInformation> deviceDataInformations = tankShellDeviceDataInformationMapper.selectList(null);
if(deviceDataInformations.size() > 0){
TankShellDeviceDataInformation tankShellDeviceDataInformation = deviceDataInformations.get(0);
result[4] = tankShellDeviceDataInformation.getRunTime();
result[5] = tankShellDeviceDataInformation.getStopTime();
result[6] = tankShellDeviceDataInformation.getDeviceOee();
result[7] = "0";
result[8] = tankShellDeviceDataInformation.getRunTime();
result[9] = tankShellDeviceDataInformation.getDeviceTakt();
}
}catch (Exception e){
System.out.println("箱壳设备看板getRunParameters方法异常:"+e.getMessage());
result[0] = "-";
}
return JSONArray.toJSONString(result);
}
@Override @Override
public String getEnergyConsumptionJson() { public String getEnergyConsumptionJson() {
List<TankShellEnergyConsumption> tankShellEnergyConsumptions = tankShellEnergyConsumptionMapper.selectList(null); List<TankShellEnergyConsumption> tankShellEnergyConsumptions = tankShellEnergyConsumptionMapper.selectList(null);

Loading…
Cancel
Save