haungxing
2 months ago
20 changed files with 695 additions and 7 deletions
@ -0,0 +1,49 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.business.constants; |
||||||
|
|
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
import java.util.concurrent.ConcurrentHashMap; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: ypj |
||||||
|
* @Date: 2024/9/20 22:39 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
public enum AccessRules { |
||||||
|
MOST_EARLY("0", "最早值"), |
||||||
|
LARGEST("1", "最大值"), |
||||||
|
SMALLEST("2", "最小值"), |
||||||
|
AVERAGE("3", "平均值"), |
||||||
|
SUM("4", "累计值/和值"), |
||||||
|
CHANGE("5", "变化值/差值"), |
||||||
|
LAST("6", "最新值/最后值"); |
||||||
|
|
||||||
|
private final String code; |
||||||
|
private final String desc; |
||||||
|
|
||||||
|
private static final Map<String, AccessRules> map = new ConcurrentHashMap<>(); |
||||||
|
|
||||||
|
static { |
||||||
|
for (AccessRules accessRules : AccessRules.values()) { |
||||||
|
map.put(accessRules.code, accessRules); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
AccessRules(String code, String desc) { |
||||||
|
this.code = code; |
||||||
|
this.desc = desc; |
||||||
|
} |
||||||
|
|
||||||
|
public static AccessRules getByCode(String code) { |
||||||
|
return map.get(code); |
||||||
|
} |
||||||
|
|
||||||
|
public static String getDescByCode(String code) { |
||||||
|
AccessRules rule = getByCode(code); |
||||||
|
if (null != rule) { |
||||||
|
return rule.getDesc(); |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.business.service; |
||||||
|
|
||||||
|
import com.hnac.gglm.bigmodel.maintenance.dto.KnowledgeData; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: ypj |
||||||
|
* @Date: 2024/9/20 15:04 |
||||||
|
*/ |
||||||
|
public interface KnowledgeDataService { |
||||||
|
List<KnowledgeData> listKnowledgeData(); |
||||||
|
} |
@ -0,0 +1,49 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.business.service.impl; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS; |
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException; |
||||||
|
import com.fasterxml.jackson.databind.JsonNode; |
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||||
|
import com.hnac.gglm.bigmodel.business.service.KnowledgeDataService; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.dto.KnowledgeData; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.mapper.KnowledgeFileFragmentMapper; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: ypj |
||||||
|
* @Date: 2024/9/20 15:04 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
@Slf4j |
||||||
|
@AllArgsConstructor |
||||||
|
@DS("hznlm") |
||||||
|
public class KnowledgeDataServiceImpl implements KnowledgeDataService { |
||||||
|
KnowledgeFileFragmentMapper knowledgeFileFragmentMapper; |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<KnowledgeData> listKnowledgeData() { |
||||||
|
List<KnowledgeData> resourceList = knowledgeFileFragmentMapper.listKnowledgeData(); |
||||||
|
List<KnowledgeData> resultList = new ArrayList<>(); |
||||||
|
for (KnowledgeData item : resourceList) { |
||||||
|
String question = item.getDocQs(); |
||||||
|
List<String> questionList = JSONObject.parseArray(question, String.class); |
||||||
|
for (String q : questionList) { |
||||||
|
KnowledgeData data = new KnowledgeData(); |
||||||
|
data.setDocId(item.getDocId()); |
||||||
|
data.setDocContent(item.getDocContent()); |
||||||
|
data.setDocPageIndex(item.getDocPageIndex()); |
||||||
|
data.setDocQs(q); |
||||||
|
data.setArea(item.getArea()); |
||||||
|
data.setLevel(item.getLevel()); |
||||||
|
resultList.add(data); |
||||||
|
} |
||||||
|
} |
||||||
|
return resultList; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,69 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.dto.DeviceFuncDTO; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.service.DataInstructService; |
||||||
|
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity; |
||||||
|
import com.hnac.hzinfo.api.annotation.ApiInterface; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import io.swagger.annotations.ApiParam; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
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 javax.validation.Valid; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("/dataInstruct") |
||||||
|
@Api(value = "控制指令管理",tags = "控制指令管理") |
||||||
|
@AllArgsConstructor |
||||||
|
public class DataInstructController { |
||||||
|
|
||||||
|
private DataInstructService dataInstructService; |
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/save") |
||||||
|
@ApiOperation("保存控制指令") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
public R save(@RequestBody @Valid DataInstructEntity req) { |
||||||
|
return R.data(dataInstructService.save(req)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/update") |
||||||
|
@ApiOperation("编辑控制指令") |
||||||
|
@ApiOperationSupport(order = 2) |
||||||
|
public R update(@RequestBody DataInstructEntity req) { |
||||||
|
return R.data(dataInstructService.updateById(req)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/listPage") |
||||||
|
@ApiOperation("控制指令列表查询") |
||||||
|
@ApiOperationSupport(order = 3) |
||||||
|
public R<IPage<DataInstructEntity>> listPage(Query query, DataInstructEntity req) { |
||||||
|
return R.data(dataInstructService.page(Condition.getPage(query),Condition.getQueryWrapper(req).lambda())); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("/removeByIds") |
||||||
|
@ApiOperation("删除控制指令") |
||||||
|
@ApiOperationSupport(order = 4) |
||||||
|
public R removeByIds(@RequestParam @ApiParam("id,按逗号分隔") String ids) { |
||||||
|
return R.status(dataInstructService.removeByIds(Func.toLongList(",",ids))); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@GetMapping ("/getDataInstructList") |
||||||
|
@ApiOperationSupport(order = 210) |
||||||
|
@ApiOperation(value = "查询指令记录") |
||||||
|
@ApiInterface |
||||||
|
public R<List<DeviceFuncDTO>> getDataInstructList() { |
||||||
|
return R.data(dataInstructService.getDataInstructList()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,66 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.dto.DeviceAttrDTO; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.service.DataRecordService; |
||||||
|
import com.hnac.hzinfo.api.annotation.ApiInterface; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import io.swagger.annotations.ApiParam; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
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 javax.validation.Valid; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("/dataRecord") |
||||||
|
@Api(value = "数据记录管理",tags = "数据记录管理") |
||||||
|
@AllArgsConstructor |
||||||
|
public class DataRecordController { |
||||||
|
|
||||||
|
private DataRecordService dataRecordService; |
||||||
|
|
||||||
|
@PostMapping("/save") |
||||||
|
@ApiOperation("保存数据记录信息") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
public R save(@RequestBody @Valid DataRecordEntity req) { |
||||||
|
return R.data(dataRecordService.save(req)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/update") |
||||||
|
@ApiOperation("编辑数据记录信息") |
||||||
|
@ApiOperationSupport(order = 2) |
||||||
|
public R update(@RequestBody DataRecordEntity req) { |
||||||
|
return R.data(dataRecordService.updateById(req)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/listPage") |
||||||
|
@ApiOperation("数据记录列表查询") |
||||||
|
@ApiOperationSupport(order = 3) |
||||||
|
public R<IPage<DataRecordEntity>> listPage(Query query, DataRecordEntity req) { |
||||||
|
return R.data(dataRecordService.page(Condition.getPage(query),Condition.getQueryWrapper(req).lambda())); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("/removeByIds") |
||||||
|
@ApiOperation("删除数据记录") |
||||||
|
@ApiOperationSupport(order = 4) |
||||||
|
public R removeByIds(@RequestParam @ApiParam("id,按逗号分隔") String ids) { |
||||||
|
return R.status(dataRecordService.removeByIds(Func.toLongList(",",ids))); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping ("/getDataRecordList") |
||||||
|
@ApiOperationSupport(order = 200) |
||||||
|
@ApiOperation(value = "查询数据记录记录") |
||||||
|
@ApiInterface |
||||||
|
public R<List<DeviceAttrDTO>> getDataRecordList() { |
||||||
|
return R.data(dataRecordService.getDataRecordList()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,33 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.dto; |
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class DeviceAttrDTO { |
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty("item") |
||||||
|
private String itemId; |
||||||
|
|
||||||
|
@ApiModelProperty("站点名称") |
||||||
|
private String stationName; |
||||||
|
|
||||||
|
@ApiModelProperty("站点ID") |
||||||
|
private String stationId; |
||||||
|
|
||||||
|
@ApiModelProperty("遥控的设备名称") |
||||||
|
private String deviceName; |
||||||
|
|
||||||
|
@ApiModelProperty("遥控的设备ID") |
||||||
|
private String deviceId; |
||||||
|
|
||||||
|
@ApiModelProperty("用于展示和匹配的全称,一般可设为 站点名称-遥控名称") |
||||||
|
private String itemName; |
||||||
|
|
||||||
|
@ApiModelProperty("记录名称") |
||||||
|
private String recordName; |
||||||
|
|
||||||
|
@ApiModelProperty("取数规则") |
||||||
|
private String rule; |
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.dto; |
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
|
||||||
|
@Data |
||||||
|
public class DeviceFuncDTO { |
||||||
|
|
||||||
|
@ApiModelProperty("item") |
||||||
|
private String itemId; |
||||||
|
|
||||||
|
@ApiModelProperty("站点名称") |
||||||
|
private String stationName; |
||||||
|
|
||||||
|
@ApiModelProperty("站点ID") |
||||||
|
private String stationId; |
||||||
|
|
||||||
|
@ApiModelProperty("遥控的设备名称") |
||||||
|
private String deviceName; |
||||||
|
|
||||||
|
@ApiModelProperty("遥控的设备ID") |
||||||
|
private String deviceId; |
||||||
|
|
||||||
|
@ApiModelProperty("用于展示和匹配的全称,一般可设为 站点名称-遥控名称") |
||||||
|
private String itemName; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.dto; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: ypj |
||||||
|
* @Date: 2024/9/20 15:07 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@ApiModel(value = "知识库文件分片信息", description = "知识库文件分片信息") |
||||||
|
public class KnowledgeData { |
||||||
|
@ApiModelProperty("文档ID") |
||||||
|
@TableField("DOC_ID") |
||||||
|
private Long docId; |
||||||
|
|
||||||
|
@ApiModelProperty("文档问题") |
||||||
|
@TableField("DOC_QS") |
||||||
|
private String docQs; |
||||||
|
|
||||||
|
@ApiModelProperty("文档内容") |
||||||
|
@TableField("DOC_CONTENT") |
||||||
|
private String docContent; |
||||||
|
|
||||||
|
@ApiModelProperty("文档页码") |
||||||
|
@TableField("DOC_PAGE_INDEX") |
||||||
|
private Integer docPageIndex; |
||||||
|
|
||||||
|
@ApiModelProperty("知识库领域") |
||||||
|
private String area; |
||||||
|
|
||||||
|
@ApiModelProperty("等级") |
||||||
|
private Integer level; |
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.entity; |
||||||
|
|
||||||
|
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; |
||||||
|
|
||||||
|
@Data |
||||||
|
@EqualsAndHashCode |
||||||
|
@TableName("gglm_data_instruct") |
||||||
|
@ApiModel(value = "自定义控制指令表",description = "自定义控制指令表") |
||||||
|
public class DataInstructEntity extends TenantEntity { |
||||||
|
|
||||||
|
@ApiModelProperty("item") |
||||||
|
private String itemId; |
||||||
|
|
||||||
|
@ApiModelProperty("站点名称") |
||||||
|
@QueryField(condition = SqlCondition.LIKE) |
||||||
|
private String stationName; |
||||||
|
|
||||||
|
@ApiModelProperty("站点ID") |
||||||
|
private String stationId; |
||||||
|
|
||||||
|
@ApiModelProperty("遥控的设备名称") |
||||||
|
@QueryField(condition = SqlCondition.LIKE) |
||||||
|
private String deviceName; |
||||||
|
|
||||||
|
@ApiModelProperty("遥控的设备ID") |
||||||
|
private String deviceId; |
||||||
|
|
||||||
|
@ApiModelProperty("遥控名称(不包含站点)") |
||||||
|
@QueryField(condition = SqlCondition.LIKE) |
||||||
|
private String ykName; |
||||||
|
|
||||||
|
@ApiModelProperty("用于展示和匹配的全称,一般可设为 站点名称-遥控名称") |
||||||
|
private String itemName; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity; |
||||||
|
|
||||||
|
public interface DataInstructMapper extends BaseMapper<DataInstructEntity> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,7 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity; |
||||||
|
|
||||||
|
public interface DataRecordMapper extends BaseMapper<DataRecordEntity> { |
||||||
|
} |
@ -1,11 +1,15 @@ |
|||||||
package com.hnac.gglm.bigmodel.maintenance.mapper; |
package com.hnac.gglm.bigmodel.maintenance.mapper; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.dto.KnowledgeData; |
||||||
import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileFragment; |
import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileFragment; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
/** |
/** |
||||||
* @Author: ypj |
* @Author: ypj |
||||||
* @Date: 2024/9/11 10:49 |
* @Date: 2024/9/11 10:49 |
||||||
*/ |
*/ |
||||||
public interface KnowledgeFileFragmentMapper extends BaseMapper<KnowledgeFileFragment> { |
public interface KnowledgeFileFragmentMapper extends BaseMapper<KnowledgeFileFragment> { |
||||||
|
List<KnowledgeData> listKnowledgeData(); |
||||||
} |
} |
||||||
|
@ -0,0 +1,19 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.hnac.gglm.bigmodel.maintenance.mapper.KnowledgeFileFragmentMapper"> |
||||||
|
<resultMap id="BaseResultMap" type="com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileFragment"> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<select id="listKnowledgeData" resultType="com.hnac.gglm.bigmodel.maintenance.dto.KnowledgeData"> |
||||||
|
SELECT |
||||||
|
`segment`.DOC_CONTENT, |
||||||
|
`segment`.DOC_ID, |
||||||
|
`segment`.DOC_QS, |
||||||
|
`segment`.DOC_PAGE_INDEX, |
||||||
|
`info`.AUTHORITY_CLASS AS `level`, |
||||||
|
`info`.DOMAIN AS `area` |
||||||
|
FROM |
||||||
|
knowledge_file_segment AS `segment` |
||||||
|
LEFT JOIN knowledge_file_info `info` ON `segment`.DOC_ID = `info`.ID |
||||||
|
</select> |
||||||
|
</mapper> |
@ -0,0 +1,68 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.hnac.gglm.bigmodel.business.service.VectorDataService; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.dto.DeviceFuncDTO; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.mapper.DataInstructMapper; |
||||||
|
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceFuncInfoDTO; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springblade.core.tool.utils.BeanUtil; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.util.CollectionUtils; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Service |
||||||
|
@Slf4j |
||||||
|
@AllArgsConstructor |
||||||
|
public class DataInstructService extends BaseServiceImpl<DataInstructMapper, DataInstructEntity> { |
||||||
|
|
||||||
|
private final VectorDataService vectorDataService; |
||||||
|
|
||||||
|
public boolean save(DataInstructEntity entity) { |
||||||
|
//对遥控名称判重
|
||||||
|
LambdaQueryWrapper<DataInstructEntity> queryWrapper = new QueryWrapper<DataInstructEntity>() |
||||||
|
.lambda().eq(DataInstructEntity::getYkName, entity.getYkName()); |
||||||
|
Long count = baseMapper.selectCount(queryWrapper); |
||||||
|
if (count > 0) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
//保存信息
|
||||||
|
return save(entity); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean updateById(DataInstructEntity entity) { |
||||||
|
//对遥控名称判重
|
||||||
|
LambdaQueryWrapper<DataInstructEntity> queryWrapper = new QueryWrapper<DataInstructEntity>() |
||||||
|
.lambda().eq(DataInstructEntity::getItemName, entity.getItemName()) |
||||||
|
.ne(DataInstructEntity::getId, entity.getId()); |
||||||
|
Long count = baseMapper.selectCount(queryWrapper); |
||||||
|
if (count > 0) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
//修改信息
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
public List<DeviceFuncDTO> getDataInstructList() { |
||||||
|
List<DataInstructEntity> list = baseMapper.selectList(null); |
||||||
|
List<DeviceFuncDTO> deviceFuncDTOS = BeanUtil.copyProperties(list, DeviceFuncDTO.class); |
||||||
|
List<DeviceFuncInfoDTO> deviceFuncList = vectorDataService.getDeviceFunc(); |
||||||
|
for (DeviceFuncInfoDTO deviceFunc : deviceFuncList) { |
||||||
|
DeviceFuncDTO deviceFuncDTO = new DeviceFuncDTO(); |
||||||
|
deviceFuncDTO.setDeviceId(deviceFunc.getDeviceId()); |
||||||
|
deviceFuncDTO.setDeviceName(deviceFunc.getDeviceName()); |
||||||
|
deviceFuncDTO.setItemId(deviceFunc.getSignage()); |
||||||
|
deviceFuncDTO.setItemName(deviceFunc.getItemName()); |
||||||
|
deviceFuncDTO.setStationName(deviceFunc.getProjectName()); |
||||||
|
deviceFuncDTO.setStationId(deviceFunc.getProjectId()); |
||||||
|
deviceFuncDTOS.add(deviceFuncDTO); |
||||||
|
} |
||||||
|
return deviceFuncDTOS; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,65 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.service; |
||||||
|
|
||||||
|
import com.hnac.gglm.bigmodel.business.service.VectorDataService; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.dto.DeviceAttrDTO; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.dto.DeviceFuncDTO; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.mapper.DataRecordMapper; |
||||||
|
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceAttrInfoDTO; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springblade.core.tool.utils.BeanUtil; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Service |
||||||
|
@Slf4j |
||||||
|
@AllArgsConstructor |
||||||
|
public class DataRecordService extends BaseServiceImpl<DataRecordMapper, DataRecordEntity> { |
||||||
|
|
||||||
|
private final VectorDataService vectorDataService; |
||||||
|
|
||||||
|
public boolean save(DataRecordEntity entity) { |
||||||
|
splicing(entity); |
||||||
|
return save(entity); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean updateById(DataRecordEntity entity) { |
||||||
|
splicing(entity); |
||||||
|
return updateById(entity); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* //拼接itemName
|
||||||
|
* @param entity |
||||||
|
*/ |
||||||
|
private void splicing(DataRecordEntity entity) { |
||||||
|
String stationName = entity.getStationName() == null ? "" : entity.getStationName(); |
||||||
|
String deviceName = entity.getDeviceName() == null ? "" : entity.getDeviceName(); |
||||||
|
String recordName = entity.getRecordName() == null ? "" : entity.getRecordName(); |
||||||
|
entity.setItemName(new StringBuffer(stationName) |
||||||
|
.append(" ").append(deviceName) |
||||||
|
.append(" ").append(recordName).toString()); |
||||||
|
} |
||||||
|
|
||||||
|
public List<DeviceAttrDTO> getDataRecordList() { |
||||||
|
List<DataRecordEntity> list = baseMapper.selectList(null); |
||||||
|
List<DeviceAttrDTO> deviceAttrDTOS = BeanUtil.copyProperties(list, DeviceAttrDTO.class); |
||||||
|
List<DeviceAttrInfoDTO> deviceAttrList = vectorDataService.getDeviceAttr(); |
||||||
|
for (DeviceAttrInfoDTO deviceAttr : deviceAttrList) { |
||||||
|
DeviceAttrDTO deviceAttrDTO = new DeviceAttrDTO(); |
||||||
|
deviceAttrDTO.setDeviceId(deviceAttr.getDeviceId()); |
||||||
|
deviceAttrDTO.setDeviceName(deviceAttr.getDeviceName()); |
||||||
|
deviceAttrDTO.setStationName(deviceAttr.getProjectName()); |
||||||
|
deviceAttrDTO.setStationId(deviceAttr.getProjectId()); |
||||||
|
deviceAttrDTO.setRecordName(deviceAttr.getName()); |
||||||
|
deviceAttrDTO.setItemId(deviceAttr.getSignage()); |
||||||
|
deviceAttrDTO.setRule(deviceAttr.getRule()); |
||||||
|
deviceAttrDTO.setItemName(deviceAttr.getItemName()); |
||||||
|
deviceAttrDTOS.add(deviceAttrDTO); |
||||||
|
} |
||||||
|
return deviceAttrDTOS; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue