whycxzp
2021-04-02 474d1b06554165386af398075d04a7b54d09f9ad
更新 设备资源申请接口
5个文件已修改
1个文件已删除
4个文件已添加
301 ■■■■ 已修改文件
src/main/java/com/whyc/config/StaticResourceConfig.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/DeviceResourceApplyController.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/DeviceConditionDTO.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/DeviceResourceApplyMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/DeviceResourceApply.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/ElectricState.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/DeviceResourceApplyService.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/DeviceResourceApplyMapper.xml 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/index.html 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/login.html 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/config/StaticResourceConfig.java
@@ -15,14 +15,13 @@
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //这个是可行的,解析的时候path为*.html,校验路径admin下是否存在
        //registry.addResourceHandler("admin/*.html").addResourceLocations("classpath:/META-INF/resources/admin/");
        registry.addResourceHandler("/map/*").addResourceLocations("classpath:/META-INF/resources/map/");
        //registry.addResourceHandler("/login.html").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("*.html").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
        registry.addResourceHandler("/service-worker.js").addResourceLocations("classpath:/META-INF/resources/");
        //registry.addResourceHandler("/favicon.ico").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/index.html").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/css/**").addResourceLocations("classpath:/META-INF/resources/css/");
        registry.addResourceHandler("/js/**").addResourceLocations("classpath:/META-INF/resources/js/");
        registry.addResourceHandler("/img/**").addResourceLocations("classpath:/META-INF/resources/img/");
        registry.addResourceHandler("/fonts/**").addResourceLocations("classpath:/META-INF/resources/fonts/");
        super.addResourceHandlers(registry);
        //registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
        //registry.addResourceHandler("*.html").addResourceLocations("classpath:/META-INF/resources/");
src/main/java/com/whyc/controller/DeviceResourceApplyController.java
@@ -1,10 +1,14 @@
package com.whyc.controller;
import com.whyc.dto.DeviceConditionDTO;
import com.whyc.dto.Response;
import com.whyc.pojo.DeviceResourceApply;
import com.whyc.service.DeviceResourceApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
/**
 * 设备资源申请
@@ -14,14 +18,19 @@
@Api(tags = "设备资源")
public class DeviceResourceApplyController {
    @GetMapping("all")
    @Autowired
    private DeviceResourceApplyService service;
    @PostMapping("all")
    @ApiOperation(value = "查询所有设备状态分页-筛选")
    public Response getAllDeviceStatus(){
        return null;
    public Response getAllDeviceStatus(@RequestParam Integer pageNum,@RequestParam Integer pageSize,
                                       @RequestBody DeviceConditionDTO deviceConditionDTO){
        return service.getAllDeviceStatus(pageNum,pageSize,deviceConditionDTO);
    }
    @GetMapping
    @ApiOperation(value = "查询设备状态-根据设备id")
    @ApiIgnore
    public Response getDeviceStatus(@RequestParam Integer deviceId){
        return null;
    }
@@ -30,14 +39,14 @@
    @ApiOperation(value = "提交申请")
    public Response apply(@RequestBody DeviceResourceApply resourceApply){
        return null;
        return service.apply(resourceApply);
    }
    @GetMapping("applyPage")
    @PostMapping("applyPage")
    @ApiOperation(value = "查询申请列表分页-筛选")
    //TODO 封装筛选条件到DTO
    public Response getApplyPage(@RequestParam Integer pageNum,@RequestParam Integer pageSize){
        return null;
    public Response getApplyPage(@RequestParam Integer pageNum,@RequestParam Integer pageSize,
                                 @RequestBody DeviceConditionDTO condition){
        return service.getApplyPage(pageNum,pageSize,condition);
    }
    @PutMapping("approve")
src/main/java/com/whyc/dto/DeviceConditionDTO.java
New file
@@ -0,0 +1,43 @@
package com.whyc.dto;
/**
 * 设备筛选条件DTO
 */
