From fe5855cbab4d56a4c9cf088bfcc23107c888111a Mon Sep 17 00:00:00 2001 From: luyie Date: Fri, 6 Sep 2024 17:49:47 +0800 Subject: [PATCH 1/9] =?UTF-8?q?add:=E5=90=91=E9=87=8F=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E6=9C=88=E6=8A=A5=E8=AF=84=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/report/entity/RunMonthEntity.java | 3 + .../controller/VectorParamController.java | 6 +- .../maintenance/service/VectorParamService.java | 2 +- .../service/impl/VectorParamServiceImpl.java | 149 +++---- .../report/controller/RunMonthController.java | 85 ++-- .../report/service/RunMonthService.java | 2 + .../report/service/impl/RunMonthServiceImpl.java | 482 +++++++++++---------- .../operational/report/vo/RunMonthEvaluateVO.java | 13 + 8 files changed, 394 insertions(+), 348 deletions(-) create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/RunMonthEvaluateVO.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/entity/RunMonthEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/entity/RunMonthEntity.java index 6694a16..d646833 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/entity/RunMonthEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/entity/RunMonthEntity.java @@ -44,4 +44,7 @@ public class RunMonthEntity extends TenantEntity { @ApiModelProperty("分析结果") private String analyseResult; + @ApiModelProperty("评价") + private String evaluation; + } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java index ec681f1..0f72ac5 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java @@ -107,11 +107,11 @@ public class VectorParamController { return R.data(vectorParamService.getUrlResponseKeyList(url, bladeToken, hzinfoToken)); } - @PutMapping("/synchronization") + @PutMapping("/synchronization/{id}") @ApiOperation(value = "同步") @ApiOperationSupport(order = 10) 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 { - return R.status(vectorParamService.synchronization(bladeToken, hzinfoToken)); + @RequestHeader(name = "Hzinfo-Auth", value = "Hzinfo-Auth", required = false) String hzinfoToken, @PathVariable Long id) throws JsonProcessingException { + return R.status(vectorParamService.synchronization(id, bladeToken, hzinfoToken)); } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/VectorParamService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/VectorParamService.java index 20cf06f..bc22e15 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/VectorParamService.java +++ b/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 { List getUrlResponseKeyList(String url, String bladeToken, String hzinfoToken); - Boolean synchronization(String bladeToken, String hzinfoToken); + Boolean synchronization(Long id ,String bladeToken, String hzinfoToken); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java index a350a57..03c19fb 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; @@ -16,7 +17,6 @@ import com.hnac.hzims.bigmodel.maintenance.service.VectorParamService; import com.hnac.hzims.bigmodel.maintenance.vo.VectorUrlResponse; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.utils.CollectionUtil; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletResponse; @@ -49,59 +49,57 @@ public class VectorParamServiceImpl extends ServiceImpl keyList = new ArrayList<>(); -// Iterator iterator = item.fieldNames(); -// while (iterator.hasNext()) { -// keyList.add(iterator.next()); -// } -// result.setKeyList(keyList); -// } -// return result; -// } + private VectorUrlResponse getUrlResponseByArray(JsonNode rootNode) throws JsonProcessingException { + VectorUrlResponse result = new VectorUrlResponse(); + result.setOriginalData(JSONArray.parseArray(rootNode.toPrettyString()).toJavaList(JSONObject.class)); + JsonNode item = rootNode.get(0); + if (item != null) { + List keyList = new ArrayList<>(); + Iterator iterator = item.fieldNames(); + while (iterator.hasNext()) { + keyList.add(iterator.next()); + } + result.setKeyList(keyList); + } + return result; + } -// private VectorUrlResponse getUrlResponseByObject(JsonNode rootNode) throws JsonProcessingException { -// VectorUrlResponse result = new VectorUrlResponse(); -// result.setOriginalData(rootNode); -// List keyList = new ArrayList<>(); -// Iterator iterator = rootNode.fieldNames(); -// while (iterator.hasNext()) { -// keyList.add(iterator.next()); -// } -// result.setKeyList(keyList); -// return result; -// } + private VectorUrlResponse getUrlResponseByObject(JsonNode rootNode) throws JsonProcessingException { + VectorUrlResponse result = new VectorUrlResponse(); + List originalData = new ArrayList<>(); + originalData.add(JSON.parseObject(rootNode.toPrettyString())); + result.setOriginalData(originalData); + List keyList = new ArrayList<>(); + Iterator iterator = rootNode.fieldNames(); + while (iterator.hasNext()) { + keyList.add(iterator.next()); + } + result.setKeyList(keyList); + return result; + } @Override public List getUrlResponseKeyList(String url, String bladeToken, String hzinfoToken) { @@ -110,45 +108,30 @@ public class VectorParamServiceImpl extends ServiceImpl list = this.list(); - if (CollectionUtil.isEmpty(list)) { + public Boolean synchronization(Long id, String bladeToken, String hzinfoToken) { + VectorParamEntity entity = getById(id); + if (null == entity) { return false; } - for (VectorParamEntity entity : list) { - VectorUrlResponse response = getUrlResponse(entity.getUrl(), bladeToken, hzinfoToken); - if (response != null) { - ObjectMapper mapper = new ObjectMapper(); - JsonNode rootNode = null; - try { - rootNode = mapper.readTree(entity.getAttributeMap()); - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - Map attrMap = new HashMap<>(); - Iterator iterator = rootNode.fieldNames(); - while (iterator.hasNext()) { - String key = iterator.next(); - attrMap.put(key, rootNode.findValue(key).textValue()); - } - List dataList = new ArrayList(); - JsonNode dataObject = (JsonNode) response.getOriginalData(); - if (dataObject.isArray()) { - Iterator dataIterator = dataObject.iterator(); - while (dataIterator.hasNext()) { - dataList.add(toJsonObject(dataIterator.next())); - } - } else { - dataList.add(toJsonObject(dataObject)); - } - weaviateService.saveBatch(response.getOriginalData(), entity.getTableName(), attrMap); + VectorUrlResponse response = getUrlResponse(entity.getUrl(), bladeToken, hzinfoToken); + if (response != null) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode rootNode = null; + try { + rootNode = mapper.readTree(entity.getAttributeMap()); + } catch (JsonProcessingException e) { + e.printStackTrace(); } + Map attrMap = new HashMap<>(); + Iterator iterator = rootNode.fieldNames(); + while (iterator.hasNext()) { + String key = iterator.next(); + attrMap.put(key, rootNode.findValue(key).textValue()); + } + weaviateService.saveBatch(response.getOriginalData(), entity.getTableName(), attrMap); + this.update(Wrappers.lambdaUpdate().eq(VectorParamEntity::getId, id).set(VectorParamEntity::getUpdateTime, new Date())); } return true; } - private JSONObject toJsonObject(JsonNode node) { - JSONObject jsonObject = JSON.parseObject(node.toString()); - return jsonObject; - } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java index a3a905f..7e47281 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java @@ -3,64 +3,69 @@ package com.hnac.hzims.operational.report.controller; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.operational.report.entity.RunMonthEntity; 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.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * @author ysj */ @RestController -@Api(value = "运行月报",tags = "生产月报") +@Api(value = "运行月报", tags = "生产月报") @AllArgsConstructor @RequestMapping("/run/month") public class RunMonthController { - private final RunMonthService runMonthService; + private final RunMonthService runMonthService; - @GetMapping("/generate") - @ApiOperation(value = "生成站点月报",notes = "生成站点月报") - @ApiOperationSupport(order = 1) - public R generate(@RequestParam("mon") String mon, - @RequestParam("stationCode") String stationCode){ - return R.data(runMonthService.generate(mon,stationCode)); - } + @GetMapping("/generate") + @ApiOperation(value = "生成站点月报", notes = "生成站点月报") + @ApiOperationSupport(order = 1) + public R generate(@RequestParam("mon") String mon, + @RequestParam("stationCode") String stationCode) { + return R.data(runMonthService.generate(mon, stationCode)); + } - @GetMapping("/check") - @ApiOperation(value = "查询站点月报数据",notes = "查询站点月报数据") - @ApiOperationSupport(order = 2) - public R check(@RequestParam("stationCode") String stationCode){ - return R.data(runMonthService.check(stationCode)); - } + @GetMapping("/check") + @ApiOperation(value = "查询站点月报数据", notes = "查询站点月报数据") + @ApiOperationSupport(order = 2) + public R check(@RequestParam("stationCode") String stationCode) { + return R.data(runMonthService.check(stationCode)); + } - @GetMapping("/data") - @ApiOperation(value = "查询站点月报数据",notes = "查询站点月报数据") - @ApiOperationSupport(order = 3) - public R data(@RequestParam("mon") String mon, - @RequestParam("stationCode") String stationCode){ - return R.data(runMonthService.data(mon,stationCode)); - } + @GetMapping("/data") + @ApiOperation(value = "查询站点月报数据", notes = "查询站点月报数据") + @ApiOperationSupport(order = 3) + public R data(@RequestParam("mon") String mon, + @RequestParam("stationCode") String stationCode) { + return R.data(runMonthService.data(mon, stationCode)); + } - @GetMapping("/export") - @ApiOperation(value = "导出站点运行月报",notes = "导出站点运行月报") - @ApiOperationSupport(order = 4) - public void export(@RequestParam("mon") String mon, - @RequestParam("stationCode") String stationCode){ - runMonthService.export(mon,stationCode); - } + @GetMapping("/export") + @ApiOperation(value = "导出站点运行月报", notes = "导出站点运行月报") + @ApiOperationSupport(order = 4) + public void export(@RequestParam("mon") String mon, + @RequestParam("stationCode") String stationCode) { + runMonthService.export(mon, stationCode); + } - @GetMapping("/generateAnalyseResult") - @ApiOperation(value = "生成分析结果",notes = "生成分析结果") - @ApiOperationSupport(order = 5) - public R generateAnalyseResult(@RequestParam @ApiParam("查询月份") String month, @RequestParam @ApiParam("站点编号") String stationCode) { - runMonthService.generateAnalyseResult(month,stationCode); - return R.success("调用成功!"); - } + @GetMapping("/generateAnalyseResult") + @ApiOperation(value = "生成分析结果", notes = "生成分析结果") + @ApiOperationSupport(order = 5) + public R generateAnalyseResult(@RequestParam @ApiParam("查询月份") String month, @RequestParam @ApiParam("站点编号") String stationCode) { + runMonthService.generateAnalyseResult(month, stationCode); + return R.success("调用成功!"); + } + + @PutMapping("/evaluate") + @ApiOperation(value = "站点月报评价", notes = "站点月报评价") + @ApiOperationSupport(order = 6) + public R evaluate(@RequestBody RunMonthEvaluateVO req) { + return R.data(runMonthService.evaluate(req.getId(), req.getText())); + } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthService.java index 8f484f7..600b3d4 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthService.java @@ -24,4 +24,6 @@ public interface RunMonthService extends IService { * @return 大模型调用结果 */ Boolean generateAnalyseResult(String month,String stationCode); + + Boolean evaluate(Long id, String text); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java index 616f38a..a926c3e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java @@ -104,10 +104,11 @@ public class RunMonthServiceImpl extends ServiceImpl(256), new ThreadFactoryBuilder().setNameFormat("generate-run-report-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy()); + private static final ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), new ThreadFactoryBuilder().setNameFormat("generate-run-report-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); /** * 查询站点月报运行数据 + * * @param mon * @param stationCode * @return @@ -115,20 +116,21 @@ public class RunMonthServiceImpl extends ServiceImpllambdaQuery() - .eq(RunMonthEntity::getStationCode,stationCode) - .eq(RunMonthEntity::getMonth,mon) + .eq(RunMonthEntity::getStationCode, stationCode) + .eq(RunMonthEntity::getMonth, mon) ); - if(ObjectUtil.isEmpty(entity)){ + if (ObjectUtil.isEmpty(entity)) { throw new ServiceException("站点" + mon + "月份未生成运行月报,请先点击【生成】按钮生成月报!"); } RunDataShowVo data = new RunDataShowVo(); - BeanUtil.copyProperties(entity,data); - List runs = JSONObject.parseObject(entity.getRunData(),new TypeReference>(){}); - if(CollectionUtil.isEmpty(runs)){ + BeanUtil.copyProperties(entity, data); + List runs = JSONObject.parseObject(entity.getRunData(), new TypeReference>() { + }); + if (CollectionUtil.isEmpty(runs)) { return data; } // 保留两位小数 - data.setRunData(JSONObject.toJSONString(runs.stream().map(run->{ + data.setRunData(JSONObject.toJSONString(runs.stream().map(run -> { // 月发电量 run.setGenerate(BigDecimal.valueOf(run.getGenerate()).setScale(2, RoundingMode.HALF_UP).doubleValue()); // 年发电量 @@ -141,24 +143,24 @@ public class RunMonthServiceImpl extends ServiceImpl 0 && Math.abs(monSumPlan) > 0){ - data.setMonRate(BigDecimal.valueOf(monSumGenerate / monSumPlan * 100L).setScale(2, RoundingMode.HALF_UP).doubleValue()); + if (Math.abs(monSumGenerate) > 0 && Math.abs(monSumPlan) > 0) { + data.setMonRate(BigDecimal.valueOf(monSumGenerate / monSumPlan * 100L).setScale(2, RoundingMode.HALF_UP).doubleValue()); } // 年发电量完成率 double yearSumGenerate = runs.stream().mapToDouble(RunDataVo::getGenerateYear).sum(); double yearSumPlan = runs.stream().mapToDouble(RunDataVo::getPlanYear).sum(); data.setYearSumGenerate(yearSumGenerate); data.setYearSumPlan(yearSumPlan); - if(Math.abs(yearSumGenerate) > 0 && Math.abs(yearSumPlan) > 0){ - data.setYearRate(BigDecimal.valueOf(yearSumGenerate / yearSumPlan * 100L).setScale(2, RoundingMode.HALF_UP).doubleValue()); + if (Math.abs(yearSumGenerate) > 0 && Math.abs(yearSumPlan) > 0) { + data.setYearRate(BigDecimal.valueOf(yearSumGenerate / yearSumPlan * 100L).setScale(2, RoundingMode.HALF_UP).doubleValue()); } return data; } - /** * 导出站点月报文件 + * * @param mon * @param stationCode */ @@ -167,17 +169,18 @@ public class RunMonthServiceImpl extends ServiceImpllambdaQuery() - .eq(RunMonthEntity::getStationCode,stationCode) - .eq(RunMonthEntity::getMonth,mon) + RunMonthEntity data = this.getOne(Wrappers.lambdaQuery() + .eq(RunMonthEntity::getStationCode, stationCode) + .eq(RunMonthEntity::getMonth, mon) ); - if(ObjectUtil.isEmpty(data)){ + if (ObjectUtil.isEmpty(data)) { throw new ServiceException("站点" + mon + "月份未生成运行月报数据!"); } - List runs = JSONObject.parseObject(data.getRunData(),new TypeReference>(){}); - if(CollectionUtil.isNotEmpty(runs)){ + List runs = JSONObject.parseObject(data.getRunData(), new TypeReference>() { + }); + if (CollectionUtil.isNotEmpty(runs)) { // 保留两位小数 - data.setRunData(JSONObject.toJSONString(runs.stream().map(run->{ + data.setRunData(JSONObject.toJSONString(runs.stream().map(run -> { // 月发电量 run.setGenerate(BigDecimal.valueOf(run.getGenerate()).setScale(2, RoundingMode.HALF_UP).doubleValue()); // 年发电量 @@ -188,7 +191,7 @@ public class RunMonthServiceImpl extends ServiceImpllambdaQuery() .eq(StationEntity::getDataOrigin, HomePageConstant.DATA_ORIGIN) - .eq(StationEntity::getType,HomePageConstant.HYDROPOWER) - .eq(StationEntity::getCode,stationCode) + .eq(StationEntity::getType, HomePageConstant.HYDROPOWER) + .eq(StationEntity::getCode, stationCode) ); - if(ObjectUtil.isEmpty(station)){ + if (ObjectUtil.isEmpty(station)) { throw new ServiceException("未查询到站点信息!"); } // 查询站点设备 List devices = deivceClient.rideDevices(Collections.singletonList(station.getRefDept())); - if(CollectionUtil.isEmpty(devices)){ + if (CollectionUtil.isEmpty(devices)) { throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!"); } // 计划发电量 DevicePlanGenerationVo param = new DevicePlanGenerationVo(); param.setStationIds(Collections.singletonList(stationCode)); - param.setDate(DateUtil.format(new Date(),"yyyy")); + param.setDate(DateUtil.format(new Date(), "yyyy")); List plans = planClient.getPlanGenerationByParam(param); RunMonthEntity run = new RunMonthEntity(); run.setTenantId(station.getTenantId()); @@ -244,20 +248,20 @@ public class RunMonthServiceImpl extends ServiceImpl runDatas = new ArrayList<>(); List curveEcharts = new ArrayList<>(); - for (RideDeviceVo device : devices){ + for (RideDeviceVo device : devices) { // 运行数据 - runDatas.add(this.runData(station.getCode(),device,plans,start,end)); + runDatas.add(this.runData(station.getCode(), device, plans, start, end)); // 月度运行曲线 - curveEcharts.add(this.curveData(device,start,end)); + curveEcharts.add(this.curveData(device, start, end)); } /*CountDownLatch countDownLatch = new CountDownLatch(devices.size()); List runDatas = new CopyOnWriteArrayList<>(); @@ -278,39 +282,40 @@ public class RunMonthServiceImpl extends ServiceImpl this.smartReportGeneratePower(mon,stationCode),"运行月报分析结论").start(); + new Thread(() -> this.smartReportGeneratePower(mon, stationCode), "运行月报分析结论").start(); return save; } /** * 调用大模型分析月报接口 - * @param mon 月报月份 + * + * @param mon 月报月份 * @param stationCode 月报站号 */ - private void smartReportGeneratePower(String mon,String stationCode) { + private void smartReportGeneratePower(String mon, String stationCode) { List analyseVOList = Lists.newArrayList(); YearMonth yearMonth = YearMonth.parse(mon); List months = Lists.newArrayList(yearMonth, yearMonth.minusMonths(1), yearMonth.minusYears(1)); - months.stream().map(YearMonth::toString).map(m ->{ + months.stream().map(YearMonth::toString).map(m -> { try { - return this.data(m,stationCode); - } catch(Exception e) { + return this.data(m, stationCode); + } catch (Exception e) { return null; } - }).filter(Func::isNotEmpty).forEach(d -> this.fillAnalyseData(d,analyseVOList,mon)); + }).filter(Func::isNotEmpty).forEach(d -> this.fillAnalyseData(d, analyseVOList, mon)); // 过滤掉发电量为空的数据 analyseVOList.forEach(analyseVO -> { List power = analyseVO.getPower(); @@ -329,15 +334,16 @@ public class RunMonthServiceImpl extends ServiceImpl analyseVOList, String month) { - if(Func.isNotEmpty(req)) { + if (Func.isNotEmpty(req)) { // 解析运行月报数据 - 运行数据、告警数据 List rundatas = JSONArray.parseArray(req.getRunData(), RunDataVo.class); - List alarms = JSONArray.parseArray(req.getAlarmData(),RunAlarmVo.class); + List alarms = JSONArray.parseArray(req.getAlarmData(), RunAlarmVo.class); // 取运行、告警设备设备并集 List runDatas = rundatas.stream().map(RunDataVo::getDeviceName).distinct().collect(Collectors.toList()); List alarmDatas = alarms.stream().map(RunAlarmVo::getDeviceName).distinct().collect(Collectors.toList()); @@ -345,10 +351,10 @@ public class RunMonthServiceImpl extends ServiceImpl { Integer deviceOrder = SetNameFormatterUtil.getSetOrder(deviceName); - if(Func.isNotEmpty(deviceOrder)) { + if (Func.isNotEmpty(deviceOrder)) { String formateDevice = deviceOrder + "#机组"; Optional exist = analyseVOList.stream().filter(a -> formateDevice.equals(a.getEmName())).findFirst(); - if(!exist.isPresent()) { + if (!exist.isPresent()) { // 若该设备未新增接受数据对象,则新增之后填充数据 RunReportDataAnalyseDTO analyseVO = this.createDeviceAnalyse(formateDevice, month, deviceOrder); analyseVOList.add(analyseVO); @@ -359,11 +365,11 @@ public class RunMonthServiceImpl extends ServiceImpl formateDevice.equals(a.getEmName())).findFirst().get(); PowerDataDTO powerDataDTO = analyseDTO.getPower().stream().filter(p -> req.getMonth().equals(p.getDate())).findFirst().get(); // 发电量赋值 - if(Func.isNotEmpty(powerDataDTO)) { - if(Func.isNotEmpty(power)) { + if (Func.isNotEmpty(powerDataDTO)) { + if (Func.isNotEmpty(power)) { powerDataDTO.setValue(Optional.ofNullable(powerDataDTO.getValue()).orElse(0.0) + power); } - if(Func.isNotEmpty(runHours)) { + if (Func.isNotEmpty(runHours)) { powerDataDTO.setRunTime(Optional.ofNullable(powerDataDTO.getRunTime()).orElse(0.0) + runHours); } } @@ -375,7 +381,7 @@ public class RunMonthServiceImpl extends ServiceImpl runs = runMonthReportService.list(Wrappers.lambdaQuery() - .eq(RunMonthEntity::getMonth,mon) - .eq(RunMonthEntity::getStationCode,stationCode) + .eq(RunMonthEntity::getMonth, mon) + .eq(RunMonthEntity::getStationCode, stationCode) ); - if(CollectionUtil.isEmpty(runs)){ + if (CollectionUtil.isEmpty(runs)) { return; } this.runMonthReportService.removeByIds(runs.stream().map(RunMonthEntity::getId).collect(Collectors.toList())); @@ -459,104 +467,109 @@ public class RunMonthServiceImpl extends ServiceImpl plans,String start,String end) { + private RunDataVo runData(String stationCode, RideDeviceVo device, List plans, String start, String end) { RunDataVo run = new RunDataVo(); run.setDeviceCode(device.getNumber()); run.setDeviceName(device.getName()); // 运行时长 - run.setRunHours(this.runHours(device,DateUtil.parse(start,DateUtil.PATTERN_DATETIME), DateUtil.parse(end,DateUtil.PATTERN_DATETIME))); + run.setRunHours(this.runHours(device, DateUtil.parse(start, DateUtil.PATTERN_DATETIME), DateUtil.parse(end, DateUtil.PATTERN_DATETIME))); // 月发电量 - Double day = this.generates(0,device.getNumber(),device.getRide(),start,end); - if(ObjectUtil.isEmpty(day)){ + Double day = this.generates(0, device.getNumber(), device.getRide(), start, end); + if (ObjectUtil.isEmpty(day)) { run.setGenerate(0.0); - }else{ - run.setGenerate(day/10000); + } else { + run.setGenerate(day / 10000); } // 年发电量 - Double year = this.generates(1,device.getNumber(),device.getRide(),start,end); - if(ObjectUtil.isEmpty(day)){ + Double year = this.generates(1, device.getNumber(), device.getRide(), start, end); + if (ObjectUtil.isEmpty(day)) { run.setGenerateYear(0.0); - }else{ - run.setGenerateYear(year/10000); + } else { + run.setGenerateYear(year / 10000); } // 计划发电量 - run.setPlan(this.planGenerate(0,stationCode,plans)/10000); + run.setPlan(this.planGenerate(0, stationCode, plans) / 10000); // 年计划发电量 - run.setPlanYear(this.planGenerate(1,stationCode,plans)/10000); + run.setPlanYear(this.planGenerate(1, stationCode, plans) / 10000); return run; } /** * 实际发电量 + * * @param type * @param deviceCode * @param ride * @return */ - private Double generates(int type,String deviceCode,double ride,String start,String end) { - if(type == 0){ - return Double.valueOf(dataService.periodTargetFloat(start,end,5,5,deviceCode,ride,HomePageConstant.HYDROPOWER_GENERATE_POWER)); + private Double generates(int type, String deviceCode, double ride, String start, String end) { + if (type == 0) { + return Double.valueOf(dataService.periodTargetFloat(start, end, 5, 5, deviceCode, ride, HomePageConstant.HYDROPOWER_GENERATE_POWER)); } Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.MONTH,-calendar.get(Calendar.MONTH)); - calendar.add(Calendar.DAY_OF_MONTH,-calendar.get(Calendar.DAY_OF_MONTH)); - calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); + calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); + calendar.add(Calendar.DAY_OF_MONTH, -calendar.get(Calendar.DAY_OF_MONTH)); + calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY)); calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); - calendar.add(Calendar.DAY_OF_MONTH,1); - return Double.valueOf(dataService.periodTargetFloat(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME),end,5,6,deviceCode,ride,HomePageConstant.HYDROPOWER_GENERATE_POWER)); + calendar.add(Calendar.DAY_OF_MONTH, 1); + return Double.valueOf(dataService.periodTargetFloat(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME), end, 5, 6, deviceCode, ride, HomePageConstant.HYDROPOWER_GENERATE_POWER)); } /** * 计划发电量 + * * @param type * @param stationCode * @param plans * @return */ - private Double planGenerate(int type, String stationCode,List plans) { + private Double planGenerate(int type, String stationCode, List plans) { Calendar calendar = Calendar.getInstance(); - calendar.setTime(DateUtil.parse("2024-05-01 00:00:00",DateUtil.PATTERN_DATETIME)); - if(type == 0){ - calendar.add(Calendar.DAY_OF_MONTH,-1); - calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY) + 1); + calendar.setTime(DateUtil.parse("2024-05-01 00:00:00", DateUtil.PATTERN_DATETIME)); + if (type == 0) { + calendar.add(Calendar.DAY_OF_MONTH, -1); + calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY) + 1); calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); - String time = DateUtil.format(calendar.getTime(),"yyyy-MM"); + String time = DateUtil.format(calendar.getTime(), "yyyy-MM"); return plans.stream().filter(plan -> plan.getStationId().equals(stationCode) && plan.getDateTime().contains(time)) .mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); } - String time = DateUtil.format(calendar.getTime(),"yyyy"); + String time = DateUtil.format(calendar.getTime(), "yyyy"); return plans.stream().filter(plan -> plan.getStationId().equals(stationCode) && plan.getDateTime().contains(time)) .mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); } /** * 获取运行数据 + * * @param device * @return */ - private Double runHours(RideDeviceVo device,Date startDate,Date endDate) { + private Double runHours(RideDeviceVo device, Date startDate, Date endDate) { MultiAnalyzeCodePO analyze = new MultiAnalyzeCodePO(); analyze.setDeviceCode(device.getNumber()); analyze.setSignages(Collections.singletonList(HomePageConstant.ACTIVE_POWER)); List signages = dataService.analyzeCodeBySignages(Collections.singletonList(analyze)); - if(CollectionUtil.isEmpty(signages)){ + if (CollectionUtil.isEmpty(signages)) { return 0.0; } // 监测点 String realId = signages.get(0).getRealId(); - if(StringUtils.isEmpty(realId)){ + if (StringUtils.isEmpty(realId)) { return 0.0; } - return this.getRunConvertData(realId,startDate,endDate); + return this.getRunConvertData(realId, startDate, endDate); } /** * 获取时间范围内运行时长 + * * @param realId * @param startDate * @param endDate @@ -571,41 +584,42 @@ public class RunMonthServiceImpl extends ServiceImpl> result = historyDataSearchClient.getOriginalDataByRealIds(originalDataQuery); - if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData())){ + if (!result.isSuccess() || ObjectUtil.isEmpty(result.getData())) { return 0.0; } // 开机运行时长 - long time = this.getRunTime(result.getData().getRecords(),startDate,endDate); + long time = this.getRunTime(result.getData().getRecords(), startDate, endDate); return BigDecimal.valueOf(time / (1000 * 60 * 60.00)).setScale(2, RoundingMode.HALF_UP).doubleValue(); } /** * 获取运行时长 + * * @param result * @return */ - private long getRunTime(List result,Date startDate,Date endDate) { - if(result.size() == 1){ + private long getRunTime(List result, Date startDate, Date endDate) { + if (result.size() == 1) { // 一直开机 - if(Double.parseDouble(result.get(0).getValue()) > 0){ + if (Double.parseDouble(result.get(0).getValue()) > 0) { return endDate.getTime() - startDate.getTime(); } // 一直关机 return 0; } - long time=0; + long time = 0; // 遍历累计开机时长 - for(int i = 0; i< result.size() ; i++){ + for (int i = 0; i < result.size(); i++) { // 记录为开机状态 就计算到下次关机的时间差 - if(Double.parseDouble(result.get(i).getValue()) <= 0){ + if (Double.parseDouble(result.get(i).getValue()) <= 0) { continue; } - Date endTime,startTime = DateUtil.parse(result.get(i).getTime(), DateUtil.PATTERN_DATETIME); + Date endTime, startTime = DateUtil.parse(result.get(i).getTime(), DateUtil.PATTERN_DATETIME); // 遍历至最后一条数据,累计至当前时间 - if(i == result.size() - 1){ + if (i == result.size() - 1) { endTime = endDate; - }else { - endTime = DateUtil.parse(result.get(i+1).getTime(), DateUtil.PATTERN_DATETIME); + } else { + endTime = DateUtil.parse(result.get(i + 1).getTime(), DateUtil.PATTERN_DATETIME); } time += endTime.getTime() - startTime.getTime(); } @@ -614,46 +628,49 @@ public class RunMonthServiceImpl extends ServiceImpl alarms = this.hz3000Alarm(code,start,end); + List alarms = this.hz3000Alarm(code, start, end); // FDP智能预警 - alarms.addAll(this.intelligentEarly(code,start,end)); + alarms.addAll(this.intelligentEarly(code, start, end)); return JSONObject.toJSONString(alarms); } /** * 查询hz3000告警 + * * @param code */ - private List hz3000Alarm(String code,String start,String end) { + private List hz3000Alarm(String code, String start, String end) { SoeQueryConditionByStation query = new SoeQueryConditionByStation(); query.setStationIds(Collections.singletonList(code)); query.setTypes(Collections.singletonList(AlarmHandleConstant.FAULT)); - query.setBeginTime(LocalDateTime.parse(start,DateUtil.DATETIME_FORMATTER)); - query.setEndTime(LocalDateTime.parse(end,DateUtil.DATETIME_FORMATTER)); + query.setBeginTime(LocalDateTime.parse(start, DateUtil.DATETIME_FORMATTER)); + query.setEndTime(LocalDateTime.parse(end, DateUtil.DATETIME_FORMATTER)); query.setNeedPage(false); Result> result = soeClient.getByStationsAndTime(query); - if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){ + if (!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())) { return new ArrayList<>(); } - return result.getData().getRecords().stream().collect(Collectors.groupingBy(SoeData::getSoeExplain)).entrySet().stream().map(entry->{ + return result.getData().getRecords().stream().collect(Collectors.groupingBy(SoeData::getSoeExplain)).entrySet().stream().map(entry -> { RunAlarmVo alarm = new RunAlarmVo(); - alarm.setAlarmTime(DateUtil.format(entry.getValue().stream().sorted(Comparator.comparing(SoeData::getTs)).collect(Collectors.toList()).get(0).getTs(),DateUtil.PATTERN_DATETIME)); + alarm.setAlarmTime(DateUtil.format(entry.getValue().stream().sorted(Comparator.comparing(SoeData::getTs)).collect(Collectors.toList()).get(0).getTs(), DateUtil.PATTERN_DATETIME)); alarm.setDeviceName(entry.getValue().get(0).getDeviceName()); alarm.setContent(entry.getKey()); alarm.setType(String.valueOf(AlarmConstants.FAULT)); alarm.setTypeName("故障"); - alarm.setCount(Math.max(entry.getValue().stream().filter(o->StringUtil.isNotBlank(o.getTraceCount())).mapToInt(soe->Integer.parseInt(soe.getTraceCount())).sum(), 1)); + alarm.setCount(Math.max(entry.getValue().stream().filter(o -> StringUtil.isNotBlank(o.getTraceCount())).mapToInt(soe -> Integer.parseInt(soe.getTraceCount())).sum(), 1)); return alarm; }).collect(Collectors.toList()); } /** * 智能预警 + * * @param code * @param start * @param end @@ -661,15 +678,15 @@ public class RunMonthServiceImpl extends ServiceImpl intelligentEarly(String code, String start, String end) { StbAnalysisDTO param = new StbAnalysisDTO(); - param.setStartTime(LocalDateTime.parse(start,DateUtil.DATETIME_FORMATTER)); + param.setStartTime(LocalDateTime.parse(start, DateUtil.DATETIME_FORMATTER)); param.setEndTime(LocalDateTime.parse(end, DateUtil.DATETIME_FORMATTER)); param.setStations(Collections.singletonList(code)); param.setNeedPage(false); Result> result = soeDataClient.pageStbAnalysis(param); - if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){ + if (!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())) { return new ArrayList<>(); } - return result.getData().getRecords().stream().collect(Collectors.groupingBy(StbAnalysisVO::getName)).entrySet().stream().map(entry->{ + return result.getData().getRecords().stream().collect(Collectors.groupingBy(StbAnalysisVO::getName)).entrySet().stream().map(entry -> { RunAlarmVo alarm = new RunAlarmVo(); alarm.setAlarmTime(entry.getValue().stream().sorted(Comparator.comparing(StbAnalysisVO::getTs)).collect(Collectors.toList()).get(0).getTs()); alarm.setDeviceName(entry.getValue().get(0).getOrd()); @@ -685,67 +702,67 @@ public class RunMonthServiceImpl extends ServiceImpl curve(List attributes,String start,String end, String deviceCode) { - List datas = dataService.periodTargetSignages(start,end,3,3,deviceCode,attributes.stream().map(AttributeVo::getSignage).collect(Collectors.toList())); - if(CollectionUtil.isEmpty(datas)){ + private List curve(List attributes, String start, String end, String deviceCode) { + List datas = dataService.periodTargetSignages(start, end, 3, 3, deviceCode, attributes.stream().map(AttributeVo::getSignage).collect(Collectors.toList())); + if (CollectionUtil.isEmpty(datas)) { return new ArrayList<>(); } List analyseDatas = new ArrayList<>(); Calendar day = Calendar.getInstance(); - datas.forEach(data->{ - if(CollectionUtil.isEmpty(data.getList())){ + datas.forEach(data -> { + if (CollectionUtil.isEmpty(data.getList())) { return; } - analyseDatas.addAll(data.getList().stream().peek(item->{ + analyseDatas.addAll(data.getList().stream().peek(item -> { item.setSignage(data.getSignage()); Date date; - if(item.getTs().contains(".0")){ + if (item.getTs().contains(".0")) { date = DateUtil.parse(item.getTs(), "yyyy-MM-dd HH:mm:ss.s"); - }else{ + } else { date = DateUtil.parse(item.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s"); } day.setTime(date); item.setTs(String.valueOf(day.get(Calendar.DAY_OF_MONTH))); }).collect(Collectors.toList())); }); - if(CollectionUtil.isEmpty(analyseDatas)){ + if (CollectionUtil.isEmpty(analyseDatas)) { return new ArrayList<>(); } - Map> map = analyseDatas.stream().collect(Collectors.groupingBy(AnalyseDataTaosVO::getTs)); - return map.entrySet().stream().map(entry->{ + Map> map = analyseDatas.stream().collect(Collectors.groupingBy(AnalyseDataTaosVO::getTs)); + return map.entrySet().stream().map(entry -> { EchartVo echart = new EchartVo(); echart.setTime(Integer.valueOf(entry.getKey())); - echart.setValues(entry.getValue().stream().map(value->{ + echart.setValues(entry.getValue().stream().map(value -> { EchartValueVo echartValue = new EchartValueVo(); echartValue.setAttribute(value.getSignage()); - echartValue.setAttributeName(attributes.stream().filter(o->o.getSignage().equals(value.getSignage())).collect(Collectors.toList()).get(0).getSignageName()); - if(StringUtil.isEmpty(value.getVal())){ + echartValue.setAttributeName(attributes.stream().filter(o -> o.getSignage().equals(value.getSignage())).collect(Collectors.toList()).get(0).getSignageName()); + if (StringUtil.isEmpty(value.getVal())) { echartValue.setValue(0.0); - }else{ + } else { echartValue.setValue(Double.parseDouble(value.getVal())); } return echartValue; @@ -756,12 +773,13 @@ public class RunMonthServiceImpl extends ServiceImpl attribute(int attributeType) { List attributes = new ArrayList<>(); - switch (attributeType){ + switch (attributeType) { case 0: AttributeVo attribute = new AttributeVo(); attribute.setSignage(HomePageConstant.ACTIVE_POWER); @@ -820,6 +838,7 @@ public class RunMonthServiceImpl extends ServiceImpl> emInfos = deivceClient.getEmInfoByDept(Collections.singletonList(station.getRefDept())); - if(!emInfos.isSuccess() || CollectionUtil.isEmpty(emInfos.getData())){ + if (!emInfos.isSuccess() || CollectionUtil.isEmpty(emInfos.getData())) { throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!"); } - List devices = emInfos.getData().stream().filter(o->"2".equals(o.getEmType())).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(devices)){ + List devices = emInfos.getData().stream().filter(o -> "2".equals(o.getEmType())).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(devices)) { throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!"); } return true; @@ -844,15 +863,21 @@ public class RunMonthServiceImpl extends ServiceImpllambdaUpdate().set(RunMonthEntity::getEvaluation, text).eq(RunMonthEntity::getId, id)); + } + /** * 手绘运行数据表格 + * * @return */ - private Workbook drawBook(String headerName,RunMonthEntity entity) { + private Workbook drawBook(String headerName, RunMonthEntity entity) { Workbook hssWB = new XSSFWorkbook(); // 添加sheet页 Sheet sheet = hssWB.createSheet(headerName); @@ -863,88 +888,91 @@ public class RunMonthServiceImpl extends ServiceImpl curves = JSONObject.parseObject(data,new TypeReference>(){}); - if(CollectionUtil.isEmpty(curves)){ + List curves = JSONObject.parseObject(data, new TypeReference>() { + }); + if (CollectionUtil.isEmpty(curves)) { // 绘制空表格 - this.emptyRow(hssWB,sheet,rowNumber); + this.emptyRow(hssWB, sheet, rowNumber); CellRangeAddress region = new CellRangeAddress(rowNumber, rowNumber, (short) 0, (short) 7); sheet.addMergedRegion(region); return rowNumber + 1; } // 遍历机组 - for(CurveEchartVo device : curves) { + for (CurveEchartVo device : curves) { // 负荷曲线 - rowNumber = this.drawCurve(hssWB,sheet,rowNumber,device.getLoadCurve(),device.getDeviceName() + "_负荷曲线"); + rowNumber = this.drawCurve(hssWB, sheet, rowNumber, device.getLoadCurve(), device.getDeviceName() + "_负荷曲线"); // 轴承温度 - rowNumber = this.drawCurve(hssWB,sheet,rowNumber,device.getBearingTempCurve(),device.getDeviceName() + "_轴承温度曲线"); + rowNumber = this.drawCurve(hssWB, sheet, rowNumber, device.getBearingTempCurve(), device.getDeviceName() + "_轴承温度曲线"); // 定子温度曲线 - rowNumber = this.drawCurve(hssWB,sheet,rowNumber,device.getStatorTempCurve(),device.getDeviceName() + "_定子温度曲线"); + rowNumber = this.drawCurve(hssWB, sheet, rowNumber, device.getStatorTempCurve(), device.getDeviceName() + "_定子温度曲线"); } return rowNumber; } /** * 绘制曲线 + * * @param loadCurve * @param rowNumber */ - private int drawCurve(Workbook hssWB,Sheet sheet,int rowNumber,List loadCurve,String title) { + private int drawCurve(Workbook hssWB, Sheet sheet, int rowNumber, List loadCurve, String title) { // 标题 Row row_1 = sheet.createRow(rowNumber); this.setTitileStyle(hssWB, row_1, 7, false, false, HorizontalAlignment.LEFT); @@ -953,9 +981,9 @@ public class RunMonthServiceImpl extends ServiceImpl xds = DataSources.fromArray(loadCurve.stream().map(EchartVo::getTime).toArray(Number[]::new)); // 曲线条目集合 - List curveYArray = this.curveToArray(loadCurve); + List curveYArray = this.curveToArray(loadCurve); // Y 轴曲线 : 平滑散点值 - for(CurveYArrayVo array : curveYArray){ + for (CurveYArrayVo array : curveYArray) { ChartDataSource yds = DataSources.fromArray(array.getValues()); - LineChartSeries series = lineChartData.addSeries(xds,yds); + LineChartSeries series = lineChartData.addSeries(xds, yds); // 曲线名称 series.setTitle(array.getAttributeName()); } @@ -1000,12 +1028,13 @@ public class RunMonthServiceImpl extends ServiceImpl curveToArray(List curves) { List attrValues = new ArrayList<>(); - curves.forEach(curve-> attrValues.addAll(curve.getValues().stream().map(value->{ + curves.forEach(curve -> attrValues.addAll(curve.getValues().stream().map(value -> { CurveAttrValueVo attrValue = new CurveAttrValueVo(); attrValue.setAttribute(value.getAttribute()); attrValue.setAttributeName(value.getAttributeName()); @@ -1013,7 +1042,7 @@ public class RunMonthServiceImpl extends ServiceImpl{ + return attrValues.stream().collect(Collectors.groupingBy(CurveAttrValueVo::getAttribute)).entrySet().stream().map(entry -> { CurveYArrayVo yArray = new CurveYArrayVo(); yArray.setAttribute(entry.getKey()); yArray.setAttributeName(entry.getValue().get(0).getAttributeName()); @@ -1024,25 +1053,26 @@ public class RunMonthServiceImpl extends ServiceImpl runData = JSONObject.parseObject(data,new TypeReference>(){}); - if(CollectionUtil.isEmpty(runData)){ + List runData = JSONObject.parseObject(data, new TypeReference>() { + }); + if (CollectionUtil.isEmpty(runData)) { // 绘制空表格 - this.emptyRow(hssWB,sheet,rowNumber); + this.emptyRow(hssWB, sheet, rowNumber); CellRangeAddress region = new CellRangeAddress(rowNumber, rowNumber, (short) 0, (short) 7); sheet.addMergedRegion(region); return rowNumber + 1; } int row = rowNumber; int endRow = rowNumber + runData.size(); - for (;row < endRow; row ++){ + for (; row < endRow; row++) { // 创建行 Row frow = sheet.createRow(row); - this.setTitileStyle(hssWB, frow, 7, false,false,HorizontalAlignment.CENTER); + this.setTitileStyle(hssWB, frow, 7, false, false, HorizontalAlignment.CENTER); // 组名 Cell frow_cell_1 = frow.getCell(0); frow_cell_1.setCellValue(runData.get(row - rowNumber).getDeviceName()); @@ -1179,7 +1215,7 @@ public class RunMonthServiceImpl extends ServiceImpl 0 && Math.abs(monSumPlan) > 0){ - frow_cell_6.setCellValue(BigDecimal.valueOf(monSumGenerate / monSumPlan * 100L).setScale(2, RoundingMode.HALF_UP).doubleValue() + "%"); - }else{ + if (Math.abs(monSumGenerate) > 0 && Math.abs(monSumPlan) > 0) { + frow_cell_6.setCellValue(BigDecimal.valueOf(monSumGenerate / monSumPlan * 100L).setScale(2, RoundingMode.HALF_UP).doubleValue() + "%"); + } else { frow_cell_6.setCellValue("0%"); } // 年累计发电量 @@ -1202,15 +1238,15 @@ public class RunMonthServiceImpl extends ServiceImpl 0 && Math.abs(yearSumPlan) > 0){ - frow_cell_8.setCellValue(BigDecimal.valueOf(yearSumGenerate / yearSumPlan * 100L).setScale(2, RoundingMode.HALF_UP).doubleValue() + "%"); - }else{ + if (Math.abs(yearSumGenerate) > 0 && Math.abs(yearSumPlan) > 0) { + frow_cell_8.setCellValue(BigDecimal.valueOf(yearSumGenerate / yearSumPlan * 100L).setScale(2, RoundingMode.HALF_UP).doubleValue() + "%"); + } else { frow_cell_8.setCellValue("0%"); } } } // 行合并情况 - if(runData.size() > 1){ + if (runData.size() > 1) { CellRangeAddress region3 = new CellRangeAddress(rowNumber, endRow - 1, (short) 3, (short) 3); CellRangeAddress region4 = new CellRangeAddress(rowNumber, endRow - 1, (short) 4, (short) 4); CellRangeAddress region5 = new CellRangeAddress(rowNumber, endRow - 1, (short) 5, (short) 5); @@ -1227,6 +1263,7 @@ public class RunMonthServiceImpl extends ServiceImpl runAlarm = JSONObject.parseObject(data,new TypeReference>(){}); - if(CollectionUtil.isEmpty(runAlarm)){ + List runAlarm = JSONObject.parseObject(data, new TypeReference>() { + }); + if (CollectionUtil.isEmpty(runAlarm)) { // 绘制空表格 - this.emptyRow(hssWB,sheet,rowNumber); + this.emptyRow(hssWB, sheet, rowNumber); CellRangeAddress region = new CellRangeAddress(rowNumber, rowNumber, (short) 0, (short) 7); sheet.addMergedRegion(region); return rowNumber + 1; } int row = rowNumber; int endRow = rowNumber + runAlarm.size(); - for (;row < endRow ; row ++){ + for (; row < endRow; row++) { // 创建行 Row frow = sheet.createRow(row); - this.setTitileStyle(hssWB, frow, 7, false,false,HorizontalAlignment.CENTER); + this.setTitileStyle(hssWB, frow, 7, false, false, HorizontalAlignment.CENTER); // 组名 Cell frow_cell_1 = frow.getCell(0); frow_cell_1.setCellValue(runAlarm.get(row - rowNumber).getDeviceName()); @@ -1349,8 +1389,8 @@ public class RunMonthServiceImpl extends ServiceImpl Date: Sat, 7 Sep 2024 12:33:26 +0800 Subject: [PATCH 2/9] =?UTF-8?q?add:=E6=9C=88=E5=88=86=E6=9E=90=E8=AF=84?= =?UTF-8?q?=E4=BB=B7=E6=8E=A5=E5=8F=A3=E6=9B=B4=E6=96=B0=EF=BC=8C=E5=90=91?= =?UTF-8?q?=E9=87=8F=E9=85=8D=E7=BD=AE=E6=94=AF=E6=8C=81=E5=A4=9Aid?= =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/report/entity/RunMonthEntity.java | 3 ++ .../controller/VectorParamController.java | 7 ++-- .../maintenance/service/VectorParamService.java | 2 +- .../service/impl/VectorParamServiceImpl.java | 42 ++++++++++++---------- .../maintenance/vo/VectorSynchronizeRequest.java | 15 ++++++++ .../report/controller/RunMonthController.java | 2 +- .../report/service/RunMonthService.java | 8 +++-- .../report/service/impl/RunMonthServiceImpl.java | 29 +++++++++++++-- .../operational/report/vo/RunMonthEvaluateVO.java | 4 ++- .../operational/src/main/resources/db/3.0.3.sql | 4 +++ 10 files changed, 87 insertions(+), 29 deletions(-) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/VectorSynchronizeRequest.java create mode 100644 hzims-service/operational/src/main/resources/db/3.0.3.sql diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/entity/RunMonthEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/entity/RunMonthEntity.java index d646833..bdbf463 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/entity/RunMonthEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/entity/RunMonthEntity.java @@ -47,4 +47,7 @@ public class RunMonthEntity extends TenantEntity { @ApiModelProperty("评价") private String evaluation; + @ApiModelProperty("重新判定的结论") + private String conclusion; + } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java index 0f72ac5..a5db614 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java +++ b/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.hnac.hzims.bigmodel.maintenance.entity.VectorParamEntity; import com.hnac.hzims.bigmodel.maintenance.service.VectorParamService; +import com.hnac.hzims.bigmodel.maintenance.vo.VectorSynchronizeRequest; import com.hnac.hzinfo.api.annotation.ApiInterface; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -107,11 +108,11 @@ public class VectorParamController { return R.data(vectorParamService.getUrlResponseKeyList(url, bladeToken, hzinfoToken)); } - @PutMapping("/synchronization/{id}") + @PutMapping("/synchronization/") @ApiOperation(value = "同步") @ApiOperationSupport(order = 10) 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, @PathVariable Long id) throws JsonProcessingException { - return R.status(vectorParamService.synchronization(id, bladeToken, hzinfoToken)); + @RequestHeader(name = "Hzinfo-Auth", value = "Hzinfo-Auth", required = false) String hzinfoToken, @RequestBody VectorSynchronizeRequest req) throws JsonProcessingException { + return R.status(vectorParamService.synchronization(req.getIds(), bladeToken, hzinfoToken)); } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/VectorParamService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/VectorParamService.java index bc22e15..56f8269 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/VectorParamService.java +++ b/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 { List getUrlResponseKeyList(String url, String bladeToken, String hzinfoToken); - Boolean synchronization(Long id ,String bladeToken, String hzinfoToken); + Boolean synchronization(List id ,String bladeToken, String hzinfoToken); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java index 03c19fb..9a9af62 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java @@ -49,6 +49,7 @@ public class VectorParamServiceImpl extends ServiceImpl ids, String bladeToken, String hzinfoToken) { + if (null == ids && ids.isEmpty()) { return false; } - VectorUrlResponse response = getUrlResponse(entity.getUrl(), bladeToken, hzinfoToken); - if (response != null) { - ObjectMapper mapper = new ObjectMapper(); - JsonNode rootNode = null; - try { - rootNode = mapper.readTree(entity.getAttributeMap()); - } catch (JsonProcessingException e) { - e.printStackTrace(); + for (Long id : ids) { + VectorParamEntity entity = getById(id); + if (null == entity) { + return false; } - Map attrMap = new HashMap<>(); - Iterator iterator = rootNode.fieldNames(); - while (iterator.hasNext()) { - String key = iterator.next(); - attrMap.put(key, rootNode.findValue(key).textValue()); + VectorUrlResponse response = getUrlResponse(entity.getUrl(), bladeToken, hzinfoToken); + if (response != null) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode rootNode = null; + try { + rootNode = mapper.readTree(entity.getAttributeMap()); + } catch (JsonProcessingException e) { + log.error("getUrlResponseKeyList error", e); + } + Map attrMap = new HashMap<>(); + Iterator iterator = rootNode.fieldNames(); + while (iterator.hasNext()) { + String key = iterator.next(); + attrMap.put(key, rootNode.findValue(key).textValue()); + } + weaviateService.saveBatch(response.getOriginalData(), entity.getTableName(), attrMap); + this.update(Wrappers.lambdaUpdate().eq(VectorParamEntity::getId, id).set(VectorParamEntity::getUpdateTime, new Date())); } - weaviateService.saveBatch(response.getOriginalData(), entity.getTableName(), attrMap); - this.update(Wrappers.lambdaUpdate().eq(VectorParamEntity::getId, id).set(VectorParamEntity::getUpdateTime, new Date())); } return true; } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/VectorSynchronizeRequest.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/VectorSynchronizeRequest.java new file mode 100644 index 0000000..c3b0a54 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/VectorSynchronizeRequest.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.bigmodel.maintenance.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @Author: ypj + * @Date: 2024/9/7 11:04 + */ +@Data +public class VectorSynchronizeRequest { + + private List ids; +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java index 7e47281..784f4d7 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/RunMonthController.java @@ -66,6 +66,6 @@ public class RunMonthController { @ApiOperation(value = "站点月报评价", notes = "站点月报评价") @ApiOperationSupport(order = 6) public R evaluate(@RequestBody RunMonthEvaluateVO req) { - return R.data(runMonthService.evaluate(req.getId(), req.getText())); + return R.data(runMonthService.evaluate(req)); } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthService.java index 600b3d4..c3177fe 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/RunMonthService.java +++ b/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.hnac.hzims.operational.report.entity.RunMonthEntity; +import com.hnac.hzims.operational.report.vo.RunMonthEvaluateVO; /** @@ -19,11 +20,12 @@ public interface RunMonthService extends IService { /** * 生成分析结果 - * @param month 月份 + * + * @param month 月份 * @param stationCode 站点编号 * @return 大模型调用结果 */ - Boolean generateAnalyseResult(String month,String stationCode); + Boolean generateAnalyseResult(String month, String stationCode); - Boolean evaluate(Long id, String text); + Boolean evaluate(RunMonthEvaluateVO req); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java index a926c3e..7cbe87a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java +++ b/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.domian.SoeData; 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.core.response.HzPage; 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.springblade.core.log.exception.ServiceException; 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.*; import org.springframework.stereotype.Service; @@ -868,8 +870,31 @@ public class RunMonthServiceImpl extends ServiceImpllambdaUpdate().set(RunMonthEntity::getEvaluation, text).eq(RunMonthEntity::getId, id)); + public Boolean evaluate(RunMonthEvaluateVO req) { + RunMonthEntity entity = this.getById(req.getId()); + if (ObjectUtil.isEmpty(entity)) { + throw new HzServiceException("未查询到月报信息!"); + } + String conclusion = entity.getConclusion(); + Map conclusionMap = new HashMap<>(); + if (StringUtil.isNotBlank(conclusion)) { + conclusionMap = JsonUtil.toMap(conclusion); + } + String evaluation = entity.getEvaluation(); + Map evaluationMap = new HashMap<>(); + if (StringUtil.isNotBlank(evaluation)) { + evaluationMap = JsonUtil.toMap(evaluation); + } + if (StringUtil.isNotBlank(req.getContent())) { + conclusionMap.put(req.getType(), req.getContent()); + } + if (StringUtil.isNotBlank(req.getEvaluation())) { + evaluationMap.put(req.getType(), req.getEvaluation()); + } + return this.update(Wrappers.lambdaUpdate() + .set(RunMonthEntity::getConclusion, JsonUtil.toJson(conclusionMap)) + .set(RunMonthEntity::getEvaluation, JsonUtil.toJson(evaluationMap)) + .eq(RunMonthEntity::getId, req.getId())); } /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/RunMonthEvaluateVO.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/RunMonthEvaluateVO.java index 3e50ceb..27e81cc 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/RunMonthEvaluateVO.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/RunMonthEvaluateVO.java @@ -8,6 +8,8 @@ import lombok.Data; */ @Data public class RunMonthEvaluateVO { - private String text; + private String content; private Long id; + private String evaluation; + private String type; } diff --git a/hzims-service/operational/src/main/resources/db/3.0.3.sql b/hzims-service/operational/src/main/resources/db/3.0.3.sql new file mode 100644 index 0000000..593be3b --- /dev/null +++ b/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 '评价'; \ No newline at end of file From 625cc28bf3bedea834dccd764ec48c7cc3e160e0 Mon Sep 17 00:00:00 2001 From: luyie Date: Mon, 9 Sep 2024 11:22:31 +0800 Subject: [PATCH 3/9] =?UTF-8?q?add:=E6=A0=87=E6=B3=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenance/controller/AgentLogController.java | 61 ++++++++++++++++++++++ .../maintenance/entity/AgentLogEntity.java | 50 ++++++++++++++++++ .../maintenance/mapper/AgentLogMapper.java | 11 ++++ .../maintenance/service/AgentLogService.java | 11 ++++ .../service/impl/AgentLogServiceImpl.java | 22 ++++++++ 5 files changed, 155 insertions(+) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/AgentLogMapper.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java new file mode 100644 index 0000000..3fdb5e3 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java @@ -0,0 +1,61 @@ +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.AgentLogEntity; +import com.hnac.hzims.bigmodel.maintenance.service.AgentLogService; +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.*; + +/** + * @Author: ypj + * @Date: 2024/9/9 10:37 + */ +@RestController +@Slf4j +@AllArgsConstructor +public class AgentLogController { + private final AgentLogService agentLogService; + + @GetMapping("/listPage") + @ApiOperation(value = "分页查询") + @ApiOperationSupport(order = 1) + public R> listPage(Query query, AgentLogEntity req) { + return R.data(agentLogService.page(Condition.getPage(query), Condition.getQueryWrapper(new AgentLogEntity(), req))); + } + + @GetMapping("/detail") + @ApiOperation(value = "查看详情") + @ApiOperationSupport(order = 2) + public R detail(@RequestParam @ApiParam("主键ID") Long id) { + return R.data(agentLogService.getById(id)); + } + + @PostMapping("/save") + @ApiOperation(value = "保存") + @ApiOperationSupport(order = 3) + public R save(@RequestParam 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)); + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java new file mode 100644 index 0000000..b28e64b --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java @@ -0,0 +1,50 @@ +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 org.springblade.core.tenant.mp.TenantEntity; + +import java.io.Serializable; + +/** + * @Author: ypj + * @Date: 2024/9/9 10:38 + */ +@ApiModel("问题标注") +@TableName("agent_log") +@Data +public class AgentLogEntity extends TenantEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("对话id") + @TableField("CHAT_ID") + private String chatId; + + @ApiModelProperty("问题id") + @TableField("Q_ID") + private String qId; + + @ApiModelProperty("问题来源") + private String agent; + + @ApiModelProperty("问题") + private String q; + + @ApiModelProperty("答案") + private String a; + + @ApiModelProperty("答案类型") + private String aType; + + @ApiModelProperty("用户结论,0为错误,1为正确") + private int userConclusion; + + @ApiModelProperty("标注状态,0为未标注,1为已标注") + private int labelStatus; + + @ApiModelProperty("标注内容,json字符串,答案类型不一样格式不一样") + private String labelContent; +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/AgentLogMapper.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/AgentLogMapper.java new file mode 100644 index 0000000..fe6747d --- /dev/null +++ b/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 { +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java new file mode 100644 index 0000000..40a2fce --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.bigmodel.maintenance.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.bigmodel.maintenance.entity.AgentLogEntity; + +/** + * @Author: ypj + * @Date: 2024/9/9 11:08 + */ +public interface AgentLogService extends IService { +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java new file mode 100644 index 0000000..4d55558 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.bigmodel.maintenance.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +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 lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * @Author: ypj + * @Date: 2024/9/9 11:10 + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("hznlm") +public class AgentLogServiceImpl extends ServiceImpl implements AgentLogService { + +} From a1a739bef72ae9dd7ffa96ccc1994dac1baf9596 Mon Sep 17 00:00:00 2001 From: luyie Date: Mon, 9 Sep 2024 20:56:48 +0800 Subject: [PATCH 4/9] =?UTF-8?q?add:=E5=A4=A7=E6=A8=A1=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=A0=87=E6=B3=A8=EF=BC=8C=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenance/controller/AgentLogController.java | 13 +++++++++++- .../controller/VectorParamController.java | 4 ++-- .../maintenance/entity/AgentLogEntity.java | 24 ++++++++++++++++++++++ .../maintenance/service/AgentLogService.java | 2 ++ .../service/impl/AgentLogServiceImpl.java | 9 ++++++++ .../hzims/bigmodel/maintenance/vo/IdsRequest.java | 15 ++++++++++++++ .../maintenance/vo/VectorSynchronizeRequest.java | 15 -------------- .../report/service/impl/RunMonthServiceImpl.java | 11 ++++++++++ 8 files changed, 75 insertions(+), 18 deletions(-) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdsRequest.java delete mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/VectorSynchronizeRequest.java diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java index 3fdb5e3..fc81a73 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; 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 io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; @@ -21,6 +23,8 @@ import org.springframework.web.bind.annotation.*; @RestController @Slf4j @AllArgsConstructor +@RequestMapping("/label") +@Api(value = "问题标注", tags = "问题标注") public class AgentLogController { private final AgentLogService agentLogService; @@ -41,7 +45,7 @@ public class AgentLogController { @PostMapping("/save") @ApiOperation(value = "保存") @ApiOperationSupport(order = 3) - public R save(@RequestParam AgentLogEntity req) { + public R save(@RequestBody AgentLogEntity req) { return R.status(agentLogService.save(req)); } @@ -58,4 +62,11 @@ public class AgentLogController { 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)); + } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java index a5db614..e178519 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.bigmodel.maintenance.entity.VectorParamEntity; import com.hnac.hzims.bigmodel.maintenance.service.VectorParamService; -import com.hnac.hzims.bigmodel.maintenance.vo.VectorSynchronizeRequest; +import com.hnac.hzims.bigmodel.maintenance.vo.IdsRequest; import com.hnac.hzinfo.api.annotation.ApiInterface; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -112,7 +112,7 @@ public class VectorParamController { @ApiOperation(value = "同步") @ApiOperationSupport(order = 10) 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, @RequestBody VectorSynchronizeRequest req) throws JsonProcessingException { + @RequestHeader(name = "Hzinfo-Auth", value = "Hzinfo-Auth", required = false) String hzinfoToken, @RequestBody IdsRequest req) throws JsonProcessingException { return R.status(vectorParamService.synchronization(req.getIds(), bladeToken, hzinfoToken)); } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java index b28e64b..e23c793 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java @@ -1,10 +1,13 @@ 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; @@ -21,30 +24,51 @@ public class AgentLogEntity extends TenantEntity implements Serializable { @ApiModelProperty("对话id") @TableField("CHAT_ID") + @QueryField(condition = SqlCondition.EQUAL) private String chatId; @ApiModelProperty("问题id") @TableField("Q_ID") + @QueryField(condition = SqlCondition.EQUAL) private String qId; @ApiModelProperty("问题来源") + @QueryField(condition = SqlCondition.EQUAL) private String agent; @ApiModelProperty("问题") + @QueryField(condition = SqlCondition.LIKE) private String q; + @ApiModelProperty("问题提示") + @QueryField(condition = SqlCondition.LIKE) + @TableField("Q_HINT") + @JSONField(name = "qHint") + private String qHint; + @ApiModelProperty("答案") + @QueryField(condition = SqlCondition.LIKE) private String a; @ApiModelProperty("答案类型") + @QueryField(condition = SqlCondition.EQUAL) + @TableField("A_TYPE") + @JSONField(name = "aType") private String aType; @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("标注内容,json字符串,答案类型不一样格式不一样") + @QueryField(condition = SqlCondition.LIKE) + @TableField("LABEL_CONTENT") private String labelContent; + } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java index 40a2fce..35bc35a 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java @@ -2,10 +2,12 @@ package com.hnac.hzims.bigmodel.maintenance.service; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.bigmodel.maintenance.entity.AgentLogEntity; +import com.hnac.hzims.bigmodel.maintenance.vo.IdsRequest; /** * @Author: ypj * @Date: 2024/9/9 11:08 */ public interface AgentLogService extends IService { + Boolean BatchLabel(IdsRequest ids); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java index 4d55558..85c3e40 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java @@ -1,10 +1,12 @@ package com.hnac.hzims.bigmodel.maintenance.service.impl; import com.baomidou.dynamic.datasource.annotation.DS; +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 lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -19,4 +21,11 @@ import org.springframework.stereotype.Service; @DS("hznlm") public class AgentLogServiceImpl extends ServiceImpl implements AgentLogService { + @Override + public Boolean BatchLabel(IdsRequest ids) { + return this.update(Wrappers.lambdaUpdate() + .set(AgentLogEntity::getLabelStatus, 1) + .in(AgentLogEntity::getId, ids.getIds())); + } + } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdsRequest.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdsRequest.java new file mode 100644 index 0000000..122aa7c --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdsRequest.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.bigmodel.maintenance.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @Author: ypj + * @Date: 2024/9/7 11:04 + */ +@Data +public class IdsRequest { + + private List ids; +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/VectorSynchronizeRequest.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/VectorSynchronizeRequest.java deleted file mode 100644 index c3b0a54..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/VectorSynchronizeRequest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.hnac.hzims.bigmodel.maintenance.vo; - -import lombok.Data; - -import java.util.List; - -/** - * @Author: ypj - * @Date: 2024/9/7 11:04 - */ -@Data -public class VectorSynchronizeRequest { - - private List ids; -} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java index 7cbe87a..9c89fc7 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java @@ -875,23 +875,34 @@ public class RunMonthServiceImpl extends ServiceImpl analyseResultMap = new HashMap<>(); + if (StringUtil.isNotBlank(analyseResult)) { + analyseResultMap = JsonUtil.toMap(analyseResult); + } + String conclusion = entity.getConclusion(); Map conclusionMap = new HashMap<>(); if (StringUtil.isNotBlank(conclusion)) { conclusionMap = JsonUtil.toMap(conclusion); } + String evaluation = entity.getEvaluation(); Map 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.lambdaUpdate() + .set(RunMonthEntity::getAnalyseResult, JsonUtil.toJson(analyseResultMap)) .set(RunMonthEntity::getConclusion, JsonUtil.toJson(conclusionMap)) .set(RunMonthEntity::getEvaluation, JsonUtil.toJson(evaluationMap)) .eq(RunMonthEntity::getId, req.getId())); From a5a1b46487d57b4f106c733d28a02f9777c7a3c0 Mon Sep 17 00:00:00 2001 From: luyie Date: Mon, 9 Sep 2024 20:59:41 +0800 Subject: [PATCH 5/9] =?UTF-8?q?add:=E6=A0=87=E6=B3=A8=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java index e23c793..119cc4b 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java @@ -30,6 +30,7 @@ public class AgentLogEntity extends TenantEntity implements Serializable { @ApiModelProperty("问题id") @TableField("Q_ID") @QueryField(condition = SqlCondition.EQUAL) + @JSONField(name = "qId") private String qId; @ApiModelProperty("问题来源") From a3fafcf0a4e3e637e0b275632826818807b9144f Mon Sep 17 00:00:00 2001 From: luyie Date: Tue, 10 Sep 2024 15:01:47 +0800 Subject: [PATCH 6/9] =?UTF-8?q?add:=E5=A4=A7=E6=A8=A1=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E6=A0=87=E6=B3=A8=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5=E5=92=8C?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenance/controller/AgentLogController.java | 13 +++++- .../maintenance/entity/AgentLogEntity.java | 47 +++++++++++++++------- .../maintenance/service/AgentLogService.java | 6 +++ .../service/impl/AgentLogServiceImpl.java | 44 ++++++++++++++++++++ .../hzims/bigmodel/maintenance/vo/IdsRequest.java | 4 ++ .../bigmodel/maintenance/vo/LabelRequest.java | 19 +++++++++ 6 files changed, 118 insertions(+), 15 deletions(-) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/LabelRequest.java diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java index fc81a73..32b9fa6 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java @@ -1,10 +1,13 @@ 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; @@ -14,6 +17,7 @@ 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.*; /** @@ -32,7 +36,7 @@ public class AgentLogController { @ApiOperation(value = "分页查询") @ApiOperationSupport(order = 1) public R> listPage(Query query, AgentLogEntity req) { - return R.data(agentLogService.page(Condition.getPage(query), Condition.getQueryWrapper(new AgentLogEntity(), req))); + return R.data(agentLogService.listPage(Condition.getPage(query), req)); } @GetMapping("/detail") @@ -69,4 +73,11 @@ public class AgentLogController { 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)); + } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java index 119cc4b..fd1d6dc 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java @@ -11,6 +11,7 @@ import org.springblade.core.mp.support.SqlCondition; import org.springblade.core.tenant.mp.TenantEntity; import java.io.Serializable; +import java.util.Date; /** * @Author: ypj @@ -23,16 +24,21 @@ public class AgentLogEntity extends TenantEntity implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty("对话id") - @TableField("CHAT_ID") + @TableField("chat_id") @QueryField(condition = SqlCondition.EQUAL) private String chatId; @ApiModelProperty("问题id") - @TableField("Q_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; @@ -43,33 +49,46 @@ public class AgentLogEntity extends TenantEntity implements Serializable { @ApiModelProperty("问题提示") @QueryField(condition = SqlCondition.LIKE) - @TableField("Q_HINT") - @JSONField(name = "qHint") - private String qHint; + @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("答案类型") - @QueryField(condition = SqlCondition.EQUAL) - @TableField("A_TYPE") - @JSONField(name = "aType") - private String aType; - @ApiModelProperty("用户结论,0为错误,1为正确") @QueryField(condition = SqlCondition.EQUAL) - @TableField("USER_CONCLUSION") + @TableField("user_conclusion") private int userConclusion; @ApiModelProperty("标注状态,0为未标注,1为已标注") @QueryField(condition = SqlCondition.EQUAL) - @TableField("LABEL_STATUS") + @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") + @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; } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java index 35bc35a..00da361 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java @@ -1,8 +1,10 @@ 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 @@ -10,4 +12,8 @@ import com.hnac.hzims.bigmodel.maintenance.vo.IdsRequest; */ public interface AgentLogService extends IService { Boolean BatchLabel(IdsRequest ids); + + Boolean label(LabelRequest req); + + IPage listPage(IPage page, AgentLogEntity req); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java index 85c3e40..558dfc0 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java @@ -1,16 +1,24 @@ 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 @@ -21,11 +29,47 @@ import org.springframework.stereotype.Service; @DS("hznlm") public class AgentLogServiceImpl extends ServiceImpl implements AgentLogService { + @Override public Boolean BatchLabel(IdsRequest ids) { + Date now = new Date(); return this.update(Wrappers.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.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 listPage(IPage page, AgentLogEntity req) { + LambdaQueryWrapper queryWrapper = Wrappers.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); + } + } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdsRequest.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdsRequest.java index 122aa7c..af3b60f 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdsRequest.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdsRequest.java @@ -1,5 +1,7 @@ package com.hnac.hzims.bigmodel.maintenance.vo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @@ -9,7 +11,9 @@ import java.util.List; * @Date: 2024/9/7 11:04 */ @Data +@ApiModel("批量操作请求") public class IdsRequest { + @ApiModelProperty("主键ID,按逗号分隔") private List ids; } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/LabelRequest.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/LabelRequest.java new file mode 100644 index 0000000..6389578 --- /dev/null +++ b/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; +} From 1b842485004fbe9dcbbbe454bb161a71e9109466 Mon Sep 17 00:00:00 2001 From: luyie Date: Tue, 10 Sep 2024 17:27:31 +0800 Subject: [PATCH 7/9] =?UTF-8?q?add:=E5=A4=A7=E6=A8=A1=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E7=9F=A5=E8=AF=86=E5=BA=93=EF=BC=8C=E6=96=87=E4=BB=B6=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/KnowledgeFileInfoController.java | 76 ++++++++++++++++++++++ .../maintenance/entity/KnowledgeFileInfo.java | 56 ++++++++++++++++ .../mapper/KnowledgeFileInfoMapper.java | 11 ++++ .../service/KnowledgeFileInfoService.java | 11 ++++ .../service/impl/AgentLogServiceImpl.java | 1 - .../service/impl/KnowledgeFileInfoServiceImpl.java | 19 ++++++ 6 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileInfoMapper.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java new file mode 100644 index 0000000..086c632 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java @@ -0,0 +1,76 @@ +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 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.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> 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 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("/upload") + @ApiOperation(value = "上传文件") + @ApiOperationSupport(order = 6) + public R upload(@ApiParam(value = "上传文件", required = true) @RequestParam("file") MultipartFile file) { + return ossClient.putFile(file); + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java new file mode 100644 index 0000000..d3ff16d --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java @@ -0,0 +1,56 @@ +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.tenant.mp.TenantEntity; + +import java.io.Serializable; + +/** + * @Author: ypj + * @Date: 2024/9/10 15:17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("HZIMS_KNOWLEDGE_FILE_INFO") +@ApiModel(value = "知识库文件信息",description = "知识库文件信息") +public class KnowledgeFileInfo extends TenantEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("文件名称") + private String name; + + @ApiModelProperty("文件url") + private String url; + + @ApiModelProperty("文件大小") + private Long size; + + @ApiModelProperty("简介") + private String briefs; + + @ApiModelProperty("标签") + private String tags; + + @ApiModelProperty("业务领域") + private String domain; + + @ApiModelProperty("权限等级,5个等级") + @TableField("AUTHORITY_CLASS") + private Integer authorityClass; + + @ApiModelProperty("是否可见,0为不可见,1为可见") + private Integer visible; + + @ApiModelProperty("文件状态,0为未入库,1为已入库") + @TableField("FILE_STATUS") + private Integer fileStatus; + + @ApiModelProperty("备注") + private String remark; + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileInfoMapper.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileInfoMapper.java new file mode 100644 index 0000000..ed64b9a --- /dev/null +++ b/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 { +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java new file mode 100644 index 0000000..81f58c9 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.bigmodel.maintenance.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileInfo; + +/** + * @Author: ypj + * @Date: 2024/9/10 16:42 + */ +public interface KnowledgeFileInfoService extends IService { +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java index 558dfc0..7b45d20 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java @@ -29,7 +29,6 @@ import java.util.Date; @DS("hznlm") public class AgentLogServiceImpl extends ServiceImpl implements AgentLogService { - @Override public Boolean BatchLabel(IdsRequest ids) { Date now = new Date(); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java new file mode 100644 index 0000000..9fc1ad7 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.bigmodel.maintenance.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +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 lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * @Author: ypj + * @Date: 2024/9/10 16:43 + */ +@Service +@Slf4j +@AllArgsConstructor +public class KnowledgeFileInfoServiceImpl extends ServiceImpl implements KnowledgeFileInfoService { +} From a48498db9ad18b86ba1049ba982ef643450dcbfa Mon Sep 17 00:00:00 2001 From: luyie Date: Tue, 10 Sep 2024 19:05:06 +0800 Subject: [PATCH 8/9] =?UTF-8?q?add:=E5=A4=A7=E6=A8=A1=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E7=9F=A5=E8=AF=86=E5=BA=93=E7=AE=A1=E7=90=86=EF=BC=8C=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigmodel/maintenance/controller/KnowledgeFileInfoController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java index 086c632..e6a7008 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java @@ -15,6 +15,7 @@ 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; @@ -67,10 +68,10 @@ public class KnowledgeFileInfoController { return R.status(knowledgeFileInfoService.removeByIds(Func.toLongList(",", ids))); } - @PostMapping("/upload") + @PostMapping(value = "/upload", produces = MediaType.APPLICATION_PROBLEM_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @ApiOperation(value = "上传文件") @ApiOperationSupport(order = 6) - public R upload(@ApiParam(value = "上传文件", required = true) @RequestParam("file") MultipartFile file) { + public R upload(@ApiParam(value = "上传文件", required = true) @RequestPart("file") MultipartFile file) { return ossClient.putFile(file); } } From 1b78157c7dc359a5f109206fab07e1b5dda4a985 Mon Sep 17 00:00:00 2001 From: luyie Date: Wed, 11 Sep 2024 16:38:07 +0800 Subject: [PATCH 9/9] =?UTF-8?q?add:=E5=A4=A7=E6=A8=A1=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E7=9F=A5=E8=AF=86=E5=BA=93=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86?= =?UTF-8?q?=EF=BC=8C=E6=96=87=E4=BB=B6=E5=88=86=E6=AE=B5=EF=BC=8C=E5=85=A5?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenance/constants/StoreStatus.java | 32 ++++++++++ .../KnowledgeFileFragmentController.java | 72 ++++++++++++++++++++++ .../controller/KnowledgeFileInfoController.java | 10 ++- .../maintenance/entity/AgentLogEntity.java | 2 +- .../maintenance/entity/KnowledgeFileFragment.java | 46 ++++++++++++++ .../maintenance/entity/KnowledgeFileInfo.java | 16 ++++- .../maintenance/entity/VectorParamEntity.java | 2 +- .../mapper/KnowledgeFileFragmentMapper.java | 11 ++++ .../service/KnowledgeFileFragmentService.java | 14 +++++ .../service/KnowledgeFileInfoService.java | 2 + .../impl/KnowledgeFileFragmentServiceImpl.java | 34 ++++++++++ .../service/impl/KnowledgeFileInfoServiceImpl.java | 17 +++++ .../service/impl/VectorParamServiceImpl.java | 2 + .../hzims/bigmodel/maintenance/vo/IdRequest.java | 16 +++++ 14 files changed, 271 insertions(+), 5 deletions(-) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/constants/StoreStatus.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileFragmentController.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileFragment.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileFragmentMapper.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileFragmentService.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileFragmentServiceImpl.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdRequest.java diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/constants/StoreStatus.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/constants/StoreStatus.java new file mode 100644 index 0000000..b100870 --- /dev/null +++ b/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; + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileFragmentController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileFragmentController.java new file mode 100644 index 0000000..bf97c49 --- /dev/null +++ b/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> 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 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> getByDocId(@RequestParam @ApiParam("主键ID") Long docId) { + return R.data(knowledgeFileFragmentService.getByDocId(docId)); + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java index e6a7008..5ea94d6 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java @@ -4,6 +4,7 @@ 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; @@ -37,7 +38,7 @@ public class KnowledgeFileInfoController { @ApiOperationSupport(order = 1) public R> listPage(Query query, KnowledgeFileInfo req) { return R.data(knowledgeFileInfoService.page(Condition.getPage(query), - Condition.getQueryWrapper(new KnowledgeFileInfo(), req).orderByDesc(KnowledgeFileInfo::getCreateTime))); + Condition.getQueryWrapper(new KnowledgeFileInfo(), req).orderByDesc(KnowledgeFileInfo::getCreateTime))); } @GetMapping("/detail") @@ -74,4 +75,11 @@ public class KnowledgeFileInfoController { public R 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)); + } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java index fd1d6dc..2931615 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java @@ -18,7 +18,7 @@ import java.util.Date; * @Date: 2024/9/9 10:38 */ @ApiModel("问题标注") -@TableName("agent_log") +@TableName("gglm_agent_log") @Data public class AgentLogEntity extends TenantEntity implements Serializable { private static final long serialVersionUID = 1L; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileFragment.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileFragment.java new file mode 100644 index 0000000..2982ae1 --- /dev/null +++ b/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; + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java index d3ff16d..a1f6ab2 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java @@ -6,6 +6,8 @@ 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; @@ -16,41 +18,51 @@ import java.io.Serializable; */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("HZIMS_KNOWLEDGE_FILE_INFO") +@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为已入库") + @ApiModelProperty("文件状态,0为未入库,1为已入库,2为入库中") @TableField("FILE_STATUS") + @QueryField(condition = SqlCondition.EQUAL) private Integer fileStatus; @ApiModelProperty("备注") + @QueryField(condition = SqlCondition.LIKE) private String remark; } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/VectorParamEntity.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/VectorParamEntity.java index 6553578..72ed2d8 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/VectorParamEntity.java +++ b/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 */ @ApiModel("向量参数配置") -@TableName("HZIMS_VECTOR_PARAM") +@TableName("gglm_vector_param") @Data public class VectorParamEntity extends TenantEntity implements Serializable { private static final long serialVersionUID = 1L; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileFragmentMapper.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileFragmentMapper.java new file mode 100644 index 0000000..0bfe6fd --- /dev/null +++ b/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 { +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileFragmentService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileFragmentService.java new file mode 100644 index 0000000..5851b8e --- /dev/null +++ b/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 { + List getByDocId(Long docId); +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java index 81f58c9..aa8482f 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java @@ -2,10 +2,12 @@ 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 { + Boolean store(IdRequest req); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileFragmentServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileFragmentServiceImpl.java new file mode 100644 index 0000000..c1ebffa --- /dev/null +++ b/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 implements KnowledgeFileFragmentService { + private KnowledgeFileFragmentMapper knowledgeFileFragmentMapper; + + @Override + public List getByDocId(Long docId) { + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery() + .eq(KnowledgeFileFragment::getDocId, docId) + .orderByAsc(KnowledgeFileFragment::getDocPageIndex); + return knowledgeFileFragmentMapper.selectList(queryWrapper); + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java index 9fc1ad7..c367af7 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java @@ -1,9 +1,14 @@ 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; @@ -15,5 +20,17 @@ import org.springframework.stereotype.Service; @Service @Slf4j @AllArgsConstructor +@DS("hznlm") public class KnowledgeFileInfoServiceImpl extends ServiceImpl implements KnowledgeFileInfoService { + private final KnowledgeFileInfoMapper knowledgeFileInfoMapper; + + @Override + public Boolean store(IdRequest req) { + KnowledgeFileInfo knowledgeFileInfo = knowledgeFileInfoMapper.selectById(req.getId()); + + LambdaUpdateWrapper queryWrapper = Wrappers.lambdaUpdate() + .set(KnowledgeFileInfo::getFileStatus, StoreStatus.STORING.getCode()) + .eq(KnowledgeFileInfo::getId, req.getId()); + return this.update(queryWrapper); + } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java index 9a9af62..fcb265f 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; 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.fasterxml.jackson.core.JsonProcessingException; @@ -30,6 +31,7 @@ import java.util.*; @Service @Slf4j @AllArgsConstructor +@DS("hznlm") public class VectorParamServiceImpl extends ServiceImpl implements VectorParamService { private static final String CLIENT_SIGN = "vector_param"; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdRequest.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdRequest.java new file mode 100644 index 0000000..113c03b --- /dev/null +++ b/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; +}