From 3ee30263eb9bb5f7bf1228ea45ce5d498fb3cdef Mon Sep 17 00:00:00 2001 From: bsw215583320 <baoshiwei121@163.com> Date: 星期二, 16 四月 2024 14:41:13 +0800 Subject: [PATCH] 设备类型增加效率和均耗绑定 --- jeecg-module-dry/jeecg-module-dry-api/src/main/java/org/jeecg/modules/dry/vo/DryEquipmentVo.java | 94 +++++++++++++++++++++++++++++++ jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/service/impl/DryRealTimeDataServiceImpl.java | 20 ++++-- jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java | 29 +++++++-- jeecg-module-dry/jeecg-module-dry-api/src/main/java/org/jeecg/modules/dry/entity/DryEqpType.java | 9 +++ 4 files changed, 139 insertions(+), 13 deletions(-) diff --git a/jeecg-module-dry/jeecg-module-dry-api/src/main/java/org/jeecg/modules/dry/entity/DryEqpType.java b/jeecg-module-dry/jeecg-module-dry-api/src/main/java/org/jeecg/modules/dry/entity/DryEqpType.java index bc341a5..1fadc47 100644 --- a/jeecg-module-dry/jeecg-module-dry-api/src/main/java/org/jeecg/modules/dry/entity/DryEqpType.java +++ b/jeecg-module-dry/jeecg-module-dry-api/src/main/java/org/jeecg/modules/dry/entity/DryEqpType.java @@ -44,6 +44,15 @@ @Excel(name = "name", width = 15) @ApiModelProperty(value = "name") private String name; + @Excel(name = "骞茬嚗鏁堢巼", width = 15) + @ApiModelProperty(value = "骞茬嚗鏁堢巼") + private String dryEfficiency; + @Excel(name = "钂告苯鍧囪��", width = 15) + @ApiModelProperty(value = "钂告苯鍧囪��") + private String steamConsumption; + @Excel(name = "鐢佃兘鍧囪��", width = 15) + @ApiModelProperty(value = "鐢佃兘鍧囪��") + private String powerConsumption; /**鍒涘缓浜�*/ @ApiModelProperty(value = "鍒涘缓浜�") private String createBy; diff --git a/jeecg-module-dry/jeecg-module-dry-api/src/main/java/org/jeecg/modules/dry/vo/DryEquipmentVo.java b/jeecg-module-dry/jeecg-module-dry-api/src/main/java/org/jeecg/modules/dry/vo/DryEquipmentVo.java new file mode 100644 index 0000000..bae5ced --- /dev/null +++ b/jeecg-module-dry/jeecg-module-dry-api/src/main/java/org/jeecg/modules/dry/vo/DryEquipmentVo.java @@ -0,0 +1,94 @@ +package org.jeecg.modules.dry.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import lombok.experimental.Accessors; +import org.jeecg.common.aspect.annotation.Dict; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description: 骞茬嚗鏈� + * @Author: jeecg-boot + * @Date: 2023-03-08 + * @Version: V1.0 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ToString +public class DryEquipmentVo implements Serializable { + /**id*/ + @ApiModelProperty(value = "id") + private String id; + /**璁惧缂栧彿*/ + @Excel(name = "璁惧缂栧彿", width = 15) + @ApiModelProperty(value = "璁惧缂栧彿") + private String code; + /**璁惧鍚嶇О*/ + @Excel(name = "璁惧鍚嶇О", width = 15) + @ApiModelProperty(value = "璁惧鍚嶇О") + private String name; + /**璁惧绫诲瀷*/ + @Excel(name = "璁惧绫诲瀷", width = 15, dictTable = "dry_eqp_type", dicText = "name", dicCode = "id") + @Dict(dictTable = "dry_eqp_type", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "璁惧绫诲瀷") + private String type; + /**璁惧鎻忚堪*/ + @Excel(name = "璁惧鎻忚堪", width = 15) + @ApiModelProperty(value = "璁惧鎻忚堪") + private String remark; + /**杞﹂棿id*/ + @Excel(name = "杞﹂棿id", width = 15, dictTable = "dry_shop", dicText = "name", dicCode = "id") + @Dict(dictTable = "dry_shop", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "杞﹂棿id") + private String shopId; + /**鍚敤鐘舵��*/ + @Excel(name = "鍚敤鐘舵��", width = 15) + @ApiModelProperty(value = "鍚敤鐘舵��") + private String enable; + /**鍒涘缓浜�*/ + @ApiModelProperty(value = "鍒涘缓浜�") + private String createBy; + /**鍒涘缓鏃ユ湡*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "鍒涘缓鏃ユ湡") + private Date createTime; + /**鏇存柊浜�*/ + @ApiModelProperty(value = "鏇存柊浜�") + private String updateBy; + /**鏇存柊鏃ユ湡*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "鏇存柊鏃ユ湡") + private Date updateTime; + /**绉熸埛id*/ + @Excel(name = "绉熸埛id", width = 15) + @ApiModelProperty(value = "绉熸埛id") + private Integer tenantId; + + /**璁惧IP*/ + @Excel(name = "璁惧IP", width = 15) + @ApiModelProperty(value = "璁惧IP") + private String ip; + + @Excel(name = "骞茬嚗鏁堢巼", width = 15) + @ApiModelProperty(value = "骞茬嚗鏁堢巼") + private String dryEfficiency; + @Excel(name = "钂告苯鍧囪��", width = 15) + @ApiModelProperty(value = "钂告苯鍧囪��") + private String steamConsumption; + @Excel(name = "鐢佃兘鍧囪��", width = 15) + @ApiModelProperty(value = "鐢佃兘鍧囪��") + private String powerConsumption; +} diff --git a/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java index 3a172ed..44bed1e 100644 --- a/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java +++ b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java @@ -1,5 +1,6 @@ package org.jeecg.modules.dry.controller; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -9,6 +10,8 @@ import java.net.URLDecoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.bean.BeanUtil; import org.jeecg.common.api.vo.Result; import org.jeecg.common.config.TenantContext; import org.jeecg.common.system.query.QueryGenerator; @@ -16,6 +19,7 @@ import org.jeecg.common.util.oConvertUtils; import org.jeecg.config.mybatis.MybatisPlusSaasConfig; import org.jeecg.modules.dry.common.CacheConstants; +import org.jeecg.modules.dry.entity.DryEqpType; import org.jeecg.modules.dry.entity.DryEquipment; import org.jeecg.modules.dry.service.IDryEqpTypeService; import org.jeecg.modules.dry.service.IDryEquipmentService; @@ -25,6 +29,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.dry.vo.DryEquipmentVo; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -92,7 +97,7 @@ @ApiOperation(value="鏌ヨ鎵�鏈夊共鐕ユ満", notes="鏌ヨ鎵�鏈夊共鐕ユ満") @GetMapping(value = "/listAll") - public Result<List<DryEquipment>> queryAllEquipment(DryEquipment dryEquipment, HttpServletRequest req) { + public Result<List<DryEquipmentVo>> queryAllEquipment(DryEquipment dryEquipment, HttpServletRequest req) { //------------------------------------------------------------------------------------------------ //鏄惁寮�鍚郴缁熺鐞嗘ā鍧楃殑澶氱鎴锋暟鎹殧绂汇�怱AAS澶氱鎴锋ā寮忋�� if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){ @@ -103,10 +108,17 @@ queryWrapper.orderByAsc("code"); List<DryEquipment> eqps = dryEquipmentService.list(queryWrapper); + List<DryEquipmentVo> equipmentVos = new ArrayList<>(); eqps.stream().forEach(item -> { - item.setType(dryEqpTypeService.getById(item.getType()).getName()); + DryEquipmentVo dryEquipmentVo = BeanUtil.toBean(item, DryEquipmentVo.class); + DryEqpType dryEqpType = dryEqpTypeService.getById(item.getType()); + dryEquipmentVo.setType(dryEqpType.getName()); + dryEquipmentVo.setDryEfficiency(dryEqpType.getDryEfficiency()); + dryEquipmentVo.setSteamConsumption(dryEqpType.getSteamConsumption()); + dryEquipmentVo.setPowerConsumption(dryEqpType.getPowerConsumption()); + equipmentVos.add(dryEquipmentVo); }); - return Result.OK(eqps); + return Result.OK(equipmentVos); } @@ -186,13 +198,18 @@ //@AutoLog(value = "骞茬嚗鏈�-閫氳繃id鏌ヨ") @ApiOperation(value="骞茬嚗鏈�-閫氳繃id鏌ヨ", notes="骞茬嚗鏈�-閫氳繃id鏌ヨ") @GetMapping(value = "/queryById") - public Result<DryEquipment> queryById(@RequestParam(name="id",required=true) String id) { + public Result<DryEquipmentVo> queryById(@RequestParam(name="id",required=true) String id) { DryEquipment dryEquipment = dryEquipmentService.getById(id); - dryEquipment.setType(dryEqpTypeService.getById(dryEquipment.getType()).getName()); + DryEquipmentVo dryEquipmentVo = BeanUtil.toBean(dryEquipment, DryEquipmentVo.class); + DryEqpType dryEqpType = dryEqpTypeService.getById(dryEquipment.getType()); + dryEquipmentVo.setType(dryEqpType.getName()); + dryEquipmentVo.setDryEfficiency(dryEqpType.getDryEfficiency()); + dryEquipmentVo.setSteamConsumption(dryEqpType.getSteamConsumption()); + dryEquipmentVo.setPowerConsumption(dryEqpType.getPowerConsumption()); if(dryEquipment==null) { return Result.error("鏈壘鍒板搴旀暟鎹�"); } - return Result.OK(dryEquipment); + return Result.OK(dryEquipmentVo); } /** diff --git a/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/service/impl/DryRealTimeDataServiceImpl.java b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/service/impl/DryRealTimeDataServiceImpl.java index aa8d0f9..5a5b52f 100644 --- a/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/service/impl/DryRealTimeDataServiceImpl.java +++ b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/service/impl/DryRealTimeDataServiceImpl.java @@ -100,6 +100,7 @@ // 2 鏇存柊宸ュ崟瀹炴椂鏁版嵁 // 2.1 灏嗗伐鍗曚腑鐨勬暟鎹浛鎹负鏈�鏂版暟鎹� realTimeDataVo.setOrderId(orderVo.getId()); + orderVo.setInitial(realTimeDataVo.getMoisture1()); orderVo.setDryTime(realTimeDataVo.getTime3()); orderVo.setDelay(realTimeDataVo.getDelay()); @@ -186,7 +187,7 @@ orderVo.getBellowsTemp().put(realTimeDataVo.getTime3(), realTimeDataVo.getTemp2()); // 2.3 鏇存柊鍒皉edis缂撳瓨 redisUtil.hset(CacheConstants.RedisKeyEnum.WORK_ORDER.getCode(), - realTimeDataVo.getTenantid()+"_"+realTimeDataVo.getMachineid(),orderVo, 600000); + realTimeDataVo.getTenantid()+"_"+realTimeDataVo.getMachineid(),orderVo, 60*60); return Result.ok(); } @@ -219,6 +220,7 @@ } // 3 鏁版嵁搴撴病鏈夊垯鏂板涓�鏉℃暟鎹� } else { + orderVo = saveNewOrder(realTimeDataVo); } return orderVo; @@ -288,7 +290,7 @@ */ private void saveOrderTrendVo(DryOrderTrendVo trendVo, DryOrderVo orderVo) { //鍒ゆ柇 瀹炴椂鍚按鐜� 鎴� 瀹炴椂閲嶉噺鏈夋病鏈夊彉鍖栵紝鏈夊彉鍖栧垯鏇存柊 - if(orderVo.getTrendVo() == null + if(orderVo.getTrendVo() == null && trendVo != null && trendVo.getWeight() > 0 || trendVo.getWeight() < orderVo.getTrendVo().getWeight() ) { DryOrder byId = dryOrderService.getById(orderVo.getId()); @@ -318,8 +320,9 @@ LambdaQueryWrapper<DryEquipment> queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DryEquipment::getTenantId, realTimeDataVo.getTenantid()); + queryWrapper.eq(DryEquipment::getTenantId, realTimeDataVo.getTenantid()); queryWrapper.eq(DryEquipment::getEnable, "Y"); + queryWrapper.orderByAsc(DryEquipment::getCode); List<DryEquipment> dryEquipments = equipmentService.list(queryWrapper); List<String> list = new ArrayList<>(); @@ -332,17 +335,20 @@ if (dryEquipments != null && dryEquipments.size() > 0) { dryEquipments.stream().forEach(item -> { DryOrderVo order = (DryOrderVo) redisUtil.hget(CacheConstants.RedisKeyEnum.WORK_ORDER.getCode(), realTimeDataVo.getTenantid() + "_" + item.getCode()); + list.add(item.getName().substring(0, item.getName().indexOf('#')+1)); if (order != null) { - double v = order.getOriginWeight() - order.getYield(); - list.add(item.getName().substring(0, item.getName().indexOf('#')+1)); - if (v > 0 && order.getDryTime()>0) { + DryOrderTrendVo dryOrderTrendVo = order.getDetailList().get(order.getDetailList().size() - 1); + double v = order.getOriginWeight() - dryOrderTrendVo.getWeight(); + + if (v > 0 && dryOrderTrendVo.getTotalTime()>0) { DecimalFormat df = new DecimalFormat("#.00"); - dList.add(Double.valueOf(df.format(v / order.getDryTime() * 60))); + dList.add(Double.valueOf(df.format(v / dryOrderTrendVo.getTotalTime() * 60))); } else { dList.add(50d); } } + dList.add(0d); }); } if (orderVo != null) { -- Gitblit v1.9.3