Browse Source

fix: 修复不同func给出的extras格式不同的问题

add: weaviate支持多条件查询
fix: 设备台账概览定时任务手动执行支持传参
zhongwei
haungxing 2 months ago
parent
commit
7d82d4b3d0
  1. 7
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/scheduled/DeviceLedgerScheduledTask.java
  2. 37
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/database/service/WeaviateService.java
  3. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/factory/AnswerResolveFactory.java
  4. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/schedule/FrontEndInteractiveSchedule.java

7
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/scheduled/DeviceLedgerScheduledTask.java

@ -10,6 +10,7 @@ import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.equipment.vo.DeviceLedgerVO;
import com.hnac.hzims.fdp.constants.ScheduledConstant;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
@ -38,7 +39,9 @@ public class DeviceLedgerScheduledTask {
@XxlJob(ScheduledConstant.DEVICE_LEDGER_DATA_GENERATE)
public ReturnT<String> execute(String param) throws Exception {
JSONObject paramJson = JSONObject.parseObject(param);
String jobParam = XxlJobHelper.getJobParam();
XxlJobHelper.log("传参为:" + jobParam);
JSONObject paramJson = JSONObject.parseObject(jobParam);
String emCode = Optional.ofNullable(paramJson).map(json -> json.getString("emCode")).orElse("");
String date = Optional.ofNullable(paramJson).map(json -> json.getString("date")).orElse(LocalDate.now().minusDays(1).format(DateUtil.DATE_FORMATTER));
List<DeviceLedgerVO> deviceLedgerList = emInfoService.getDeviceLedgerList(emCode, date);
@ -46,7 +49,7 @@ public class DeviceLedgerScheduledTask {
WeaviateQueryDTO query = new WeaviateQueryDTO();
Map<String,String> queryMap = new HashMap<>();
if(Func.isNotEmpty(emCode)) {
queryMap.put("emCode",emCode);
queryMap.put("deviceCode",emCode);
}
queryMap.put("date",date);
query.setQuery(queryMap);

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

@ -178,7 +178,7 @@ public class WeaviateService {
if(Func.isEmpty(ids) && Func.isNotEmpty(className)) {
// 删除className
Map<String,String> deleteTableParams = new HashMap<>(1);
deleteTableParams.put("table_name",className);
deleteTableParams.put("table_name",className.replace("Hzn_lm_",""));
RequestClientUtil.postCall(gglmUrl + invokeApi.getDeleteTable(),deleteTableParams);
} else {
// 删除记录
@ -333,32 +333,25 @@ public class WeaviateService {
fields.add(additionalId);
get.withFields(fields.toArray(new Field[fields.size()]));
if(Func.isNotEmpty(query)) {
// waeviate 多个filter查询结果
List<WhereFilter> whereFilters = query.entrySet().stream().map(e -> WhereFilter.builder()
.path(e.getKey())
.operator(Operator.Equal)
.valueString(e.getValue())
.build()).collect(Collectors.toList());
whereFilters.forEach(where -> get.withWhere(where));
WhereFilter combinedFilter = WhereFilter.builder()
.operator(Operator.And)
.operands(whereFilters.toArray(new WhereFilter[whereFilters.size()]))
.build();
get.withWhere(combinedFilter);
}
try {
// 执行查询并返回结果
return get.run().getResult().getData();
} catch (Exception e) {
// 异常处理
System.err.println("Error occurred during query execution: " + e.getMessage());
throw new RuntimeException("Query failed.", e);
}
return get.run().getResult().getData();
}
// public static void main(String[] args) throws AuthException {
// Config config = new Config("http", "192.168.60.16:9992");
// WeaviateClient client = WeaviateAuthClient.apiKey(config, "123");
// Field itemName = Field.builder().name("item_name").build();
// Field itemId = Field.builder().name("item_id").build();
// Field additionalId = Field.builder().name("_additional { id }").build();
// WhereFilter where = WhereFilter.builder()
// .path(new String[]{ "item_name" })
// .operator(Operator.Equal)
// .valueString("湖北宜昌泵站")
// .build();
// Result<GraphQLResponse> result = client.graphQL().get()
// .withClassName("Hzn_lm_form_station")
// .withFields(itemName,itemId,additionalId)
// .withWhere(where)
// .run();
// System.out.println(JSON.toJSONString(result.getResult().getData()));
// }
}

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

@ -51,7 +51,7 @@ public class AnswerResolveFactory {
return null;
}
}
throw new HzServiceException(ResultCode.DEFAULT_NULL_MESSAGE,"service解析失败!");
return null;
}
}

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

@ -70,7 +70,7 @@ public class FrontEndInteractiveSchedule {
answerVO.setExtras(resolveExtras);
} catch(Exception e) {
log.error("An error occurred",e);
AnswerVO.error(answerVO.getChatId(), answerVO.getUserId(), answerVO.getQuery());
answerVO = AnswerVO.error(answerVO.getChatId(), answerVO.getUserId(), answerVO.getQuery());
}
}
TextMessage message = InteractiveSessionManager.getTextMessage("1",JSON.toJSONString(answerVO));

Loading…
Cancel
Save