Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 5 months ago
parent
commit
a427522722
  1. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java
  2. 16
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java
  3. 6
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java
  4. 24
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java
  5. 9
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java
  6. 16
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java
  7. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java

2
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;
}

16
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());
}
}
}

6
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java

@ -48,4 +48,10 @@ public interface IInteractiveService {
R<Object> sendRemoteControl(ControlDTO operate);
Double generation(String stationId, String startTime, String endTime);
/**
* 获取热点问题
* @return 热点问题
*/
List hotQuestions();
}

24
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 <T> 结果解析对象类型
*/
public <T> T postCall(String url,Map body,Class<T> 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<String, Object> request) {
HttpResponse response = HttpRequest.post(fdpHost + bigModelInvokeUrl.getUpdateVideo())
.body(JSON.toJSONString(request)).execute();

9
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);
}
}

16
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<CarCheckRecordMapper,
public void exportCarCheckRecordData(Long id, HttpServletResponse response) {
CarCheckRecordDetailVO carCheckRecordDetailVO = this.getCarCheckRecord(id);
// 数据处理
// 检查项
List<CarCheckItemEntity> checkList = carCheckRecordDetailVO.getCheckItemList();
List<CarCheckItemEntity> 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));

3
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();
}

Loading…
Cancel
Save