diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/scheduled/DeviceLedgerScheduledTask.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/scheduled/DeviceLedgerScheduledTask.java index 7b827cb..5410a52 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/scheduled/DeviceLedgerScheduledTask.java +++ b/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 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 deviceLedgerList = emInfoService.getDeviceLedgerList(emCode, date); @@ -46,7 +49,7 @@ public class DeviceLedgerScheduledTask { WeaviateQueryDTO query = new WeaviateQueryDTO(); Map queryMap = new HashMap<>(); if(Func.isNotEmpty(emCode)) { - queryMap.put("emCode",emCode); + queryMap.put("deviceCode",emCode); } queryMap.put("date",date); query.setQuery(queryMap); diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/database/service/WeaviateService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/database/service/WeaviateService.java index 2ba6d18..cecd4a4 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/database/service/WeaviateService.java +++ b/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 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 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 result = client.graphQL().get() -// .withClassName("Hzn_lm_form_station") -// .withFields(itemName,itemId,additionalId) -// .withWhere(where) -// .run(); -// System.out.println(JSON.toJSONString(result.getResult().getData())); -// } } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/factory/AnswerResolveFactory.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/factory/AnswerResolveFactory.java index 4f25f78..4a7f757 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/factory/AnswerResolveFactory.java +++ b/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; } } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/schedule/FrontEndInteractiveSchedule.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/schedule/FrontEndInteractiveSchedule.java index 7747c10..515abba 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/schedule/FrontEndInteractiveSchedule.java +++ b/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));