Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
yang_shj 2 months ago
parent
commit
c88ec91f5c
  1. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/entity/RunMonthEntity.java
  2. 32
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/constants/StoreStatus.java
  3. 83
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java
  4. 72
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileFragmentController.java
  5. 85
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java
  6. 7
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java
  7. 94
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java
  8. 46
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileFragment.java
  9. 68
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java
  10. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/VectorParamEntity.java
  11. 11
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/AgentLogMapper.java
  12. 11
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileFragmentMapper.java
  13. 11
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileInfoMapper.java
  14. 19
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java
  15. 14
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileFragmentService.java
  16. 13
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java
  17. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/VectorParamService.java
  18. 74
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java
  19. 34
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileFragmentServiceImpl.java
  20. 36
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java
  21. 127
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java
  22. 16
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdRequest.java
  23. 19
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdsRequest.java
  24. 19
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/LabelRequest.java
  25. 13
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java
  26. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthService.java
  27. 92
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java
  28. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/RunMonthEvaluateVO.java
  29. 4
      hzims-service/operational/src/main/resources/db/3.0.3.sql

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/entity/RunMonthEntity.java

@ -44,4 +44,10 @@ public class RunMonthEntity extends TenantEntity {
@ApiModelProperty("分析结果") @ApiModelProperty("分析结果")
private String analyseResult; private String analyseResult;
@ApiModelProperty("评价")
private String evaluation;
@ApiModelProperty("重新判定的结论")
private String conclusion;
} }

32
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/constants/StoreStatus.java

@ -0,0 +1,32 @@
package com.hnac.hzims.bigmodel.maintenance.constants;
import lombok.Getter;
/**
* @Author: ypj
* @Date: 2024/9/11 16:16
*/
@Getter
public enum StoreStatus {
NOT_STORE(0, "未入库"),
STORED(1, "已入库"),
STORING(2, "入库中");
private final int code;
private final String msg;
StoreStatus(int code, String msg) {
this.code = code;
this.msg = msg;
}
public static StoreStatus getInstance(int code) {
for (StoreStatus status : StoreStatus.values()) {
if (status.getCode() == code) {
return status;
}
}
return null;
}
}

83
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java

@ -0,0 +1,83 @@
package com.hnac.hzims.bigmodel.maintenance.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.maintenance.entity.AgentLogEntity;
import com.hnac.hzims.bigmodel.maintenance.service.AgentLogService;
import com.hnac.hzims.bigmodel.maintenance.vo.IdsRequest;
import com.hnac.hzims.bigmodel.maintenance.vo.LabelRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.web.bind.annotation.*;
/**
* @Author: ypj
* @Date: 2024/9/9 10:37
*/
@RestController
@Slf4j
@AllArgsConstructor
@RequestMapping("/label")
@Api(value = "问题标注", tags = "问题标注")
public class AgentLogController {
private final AgentLogService agentLogService;
@GetMapping("/listPage")
@ApiOperation(value = "分页查询")
@ApiOperationSupport(order = 1)
public R<IPage<AgentLogEntity>> listPage(Query query, AgentLogEntity req) {
return R.data(agentLogService.listPage(Condition.getPage(query), req));
}
@GetMapping("/detail")
@ApiOperation(value = "查看详情")
@ApiOperationSupport(order = 2)
public R<AgentLogEntity> detail(@RequestParam @ApiParam("主键ID") Long id) {
return R.data(agentLogService.getById(id));
}
@PostMapping("/save")
@ApiOperation(value = "保存")
@ApiOperationSupport(order = 3)
public R save(@RequestBody AgentLogEntity req) {
return R.status(agentLogService.save(req));
}
@DeleteMapping("/remove")
@ApiOperation(value = "删除")
@ApiOperationSupport(order = 4)
public R remove(@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) {
return R.status(agentLogService.removeByIds(Func.toLongList(",", ids)));
}
@PutMapping("/update")
@ApiOperation(value = "编辑")
@ApiOperationSupport(order = 5)
public R update(@RequestBody AgentLogEntity req) {
return R.status(agentLogService.updateById(req));
}
@PutMapping("/batchLabel")
@ApiOperation(value = "批量标注")
@ApiOperationSupport(order = 6)
public R BatchLabel(@RequestBody IdsRequest ids) {
return R.status(agentLogService.BatchLabel(ids));
}
@PutMapping("/label")
@ApiOperation(value = "标注")
@ApiOperationSupport(order = 7)
public R label(@RequestBody LabelRequest req) {
return R.status(agentLogService.label(req));
}
}

72
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileFragmentController.java

@ -0,0 +1,72 @@
package com.hnac.hzims.bigmodel.maintenance.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileFragment;
import com.hnac.hzims.bigmodel.maintenance.service.KnowledgeFileFragmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Author: ypj
* @Date: 2024/9/11 11:56
*/
@RestController
@Slf4j
@RequestMapping("/knowledge/fragment")
@AllArgsConstructor
@Api(value = "知识库文件分片管理", tags = "知识库文件分片管理")
public class KnowledgeFileFragmentController {
private final KnowledgeFileFragmentService knowledgeFileFragmentService;
@GetMapping("/listPage")
@ApiOperation(value = "分页查询")
@ApiOperationSupport(order = 1)
public R<IPage<KnowledgeFileFragment>> listPage(Query query, KnowledgeFileFragment req) {
return R.data(knowledgeFileFragmentService.page(Condition.getPage(query), Condition.getQueryWrapper(new KnowledgeFileFragment(), req)));
}
@GetMapping("/detail")
@ApiOperation(value = "查看详情")
@ApiOperationSupport(order = 2)
public R<KnowledgeFileFragment> detail(@RequestParam @ApiParam("主键ID") Long id) {
return R.data(knowledgeFileFragmentService.getById(id));
}
@PostMapping("/save")
@ApiOperation(value = "保存")
@ApiOperationSupport(order = 3)
public R save(@RequestBody KnowledgeFileFragment req) {
return R.status(knowledgeFileFragmentService.save(req));
}
@PutMapping("/update")
@ApiOperation(value = "编辑")
@ApiOperationSupport(order = 4)
public R update(@RequestBody KnowledgeFileFragment req) {
return R.status(knowledgeFileFragmentService.updateById(req));
}
@DeleteMapping("/remove")
@ApiOperation(value = "删除")
@ApiOperationSupport(order = 5)
public R remove(@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) {
return R.status(knowledgeFileFragmentService.removeByIds(Func.toLongList(",", ids)));
}
@GetMapping("/getByDocId")
@ApiOperation(value = "根据文档ID获取分片,不分页")
public R<List<KnowledgeFileFragment>> getByDocId(@RequestParam @ApiParam("主键ID") Long docId) {
return R.data(knowledgeFileFragmentService.getByDocId(docId));
}
}

