Browse Source

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

zhongwei
yang_shj 5 months ago
parent
commit
5c3d5c5627
  1. 5
      hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/constants/MqttTopicConstants.java
  2. 38
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/controller/WeaviateController.java
  3. 33
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/dto/WeaviateSaveDTO.java
  4. 48
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/service/WeaviateService.java
  5. 3
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java
  6. 32
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ControlAnswerResolveServiceImpl.java
  7. 5
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java
  8. 16
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java
  9. 3
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/VectorParamEntity.java
  10. 5
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/VectorParamService.java
  11. 22
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java
  12. 57
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java
  13. 11
      hzims-service/hzims-big-model/src/main/resources/template/template.yml
  14. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/XxlJobConfig.java
  15. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ObjectUserMapper.java
  16. 4
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.java
  17. 4
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/TemplateProjectMapper.java
  18. 4
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectMapper.java
  19. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectProjectContentMapper.java
  20. 3
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectProjectMapper.java
  21. 4
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskUserMapper.java
  22. 4
      hzims-service/inspect/src/main/resources/template/template.yml
  23. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/config/XxlJobConfig.java
  24. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafetyToolServiceImpl.java
  25. 2
      hzims-service/weather/src/main/java/com/hnac/hzims/weather/config/XxlJobConfig.java
  26. 4
      hzims-service/weather/src/main/resources/template/template.yml

5
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/constants/MqttTopicConstants.java

@ -21,5 +21,10 @@ public interface MqttTopicConstants {
*/ */
String RUN_REPORT_ANALYSE_RESULT = "topic_run_report_analyse_result"; String RUN_REPORT_ANALYSE_RESULT = "topic_run_report_analyse_result";
/**
* 识别结果
*/
String IDENTITY_RESULT = "topic_hznlm_identify_result";
} }

38
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/controller/WeaviateController.java

@ -0,0 +1,38 @@
package com.hnac.hzims.bigmodel.database.controller;
import com.hnac.hzims.bigmodel.database.dto.WeaviateSaveDTO;
import com.hnac.hzims.bigmodel.database.service.WeaviateService;
import io.weaviate.client.v1.data.model.WeaviateObject;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Author: huangxing
* @Date: 2024/09/04 14:16
*/
@RestController
@AllArgsConstructor
@RequestMapping("/weaviate")
public class WeaviateController {
private final WeaviateService weaviateService;
@PostMapping("/saveBatch")
public R<Boolean> saveBatch(@RequestBody WeaviateSaveDTO req) {
weaviateService.saveBatch(req.getEntities(), req.getClassName(), req.getAttrsMap());
return R.success("操作成功!");
}
@GetMapping("/list")
public R<List<WeaviateObject>> list(@RequestParam(value = "id",required = false) String id, @RequestParam("className") String className) {
return R.data(weaviateService.list(id,className));
}
@DeleteMapping("/removeById")
public R<Boolean> removeById(@RequestParam(value = "id",required = false) String id, @RequestParam("className") String className) {
return R.status(weaviateService.delete(id,className));
}
}

33
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/dto/WeaviateSaveDTO.java

@ -0,0 +1,33 @@
package com.hnac.hzims.bigmodel.database.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* @Author: huangxing
* @Date: 2024/09/04 14:36
*/
@Data
@EqualsAndHashCode
public class WeaviateSaveDTO implements Serializable {
/**
* 向量数据库表名
*/
private String className;
/**
* 向量数据库属性名
*/
private Map<String,String> attrsMap;
/**
* 向量数据库存入对象列表
*/
private List entities;
}

48
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/service/WeaviateService.java

