Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -46,16 +46,10 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
|||||||
private String mac;
|
private String mac;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 装置用途(治理、监测...)
|
* 装置类型(直连设备、网关设备)
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value="装置用途")
|
@ApiModelProperty(value="装置类型")
|
||||||
private String devUse;
|
private String devType;
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 装置类型(直连设备、网关设备)
|
|
||||||
// */
|
|
||||||
// @ApiModelProperty(value="装置类型")
|
|
||||||
// private String devType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 装置型号(pqs588、pqs680...)
|
* 装置型号(pqs588、pqs680...)
|
||||||
@@ -109,7 +103,7 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
|||||||
private String salesManager;
|
private String salesManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0:删除 1:正常)
|
* 状态(0:删除 1:未注册 2:注册 3:接入)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "status")
|
@TableField(value = "status")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.njcn.csdevice.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/6/15 20:36
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DeviceManagerDetailVO {
|
||||||
|
|
||||||
|
@ApiModelProperty("指标名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@ApiModelProperty("单位")
|
||||||
|
private String unit;
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.njcn.csdevice.pojo.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/6/15 15:23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DeviceManagerVO {
|
||||||
|
|
||||||
|
@ApiModelProperty("识别码")
|
||||||
|
private String ndid;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "装置类型(前端根据字典自己查询)")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备型号(前端根据字典自己查询)")
|
||||||
|
private String devModel;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "装置接入方式(cloud转为云前置)")
|
||||||
|
private String devAccessMethod;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "装置接入时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||||
|
private LocalDateTime time;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "装置数据集集合")
|
||||||
|
private List<DataSetVO> dataSetList;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class DataSetVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "数据集Id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "数据集名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,8 +7,8 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
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.DataArrayTreeVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DeviceManagerDetailVO;
|
||||||
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -42,10 +42,20 @@ public class CsDataArrayController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getArrayBySet")
|
@PostMapping("/getArrayBySet")
|
||||||
@ApiOperation("根据数据集获取详细数据")
|
@ApiOperation("根据数据集获取详细数据")
|
||||||
@ApiImplicitParam(name = "dataSetList", value = "数据集集合", required = true)
|
@ApiImplicitParam(name = "dataSet", value = "数据集id", required = true)
|
||||||
public HttpResult<List<CsDataArray>> getArrayBySet(@RequestBody List<CsDataSet> dataSetList){
|
public HttpResult<List<CsDataArray>> getArrayBySet(@RequestParam("dataSet") String dataSet){
|
||||||
String methodDescribe = getMethodDescribe("getArrayBySet");
|
String methodDescribe = getMethodDescribe("getArrayBySet");
|
||||||
List<CsDataArray> list = csDataArrayService.getArrayBySet(dataSetList);
|
List<CsDataArray> list = csDataArrayService.getArrayBySet(dataSet);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getTargetById")
|
||||||
|
@ApiOperation("根据数据集获取指标数据")
|
||||||
|
@ApiImplicitParam(name = "id", value = "数据集Id", required = true)
|
||||||
|
public HttpResult<List<DeviceManagerDetailVO>> getTargetById(@RequestParam("id") String id){
|
||||||
|
String methodDescribe = getMethodDescribe("getTargetById");
|
||||||
|
List<DeviceManagerDetailVO> list = csDataArrayService.getTargetById(id);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,18 +69,19 @@ public class CsDataArrayController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getDataArrayById")
|
// @PostMapping("/getDataArrayById")
|
||||||
@ApiOperation("获取详细数据(id)")
|
// @ApiOperation("获取详细数据(id)")
|
||||||
@ApiImplicitParams({
|
// @ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "pid", value = "数据集id", required = true),
|
// @ApiImplicitParam(name = "pid", value = "数据集id", required = true),
|
||||||
@ApiImplicitParam(name = "name", value = "名称", required = true)
|
// @ApiImplicitParam(name = "name", value = "名称", required = true)
|
||||||
})
|
// })
|
||||||
public HttpResult<List<CsDataArray>> getDataArrayById(@RequestParam("pid") String pid, @RequestParam("name") String name){
|
// @Deprecated
|
||||||
String methodDescribe = getMethodDescribe("getDataArrayById");
|
// public HttpResult<List<CsDataArray>> getDataArrayById(@RequestParam("pid") String pid, @RequestParam("name") String name){
|
||||||
List<CsDataArray> list = csDataArrayService.getDataArrayById(pid, name);
|
// String methodDescribe = getMethodDescribe("getDataArrayById");
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
// List<CsDataArray> list = csDataArrayService.getDataArrayById(pid, name);
|
||||||
}
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
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 {
|
|
||||||
}
|
|
||||||
@@ -13,6 +13,8 @@ import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
|||||||
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -123,17 +125,28 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ApiOperation("出厂设备列表")
|
@ApiOperation("出厂设备列表")
|
||||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
public HttpResult<Page<CsEquipmentDeliveryPO>> list(@RequestBody CsEquipmentDeliveryQueryParm param){
|
public HttpResult<Page<CsEquipmentDeliveryVO>> list(@RequestBody CsEquipmentDeliveryQueryParm param){
|
||||||
String methodDescribe = getMethodDescribe("list");
|
String methodDescribe = getMethodDescribe("list");
|
||||||
Page<CsEquipmentDeliveryPO> page = csEquipmentDeliveryService.list(param);
|
Page<CsEquipmentDeliveryVO> page = csEquipmentDeliveryService.list(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/deviceTree")
|
||||||
|
@ApiOperation("三层设备树")
|
||||||
|
public HttpResult<List<CsLedgerVO>> getDeviceTree(){
|
||||||
|
String methodDescribe = getMethodDescribe("getDeviceTree");
|
||||||
|
List<CsLedgerVO> list = csEquipmentDeliveryService.getDeviceTree();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/deviceData")
|
||||||
|
@ApiOperation("装置基础数据和模板数据")
|
||||||
|
@ApiImplicitParam(name = "deviceId", value = "装置id", required = true)
|
||||||
|
public HttpResult<DeviceManagerVO> getDeviceData(@RequestParam String deviceId){
|
||||||
|
String methodDescribe = getMethodDescribe("getDeviceData");
|
||||||
|
DeviceManagerVO vo = csEquipmentDeliveryService.getDeviceData(deviceId);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,4 +22,6 @@ public interface CsDataArrayMapper extends BaseMapper<CsDataArray> {
|
|||||||
|
|
||||||
List<DataArrayDTO> getData(@Param("list") List<String> list);
|
List<DataArrayDTO> getData(@Param("list") List<String> list);
|
||||||
|
|
||||||
|
List<CsDataArray> getDictData(@Param("id") String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
||||||
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||||
import com.njcn.system.pojo.vo.EleEpdPqdVO;
|
import com.njcn.system.pojo.vo.EleEpdPqdVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@@ -22,7 +23,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
public interface CsEquipmentDeliveryMapper extends BaseMapper<CsEquipmentDeliveryPO> {
|
public interface CsEquipmentDeliveryMapper extends BaseMapper<CsEquipmentDeliveryPO> {
|
||||||
Page<ProjectEquipmentVO> queryProjectEquipmentVO(Page<ProjectEquipmentVO> returnpage,@Param("projectEquipmentQueryParm")ProjectEquipmentQueryParm projectEquipmentQueryParm);
|
Page<ProjectEquipmentVO> queryProjectEquipmentVO(Page<ProjectEquipmentVO> returnpage,@Param("projectEquipmentQueryParm")ProjectEquipmentQueryParm projectEquipmentQueryParm);
|
||||||
|
|
||||||
Page<CsEquipmentDeliveryPO> page(Page<CsEquipmentDeliveryPO> returnpage,@Param("ew") QueryWrapper<CsEquipmentDeliveryPO> queryWrapper);
|
Page<CsEquipmentDeliveryVO> page(Page<CsEquipmentDeliveryPO> returnpage, @Param("ew") QueryWrapper<CsEquipmentDeliveryPO> queryWrapper);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -19,8 +19,6 @@
|
|||||||
order by idx
|
order by idx
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<select id="getData" resultType="DataArrayDTO">
|
<select id="getData" resultType="DataArrayDTO">
|
||||||
select
|
select
|
||||||
t1.id dataSetId,
|
t1.id dataSetId,
|
||||||
@@ -41,5 +39,12 @@
|
|||||||
order by convert (substring_index(group_concat(distinct t0.sort),',',-1),unsigned)
|
order by convert (substring_index(group_concat(distinct t0.sort),',',-1),unsigned)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getDictData" resultType="CsDataArray">
|
||||||
|
select
|
||||||
|
distinct data_id,name
|
||||||
|
from
|
||||||
|
cs_data_array t0
|
||||||
|
where
|
||||||
|
pid = #{id}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="page" resultType="CsEquipmentDeliveryPO">
|
<select id="page" resultType="CsEquipmentDeliveryVO">
|
||||||
select
|
select
|
||||||
*
|
*
|
||||||
from
|
from
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
|||||||
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -66,9 +68,21 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
|||||||
void updateStatusBynDid(String nDid,Integer status);
|
void updateStatusBynDid(String nDid,Integer status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 设备出厂列表
|
||||||
* @param param
|
* @param param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Page<CsEquipmentDeliveryPO> list(CsEquipmentDeliveryQueryParm param);
|
Page<CsEquipmentDeliveryVO> list(CsEquipmentDeliveryQueryParm param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端三层树
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<CsLedgerVO> getDeviceTree();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取装置基础数据和模板数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
DeviceManagerVO getDeviceData(String deviceId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DeviceManagerDetailVO;
|
||||||
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
@@ -18,17 +19,22 @@ import java.util.List;
|
|||||||
* @since 2023-05-31
|
* @since 2023-05-31
|
||||||
*/
|
*/
|
||||||
public interface ICsDataArrayService extends IService<CsDataArray> {
|
public interface ICsDataArrayService extends IService<CsDataArray> {
|
||||||
|
/**
|
||||||
|
* 根据数据集获取指标数据
|
||||||
|
* @param dataSet 数据集Id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<CsDataArray> getArrayBySet(String dataSet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据数据集获取指标数据
|
* 根据数据集获取指标数据
|
||||||
* @param list 数据集
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<CsDataArray> getArrayBySet(List<CsDataSet> list);
|
List<DeviceManagerDetailVO> getTargetById(String id);
|
||||||
|
|
||||||
List<DataArrayTreeVO> getDataArray(List<String> list);
|
List<DataArrayTreeVO> getDataArray(List<String> list);
|
||||||
|
|
||||||
List<CsDataArray> getDataArrayById(String pid, String name);
|
// List<CsDataArray> getDataArrayById(String pid, String name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csdevice.service;
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -52,4 +53,11 @@ public interface ICsLedgerService {
|
|||||||
*/
|
*/
|
||||||
String findDevByLineId(String lineId);
|
String findDevByLineId(String lineId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询数据
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CsLedger findDataById(String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,15 +5,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
||||||
import com.njcn.csdevice.pojo.dto.DataArrayDTO;
|
import com.njcn.csdevice.pojo.dto.DataArrayDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
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.DataArrayTreeVO;
|
||||||
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
import com.njcn.csdevice.pojo.vo.DeviceManagerDetailVO;
|
||||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||||
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 详细数据表 服务实现类
|
* 详细数据表 服务实现类
|
||||||
@@ -23,12 +26,33 @@ import java.util.stream.Collectors;
|
|||||||
* @since 2023-05-31
|
* @since 2023-05-31
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDataArray> implements ICsDataArrayService {
|
public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDataArray> implements ICsDataArrayService {
|
||||||
|
|
||||||
|
private final EpdFeignClient epdFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsDataArray> getArrayBySet(List<CsDataSet> list) {
|
public List<CsDataArray> getArrayBySet(String dataSet) {
|
||||||
List<String> setList = list.stream().map(CsDataSet::getId).collect(Collectors.toList());
|
return this.lambdaQuery().eq(CsDataArray::getPid,dataSet).orderByAsc(CsDataArray::getSort).list();
|
||||||
return this.lambdaQuery().in(CsDataArray::getPid,setList).list();
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceManagerDetailVO> getTargetById(String id) {
|
||||||
|
List<DeviceManagerDetailVO> list = new ArrayList<>();
|
||||||
|
List<String> l = this.baseMapper.getDictData(id).stream().map(CsDataArray::getDataId).collect(Collectors.toList());
|
||||||
|
List<EleEpdPqd> result = epdFeignClient.selectByIds(l).getData();
|
||||||
|
result.forEach(item->{
|
||||||
|
DeviceManagerDetailVO vo = new DeviceManagerDetailVO();
|
||||||
|
if(Objects.equals(item.getPhase(),"M")) {
|
||||||
|
vo.setName(item.getShowName());
|
||||||
|
} else {
|
||||||
|
vo.setName(item.getPhase() + "相" +item.getShowName());
|
||||||
|
}
|
||||||
|
vo.setType(item.getType());
|
||||||
|
vo.setUnit(item.getUnit());
|
||||||
|
list.add(vo);
|
||||||
|
});
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -79,10 +103,10 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public List<CsDataArray> getDataArrayById(String pid, String name) {
|
// public List<CsDataArray> getDataArrayById(String pid, String name) {
|
||||||
return this.lambdaQuery().eq(CsDataArray::getPid,pid).eq(CsDataArray::getName,name).list();
|
// return this.lambdaQuery().eq(CsDataArray::getPid,pid).eq(CsDataArray::getName,name).list();
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -10,36 +9,32 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
|
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAuditParm;
|
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAuditParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
||||||
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.*;
|
||||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
import com.njcn.csdevice.service.*;
|
||||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.system.enums.SystemResponseEnum;
|
|
||||||
import com.njcn.system.pojo.param.EleEpdPqdParam;
|
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import com.njcn.db.constant.DbConstant;
|
import com.njcn.db.constant.DbConstant;
|
||||||
import com.njcn.system.pojo.vo.EleEpdPqdVO;
|
|
||||||
import com.njcn.web.factory.PageFactory;
|
import com.njcn.web.factory.PageFactory;
|
||||||
|
import com.njcn.web.utils.RequestUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.logging.log4j.util.Strings;
|
import org.apache.logging.log4j.util.Strings;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
import java.util.stream.Collectors;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -53,8 +48,17 @@ import java.util.Optional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliveryMapper, CsEquipmentDeliveryPO> implements CsEquipmentDeliveryService{
|
public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliveryMapper, CsEquipmentDeliveryPO> implements CsEquipmentDeliveryService{
|
||||||
|
|
||||||
private final CsLedgerMapper csLedgerMapper;
|
private final CsLedgerMapper csLedgerMapper;
|
||||||
|
|
||||||
|
private final ICsEngineeringUserService csEngineeringUserService;
|
||||||
|
|
||||||
|
private final CsDevModelRelationService csDevModelRelationService;
|
||||||
|
|
||||||
|
private final ICsDataSetService csDataSetService;
|
||||||
|
|
||||||
|
private final ICsLedgerService csLedgerService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||||
@@ -129,7 +133,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<CsEquipmentDeliveryPO> list(CsEquipmentDeliveryQueryParm queryParam) {
|
public Page<CsEquipmentDeliveryVO> list(CsEquipmentDeliveryQueryParm queryParam) {
|
||||||
QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<CsEquipmentDeliveryPO>();
|
QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<CsEquipmentDeliveryPO>();
|
||||||
if (ObjectUtil.isNotNull(queryParam)) {
|
if (ObjectUtil.isNotNull(queryParam)) {
|
||||||
//查询参数不为空,进行条件填充
|
//查询参数不为空,进行条件填充
|
||||||
@@ -145,7 +149,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
queryWrapper.orderBy(true, queryParam.getOrderBy().equalsIgnoreCase(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
queryWrapper.orderBy(true, queryParam.getOrderBy().equalsIgnoreCase(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
||||||
} else {
|
} else {
|
||||||
//默认根据创建时间排序
|
//默认根据创建时间排序
|
||||||
queryWrapper.orderBy(true, true, "create_time");
|
queryWrapper.orderBy(true, false, "create_time");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Strings.isNotBlank(queryParam.getDevType()) || !Objects.isNull(queryParam.getDevType())){
|
if (Strings.isNotBlank(queryParam.getDevType()) || !Objects.isNull(queryParam.getDevType())){
|
||||||
@@ -164,4 +168,49 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsLedgerVO> getDeviceTree() {
|
||||||
|
List<CsLedgerVO> engineeringList = new ArrayList<>();
|
||||||
|
List<CsLedgerVO> allList = csLedgerMapper.getAll();
|
||||||
|
//fixme 这边先根据登录的用户名称来区分是否展示所有的台账信息
|
||||||
|
if (Objects.equals(RequestUtil.getUsername(),"root")){
|
||||||
|
engineeringList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
List<CsEngineeringPO> engineering = csEngineeringUserService.getEngineeringByUser();
|
||||||
|
engineeringList = allList.stream().filter(item->engineering.stream().map(CsEngineeringPO::getId).collect(Collectors.toList()).contains(item.getId())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
List<CsLedgerVO> deviceList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||||
|
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
||||||
|
return engineeringList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceManagerVO getDeviceData(String deviceId) {
|
||||||
|
DeviceManagerVO deviceManagerVo = new DeviceManagerVO();
|
||||||
|
List<DeviceManagerVO.DataSetVO> dataSetList = new ArrayList<>();
|
||||||
|
CsEquipmentDeliveryPO csEquipmentDeliveryPo = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId,deviceId).one();
|
||||||
|
String modelId = csDevModelRelationService.findModelByDevId(deviceId).getModelId();
|
||||||
|
List<CsDataSet> dataSet = csDataSetService.findDataSetByModelId(modelId);
|
||||||
|
BeanUtils.copyProperties(csEquipmentDeliveryPo,deviceManagerVo);
|
||||||
|
dataSet.forEach(item->{
|
||||||
|
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||||
|
dataSetVO.setId(item.getId());
|
||||||
|
dataSetVO.setName(item.getAnotherName());
|
||||||
|
dataSetList.add(dataSetVO);
|
||||||
|
});
|
||||||
|
deviceManagerVo.setDataSetList(dataSetList);
|
||||||
|
CsLedger csLedger = csLedgerService.findDataById(deviceId);
|
||||||
|
deviceManagerVo.setTime(csLedger.getCreateTime());
|
||||||
|
return deviceManagerVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取子节点
|
||||||
|
*/
|
||||||
|
public List<CsLedgerVO> getChildren(CsLedgerVO item, List<CsLedgerVO> all) {
|
||||||
|
return all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,6 +113,11 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
return deviceId;
|
return deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CsLedger findDataById(String id) {
|
||||||
|
return this.lambdaQuery().eq(CsLedger::getId,id).one();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子节点
|
* 获取子节点
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -42,10 +45,10 @@ public class CsElementController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperation("组态图元新增")
|
@ApiOperation("组态图元新增")
|
||||||
@ApiImplicitParam(name = "param", value = "组态图元", required = true)
|
@ApiImplicitParam(name = "multipartFile", value = "组态图元数据流", required = true)
|
||||||
public HttpResult<String> add(@RequestBody @Validated CsPageParm param){
|
public HttpResult<String> add(@RequestBody @Validated MultipartFile multipartFile){
|
||||||
String methodDescribe = getMethodDescribe("add");
|
String methodDescribe = getMethodDescribe("add");
|
||||||
csElementService.addElement(param.getJsonFile());
|
csElementService.addElement(multipartFile);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, CommonResponseEnum.SUCCESS.getMessage(), methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, CommonResponseEnum.SUCCESS.getMessage(), methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
import com.njcn.csharmonic.param.CsPageParm;
|
import com.njcn.csharmonic.param.CsPageParm;
|
||||||
import com.njcn.csharmonic.pojo.po.CsElement;
|
import com.njcn.csharmonic.pojo.po.CsElement;
|
||||||
import com.njcn.csharmonic.pojo.vo.ElementsVO;
|
import com.njcn.csharmonic.pojo.vo.ElementsVO;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -17,9 +18,9 @@ public interface ICsElementService extends IService<CsElement> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增组态图元
|
* 新增组态图元
|
||||||
* @param json 参数
|
* @param multipartFile 文件
|
||||||
*/
|
*/
|
||||||
void addElement(String json);
|
void addElement(MultipartFile multipartFile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组态图元数据查询
|
* 组态图元数据查询
|
||||||
|
|||||||
@@ -13,11 +13,9 @@ import com.njcn.oss.utils.FileStorageUtil;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.*;
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -38,9 +36,9 @@ public class CsElementServiceImpl extends ServiceImpl<CsElementMapper, CsElement
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void addElement(String json) {
|
public void addElement(MultipartFile multipartFile) {
|
||||||
CsElement csElement = new CsElement();
|
CsElement csElement = new CsElement();
|
||||||
if (Objects.isNull(json)){
|
if (Objects.isNull(multipartFile)){
|
||||||
throw new BusinessException("组态图元json缺失");
|
throw new BusinessException("组态图元json缺失");
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<CsElement> lambdaQueryWrapper = new LambdaQueryWrapper<CsElement>();
|
LambdaQueryWrapper<CsElement> lambdaQueryWrapper = new LambdaQueryWrapper<CsElement>();
|
||||||
@@ -50,9 +48,13 @@ public class CsElementServiceImpl extends ServiceImpl<CsElementMapper, CsElement
|
|||||||
} else {
|
} else {
|
||||||
csElement = new CsElement();
|
csElement = new CsElement();
|
||||||
}
|
}
|
||||||
InputStream inputStream = this.writeJsonStringToInputStream(json);
|
try {
|
||||||
|
InputStream inputStream = multipartFile.getInputStream();
|
||||||
String path = fileStorageUtil.uploadStream(inputStream, OssPath.ELEMENT, FileUtil.generateFileName("json"));
|
String path = fileStorageUtil.uploadStream(inputStream, OssPath.ELEMENT, FileUtil.generateFileName("json"));
|
||||||
csElement.setPath(path);
|
csElement.setPath(path);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
this.saveOrUpdate(csElement);
|
this.saveOrUpdate(csElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user