85
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java

@ -0,0 +1,85 @@
package com.hnac.hzims.bigmodel.maintenance.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileInfo;
import com.hnac.hzims.bigmodel.maintenance.service.KnowledgeFileInfoService;
import com.hnac.hzims.bigmodel.maintenance.vo.IdRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.resource.feign.IOssClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
* @Author: ypj
* @Date: 2024/9/10 16:44
*/
@RestController
@Slf4j
@RequestMapping("/knowledge/file")
@Api(value = "知识库文件管理", tags = "知识库文件管理")
@AllArgsConstructor
public class KnowledgeFileInfoController {
private final KnowledgeFileInfoService knowledgeFileInfoService;
private final IOssClient ossClient;
@GetMapping("/listPage")
@ApiOperation(value = "分页查询")
@ApiOperationSupport(order = 1)
public R<IPage<KnowledgeFileInfo>> listPage(Query query, KnowledgeFileInfo req) {
return R.data(knowledgeFileInfoService.page(Condition.getPage(query),
Condition.getQueryWrapper(new KnowledgeFileInfo(), req).orderByDesc(KnowledgeFileInfo::getCreateTime)));
}
@GetMapping("/detail")
@ApiOperation(value = "查看详情")
@ApiOperationSupport(order = 2)
public R<KnowledgeFileInfo> detail(@RequestParam @ApiParam("主键ID") Long id) {
return R.data(knowledgeFileInfoService.getById(id));
}
@PostMapping("/save")
@ApiOperation(value = "保存")
@ApiOperationSupport(order = 3)
public R save(@RequestBody KnowledgeFileInfo req) {
return R.status(knowledgeFileInfoService.save(req));
}
@PutMapping("/update")
@ApiOperation(value = "编辑")
@ApiOperationSupport(order = 4)
public R update(@RequestBody KnowledgeFileInfo req) {
return R.status(knowledgeFileInfoService.updateById(req));
}
@DeleteMapping("/remove")
@ApiOperation(value = "删除")
@ApiOperationSupport(order = 5)
public R remove(@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) {
return R.status(knowledgeFileInfoService.removeByIds(Func.toLongList(",", ids)));
}
@PostMapping(value = "/upload", produces = MediaType.APPLICATION_PROBLEM_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@ApiOperation(value = "上传文件")
@ApiOperationSupport(order = 6)
public R<BladeFile> upload(@ApiParam(value = "上传文件", required = true) @RequestPart("file") MultipartFile file) {
return ossClient.putFile(file);
}
@PostMapping("/store")
@ApiOperation(value = "入库")
@ApiOperationSupport(order = 7)
public R store(@RequestBody IdRequest req) {
return R.status(knowledgeFileInfoService.store(req));
}
}

7
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java

@ -5,6 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.maintenance.entity.VectorParamEntity; import com.hnac.hzims.bigmodel.maintenance.entity.VectorParamEntity;
import com.hnac.hzims.bigmodel.maintenance.service.VectorParamService; import com.hnac.hzims.bigmodel.maintenance.service.VectorParamService;
import com.hnac.hzims.bigmodel.maintenance.vo.IdsRequest;
import com.hnac.hzinfo.api.annotation.ApiInterface; import com.hnac.hzinfo.api.annotation.ApiInterface;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -107,11 +108,11 @@ public class VectorParamController {
return R.data(vectorParamService.getUrlResponseKeyList(url, bladeToken, hzinfoToken)); return R.data(vectorParamService.getUrlResponseKeyList(url, bladeToken, hzinfoToken));
} }
@PutMapping("/synchronization") @PutMapping("/synchronization/")
@ApiOperation(value = "同步") @ApiOperation(value = "同步")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
public R synchronization(@RequestHeader(name = "Blade-Auth", value = "Blade-Auth", required = false) String bladeToken, public R synchronization(@RequestHeader(name = "Blade-Auth", value = "Blade-Auth", required = false) String bladeToken,
@RequestHeader(name = "Hzinfo-Auth", value = "Hzinfo-Auth", required = false) String hzinfoToken) throws JsonProcessingException { @RequestHeader(name = "Hzinfo-Auth", value = "Hzinfo-Auth", required = false) String hzinfoToken, @RequestBody IdsRequest req) throws JsonProcessingException {
return R.status(vectorParamService.synchronization(bladeToken, hzinfoToken)); return R.status(vectorParamService.synchronization(req.getIds(), bladeToken, hzinfoToken));
} }
} }

94
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java