@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.bigmodel.configuration.BigModelInvokeApi; import com.hnac.hzims.bigmodel.configuration.BigModelInvokeApi;
import com.hnac.hzinfo.exception.HzServiceException; import com.hnac.hzinfo.exception.HzServiceException;
import io.weaviate.client.WeaviateClient;
import io.weaviate.client.base.Result; import io.weaviate.client.base.Result;
import io.weaviate.client.v1.data.api.ObjectCreator; import io.weaviate.client.v1.data.api.ObjectCreator;
import io.weaviate.client.v1.data.api.ObjectDeleter; import io.weaviate.client.v1.data.api.ObjectDeleter;
@ -38,10 +39,7 @@ import java.util.stream.IntStream;
@Slf4j @Slf4j
public class WeaviateService { public class WeaviateService {
private final ObjectCreator objectCreator; private final WeaviateClient weaviateClient;
private final ObjectUpdater objectUpdater;
private final ObjectDeleter objectDeleter;
private final ObjectsGetter objectsGetter;
private final BigModelInvokeApi invokeApi; private final BigModelInvokeApi invokeApi;
@Value("${gglm.vectorUrl}") @Value("${gglm.vectorUrl}")
@ -55,7 +53,7 @@ public class WeaviateService {
* @return 保存操作结果 * @return 保存操作结果
*/ */
public Boolean save(Object entity, String className, List<String> attrs) { public Boolean save(Object entity, String className, List<String> attrs) {
ObjectCreator creator = objectCreator.withClassName(className); ObjectCreator creator = weaviateClient.data().creator().withClassName(className);
if(Func.isNotEmpty(attrs)) { if(Func.isNotEmpty(attrs)) {
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(entity)); JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(entity));
List<String> vectors = attrs.stream().map(attr -> jsonObject.getString(attr)).collect(Collectors.toList()); List<String> vectors = attrs.stream().map(attr -> jsonObject.getString(attr)).collect(Collectors.toList());
@ -74,7 +72,7 @@ public class WeaviateService {
* @return 保存操作结果 * @return 保存操作结果
*/ */
public Boolean saveBatch(List entities,String className, Map<String,String> attrsMap) { public Boolean saveBatch(List entities,String className, Map<String,String> attrsMap) {
ObjectCreator creator = objectCreator.withClassName(className); ObjectCreator creator = weaviateClient.data().creator().withClassName(className);
List<String> vectorStrs = Lists.newArrayList(); List<String> vectorStrs = Lists.newArrayList();
List<String> attrs = Lists.newArrayList(); List<String> attrs = Lists.newArrayList();
if(Func.isNotEmpty(attrsMap)) { if(Func.isNotEmpty(attrsMap)) {
@ -91,7 +89,12 @@ public class WeaviateService {
Float[] vectors = this.compute(vectorStrs); Float[] vectors = this.compute(vectorStrs);
List<Map<String, Float[]>> vector = this.splitVector(entities.size(), attrsMap, vectors); List<Map<String, Float[]>> vector = this.splitVector(entities.size(), attrsMap, vectors);
for(int i = 0; i < entities.size(); i++) { for(int i = 0; i < entities.size(); i++) {
creator.withProperties(BeanUtil.toMap(entities.get(i))).withVectors(vector.get(i)).run(); // log.info("vector:{}",JSON.toJSONString(vector.get(i)));
JSONObject object = JSONObject.parseObject(JSON.toJSONString(entities.get(i)));
Map<String,Object> properties = new HashMap<>();
object.forEach((k,v) -> properties.put(k,v));
log.info("properties:{}",JSON.toJSONString(properties));
creator.withProperties(properties).withVectors(vector.get(i)).run();
} }
} else { } else {
entities.forEach(entity -> creator.withProperties(BeanUtil.toMap(entity)).run()); entities.forEach(entity -> creator.withProperties(BeanUtil.toMap(entity)).run());
@ -105,18 +108,15 @@ public class WeaviateService {
* @param className 表名 * @param className 表名
* @return 删除结果 * @return 删除结果
*/ */
public Boolean deleteByClassName(String className) { public Boolean delete(String id,String className) {
Result<Boolean> result = objectDeleter.withClassName(className).run(); ObjectDeleter deleter = weaviateClient.data().deleter();
return !result.hasErrors(); if(Func.isNotEmpty(id)) {
} deleter.withID(id);
}
/** if(Func.isNotEmpty(className)) {
* 删除向量数据库ID deleter.withClassName(className);
* @param id 向量数据库ID }
* @return 删除结果 Result<Boolean> result = deleter.run();
*/
public Boolean deleteById(String id) {
Result<Boolean> result = objectDeleter.withID(id).run();
return !result.hasErrors(); return !result.hasErrors();
} }
@ -126,7 +126,7 @@ public class WeaviateService {
* @return 更新结果 * @return 更新结果
*/ */
public Boolean updateById(String id, Object entity, String className, Map<String,String> attrMap) { public Boolean updateById(String id, Object entity, String className, Map<String,String> attrMap) {
ObjectUpdater updater = objectUpdater.withClassName(className).withID(id).withProperties(BeanUtil.toMap(entity)); ObjectUpdater updater = weaviateClient.data().updater().withClassName(className).withID(id).withProperties(BeanUtil.toMap(entity));
// 计算向量 // 计算向量
Map<String, Float[]> vector = new HashMap<>(); Map<String, Float[]> vector = new HashMap<>();
if(Func.isNotEmpty(attrMap)) { if(Func.isNotEmpty(attrMap)) {
@ -143,7 +143,8 @@ public class WeaviateService {
return !result.hasErrors(); return !result.hasErrors();
} }
public List<Map> list(String id,String className) { public List<WeaviateObject> list(String id,String className) {
ObjectsGetter objectsGetter = weaviateClient.data().objectsGetter();
if(Func.isNotEmpty(id)) { if(Func.isNotEmpty(id)) {
objectsGetter.withID(id); objectsGetter.withID(id);
} }
@ -154,7 +155,7 @@ public class WeaviateService {
if(result.hasErrors()) { if(result.hasErrors()) {
throw new HzServiceException("查询失败!"); throw new HzServiceException("查询失败!");
} }
return result.getResult().stream().map(WeaviateObject::getProperties).collect(Collectors.toList()); return result.getResult();
} }
/** /**
@ -176,10 +177,11 @@ public class WeaviateService {
List<Integer> splitIndex = this.getSplitIndex(vectors.size(), attrsMap.size()); List<Integer> splitIndex = this.getSplitIndex(vectors.size(), attrsMap.size());
AtomicInteger i = new AtomicInteger(); AtomicInteger i = new AtomicInteger();
attrsMap.forEach((k,v) -> { attrsMap.forEach((k,v) -> {
List<Float> vector = vectors.subList(splitIndex.get(i.get()), splitIndex.get(i.get() + (vectors.size() / attrsMap.size()))); List<Float> vector = vectors.subList(splitIndex.get(i.get()), splitIndex.get(i.get()) + (vectors.size() / attrsMap.size()));
vectorMap.put(k, vector.toArray(new Float[vector.size()])); vectorMap.put(k, vector.toArray(new Float[vector.size()]));
i.getAndIncrement(); i.getAndIncrement();
}); });
result.add(vectorMap);
}); });
return result; return result;
} }

3
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java

@ -21,6 +21,7 @@ public class AnswerResolveFactory {
public static final String REMOTE_ANSWER_SERVICE = "remoteAnswerResolveService"; public static final String REMOTE_ANSWER_SERVICE = "remoteAnswerResolveService";
public static final String PARAM_ANSWER_SERVICE = "paramAnswerResolveService"; public static final String PARAM_ANSWER_SERVICE = "paramAnswerResolveService";
public static final String PRE_ANSWER_SERVICE = "preAnswerResolveService"; public static final String PRE_ANSWER_SERVICE = "preAnswerResolveService";
public static final String CONTROL_DEVICE_SERVICE = "controlAnswerResolveService";
public static IAnswerResolveService getResolveService(Object extra) { public static IAnswerResolveService getResolveService(Object extra) {
String funcCode = JSONObject.parseObject(JSON.toJSONString(extra)).getString("func"); String funcCode = JSONObject.parseObject(JSON.toJSONString(extra)).getString("func");
@ -44,6 +45,8 @@ public class AnswerResolveFactory {
return SpringUtil.getBean(REMOTE_ANSWER_SERVICE); return SpringUtil.getBean(REMOTE_ANSWER_SERVICE);
case SHOW_PARAM: case SHOW_PARAM:
return SpringUtil.getBean(PARAM_ANSWER_SERVICE); return SpringUtil.getBean(PARAM_ANSWER_SERVICE);
case CONTROL_DEVICE:
return SpringUtil.getBean(CONTROL_DEVICE_SERVICE);
default: default:
return null; return null;
} }

32
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ControlAnswerResolveServiceImpl.java

@ -0,0 +1,32 @@
package com.hnac.hzims.bigmodel.interactive.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.bigmodel.interactive.factory.AnswerResolveFactory;
import com.hnac.hzims.bigmodel.interactive.service.IAnswerResolveService;
import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO;
import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Author: huangxing
* @Date: 2024/08/30 11:33
*/
@Service(AnswerResolveFactory.CONTROL_DEVICE_SERVICE)
@Slf4j
public class ControlAnswerResolveServiceImpl implements IAnswerResolveService {
@Override
public AnswerVO resolve(AnswerVO answer) {
Object[] extraArray = this.extraStream(answer).map(this::getExtra).toArray();
answer.setExtras(extraArray);
return answer;
}
@Override
public ExtraVO getExtra(JSONObject originExtra) {
log.info("控制指令传参为:{}", JSON.toJSONString(originExtra));
return null;
}
}

5
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java

@ -65,8 +65,7 @@ public class AnswerVO implements Serializable {
return new AnswerVO(sessionId,userId,0,-2,null,query, InfoMessageConstant.ERROR_MESSAGE, null,null,new String[]{InfoMessageConstant.ERROR_MESSAGE}); return new AnswerVO(sessionId,userId,0,-2,null,query, InfoMessageConstant.ERROR_MESSAGE, null,null,new String[]{InfoMessageConstant.ERROR_MESSAGE});
} }
public static void error(AnswerVO usualVO) { public static AnswerVO progress(String sessionId,String userId,String query,String message,Integer status) {
usualVO.setRunning(0); return new AnswerVO(sessionId,userId,1,status,null,query, message, null,null,new String[]{message});
usualVO.setStatus(-2);
} }
} }

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

@ -17,6 +17,7 @@ import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -76,8 +77,10 @@ public class VectorParamController {
@GetMapping("/getUrlResponse") @GetMapping("/getUrlResponse")
@ApiOperation(value = "通过url获取向量参数数据") @ApiOperation(value = "通过url获取向量参数数据")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
public R getUrlResponse(@RequestParam String url, @RequestHeader("Blade-Auth") String token) { public R getUrlResponse(@RequestParam String url,
return R.data(vectorParamService.getUrlResponse(url, token)); @RequestHeader(name = "Blade-Auth", value = "Blade-Auth", required = false) String bladeToken,
@RequestHeader(name = "Hzinfo-Auth", value = "Hzinfo-Auth", required = false) String hzinfoToken) {
return R.data(vectorParamService.getUrlResponse(url, bladeToken, hzinfoToken));
} }
@GetMapping("/getTestData") @GetMapping("/getTestData")
@ -91,4 +94,13 @@ public class VectorParamController {
data.put("data", "data"); data.put("data", "data");
return R.data(data); return R.data(data);
} }
@GetMapping("/getUrlResponseKeyList")
@ApiOperation(value = "获取url返回的key列表")
@ApiOperationSupport(order = 9)
public R<List<String>> getUrlResponseKeyList(@RequestParam String url,
@RequestHeader(name = "Blade-Auth", value = "Blade-Auth", required = false) String bladeToken,
@RequestHeader(name = "Hzinfo-Auth", value = "Hzinfo-Auth", required = false) String hzinfoToken) {
return R.data(vectorParamService.getUrlResponseKeyList(url, bladeToken, hzinfoToken));
}
} }

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

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; 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 org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable; import java.io.Serializable;
@ -21,6 +23,7 @@ public class VectorParamEntity extends TenantEntity implements Serializable {
@ApiModelProperty("参数名称") @ApiModelProperty("参数名称")
@TableField("NAME") @TableField("NAME")
@QueryField(condition = SqlCondition.LIKE)
private String name; private String name;
@ApiModelProperty("url") @ApiModelProperty("url")

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

@ -3,6 +3,7 @@ package com.hnac.hzims.bigmodel.maintenance.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.bigmodel.maintenance.entity.VectorParamEntity; import com.hnac.hzims.bigmodel.maintenance.entity.VectorParamEntity;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -13,5 +14,7 @@ import java.util.Map;
public interface VectorParamService extends IService<VectorParamEntity> { public interface VectorParamService extends IService<VectorParamEntity> {
String getAuthorization(); String getAuthorization();
Map getUrlResponse(String url, String token); Map getUrlResponse(String url, String bladeToken ,String hzinfoToken);
List<String> getUrlResponseKeyList(String url, String bladeToken, String hzinfoToken);
} }

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

@ -6,12 +6,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.bigmodel.maintenance.entity.VectorParamEntity; import com.hnac.hzims.bigmodel.maintenance.entity.VectorParamEntity;
import com.hnac.hzims.bigmodel.maintenance.mapper.VectorParamMapper; import com.hnac.hzims.bigmodel.maintenance.mapper.VectorParamMapper;
import com.hnac.hzims.bigmodel.maintenance.service.VectorParamService; import com.hnac.hzims.bigmodel.maintenance.service.VectorParamService;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.jackson.JsonUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Base64; import java.util.Base64;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -19,6 +22,7 @@ import java.util.Map;
* @Date: 2024/9/2 16:14 * @Date: 2024/9/2 16:14
*/ */
@Service @Service
@Slf4j
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";
@ -29,13 +33,27 @@ public class VectorParamServiceImpl extends ServiceImpl<VectorParamMapper, Vecto
} }
@Override @Override
public Map getUrlResponse(String url, String token) { public Map getUrlResponse(String url, String bladeToken, String hzinfoToken) {
HttpResponse response = HttpRequest.get(url) HttpResponse response = HttpRequest.get(url)
.header("Authorization", getAuthorization()) .header("Authorization", getAuthorization())
.header("Blade-Auth", token).execute(); .header("Blade-Auth", bladeToken)
.header("Hzinfo-Auth", hzinfoToken).execute();
if (response.getStatus() == HttpServletResponse.SC_OK) { if (response.getStatus() == HttpServletResponse.SC_OK) {
return JsonUtil.toMap(response.body()); return JsonUtil.toMap(response.body());
} }
return null; return null;
} }
@Override
public List<String> getUrlResponseKeyList(String url, String bladeToken, String hzinfoToken) {
List<String> result = new ArrayList<>();
Map map = getUrlResponse(url, bladeToken, hzinfoToken);
Map<String, Object> data = ((Map<String, Object>) map.get("data"));
if (data != null) {
result.addAll(data.keySet());
} else {
result.addAll(map.keySet());
}
return result;
}
} }

57
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java

@ -50,34 +50,35 @@ public class FrontEndInteractiveSchedule {
return ReturnT.SUCCESS; return ReturnT.SUCCESS;
} }
List<AnswerVO> answerList = hznlmInvokeService.getAnswerBySessionIds(String.join(",", sessionIds)); List<AnswerVO> answerList = hznlmInvokeService.getAnswerBySessionIds(String.join(",", sessionIds));
answerList.stream().parallel().forEach(answerVO -> CompletableFuture.runAsync(() -> { answerList.stream().parallel().forEach(answerVO -> CompletableFuture.runAsync(() -> this.formatAnswer(answerVO), getAnswerPoolExecutor));
// 如果已经获取到答案 则删除缓存
if(answerVO.getRunning() == 0) {
log.info("获取大模型解析答案:{}" , JSON.toJSONString(answerVO));
sessionRedisManager.removeSessionId(answerVO.getChatId());
}
Object[] extras = answerVO.getExtras();
if(ObjectUtil.isNotEmpty(answerVO.getExtras()) && extras.length > 0){
try {
// 解析答案
Object[] resolveExtras = Arrays.stream(extras).map(extra -> {
IAnswerResolveService answerResolveService = AnswerResolveFactory.getResolveService(extra);
if(Func.isNotEmpty(answerResolveService)) {
JSONObject extraObject = JSONObject.parseObject(JSON.toJSONString(extra));
return answerResolveService.getExtra(extraObject);
}
return extra;
}).map(JSON::toJSONString).toArray();
answerVO.setExtras(resolveExtras);
}
catch(Exception e) {
log.error("An error occurred",e);
AnswerVO.error(answerVO.getChatId(), answerVO.getUserId(), answerVO.getQuery());
}
}
TextMessage message = InteractiveSessionManager.getTextMessage("1",JSON.toJSONString(answerVO));
wsService.sendMessage(answerVO.getChatId(),message);
}, getAnswerPoolExecutor));
return ReturnT.SUCCESS; return ReturnT.SUCCESS;
} }
private void formatAnswer(AnswerVO answerVO) {
// 如果已经获取到答案 则删除缓存
if(answerVO.getRunning() == 0) {
log.info("获取大模型解析答案:{}", JSON.toJSONString(answerVO));
sessionRedisManager.removeSessionId(answerVO.getChatId());
}
Object[] extras = answerVO.getExtras();
// 格式化 extra
if(Func.isNotEmpty(extras)) {
try {
Object[] resolveExtras = Arrays.stream(extras).map(extra -> {
IAnswerResolveService answerResolveService = AnswerResolveFactory.getResolveService(extra);
if (Func.isNotEmpty(answerResolveService)) {
JSONObject extraObject = JSONObject.parseObject(JSON.toJSONString(extra));
return answerResolveService.getExtra(extraObject);
}
return extra;
}).map(JSON::toJSONString).toArray();
answerVO.setExtras(resolveExtras);
} catch(Exception e) {
log.error("An error occurred",e);
AnswerVO.error(answerVO.getChatId(), answerVO.getUserId(), answerVO.getQuery());
}
}
TextMessage message = InteractiveSessionManager.getTextMessage("1",JSON.toJSONString(answerVO));
wsService.sendMessage(answerVO.getChatId(),message);
}
} }

11
hzims-service/hzims-big-model/src/main/resources/template/template.yml

@ -63,7 +63,7 @@ gglm:
smartReportGeneratePower: "/custom/smart_report_generate_power" smartReportGeneratePower: "/custom/smart_report_generate_power"
assistantAnalyseAsk: "/qa/assistant_analyse_ask" assistantAnalyseAsk: "/qa/assistant_analyse_ask"
updateKnowledge: "/kn/update_knowledge" updateKnowledge: "/kn/update_knowledge"
compute: "compute" compute: "/compute"
swagger: swagger:
base-packages: com.hnac.hzims.bigmodel base-packages: com.hnac.hzims.bigmodel
@ -84,4 +84,11 @@ xxl:
bigmodel: bigmodel:
zhipuai: zhipuai:
url: https://open.bigmodel.cn/api/paas/v4/chat/completions url: https://open.bigmodel.cn/api/paas/v4/chat/completions
apiSecret: dfd23052747674818c7ac6f9922beff1.n2o5JEdfnrLbFU53 apiSecret: dfd23052747674818c7ac6f9922beff1.n2o5JEdfnrLbFU53
weaviate:
datasource:
schema: http
host: 192.168.60.16
port: 9992
apiKey: 123

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/XxlJobConfig.java

@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration;
* *
* @author xuxueli 2017-04-28 * @author xuxueli 2017-04-28
*/ */
@Configuration //@Configuration
@Slf4j @Slf4j
public class XxlJobConfig { public class XxlJobConfig {

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ObjectUserMapper.java

@ -1,5 +1,6 @@
package com.hnac.hzinfo.inspect.obj.mapper; package com.hnac.hzinfo.inspect.obj.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import org.springblade.core.datascope.annotation.UserDataAuth; import org.springblade.core.datascope.annotation.UserDataAuth;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity; import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity;
@ -16,5 +17,6 @@ import java.util.List;
public interface ObjectUserMapper extends BaseMapper<ObjectUserEntity>{ public interface ObjectUserMapper extends BaseMapper<ObjectUserEntity>{
@UserDataAuth @UserDataAuth
@InterceptorIgnore(tenantLine = "true")
List<ObjectUserListQuery> getPageList(@Param("user") ObjectUserListQuery user); List<ObjectUserListQuery> getPageList(@Param("user") ObjectUserListQuery user);
} }

4
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.java

@ -1,5 +1,6 @@
package com.hnac.hzinfo.inspect.obj.mapper; package com.hnac.hzinfo.inspect.obj.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; import com.hnac.hzinfo.inspect.obj.entity.ContentEntity;
import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity; import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity;
@ -18,6 +19,7 @@ public interface ProjectContentMapper extends BaseMapper<ProjectContentEntity>{
* @param projectId 项目id * @param projectId 项目id
* @return * @return
*/ */
@InterceptorIgnore(tenantLine = "true")
List<ProjectContentEntity> getListByProjectId(Long projectId); List<ProjectContentEntity> getListByProjectId(Long projectId);
/** /**
@ -26,6 +28,7 @@ public interface ProjectContentMapper extends BaseMapper<ProjectContentEntity>{
* @param projectId 项目id * @param projectId 项目id
* @return * @return
*/ */
@InterceptorIgnore(tenantLine = "true")
List<ContentEntity> getListByPrjId(Long projectId); List<ContentEntity> getListByPrjId(Long projectId);
@ -35,5 +38,6 @@ public interface ProjectContentMapper extends BaseMapper<ProjectContentEntity>{
* @param projectId * @param projectId
* @return * @return
*/ */
@InterceptorIgnore(tenantLine = "true")
Integer getMaxSortProjectContentByProjectId(Long projectId); Integer getMaxSortProjectContentByProjectId(Long projectId);
} }

4
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/TemplateProjectMapper.java

@ -1,5 +1,6 @@
package com.hnac.hzinfo.inspect.obj.mapper; package com.hnac.hzinfo.inspect.obj.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzinfo.inspect.obj.entity.TemplateProjectEntity; import com.hnac.hzinfo.inspect.obj.entity.TemplateProjectEntity;
import com.hnac.hzinfo.inspect.obj.vo.ProjectContentDto; import com.hnac.hzinfo.inspect.obj.vo.ProjectContentDto;
@ -17,6 +18,7 @@ public interface TemplateProjectMapper extends BaseMapper<TemplateProjectEntity>
* 根据模板id获取项目 * 根据模板id获取项目
* @param templateId * @param templateId
*/ */
@InterceptorIgnore(tenantLine = "true")
List<TemplateProjectEntity> getListByTemplateId(Long templateId); List<TemplateProjectEntity> getListByTemplateId(Long templateId);
/** /**
@ -24,6 +26,7 @@ public interface TemplateProjectMapper extends BaseMapper<TemplateProjectEntity>
* 根据模板id获取项目内容 * 根据模板id获取项目内容
* @param templateId * @param templateId
*/ */
@InterceptorIgnore(tenantLine = "true")
List<ProjectContentDto> getProjectsByTemplateId(Long templateId); List<ProjectContentDto> getProjectsByTemplateId(Long templateId);
/** /**
@ -31,5 +34,6 @@ public interface TemplateProjectMapper extends BaseMapper<TemplateProjectEntity>
* @param templateId * @param templateId
* @return * @return
*/ */
@InterceptorIgnore(tenantLine = "true")
Integer getMaxSortTemplateProjectByTemplateId(Long templateId); Integer getMaxSortTemplateProjectByTemplateId(Long templateId);
} }

4
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectMapper.java

@ -1,5 +1,6 @@
package com.hnac.hzinfo.inspect.task.mapper; package com.hnac.hzinfo.inspect.task.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity; import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity;
import com.hnac.hzinfo.inspect.task.vo.TaskObjectOfflineVO; import com.hnac.hzinfo.inspect.task.vo.TaskObjectOfflineVO;
@ -17,9 +18,12 @@ import java.util.List;
@Mapper @Mapper
public interface TaskObjectMapper extends BaseMapper<TaskObjectEntity> { public interface TaskObjectMapper extends BaseMapper<TaskObjectEntity> {
@InterceptorIgnore(tenantLine = "true")
List<TaskObjectEntity> getTaskObjects(@Param("to") TaskObjectEntity to); List<TaskObjectEntity> getTaskObjects(@Param("to") TaskObjectEntity to);
@InterceptorIgnore(tenantLine = "true")
List<TaskObjectVO> getTaskObjectsDetail(@Param("to") TaskObjectEntity to); List<TaskObjectVO> getTaskObjectsDetail(@Param("to") TaskObjectEntity to);
@InterceptorIgnore(tenantLine = "true")
List<TaskObjectOfflineVO> getExObjectData(@Param("taskIds") List<Long> taskIds); List<TaskObjectOfflineVO> getExObjectData(@Param("taskIds") List<Long> taskIds);
} }

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectProjectContentMapper.java

@ -1,5 +1,6 @@
package com.hnac.hzinfo.inspect.task.mapper; package com.hnac.hzinfo.inspect.task.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectContentEntity; import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectContentEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -15,5 +16,6 @@ import java.util.List;
@Mapper @Mapper
public interface TaskObjectProjectContentMapper extends BaseMapper<TaskObjectProjectContentEntity> { public interface TaskObjectProjectContentMapper extends BaseMapper<TaskObjectProjectContentEntity> {
@InterceptorIgnore(tenantLine = "true")
List<TaskObjectProjectContentEntity> getTaskObjectProjectContents(@Param("topc")TaskObjectProjectContentEntity topc); List<TaskObjectProjectContentEntity> getTaskObjectProjectContents(@Param("topc")TaskObjectProjectContentEntity topc);
} }

3
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectProjectMapper.java

@ -1,5 +1,6 @@
package com.hnac.hzinfo.inspect.task.mapper; package com.hnac.hzinfo.inspect.task.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectEntity; import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectEntity;
import com.hnac.hzinfo.inspect.task.vo.TaskObjectProjectOfflineVO; import com.hnac.hzinfo.inspect.task.vo.TaskObjectProjectOfflineVO;
@ -16,7 +17,9 @@ import java.util.List;
@Mapper @Mapper
public interface TaskObjectProjectMapper extends BaseMapper<TaskObjectProjectEntity> { public interface TaskObjectProjectMapper extends BaseMapper<TaskObjectProjectEntity> {
@InterceptorIgnore(tenantLine = "true")
List<TaskObjectProjectEntity> getTaskObjectProjects(@Param("top")TaskObjectProjectEntity top); List<TaskObjectProjectEntity> getTaskObjectProjects(@Param("top")TaskObjectProjectEntity top);
@InterceptorIgnore(tenantLine = "true")
List<TaskObjectProjectOfflineVO> getObjectProjectData(@Param("taskIds") List<Long> taskIds); List<TaskObjectProjectOfflineVO> getObjectProjectData(@Param("taskIds") List<Long> taskIds);
} }

4
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskUserMapper.java

@ -1,5 +1,6 @@
package com.hnac.hzinfo.inspect.task.mapper; package com.hnac.hzinfo.inspect.task.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity; import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -19,9 +20,12 @@ public interface TaskUserMapper extends BaseMapper<TaskUserEntity> {
* @param planId 计划id * @param planId 计划id
* @return * @return
*/ */
@InterceptorIgnore(tenantLine = "true")
int deleteByPlanId(@Param("planId") Long planId); int deleteByPlanId(@Param("planId") Long planId);
@InterceptorIgnore(tenantLine = "true")
int updateDeleteStatus(@Param("taskId") Long taskId); int updateDeleteStatus(@Param("taskId") Long taskId);
@InterceptorIgnore(tenantLine = "true")
List<TaskUserEntity> getOfflineTaskUser(@Param("taskIds") List<Long> taskIds); List<TaskUserEntity> getOfflineTaskUser(@Param("taskIds") List<Long> taskIds);
} }

4
hzims-service/inspect/src/main/resources/template/template.yml

@ -36,8 +36,8 @@ swagger:
xxl: xxl:
job: job:
auto: auto:
registry: 0 registry: 1
accessToken: '' accessToken: 'hzinfo88238888!'
admin: admin:
addresses: http://${hzims.xxljob.ip}:${hzims.xxljob.port}/xxl-job-admin addresses: http://${hzims.xxljob.ip}:${hzims.xxljob.port}/xxl-job-admin
executor: executor:

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/config/XxlJobConfig.java

@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration;
* *
* @author xuxueli 2017-04-28 * @author xuxueli 2017-04-28
*/ */
@Configuration //@Configuration
@Slf4j @Slf4j
public class XxlJobConfig { public class XxlJobConfig {

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafetyToolServiceImpl.java

@ -237,7 +237,7 @@ public class SafetyToolServiceImpl extends ServiceImpl<SafetyToolMapper, SafetyT
if (CollectionUtil.isNotEmpty(entityList)) { if (CollectionUtil.isNotEmpty(entityList)) {
List<SafeProductPdf> pdfList = new ArrayList<>(entityList.size()); List<SafeProductPdf> pdfList = new ArrayList<>(entityList.size());
entityList.forEach(entity -> { entityList.forEach(entity -> {
String imgPath = uploadPath + "/" + entity.getTenantId() + entity.getToolCode() + UPLOAD_IMG_SUFFIX; String imgPath = uploadPath + "/" + entity.getTenantId() + entity.getToolCode().trim() + UPLOAD_IMG_SUFFIX;
File file = new File(imgPath); File file = new File(imgPath);
if (!file.exists()) { if (!file.exists()) {
/**生成二维码**/ /**生成二维码**/

2
hzims-service/weather/src/main/java/com/hnac/hzims/weather/config/XxlJobConfig.java

@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration;
* *
* @author xuxueli 2017-04-28 * @author xuxueli 2017-04-28
*/ */
@Configuration //@Configuration
@Slf4j @Slf4j
public class XxlJobConfig { public class XxlJobConfig {

4
hzims-service/weather/src/main/resources/template/template.yml

@ -30,8 +30,8 @@ mybatis-plus:
xxl: xxl:
job: job:
auto: auto:
registry: 0 registry: 1
accessToken: '' accessToken: 'hzinfo88238888!'
admin: admin:
addresses: "http://${hzims.xxljob.ip}:${hzims.xxljob.port}/xxl-job-admin" addresses: "http://${hzims.xxljob.ip}:${hzims.xxljob.port}/xxl-job-admin"
executor: executor:

Loading…
Cancel
Save