Browse Source

# 智能诊断问答题接口补充

zhongwei
H.X 2 years ago
parent
commit
844533707c
  1. 11
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/config/FdpUrlConfiguration.java
  2. 21
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpQuestionController.java
  3. 6
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/SubmitAnswerReq.java
  4. 4
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/response/DevsetQuestionResp.java
  5. 24
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpQuestionService.java
  6. 45
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpQuestionServiceImpl.java
  7. 5
      hzims-service/equipment/src/main/resources/db/1.0.0_0831.sql

11
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/config/FdpUrlConfiguration.java

@ -38,4 +38,15 @@ public class FdpUrlConfiguration {
/**提交站点问题的答案**/ /**提交站点问题的答案**/
private String submitStationAnswer; private String submitStationAnswer;
/**实例化站点图谱**/
private String generateGraphInstance;
/**按物模型实例编号获取问题答案**/
private String getInstanceAnswer;
/**按物模型实例编号删除问题答案**/
private String deleteInstanceAnswer;
} }

21
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpQuestionController.java

@ -1,5 +1,6 @@
package com.hnac.hzims.fdp.controller; package com.hnac.hzims.fdp.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.fdp.request.SubmitAnswerReq; import com.hnac.hzims.fdp.request.SubmitAnswerReq;
import com.hnac.hzims.fdp.response.DevsetQuestionResp; import com.hnac.hzims.fdp.response.DevsetQuestionResp;
@ -57,4 +58,24 @@ public class FdpQuestionController extends BladeController {
return R.data(fdpQuestionService.submitDeviceAnswer(submitAnswerReq)); return R.data(fdpQuestionService.submitDeviceAnswer(submitAnswerReq));
} }
@GetMapping("/generateGraphInstance")
@ApiOperation("实例化站点图谱")
@ApiOperationSupport(order = 5)
public R<Boolean> generateGraphInstance(@RequestParam @ApiParam(value = "站点类型",required = true)Integer stationType,@RequestParam @ApiParam(value = "站点编码",required = true) String stationId) {
return R.data(fdpQuestionService.generateGraphInstance(stationType,stationId));
}
@DeleteMapping("/deleteInstanceAnswer/{instanceId}")
@ApiOperation("删除站点信息")
@ApiOperationSupport(order = 6)
public R<Boolean> deleteInstanceAnswer(@PathVariable @ApiParam("物模型实例编号") String instanceId) {
return R.status(fdpQuestionService.deleteInstanceAnswer(instanceId));
}
@GetMapping("/getInstanceAnswer/{instanceId}")
@ApiOperation("删除站点信息")
@ApiOperationSupport(order = 7)
public R<List<JSONObject>> getInstanceAnswer(@PathVariable @ApiParam("物模型实例编号") String instanceId) {
return R.data(fdpQuestionService.getInstanceAnswer(instanceId));
}
} }

6
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/SubmitAnswerReq.java