@ -0,0 +1,94 @@
package com.hnac.hzims.bigmodel.maintenance.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.mp.support.SqlCondition;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable;
import java.util.Date;
/**
* @Author: ypj
* @Date: 2024/9/9 10:38
*/
@ApiModel("问题标注")
@TableName("gglm_agent_log")
@Data
public class AgentLogEntity extends TenantEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("对话id")
@TableField("chat_id")
@QueryField(condition = SqlCondition.EQUAL)
private String chatId;
@ApiModelProperty("问题id")
@TableField("q_id")
@QueryField(condition = SqlCondition.EQUAL)
@JSONField(name = "qId")
private String qId;
@ApiModelProperty("模型名称")
@QueryField(condition = SqlCondition.EQUAL)
@TableField("model_name")
private String modelName;
@ApiModelProperty("问题来源")
@QueryField(condition = SqlCondition.EQUAL)
private String agent;
@ApiModelProperty("问题")
@QueryField(condition = SqlCondition.LIKE)
private String q;
@ApiModelProperty("问题提示")
@QueryField(condition = SqlCondition.LIKE)
@TableField("prompt")
@JSONField(name = "prompt")
private String prompt;
@ApiModelProperty("系统提示")
@QueryField(condition = SqlCondition.LIKE)
@TableField("system")
private String system;
@ApiModelProperty("答案")
@QueryField(condition = SqlCondition.LIKE)
private String a;
@ApiModelProperty("用户结论,0为错误,1为正确")
@QueryField(condition = SqlCondition.EQUAL)
@TableField("user_conclusion")
private int userConclusion;
@ApiModelProperty("标注状态,0为未标注,1为已标注")
@QueryField(condition = SqlCondition.EQUAL)
@TableField("label_status")
private int labelStatus;
@ApiModelProperty("标注结果,0为错误,1为正确")
@QueryField(condition = SqlCondition.EQUAL)
@TableField("label_result")
private int labelResult;
@ApiModelProperty("标注内容,json字符串,答案类型不一样格式不一样")
@QueryField(condition = SqlCondition.LIKE)
@TableField("label_content")
private String labelContent;
@ApiModelProperty("标注人名称")
@QueryField(condition = SqlCondition.LIKE)
@TableField("label_operator")
private String labelOperator;
@ApiModelProperty("标注时间")
@QueryField(condition = SqlCondition.EQUAL)
@TableField("label_time")
private Date labelTime;
}

46
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileFragment.java

@ -0,0 +1,46 @@
package com.hnac.hzims.bigmodel.maintenance.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.mp.support.SqlCondition;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable;
/**
* @Author: ypj
* @Date: 2024/9/11 9:58
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("knowledge_file_fragment")
@ApiModel(value = "知识库文件分片信息",description = "知识库文件分片信息")
public class KnowledgeFileFragment extends TenantEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("文档ID")
@TableField("DOC_ID")
@QueryField(condition = SqlCondition.EQUAL)
private Long docId;
@ApiModelProperty("文档问题")
@TableField("DOC_QS")
@QueryField(condition = SqlCondition.LIKE)
private String docQs;
@ApiModelProperty("文档内容")
@TableField("DOC_CONTENT")
@QueryField(condition = SqlCondition.LIKE)
private String docContent;
@ApiModelProperty("文档页码")
@TableField("DOC_PAGE_INDEX")
@QueryField(condition = SqlCondition.EQUAL)
private Integer docPageIndex;
}

68
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java

@ -0,0 +1,68 @@
package com.hnac.hzims.bigmodel.maintenance.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.mp.support.SqlCondition;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable;
/**
* @Author: ypj
* @Date: 2024/9/10 15:17
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("knowledge_file_info")
@ApiModel(value = "知识库文件信息",description = "知识库文件信息")
public class KnowledgeFileInfo extends TenantEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("文件名称")
@QueryField(condition = SqlCondition.LIKE)
private String name;
@ApiModelProperty("文件url")
@QueryField(condition = SqlCondition.LIKE)
private String url;
@ApiModelProperty("文件大小")
@QueryField(condition = SqlCondition.EQUAL)
private Long size;
@ApiModelProperty("简介")
@QueryField(condition = SqlCondition.LIKE)
private String briefs;
@ApiModelProperty("标签")
@QueryField(condition = SqlCondition.LIKE)
private String tags;
@ApiModelProperty("业务领域")
@QueryField(condition = SqlCondition.EQUAL)
private String domain;
@ApiModelProperty("权限等级,5个等级")
@TableField("AUTHORITY_CLASS")
@QueryField(condition = SqlCondition.EQUAL)
private Integer authorityClass;
@ApiModelProperty("是否可见,0为不可见,1为可见")
@QueryField(condition = SqlCondition.EQUAL)
private Integer visible;
@ApiModelProperty("文件状态,0为未入库,1为已入库,2为入库中")
@TableField("FILE_STATUS")
@QueryField(condition = SqlCondition.EQUAL)
private Integer fileStatus;
@ApiModelProperty("备注")
@QueryField(condition = SqlCondition.LIKE)
private String remark;
}

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/VectorParamEntity.java

@ -16,7 +16,7 @@ import java.io.Serializable;
* @Date: 2024/9/2 14:54 * @Date: 2024/9/2 14:54
*/ */
@ApiModel("向量参数配置") @ApiModel("向量参数配置")
@TableName("HZIMS_VECTOR_PARAM") @TableName("gglm_vector_param")
@Data @Data
public class VectorParamEntity extends TenantEntity implements Serializable { public class VectorParamEntity extends TenantEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

11
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/AgentLogMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.bigmodel.maintenance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.bigmodel.maintenance.entity.AgentLogEntity;
/**
* @Author: ypj
* @Date: 2024/9/9 11:07
*/
public interface AgentLogMapper extends BaseMapper<AgentLogEntity> {
}

11
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileFragmentMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.bigmodel.maintenance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileFragment;
/**
* @Author: ypj
* @Date: 2024/9/11 10:49
*/
public interface KnowledgeFileFragmentMapper extends BaseMapper<KnowledgeFileFragment> {
}

11
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileInfoMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.bigmodel.maintenance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileInfo;
/**
* @Author: ypj
* @Date: 2024/9/10 16:41
*/
public interface KnowledgeFileInfoMapper extends BaseMapper<KnowledgeFileInfo> {
}

19
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java

@ -0,0 +1,19 @@
package com.hnac.hzims.bigmodel.maintenance.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.bigmodel.maintenance.entity.AgentLogEntity;
import com.hnac.hzims.bigmodel.maintenance.vo.IdsRequest;
import com.hnac.hzims.bigmodel.maintenance.vo.LabelRequest;
/**
* @Author: ypj
* @Date: 2024/9/9 11:08
*/
public interface AgentLogService extends IService<AgentLogEntity> {
Boolean BatchLabel(IdsRequest ids);
Boolean label(LabelRequest req);
IPage<AgentLogEntity> listPage(IPage<AgentLogEntity> page, AgentLogEntity req);
}

14
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileFragmentService.java

@ -0,0 +1,14 @@
package com.hnac.hzims.bigmodel.maintenance.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileFragment;
import java.util.List;
/**
* @Author: ypj
* @Date: 2024/9/11 10:50
*/
public interface KnowledgeFileFragmentService extends IService<KnowledgeFileFragment> {
List<KnowledgeFileFragment> getByDocId(Long docId);
}

13
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java

@ -0,0 +1,13 @@
package com.hnac.hzims.bigmodel.maintenance.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileInfo;
import com.hnac.hzims.bigmodel.maintenance.vo.IdRequest;
/**
* @Author: ypj
* @Date: 2024/9/10 16:42
*/
public interface KnowledgeFileInfoService extends IService<KnowledgeFileInfo> {
Boolean store(IdRequest req);
}

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/VectorParamService.java

@ -18,5 +18,5 @@ public interface VectorParamService extends IService<VectorParamEntity> {
List<String> getUrlResponseKeyList(String url, String bladeToken, String hzinfoToken); List<String> getUrlResponseKeyList(String url, String bladeToken, String hzinfoToken);
Boolean synchronization(String bladeToken, String hzinfoToken); Boolean synchronization(List<Long> id ,String bladeToken, String hzinfoToken);
} }

74
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java

@ -0,0 +1,74 @@
package com.hnac.hzims.bigmodel.maintenance.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.bigmodel.maintenance.entity.AgentLogEntity;
import com.hnac.hzims.bigmodel.maintenance.mapper.AgentLogMapper;
import com.hnac.hzims.bigmodel.maintenance.service.AgentLogService;
import com.hnac.hzims.bigmodel.maintenance.vo.IdsRequest;
import com.hnac.hzims.bigmodel.maintenance.vo.LabelRequest;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* @Author: ypj
* @Date: 2024/9/9 11:10
*/
@Service
@Slf4j
@AllArgsConstructor
@DS("hznlm")
public class AgentLogServiceImpl extends ServiceImpl<AgentLogMapper, AgentLogEntity> implements AgentLogService {
@Override
public Boolean BatchLabel(IdsRequest ids) {
Date now = new Date();
return this.update(Wrappers.<AgentLogEntity>lambdaUpdate()
.set(AgentLogEntity::getLabelStatus, 1)
.set(AgentLogEntity::getLabelResult, 1)
.set(AgentLogEntity::getLabelOperator, AuthUtil.getUserName())
.set(AgentLogEntity::getLabelTime, now)
.set(AgentLogEntity::getUpdateTime, now)
.in(AgentLogEntity::getId, ids.getIds()));
}
@Override
public Boolean label(LabelRequest req) {
AgentLogEntity entity = this.getById(req.getId());
if (entity != null) {
int labelResult = StringUtil.isBlank(req.getLabelContent()) || req.getLabelContent().equals(entity.getA()) ? 1 : 0;
Date now = new Date();
return this.update(Wrappers.<AgentLogEntity>lambdaUpdate()
.set(AgentLogEntity::getLabelStatus, 1)
.set(AgentLogEntity::getLabelResult, labelResult)
.set(StringUtil.isNotBlank(req.getLabelContent()), AgentLogEntity::getLabelContent, req.getLabelContent())
.set(AgentLogEntity::getLabelOperator, AuthUtil.getUserName())
.set(AgentLogEntity::getLabelTime, now)
.set(AgentLogEntity::getUpdateTime, now)
.eq(AgentLogEntity::getId, req.getId()));
}
return false;
}
@Override
public IPage<AgentLogEntity> listPage(IPage<AgentLogEntity> page, AgentLogEntity req) {
LambdaQueryWrapper<AgentLogEntity> queryWrapper = Wrappers.<AgentLogEntity>lambdaQuery()
.eq(ObjectUtil.isNotEmpty(req.getId()), AgentLogEntity::getId, req.getId())
.eq(ObjectUtil.isNotEmpty(req.getChatId()), AgentLogEntity::getChatId, req.getChatId())
.eq(ObjectUtil.isNotEmpty(req.getQId()), AgentLogEntity::getQId, req.getQId())
.eq(ObjectUtil.isNotEmpty(req.getModelName()), AgentLogEntity::getModelName, req.getModelName())
.orderByDesc(AgentLogEntity::getCreateTime)
.orderByAsc(AgentLogEntity::getChatId);
return this.page(page, queryWrapper);
}
}

34
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileFragmentServiceImpl.java

@ -0,0 +1,34 @@
package com.hnac.hzims.bigmodel.maintenance.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileFragment;
import com.hnac.hzims.bigmodel.maintenance.mapper.KnowledgeFileFragmentMapper;
import com.hnac.hzims.bigmodel.maintenance.service.KnowledgeFileFragmentService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author: ypj
* @Date: 2024/9/11 10:51
*/
@Service
@Slf4j
@AllArgsConstructor
@DS("hznlm")
public class KnowledgeFileFragmentServiceImpl extends ServiceImpl<KnowledgeFileFragmentMapper, KnowledgeFileFragment> implements KnowledgeFileFragmentService {
private KnowledgeFileFragmentMapper knowledgeFileFragmentMapper;
@Override
public List<KnowledgeFileFragment> getByDocId(Long docId) {
LambdaQueryWrapper<KnowledgeFileFragment> queryWrapper = Wrappers.<KnowledgeFileFragment>lambdaQuery()
.eq(KnowledgeFileFragment::getDocId, docId)
.orderByAsc(KnowledgeFileFragment::getDocPageIndex);
return knowledgeFileFragmentMapper.selectList(queryWrapper);
}
}

36
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java

@ -0,0 +1,36 @@
package com.hnac.hzims.bigmodel.maintenance.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.bigmodel.maintenance.constants.StoreStatus;
import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileInfo;
import com.hnac.hzims.bigmodel.maintenance.mapper.KnowledgeFileInfoMapper;
import com.hnac.hzims.bigmodel.maintenance.service.KnowledgeFileInfoService;
import com.hnac.hzims.bigmodel.maintenance.vo.IdRequest;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Author: ypj
* @Date: 2024/9/10 16:43
*/
@Service
@Slf4j
@AllArgsConstructor
@DS("hznlm")
public class KnowledgeFileInfoServiceImpl extends ServiceImpl<KnowledgeFileInfoMapper, KnowledgeFileInfo> implements KnowledgeFileInfoService {
private final KnowledgeFileInfoMapper knowledgeFileInfoMapper;
@Override
public Boolean store(IdRequest req) {
KnowledgeFileInfo knowledgeFileInfo = knowledgeFileInfoMapper.selectById(req.getId());
LambdaUpdateWrapper<KnowledgeFileInfo> queryWrapper = Wrappers.<KnowledgeFileInfo>lambdaUpdate()
.set(KnowledgeFileInfo::getFileStatus, StoreStatus.STORING.getCode())
.eq(KnowledgeFileInfo::getId, req.getId());
return this.update(queryWrapper);
}
}