public class DeviceConditionDTO {
    private String site;
    private Integer deviceTypeId;
    private Integer runningStatus;
    private Integer loadStatus;
    public String getSite() {
        return site;
    }
    public void setSite(String site) {
        this.site = site;
    }
    public Integer getDeviceTypeId() {
        return deviceTypeId;
    }
    public void setDeviceTypeId(Integer deviceTypeId) {
        this.deviceTypeId = deviceTypeId;
    }
    public Integer getRunningStatus() {
        return runningStatus;
    }
    public void setRunningStatus(Integer runningStatus) {
        this.runningStatus = runningStatus;
    }
    public Integer getLoadStatus() {
        return loadStatus;
    }
    public void setLoadStatus(Integer loadStatus) {
        this.loadStatus = loadStatus;
    }
}
src/main/java/com/whyc/mapper/DeviceResourceApplyMapper.java
New file
@@ -0,0 +1,12 @@
package com.whyc.mapper;
import com.whyc.dto.DeviceConditionDTO;
import com.whyc.pojo.DeviceResourceApply;
import java.util.List;
public interface DeviceResourceApplyMapper extends CustomMapper<DeviceResourceApply> {
    List<DeviceResourceApply> getAllDeviceStatus(DeviceConditionDTO deviceConditionDTO);
    List<DeviceResourceApply> getApplyPage(DeviceConditionDTO condition);
}
src/main/java/com/whyc/pojo/DeviceResourceApply.java
@@ -1,5 +1,6 @@
package com.whyc.pojo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
@@ -19,6 +20,10 @@
    private Integer  id   ;
    @ApiModelProperty("设备id")
    private Integer  deviceId ;
    @TableField(exist = false)
    private DeviceManage deviceManage;
    @ApiModelProperty("申请资源接入线路")
    private String   accessLine    ;
    @ApiModelProperty("申请资源分配电压")
