diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java index 8179cba..996a155 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java @@ -28,4 +28,6 @@ public class BigModelInvokeUrl { private String updateCanvas; private String assistantKnowledgeAsk; + + private String hotQuestion; } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java index c109e57..26edbdf 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java @@ -2,6 +2,7 @@ package com.hnac.hzims.bigmodel.interactive.controller; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.google.common.collect.Lists; import com.hnac.hzims.bigmodel.BigModelConstants; import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq; import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService; @@ -16,6 +17,7 @@ import org.springblade.system.dto.ControlDTO; import org.springframework.web.bind.annotation.*; import java.text.DecimalFormat; +import java.util.List; /** * @Author: huangxing @@ -92,4 +94,18 @@ public class InteractiveController { DecimalFormat format = new DecimalFormat("0.00"); return R.data(format.format(generate) + "kWh"); } + + @ApiOperation("获取热点问题") + @ApiOperationSupport(order = 8) + @GetMapping("/hotQuestions") + public R hotQuestions() { + try{ + List questions = interactiveService.hotQuestions(); + return R.data(questions); + } + catch (Exception e) { + e.printStackTrace(); + return R.data(Lists.newArrayList()); + } + } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java index c6433df..9474795 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java @@ -48,4 +48,10 @@ public interface IInteractiveService { R sendRemoteControl(ControlDTO operate); Double generation(String stationId, String startTime, String endTime); + + /** + * 获取热点问题 + * @return 热点问题 + */ + List hotQuestions(); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java index 2fd2480..d670ef6 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java @@ -37,6 +37,7 @@ import com.xxl.job.core.log.XxlJobLogger; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.MapUtils; +import org.apache.poi.ss.formula.functions.T; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.logger.BladeLogger; import org.springblade.core.tool.api.R; @@ -196,6 +197,29 @@ public class InteractiveServiceImpl implements IInteractiveService { } @Override + public List hotQuestions() { + String url = fdpHost + bigModelInvokeUrl.getHotQuestion(); + return this.postCall(url,null,List.class); + } + + /** + * 远程调用http接口 + * @param url 接口url + * @param body 传参 + * @param resultT 结果解析对象 + * @return 结果 + * @param 结果解析对象类型 + */ + public T postCall(String url,Map body,Class resultT) { + HttpResponse response = HttpRequest.post(url).body(JSON.toJSONString(body)).execute(); + Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> { + log.error("远程调用大模型接口" + url + "失败!"); + throw new ServiceException("远程调用大模型接口" + url + "失败!"); + }); + return JSONObject.parseObject(response.body(),resultT); + } + + @Override public void updateVideo(Map request) { HttpResponse response = HttpRequest.post(fdpHost + bigModelInvokeUrl.getUpdateVideo()) .body(JSON.toJSONString(request)).execute(); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java index 47908f1..29baf54 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java @@ -48,9 +48,16 @@ public class AnswerVO implements Serializable { @ApiModelProperty("其它调用的参数") private Object[] extras; + @ApiModelProperty("用于语音回复的状态文本") + @JSONField(name = "voice_text") + private String[] voiceText; + + @ApiModelProperty("用于语音回复的答案") + @JSONField(name = "voice_answer") + private String[] voiceAnswer; + public static void error(AnswerVO usualVO) { usualVO.setRunning(0); usualVO.setStatus(-2); } - } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java index ce72167..2ddad1b 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java @@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -198,6 +199,21 @@ public class CarCheckRecordServiceImpl extends ServiceImpl checkList = carCheckRecordDetailVO.getCheckItemList(); + List res = new ArrayList<>(); + checkList.forEach(item -> { + String[] checkContent = item.getCheckContent().split(","); + String[] checkResult = item.getCheckResult().split(","); + for (int i = 0; i < checkContent.length; i++) { + CarCheckItemEntity carCheckItemEntity = new CarCheckItemEntity(); + carCheckItemEntity.setCheckItem(item.getCheckItem()); + carCheckItemEntity.setCheckContent(checkContent[i]); + carCheckItemEntity.setCheckResult(checkResult[i]); + res.add(carCheckItemEntity); + } + }); + carCheckRecordDetailVO.setCheckItemList(res); // 表头年月 String code = carCheckRecordDetailVO.getCode(); carCheckRecordDetailVO.setYear(code.substring(4, 8)); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java index 76aada7..c80b1ba 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java @@ -147,6 +147,9 @@ public class BaseUtil { if (templatePath.equals("template/卫生自查表.docx")) { formatHygieneRecordTable(xwpfDocument); } + if (templatePath.equals("template/车辆检查表.docx")) { + formatCarCheckRecordTable(xwpfDocument); + } } catch (Exception e) { e.printStackTrace(); }