127
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java

@ -5,6 +5,8 @@ import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
@ -16,7 +18,6 @@ import com.hnac.hzims.bigmodel.maintenance.service.VectorParamService;
import com.hnac.hzims.bigmodel.maintenance.vo.VectorUrlResponse; import com.hnac.hzims.bigmodel.maintenance.vo.VectorUrlResponse;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -30,6 +31,7 @@ import java.util.*;
@Service @Service
@Slf4j @Slf4j
@AllArgsConstructor @AllArgsConstructor
@DS("hznlm")
public class VectorParamServiceImpl extends ServiceImpl<VectorParamMapper, VectorParamEntity> implements VectorParamService { public class VectorParamServiceImpl extends ServiceImpl<VectorParamMapper, VectorParamEntity> implements VectorParamService {
private static final String CLIENT_SIGN = "vector_param"; private static final String CLIENT_SIGN = "vector_param";
@ -49,59 +51,58 @@ public class VectorParamServiceImpl extends ServiceImpl<VectorParamMapper, Vecto
.header("Hzinfo-Auth", hzinfoToken).execute(); .header("Hzinfo-Auth", hzinfoToken).execute();
if (response.getStatus() == HttpServletResponse.SC_OK) { if (response.getStatus() == HttpServletResponse.SC_OK) {
String body = response.body(); String body = response.body();
log.info("getUrlResponse:" + body); log.info("vector url response url:{}, response:{}", url, body);
JSONObject jsonObject = JSON.parseObject(body); try {
VectorUrlResponse result = new VectorUrlResponse(); ObjectMapper mapper = new ObjectMapper();
result.setOriginalData(JSONArray.parseArray(jsonObject.getString("data")).toJavaList(JSONObject.class)); JsonNode rootNode = mapper.readTree(body);
// try { if (rootNode.isArray()) {
// ObjectMapper mapper = new ObjectMapper(); return getUrlResponseByArray(rootNode);
// JsonNode rootNode = mapper.readTree(body); }
// if (rootNode.isArray()) { JsonNode dataNode = rootNode.findValue("data");
// return getUrlResponseByArray(rootNode); if (dataNode != null && dataNode.isArray()) {
// } return getUrlResponseByArray(dataNode);
// JsonNode dataNode = rootNode.findValue("data"); }
// if (dataNode != null && dataNode.isArray()) { if (dataNode != null) {
// return getUrlResponseByArray(dataNode); return getUrlResponseByObject(dataNode);
// } }
// if (dataNode != null) { if (rootNode != null) {
// return getUrlResponseByObject(dataNode); return getUrlResponseByObject(rootNode);
// } }
// if (rootNode != null) { } catch (JsonProcessingException e) {
// return getUrlResponseByObject(rootNode); log.error("getUrlResponse error", e);
// } }
// } catch (JsonProcessingException e) {
// log.error("getUrlResponse error", e);
// }
} }
return null; return null;
} }
// private VectorUrlResponse getUrlResponseByArray(JsonNode rootNode) throws JsonProcessingException { private VectorUrlResponse getUrlResponseByArray(JsonNode rootNode) throws JsonProcessingException {
// VectorUrlResponse result = new VectorUrlResponse(); VectorUrlResponse result = new VectorUrlResponse();
// result.setOriginalData(rootNode); result.setOriginalData(JSONArray.parseArray(rootNode.toPrettyString()).toJavaList(JSONObject.class));
// JsonNode item = rootNode.get(0); JsonNode item = rootNode.get(0);
// if (item != null) { if (item != null) {
// List<String> keyList = new ArrayList<>(); List<String> keyList = new ArrayList<>();
// Iterator<String> iterator = item.fieldNames(); Iterator<String> iterator = item.fieldNames();
// while (iterator.hasNext()) { while (iterator.hasNext()) {
// keyList.add(iterator.next()); keyList.add(iterator.next());
// } }
// result.setKeyList(keyList); result.setKeyList(keyList);
// } }
// return result; return result;
// } }
// private VectorUrlResponse getUrlResponseByObject(JsonNode rootNode) throws JsonProcessingException { private VectorUrlResponse getUrlResponseByObject(JsonNode rootNode) throws JsonProcessingException {
// VectorUrlResponse result = new VectorUrlResponse(); VectorUrlResponse result = new VectorUrlResponse();
// result.setOriginalData(rootNode); List<JSONObject> originalData = new ArrayList<>();
// List<String> keyList = new ArrayList<>(); originalData.add(JSON.parseObject(rootNode.toPrettyString()));
// Iterator<String> iterator = rootNode.fieldNames(); result.setOriginalData(originalData);
// while (iterator.hasNext()) { List<String> keyList = new ArrayList<>();
// keyList.add(iterator.next()); Iterator<String> iterator = rootNode.fieldNames();
// } while (iterator.hasNext()) {
// result.setKeyList(keyList); keyList.add(iterator.next());
// return result; }
// } result.setKeyList(keyList);
return result;
}
@Override @Override
public List<String> getUrlResponseKeyList(String url, String bladeToken, String hzinfoToken) { public List<String> getUrlResponseKeyList(String url, String bladeToken, String hzinfoToken) {
@ -110,12 +111,15 @@ public class VectorParamServiceImpl extends ServiceImpl<VectorParamMapper, Vecto
} }
@Override @Override
public Boolean synchronization(String bladeToken, String hzinfoToken) { public Boolean synchronization(List<Long> ids, String bladeToken, String hzinfoToken) {
List<VectorParamEntity> list = this.list(); if (null == ids && ids.isEmpty()) {
if (CollectionUtil.isEmpty(list)) { return false;
}
for (Long id : ids) {
VectorParamEntity entity = getById(id);
if (null == entity) {
return false; return false;
} }
for (VectorParamEntity entity : list) {
VectorUrlResponse response = getUrlResponse(entity.getUrl(), bladeToken, hzinfoToken); VectorUrlResponse response = getUrlResponse(entity.getUrl(), bladeToken, hzinfoToken);
if (response != null) { if (response != null) {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
@ -123,7 +127,7 @@ public class VectorParamServiceImpl extends ServiceImpl<VectorParamMapper, Vecto
try { try {
rootNode = mapper.readTree(entity.getAttributeMap()); rootNode = mapper.readTree(entity.getAttributeMap());
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
e.printStackTrace(); log.error("getUrlResponseKeyList error", e);
} }
Map<String, String> attrMap = new HashMap<>(); Map<String, String> attrMap = new HashMap<>();
Iterator<String> iterator = rootNode.fieldNames(); Iterator<String> iterator = rootNode.fieldNames();
@ -131,24 +135,11 @@ public class VectorParamServiceImpl extends ServiceImpl<VectorParamMapper, Vecto
String key = iterator.next(); String key = iterator.next();
attrMap.put(key, rootNode.findValue(key).textValue()); attrMap.put(key, rootNode.findValue(key).textValue());
} }
List<Object> dataList = new ArrayList();
JsonNode dataObject = (JsonNode) response.getOriginalData();
if (dataObject.isArray()) {
Iterator<JsonNode> dataIterator = dataObject.iterator();
while (dataIterator.hasNext()) {
dataList.add(toJsonObject(dataIterator.next()));
}
} else {
dataList.add(toJsonObject(dataObject));
}
weaviateService.saveBatch(response.getOriginalData(), entity.getTableName(), attrMap); weaviateService.saveBatch(response.getOriginalData(), entity.getTableName(), attrMap);
this.update(Wrappers.<VectorParamEntity>lambdaUpdate().eq(VectorParamEntity::getId, id).set(VectorParamEntity::getUpdateTime, new Date()));
} }
} }
return true; return true;
} }
private JSONObject toJsonObject(JsonNode node) {
JSONObject jsonObject = JSON.parseObject(node.toString());
return jsonObject;
}
} }

16
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdRequest.java

@ -0,0 +1,16 @@
package com.hnac.hzims.bigmodel.maintenance.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author: ypj
* @Date: 2024/9/11 14:16
*/
@Data
@ApiModel("单id操作请求")
public class IdRequest {
@ApiModelProperty("主键ID")
private Long id;
}

19
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdsRequest.java

@ -0,0 +1,19 @@
package com.hnac.hzims.bigmodel.maintenance.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @Author: ypj
* @Date: 2024/9/7 11:04
*/
@Data
@ApiModel("批量操作请求")
public class IdsRequest {
@ApiModelProperty("主键ID,按逗号分隔")
private List<Long> ids;
}

19
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/LabelRequest.java

@ -0,0 +1,19 @@
package com.hnac.hzims.bigmodel.maintenance.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author: ypj
* @Date: 2024/9/10 14:04
*/
@Data
@ApiModel("标注")
public class LabelRequest {
@ApiModelProperty("主键ID")
private Long id;
@ApiModelProperty("标注内容,json字符串,答案类型不一样格式不一样")
private String labelContent;
}

13
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java

@ -3,15 +3,13 @@ package com.hnac.hzims.operational.report.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.report.entity.RunMonthEntity; import com.hnac.hzims.operational.report.entity.RunMonthEntity;
import com.hnac.hzims.operational.report.service.RunMonthService; import com.hnac.hzims.operational.report.service.RunMonthService;
import com.hnac.hzims.operational.report.vo.RunMonthEvaluateVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @author ysj * @author ysj
@ -63,4 +61,11 @@ public class RunMonthController {
runMonthService.generateAnalyseResult(month, stationCode); runMonthService.generateAnalyseResult(month, stationCode);
return R.success("调用成功!"); return R.success("调用成功!");
} }
@PutMapping("/evaluate")
@ApiOperation(value = "站点月报评价", notes = "站点月报评价")
@ApiOperationSupport(order = 6)
public R evaluate(@RequestBody RunMonthEvaluateVO req) {
return R.data(runMonthService.evaluate(req));
}
} }

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthService.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.report.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.operational.report.entity.RunMonthEntity; import com.hnac.hzims.operational.report.entity.RunMonthEntity;
import com.hnac.hzims.operational.report.vo.RunMonthEvaluateVO;
/** /**
@ -19,9 +20,12 @@ public interface RunMonthService extends IService<RunMonthEntity> {
/** /**
* 生成分析结果 * 生成分析结果
*
* @param month 月份 * @param month 月份
* @param stationCode 站点编号 * @param stationCode 站点编号
* @return 大模型调用结果 * @return 大模型调用结果
*/ */
Boolean generateAnalyseResult(String month, String stationCode); Boolean generateAnalyseResult(String month, String stationCode);
Boolean evaluate(RunMonthEvaluateVO req);
} }

92
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java

