1.新增数据清洗相关实体
2.兼容便携式设备接入
This commit is contained in:
@@ -0,0 +1,171 @@
|
||||
package com.njcn.csdevice.controller.scheme;
|
||||
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.RecordTreeVo;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csdevice.service.IWlRecordService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 方案、测试项表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2024-04-01
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/wlRecord")
|
||||
@Api(tags = "方案测试项管理")
|
||||
@AllArgsConstructor
|
||||
public class WlRecordController extends BaseController {
|
||||
|
||||
private final IWlRecordService wlRecordService;
|
||||
|
||||
/**
|
||||
* 新增方案、测试项
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增方案或测试项")
|
||||
@ApiImplicitParam(name = "list", value = "测试项集合", required = true)
|
||||
public HttpResult<Boolean> add(@RequestBody @Validated List<WlRecordParam.Record> list) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{},新增的测试项集合为:{}", methodDescribe, list);
|
||||
wlRecordService.add(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改方案
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改方案")
|
||||
@ApiImplicitParam(name = "list", value = "测试项集合", required = true)
|
||||
public HttpResult<Boolean> update(@RequestBody @Validated List<WlRecordParam.UpdateRecord> list) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{},修改的测试项集合为:{}", methodDescribe, list);
|
||||
wlRecordService.update(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据方案查询测试项信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/getRecordById")
|
||||
@ApiOperation("通过方案id查询所属测试项")
|
||||
@ApiImplicitParam(name = "id", value = "用户id", required = true)
|
||||
public HttpResult<List<RecordVo>> getRecordById(@RequestParam @Validated String id) {
|
||||
String methodDescribe = getMethodDescribe("getRecordById");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{},测试项id为:{}", methodDescribe, id);
|
||||
List<RecordVo> result = wlRecordService.getRecordById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有测试项信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/listRecord")
|
||||
@ApiOperation("查询所有测试项信息")
|
||||
public HttpResult<List<RecordTreeVo>> listRecord() {
|
||||
String methodDescribe = getMethodDescribe("listRecord");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{}", methodDescribe);
|
||||
List<RecordTreeVo> result = wlRecordService.getRecordTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 两层方案树
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/schemeTree")
|
||||
@ApiOperation("两层方案树")
|
||||
public HttpResult<List<RecordTreeVo>> getSchemeTree() {
|
||||
String methodDescribe = getMethodDescribe("getSchemeTree");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{}", methodDescribe);
|
||||
List<RecordTreeVo> result = wlRecordService.getSchemeTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除方案
|
||||
* @param id 方案、测试项id
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除方案")
|
||||
@ApiImplicitParam(name = "id", value = "方案id", required = true)
|
||||
public HttpResult<Boolean> delete(@RequestParam @Validated String id) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{},方案id为:{}", methodDescribe, id);
|
||||
wlRecordService.delete(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据测试项id查询测试项详细信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
|
||||
@DeleteMapping("/detailById")
|
||||
@ApiOperation("根据id获取测试项详情")
|
||||
@ApiImplicitParam(name = "id", value = "测试项id", required = true)
|
||||
public HttpResult<WlRecord> getDetailById(@RequestParam @Validated String id) {
|
||||
String methodDescribe = getMethodDescribe("getRecordById");
|
||||
try {
|
||||
LogUtil.njcnDebug(log, "{},测试项id为:{}", methodDescribe, id);
|
||||
WlRecord wlRecord = wlRecordService.getDataById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wlRecord, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 方案、测试项表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2024-04-01
|
||||
*/
|
||||
public interface WlRecordMapper extends BaseMapper<WlRecord> {
|
||||
|
||||
/**
|
||||
* 根据方案id查询所属的测试项
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<RecordVo> listRecord(@Param("id") String id);
|
||||
|
||||
/**
|
||||
* 查询所有的测试项
|
||||
* @return
|
||||
*/
|
||||
List<RecordVo> getAllRecord();
|
||||
|
||||
/**
|
||||
* 查询所有的方案和测试项
|
||||
* @return
|
||||
*/
|
||||
List<RecordVo> getAll();
|
||||
|
||||
|
||||
}
|
||||
@@ -24,16 +24,13 @@
|
||||
</sql>
|
||||
|
||||
<select id="findByNdid" resultType="CsLinePO">
|
||||
select
|
||||
t3.*
|
||||
from
|
||||
cs_equipment_delivery t0
|
||||
left join cs_ledger t1 on
|
||||
t0.id = t1.Id and t1.State = 1
|
||||
left join cs_ledger t2 on
|
||||
t1.Id = t2.Pid and t2.State = 1
|
||||
left join cs_line t3 on t2.Id = t3.line_id and t3.status = 1
|
||||
where
|
||||
t0.ndid = #{id}
|
||||
select
|
||||
t1.*
|
||||
from
|
||||
cs_equipment_delivery t0
|
||||
left join cs_line t1 on
|
||||
t0.id = t1.device_id
|
||||
where
|
||||
t0.ndid = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?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.njcn.csdevice.mapper.WlRecordMapper">
|
||||
|
||||
<select id="listRecord" resultType="com.njcn.csdevice.pojo.vo.RecordVo">
|
||||
select
|
||||
a.id,
|
||||
a.item_name recordName,
|
||||
b.name devName,
|
||||
b.mac devMac,
|
||||
c.name lineName,
|
||||
a.start_time startTime,
|
||||
a.end_time endTime,
|
||||
a.location
|
||||
from
|
||||
wl_record a
|
||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||
left join cs_line c on a.line_id = c.line_id
|
||||
where a.p_id = #{id} and a.state = 1
|
||||
</select>
|
||||
|
||||
<select id="getAllRecord" resultType="com.njcn.csdevice.pojo.vo.RecordVo">
|
||||
select
|
||||
a.id,
|
||||
a.item_name recordName,
|
||||
b.name devName,
|
||||
b.mac devMac,
|
||||
c.name lineName,
|
||||
a.start_time startTime,
|
||||
a.end_time endTime,
|
||||
a.location
|
||||
from
|
||||
wl_record a
|
||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||
left join cs_line c on a.line_id = c.line_id
|
||||
where a.`type` = 1 and a.state = 1
|
||||
</select>
|
||||
|
||||
<select id="getAll" resultType="com.njcn.csdevice.pojo.vo.RecordVo">
|
||||
select
|
||||
a.id,
|
||||
a.item_name recordName,
|
||||
b.name devName,
|
||||
b.mac devMac,
|
||||
c.name lineName,
|
||||
a.start_time startTime,
|
||||
a.end_time endTime,
|
||||
a.location,
|
||||
a.type
|
||||
from
|
||||
wl_record a
|
||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||
left join cs_line c on a.line_id = c.line_id
|
||||
where a.state = 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.RecordTreeVo;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 方案、测试项表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2024-04-01
|
||||
*/
|
||||
public interface IWlRecordService extends IService<WlRecord> {
|
||||
|
||||
/**
|
||||
* 批量新增方案或测试项
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
void add(List<WlRecordParam.Record> list);
|
||||
|
||||
/**
|
||||
* 批量修改方案信息
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
void update(List<WlRecordParam.UpdateRecord> list);
|
||||
|
||||
/**
|
||||
* 根据方案查询测试项信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<RecordVo> getRecordById(String id);
|
||||
|
||||
/**
|
||||
* 查询所有测试项信息,用于方案添加测试项
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
List<RecordTreeVo> getRecordTree();
|
||||
|
||||
/**
|
||||
* 获取方案树
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
List<RecordTreeVo> getSchemeTree();
|
||||
|
||||
/**
|
||||
* 删除方案
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void delete(String id);
|
||||
|
||||
/**
|
||||
* 根据测试项id查询测试项详情
|
||||
* @return
|
||||
*/
|
||||
WlRecord getDataById(String id);
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@@ -31,6 +32,7 @@ import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||
import com.njcn.db.constant.DbConstant;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
@@ -96,7 +98,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid ( ));
|
||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid());
|
||||
if(!Objects.isNull (po)){
|
||||
throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR);
|
||||
}
|
||||
@@ -104,7 +106,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
BeanUtils.copyProperties (csEquipmentDeliveryAddParm,csEquipmentDeliveryPo);
|
||||
csEquipmentDeliveryPo.setStatus ("1");
|
||||
csEquipmentDeliveryPo.setRunStatus(1);
|
||||
csEquipmentDeliveryPo.setProcess(2);
|
||||
String code = dictTreeFeignClient.queryById(po.getDevType()).getData().getCode();
|
||||
if (Objects.equals(DicDataEnum.PORTABLE.getCode(),code)) {
|
||||
csEquipmentDeliveryPo.setProcess(4);
|
||||
} else if (Objects.equals(DicDataEnum.CONNECT_DEV.getCode(),code)) {
|
||||
csEquipmentDeliveryPo.setProcess(2);
|
||||
}
|
||||
//生成二维码文件
|
||||
String qr = this.createQr(csEquipmentDeliveryAddParm.getNdid());
|
||||
csEquipmentDeliveryPo.setQrPath(qr);
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.WlRecordMapper;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.RecordTreeVo;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csdevice.service.IWlRecordService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 方案、测试项表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2024-04-01
|
||||
*/
|
||||
@Service
|
||||
public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> implements IWlRecordService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void add(List<WlRecordParam.Record> list) {
|
||||
List<WlRecord> insertList = new ArrayList<>();
|
||||
list.forEach(item->{
|
||||
String id = IdUtil.simpleUUID();
|
||||
WlRecord wlRecord = new WlRecord();
|
||||
BeanUtils.copyProperties(item, wlRecord);
|
||||
wlRecord.setId(id);
|
||||
insertList.add(wlRecord);
|
||||
if (CollUtil.isNotEmpty(item.getList())){
|
||||
LambdaUpdateWrapper<WlRecord> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(WlRecord::getPId, id)
|
||||
.in(WlRecord::getId,item.getList());
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
});
|
||||
this.saveBatch(insertList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(List<WlRecordParam.UpdateRecord> list) {
|
||||
List<WlRecord> updateList = new ArrayList<>();
|
||||
list.forEach(item->{
|
||||
WlRecord wlRecord = new WlRecord();
|
||||
BeanUtils.copyProperties(item, wlRecord);
|
||||
updateList.add(wlRecord);
|
||||
if (CollUtil.isNotEmpty(item.getList())){
|
||||
//先将方案绑定的测试项去除,然后再根据传递的数据绑定
|
||||
LambdaUpdateWrapper<WlRecord> lambdaUpdateWrapper1 = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper1.set(WlRecord::getPId, null)
|
||||
.in(WlRecord::getId,item.getList());
|
||||
this.update(lambdaUpdateWrapper1);
|
||||
LambdaUpdateWrapper<WlRecord> lambdaUpdateWrapper2 = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper2.set(WlRecord::getPId, item.getId())
|
||||
.in(WlRecord::getId,item.getList());
|
||||
this.update(lambdaUpdateWrapper2);
|
||||
}
|
||||
});
|
||||
this.updateBatchById(updateList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RecordVo> getRecordById(String id) {
|
||||
return this.baseMapper.listRecord(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RecordTreeVo> getRecordTree() {
|
||||
List<RecordTreeVo> result = new ArrayList<>();
|
||||
Optional.ofNullable(this.baseMapper.getAllRecord())
|
||||
.ifPresent(list -> list.stream()
|
||||
.collect(Collectors.groupingBy(RecordVo::getDevName))
|
||||
.forEach((devName, records) -> {
|
||||
List<RecordTreeVo.Children> childrenList = records.stream()
|
||||
.map(this::mapToChildren)
|
||||
.collect(Collectors.toList());
|
||||
RecordTreeVo vo = new RecordTreeVo();
|
||||
vo.setName(devName);
|
||||
vo.setChildren(childrenList);
|
||||
result.add(vo);
|
||||
}));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RecordTreeVo> getSchemeTree() {
|
||||
List<RecordTreeVo> result = new ArrayList<>();
|
||||
List<RecordVo> list = this.baseMapper.getAll();
|
||||
// 过滤出方案数据和测试项数据
|
||||
List<RecordVo> schemes = list.stream().filter(item -> item.getType() == 0).collect(Collectors.toList());
|
||||
List<RecordVo> testItems = list.stream().filter(item -> item.getType() == 1).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(schemes)){
|
||||
// 遍历方案数据
|
||||
for (RecordVo scheme : schemes) {
|
||||
RecordTreeVo vo = new RecordTreeVo();
|
||||
vo.setSchemeId(scheme.getId());
|
||||
vo.setName(scheme.getRecordName());
|
||||
if (CollUtil.isNotEmpty(testItems)){
|
||||
// 将测试项数据映射为子节点列表
|
||||
List<RecordTreeVo.Children> childrenList = testItems.stream()
|
||||
.map(item -> {
|
||||
RecordTreeVo.Children children = new RecordTreeVo.Children();
|
||||
children.setId(item.getId());
|
||||
String name = item.getDevName() + "-" + item.getLocation() + "(" + item.getStartTime() + "~" + item.getEndTime() + ")";
|
||||
children.setRecordName(name);
|
||||
return children;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
vo.setChildren(childrenList);
|
||||
result.add(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
LambdaUpdateWrapper<WlRecord> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(WlRecord::getState,0)
|
||||
.eq(WlRecord::getId, id)
|
||||
.eq(WlRecord::getType, 0);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WlRecord getDataById(String id) {
|
||||
return lambdaQuery().eq(WlRecord::getId, id)
|
||||
.eq(WlRecord::getType,1)
|
||||
.eq(WlRecord::getState, 1)
|
||||
.one();
|
||||
}
|
||||
|
||||
private RecordTreeVo.Children mapToChildren(RecordVo record) {
|
||||
RecordTreeVo.Children children = new RecordTreeVo.Children();
|
||||
BeanUtils.copyProperties(record, children);
|
||||
return children;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user