@ -31,6 +31,12 @@ public class SubmitAnswerReq implements Serializable {
@NotNull @NotNull
private String stationId; private String stationId;
@ApiModelProperty(value = "",required = true)
private String index;
@ApiModelProperty(value = "物模型ID",required = true)
private String instanceId;
@ApiModelProperty(value = "设备类型",required = true) @ApiModelProperty(value = "设备类型",required = true)
@NotNull @NotNull
private String deviceType; private String deviceType;

4
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/response/DevsetQuestionResp.java

@ -28,6 +28,10 @@ public class DevsetQuestionResp implements Serializable {
@JSONField(name = "NAME") @JSONField(name = "NAME")
private String name; private String name;
@ApiModelProperty("问题描述")
@JSONField(name = "INFO")
private String info;
@ApiModelProperty("问题类型。当前有“单选”、“多选”、“参数填空”、“数量填空”") @ApiModelProperty("问题类型。当前有“单选”、“多选”、“参数填空”、“数量填空”")
@JSONField(name = "QTYPE") @JSONField(name = "QTYPE")
private String qType; private String qType;

24
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpQuestionService.java

@ -1,8 +1,10 @@
package com.hnac.hzims.fdp.service; package com.hnac.hzims.fdp.service;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.fdp.request.SubmitAnswerReq; import com.hnac.hzims.fdp.request.SubmitAnswerReq;
import com.hnac.hzims.fdp.response.DevsetQuestionResp; import com.hnac.hzims.fdp.response.DevsetQuestionResp;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -45,4 +47,26 @@ public interface IFdpQuestionService {
*/ */
boolean submitDeviceAnswer(@RequestBody SubmitAnswerReq submitAnswerReq); boolean submitDeviceAnswer(@RequestBody SubmitAnswerReq submitAnswerReq);
/**
* 实例化站点图谱
* @param stationType 站点类型
* @param stationId 站点编码
* @return
*/
boolean generateGraphInstance(Integer stationType,String stationId);
/**
* 按物模型实例编号删除问题答案
* @param instanceId 物模型实例编号
* @return
*/
boolean deleteInstanceAnswer(String instanceId);
/**
* 按物模型实例编号获取问题答案
* @param instanceId 物模型实例编号
* @return
*/
List<JSONObject> getInstanceAnswer(String instanceId);
} }

45
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpQuestionServiceImpl.java

@ -118,7 +118,6 @@ public class FdpQuestionServiceImpl implements IFdpQuestionService {
@Override @Override
public boolean submitDeviceAnswer(SubmitAnswerReq submitAnswerReq) { public boolean submitDeviceAnswer(SubmitAnswerReq submitAnswerReq) {
logger.info("hzims:equipment:submitDeviceAnswer",JSON.toJSONString(submitAnswerReq));
String submitAnswerUrl = ""; String submitAnswerUrl = "";
switch(submitAnswerReq.getDeviceType()) { switch(submitAnswerReq.getDeviceType()) {
case FdpConstant.COMMON_DEVICE_TYPE: case FdpConstant.COMMON_DEVICE_TYPE:
@ -139,6 +138,50 @@ public class FdpQuestionServiceImpl implements IFdpQuestionService {
return false; return false;
} }
@Override
public boolean generateGraphInstance(Integer stationType, String stationId) {
Integer type = this.getStationType(stationType);
if(Func.isNotEmpty(type)) {
HttpResponse httpResponse = HttpRequest.post(fdpUrlConfiguration.getGenerateGraphInstance()).body(JSON.toJSONString(
new HashMap<String,Object>(){{
put("type",type);
put("stationId",stationId);
}}
)).execute();
return httpResponse.getStatus() == HttpServletResponse.SC_OK &&
"1".equals(JSONObject.parseObject(httpResponse.body()).getString("success"));
}
return false;
}
@Override
public boolean deleteInstanceAnswer(String instanceId) {
HttpResponse httpResponse = HttpRequest.post(fdpUrlConfiguration.getDeleteInstanceAnswer()).body(JSON.toJSONString(
new HashMap<String, String>(1) {{
put("instanceId", instanceId);
}}
)).execute();
return httpResponse.getStatus() == HttpServletResponse.SC_OK &&
"1".equals(JSONObject.parseObject(httpResponse.body()).getString("success"));
}
@Override
public List<JSONObject> getInstanceAnswer(String instanceId) {
HttpResponse httpResponse = HttpRequest.post(fdpUrlConfiguration.getGetInstanceAnswer()).body(
JSON.toJSONString(
new HashMap<String,String>(1){{
put("instanceId",instanceId);
}}
)
).execute();
JSONObject responseObject = JSONObject.parseObject(httpResponse.body());
if(httpResponse.getStatus() == HttpServletResponse.SC_OK &&
"1".equals(responseObject.getString("success"))) {
return JSONArray.parseArray(JSON.toJSONString(responseObject),JSONObject.class);
}
return Lists.newArrayList();
}
/** /**
* 根据站点类型获取Fdp的站点类型 * 根据站点类型获取Fdp的站点类型
* @param stationType 站点管理站点类型 * @param stationType 站点管理站点类型

5
hzims-service/equipment/src/main/resources/db/1.0.0_0831.sql

@ -1,5 +0,0 @@
ALTER TABLE hzims_fdp_device ADD FATHER_ID VARCHAR(40) COMMENT '智能诊断-PID';
ALTER TABLE hzims_em_info ADD HOME_PAGE_DISPLAY CHAR(2) DEFAULT '0' COMMENT '首页展示:0否,1是';
UPDATE `hzims_em_info` SET HOME_PAGE_DISPLAY = 1 WHERE NUMBER IN ('HZ111','HZ112','HZ113','HZ121','HZ122','HZ123','HZ131','HZ132');
Loading…
Cancel
Save