@ -38,6 +38,7 @@ import com.hnac.hzinfo.datasearch.history.OriginalDataQuery;
import com.hnac.hzinfo.datasearch.soe.ISoeClient; import com.hnac.hzinfo.datasearch.soe.ISoeClient;
import com.hnac.hzinfo.datasearch.soe.domian.SoeData; import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation; import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation;
import com.hnac.hzinfo.exception.HzServiceException;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import com.hnac.hzinfo.sdk.core.response.HzPage; import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result; import com.hnac.hzinfo.sdk.core.response.Result;
@ -55,6 +56,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.*; import org.springblade.core.tool.utils.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -108,6 +110,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 查询站点月报运行数据 * 查询站点月报运行数据
*
* @param mon * @param mon
* @param stationCode * @param stationCode
* @return * @return
@ -123,7 +126,8 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
} }
RunDataShowVo data = new RunDataShowVo(); RunDataShowVo data = new RunDataShowVo();
BeanUtil.copyProperties(entity, data); BeanUtil.copyProperties(entity, data);
List<RunDataVo> runs = JSONObject.parseObject(entity.getRunData(),new TypeReference<List<RunDataVo>>(){}); List<RunDataVo> runs = JSONObject.parseObject(entity.getRunData(), new TypeReference<List<RunDataVo>>() {
});
if (CollectionUtil.isEmpty(runs)) { if (CollectionUtil.isEmpty(runs)) {
return data; return data;
} }
@ -156,9 +160,9 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
} }
/** /**
* 导出站点月报文件 * 导出站点月报文件
*
* @param mon * @param mon
* @param stationCode * @param stationCode
*/ */
@ -174,7 +178,8 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
if (ObjectUtil.isEmpty(data)) { if (ObjectUtil.isEmpty(data)) {
throw new ServiceException("站点" + mon + "月份未生成运行月报数据!"); throw new ServiceException("站点" + mon + "月份未生成运行月报数据!");
} }
List<RunDataVo> runs = JSONObject.parseObject(data.getRunData(),new TypeReference<List<RunDataVo>>(){}); List<RunDataVo> runs = JSONObject.parseObject(data.getRunData(), new TypeReference<List<RunDataVo>>() {
});
if (CollectionUtil.isNotEmpty(runs)) { if (CollectionUtil.isNotEmpty(runs)) {
// 保留两位小数 // 保留两位小数
data.setRunData(JSONObject.toJSONString(runs.stream().map(run -> { data.setRunData(JSONObject.toJSONString(runs.stream().map(run -> {
@ -210,6 +215,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 生成站点月报 * 生成站点月报
*
* @param mon * @param mon
* @param stationCode * @param stationCode
* @return * @return
@ -297,6 +303,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 调用大模型分析月报接口 * 调用大模型分析月报接口
*
* @param mon 月报月份 * @param mon 月报月份
* @param stationCode 月报站号 * @param stationCode 月报站号
*/ */
@ -329,6 +336,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 填充大模型分析所需数据格式 * 填充大模型分析所需数据格式
*
* @param req 月报数据 * @param req 月报数据
* @param analyseVOList 大模型分析对象 * @param analyseVOList 大模型分析对象
* @param month 查询月报筛选条件 * @param month 查询月报筛选条件
@ -385,6 +393,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 创建大模型分析所需对象 * 创建大模型分析所需对象
*
* @param deviceName 设备名称 * @param deviceName 设备名称
* @param month 对象月份 * @param month 对象月份
* @param deviceOrder 设备序号 * @param deviceOrder 设备序号
@ -443,6 +452,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 先删除原先月报数据 * 先删除原先月报数据
*
* @param mon * @param mon
* @param stationCode * @param stationCode
*/ */
@ -459,6 +469,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 运行数据 * 运行数据
*
* @param devices * @param devices
* @return * @return
*/ */
@ -491,6 +502,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 实际发电量 * 实际发电量
*
* @param type * @param type
* @param deviceCode * @param deviceCode
* @param ride * @param ride
@ -512,6 +524,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 计划发电量 * 计划发电量
*
* @param type * @param type
* @param stationCode * @param stationCode
* @param plans * @param plans
@ -536,6 +549,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 获取运行数据 * 获取运行数据
*
* @param device * @param device
* @return * @return
*/ */
@ -557,6 +571,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 获取时间范围内运行时长 * 获取时间范围内运行时长
*
* @param realId * @param realId
* @param startDate * @param startDate
* @param endDate * @param endDate
@ -581,6 +596,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 获取运行时长 * 获取运行时长
*
* @param result * @param result
* @return * @return
*/ */
@ -614,6 +630,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 告警数据 * 告警数据
*
* @param code * @param code
* @return * @return
*/ */
@ -627,6 +644,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 查询hz3000告警 * 查询hz3000告警
*
* @param code * @param code
*/ */
private List<RunAlarmVo> hz3000Alarm(String code, String start, String end) { private List<RunAlarmVo> hz3000Alarm(String code, String start, String end) {
@ -654,6 +672,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 智能预警 * 智能预警
*
* @param code * @param code
* @param start * @param start
* @param end * @param end
@ -685,6 +704,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 运行曲线 * 运行曲线
*
* @param devices * @param devices
* @return * @return
*/ */
@ -703,11 +723,10 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 获取曲线数据 * 获取曲线数据
*
* @param attributes * @param attributes
* @param deviceCode * @param deviceCode
* @return * @return
*
*
*/ */
private List<EchartVo> curve(List<AttributeVo> attributes, String start, String end, String deviceCode) { private List<EchartVo> curve(List<AttributeVo> attributes, String start, String end, String deviceCode) {
List<AnalyzeDataConditionVO> datas = dataService.periodTargetSignages(start, end, 3, 3, deviceCode, attributes.stream().map(AttributeVo::getSignage).collect(Collectors.toList())); List<AnalyzeDataConditionVO> datas = dataService.periodTargetSignages(start, end, 3, 3, deviceCode, attributes.stream().map(AttributeVo::getSignage).collect(Collectors.toList()));
@ -756,6 +775,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 曲线属性获取 * 曲线属性获取
*
* @param attributeType * @param attributeType
* @return * @return
*/ */
@ -820,6 +840,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 检查站点是否存在设备信息 * 检查站点是否存在设备信息
*
* @param stationCode * @param stationCode
* @return * @return
*/ */
@ -848,8 +869,48 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
return true; return true;
} }
@Override
public Boolean evaluate(RunMonthEvaluateVO req) {
RunMonthEntity entity = this.getById(req.getId());
if (ObjectUtil.isEmpty(entity)) {
throw new HzServiceException("未查询到月报信息!");
}
String analyseResult = entity.getAnalyseResult();
Map<String, Object> analyseResultMap = new HashMap<>();
if (StringUtil.isNotBlank(analyseResult)) {
analyseResultMap = JsonUtil.toMap(analyseResult);
}
String conclusion = entity.getConclusion();
Map<String, Object> conclusionMap = new HashMap<>();
if (StringUtil.isNotBlank(conclusion)) {
conclusionMap = JsonUtil.toMap(conclusion);
}
String evaluation = entity.getEvaluation();
Map<String, Object> evaluationMap = new HashMap<>();
if (StringUtil.isNotBlank(evaluation)) {
evaluationMap = JsonUtil.toMap(evaluation);
}
// 更新
if (StringUtil.isNotBlank(req.getContent())) {
conclusionMap.put(req.getType(), req.getContent());
analyseResultMap.put(req.getType(), req.getContent());
}
if (StringUtil.isNotBlank(req.getEvaluation())) {
evaluationMap.put(req.getType(), req.getEvaluation());
}
return this.update(Wrappers.<RunMonthEntity>lambdaUpdate()
.set(RunMonthEntity::getAnalyseResult, JsonUtil.toJson(analyseResultMap))
.set(RunMonthEntity::getConclusion, JsonUtil.toJson(conclusionMap))
.set(RunMonthEntity::getEvaluation, JsonUtil.toJson(evaluationMap))
.eq(RunMonthEntity::getId, req.getId()));
}
/** /**
* 手绘运行数据表格 * 手绘运行数据表格
*
* @return * @return
*/ */
private Workbook drawBook(String headerName, RunMonthEntity entity) { private Workbook drawBook(String headerName, RunMonthEntity entity) {
@ -906,6 +967,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 绘制机组曲线 * 绘制机组曲线
*
* @param hssWB * @param hssWB
* @param rowNumber * @param rowNumber
* @param data * @param data
@ -919,7 +981,8 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
sheet.addMergedRegion(region); sheet.addMergedRegion(region);
return rowNumber + 1; return rowNumber + 1;
} }
List<CurveEchartVo> curves = JSONObject.parseObject(data,new TypeReference<List<CurveEchartVo>>(){}); List<CurveEchartVo> curves = JSONObject.parseObject(data, new TypeReference<List<CurveEchartVo>>() {
});
if (CollectionUtil.isEmpty(curves)) { if (CollectionUtil.isEmpty(curves)) {
// 绘制空表格 // 绘制空表格
this.emptyRow(hssWB, sheet, rowNumber); this.emptyRow(hssWB, sheet, rowNumber);
@ -941,6 +1004,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 绘制曲线 * 绘制曲线
*
* @param loadCurve * @param loadCurve
* @param rowNumber * @param rowNumber
*/ */
@ -1000,6 +1064,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 曲线转数组对象 * 曲线转数组对象
*
* @param curves * @param curves
* @return * @return
*/ */
@ -1024,6 +1089,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 运行数据分析填充 * 运行数据分析填充
*
* @param hssWB * @param hssWB
* @param sheet * @param sheet
* @param rowNumber * @param rowNumber
@ -1053,6 +1119,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 运行建议及其他填充 * 运行建议及其他填充
*
* @param hssWB * @param hssWB
* @param sheet * @param sheet
* @param rowNumber * @param rowNumber
@ -1081,6 +1148,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 设置头部 * 设置头部
*
* @param hssWB * @param hssWB
* @param sheet * @param sheet
*/ */
@ -1098,6 +1166,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 设置标题表头 * 设置标题表头
*
* @param hssWB * @param hssWB
* @param sheet * @param sheet
*/ */
@ -1114,6 +1183,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 运行数据表头绘制 * 运行数据表头绘制
*
* @param hssWB * @param hssWB
* @param sheet * @param sheet
*/ */
@ -1142,6 +1212,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 运行数据填充 * 运行数据填充
*
* @param hssWB * @param hssWB
* @param sheet * @param sheet
* @param rowNumber * @param rowNumber
@ -1156,7 +1227,8 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
sheet.addMergedRegion(region); sheet.addMergedRegion(region);
return rowNumber + 1; return rowNumber + 1;
} }
List<RunDataVo> runData = JSONObject.parseObject(data,new TypeReference<List<RunDataVo>>(){}); List<RunDataVo> runData = JSONObject.parseObject(data, new TypeReference<List<RunDataVo>>() {
});
if (CollectionUtil.isEmpty(runData)) { if (CollectionUtil.isEmpty(runData)) {
// 绘制空表格 // 绘制空表格
this.emptyRow(hssWB, sheet, rowNumber); this.emptyRow(hssWB, sheet, rowNumber);
@ -1227,6 +1299,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 绘制空表格 * 绘制空表格
*
* @param hssWB * @param hssWB
* @param sheet * @param sheet
* @param rowNumber * @param rowNumber
@ -1257,6 +1330,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 告警数据表头绘制 * 告警数据表头绘制
*
* @param hssWB * @param hssWB
* @param sheet * @param sheet
*/ */
@ -1285,6 +1359,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
/** /**
* 告警数据填充 * 告警数据填充
*
* @param hssWB * @param hssWB
* @param sheet * @param sheet
* @param rowNumber * @param rowNumber
@ -1299,7 +1374,8 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
sheet.addMergedRegion(region); sheet.addMergedRegion(region);
return rowNumber + 1; return rowNumber + 1;
} }
List<RunAlarmVo> runAlarm = JSONObject.parseObject(data,new TypeReference<List<RunAlarmVo>>(){}); List<RunAlarmVo> runAlarm = JSONObject.parseObject(data, new TypeReference<List<RunAlarmVo>>() {
});
if (CollectionUtil.isEmpty(runAlarm)) { if (CollectionUtil.isEmpty(runAlarm)) {
// 绘制空表格 // 绘制空表格
this.emptyRow(hssWB, sheet, rowNumber); this.emptyRow(hssWB, sheet, rowNumber);

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/RunMonthEvaluateVO.java

@ -0,0 +1,15 @@
package com.hnac.hzims.operational.report.vo;
import lombok.Data;
/**
* @Author: ypj
* @Date: 2024/9/6 14:50
*/
@Data
public class RunMonthEvaluateVO {
private String content;
private Long id;
private String evaluation;
private String type;
}

4
hzims-service/operational/src/main/resources/db/3.0.3.sql

@ -0,0 +1,4 @@
--
ALTER TABLE `hzims_run_month_report`
ADD COLUMN `CONCLUSION` text NULL COMMENT '重新判定的结论' ;
ALTER TABLE `hzims_run_month_report` ADD COLUMN `EVALUATION` text NULL COMMENT '评价';
Loading…
Cancel
Save