diff --git a/src/main/java/com/zhgd/xmgl/modules/bimface/controller/BimfaceController.java b/src/main/java/com/zhgd/xmgl/modules/bimface/controller/BimfaceController.java index 29d6bf89f..8c00cf9cc 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bimface/controller/BimfaceController.java +++ b/src/main/java/com/zhgd/xmgl/modules/bimface/controller/BimfaceController.java @@ -13,7 +13,6 @@ import com.zhgd.xmgl.modules.bimface.entity.vo.ConfigVO; import com.zhgd.xmgl.modules.bimface.entity.vo.ProjectBimfaceListVO; import com.zhgd.xmgl.modules.bimface.service.IBimfaceConfigService; import com.zhgd.xmgl.modules.bimface.service.IProjectBimfaceService; -import com.zhgd.xmgl.modules.stablewater.entity.StableWaterMixStationData; import com.zhgd.xmgl.util.MessageUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -262,4 +261,14 @@ public class BimfaceController { projectBimfaceService.updateById(stableWaterMixStationData); return Result.ok(); } + + @ApiOperation(value = "查询启用的模型和token", notes = "查询启用的模型和token") + @GetMapping(value = "/getEnableModel") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", dataType = "string"), + }) + public Result getEnableModel(@ApiIgnore @RequestParam HashMap paramMap) { + return Result.success(projectBimfaceService.getEnableModel(paramMap)); + } } + diff --git a/src/main/java/com/zhgd/xmgl/modules/bimface/service/IProjectBimfaceService.java b/src/main/java/com/zhgd/xmgl/modules/bimface/service/IProjectBimfaceService.java index d7e2a4a58..566aa1486 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bimface/service/IProjectBimfaceService.java +++ b/src/main/java/com/zhgd/xmgl/modules/bimface/service/IProjectBimfaceService.java @@ -67,4 +67,5 @@ public interface IProjectBimfaceService extends IService { ProjectBimface getDetailsByFileIdAndProjectSn(HashMap paramMap); + ProjectBimface getEnableModel(HashMap paramMap); } diff --git a/src/main/java/com/zhgd/xmgl/modules/bimface/service/impl/ProjectBimfaceServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/bimface/service/impl/ProjectBimfaceServiceImpl.java index 6b5308bc6..0714aeff2 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bimface/service/impl/ProjectBimfaceServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/bimface/service/impl/ProjectBimfaceServiceImpl.java @@ -181,6 +181,29 @@ public class ProjectBimfaceServiceImpl extends ServiceImpl paramMap) { + String projectSn = MapUtils.getString(paramMap, "projectSn"); + ProjectBimface projectBimface = projectBimfaceMapper.selectOne(new LambdaQueryWrapper() + .eq(ProjectBimface::getProjectSn, projectSn) + .eq(ProjectBimface::getIsEnable, 1) + ); + BimfaceClient bimfaceClient = this.getBimfaceClientByProjectSn(projectSn); + Long fileId = projectBimface.getFileId(); + String status = this.getFileStatus(bimfaceClient, fileId); + if (status == null) { + try { + projectBimface.setViewToken(bimfaceClient.getViewTokenByFileId(fileId)); + } catch (BimfaceException e) { + e.printStackTrace(); + log.error("err:", e); + } + } else { + log.error(status); + } + return projectBimface; + } + @Override public String getFileStatus(BimfaceClient bimfaceClient, Long fileId) { String status = null; diff --git a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/controller/SmartBeamFieldMaintainDataController.java b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/controller/SmartBeamFieldMaintainDataController.java index f6db017e4..4d1503fbc 100644 --- a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/controller/SmartBeamFieldMaintainDataController.java +++ b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/controller/SmartBeamFieldMaintainDataController.java @@ -144,7 +144,7 @@ public class SmartBeamFieldMaintainDataController { @ApiOperation(value = "查询智慧梁场-智能养护数据平均温度和湿度信息", notes = "查询智慧梁场-智能养护数据平均温度和湿度信息", httpMethod = "GET") @ApiImplicitParams({ - @ApiImplicitParam(name = "makeBeamPedestalSn", value = "制梁台座编号", paramType = "query", required = true, dataType = "String"), + @ApiImplicitParam(name = "makeBeamPedestalSn", value = "制梁台座编号", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "type", value = "类型:1今日", paramType = "query", required = true, dataType = "Integer"), }) @GetMapping(value = "/getAvgData") diff --git a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/controller/SmartBeamFieldSaveBeamDistrictController.java b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/controller/SmartBeamFieldSaveBeamDistrictController.java index 560bc59b7..e1a052723 100644 --- a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/controller/SmartBeamFieldSaveBeamDistrictController.java +++ b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/controller/SmartBeamFieldSaveBeamDistrictController.java @@ -11,6 +11,7 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.MapUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; @@ -67,7 +68,7 @@ public class SmartBeamFieldSaveBeamDistrictController { */ @ApiOperation(value = "添加智慧梁场-存梁区信息", notes = "添加智慧梁场-存梁区信息", httpMethod = "POST") @PostMapping(value = "/add") - public Result add(@RequestBody SmartBeamFieldSaveBeamDistrict smartBeamFieldSaveBeamDistrict) { + public Result add(@RequestBody @Validated SmartBeamFieldSaveBeamDistrict smartBeamFieldSaveBeamDistrict) { smartBeamFieldSaveBeamDistrictService.add(smartBeamFieldSaveBeamDistrict); return Result.ok(); } diff --git a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/entity/SmartBeamFieldSaveBeamDistrict.java b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/entity/SmartBeamFieldSaveBeamDistrict.java index 55433c2c5..d9b9c8e10 100644 --- a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/entity/SmartBeamFieldSaveBeamDistrict.java +++ b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/entity/SmartBeamFieldSaveBeamDistrict.java @@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.smartbeamfield.entity; import java.io.Serializable; import java.util.Date; + import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -11,25 +12,29 @@ import org.springframework.format.annotation.DateTimeFormat; import org.jeecgframework.poi.excel.annotation.Excel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotBlank; + /** * @Description: 智慧梁场-存梁区 * @author: pds - * @date: 2023-12-05 + * @date: 2023-12-05 * @version: V1.0 */ @Data @TableName("smart_beam_field_save_beam_district") -@ApiModel(value="SmartBeamFieldSaveBeamDistrict实体类",description="SmartBeamFieldSaveBeamDistrict") +@ApiModel(value = "SmartBeamFieldSaveBeamDistrict实体类", description = "SmartBeamFieldSaveBeamDistrict") public class SmartBeamFieldSaveBeamDistrict implements Serializable { private static final long serialVersionUID = 1L; - + /**主键id*/ @TableId(type = IdType.ASSIGN_ID) @ApiModelProperty(value="主键id") private java.lang.Long id ; /**存梁区名称*/ @Excel(name = "存梁区名称", width = 15) - @ApiModelProperty(value="存梁区名称") + @ApiModelProperty(value = "存梁区名称") + @NotBlank private java.lang.String saveBeamDistrictName ; /**项目sn*/ @Excel(name = "项目sn", width = 15) diff --git a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/mapper/xml/SmartBeamFieldMaintainDataMapper.xml b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/mapper/xml/SmartBeamFieldMaintainDataMapper.xml index cef9b3343..078b0586f 100644 --- a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/mapper/xml/SmartBeamFieldMaintainDataMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/mapper/xml/SmartBeamFieldMaintainDataMapper.xml @@ -2,8 +2,8 @@ select round(ifnull(avg(temperature),0),2) temperature, round(ifnull(avg(humidity),0),2) humidity from smart_beam_field_maintain_data - where make_beam_pedestal_sn = #{makeBeamPedestalSn} + where 1=1 + + and make_beam_pedestal_sn = #{make_beam_pedestal_sn} + and create_date >= concat(date_format(create_date, '%Y-%m-%d'),' 00:00:00') diff --git a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldMaintainDataServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldMaintainDataServiceImpl.java index 37e732763..9dbe11ded 100644 --- a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldMaintainDataServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldMaintainDataServiceImpl.java @@ -88,8 +88,8 @@ public class SmartBeamFieldMaintainDataServiceImpl extends ServiceImpl> source = baseMapper.countCustomData(paramMap); List dimensions = new ArrayList<>(); dimensions.add("time"); - dimensions.add("temperature"); - dimensions.add("humidity"); + dimensions.add("温度"); + dimensions.add("湿度"); flexibleBigScreenVo.setDimensions(dimensions); flexibleBigScreenVo.setSource(source); List strList = DateUtils.getDateStrList(100, "HH:00"); diff --git a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldSaveBeamDistrictServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldSaveBeamDistrictServiceImpl.java index 374cd1130..55fd9855c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldSaveBeamDistrictServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldSaveBeamDistrictServiceImpl.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zhgd.jeecg.common.execption.OpenAlertException; import com.zhgd.jeecg.common.system.query.QueryGenerator; import com.zhgd.xmgl.modules.smartbeamfield.entity.SmartBeamFieldBeam; import com.zhgd.xmgl.modules.smartbeamfield.entity.SmartBeamFieldBeamToSaveBeamPedestal; @@ -72,12 +73,27 @@ public class SmartBeamFieldSaveBeamDistrictServiceImpl extends ServiceImpl() + .eq(SmartBeamFieldSaveBeamDistrict::getProjectSn, smartBeamFieldSaveBeamDistrict.getProjectSn()) + .eq(SmartBeamFieldSaveBeamDistrict::getSaveBeamDistrictName, smartBeamFieldSaveBeamDistrict.getSaveBeamDistrictName()) + ); + if (d != null) { + throw new OpenAlertException("存梁区名称已存在"); + } smartBeamFieldSaveBeamDistrict.setId(null); baseMapper.insert(smartBeamFieldSaveBeamDistrict); } @Override public void edit(SmartBeamFieldSaveBeamDistrict smartBeamFieldSaveBeamDistrict) { + SmartBeamFieldSaveBeamDistrict d = smartBeamFieldSaveBeamDistrictMapper.selectOne(new LambdaQueryWrapper() + .eq(SmartBeamFieldSaveBeamDistrict::getProjectSn, smartBeamFieldSaveBeamDistrict.getProjectSn()) + .eq(SmartBeamFieldSaveBeamDistrict::getSaveBeamDistrictName, smartBeamFieldSaveBeamDistrict.getSaveBeamDistrictName()) + .ne(SmartBeamFieldSaveBeamDistrict::getId, smartBeamFieldSaveBeamDistrict.getId()) + ); + if (d != null) { + throw new OpenAlertException("存梁区名称已存在"); + } baseMapper.updateById(smartBeamFieldSaveBeamDistrict); } diff --git a/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java b/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java index ce6a9d595..65cf3e2e0 100644 --- a/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java +++ b/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java @@ -269,6 +269,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers("/xmgl/smartBeamFieldMaintainData/page").permitAll() .antMatchers("/xmgl/smartBeamFieldMaintainData/countCustomData").permitAll() .antMatchers("/xmgl/smartBeamFieldMaintainData/getAvgData").permitAll() + .antMatchers("/xmgl/smartBeamFieldMakeBeamPedestal/list").permitAll() .antMatchers(HttpMethod.OPTIONS, "/**").anonymous() .anyRequest().authenticated() // 剩下所有的验证都需要验证 .and()