From 629b027e9b8833ca2f6d02089172521d4e7cf5aa Mon Sep 17 00:00:00 2001 From: wenjy Date: Thu, 9 Jun 2022 10:29:53 +0800 Subject: [PATCH] =?UTF-8?q?add=20-=20=E7=AE=B1=E5=A3=B3=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=8F=AF=E8=A7=86=E5=8C=96=E7=9C=8B=E6=9D=BF=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AluminumLinerkController.java | 2 +- .../controller/TankShellDeviceController.java | 13 +++- .../TankShellThisMonthEnergy.java | 26 ++++++++ .../TankShellThisMonthEnergyMapper.java | 13 ++++ .../service/ITankShellDeviceInfoService.java | 8 +++ .../impl/TankShellDeviceInfoServiceImpl.java | 58 ++++++++++++++++-- .../TankShellDeviceController.class | Bin 1944 -> 1782 bytes .../service/ITankShellDeviceInfoService.class | Bin 285 -> 312 bytes .../impl/TankShellDeviceInfoServiceImpl.class | Bin 4507 -> 7444 bytes 9 files changed, 112 insertions(+), 8 deletions(-) create mode 100644 productionboard/src/main/java/com/productionboard/entity/TankShellDevice/TankShellThisMonthEnergy.java create mode 100644 productionboard/src/main/java/com/productionboard/mapper/TankShellThisMonthEnergyMapper.java diff --git a/productionboard/src/main/java/com/productionboard/controller/AluminumLinerkController.java b/productionboard/src/main/java/com/productionboard/controller/AluminumLinerkController.java index 0aebfc8..b660db7 100644 --- a/productionboard/src/main/java/com/productionboard/controller/AluminumLinerkController.java +++ b/productionboard/src/main/java/com/productionboard/controller/AluminumLinerkController.java @@ -53,7 +53,7 @@ public class AluminumLinerkController { } /** - * 获取能耗产量数据 + * 获取运行参数,整合产量能耗、运行参数、loss、标准节拍参数 * @author WenJY * @date 2022-06-08 15:53 * @return java.lang.String diff --git a/productionboard/src/main/java/com/productionboard/controller/TankShellDeviceController.java b/productionboard/src/main/java/com/productionboard/controller/TankShellDeviceController.java index cd65211..7bf4250 100644 --- a/productionboard/src/main/java/com/productionboard/controller/TankShellDeviceController.java +++ b/productionboard/src/main/java/com/productionboard/controller/TankShellDeviceController.java @@ -42,10 +42,21 @@ public class TankShellDeviceController { @ResponseBody public String getEnergyConsumption(){ String energyConsumptionJson = iTankShellDeviceInfoService.getEnergyConsumptionJson(); - System.out.println("打印JSON:"+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统计数据 * @author WenJY diff --git a/productionboard/src/main/java/com/productionboard/entity/TankShellDevice/TankShellThisMonthEnergy.java b/productionboard/src/main/java/com/productionboard/entity/TankShellDevice/TankShellThisMonthEnergy.java new file mode 100644 index 0000000..da23dd7 --- /dev/null +++ b/productionboard/src/main/java/com/productionboard/entity/TankShellDevice/TankShellThisMonthEnergy.java @@ -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 2022年06月09日 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; +} diff --git a/productionboard/src/main/java/com/productionboard/mapper/TankShellThisMonthEnergyMapper.java b/productionboard/src/main/java/com/productionboard/mapper/TankShellThisMonthEnergyMapper.java new file mode 100644 index 0000000..febfc5b --- /dev/null +++ b/productionboard/src/main/java/com/productionboard/mapper/TankShellThisMonthEnergyMapper.java @@ -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 2022年06月09日 10:04 + */ +@Mapper +public interface TankShellThisMonthEnergyMapper 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 ed2ae80..64cd68e 100644 --- a/productionboard/src/main/java/com/productionboard/service/ITankShellDeviceInfoService.java +++ b/productionboard/src/main/java/com/productionboard/service/ITankShellDeviceInfoService.java @@ -15,6 +15,14 @@ public interface ITankShellDeviceInfoService { */ public String getDataInformationJson(); + /** + * 获取运行参数,整合产量能耗、运行参数、loss、标准节拍参数 + * @author WenJY + * @date 2022-06-09 10:09 + * @return java.lang.String + */ + public String getRunParameters(); + /** * 获取能耗产量对比JSON * @author WenJY 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 fae276b..abe5dce 100644 --- a/productionboard/src/main/java/com/productionboard/service/impl/TankShellDeviceInfoServiceImpl.java +++ b/productionboard/src/main/java/com/productionboard/service/impl/TankShellDeviceInfoServiceImpl.java @@ -2,17 +2,19 @@ package com.productionboard.service.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.productionboard.entity.TankShellDevice.TankShellDeviceDataInformation; -import com.productionboard.entity.TankShellDevice.TankShellEnergyConsumption; -import com.productionboard.entity.TankShellDevice.TankShellOeeStatistics; -import com.productionboard.mapper.TankShellDeviceDataInformationMapper; -import com.productionboard.mapper.TankShellEnergyConsumptionMapper; -import com.productionboard.mapper.TankShellOeeStatisticsMapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.productionboard.entity.AluminumDevice.AluminumDeviceDataInformation; +import com.productionboard.entity.AluminumDevice.AluminumThisMonthEnergy; +import com.productionboard.entity.AluminumDevice.AluminumYesterdayEnergy; +import com.productionboard.entity.TankShellDevice.*; +import com.productionboard.mapper.*; import com.productionboard.service.ITankShellDeviceInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; import java.util.List; /** @@ -25,6 +27,9 @@ public class TankShellDeviceInfoServiceImpl implements ITankShellDeviceInfoServi @Autowired private TankShellDeviceDataInformationMapper tankShellDeviceDataInformationMapper; + @Autowired + private TankShellThisMonthEnergyMapper tankShellThisMonthEnergyMapper; + @Autowired private TankShellEnergyConsumptionMapper tankShellEnergyConsumptionMapper; @@ -35,12 +40,53 @@ public class TankShellDeviceInfoServiceImpl implements ITankShellDeviceInfoServi private SimpleDateFormat hourFormat = new SimpleDateFormat("HH"); + private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + @Override public String getDataInformationJson() { List tankShellDeviceDataInformations = tankShellDeviceDataInformationMapper.selectList(null); return JSONArray.toJSONString(tankShellDeviceDataInformations); } + @Override + public String getRunParameters() { + String[] result = new String[10]; + try{ + List 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 wrapper = new QueryWrapper(); + wrapper.eq("createTime",simpleDateFormat.parse(lastDate)); + List 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 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 public String getEnergyConsumptionJson() { List tankShellEnergyConsumptions = tankShellEnergyConsumptionMapper.selectList(null); diff --git a/productionboard/target/classes/com/productionboard/controller/TankShellDeviceController.class b/productionboard/target/classes/com/productionboard/controller/TankShellDeviceController.class index c56388aefd09b80a18ac5c53e436492823c3d34c..e2c424cb7b39812bd3117618d27c5972955c838b 100644 GIT binary patch literal 1782 zcma)6>rWFw5T7kAg;J%IhZGgTCzQwfs6f$}APc4vYqcGIE-b!pS7ebZ^GP6Iuwq}t^{ffZA!s0Q3=(a2)jnRUz`FpQk z;_8TDEhbo6tai+lFz2Q+s!s$Kw;4*>lD1Z|R^y6x(cW%Zuz;Ab%N(nlSXd0JFBeMu zf|qCs1KT;j;rbnOoPbuk%JmM@%nV1>{Vrmvb5`?^%Qy|QuJxVikh=~}g};{N1~QmH zv|XF4Y6FS6UfnS>BQVLkb#Gl?Z?cE@r%;U>@PV1}YOb)cW5%^hXR;k|UNo!WYGJtn z>X;1CneYx@0*RvZl*RXi8R~4$!K|89A+QwM6Bn!FQa2n0!Wg6pq*`iP_HSDfMj@4i5lF^iJqa6-NkZO;yGGoH4BnNnE7;FAV!F#4a!@+u zmL{+shStZ0CNPEF@7lp&R?}#>vH->e^Z55k;9n_%4^jjI*YGrm@9Vx6xi`<)9n_BF zDUZGc-y_){K(gt`cNqBUJ5QiYpb@Z@QJ8{B{4$W}il-a+CNK>d^e`|KPsSF@euIH8 z_z?jEU~&V@v<1hS!T&3pK|B5yTR^!cPy&IXKOsh-8*Q!)EzyRS#+)-4ed{9-7jDC> zk9?0k@AXW326g@3lmMu>bN7zn60GlP?1-n^H65Ao*B?&f)O<5^dQ9QLqZKadZwCL%v z(I@c06K{M)puj1X;sf{(c+DTAxILrDk}|Gxsnk7v``&ZU-TI&BfBX$#2|GoM;e%m( zID!lK$Sog_lK2z1Tpz&=+$>EkJ4+tb-L*)!mKwgD4N$kdFX0!M$Wd?pEtGr5v-7(*j_P%H~)38c) zX*Y!xt~jQVWRYAQiXf&~Ug24{*U#)}Pex6uid@&V7DX^lXm>(s>MaT^iW^N=GlmJ- zFWZh1x$~Z(?_hSNthky-R{2q?eo<%097K;UL$RV`+Lu(?w1Hw^roD8EW;kuE_{gJgJ> zzPwZwui!%ng6^}7G zPyb_h$2d2C;`BV30q;{T76^1PaXy&>wVfA9_AX^8O?NMi_u4dQ4#>u3YLoO_R=t$Q sd7{zfEzS4}d0XxB^ d$iU3N!oUEeS)nu=lx7Ff42%pMK$3}p69A-P4v_!= delta 44 zcmdnNG?z)>)W2Q(7#J8#7`WLPIN2GvCJGo$4Bf%VJeiMCf{THXfgLEx#J~Xn{*ee( diff --git a/productionboard/target/classes/com/productionboard/service/impl/TankShellDeviceInfoServiceImpl.class b/productionboard/target/classes/com/productionboard/service/impl/TankShellDeviceInfoServiceImpl.class index dbd2110da94f847067cb346a87dc1362e55a4dfd..98401d18757584a9ef6d1ebf9a042399e950175f 100644 GIT binary patch literal 7444 zcmd5>d3;pW75?r_X5M7-kVzoX$YMa&EDp48BnUzP6G#A^2;x$FnRy8VGxNf{H$d#J zR@>UDwME;yl&USY3sunp#I1X4t+o4JyMcDId$ra|zx&>s$!x($`J?>udvmvU&bjA) z=R4;2A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