组态功能
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.njcn.csdevice.controller.Equipment;
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
@@ -8,6 +8,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
||||
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -52,9 +53,9 @@ public class CsDataArrayController extends BaseController {
|
||||
@PostMapping("/getDataArray")
|
||||
@ApiOperation("获取详细数据")
|
||||
@ApiImplicitParam(name = "dataSetList", value = "数据集集合", required = true)
|
||||
public HttpResult<List<LineTargetVO>> getDataArray(@RequestBody List<String> dataSetList){
|
||||
public HttpResult<List<DataArrayTreeVO>> getDataArray(@RequestBody List<String> dataSetList){
|
||||
String methodDescribe = getMethodDescribe("getDataArray");
|
||||
List<LineTargetVO> list = csDataArrayService.getDataArray(dataSetList);
|
||||
List<DataArrayTreeVO> list = csDataArrayService.getDataArray(dataSetList);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.csdevice.controller.Equipment;
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.csdevice.controller.Equipment;
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
import com.njcn.csdevice.pojo.param.CsEquipmentTransferAddParm;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.csdevice.controller.Equipment;
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelAddParm;
|
||||
@@ -105,7 +105,7 @@ public class DevModelController extends BaseController {
|
||||
@ApiOperation("根据模板Id获取模板数据")
|
||||
@ApiImplicitParam(name = "id", value = "模板id", required = true)
|
||||
public HttpResult<CsDevModelPO> getModelById(@RequestParam("id") String id){
|
||||
String methodDescribe = getMethodDescribe("getDataById");
|
||||
String methodDescribe = getMethodDescribe("getModelById");
|
||||
CsDevModelPO po = csDevModelService.getModelById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.csdevice.controller.Equipment;
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelRelationAddParm;
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
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.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/6/13 15:44
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/deviceManager")
|
||||
@Api(tags = " 设备管理")
|
||||
@AllArgsConstructor
|
||||
public class DeviceManagerController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/deviceTree")
|
||||
@ApiOperation("设备树")
|
||||
public HttpResult<Boolean> getDeviceTree(){
|
||||
String methodDescribe = getMethodDescribe("getDeviceTree");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/6/13 15:45
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/deviceMonitor")
|
||||
@Api(tags = " 设备监控")
|
||||
@AllArgsConstructor
|
||||
public class DeviceMonitorController extends BaseController {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.csdevice.controller.Equipment;
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.dto.DataArrayDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -19,4 +20,6 @@ public interface CsDataArrayMapper extends BaseMapper<CsDataArray> {
|
||||
|
||||
List<LineTargetVO> getDataArray(@Param("list") List<String> list);
|
||||
|
||||
List<DataArrayDTO> getData(@Param("list") List<String> list);
|
||||
|
||||
}
|
||||
|
||||
@@ -19,4 +19,26 @@
|
||||
order by idx
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="getData" resultType="DataArrayDTO">
|
||||
select
|
||||
t1.another_name dataSetName,
|
||||
t0.name dataArrayName,
|
||||
t0.another_name dataArrayShowName,
|
||||
group_concat(distinct t0.stat_method) statMethod,
|
||||
group_concat(distinct t0.phase) phase
|
||||
from
|
||||
cs_data_array t0
|
||||
left join cs_data_set t1 on t0.pid = t1.id
|
||||
where
|
||||
t1.id IN
|
||||
<foreach collection='list' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
group by t1.another_name,t0.name,t0.another_name
|
||||
order by convert (substring_index(group_concat(distinct t0.sort),',',-1),unsigned)
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -3,6 +3,7 @@ package com.njcn.csdevice.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
||||
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@@ -26,7 +27,7 @@ public interface ICsDataArrayService extends IService<CsDataArray> {
|
||||
*/
|
||||
List<CsDataArray> getArrayBySet(List<CsDataSet> list);
|
||||
|
||||
List<LineTargetVO> getDataArray(List<String> list);
|
||||
List<DataArrayTreeVO> getDataArray(List<String> list);
|
||||
|
||||
List<CsDataArray> getDataArrayById(String pid, String name);
|
||||
|
||||
|
||||
@@ -2,13 +2,15 @@ package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
||||
import com.njcn.csdevice.pojo.dto.DataArrayDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
||||
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -29,8 +31,51 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LineTargetVO> getDataArray(List<String> list) {
|
||||
return this.baseMapper.getDataArray(list);
|
||||
public List<DataArrayTreeVO> getDataArray(List<String> list) {
|
||||
List<DataArrayTreeVO> result = new ArrayList<>();
|
||||
List<DataArrayDTO> dataArrayList = this.baseMapper.getData(list);
|
||||
Map<String,List<DataArrayDTO>> map = dataArrayList.stream().collect(Collectors.groupingBy(DataArrayDTO::getDataSetName));
|
||||
map.forEach((k,v)->{
|
||||
List<DataArrayTreeVO> list2 = new ArrayList<>();
|
||||
DataArrayTreeVO vo1 = new DataArrayTreeVO();
|
||||
vo1.setId("0");
|
||||
vo1.setName(k);
|
||||
vo1.setShowName(k);
|
||||
v.forEach(item->{
|
||||
DataArrayTreeVO vo2 = new DataArrayTreeVO();
|
||||
List<DataArrayTreeVO> list3 = new ArrayList<>();
|
||||
vo2.setId("1");
|
||||
vo2.setName(item.getDataArrayName());
|
||||
vo2.setShowName(item.getDataArrayShowName());
|
||||
List<String> statMethodList = Arrays.asList(item.getStatMethod().split(","));
|
||||
List<String> phaseList = Arrays.asList(item.getPhase().split(","));
|
||||
statMethodList.forEach(item2->{
|
||||
List<DataArrayTreeVO> list4 = new ArrayList<>();
|
||||
DataArrayTreeVO vo3 = new DataArrayTreeVO();
|
||||
vo3.setId("2");
|
||||
vo3.setName(item2);
|
||||
vo3.setShowName(item2);
|
||||
phaseList.forEach(item3->{
|
||||
DataArrayTreeVO vo4 = new DataArrayTreeVO();
|
||||
vo4.setId("3");
|
||||
vo4.setName(item3);
|
||||
if (Objects.equals(item3,"M")){
|
||||
vo4.setShowName("无相别");
|
||||
} else {
|
||||
vo4.setShowName(item3);
|
||||
}
|
||||
list4.add(vo4);
|
||||
});
|
||||
vo3.setChildren(list4);
|
||||
list3.add(vo3);
|
||||
});
|
||||
vo2.setChildren(list3);
|
||||
list2.add(vo2);
|
||||
});
|
||||
vo1.setChildren(list2);
|
||||
result.add(vo1);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user