@@ -31,12 +36,20 @@
    @ApiModelProperty("申请人")
    private String   applyOwner    ;
    @ApiModelProperty("申请状态:0-过期,1-审核中,2-审核通过,3-未审核通过")
    private String   status    ;
    private Integer   status    ;
    @ApiModelProperty("审核时间")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai")
    private Date approveTime   ;
    @ApiModelProperty("审核人")
    private String   approveOwner  ;
    public DeviceManage getDeviceManage() {
        return deviceManage;
    }
    public void setDeviceManage(DeviceManage deviceManage) {
        this.deviceManage = deviceManage;
    }
    public Integer getId() {
        return id;
@@ -94,11 +107,11 @@
        this.applyOwner = applyOwner;
    }
    public String getStatus() {
    public Integer getStatus() {
        return status;
    }
    public void setStatus(String status) {
    public void setStatus(Integer status) {
        this.status = status;
    }
src/main/java/com/whyc/pojo/ElectricState.java
@@ -17,28 +17,32 @@
@ApiModel("1号,2号大功率整流电源")
public class ElectricState {
    Long          num                         ; //主键
    Integer       electricId                  ; //设备id
    private Long          num                         ; //主键
    private Integer       electricId                  ; //设备id
    @TableField(exist = false)
    private DeviceManage deviceManage;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai")
    Date          recordTime                  ; //记录时间
    Integer       caseTripOutput             ; //机箱跳闸输出
    Integer       faultResetSignal           ; //故障复位信号
    Integer       highVolSwitchStatus       ; //高压开关状态
    Integer       stopButton                  ; //急停按钮
    Integer       mainCabinetFanStatus      ; //主柜风机状态
    Integer       transCabinetDoorLock      ; //变压器柜门连锁
    private Date          recordTime                  ; //记录时间
    private Integer       caseTripOutput             ; //机箱跳闸输出
    private Integer       faultResetSignal           ; //故障复位信号
    private Integer       highVolSwitchStatus       ; //高压开关状态
    private Integer       stopButton                  ; //急停按钮
    private Integer       mainCabinetFanStatus      ; //主柜风机状态
    private Integer       transCabinetDoorLock      ; //变压器柜门连锁
    @TableField("trans_cabinet_overtem_alarm")
    Integer       transCabinetOverTemAlarm  ; //变压器超温报警
    private Integer       transCabinetOverTemAlarm  ; //变压器超温报警
    @TableField("trans_cabinet_overtem_trip")
    Integer       transCabinetOverTemTrip   ; //变压器超温跳闸
    Integer       qs1State                    ; //QS1状态
    Integer       qs2State                    ; //QS2状态
    Integer       switchCabinetDoorStatus   ; //转换开关柜门状态
    private Integer       transCabinetOverTemTrip   ; //变压器超温跳闸
    private Integer       qs1State                    ; //QS1状态
    private Integer       qs2State                    ; //QS2状态
    private Integer       switchCabinetDoorStatus   ; //转换开关柜门状态
    @TableField("alldcvol")
    Float         allDCVol                     ; //总直流电压
    private Float         allDCVol                     ; //总直流电压
    @TableField("alldccurr")
    Float         allDCCurr                    ; //总直流电流
    Integer       connFlag                    ; //串/并联状态
    private Float         allDCCurr                    ; //总直流电流
    private Integer       connFlag                    ; //串/并联状态
    @ApiModelProperty("运行状态:0-停止,1-运行")
    private Integer runningStatus;
    @ApiModelProperty("负荷状态:0-未知,1-正常,2-负荷,3-满负")
@@ -54,6 +58,14 @@
    String   note;
    public DeviceManage getDeviceManage() {
        return deviceManage;
    }
    public void setDeviceManage(DeviceManage deviceManage) {
        this.deviceManage = deviceManage;
    }
    public Long getNum() {
        return num;
    }
src/main/java/com/whyc/service/DeviceResourceApplyService.java
New file
@@ -0,0 +1,41 @@
package com.whyc.service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.DeviceConditionDTO;
import com.whyc.dto.Response;
import com.whyc.mapper.DeviceResourceApplyMapper;
import com.whyc.pojo.DeviceResourceApply;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Service
public class DeviceResourceApplyService {
    @Resource
    private DeviceResourceApplyMapper mapper;
    public Response getAllDeviceStatus(Integer pageNum,Integer pageSize,DeviceConditionDTO deviceConditionDTO) {
        PageHelper.startPage(pageNum,pageSize);
        List<DeviceResourceApply> deviceResourceApplyMapperList =mapper.getAllDeviceStatus(deviceConditionDTO);
        PageInfo<DeviceResourceApply> deviceResourceApplyPageInfo = new PageInfo<>(deviceResourceApplyMapperList);
        return new Response().set(1,deviceResourceApplyPageInfo);
    }
    public Response apply(DeviceResourceApply resourceApply) {
        resourceApply.setApplyTime(new Date());
        resourceApply.setStatus(1);
        mapper.insert(resourceApply);
        return new Response().setMsg(1,"提交成功");
    }
    public Response getApplyPage(Integer pageNum, Integer pageSize, DeviceConditionDTO condition) {
        PageHelper.startPage(pageNum,pageSize);
        List<DeviceResourceApply> deviceResourceApplies = mapper.getApplyPage(condition);
        PageInfo<DeviceResourceApply> pageInfo = new PageInfo<>(deviceResourceApplies);
        return new Response().set(1,pageInfo);
    }
}
src/main/resources/mapper/DeviceResourceApplyMapper.xml
New file
@@ -0,0 +1,83 @@
<?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.whyc.mapper.DeviceResourceApplyMapper" >
    <!--TODO 暂用ElectricState代替-->
    <resultMap id="DeviceStatusResultMap" type="ElectricState">
    </resultMap>
    <resultMap id="ElectricStateResultMap" type="ElectricState">
        <result property="electricId" column="electric_id"/>
        <result property="runningStatus" column="running_status"/>
        <result property="loadStatus" column="load_status"/>
        <result property="volStd" column="vol_std"/>
        <result property="maxVol" column="max_vol"/>
        <result property="loadVol" column="load_vol"/>
        <result property="assignableVol" column="assignable_vol"/>
        <association property="deviceManage" javaType="DeviceManage">
            <result property="deviceId" column="device_id"/>
            <result property="deviceName" column="device_name" />
            <result property="site" column="site"/>
        </association>
    </resultMap>
    <resultMap id="DeviceResourceApplyResultMap" type="DeviceResourceApply">
    </resultMap>
    <select id="getAllDeviceStatus" resultMap="ElectricStateResultMap">
        SELECT
            m.device_name,m.site,m.device_id,s.electric_id,s.running_status,s.load_status,s.vol_std,s.max_vol,s.load_vol,s.assignable_vol
        FROM
            db_experiment.tb_device_manage m,
            db_experiment.tb_electric_state s
        WHERE
            m.device_id = s.electric_id
        <if test="site!=null">
            AND m.site=#{site}
        </if>
        <if test="deviceTypeId!=null">
            AND m.device_type_id=#{deviceTypeId}
        </if>
        <if test="runningStatus!=null">
            AND s.running_status=#{runningStatus}
        </if>
        <if test="loadStatus!=null">
            AND s.load_status=#{loadStatus}
        </if>
    </select>
    <select id="getApplyPage" resultMap="DeviceResourceApplyResultMap">
        SELECT
            m.device_id,
            m.device_name,
            m.site,
            m.device_brand,
            m.device_version,
            type.device_type_name,
            s.electric_id,
            s.load_status,
            s.assignable_vol,
            a.apply_owner,
            a.apply_time,
            a.approve_time,
            a.STATUS
        FROM
            db_experiment.tb_device_manage m,
            db_experiment.tb_device_type type,
            db_experiment.tb_electric_state s,
            db_experiment.tb_device_resource_apply a
        WHERE
            m.device_id = s.electric_id
        AND m.device_type_id = type.device_type_id
        AND m.device_id = a.device_id
        <if test="site!=null">
            m.site=#{site}
        </if>
        <if test="deviceTypeId!=null">
            m.device_type_id=#{deviceTypeId}
        </if>
        <if test="loadStatus!=null">
            s.load_status=#{loadStatus}
        </if>
    </select>
</mapper>
src/main/webapp/index.html
@@ -1,10 +1 @@
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <h1>Index页面加载成功!</h1>
</body>
</html>
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>综合管理平台</title><link href="css/chunk-09eb384f.3431fcdc.css" rel="prefetch"><link href="css/chunk-0b2ef3ea.35fa80a3.css" rel="prefetch"><link href="css/chunk-139c5972.8a27ca72.css" rel="prefetch"><link href="css/chunk-1d7548c3.0333a89a.css" rel="prefetch"><link href="css/chunk-2c148b42.3ac8985f.css" rel="prefetch"><link href="css/chunk-3e6947f5.9c42360c.css" rel="prefetch"><link href="css/chunk-47e2b3a5.db6093de.css" rel="prefetch"><link href="css/chunk-498d95bc.9e054b02.css" rel="prefetch"><link href="css/chunk-54065a80.50e7dcd1.css" rel="prefetch"><link href="css/chunk-5f45736e.c5269e18.css" rel="prefetch"><link href="css/chunk-6973780f.f3ddf637.css" rel="prefetch"><link href="css/chunk-6d08f194.3458e648.css" rel="prefetch"><link href="css/chunk-a8461482.67bf3948.css" rel="prefetch"><link href="css/chunk-aef1ca9e.fd312b26.css" rel="prefetch"><link href="css/chunk-f5e597be.9292abf6.css" rel="prefetch"><link href="js/chunk-09eb384f.b1a6c35f.js" rel="prefetch"><link href="js/chunk-0b2ef3ea.b08c4ab5.js" rel="prefetch"><link href="js/chunk-139c5972.051904e9.js" rel="prefetch"><link href="js/chunk-1d7548c3.a16459ae.js" rel="prefetch"><link href="js/chunk-276f7460.e6389dbb.js" rel="prefetch"><link href="js/chunk-2c148b42.0030a128.js" rel="prefetch"><link href="js/chunk-3057c739.260b39e5.js" rel="prefetch"><link href="js/chunk-3e6947f5.2e7d09a1.js" rel="prefetch"><link href="js/chunk-47e2b3a5.0d3ffbe3.js" rel="prefetch"><link href="js/chunk-498d95bc.f271329b.js" rel="prefetch"><link href="js/chunk-54065a80.3a8431b8.js" rel="prefetch"><link href="js/chunk-5f45736e.20f2d193.js" rel="prefetch"><link href="js/chunk-6973780f.d47a4650.js" rel="prefetch"><link href="js/chunk-6d08f194.8cea117c.js" rel="prefetch"><link href="js/chunk-a8461482.114d0dc5.js" rel="prefetch"><link href="js/chunk-aef1ca9e.7ebac628.js" rel="prefetch"><link href="js/chunk-f5e597be.ce650b2b.js" rel="prefetch"><link href="css/app.cec0a985.css" rel="preload" as="style"><link href="css/chunk-vendors.d5309752.css" rel="preload" as="style"><link href="js/app.93344ded.js" rel="preload" as="script"><link href="js/chunk-vendors.3f85831f.js" rel="preload" as="script"><link href="css/chunk-vendors.d5309752.css" rel="stylesheet"><link href="css/app.cec0a985.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but cockpit doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.3f85831f.js"></script><script src="js/app.93344ded.js"></script></body></html>
src/main/webapp/login.html
File was deleted