设备详情
This commit is contained in:
parent
e3b0fb567b
commit
b4c4f7b6cd
|
|
@ -0,0 +1,58 @@
|
|||
package com.securitycontrol.entity.background.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
* @date:2024-04-02-16:54
|
||||
* @version:1.0
|
||||
* @description:边带设备详情-vo
|
||||
*/
|
||||
@Data
|
||||
public class DeviceBdDetailVo {
|
||||
|
||||
@ApiModelProperty("ID")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("设备id")
|
||||
@NotBlank(message = "设备ID不能为空", groups = {Query.class})
|
||||
@Length(max = 50, message = "设备ID字符长度不能超过50", groups = {Query.class})
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("检测名称")
|
||||
@NotBlank(message = "检测名称不能为空", groups = {Query.class})
|
||||
@Length(max = 50, message = "检测名称字符长度不能超过50", groups = {Query.class})
|
||||
private String modeName;
|
||||
|
||||
@ApiModelProperty("最大阈值")
|
||||
@Length(max = 50, message = "最大阈值字符长度不能超过50", groups = {Query.class})
|
||||
@Pattern(regexp = "(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))",message = "最大阈值为大于0的数字",groups = {SignProVo.Query.class})
|
||||
private String maxValueData;
|
||||
|
||||
@ApiModelProperty("最小阈值")
|
||||
@Length(max = 50, message = "最小阈值长字符度不能超过50", groups = {Query.class})
|
||||
@Pattern(regexp = "(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))",message = "最小阈值为大于0的数字",groups = {SignProVo.Query.class})
|
||||
private String minValueData;
|
||||
|
||||
@ApiModelProperty("采集值类型")
|
||||
@Length(max = 50, message = "采集值类型字符长度不能超过50", groups = {Query.class})
|
||||
private String dataType;
|
||||
|
||||
@ApiModelProperty("设备级联编码")
|
||||
@Length(max = 50, message = "检设备级联编码字符长度不能超过50", groups = {Query.class})
|
||||
private String deviceCode;
|
||||
|
||||
@ApiModelProperty("1.新增 2.修改")
|
||||
private int type;
|
||||
|
||||
/**
|
||||
* 查询条件限制
|
||||
*/
|
||||
public interface Query {
|
||||
}
|
||||
}
|
||||
|
|
@ -64,6 +64,12 @@ public class HumanManageVo {
|
|||
@ApiModelProperty(value = "所属工程")
|
||||
private String proName;
|
||||
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
private String deptName;
|
||||
|
||||
@ApiModelProperty(value = "项目部名称")
|
||||
private String projectDepName;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
@ApiModelProperty(value = "删除的文件ID")
|
||||
private String delFiles;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.securitycontrol.common.core.web.domain.AjaxResult;
|
|||
import com.securitycontrol.common.core.web.page.TableDataInfo;
|
||||
import com.securitycontrol.common.log.annotation.Log;
|
||||
import com.securitycontrol.common.log.enums.OperationType;
|
||||
import com.securitycontrol.entity.background.vo.DeviceBdDetailVo;
|
||||
import com.securitycontrol.entity.background.dto.DeviceBdDto;
|
||||
import com.securitycontrol.entity.background.vo.DeviceBdChildVo;
|
||||
import com.securitycontrol.entity.background.vo.DeviceBdVo;
|
||||
|
|
@ -99,4 +100,41 @@ public class DeviceOfBdController extends BaseController {
|
|||
public AjaxResult delDeviceBdChildById(@RequestBody DeviceBdDto dto) {
|
||||
return service.delDeviceBdChildById(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取边带子设备详情列表")
|
||||
@GetMapping("getDeviceBdChildDetailList")
|
||||
@Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.QUERY_BUSINESS, details = "查询边带子设备详情列表", type = "业务日志")
|
||||
public TableDataInfo getDeviceBdChildDetailList(DeviceBdDto dto) {
|
||||
startPage();
|
||||
List<DeviceBdDetailVo> list = service.getDeviceBdChildDetailList(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增边带子设备详情数据")
|
||||
@PostMapping("addDeviceBdChildDetail")
|
||||
@Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.ADD_BUSINESS, details = "新增边带子设备详情数据", type = "业务日志")
|
||||
public AjaxResult addDeviceBdChildDetail(@RequestBody DeviceBdDetailVo vo) {
|
||||
return service.addOrUpdateDeviceBdChildDetail(vo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改边带子设备详情数据")
|
||||
@PostMapping("editDeviceBdChildDetail")
|
||||
@Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.UPDATE_BUSINESS, details = "修改边带子设备详情数据", type = "业务日志")
|
||||
public AjaxResult editDeviceBdChildDetail(@RequestBody DeviceBdDetailVo vo) {
|
||||
return service.addOrUpdateDeviceBdChildDetail(vo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "边带子设备详情数据")
|
||||
@GetMapping("getDeviceBdChildDetailById")
|
||||
public AjaxResult getDeviceBdChildDetailById(DeviceBdDto dto) {
|
||||
return service.getDeviceBdChildDetailById(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除边带子设备详情数据")
|
||||
@PostMapping("delDeviceBdChildDetail")
|
||||
@Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.DELETE_BUSINESS, details = "删除边带子设备详情", type = "业务日志")
|
||||
public AjaxResult delDeviceBdChildDetail(@RequestBody DeviceBdDto dto) {
|
||||
return service.delDeviceBdChildDetail(dto);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.securitycontrol.background.mapper;
|
|||
|
||||
import com.securitycontrol.entity.background.dto.DeviceBdDto;
|
||||
import com.securitycontrol.entity.background.vo.DeviceBdChildVo;
|
||||
import com.securitycontrol.entity.background.vo.DeviceBdDetailVo;
|
||||
import com.securitycontrol.entity.background.vo.DeviceBdVo;
|
||||
import com.securitycontrol.entity.background.vo.ProBdDevVo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
|
@ -145,6 +146,7 @@ public interface IDeviceOfBdMapper {
|
|||
|
||||
/**
|
||||
* 边带是否绑定重复工程
|
||||
*
|
||||
* @param vo
|
||||
* @return int
|
||||
* @description
|
||||
|
|
@ -152,4 +154,56 @@ public interface IDeviceOfBdMapper {
|
|||
* @date 2024/3/28 9:57
|
||||
*/
|
||||
int isRepeatBanding(DeviceBdVo vo);
|
||||
|
||||
/**
|
||||
* 获取边带子设备详情列表
|
||||
*
|
||||
* @param dto
|
||||
* @return List<DeviceBdDetailVo>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/4/2 17:00
|
||||
*/
|
||||
List<DeviceBdDetailVo> getDeviceBdChildDetailList(DeviceBdDto dto);
|
||||
|
||||
/**
|
||||
* 设备级联编码 是否存在
|
||||
*
|
||||
* @param vo
|
||||
* @return int
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/4/2 17:31
|
||||
*/
|
||||
int isBdDeviceDetailExist(DeviceBdDetailVo vo);
|
||||
|
||||
/**
|
||||
* 新增/修改边带子设备详情数据
|
||||
*
|
||||
* @param vo
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/4/2 17:31
|
||||
*/
|
||||
void addOrUpdateDeviceBdChildDetail(DeviceBdDetailVo vo);
|
||||
|
||||
/**
|
||||
* 边带子设备详情数据
|
||||
*
|
||||
* @param dto
|
||||
* @return DeviceBdDetailVo
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/4/2 17:39
|
||||
*/
|
||||
DeviceBdDetailVo getDeviceBdChildDetailById(DeviceBdDto dto);
|
||||
|
||||
/**
|
||||
* 删除边带子设备详情数据
|
||||
* @param dto
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/4/2 17:40
|
||||
*/
|
||||
void delDeviceBdChildDetail(DeviceBdDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.securitycontrol.background.service;
|
|||
|
||||
|
||||
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
||||
import com.securitycontrol.entity.background.vo.DeviceBdDetailVo;
|
||||
import com.securitycontrol.entity.background.dto.DeviceBdDto;
|
||||
import com.securitycontrol.entity.background.vo.DeviceBdChildVo;
|
||||
import com.securitycontrol.entity.background.vo.DeviceBdVo;
|
||||
|
|
@ -94,6 +95,7 @@ public interface IDeviceOfBdService {
|
|||
|
||||
/**
|
||||
* 删除边带设备
|
||||
*
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
|
|
@ -101,4 +103,47 @@ public interface IDeviceOfBdService {
|
|||
* @date 2024/3/20 19:50
|
||||
*/
|
||||
AjaxResult delDeviceBdChildById(DeviceBdDto dto);
|
||||
|
||||
/**
|
||||
* 获取边带子设备详情列表
|
||||
*
|
||||
* @param dto
|
||||
* @return List<DeviceBdDetailVo>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/4/2 16:59
|
||||
*/
|
||||
List<DeviceBdDetailVo> getDeviceBdChildDetailList(DeviceBdDto dto);
|
||||
|
||||
/**
|
||||
* 新增/修改边带子设备详情数据
|
||||
*
|
||||
* @param vo
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/4/2 17:24
|
||||
*/
|
||||
AjaxResult addOrUpdateDeviceBdChildDetail(DeviceBdDetailVo vo);
|
||||
|
||||
/**
|
||||
* 边带子设备详情数据
|
||||
*
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/4/2 17:25
|
||||
*/
|
||||
AjaxResult getDeviceBdChildDetailById(DeviceBdDto dto);
|
||||
|
||||
/**
|
||||
* 删除边带子设备详情数据
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/4/2 17:25
|
||||
*/
|
||||
AjaxResult delDeviceBdChildDetail(DeviceBdDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ package com.securitycontrol.background.service.impl;
|
|||
|
||||
import com.securitycontrol.background.mapper.IDeviceOfBdMapper;
|
||||
import com.securitycontrol.background.service.IDeviceOfBdService;
|
||||
import com.securitycontrol.common.core.constant.Constant;
|
||||
import com.securitycontrol.common.core.utils.StringUtils;
|
||||
import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
|
||||
import com.securitycontrol.common.core.utils.uuid.IdUtils;
|
||||
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
||||
import com.securitycontrol.common.security.utils.ValidatorsUtils;
|
||||
import com.securitycontrol.entity.background.vo.DeviceBdDetailVo;
|
||||
import com.securitycontrol.entity.background.dto.DeviceBdDto;
|
||||
import com.securitycontrol.entity.background.vo.DeviceBdChildVo;
|
||||
import com.securitycontrol.entity.background.vo.DeviceBdVo;
|
||||
|
|
@ -162,6 +162,7 @@ public class DeviceOfBdServiceImpl implements IDeviceOfBdService {
|
|||
mapper.addOrUpdateDeviceBdChild(vo);
|
||||
} catch (Exception e) {
|
||||
log.error("新增/修改边带设备", e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
|
|
@ -194,4 +195,72 @@ public class DeviceOfBdServiceImpl implements IDeviceOfBdService {
|
|||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceBdDetailVo> getDeviceBdChildDetailList(DeviceBdDto dto) {
|
||||
List<DeviceBdDetailVo> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getDeviceBdChildDetailList(dto);
|
||||
} catch (Exception e) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
log.error("获取边带子设备详情列表", e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult addOrUpdateDeviceBdChildDetail(DeviceBdDetailVo vo) {
|
||||
try {
|
||||
String validResult = validatorsUtils.valid(vo, DeviceBdDetailVo.Query.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
int result = mapper.isBdDeviceDetailExist(vo);
|
||||
if (result > 0) {
|
||||
return AjaxResult.error("设备级联编码不能重复");
|
||||
}
|
||||
if (StringUtils.isEmpty(vo.getId())) {
|
||||
String id = IdUtils.getUUId();
|
||||
vo.setId(id);
|
||||
vo.setType(1);
|
||||
} else {
|
||||
vo.setType(2);
|
||||
}
|
||||
mapper.addOrUpdateDeviceBdChildDetail(vo);
|
||||
} catch (Exception e) {
|
||||
log.error("新增/修改边带子设备详情数据", e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getDeviceBdChildDetailById(DeviceBdDto dto) {
|
||||
DeviceBdDetailVo vo = new DeviceBdDetailVo();
|
||||
try {
|
||||
vo = mapper.getDeviceBdChildDetailById(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("边带子设备详情数据", e);
|
||||
}
|
||||
return AjaxResult.success(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult delDeviceBdChildDetail(DeviceBdDto dto) {
|
||||
try {
|
||||
if (StringUtils.isEmpty(dto.getId())) {
|
||||
return AjaxResult.error("参数不完整");
|
||||
}
|
||||
mapper.delDeviceBdChildDetail(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("删除边带子设备详情数据", e);
|
||||
//手动回滚异常
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,44 @@
|
|||
<if test="bidTime != null and bidTime!=''">#{bidTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<!--新增/修改边带子设备详情数据-->
|
||||
<insert id="addOrUpdateDeviceBdChildDetail">
|
||||
<if test="type == 1">
|
||||
INSERT INTO tb_device_detail
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null and id != ''">id,</if>
|
||||
<if test="deviceId != null and deviceId!=''">device_id,</if>
|
||||
<if test="modeName != null and modeName!=''">mode_name,</if>
|
||||
<if test="maxValueData != null and maxValueData!=''">max_value,</if>
|
||||
<if test="minValueData != null and minValueData!=''">min_valu,</if>
|
||||
<if test="dataType != null and dataType!=''">data_type,</if>
|
||||
del_flag,
|
||||
<if test="deviceCode != null and deviceCode!=''">device_code,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null and id != ''">#{id},</if>
|
||||
<if test="deviceId != null and deviceId!=''">#{deviceId},</if>
|
||||
<if test="modeName != null and modeName!=''">#{modeName},</if>
|
||||
<if test="maxValueData != null and maxValueData!=''">#{maxValueData},</if>
|
||||
<if test="minValueData != null and minValueData != ''">#{minValueData},</if>
|
||||
<if test="dataType != null and dataType!=''">#{dataType},</if>
|
||||
0,
|
||||
<if test="deviceCode != null and deviceCode!=''">#{deviceCode},</if>
|
||||
</trim>
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
UPDATE tb_device_detail
|
||||
<set>
|
||||
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
|
||||
<if test="modeName != null and modeName != ''">mode_name = #{modeName},</if>
|
||||
<if test="maxValueData != null and maxValueData != ''">max_value = #{maxValueData},</if>
|
||||
<if test="minValueData != null and minValueData != ''">min_valu = #{minValueData},</if>
|
||||
<if test="dataType != null and dataType != ''">data_type = #{dataType},</if>
|
||||
<if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</if>
|
||||
</insert>
|
||||
<!--删除边带设备-->
|
||||
<delete id="delDeviceBdById">
|
||||
UPDATE tb_pro_bd SET del_flag = 1 WHERE id = #{id}
|
||||
|
|
@ -125,6 +163,10 @@
|
|||
<delete id="delDeviceBdChildById">
|
||||
UPDATE tb_bd_device SET del_flag = 1 WHERE device_id = #{id}
|
||||
</delete>
|
||||
<!--删除边带子设备详情数据-->
|
||||
<update id="delDeviceBdChildDetail">
|
||||
UPDATE tb_device_detail SET del_flag = 1 WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!--获取边带列表-->
|
||||
<select id="getDeviceBdList" resultType="com.securitycontrol.entity.background.vo.DeviceBdVo">
|
||||
|
|
@ -236,4 +278,40 @@
|
|||
<select id="isRepeatBanding" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM tb_pro_bd WHERE id = #{id} AND bid_code = #{bidCode}
|
||||
</select>
|
||||
<!--获取边带子设备详情列表-->
|
||||
<select id="getDeviceBdChildDetailList"
|
||||
resultType="com.securitycontrol.entity.background.vo.DeviceBdDetailVo">
|
||||
SELECT id,
|
||||
mode_name AS modeName,
|
||||
max_value AS maxValueData,
|
||||
min_valu AS minValueData,
|
||||
data_type AS dataType,
|
||||
device_code AS deviceCode
|
||||
FROM tb_device_detail
|
||||
WHERE device_id = #{id} AND del_flag = 0
|
||||
<if test="keyWord!=null and keyWord!=''">
|
||||
AND INSTR(mode_name,#{keyWord}) > 0
|
||||
</if>
|
||||
</select>
|
||||
<!--设备级联编码 是否存在-->
|
||||
<select id="isBdDeviceDetailExist" resultType="java.lang.Integer">
|
||||
<if test="id == null or id == ''">
|
||||
SELECT COUNT(*) FROM tb_device_detail tdd WHERE device_id = #{deviceId} AND device_code = #{deviceCode} AND del_flag = 0
|
||||
</if>
|
||||
<if test="id != null and id != ''">
|
||||
SELECT COUNT(*) FROM tb_device_detail tdd WHERE device_id = #{deviceId} AND device_code = #{deviceCode} AND id != #{id} AND del_flag = 0
|
||||
</if>
|
||||
</select>
|
||||
<!--边带子设备详情数据-->
|
||||
<select id="getDeviceBdChildDetailById"
|
||||
resultType="com.securitycontrol.entity.background.vo.DeviceBdDetailVo">
|
||||
SELECT id,
|
||||
mode_name AS modeName,
|
||||
max_value AS maxValueData,
|
||||
min_valu AS minValueData,
|
||||
data_type AS dataType,
|
||||
device_code AS deviceCode
|
||||
FROM tb_device_detail
|
||||
WHERE id = #{id} AND del_flag = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -213,7 +213,8 @@
|
|||
tsp.start_date AS startDate,
|
||||
tsp.end_date AS endDate,
|
||||
tsp.complete_date AS completeDate,
|
||||
sb.city_name AS orgName
|
||||
sb.city_name AS orgName,
|
||||
tsp.signle_no AS signleNo
|
||||
FROM tb_sign_project tsp
|
||||
LEFT JOIN sys_build sb ON tsp.org_id = sb.org_id
|
||||
LEFT JOIN tb_jj_project tjp ON tsp.project_no = tjp.pro_no AND tjp.del_flag = 0
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<!--查询用户角色-->
|
||||
<select id="selectUserByUserName" parameterType="String" resultType="com.securitycontrol.system.api.domain.SysUser">
|
||||
select user_id userId,user_name userName,login_name nickName,
|
||||
`password`,su.org_id AS orgId,dept_name deptName,org_name orgName,is_admin,sr.role_id AS roleId,
|
||||
`password`,su.org_id AS orgId,dept_name deptName,org_name orgName,is_admin AS isAdmin,sr.role_id AS roleId,
|
||||
su.user_type AS userType,su.login_type AS loginType,status,
|
||||
sr.role_name roleName,phone,su.login_ip loginIp,su.login_name login_time,
|
||||
sr.role_code AS roleCode
|
||||
|
|
|
|||
Loading…
Reference in New Issue