diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/config/FdpUrlConfiguration.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/config/FdpUrlConfiguration.java index e058b38..c71a221 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/config/FdpUrlConfiguration.java +++ b/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 generateGraphInstance; + + /**按物模型实例编号获取问题答案**/ + private String getInstanceAnswer; + + /**按物模型实例编号删除问题答案**/ + private String deleteInstanceAnswer; + + } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpQuestionController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpQuestionController.java index 4d693de..e9aa74d 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpQuestionController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpQuestionController.java @@ -1,5 +1,6 @@ package com.hnac.hzims.fdp.controller; +import com.alibaba.fastjson.JSONObject; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.fdp.request.SubmitAnswerReq; import com.hnac.hzims.fdp.response.DevsetQuestionResp; @@ -57,4 +58,24 @@ public class FdpQuestionController extends BladeController { return R.data(fdpQuestionService.submitDeviceAnswer(submitAnswerReq)); } + @GetMapping("/generateGraphInstance") + @ApiOperation("实例化站点图谱") + @ApiOperationSupport(order = 5) + public R 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 deleteInstanceAnswer(@PathVariable @ApiParam("物模型实例编号") String instanceId) { + return R.status(fdpQuestionService.deleteInstanceAnswer(instanceId)); + } + + @GetMapping("/getInstanceAnswer/{instanceId}") + @ApiOperation("删除站点信息") + @ApiOperationSupport(order = 7) + public R> getInstanceAnswer(@PathVariable @ApiParam("物模型实例编号") String instanceId) { + return R.data(fdpQuestionService.getInstanceAnswer(instanceId)); + } } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/SubmitAnswerReq.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/SubmitAnswerReq.java index f5aef16..31986e1 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/SubmitAnswerReq.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/SubmitAnswerReq.java @@ -31,6 +31,12 @@ public class SubmitAnswerReq implements Serializable { @NotNull private String stationId; + @ApiModelProperty(value = "",required = true) + private String index; + + @ApiModelProperty(value = "物模型ID",required = true) + private String instanceId; + @ApiModelProperty(value = "设备类型",required = true) @NotNull private String deviceType; diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/response/DevsetQuestionResp.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/response/DevsetQuestionResp.java index 873da12..dabcfe1 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/response/DevsetQuestionResp.java +++ b/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") private String name; + @ApiModelProperty("问题描述") + @JSONField(name = "INFO") + private String info; + @ApiModelProperty("问题类型。当前有“单选”、“多选”、“参数填空”、“数量填空”") @JSONField(name = "QTYPE") private String qType; diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpQuestionService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpQuestionService.java index dfe1d35..2e5f062 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpQuestionService.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpQuestionService.java @@ -1,8 +1,10 @@ package com.hnac.hzims.fdp.service; +import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.fdp.request.SubmitAnswerReq; import com.hnac.hzims.fdp.response.DevsetQuestionResp; 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.RequestParam; @@ -45,4 +47,26 @@ public interface IFdpQuestionService { */ 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 getInstanceAnswer(String instanceId); + } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpQuestionServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpQuestionServiceImpl.java index ba6d334..096acbe 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpQuestionServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpQuestionServiceImpl.java @@ -118,7 +118,6 @@ public class FdpQuestionServiceImpl implements IFdpQuestionService { @Override public boolean submitDeviceAnswer(SubmitAnswerReq submitAnswerReq) { - logger.info("hzims:equipment:submitDeviceAnswer",JSON.toJSONString(submitAnswerReq)); String submitAnswerUrl = ""; switch(submitAnswerReq.getDeviceType()) { case FdpConstant.COMMON_DEVICE_TYPE: @@ -139,6 +138,50 @@ public class FdpQuestionServiceImpl implements IFdpQuestionService { 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(){{ + 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(1) {{ + put("instanceId", instanceId); + }} + )).execute(); + return httpResponse.getStatus() == HttpServletResponse.SC_OK && + "1".equals(JSONObject.parseObject(httpResponse.body()).getString("success")); + } + + @Override + public List getInstanceAnswer(String instanceId) { + HttpResponse httpResponse = HttpRequest.post(fdpUrlConfiguration.getGetInstanceAnswer()).body( + JSON.toJSONString( + new HashMap(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的站点类型 * @param stationType 站点管理站点类型 diff --git a/hzims-service/equipment/src/main/resources/db/1.0.0_0831.sql b/hzims-service/equipment/src/main/resources/db/1.0.0_0831.sql deleted file mode 100644 index a2aa9fe..0000000 --- a/hzims-service/equipment/src/main/resources/db/1.0.0_0831.sql +++ /dev/null @@ -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');