2024-03-25 14:05:40 完成模型测试接口-能源消耗测算开发

master
魔神煜修罗皇 1 year ago
parent 28e549e4b9
commit ac3a28fe2d
  1. BIN
      psdc-business/lib/dntd-common-1.0-SNAPSHOT.jar
  2. BIN
      psdc-business/lib/dntd-model-metalkiln-1.0-SNAPSHOT.jar
  3. BIN
      psdc-business/lib/dntd-tool-1.0-SNAPSHOT.jar
  4. 7
      psdc-business/src/main/java/com/psdc/entity/SysDeviceHeatScene.java
  5. 31
      psdc-business/src/main/java/com/psdc/mapper/SysModelParamMapper.java
  6. 19
      psdc-business/src/main/java/com/psdc/service/ISysModelParamService.java
  7. 29
      psdc-business/src/main/java/com/psdc/service/impl/SysModelParamServiceImpl.java
  8. 6
      psdc-business/src/main/java/com/psdc/service/model/impl/BuildHeatingServiceImpl.java
  9. 25
      psdc-web/src/main/java/com/psdc/controller/model/BuildHeatingController.java

@ -4,11 +4,15 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zgdky
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysDeviceHeatScene {
// 设备id
// 设备Id
private String id;
/** 设备类型 */
private String devType ;
@ -47,5 +51,4 @@ public class SysDeviceHeatScene {
/** 备注 */
private String remark ;
}

@ -0,0 +1,31 @@
package com.psdc.mapper;
import com.dky.utils.entity.SysModelParam;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;
import java.util.List;
/**
* @author 小镇做题家
* @Date2024/1/22 16:58
* @Version 1.0
*/
@Mapper
public interface SysModelParamMapper{
/**
* 查询所有
* @return
*/
@Select("Select * From sys_model_param")
@Results(id="accountMap",value = {
@Result(id = true,column = "id",property = "id"),
@Result(column = "param_name",property = "paramName"),
@Result(column = "param_value",property = "paramValue"),
@Result(column = "param_model",property = "paramModel")
})
List<SysModelParam> findAll();
}

@ -0,0 +1,19 @@
package com.psdc.service;
import com.dky.utils.entity.SysModelParam;
import java.util.List;
/**
* @Author戴仕崑
* @Projectpsdc
* @FilenameI
* @Slogan 致敬大师致敬未来的你
* @Date2024/3/26 11:12
* @Version 1.0
*/
public interface ISysModelParamService {
List<SysModelParam> findAll();
}

@ -0,0 +1,29 @@
package com.psdc.service.impl;
import com.dky.utils.entity.SysModelParam;
import com.psdc.mapper.SysModelParamMapper;
import com.psdc.service.ISysModelParamService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author戴仕崑
* @Projectpsdc
* @FilenameSysModelParamServiceImpl
* @Slogan 致敬大师致敬未来的你
* @Date2024/3/26 11:12
* @Version 1.0
*/
@Service
public class SysModelParamServiceImpl implements ISysModelParamService {
@Resource
SysModelParamMapper sysModelParamMapper;
@Override
public List<SysModelParam> findAll() {
return sysModelParamMapper.findAll();
}
}

@ -38,7 +38,7 @@ public class BuildHeatingServiceImpl implements IBuildHeatingService {
// 创建JSONObject对象用于承接模型方法输出结果。
JSONObject jsonObject = null;
try{
// 构建JSONObject对象
// 构建JSONObject对象存放产品库设备列表
JSONObject list = new JSONObject();
// 查询得到设备列表
List<SysDeviceHeatScene> sysDeviceHeatScenes = deviceHeatSceneMapper.selAllDevices();
@ -46,8 +46,8 @@ public class BuildHeatingServiceImpl implements IBuildHeatingService {
list.put("devSpecList", sysDeviceHeatScenes);
// 将这个JSONObject对象list作为入参调用ModelTool的create方法实现产品库初始化。
ModelTool modelTool = ModelTool.create(list);
// 调用ModelTool的唯一入口函数exeModel2Report,将场景参数param和密钥key作为入参传进去,得到输出结果电能替代报告。
jsonObject = modelTool.exeModel2Report(param, key,mapList);
// 调用ModelTool的唯一入口函数exeModel2Report,将参数param、key、mapList作为入参传进去,得到输出结果电能替代报告。
jsonObject = modelTool.exeModel2Report(param, key, mapList);
} catch (Exception e){
e.printStackTrace();

@ -3,6 +3,7 @@ package com.psdc.controller.model;
import cn.hutool.json.JSONObject;
import com.psdc.core.domain.AjaxResult;
import com.psdc.enums.DeviceSubType;
import com.psdc.service.ISysModelParamService;
import com.psdc.service.model.IBuildHeatingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -13,12 +14,11 @@ import java.util.List;
import java.util.Map;
/**
* @Author戴仕崑
* @Projectpsdc
* @FilenameBuildHeatingController
* @author 小镇做题家
* @ProjectScmy
* @Slogan 致敬大师致敬未来的你
* @Date2024/2/2 8:55
* @Version 1.0
* date2024/2/2 8:55
* @version 1.0
*/
@RestController
@RequestMapping("/system/model")
@ -27,6 +27,9 @@ public class BuildHeatingController {
@Autowired
IBuildHeatingService buildHeatingService;
@Autowired
ISysModelParamService sysModelParamService;
@PostMapping("/getReport")
public AjaxResult getGenerateKey(@RequestBody Map<String, Object> requestBody) {
HashMap<String, Object> param = (HashMap<String, Object>) requestBody.get("param");
@ -45,6 +48,13 @@ public class BuildHeatingController {
return ajax;
}
@GetMapping("/selAllParams")
public AjaxResult selAllParams(){
AjaxResult ajax = AjaxResult.success();
ajax.put("data", sysModelParamService.findAll());
return ajax;
}
@PostMapping("/selByCoed")
public AjaxResult queryByType(@RequestParam(value="typeCoed") String typeCode) {
AjaxResult ajax = AjaxResult.success();
@ -70,6 +80,11 @@ public class BuildHeatingController {
list4.add(DeviceSubType.Material_Kiln.getDesc());
ajax.put("data", buildHeatingService.selDevicesBySubType(list4));
return ajax;
case "0105" :
List<String> list5 = new ArrayList<>();
list5.add(DeviceSubType.Metal_Kiln.getDesc());
ajax.put("data", buildHeatingService.selDevicesBySubType(list5));
return ajax;
default:
ajax.put("data", buildHeatingService.selAllDevices());
return ajax;

Loading…
Cancel
Save