唐耀东
2022-05-12 ede630639ad494189282c2c02dbcd4b88741cc30
提交代码
11个文件已修改
8个文件已添加
895 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/SgIotController.java 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/domain/SgIot.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/SgIotBo.java 171 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SgIotVo.java 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/mapper/SgIotMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/service/ISgIotService.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/BsBuildingServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/BsOrganizationServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/BsSchoolServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/DevBatchServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/DevEquipmentLogServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/DevEquipmentServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/DevManufacturerServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgConstructionBatchServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgIotServiceImpl.java 197 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgIpcServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgNvrServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgReserveIpServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-oa/src/main/resources/mapper/oa/SgIotMapper.xml 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/SgIotController.java
New file
@@ -0,0 +1,127 @@
package com.ruoyi.web.controller.oa;
import java.util.List;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import com.ruoyi.common.annotation.DataDictClass;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.core.validate.QueryGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.oa.domain.vo.SgIotVo;
import com.ruoyi.oa.domain.bo.SgIotBo;
import com.ruoyi.oa.service.ISgIotService;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiOperation;
/**
 * IoT设备Controller
 *
 * @author ruoyi
 * @date 2022-05-12
 */
@Validated
@Api(value = "IoT设备控制器", tags = {"IoT设备管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/oa/iot")
public class SgIotController extends BaseController {
    private final ISgIotService iSgIotService;
    /**
     * 查询IoT设备列表
     */
    @DataDictClass
    @ApiOperation("查询IoT设备列表")
    @PreAuthorize("@ss.hasPermi('oa:iot:list')")
    @GetMapping("/list")
    public TableDataInfo<SgIotVo> list(@Validated(QueryGroup.class) SgIotBo bo) {
        return iSgIotService.queryPageList(bo);
    }
    /**
     * 获取外设数量
     */
    @ApiOperation("查询IoT设备列表")
    @GetMapping("/number")
    public AjaxResult getNumber(SgIotBo bo) {
        return AjaxResult.success(iSgIotService.getNumber(bo));
    }
    /**
     * 导出IoT设备列表
     */
    @ApiOperation("导出IoT设备列表")
    @PreAuthorize("@ss.hasPermi('oa:iot:export')")
    @Log(title = "IoT设备", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public void export(@Validated SgIotBo bo, HttpServletResponse response) {
        List<SgIotVo> list = iSgIotService.queryList(bo);
        ExcelUtil.exportExcel(list, "IoT设备", SgIotVo.class, response);
    }
    /**
     * 获取IoT设备详细信息
     */
    @ApiOperation("获取IoT设备详细信息")
    @PreAuthorize("@ss.hasPermi('oa:iot:query')")
    @GetMapping("/{id}")
    public AjaxResult<SgIotVo> getInfo(@ApiParam("主键")
                                                  @NotNull(message = "主键不能为空")
                                                  @PathVariable("id") Long id) {
        return AjaxResult.success(iSgIotService.queryById(id));
    }
    /**
     * 新增IoT设备
     */
    @ApiOperation("新增IoT设备")
    @PreAuthorize("@ss.hasPermi('oa:iot:add')")
    @Log(title = "IoT设备", businessType = BusinessType.INSERT)
    @RepeatSubmit()
    @PostMapping()
    public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody SgIotBo bo) {
        return toAjax(iSgIotService.insertByBo(bo) ? 1 : 0);
    }
    /**
     * 修改IoT设备
     */
    @ApiOperation("修改IoT设备")
    @PreAuthorize("@ss.hasPermi('oa:iot:edit')")
    @Log(title = "IoT设备", businessType = BusinessType.UPDATE)
    @RepeatSubmit()
    @PutMapping()
    public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody SgIotBo bo) {
        return toAjax(iSgIotService.updateByBo(bo) ? 1 : 0);
    }
    /**
     * 删除IoT设备
     */
    @ApiOperation("删除IoT设备")
    @PreAuthorize("@ss.hasPermi('oa:iot:remove')")
    @Log(title = "IoT设备" , businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult<Void> remove(@ApiParam("主键串")
                                       @NotEmpty(message = "主键不能为空")
                                       @PathVariable Long[] ids) {
        return toAjax(iSgIotService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
    }
}
ruoyi-oa/src/main/java/com/ruoyi/oa/domain/SgIot.java
New file
@@ -0,0 +1,101 @@
package com.ruoyi.oa.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import com.ruoyi.common.core.domain.BaseEntity;
/**
 * IoT设备对象 sg_iot
 *
 * @author ruoyi
 * @date 2022-05-12
 */
@Data
@Accessors(chain = true)
@TableName("sg_iot")
public class SgIot extends BaseEntity {
    private static final long serialVersionUID=1L;
    /**
     *
     */
    @TableId(value = "id")
    private Long id;
    /**
     * 高校
     */
    private Long schoolId;
    /**
     * 部署名称
     */
    private String deploymentName;
    /**
     * 版本
     */
    private String edition;
    /**
     * LAN
     */
    private String lan;
    /**
     * IP
     */
    private String ip;
    /**
     * 安装位置
     */
    private Long buildingId;
    /**
     * 所属单位
     */
    private Long organizationId;
    /**
     * 施工批次
     */
    private Long constructionBatchId;
    /**
     * 序列号
     */
    private String serialNumber;
    /**
     * 型号
     */
    private String model;
    /**
     * 生产厂商
     */
    private Long manufacturerId;
    /**
     * 监控对象
     */
    private String monitorObject;
    /**
     * 通道1
     */
    private Long passagewayOne;
    /**
     * 通道2
     */
    private Long passagewayTwo;
    /**
     * 通道3
     */
    private Long passagewayThree;
    /**
     * 通道4
     */
    private Long passagewayFour;
    /**
     *
     */
    @TableLogic
    private String delFlag;
}
ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/SgIotBo.java
New file
@@ -0,0 +1,171 @@
package com.ruoyi.oa.domain.bo;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.*;
import java.util.Date;
import com.ruoyi.common.core.domain.BaseEntity;
/**
 * IoT设备业务对象 sg_iot
 *
 * @author ruoyi
 * @date 2022-05-12
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("IoT设备业务对象")
public class SgIotBo extends BaseEntity {
    /**
     *
     */
    @ApiModelProperty(value = "", required = true)
    @NotNull(message = "不能为空", groups = { EditGroup.class })
    private Long id;
    /**
     * 高校
     */
    private Long schoolId;
    /**
     * 部署名称
     */
    @ApiModelProperty(value = "部署名称", required = true)
    @NotBlank(message = "部署名称不能为空", groups = { AddGroup.class, EditGroup.class })
    private String deploymentName;
    /**
     * 版本
     */
    @ApiModelProperty(value = "版本", required = true)
    @NotBlank(message = "版本不能为空", groups = { AddGroup.class, EditGroup.class })
    private String edition;
    /**
     * LAN
     */
    @ApiModelProperty(value = "LAN", required = true)
    @NotBlank(message = "LAN不能为空", groups = { AddGroup.class, EditGroup.class })
    private String lan;
    /**
     * IP
     */
    @ApiModelProperty(value = "IP", required = true)
    @NotBlank(message = "IP不能为空", groups = { AddGroup.class, EditGroup.class })
    private String ip;
    /**
     * 安装位置
     */
    @ApiModelProperty(value = "安装位置", required = true)
    @NotNull(message = "安装位置不能为空", groups = { AddGroup.class, EditGroup.class })
    private Long buildingId;
    /**
     * 所属单位
     */
    @ApiModelProperty(value = "所属单位", required = true)
    @NotNull(message = "所属单位不能为空", groups = { AddGroup.class, EditGroup.class })
    private Long organizationId;
    /**
     * 施工批次
     */
    @ApiModelProperty(value = "施工批次", required = true)
    @NotNull(message = "施工批次不能为空", groups = { AddGroup.class, EditGroup.class })
    private Long constructionBatchId;
    /**
     * 序列号
     */
    @ApiModelProperty(value = "序列号")
    private String serialNumber;
    /**
     * 型号
     */
    @ApiModelProperty(value = "型号")
    private String model;
    /**
     * 生产厂商
     */
    @ApiModelProperty(value = "生产厂商")
    private Long manufacturerId;
    /**
     * 监控对象
     */
    @ApiModelProperty(value = "监控对象")
    private String monitorObject;
    /**
     * 通道1
     */
    @ApiModelProperty(value = "通道1")
    private Long passagewayOne;
    /**
     * 通道2
     */
    @ApiModelProperty(value = "通道2")
    private Long passagewayTwo;
    /**
     * 通道3
     */
    @ApiModelProperty(value = "通道3")
    private Long passagewayThree;
    /**
     * 通道4
     */
    @ApiModelProperty(value = "通道4")
    private Long passagewayFour;
    /**
     * 通道
     */
    @ApiModelProperty(value = "通道")
    private String passageway;
    /**
     * 外设单元
     */
    @ApiModelProperty(value = "外设单元")
    private Long peripheralUnit;
    /**
     * 分页大小
     */
    @ApiModelProperty("分页大小")
    private Integer pageSize;
    /**
     * 当前页数
     */
    @ApiModelProperty("当前页数")
    private Integer pageNum;
    /**
     * 排序列
     */
    @ApiModelProperty("排序列")
    private String orderByColumn;
    /**
     * 排序的方向desc或者asc
     */
    @ApiModelProperty(value = "排序的方向", example = "asc,desc")
    private String isAsc;
}
ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SgIotVo.java
New file
@@ -0,0 +1,153 @@
package com.ruoyi.oa.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.ruoyi.common.annotation.Dict;
import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.convert.ExcelDictConvert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * IoT设备视图对象 sg_iot
 *
 * @author ruoyi
 * @date 2022-05-12
 */
@Data
@ApiModel("IoT设备视图对象")
@ExcelIgnoreUnannotated
public class SgIotVo {
    private static final long serialVersionUID = 1L;
    /**
     *
     */
    @ExcelProperty(value = "")
    @ApiModelProperty("")
    private Long id;
    /**
     * 高校
     */
    private Long schoolId;
    /**
     * 部署名称
     */
    @ExcelProperty(value = "部署名称")
    @ApiModelProperty("部署名称")
    private String deploymentName;
    /**
     * 版本
     */
    @ExcelProperty(value = "版本", converter = ExcelDictConvert.class)
    @ExcelDictFormat(dictType = "DICT110")
    @ApiModelProperty("版本")
    private String edition;
    /**
     * LAN
     */
    @ExcelProperty(value = "LAN")
    @ApiModelProperty("LAN")
    private String lan;
    /**
     * IP
     */
    @ExcelProperty(value = "IP")
    @ApiModelProperty("IP")
    private String ip;
    /**
     * 安装位置
     */
    @ExcelProperty(value = "安装位置")
    @ApiModelProperty("安装位置")
    @Dict(dictTable = "bs_building", dicCode = "id", dicText = "detailed_name")
    private Long buildingId;
    /**
     * 所属单位
     */
    @ExcelProperty(value = "所属单位")
    @ApiModelProperty("所属单位")
    @Dict(dictTable = "bs_organization", dicCode = "id", dicText = "detailed_name")
    private Long organizationId;
    /**
     * 施工批次
     */
    @ExcelProperty(value = "施工批次")
    @ApiModelProperty("施工批次")
    @Dict(dictTable = "sg_construction_batch", dicCode = "id", dicText = "batch")
    private Long constructionBatchId;
    /**
     * 序列号
     */
    @ExcelProperty(value = "序列号")
    @ApiModelProperty("序列号")
    private String serialNumber;
    /**
     * 型号
     */
    @ExcelProperty(value = "型号")
    @ApiModelProperty("型号")
    private String model;
    /**
     * 生产厂商
     */
    @ExcelProperty(value = "生产厂商")
    @ApiModelProperty("生产厂商")
    @Dict(dictTable = "dev_manufacturer", dicCode = "id", dicText = "name")
    private Long manufacturerId;
    /**
     * 监控对象
     */
    @ExcelProperty(value = "监控对象")
    @ApiModelProperty("监控对象")
    private String monitorObject;
    /**
     * 通道1
     */
    @ExcelProperty(value = "通道1", converter = ExcelDictConvert.class)
    @ApiModelProperty("通道1")
    @Dict(dictTable = "dev_peripheral_unit", dicCode = "id", dicText = "name")
    private Long passagewayOne;
    /**
     * 通道2
     */
    @ExcelProperty(value = "通道2")
    @ApiModelProperty("通道2")
    @Dict(dictTable = "dev_peripheral_unit", dicCode = "id", dicText = "name")
    private Long passagewayTwo;
    /**
     * 通道3
     */
    @ExcelProperty(value = "通道3")
    @ApiModelProperty("通道3")
    @Dict(dictTable = "dev_peripheral_unit", dicCode = "id", dicText = "name")
    private Long passagewayThree;
    /**
     * 通道4
     */
    @ExcelProperty(value = "通道4")
    @ApiModelProperty("通道4")
    @Dict(dictTable = "dev_peripheral_unit", dicCode = "id", dicText = "name")
    private Long passagewayFour;
}
ruoyi-oa/src/main/java/com/ruoyi/oa/mapper/SgIotMapper.java
New file
@@ -0,0 +1,14 @@
package com.ruoyi.oa.mapper;
import com.ruoyi.oa.domain.SgIot;
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
/**
 * IoT设备Mapper接口
 *
 * @author ruoyi
 * @date 2022-05-12
 */
public interface SgIotMapper extends BaseMapperPlus<SgIot> {
}
ruoyi-oa/src/main/java/com/ruoyi/oa/service/ISgIotService.java
New file
@@ -0,0 +1,58 @@
package com.ruoyi.oa.service;
import com.ruoyi.oa.domain.SgIot;
import com.ruoyi.oa.domain.vo.SgIotVo;
import com.ruoyi.oa.domain.bo.SgIotBo;
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import java.util.Collection;
import java.util.List;
/**
 * IoT设备Service接口
 *
 * @author ruoyi
 * @date 2022-05-12
 */
public interface ISgIotService extends IServicePlus<SgIot, SgIotVo> {
    /**
     * 查询单个
     * @return
     */
    SgIotVo queryById(Long id);
    /**
     * 查询列表
     */
    TableDataInfo<SgIotVo> queryPageList(SgIotBo bo);
    /**
     * 查询列表
     */
    List<SgIotVo> queryList(SgIotBo bo);
    /**
     * 根据新增业务对象插入IoT设备
     * @param bo IoT设备新增业务对象
     * @return
     */
    Boolean insertByBo(SgIotBo bo);
    /**
     * 根据编辑业务对象修改IoT设备
     * @param bo IoT设备编辑业务对象
     * @return
     */
    Boolean updateByBo(SgIotBo bo);
    /**
     * 校验并删除数据
     * @param ids 主键集合
     * @param isValid 是否校验,true-删除前校验,false-不校验
     * @return
     */
    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
    int getNumber(SgIotBo bo);
}
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/BsBuildingServiceImpl.java
@@ -18,6 +18,7 @@
import com.ruoyi.oa.domain.BsBuilding;
import com.ruoyi.oa.mapper.BsBuildingMapper;
import com.ruoyi.oa.service.IBsBuildingService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -60,6 +61,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean insertByBo(BsBuildingBo bo) {
        BsBuilding add = BeanUtil.toBean(bo, BsBuilding.class);
        if (bo.getParentId() == Long.valueOf(0)) {
@@ -79,6 +81,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateByBo(BsBuildingBo bo) {
        BsBuilding update = BeanUtil.toBean(bo, BsBuilding.class);
        if (bo.getParentId() == Long.valueOf(0)) {
@@ -104,6 +107,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
        List<BsBuilding> list = baseMapper.selectList(new LambdaQueryWrapper<BsBuilding>()
            .in(BsBuilding::getParentId, ids));
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/BsOrganizationServiceImpl.java
@@ -17,6 +17,7 @@
import com.ruoyi.oa.domain.BsOrganization;
import com.ruoyi.oa.mapper.BsOrganizationMapper;
import com.ruoyi.oa.service.IBsOrganizationService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -54,6 +55,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean insertByBo(BsOrganizationBo bo) {
        BsOrganization add = BeanUtil.toBean(bo, BsOrganization.class);
        if (bo.getParentId() == Long.valueOf(0)) {
@@ -73,6 +75,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateByBo(BsOrganizationBo bo) {
        BsOrganization update = BeanUtil.toBean(bo, BsOrganization.class);
        if (bo.getParentId() == Long.valueOf(0)) {
@@ -98,6 +101,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
        List<BsOrganization> list = baseMapper.selectList(new LambdaQueryWrapper<BsOrganization>()
            .in(BsOrganization::getParentId, ids));
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/BsSchoolServiceImpl.java
@@ -18,6 +18,7 @@
import com.ruoyi.oa.domain.BsSchool;
import com.ruoyi.oa.mapper.BsSchoolMapper;
import com.ruoyi.oa.service.IBsSchoolService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -64,6 +65,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean insertByBo(BsSchoolBo bo) {
        List<BsSchool> list = baseMapper.selectList(new QueryWrapper<BsSchool>().lambda().eq(BsSchool::getCode, bo.getCode()));
        if (list.size() > 0) {
@@ -79,6 +81,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateByBo(BsSchoolBo bo) {
        List<BsSchool> list = baseMapper.selectList(new QueryWrapper<BsSchool>().lambda()
            .eq(BsSchool::getCode, bo.getCode()).ne(BsSchool::getId, bo.getId()));
@@ -100,6 +103,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
        if(isValid){
            //TODO 做一些业务上的校验,判断是否需要校验
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/DevBatchServiceImpl.java
@@ -14,6 +14,7 @@
import com.ruoyi.oa.domain.DevBatch;
import com.ruoyi.oa.mapper.DevBatchMapper;
import com.ruoyi.oa.service.IDevBatchService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -55,6 +56,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean insertByBo(DevBatchBo bo) {
        DevBatch add = BeanUtil.toBean(bo, DevBatch.class);
        validEntityBeforeSave(add);
@@ -66,6 +68,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateByBo(DevBatchBo bo) {
        DevBatch update = BeanUtil.toBean(bo, DevBatch.class);
        validEntityBeforeSave(update);
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/DevEquipmentLogServiceImpl.java
@@ -18,6 +18,7 @@
import com.ruoyi.oa.domain.DevEquipmentLog;
import com.ruoyi.oa.mapper.DevEquipmentLogMapper;
import com.ruoyi.oa.service.IDevEquipmentLogService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -62,6 +63,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean insertByBo(DevEquipmentLogBo bo) {
        DevEquipmentLog add = BeanUtil.toBean(bo, DevEquipmentLog.class);
        validEntityBeforeSave(add);
@@ -73,6 +75,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateByBo(DevEquipmentLogBo bo) {
        DevEquipmentLog update = BeanUtil.toBean(bo, DevEquipmentLog.class);
        validEntityBeforeSave(update);
@@ -97,6 +100,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void recordOper(EquipmentLogDTO dto){
        DevEquipmentLog po = BeanUtil.toBean(dto, DevEquipmentLog.class);
        // 远程查询操作地点
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/DevEquipmentServiceImpl.java
@@ -96,6 +96,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateByBo(DevEquipmentBo bo) {
        List<DevEquipment> list = baseMapper.selectList(new QueryWrapper<DevEquipment>().lambda()
            .eq(DevEquipment::getSequenceCode, bo.getSequenceCode())
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/DevManufacturerServiceImpl.java
@@ -17,6 +17,7 @@
import com.ruoyi.oa.domain.DevManufacturer;
import com.ruoyi.oa.mapper.DevManufacturerMapper;
import com.ruoyi.oa.service.IDevManufacturerService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -59,6 +60,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean insertByBo(DevManufacturerBo bo) {
        List<DevManufacturer> list = baseMapper.selectList(new QueryWrapper<DevManufacturer>().lambda()
            .eq(DevManufacturer::getCode, bo.getCode()));
@@ -75,6 +77,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateByBo(DevManufacturerBo bo) {
        List<DevManufacturer> list = baseMapper.selectList(new QueryWrapper<DevManufacturer>().lambda()
            .eq(DevManufacturer::getCode, bo.getCode()).ne(DevManufacturer::getId, bo.getId()));
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgConstructionBatchServiceImpl.java
@@ -16,6 +16,7 @@
import com.ruoyi.oa.domain.SgConstructionBatch;
import com.ruoyi.oa.mapper.SgConstructionBatchMapper;
import com.ruoyi.oa.service.ISgConstructionBatchService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -51,10 +52,12 @@
        LambdaQueryWrapper<SgConstructionBatch> lqw = Wrappers.lambdaQuery();
        lqw.like(StringUtils.isNotBlank(bo.getBatch()), SgConstructionBatch::getBatch, bo.getBatch());
        lqw.eq(SgConstructionBatch::getSchoolId, bo.getSchoolId());
        lqw.orderByDesc(SgConstructionBatch::getUpdateTime);
        return lqw;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean insertByBo(SgConstructionBatchBo bo) {
        List<SgConstructionBatch> list = baseMapper.selectList(new LambdaQueryWrapper<SgConstructionBatch>()
            .eq(SgConstructionBatch::getBatch, bo.getBatch()).eq(SgConstructionBatch::getSchoolId, bo.getSchoolId()));
@@ -71,6 +74,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateByBo(SgConstructionBatchBo bo) {
        List<SgConstructionBatch> list = baseMapper.selectList(new LambdaQueryWrapper<SgConstructionBatch>()
            .eq(SgConstructionBatch::getBatch, bo.getBatch())
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgIotServiceImpl.java
New file
@@ -0,0 +1,197 @@
package com.ruoyi.oa.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.http.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.core.page.PagePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.oa.domain.bo.SgIotBo;
import com.ruoyi.oa.domain.vo.SgIotVo;
import com.ruoyi.oa.domain.SgIot;
import com.ruoyi.oa.mapper.SgIotMapper;
import com.ruoyi.oa.service.ISgIotService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
 * IoT设备Service业务层处理
 *
 * @author ruoyi
 * @date 2022-05-12
 */
@Service
public class SgIotServiceImpl extends ServicePlusImpl<SgIotMapper, SgIot, SgIotVo> implements ISgIotService {
    @Override
    public SgIotVo queryById(Long id) {
        return getVoById(id);
    }
    @Override
    public TableDataInfo<SgIotVo> queryPageList(SgIotBo bo) {
        PagePlus<SgIot, SgIotVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo));
        return PageUtils.buildDataInfo(result);
    }
    @Override
    public List<SgIotVo> queryList(SgIotBo bo) {
        return listVo(buildQueryWrapper(bo));
    }
    private LambdaQueryWrapper<SgIot> buildQueryWrapper(SgIotBo bo) {
        Map<String, Object> params = bo.getParams();
        LambdaQueryWrapper<SgIot> lqw = Wrappers.lambdaQuery();
        lqw.like(StringUtils.isNotBlank(bo.getDeploymentName()), SgIot::getDeploymentName, bo.getDeploymentName());
        lqw.eq(StringUtils.isNotBlank(bo.getEdition()), SgIot::getEdition, bo.getEdition());
        lqw.eq(bo.getBuildingId() != null, SgIot::getBuildingId, bo.getBuildingId());
        lqw.eq(bo.getOrganizationId() != null, SgIot::getOrganizationId, bo.getOrganizationId());
        lqw.eq(bo.getConstructionBatchId() != null, SgIot::getConstructionBatchId, bo.getConstructionBatchId());
        lqw.like(StringUtils.isNotBlank(bo.getMonitorObject()), SgIot::getMonitorObject, bo.getMonitorObject());
        lqw.eq(SgIot::getSchoolId, bo.getSchoolId());
        lqw.orderByDesc(SgIot::getUpdateTime);
        if (bo.getPeripheralUnit() != null && StringUtils.isNotBlank(bo.getPassageway())) {
            if ("1".equals(bo.getPassageway())) {
                lqw.eq(SgIot::getPassagewayOne, bo.getPeripheralUnit());
            }
            if ("2".equals(bo.getPassageway())) {
                lqw.eq(SgIot::getPassagewayTwo, bo.getPeripheralUnit());
            }
            if ("3".equals(bo.getPassageway())) {
                lqw.eq(SgIot::getPassagewayThree, bo.getPeripheralUnit());
            }
            if ("4".equals(bo.getPassageway())) {
                lqw.eq(SgIot::getPassagewayFour, bo.getPeripheralUnit());
            }
            if ("5".equals(bo.getPassageway())) {
                lqw.and(i -> i.eq(SgIot::getPassagewayOne, bo.getPeripheralUnit())
                    .or().eq(SgIot::getPassagewayTwo, bo.getPeripheralUnit())
                    .or().eq(SgIot::getPassagewayThree, bo.getPeripheralUnit())
                    .or().eq(SgIot::getPassagewayFour, bo.getPeripheralUnit()));
            }
        }
        return lqw;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean insertByBo(SgIotBo bo) {
        List<SgIot> list = baseMapper.selectList(new LambdaQueryWrapper<SgIot>()
            .eq(SgIot::getDeploymentName, bo.getDeploymentName())
            .eq(SgIot::getSchoolId, bo.getSchoolId()));
        if (list.size() > 0) {
            throw new ServiceException("部署名称重复", HttpStatus.HTTP_PARTIAL);
        }
        List<SgIot> lanList = baseMapper.selectList(new LambdaQueryWrapper<SgIot>()
            .eq(SgIot::getLan, bo.getLan())
            .eq(SgIot::getSchoolId, bo.getSchoolId()));
        if (lanList.size() > 0) {
            throw new ServiceException("LAN重复", HttpStatus.HTTP_PARTIAL);
        }
        SgIot add = BeanUtil.toBean(bo, SgIot.class);
        validEntityBeforeSave(add);
        boolean flag = save(add);
        if (flag) {
            bo.setId(add.getId());
        }
        return flag;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateByBo(SgIotBo bo) {
        List<SgIot> list = baseMapper.selectList(new LambdaQueryWrapper<SgIot>()
            .eq(SgIot::getDeploymentName, bo.getDeploymentName())
            .eq(SgIot::getSchoolId, bo.getSchoolId())
            .ne(SgIot::getId, bo.getId()));
        if (list.size() > 0) {
            throw new ServiceException("部署名称重复", HttpStatus.HTTP_PARTIAL);
        }
        List<SgIot> lanList = baseMapper.selectList(new LambdaQueryWrapper<SgIot>()
            .eq(SgIot::getLan, bo.getLan())
            .eq(SgIot::getSchoolId, bo.getSchoolId())
            .ne(SgIot::getId, bo.getId()));
        if (lanList.size() > 0) {
            throw new ServiceException("LAN重复", HttpStatus.HTTP_PARTIAL);
        }
        SgIot update = BeanUtil.toBean(bo, SgIot.class);
        validEntityBeforeSave(update);
        return updateById(update);
    }
    @Override
    public int getNumber(SgIotBo bo) {
        int sum = 0;
        LambdaQueryWrapper<SgIot> lqw = Wrappers.lambdaQuery();
        lqw.eq(SgIot::getSchoolId, bo.getSchoolId());
        if (bo.getPeripheralUnit() != null && StringUtils.isNotBlank(bo.getPassageway())) {
            if ("5".equals(bo.getPassageway())) {
                lqw.and(i -> i.eq(SgIot::getPassagewayOne, bo.getPeripheralUnit())
                    .or().eq(SgIot::getPassagewayTwo, bo.getPeripheralUnit())
                    .or().eq(SgIot::getPassagewayThree, bo.getPeripheralUnit())
                    .or().eq(SgIot::getPassagewayFour, bo.getPeripheralUnit()));
                List<SgIot> list = baseMapper.selectList(lqw);
                if (list.size() > 0) {
                    for (SgIot s : list) {
                        if (s.getPassagewayOne() != null && s.getPassagewayOne().equals(bo.getPeripheralUnit())) {
                            sum = sum + 1;
                        }
                        if (s.getPassagewayTwo() != null && s.getPassagewayTwo().equals(bo.getPeripheralUnit())) {
                            sum = sum + 1;
                        }
                        if (s.getPassagewayThree() != null && s.getPassagewayThree().equals(bo.getPeripheralUnit())) {
                            sum = sum + 1;
                        }
                        if (s.getPassagewayFour() != null && s.getPassagewayFour().equals(bo.getPeripheralUnit())) {
                            sum = sum + 1;
                        }
                    }
                } else {
                    sum = 0;
                }
            } else {
                if ("1".equals(bo.getPassageway())) {
                    lqw.eq(SgIot::getPassagewayOne, bo.getPeripheralUnit());
                }
                if ("2".equals(bo.getPassageway())) {
                    lqw.eq(SgIot::getPassagewayTwo, bo.getPeripheralUnit());
                }
                if ("3".equals(bo.getPassageway())) {
                    lqw.eq(SgIot::getPassagewayThree, bo.getPeripheralUnit());
                }
                if ("4".equals(bo.getPassageway())) {
                    lqw.eq(SgIot::getPassagewayFour, bo.getPeripheralUnit());
                }
                List<SgIot> list = baseMapper.selectList(lqw);
                sum = list.size();
            }
        }
        return sum;
    }
    /**
     * 保存前的数据校验
     *
     * @param entity 实体类数据
     */
    private void validEntityBeforeSave(SgIot entity) {
        //TODO 做一些数据校验,如唯一约束
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
        if (isValid) {
            //TODO 做一些业务上的校验,判断是否需要校验
        }
        return removeByIds(ids);
    }
}
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgIpcServiceImpl.java
@@ -19,6 +19,7 @@
import com.ruoyi.oa.domain.SgIpc;
import com.ruoyi.oa.mapper.SgIpcMapper;
import com.ruoyi.oa.service.ISgIpcService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -61,10 +62,12 @@
        lqw.eq(bo.getOrganizationId() != null, SgIpc::getOrganizationId, bo.getOrganizationId());
        lqw.eq(bo.getConstructionBatchId() != null, SgIpc::getConstructionBatchId, bo.getConstructionBatchId());
        lqw.like(StringUtils.isNotBlank(bo.getModel()), SgIpc::getModel, bo.getModel());
        lqw.orderByDesc(SgIpc::getUpdateTime);
        return lqw;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean insertByBo(SgIpcBo bo) {
        List<SgIpc> list = baseMapper.selectList(new LambdaQueryWrapper<SgIpc>()
            .eq(SgIpc::getSchoolId, bo.getSchoolId()).eq(SgIpc::getMac, bo.getMac()));
@@ -85,6 +88,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateByBo(SgIpcBo bo) {
        List<SgIpc> list = baseMapper.selectList(new LambdaQueryWrapper<SgIpc>()
            .eq(SgIpc::getSchoolId, bo.getSchoolId())
@@ -112,6 +116,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
        if (isValid) {
            //TODO 做一些业务上的校验,判断是否需要校验
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgNvrServiceImpl.java
@@ -5,6 +5,7 @@
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.core.page.PagePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.oa.domain.SgReserveIp;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -14,6 +15,7 @@
import com.ruoyi.oa.domain.SgNvr;
import com.ruoyi.oa.mapper.SgNvrMapper;
import com.ruoyi.oa.service.ISgNvrService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -53,10 +55,12 @@
        lqw.eq(bo.getConstructionBatchId() != null, SgNvr::getConstructionBatchId, bo.getConstructionBatchId());
        lqw.like(StringUtils.isNotBlank(bo.getModel()), SgNvr::getModel, bo.getModel());
        lqw.eq(SgNvr::getSchoolId, bo.getSchoolId());
        lqw.orderByDesc(SgNvr::getUpdateTime);
        return lqw;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean insertByBo(SgNvrBo bo) {
        SgNvr add = BeanUtil.toBean(bo, SgNvr.class);
        validEntityBeforeSave(add);
@@ -68,6 +72,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateByBo(SgNvrBo bo) {
        SgNvr update = BeanUtil.toBean(bo, SgNvr.class);
        validEntityBeforeSave(update);
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgReserveIpServiceImpl.java
@@ -14,6 +14,7 @@
import com.ruoyi.oa.domain.SgReserveIp;
import com.ruoyi.oa.mapper.SgReserveIpMapper;
import com.ruoyi.oa.service.ISgReserveIpService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -50,10 +51,12 @@
        lqw.like(StringUtils.isNotBlank(bo.getIp()), SgReserveIp::getIp, bo.getIp());
        lqw.eq(bo.getBuildingId() != null, SgReserveIp::getBuildingId, bo.getBuildingId());
        lqw.eq(SgReserveIp::getSchoolId, bo.getSchoolId());
        lqw.orderByDesc(SgReserveIp::getUpdateTime);
        return lqw;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean insertByBo(SgReserveIpBo bo) {
        SgReserveIp add = BeanUtil.toBean(bo, SgReserveIp.class);
        validEntityBeforeSave(add);
@@ -65,6 +68,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateByBo(SgReserveIpBo bo) {
        SgReserveIp update = BeanUtil.toBean(bo, SgReserveIp.class);
        validEntityBeforeSave(update);
@@ -81,6 +85,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
        if(isValid){
            //TODO 做一些业务上的校验,判断是否需要校验
ruoyi-oa/src/main/resources/mapper/oa/SgIotMapper.xml
New file
@@ -0,0 +1,32 @@
<?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.ruoyi.oa.mapper.SgIotMapper">
    <resultMap type="com.ruoyi.oa.domain.SgIot" id="SgIotResult">
        <result property="id" column="id"/>
        <result property="deploymentName" column="deployment_name"/>
        <result property="edition" column="edition"/>
        <result property="lan" column="lan"/>
        <result property="ip" column="ip"/>
        <result property="buildingId" column="building_id"/>
        <result property="organizationId" column="organization_id"/>
        <result property="constructionBatchId" column="construction_batch_id"/>
        <result property="serialNumber" column="serial_number"/>
        <result property="model" column="model"/>
        <result property="manufacturerId" column="manufacturer_id"/>
        <result property="monitorObject" column="monitor_object"/>
        <result property="passagewayOne" column="passageway_one"/>
        <result property="passagewayTwo" column="passageway_two"/>
        <result property="passagewayThree" column="passageway_three"/>
        <result property="passagewayFour" column="passageway_four"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="delFlag" column="del_flag"/>
    </resultMap>
</mapper>