parent
0d560afee0
commit
bacd78e36e
@ -0,0 +1,36 @@ |
||||
package com.psdc.entity.vo; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Data |
||||
@AllArgsConstructor |
||||
@NoArgsConstructor |
||||
@Component |
||||
public class DeviceStatusVo { |
||||
|
||||
/** |
||||
* 设备id |
||||
*/ |
||||
private Integer deviceId; |
||||
|
||||
/** |
||||
* 设备类型:1-监测设备,2-运行设备 |
||||
*/ |
||||
private Integer deviceType; |
||||
/** |
||||
* 设备名称 |
||||
*/ |
||||
private String deviceName; |
||||
/** |
||||
* 设备sn |
||||
*/ |
||||
private String deviceSn; |
||||
/** 图片地址 */ |
||||
private String photoUrl ; |
||||
/** 设备运行状态:1-开启,2-关闭 */ |
||||
private Integer deviceRunstatus ; |
||||
|
||||
} |
@ -0,0 +1,47 @@ |
||||
package com.psdc.service; |
||||
|
||||
import com.psdc.entity.PsdcControlLog; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 控制日志;(psdc_control_log)表服务接口 |
||||
* @date : 2023-5-9 |
||||
*/ |
||||
public interface IPsdcControlLogService { |
||||
/** |
||||
* 通过ID查询单条数据 |
||||
* |
||||
* @param controlLogId 主键 |
||||
* @return 实例对象 |
||||
*/ |
||||
PsdcControlLog queryById(Integer controlLogId); |
||||
|
||||
/** |
||||
* 新增数据 |
||||
* |
||||
* @param psdcControlLog 实例对象 |
||||
* @return 实例对象 |
||||
*/ |
||||
PsdcControlLog insert(PsdcControlLog psdcControlLog); |
||||
/** |
||||
* 更新数据 |
||||
* |
||||
* @param psdcControlLog 实例对象 |
||||
* @return 实例对象 |
||||
*/ |
||||
PsdcControlLog update(PsdcControlLog psdcControlLog); |
||||
/** |
||||
* 通过主键删除数据 |
||||
* |
||||
* @param controlLogId 主键 |
||||
* @return 是否成功 |
||||
*/ |
||||
boolean deleteById(Integer controlLogId); |
||||
|
||||
/** |
||||
* 分页查询控制日志 |
||||
* @param psdcControlLog |
||||
*/ |
||||
List<PsdcControlLog> query(PsdcControlLog psdcControlLog); |
||||
} |
@ -0,0 +1,69 @@ |
||||
package com.psdc.service.impl; |
||||
|
||||
import com.psdc.entity.PsdcControlLog; |
||||
import com.psdc.mapper.PsdcControlLogMapper; |
||||
import com.psdc.service.IPsdcControlLogService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 控制日志;(psdc_control_log)表服务实现类 |
||||
* @date : 2023-5-9 |
||||
*/ |
||||
@Service |
||||
public class PsdcControlLogServiceImpl implements IPsdcControlLogService { |
||||
@Autowired |
||||
private PsdcControlLogMapper psdcControlLogMapper; |
||||
|
||||
/** |
||||
* 通过ID查询单条数据 |
||||
* |
||||
* @param controlLogId 主键 |
||||
* @return 实例对象 |
||||
*/ |
||||
public PsdcControlLog queryById(Integer controlLogId){ |
||||
return psdcControlLogMapper.queryById(controlLogId); |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 新增数据 |
||||
* |
||||
* @param psdcControlLog 实例对象 |
||||
* @return 实例对象 |
||||
*/ |
||||
public PsdcControlLog insert(PsdcControlLog psdcControlLog){ |
||||
psdcControlLogMapper.insert(psdcControlLog); |
||||
return psdcControlLog; |
||||
} |
||||
|
||||
/** |
||||
* 更新数据 |
||||
* |
||||
* @param psdcControlLog 实例对象 |
||||
* @return 实例对象 |
||||
*/ |
||||
public PsdcControlLog update(PsdcControlLog psdcControlLog){ |
||||
psdcControlLogMapper.update(psdcControlLog); |
||||
return queryById(psdcControlLog.getControlLogId()); |
||||
} |
||||
|
||||
/** |
||||
* 通过主键删除数据 |
||||
* |
||||
* @param controlLogId 主键 |
||||
* @return 是否成功 |
||||
*/ |
||||
public boolean deleteById(Integer controlLogId){ |
||||
int total = psdcControlLogMapper.deleteById(controlLogId); |
||||
return total > 0; |
||||
} |
||||
|
||||
@Override |
||||
public List<PsdcControlLog> query(PsdcControlLog psdcControlLog) { |
||||
return psdcControlLogMapper.queryControlLogList(psdcControlLog); |
||||
} |
||||
} |
@ -0,0 +1,25 @@ |
||||
package com.psdc.exception; |
||||
|
||||
public class ControlException extends RuntimeException{ |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public ControlException() { |
||||
super(); |
||||
} |
||||
|
||||
public ControlException(String message) { |
||||
super(message); |
||||
} |
||||
|
||||
public ControlException(String message, Throwable cause) { |
||||
super(message, cause); |
||||
} |
||||
|
||||
public ControlException(Throwable cause) { |
||||
super(cause); |
||||
} |
||||
|
||||
protected ControlException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { |
||||
super(message, cause, enableSuppression, writableStackTrace); |
||||
} |
||||
} |
@ -1,32 +1,70 @@ |
||||
package com.psdc.controller.control; |
||||
|
||||
import com.alibaba.fastjson2.JSONObject; |
||||
import com.psdc.core.controller.BaseController; |
||||
import com.psdc.core.domain.AjaxResult; |
||||
import com.psdc.core.domain.R; |
||||
import com.psdc.core.domain.entity.SysRole; |
||||
import com.psdc.core.domain.entity.SysUser; |
||||
import com.psdc.utils.StringUtils; |
||||
import com.psdc.core.page.TableDataInfo; |
||||
import com.psdc.domain.SysConfig; |
||||
import com.psdc.entity.PsdcControlLog; |
||||
import com.psdc.entity.vo.DeviceStatusVo; |
||||
import com.psdc.service.IPsdcControlLogService; |
||||
import com.psdc.service.IPsdcDeviceService; |
||||
import org.aspectj.weaver.loadtime.Aj; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.security.access.prepost.PreAuthorize; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.PathVariable; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
import java.util.Map; |
||||
|
||||
|
||||
@RestController |
||||
@RequestMapping("/control/manual") |
||||
public class ManualControl { |
||||
public class ManualControl extends BaseController { |
||||
|
||||
|
||||
@Autowired |
||||
private IPsdcDeviceService psdcDeviceService; |
||||
|
||||
@PreAuthorize("@ss.hasPermi('control:user:query')") |
||||
@GetMapping("/deviceList") |
||||
public AjaxResult getControlDeviceList() { |
||||
@Autowired |
||||
private IPsdcControlLogService psdcControlLogService; |
||||
|
||||
return ajax; |
||||
/** |
||||
* 查询设备状态列表 |
||||
* @return |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('control:manual:devlist')") |
||||
@GetMapping("/deviceStatusList") |
||||
public AjaxResult getControlDeviceList() { |
||||
List<DeviceStatusVo> deviceStatusVos = psdcDeviceService.queryDeviceStatus(); |
||||
return AjaxResult.success("设备状态列表",deviceStatusVos); |
||||
} |
||||
|
||||
/** |
||||
* 控制设备启停 |
||||
* @param jsonObject |
||||
* @return |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('control:manual:startstop')") |
||||
@PostMapping("/startAndStop") |
||||
public AjaxResult deviceStartAndStop(@RequestBody JSONObject jsonObject){ |
||||
int i = psdcDeviceService.controlDeviceStartAndStop(jsonObject.getInteger("deviceId"), jsonObject.getInteger("runStatus")); |
||||
if ( i == 1){ |
||||
return AjaxResult.success("控制成功"); |
||||
} else { |
||||
return AjaxResult.error("控制失败,请联系管理员"); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取调控日志列表 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('control:timer:controlLogList')") |
||||
@GetMapping("/controlLogList") |
||||
public TableDataInfo controlLogList(PsdcControlLog psdcControlLog) { |
||||
startPage(); |
||||
List<PsdcControlLog> list = psdcControlLogService.query(psdcControlLog); |
||||
return getDataTable(list); |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue