first commit
This commit is contained in:
commit
655495af6b
|
|
@ -0,0 +1,7 @@
|
|||
/target/
|
||||
/.settings/
|
||||
/.classpath
|
||||
/.project
|
||||
/logs/
|
||||
/.idea/
|
||||
/*.iml
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.bonus.boot</groupId>
|
||||
<artifactId>rearServiceManage</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>rearServiceManage</name>
|
||||
<description>rearServiceManage</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.1.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.1.9</version>
|
||||
</dependency>
|
||||
<!-- redis jar -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!-- security -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<!-- mysql -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- mybatis -->
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper</artifactId>
|
||||
<version>4.1.5</version>
|
||||
</dependency>
|
||||
<!-- poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>3.17</version>
|
||||
</dependency>
|
||||
<!-- poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.3</version>
|
||||
</dependency>
|
||||
<!-- json 解析 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.28</version>
|
||||
</dependency>
|
||||
<!-- junit -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<!-- webService jar -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.rpc</groupId>
|
||||
<artifactId>javax.xml.rpc-api</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.axis</groupId>
|
||||
<artifactId>axis</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-discovery</groupId>
|
||||
<artifactId>commons-discovery</artifactId>
|
||||
<version>0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>wsdl4j</groupId>
|
||||
<artifactId>wsdl4j</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ws.schild</groupId>
|
||||
<artifactId>jave-core</artifactId>
|
||||
<version>2.4.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ws.schild</groupId>
|
||||
<artifactId>jave-native-win64</artifactId>
|
||||
<version>2.4.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ws.schild</groupId>
|
||||
<artifactId>jave-native-linux64</artifactId>
|
||||
<version>2.4.5</version>
|
||||
</dependency>
|
||||
<!--bean辅助-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.18</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-bean-validators</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>1.9.6</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.6</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<version>2.6</version>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.bonus.boot.rear.manager;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 启动类
|
||||
*
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.bonus.boot.rear.manager.*.dao")
|
||||
public class SecurityApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SecurityApplication.class, args);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package com.bonus.boot.rear.manager.basic.controller;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
|
||||
import com.bonus.boot.rear.manager.basic.dao.SysLogDao;
|
||||
import com.bonus.boot.rear.manager.basic.entity.SysLogs;
|
||||
import com.bonus.boot.rear.manager.basic.service.SysLogService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (SysLogs)表控制层
|
||||
*
|
||||
* @author syruan
|
||||
* @since 2023-01-07 16:33:35
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("sysLog")
|
||||
public class SysLogController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private SysLogService sysLogService;
|
||||
|
||||
@Resource
|
||||
private SysLogDao sysLogDao;
|
||||
|
||||
/**
|
||||
* 系统操作日志分页查询
|
||||
* @param sysLogs 筛选条件对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@RequestMapping(value = "/queryByPage")
|
||||
public String queryByPage(SysLogs sysLogs, @RequestParam("page") Integer page, @RequestParam("limit") Integer pageSize) {
|
||||
int count = sysLogDao.count(sysLogs);
|
||||
page = (page - 1) * pageSize;
|
||||
List<SysLogs> list = this.sysLogDao.queryAllByLimit(sysLogs, page, pageSize);
|
||||
String data = JSONUtil.toJsonStr(list);
|
||||
return "{\"code\":0 , \"count\":" + count + " , \"data\":" + data + "}";
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseEntity<SysLogs> queryById(@PathVariable("id") Integer id) {
|
||||
return ResponseEntity.ok(this.sysLogService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param sysLogs 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity<SysLogs> add(SysLogs sysLogs) {
|
||||
return ResponseEntity.ok(this.sysLogService.insert(sysLogs));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param sysLogs 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseEntity<SysLogs> edit(SysLogs sysLogs) {
|
||||
return ResponseEntity.ok(this.sysLogService.update(sysLogs));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Boolean> deleteById(Integer id) {
|
||||
return ResponseEntity.ok(this.sysLogService.deleteById(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.bonus.boot.rear.manager.basic.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.basic.entity.SysLogs;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (SysLogs)表数据库访问层
|
||||
*
|
||||
* @author syruan
|
||||
* @since 2023-01-07 16:33:36
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysLogDao {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
SysLogs queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param sysLogs 查询条件
|
||||
* @param page 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<SysLogs> queryAllByLimit(@Param("user") SysLogs sysLogs, @Param("page")Integer page,@Param("pageSize")Integer pageSize);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param sysLogs 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
int count(SysLogs sysLogs);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param sysLogs 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(SysLogs sysLogs);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<SysLogs> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<SysLogs> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<SysLogs> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<SysLogs> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param sysLogs 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(SysLogs sysLogs);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.bonus.boot.rear.manager.basic.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* (SysLogs)实体类
|
||||
*
|
||||
* @author syruan
|
||||
* @since 2023-01-07 16:33:37
|
||||
*/
|
||||
@Data
|
||||
public class SysLogs implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -55049016458791039L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer userid;
|
||||
|
||||
private String username;
|
||||
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 模块名
|
||||
*/
|
||||
private String module;
|
||||
/**
|
||||
* 成功失败
|
||||
*/
|
||||
private String flag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createtime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.bonus.boot.rear.manager.basic.service;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.basic.entity.SysLogs;
|
||||
|
||||
/**
|
||||
* (SysLogs)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-01-07 16:33:39
|
||||
*/
|
||||
public interface SysLogService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
SysLogs queryById(Integer id);
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param sysLogs 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
SysLogs insert(SysLogs sysLogs);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param sysLogs 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
SysLogs update(SysLogs sysLogs);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.bonus.boot.rear.manager.basic.service.impl;
|
||||
|
||||
import com.bonus.boot.rear.manager.basic.dao.SysLogDao;
|
||||
import com.bonus.boot.rear.manager.basic.entity.SysLogs;
|
||||
import com.bonus.boot.rear.manager.basic.service.SysLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* (SysLogs)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-01-07 16:33:39
|
||||
*/
|
||||
@Service("sysLogService")
|
||||
public class SysLogServiceImpl implements SysLogService {
|
||||
|
||||
@Resource
|
||||
private SysLogDao sysLogDao;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public SysLogs queryById(Integer id) {
|
||||
return this.sysLogDao.queryById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param sysLogs 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public SysLogs insert(SysLogs sysLogs) {
|
||||
this.sysLogDao.insert(sysLogs);
|
||||
return sysLogs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param sysLogs 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public SysLogs update(SysLogs sysLogs) {
|
||||
this.sysLogDao.update(sysLogs);
|
||||
return this.queryById(sysLogs.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.sysLogDao.deleteById(id) > 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package com.bonus.boot.rear.manager.datainterface.controller;
|
||||
|
||||
import com.bonus.boot.rear.manager.datainterface.service.DataService;
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2023/7/18 14:19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dataInfo")
|
||||
public class DataController {
|
||||
|
||||
|
||||
@Resource
|
||||
private DataService dataService;
|
||||
|
||||
|
||||
@ApiOperation(value = "获取项目内的所有设备")
|
||||
@PostMapping("/GET_BOXES")
|
||||
@ResponseBody
|
||||
@LogAnnotation
|
||||
public void GET_BOXES(){
|
||||
dataService.GET_BOXES();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取设备月区间统计")
|
||||
@PostMapping("/GET_BOXES_MON_STATS")
|
||||
@ResponseBody
|
||||
@LogAnnotation
|
||||
public void GET_BOXES_MON_STATS(){
|
||||
dataService.GET_BOXES_MON_STATS();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取设备日区间统计")
|
||||
@PostMapping("/GET_BOXES_DAY_STATS")
|
||||
@ResponseBody
|
||||
@LogAnnotation
|
||||
public void GET_BOXES_DAY_STATS(){
|
||||
dataService.GET_BOXES_DAY_STATS();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取设备日区间统计")
|
||||
@PostMapping("/GET_PROJECT_DAY_STATS")
|
||||
@ResponseBody
|
||||
@LogAnnotation
|
||||
public void GET_PROJECT_DAY_STATS(){
|
||||
dataService.GET_PROJECT_DAY_STATS();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取设备节点的开关状态")
|
||||
@PostMapping("/GET_BOX_CHANNELS_OC")
|
||||
@ResponseBody
|
||||
@LogAnnotation
|
||||
public void GET_BOX_CHANNELS_OC(){
|
||||
dataService.GET_BOX_CHANNELS_OC();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取设备的有效节点")
|
||||
@PostMapping("/GET_BOX_CHANNELS")
|
||||
@ResponseBody
|
||||
@LogAnnotation
|
||||
public void GET_BOX_CHANNELS(){
|
||||
dataService.GET_BOX_CHANNELS();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "智慧用电信息推送")
|
||||
@PostMapping("/giveAnAlarm")
|
||||
@ResponseBody
|
||||
@LogAnnotation
|
||||
public void giveAnAlarm(@RequestBody String str){
|
||||
System.err.println("智慧用电==="+str);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "安防信息推送")
|
||||
@PostMapping("/security")
|
||||
@ResponseBody
|
||||
@LogAnnotation
|
||||
public void security(@RequestBody String str){
|
||||
dataService.security(str);
|
||||
System.err.println("防区告警==="+str);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.bonus.boot.rear.manager.datainterface.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.datainterface.entity.FenceBean;
|
||||
import com.bonus.boot.rear.manager.datainterface.entity.LineBean;
|
||||
import com.bonus.boot.rear.manager.datainterface.entity.SwitchBean;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2023/8/7 16:29
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataInterfaceDao {
|
||||
|
||||
|
||||
int addBoxsDayStatusInfo(LineBean bean);
|
||||
|
||||
LineBean getLineInfoByMacAndAddr(LineBean bean);
|
||||
int updateLineInfoByMacAndAdrr(LineBean bean);
|
||||
int addLineDataInfo(LineBean bean);
|
||||
|
||||
|
||||
|
||||
|
||||
List<String> getSwitchList();
|
||||
|
||||
|
||||
int addSwitchDataInfo(SwitchBean bean);
|
||||
|
||||
SwitchBean getSwitchInfoByMac(SwitchBean bean);
|
||||
|
||||
int updateSwtichInfoByMac(SwitchBean bean);
|
||||
|
||||
|
||||
|
||||
|
||||
int addFanceDataInfo(FenceBean bean);
|
||||
|
||||
FenceBean getFanceInfoByMac(FenceBean bean);
|
||||
|
||||
int updateFanceInfoByMac(FenceBean bean);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.boot.rear.manager.datainterface.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2023/8/8 13:58
|
||||
*/
|
||||
@Data
|
||||
public class FenceBean {
|
||||
|
||||
private String fenceUuid;
|
||||
private String mac;
|
||||
private String fenceIp;
|
||||
private String fenceType;
|
||||
private String fenceCode;
|
||||
private String deviceType;
|
||||
private String fenceName;
|
||||
private String currentTime;
|
||||
private String fenceNickname;
|
||||
private String fenceStatus;
|
||||
private String fenceMark;
|
||||
private String isActive;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.bonus.boot.rear.manager.datainterface.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2023/8/9 14:39
|
||||
*/
|
||||
@Data
|
||||
public class LineBean {
|
||||
|
||||
private String lineUuid;
|
||||
private String switchId;
|
||||
private String addr;
|
||||
private String oc;
|
||||
private String ocTime;//线路开关状态变更时间
|
||||
private String updateTime;
|
||||
private String lineName;
|
||||
private String linkNickName;
|
||||
private String mac;
|
||||
private String electricity;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.boot.rear.manager.datainterface.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2023/8/8 15:48
|
||||
*/
|
||||
@Data
|
||||
public class SwitchBean {
|
||||
private String switchUuid;
|
||||
private String switchName;
|
||||
private String switchNickname;
|
||||
private String build;
|
||||
private String unit;
|
||||
private String mac;
|
||||
private String room;
|
||||
private String deviceType;
|
||||
private String linkMan;
|
||||
private String phone;
|
||||
private String projectCode;
|
||||
private String isActive;
|
||||
private String onLine;
|
||||
private String updateTime;
|
||||
private String equipmentType;
|
||||
private String onlineLastTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.boot.rear.manager.datainterface.service;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2023/7/25 15:51
|
||||
*/
|
||||
public interface DataService {
|
||||
|
||||
|
||||
//获取项目内的所有设备
|
||||
void GET_BOXES();
|
||||
|
||||
//获取设备月区间统计
|
||||
void GET_BOXES_MON_STATS();
|
||||
|
||||
//获取设备节点的开关状态
|
||||
void GET_BOX_CHANNELS_OC();
|
||||
|
||||
//获取设备的有效节点
|
||||
void GET_BOX_CHANNELS();
|
||||
|
||||
//安防信息推送
|
||||
void security(String str);
|
||||
|
||||
void GET_PROJECT_DAY_STATS();
|
||||
|
||||
void GET_BOXES_DAY_STATS();
|
||||
}
|
||||
|
|
@ -0,0 +1,430 @@
|
|||
package com.bonus.boot.rear.manager.datainterface.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.boot.rear.manager.datainterface.dao.DataInterfaceDao;
|
||||
import com.bonus.boot.rear.manager.datainterface.entity.FenceBean;
|
||||
import com.bonus.boot.rear.manager.datainterface.entity.LineBean;
|
||||
import com.bonus.boot.rear.manager.datainterface.entity.SwitchBean;
|
||||
import com.bonus.boot.rear.manager.datainterface.service.DataService;
|
||||
import com.bonus.boot.rear.manager.manager.config.OpenSendConfig;
|
||||
import com.bonus.boot.rear.manager.manager.utils.DateTimeHelper;
|
||||
import com.bonus.boot.rear.manager.manager.utils.StringHelper;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2023/7/25 15:54
|
||||
*/
|
||||
@Service
|
||||
public class DataServiceImpl implements DataService {
|
||||
|
||||
@Resource
|
||||
private RedisTemplate<String, String> redis;
|
||||
@Resource
|
||||
private OpenSendConfig openSendConfig;
|
||||
|
||||
@Resource
|
||||
private DataInterfaceDao dataInterfaceDao;
|
||||
|
||||
|
||||
/**
|
||||
* 注:将接口要求的所有参数(包括公共参数和方法的其他参数,sign除外)按参数名称排序(参数名称字母顺序升序)后,
|
||||
* 拼接每个参数的参数值,最后将appSecret拼在参数串后面,采用MD5进行加密拼接的参数串.
|
||||
*/
|
||||
|
||||
//获取项目内的所有设备
|
||||
@Override
|
||||
public void GET_BOXES() {
|
||||
//获取平台数据
|
||||
String jsonStr = getBoxJson();
|
||||
//处理平台数据
|
||||
boxDataHandle(jsonStr);
|
||||
}
|
||||
|
||||
private void boxDataHandle(String jsonStr){
|
||||
JSONObject jsonObject = JSONObject.parseObject(jsonStr);
|
||||
String code = jsonObject.getString("code");
|
||||
String success = jsonObject.getString("success");
|
||||
String data = jsonObject.getString("data");
|
||||
if("0".equals(code) && "true".equals(success)){
|
||||
JSONArray jsonArray = JSONObject.parseArray(data);
|
||||
for(int i=0;i<jsonArray.size();i++){
|
||||
JSONObject arrStr = JSONObject.parseObject(jsonArray.get(i).toString());
|
||||
SwitchBean bean = new SwitchBean();
|
||||
String aliasName = arrStr.getString("aliasName");
|
||||
String mac = arrStr.getString("mac");
|
||||
String room = arrStr.getString("room");
|
||||
String linkman = arrStr.getString("linkman");
|
||||
String equipmentType = arrStr.getString("equipmentType");
|
||||
String unit = arrStr.getString("unit");
|
||||
String onlineLastTime = arrStr.getString("onlineLastTime");
|
||||
String projectCode = arrStr.getString("projectCode");
|
||||
String build = arrStr.getString("build");
|
||||
String phone = arrStr.getString("phone");
|
||||
String online = arrStr.getString("online");
|
||||
bean.setSwitchUuid(UUID.randomUUID().toString().replace("-",""));
|
||||
bean.setSwitchName(aliasName);
|
||||
bean.setMac(mac);
|
||||
bean.setRoom(room);
|
||||
bean.setLinkMan(linkman);
|
||||
bean.setEquipmentType(equipmentType);
|
||||
bean.setUnit(unit);
|
||||
bean.setUpdateTime(DateTimeHelper.getNowDayHMS());
|
||||
bean.setOnlineLastTime(onlineLastTime);
|
||||
bean.setProjectCode(projectCode);
|
||||
bean.setBuild(build);
|
||||
bean.setPhone(phone);
|
||||
bean.setOnLine(online);
|
||||
|
||||
SwitchBean bb = dataInterfaceDao.getSwitchInfoByMac(bean);
|
||||
if(bb == null){
|
||||
dataInterfaceDao.addSwitchDataInfo(bean);
|
||||
}else{
|
||||
dataInterfaceDao.updateSwtichInfoByMac(bean);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private String getBoxJson(){
|
||||
String methodName = "GET_BOXES";
|
||||
String accessToken = checkToken(redis.opsForValue().get("accessToken"));
|
||||
String timestamp = DateTimeHelper.getNowDateToSecond();
|
||||
Map pm = new HashMap();
|
||||
pm.put("projectCode", OpenSendConfig.getProjectCode());
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(accessToken);
|
||||
sb.append(openSendConfig.getClientId());
|
||||
sb.append(methodName);
|
||||
sb.append(openSendConfig.getProjectCode());
|
||||
sb.append(timestamp);
|
||||
sb.append(openSendConfig.getAppSecret());
|
||||
String signStr = sb.toString().replace("\"","");
|
||||
System.err.println("getPost sign加密前="+signStr);
|
||||
String json = openSendConfig.getPost(methodName,pm,timestamp,signStr);
|
||||
System.err.println("getProjectInfo json="+json);
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void GET_BOXES_MON_STATS(){
|
||||
List<String> stringList = dataInterfaceDao.getSwitchList();
|
||||
String s = StringUtils.join(stringList,",");
|
||||
System.err.println("ss="+s);
|
||||
String methodName = "GET_BOXES_MON_STATS";
|
||||
String accessToken = checkToken(redis.opsForValue().get("accessToken"));
|
||||
String timestamp = DateTimeHelper.getNowDateToSecond();
|
||||
Map pm = new HashMap();
|
||||
pm.put("projectCode", OpenSendConfig.getProjectCode());
|
||||
pm.put("mac", s);
|
||||
pm.put("year", "2023");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(accessToken);
|
||||
sb.append(openSendConfig.getClientId());
|
||||
sb.append(s);
|
||||
sb.append(methodName);
|
||||
sb.append(openSendConfig.getProjectCode());
|
||||
sb.append(timestamp);
|
||||
sb.append("2023");
|
||||
sb.append(openSendConfig.getAppSecret());
|
||||
String signStr = sb.toString().replace("\"","");
|
||||
System.err.println("getPost sign加密前="+signStr);
|
||||
String json = openSendConfig.getPost(methodName,pm,timestamp,signStr);
|
||||
System.err.println("getProjectInfo json="+json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GET_BOX_CHANNELS_OC() {
|
||||
String methodName = "GET_BOX_CHANNELS_OC";
|
||||
String accessToken = checkToken(redis.opsForValue().get("accessToken"));
|
||||
String timestamp = DateTimeHelper.getNowDateToSecond();
|
||||
Map pm = new HashMap();
|
||||
pm.put("projectCode", OpenSendConfig.getProjectCode());
|
||||
pm.put("mac", "187ED5338A64");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(accessToken);
|
||||
sb.append(openSendConfig.getClientId());
|
||||
sb.append("187ED5338A64");
|
||||
sb.append(methodName);
|
||||
sb.append(openSendConfig.getProjectCode());
|
||||
sb.append(timestamp);
|
||||
sb.append(openSendConfig.getAppSecret());
|
||||
String signStr = sb.toString().replace("\"","");
|
||||
System.err.println("getPost sign加密前="+signStr);
|
||||
String json = openSendConfig.getPost(methodName,pm,timestamp,signStr);
|
||||
System.err.println("getProjectInfo json="+json);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void GET_BOX_CHANNELS() {
|
||||
//获取平台数据
|
||||
String jsonStr = getBoxChannelsJson();
|
||||
//处理平台数据
|
||||
boxChannelsDataHandle(jsonStr);
|
||||
|
||||
}
|
||||
private String getBoxChannelsJson() {
|
||||
List<String> stringList = dataInterfaceDao.getSwitchList();
|
||||
String s = StringUtils.join(stringList,",");
|
||||
System.err.println("ss="+s);
|
||||
String methodName = "GET_BOX_CHANNELS";
|
||||
String accessToken = checkToken(redis.opsForValue().get("accessToken"));
|
||||
String timestamp = DateTimeHelper.getNowDateToSecond();
|
||||
Map pm = new HashMap();
|
||||
pm.put("projectCode", OpenSendConfig.getProjectCode());
|
||||
pm.put("mac", s);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(accessToken);
|
||||
sb.append(openSendConfig.getClientId());
|
||||
sb.append(s);
|
||||
sb.append(methodName);
|
||||
sb.append(openSendConfig.getProjectCode());
|
||||
sb.append(timestamp);
|
||||
sb.append(openSendConfig.getAppSecret());
|
||||
String signStr = sb.toString().replace("\"","");
|
||||
String json = openSendConfig.getPost(methodName,pm,timestamp,signStr);
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
private void boxChannelsDataHandle(String jsonStr) {
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(jsonStr);
|
||||
String code = jsonObject.getString("code");
|
||||
String success = jsonObject.getString("success");
|
||||
String data = jsonObject.getString("data");
|
||||
if("0".equals(code) && "true".equals(success)){
|
||||
JSONArray dataArray = JSONArray.parseArray(data);
|
||||
for (int i=0;i<dataArray.size();i++){
|
||||
JSONObject childObj = JSONObject.parseObject(dataArray.get(i).toString());
|
||||
String mac = childObj.getString("mac");
|
||||
String channels = childObj.getString("channels");
|
||||
JSONArray channeslArray = JSONArray.parseArray(channels);
|
||||
for (int j=0;j<channeslArray.size();j++){
|
||||
JSONObject channelsObj = JSONObject.parseObject(channeslArray.get(j).toString());
|
||||
String oc = channelsObj.getString("oc");
|
||||
String ocTime = channelsObj.getString("ocTime");
|
||||
String updateTime = channelsObj.getString("updateTime");
|
||||
String addr = channelsObj.getString("addr");
|
||||
String title = channelsObj.getString("title");
|
||||
LineBean lineBean = new LineBean();
|
||||
lineBean.setLineUuid(UUID.randomUUID().toString().replace("-",""));
|
||||
lineBean.setOc(oc);
|
||||
lineBean.setOcTime(ocTime);
|
||||
lineBean.setUpdateTime(updateTime);
|
||||
lineBean.setAddr(addr);
|
||||
lineBean.setLineName(title);
|
||||
lineBean.setMac(mac);
|
||||
SwitchBean b = new SwitchBean();
|
||||
b.setMac(mac);
|
||||
SwitchBean bb = dataInterfaceDao.getSwitchInfoByMac(b);
|
||||
lineBean.setSwitchId(bb.getSwitchUuid());
|
||||
LineBean ll = dataInterfaceDao.getLineInfoByMacAndAddr(lineBean);
|
||||
if(ll ==null){
|
||||
dataInterfaceDao.addLineDataInfo(lineBean);
|
||||
}else {
|
||||
dataInterfaceDao.updateLineInfoByMacAndAdrr(lineBean);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GET_PROJECT_DAY_STATS() {
|
||||
|
||||
//获取平台数据
|
||||
String jsonStr = getProjectDayStatsJson();
|
||||
//处理平台数据
|
||||
projectDayStatsDataHandle(jsonStr);
|
||||
|
||||
}
|
||||
|
||||
private void projectDayStatsDataHandle(String jsonStr) {
|
||||
|
||||
}
|
||||
|
||||
private String getProjectDayStatsJson() {
|
||||
String methodName = "GET_PROJECT_DAY_STATS";
|
||||
String accessToken = checkToken(redis.opsForValue().get("accessToken"));
|
||||
String timestamp = DateTimeHelper.getNowDateToSecond();
|
||||
Map pm = new HashMap();
|
||||
pm.put("projectCode", OpenSendConfig.getProjectCode());
|
||||
pm.put("year",DateTimeHelper.getYear(new Date()));
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(accessToken);
|
||||
sb.append(openSendConfig.getClientId());
|
||||
sb.append(methodName);
|
||||
sb.append(openSendConfig.getProjectCode());
|
||||
sb.append(timestamp);
|
||||
sb.append(DateTimeHelper.getYear(new Date()));
|
||||
sb.append(openSendConfig.getAppSecret());
|
||||
String signStr = sb.toString().replace("\"","");
|
||||
String json = openSendConfig.getPost(methodName,pm,timestamp,signStr);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GET_BOXES_DAY_STATS() {
|
||||
//获取平台数据
|
||||
String jsonStr = getBoxsDayStatusJson();
|
||||
//处理平台数据
|
||||
boxsDayStatusHandle(jsonStr);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private String getBoxsDayStatusJson() {
|
||||
List<String> stringList = dataInterfaceDao.getSwitchList();
|
||||
String s = StringUtils.join(stringList,",");
|
||||
System.err.println("ss="+s);
|
||||
String methodName = "GET_BOXES_DAY_STATS";
|
||||
String accessToken = checkToken(redis.opsForValue().get("accessToken"));
|
||||
String timestamp = DateTimeHelper.getNowDateToSecond();
|
||||
Map pm = new HashMap();
|
||||
pm.put("projectCode", OpenSendConfig.getProjectCode());
|
||||
pm.put("mac",s);
|
||||
pm.put("year",DateTimeHelper.getYear(new Date()));
|
||||
pm.put("month",DateTimeHelper.getMonth(new Date()));
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(accessToken);
|
||||
sb.append(openSendConfig.getClientId());
|
||||
sb.append(s);
|
||||
sb.append(methodName);
|
||||
sb.append(DateTimeHelper.getMonth(new Date()));
|
||||
sb.append(openSendConfig.getProjectCode());
|
||||
sb.append(timestamp);
|
||||
sb.append(DateTimeHelper.getYear(new Date()));
|
||||
sb.append(openSendConfig.getAppSecret());
|
||||
String signStr = sb.toString().replace("\"","");
|
||||
String json = openSendConfig.getPost(methodName,pm,timestamp,signStr);
|
||||
return json;
|
||||
}
|
||||
|
||||
private void boxsDayStatusHandle(String jsonStr) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(jsonStr);
|
||||
String code = jsonObject.getString("code");
|
||||
String success = jsonObject.getString("success");
|
||||
String data = jsonObject.getString("data");
|
||||
int dayNum = Integer.parseInt(DateTimeHelper.getNowDate().substring(8,10));
|
||||
System.err.println(dayNum);
|
||||
if("0".equals(code) && "true".equals(success)){
|
||||
JSONObject dataObject = JSONObject.parseObject(data);
|
||||
List<String> stringList = dataInterfaceDao.getSwitchList();
|
||||
for (int i=0;i<stringList.size();i++){
|
||||
String mac = dataObject.getString(stringList.get(i));
|
||||
for(int j=1;j<=dayNum;j++){
|
||||
JSONObject macObject = JSONObject.parseObject(mac);
|
||||
String dayStr ="";
|
||||
String nowData = "";
|
||||
if(j<10){
|
||||
dayStr = macObject.getString(("0"+j));
|
||||
nowData = DateTimeHelper.getNowMonth()+"-"+("0"+j);
|
||||
}else{
|
||||
dayStr = macObject.getString(j+"");
|
||||
nowData = DateTimeHelper.getNowMonth()+"-"+j;
|
||||
}
|
||||
System.err.println("stringList.get(i)="+stringList.get(i)+" ,j="+j+" ,dayStr="+dayStr);
|
||||
JSONArray dayArray = JSONArray.parseArray(dayStr);
|
||||
for (int k=0;k<dayArray.size();k++){
|
||||
LineBean lineBean = new LineBean();
|
||||
JSONObject dayObject = JSONObject.parseObject(dayArray.get(k).toString());
|
||||
String addr = dayObject.getString("addr");
|
||||
String electricity = dayObject.getString("electricity");
|
||||
lineBean.setAddr(addr);
|
||||
lineBean.setMac(stringList.get(i));
|
||||
lineBean.setElectricity(electricity);
|
||||
try{
|
||||
LineBean ll = dataInterfaceDao.getLineInfoByMacAndAddr(lineBean);
|
||||
lineBean.setLineUuid(ll.getLineUuid());
|
||||
lineBean.setUpdateTime(nowData);
|
||||
dataInterfaceDao.addBoxsDayStatusInfo(lineBean);
|
||||
}catch (NullPointerException e){
|
||||
lineBean.setLineUuid("0");
|
||||
lineBean.setUpdateTime(nowData);
|
||||
dataInterfaceDao.addBoxsDayStatusInfo(lineBean);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//安防信息推送
|
||||
@Override
|
||||
public void security(String str) {
|
||||
// 第一步,根据推送过来的信息更新系统内数据,更新频率可有安防平台配置
|
||||
JSONObject jsonObject = JSONObject.parseObject(str);
|
||||
//接口防区个数
|
||||
String dnum = jsonObject.getString("dnum");
|
||||
//接口防区详细信息
|
||||
String d = jsonObject.getString("d");
|
||||
JSONArray dArray = JSONObject.parseArray(d);
|
||||
for(int i=0;i<dArray.size();i++){
|
||||
JSONObject dObject = JSONObject.parseObject(dArray.get(i).toString());
|
||||
String mac = dObject.getString("mac");
|
||||
String ip = dObject.getString("ip");
|
||||
String fencetype = dObject.getString("fencetype");
|
||||
String fencenumber = dObject.getString("fencenumber");
|
||||
String time = dObject.getString("time");
|
||||
String areas = dObject.getString("areas");
|
||||
JSONArray areasArray = JSONObject.parseArray(areas);
|
||||
for(int j=0;j<areasArray.size();j++){
|
||||
JSONObject aaObject = JSONObject.parseObject(areasArray.get(j).toString());
|
||||
String code = aaObject.getString("code");
|
||||
String name = aaObject.getString("name");
|
||||
String status = aaObject.getString("status");
|
||||
FenceBean bean = new FenceBean();
|
||||
bean.setFenceUuid(UUID.randomUUID().toString().replace("-",""));
|
||||
bean.setMac(mac);
|
||||
bean.setFenceIp(ip);
|
||||
bean.setFenceType(fencetype);
|
||||
bean.setCurrentTime(DateTimeHelper.getNowDayHMS());
|
||||
bean.setFenceName(name);
|
||||
bean.setFenceStatus(status);
|
||||
bean.setFenceCode(code);
|
||||
FenceBean bb = dataInterfaceDao.getFanceInfoByMac(bean);
|
||||
if(bb == null){
|
||||
dataInterfaceDao.addFanceDataInfo(bean);
|
||||
}else{
|
||||
dataInterfaceDao.updateFanceInfoByMac(bean);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private String checkToken(String accessToken) {
|
||||
if (StringHelper.isEmpty(accessToken)) {
|
||||
accessToken = openSendConfig.getCode();
|
||||
System.err.println("checkToken accessToken="+accessToken);
|
||||
if ("-1".equals(accessToken)) {
|
||||
System.err.println("获取code失败");
|
||||
return "-1";
|
||||
} else if ("-2".equals(accessToken)) {
|
||||
System.err.println("获取accessToken失败");
|
||||
return "-2";
|
||||
}
|
||||
}
|
||||
return accessToken;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package com.bonus.boot.rear.manager.devices.controller;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.AirConditionerBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.AirConditionerService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.boot.rear.manager.manager.utils.AjaxRes;
|
||||
import com.bonus.boot.rear.manager.manager.utils.GlobalConst;
|
||||
import com.bonus.boot.rear.manager.manager.utils.R;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 空调设备
|
||||
*
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("airConditioner")
|
||||
public class AirConditionerController {
|
||||
|
||||
/** 服务 */
|
||||
@Resource
|
||||
private AirConditionerService service;
|
||||
|
||||
@PostMapping("getMsgContent")
|
||||
@ApiOperation(value = "空气监测设备-列表")
|
||||
public R getList(AirConditionerBean o){
|
||||
List<AirConditionerBean> list = service.getList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getDepartmentTree")
|
||||
@ApiOperation(value = "获取部门树")
|
||||
public AjaxRes getDepartmentTree() {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try {
|
||||
List<ZNode> list = service.getDepartmentTree();
|
||||
ar.setSucceed(list);
|
||||
} catch (Exception e) {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "空气监测设备-修改")
|
||||
public AjaxRes updateInfo(AirConditionerBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = service.updateInfo(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if(cb>0){
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "getListById", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "空气监测设备-查询设备信息")
|
||||
public AjaxRes getListById(String id){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
AirConditionerBean AirConditionerBean = service.getListById(id);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(AirConditionerBean !=null){
|
||||
map.put("AirConditionerBean",AirConditionerBean);
|
||||
}
|
||||
ar.setSucceed(map,GlobalConst.DATA_SUCCEED);
|
||||
return ar;
|
||||
}
|
||||
|
||||
@PostMapping("getAirTree")
|
||||
@ApiOperation(value = "获取空调树")
|
||||
public AjaxRes getAirTree() {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try {
|
||||
List<AirConditionerBean> list = service.getAirTree();
|
||||
ar.setSucceed(list);
|
||||
} catch (Exception e) {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package com.bonus.boot.rear.manager.devices.controller;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.dao.DevicesDao;
|
||||
import com.bonus.boot.rear.manager.devices.entity.DevicesBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.DevicesService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.boot.rear.manager.manager.utils.AjaxRes;
|
||||
import com.bonus.boot.rear.manager.manager.utils.GlobalConst;
|
||||
import com.bonus.boot.rear.manager.manager.utils.R;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 球机管理
|
||||
* @author jjLv
|
||||
* @date 2023-08-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("devices")
|
||||
public class DevicesController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private DevicesService service;
|
||||
|
||||
@Resource
|
||||
private DevicesDao dao;
|
||||
|
||||
@PostMapping("getMsgContent")
|
||||
@ApiOperation(value = "球机管理-列表")
|
||||
public R getList(DevicesBean o){
|
||||
List<DevicesBean> list = service.getList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getDepartmentTree")
|
||||
@ApiOperation(value = "获取部门树")
|
||||
public AjaxRes getDepartmentTree() {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try {
|
||||
List<ZNode> list = service.getDepartmentTree();
|
||||
ar.setSucceed(list);
|
||||
} catch (Exception e) {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "球机管理-修改")
|
||||
public AjaxRes updateInfo(DevicesBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = service.updateInfo(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if(cb>0){
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "getListById", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "球机管理-查询人员信息")
|
||||
public AjaxRes getListById(String id){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
DevicesBean devicesBean = service.getListById(id);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(devicesBean !=null){
|
||||
map.put("DevicesBean",devicesBean);
|
||||
}
|
||||
ar.setSucceed(map,GlobalConst.DATA_SUCCEED);
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.bonus.boot.rear.manager.devices.controller;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.LightBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.LightService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.boot.rear.manager.manager.utils.AjaxRes;
|
||||
import com.bonus.boot.rear.manager.manager.utils.GlobalConst;
|
||||
import com.bonus.boot.rear.manager.manager.utils.R;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 智慧路灯
|
||||
*
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("light")
|
||||
public class LightController {
|
||||
|
||||
/** 服务 */
|
||||
@Resource
|
||||
private LightService service;
|
||||
|
||||
@PostMapping("getMsgContent")
|
||||
@ApiOperation(value = "空气监测设备-列表")
|
||||
public R getList(LightBean o){
|
||||
List<LightBean> list = service.getList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getDepartmentTree")
|
||||
@ApiOperation(value = "获取部门树")
|
||||
public AjaxRes getDepartmentTree() {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try {
|
||||
List<ZNode> list = service.getDepartmentTree();
|
||||
ar.setSucceed(list);
|
||||
} catch (Exception e) {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "空气监测设备-修改")
|
||||
public AjaxRes updateInfo(LightBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = service.updateInfo(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if(cb>0){
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "getListById", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "空气监测设备-查询设备信息")
|
||||
public AjaxRes getListById(String id){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
LightBean LightBean = service.getListById(id);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(LightBean !=null){
|
||||
map.put("LightBean",LightBean);
|
||||
}
|
||||
ar.setSucceed(map,GlobalConst.DATA_SUCCEED);
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.bonus.boot.rear.manager.devices.controller;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.LinearBean;
|
||||
import com.bonus.boot.rear.manager.devices.entity.SmarterBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.LinearService;
|
||||
import com.bonus.boot.rear.manager.devices.service.SmarterService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.boot.rear.manager.manager.utils.AjaxRes;
|
||||
import com.bonus.boot.rear.manager.manager.utils.GlobalConst;
|
||||
import com.bonus.boot.rear.manager.manager.utils.R;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 线路管理
|
||||
* @author jjLv
|
||||
* @date 2023-08-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("linear")
|
||||
public class LinearController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private LinearService service;
|
||||
|
||||
@PostMapping("getMsgContent")
|
||||
@ApiOperation(value = "线路管理-列表")
|
||||
public R getList(LinearBean o){
|
||||
List<LinearBean> list = service.getList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getDepartmentTree")
|
||||
@ApiOperation(value = "获取部门树")
|
||||
public AjaxRes getDepartmentTree() {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try {
|
||||
List<ZNode> list = service.getDepartmentTree();
|
||||
ar.setSucceed(list);
|
||||
} catch (Exception e) {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "球机管理-修改")
|
||||
public AjaxRes updateInfo(LinearBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = service.updateInfo(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if(cb>0){
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "getListById", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "线路管理-查询人员信息")
|
||||
public AjaxRes getListById(String id){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
LinearBean linearBean = service.getListById(id);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(linearBean !=null){
|
||||
map.put("LinearBean",linearBean);
|
||||
}
|
||||
ar.setSucceed(map,GlobalConst.DATA_SUCCEED);
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.bonus.boot.rear.manager.devices.controller;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.MonitorBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.MonitorService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.boot.rear.manager.manager.utils.AjaxRes;
|
||||
import com.bonus.boot.rear.manager.manager.utils.GlobalConst;
|
||||
import com.bonus.boot.rear.manager.manager.utils.R;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 空气监测设备
|
||||
*
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("monitor")
|
||||
public class MonitorController {
|
||||
|
||||
/** 服务 */
|
||||
@Resource
|
||||
private MonitorService service;
|
||||
|
||||
@PostMapping("getMsgContent")
|
||||
@ApiOperation(value = "空气监测设备-列表")
|
||||
public R getList(MonitorBean o){
|
||||
List<MonitorBean> list = service.getList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getDepartmentTree")
|
||||
@ApiOperation(value = "获取部门树")
|
||||
public AjaxRes getDepartmentTree() {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try {
|
||||
List<ZNode> list = service.getDepartmentTree();
|
||||
ar.setSucceed(list);
|
||||
} catch (Exception e) {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "空气监测设备-修改")
|
||||
public AjaxRes updateInfo(MonitorBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = service.updateInfo(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if(cb>0){
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "getListById", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "空气监测设备-查询设备信息")
|
||||
public AjaxRes getListById(String id){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
MonitorBean MonitorBean = service.getListById(id);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(MonitorBean !=null){
|
||||
map.put("MonitorBean",MonitorBean);
|
||||
}
|
||||
ar.setSucceed(map,GlobalConst.DATA_SUCCEED);
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.bonus.boot.rear.manager.devices.controller;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.SmarterBean;
|
||||
import com.bonus.boot.rear.manager.devices.entity.StandradBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.SmarterService;
|
||||
import com.bonus.boot.rear.manager.devices.service.StandradService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.boot.rear.manager.manager.utils.AjaxRes;
|
||||
import com.bonus.boot.rear.manager.manager.utils.GlobalConst;
|
||||
import com.bonus.boot.rear.manager.manager.utils.R;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 智能开关管理
|
||||
* @author jjLv
|
||||
* @date 2023-08-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("smarter")
|
||||
public class SmarterController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private SmarterService service;
|
||||
|
||||
@PostMapping("getMsgContent")
|
||||
@ApiOperation(value = "智能开关管理-列表")
|
||||
public R getList(SmarterBean o){
|
||||
List<SmarterBean> list = service.getList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getDepartmentTree")
|
||||
@ApiOperation(value = "获取部门树")
|
||||
public AjaxRes getDepartmentTree() {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try {
|
||||
List<ZNode> list = service.getDepartmentTree();
|
||||
ar.setSucceed(list);
|
||||
} catch (Exception e) {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "球机管理-修改")
|
||||
public AjaxRes updateInfo(SmarterBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = service.updateInfo(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if(cb>0){
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "getListById", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "智能开关管理-查询人员信息")
|
||||
public AjaxRes getListById(String id){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
SmarterBean smarterBean = service.getListById(id);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(smarterBean !=null){
|
||||
map.put("SmarterBean",smarterBean);
|
||||
}
|
||||
ar.setSucceed(map,GlobalConst.DATA_SUCCEED);
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.bonus.boot.rear.manager.devices.controller;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.StandradBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.StandradService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.boot.rear.manager.manager.utils.AjaxRes;
|
||||
import com.bonus.boot.rear.manager.manager.utils.GlobalConst;
|
||||
import com.bonus.boot.rear.manager.manager.utils.R;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 防区管理
|
||||
* @author jjLv
|
||||
* @date 2023-08-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("standrad")
|
||||
public class StandradController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private StandradService service;
|
||||
|
||||
@PostMapping("getMsgContent")
|
||||
@ApiOperation(value = "防区管理-列表")
|
||||
public R getList(StandradBean o){
|
||||
List<StandradBean> list = service.getList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getDepartmentTree")
|
||||
@ApiOperation(value = "获取部门树")
|
||||
public AjaxRes getDepartmentTree() {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try {
|
||||
List<ZNode> list = service.getDepartmentTree();
|
||||
ar.setSucceed(list);
|
||||
} catch (Exception e) {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "球机管理-修改")
|
||||
public AjaxRes updateInfo(StandradBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = service.updateInfo(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if(cb>0){
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "getListById", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "防区管理-查询人员信息")
|
||||
public AjaxRes getListById(String id){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
StandradBean standradBean = service.getListById(id);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(standradBean !=null){
|
||||
map.put("StandradBean",standradBean);
|
||||
}
|
||||
ar.setSucceed(map,GlobalConst.DATA_SUCCEED);
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.bonus.boot.rear.manager.devices.controller;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.VoltBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.VoltService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.boot.rear.manager.manager.utils.AjaxRes;
|
||||
import com.bonus.boot.rear.manager.manager.utils.GlobalConst;
|
||||
import com.bonus.boot.rear.manager.manager.utils.R;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 光伏设备
|
||||
*
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("volt")
|
||||
public class VoltController {
|
||||
|
||||
/** 服务 */
|
||||
@Resource
|
||||
private VoltService service;
|
||||
|
||||
@PostMapping("getMsgContent")
|
||||
@ApiOperation(value = "空气监测设备-列表")
|
||||
public R getList(VoltBean o){
|
||||
List<VoltBean> list = service.getList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getDepartmentTree")
|
||||
@ApiOperation(value = "获取部门树")
|
||||
public AjaxRes getDepartmentTree() {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try {
|
||||
List<ZNode> list = service.getDepartmentTree();
|
||||
ar.setSucceed(list);
|
||||
} catch (Exception e) {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "空气监测设备-修改")
|
||||
public AjaxRes updateInfo(VoltBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = service.updateInfo(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if(cb>0){
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "getListById", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "空气监测设备-查询设备信息")
|
||||
public AjaxRes getListById(String id){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
VoltBean VoltBean = service.getListById(id);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(VoltBean !=null){
|
||||
map.put("VoltBean",VoltBean);
|
||||
}
|
||||
ar.setSucceed(map,GlobalConst.DATA_SUCCEED);
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.bonus.boot.rear.manager.devices.controller;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.WaterBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.WaterService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.boot.rear.manager.manager.utils.AjaxRes;
|
||||
import com.bonus.boot.rear.manager.manager.utils.GlobalConst;
|
||||
import com.bonus.boot.rear.manager.manager.utils.R;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 用水设备
|
||||
*
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("water")
|
||||
public class WaterController {
|
||||
|
||||
/** 服务 */
|
||||
@Resource
|
||||
private WaterService service;
|
||||
|
||||
@PostMapping("getMsgContent")
|
||||
@ApiOperation(value = "空气监测设备-列表")
|
||||
public R getList(WaterBean o){
|
||||
List<WaterBean> list = service.getList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getDepartmentTree")
|
||||
@ApiOperation(value = "获取部门树")
|
||||
public AjaxRes getDepartmentTree() {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try {
|
||||
List<ZNode> list = service.getDepartmentTree();
|
||||
ar.setSucceed(list);
|
||||
} catch (Exception e) {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "空气监测设备-修改")
|
||||
public AjaxRes updateInfo(WaterBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = service.updateInfo(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if(cb>0){
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "getListById", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "空气监测设备-查询设备信息")
|
||||
public AjaxRes getListById(String id){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
WaterBean WaterBean = service.getListById(id);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(WaterBean !=null){
|
||||
map.put("WaterBean",WaterBean);
|
||||
}
|
||||
ar.setSucceed(map,GlobalConst.DATA_SUCCEED);
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.bonus.boot.rear.manager.devices.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.AirConditionerBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 空气监测设备 数据库访问层
|
||||
* pm_air_quality_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Mapper
|
||||
public interface AirConditionerDao {
|
||||
|
||||
|
||||
List<AirConditionerBean> getList(AirConditionerBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(AirConditionerBean bean);
|
||||
|
||||
AirConditionerBean getListById(String id);
|
||||
|
||||
List<AirConditionerBean> getAirTree();
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.boot.rear.manager.devices.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.DevicesBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 球机管理(pm_ball_info)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-12-12 13:57:37
|
||||
*/
|
||||
@Mapper
|
||||
public interface DevicesDao {
|
||||
|
||||
|
||||
List<DevicesBean> getList(DevicesBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(DevicesBean bean);
|
||||
|
||||
DevicesBean getListById(String id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.boot.rear.manager.devices.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.LightBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 空气监测设备 数据库访问层
|
||||
* pm_street_light_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Mapper
|
||||
public interface LightDao {
|
||||
|
||||
|
||||
List<LightBean> getList(LightBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(LightBean bean);
|
||||
|
||||
LightBean getListById(String id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.boot.rear.manager.devices.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.LinearBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 线路管理(pm_line_info)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-12-12 13:57:37
|
||||
*/
|
||||
@Mapper
|
||||
public interface LinearDao {
|
||||
|
||||
|
||||
List<LinearBean> getList(LinearBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(LinearBean bean);
|
||||
|
||||
LinearBean getListById(String id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.boot.rear.manager.devices.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.MonitorBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 空气监测设备 数据库访问层
|
||||
* pm_air_quality_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Mapper
|
||||
public interface MonitorDao {
|
||||
|
||||
|
||||
List<MonitorBean> getList(MonitorBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(MonitorBean bean);
|
||||
|
||||
MonitorBean getListById(String id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.boot.rear.manager.devices.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.SmarterBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能开关管理(pm_fence_info)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-12-12 13:57:37
|
||||
*/
|
||||
@Mapper
|
||||
public interface SmarterDao {
|
||||
|
||||
|
||||
List<SmarterBean> getList(SmarterBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(SmarterBean bean);
|
||||
|
||||
SmarterBean getListById(String id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.boot.rear.manager.devices.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.StandradBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 防区管理(pm_fence_info)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-12-12 13:57:37
|
||||
*/
|
||||
@Mapper
|
||||
public interface StandradDao {
|
||||
|
||||
|
||||
List<StandradBean> getList(StandradBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(StandradBean bean);
|
||||
|
||||
StandradBean getListById(String id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.boot.rear.manager.devices.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.VoltBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 空气监测设备 数据库访问层
|
||||
* pm_air_quality_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Mapper
|
||||
public interface VoltDao {
|
||||
|
||||
|
||||
List<VoltBean> getList(VoltBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(VoltBean bean);
|
||||
|
||||
VoltBean getListById(String id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.boot.rear.manager.devices.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.WaterBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 空气监测设备 数据库访问层
|
||||
* pm_air_quality_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Mapper
|
||||
public interface WaterDao {
|
||||
|
||||
|
||||
List<WaterBean> getList(WaterBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(WaterBean bean);
|
||||
|
||||
WaterBean getListById(String id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.bonus.boot.rear.manager.devices.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**空调设备bean
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Data
|
||||
public class AirConditionerBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/** 主键id */
|
||||
private String id;
|
||||
|
||||
/** 设备名称 */
|
||||
private String airConditionerName;
|
||||
|
||||
/** 设备编号 */
|
||||
private String airConditionerCode;
|
||||
|
||||
/** 设备类型 */
|
||||
private String airConditionerType;
|
||||
|
||||
/** 设备位置 */
|
||||
private String airConditionerLocation;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
private String isActive;
|
||||
|
||||
/** 模糊查询 */
|
||||
private String keyWord;
|
||||
|
||||
/** 设备类型 */
|
||||
private String deviceType;
|
||||
|
||||
/** 设备类型id */
|
||||
private String deviceTypeId;
|
||||
|
||||
/** '关联空调类型(1、立式空调 2、挂式空调)' */
|
||||
private String relationType;
|
||||
|
||||
/** 父类id */
|
||||
private String parentId;
|
||||
|
||||
/** 节点名称 */
|
||||
private String title;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.bonus.boot.rear.manager.devices.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 包名称:com.bonus.boot.manager.basic.entity
|
||||
* 类名称:HospitalBean
|
||||
* 类描述:防区管理bean
|
||||
* 创建时间:2023年08月12日 09:11
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class DevicesBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 球机名称
|
||||
*/
|
||||
private String ballName;
|
||||
|
||||
/**
|
||||
* 球机puid
|
||||
*/
|
||||
private String puid;
|
||||
|
||||
/**
|
||||
* 球机编码
|
||||
*/
|
||||
private String ballCode;
|
||||
|
||||
/**
|
||||
* 球机下标
|
||||
*/
|
||||
private String ballIndex;
|
||||
|
||||
/**
|
||||
* 球机描述
|
||||
*/
|
||||
private String ballMark;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* 位置信息
|
||||
*/
|
||||
private String locationId;
|
||||
|
||||
/**
|
||||
* 球机状态(0离线1在线)
|
||||
*/
|
||||
private String onLine;
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
private String isActive;
|
||||
|
||||
private String keyWord;
|
||||
private String deviceTypeId;
|
||||
|
||||
private String fenceName;
|
||||
private String fenceStatus;
|
||||
private String fenceType;
|
||||
private String fenceCode;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.bonus.boot.rear.manager.devices.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**智慧路灯bean
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Data
|
||||
public class LightBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/** 主键id */
|
||||
private String id;
|
||||
|
||||
/** 设备名称 */
|
||||
private String lightName;
|
||||
|
||||
/** 设备编号 */
|
||||
private String lightCode;
|
||||
|
||||
/** 设备类型 */
|
||||
private String lightType;
|
||||
|
||||
/** 设备位置 */
|
||||
private String lightLocation;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
private String isActive;
|
||||
|
||||
/** 模糊查询 */
|
||||
private String keyWord;
|
||||
|
||||
/** 设备类型 */
|
||||
private String deviceType;
|
||||
|
||||
/** 设备类型id */
|
||||
private String deviceTypeId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package com.bonus.boot.rear.manager.devices.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 包名称:com.bonus.boot.manager.basic.entity
|
||||
* 类名称:StandradBean
|
||||
* 类描述:线路管理bean
|
||||
* 创建时间:2023年08月12日 09:11
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class LinearBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 线路名称
|
||||
*/
|
||||
private String lineName;
|
||||
|
||||
/**
|
||||
* 开关名称
|
||||
*/
|
||||
private String switchName;
|
||||
|
||||
/**
|
||||
* 线路昵称
|
||||
*/
|
||||
private String lineNickname;
|
||||
|
||||
/**
|
||||
* 开关id
|
||||
*/
|
||||
private String switchId;
|
||||
|
||||
/**
|
||||
* 开关mac
|
||||
*/
|
||||
private String mac;
|
||||
|
||||
/**
|
||||
* 线路开关状态:true开;fase关
|
||||
*/
|
||||
private String oc;
|
||||
|
||||
/**
|
||||
* 线路开关状态变更时间
|
||||
*/
|
||||
private String ocTime;
|
||||
|
||||
/**
|
||||
* 线路id
|
||||
*/
|
||||
private String addr;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
private String isActive;
|
||||
|
||||
private String keyWord;
|
||||
private String deviceTypeId;
|
||||
private String deviceType;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.bonus.boot.rear.manager.devices.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**空气监测设备bean
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Data
|
||||
public class MonitorBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/** 主键id */
|
||||
private String id;
|
||||
|
||||
/** 设备名称 */
|
||||
private String airQualityName;
|
||||
|
||||
/** 设备编号 */
|
||||
private String airQualityCode;
|
||||
|
||||
/** 设备类型 */
|
||||
private String airQualityType;
|
||||
|
||||
/** 设备位置 */
|
||||
private String airQualityLocation;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
private String isActive;
|
||||
|
||||
/** 模糊查询 */
|
||||
private String keyWord;
|
||||
|
||||
/** 设备类型 */
|
||||
private String deviceType;
|
||||
|
||||
/** 设备类型id */
|
||||
private String deviceTypeId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.bonus.boot.rear.manager.devices.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 包名称:com.bonus.boot.manager.basic.entity
|
||||
* 类名称:StandradBean
|
||||
* 类描述:防区管理bean
|
||||
* 创建时间:2023年08月12日 09:11
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class SmarterBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 开关名称
|
||||
*/
|
||||
private String switchName;
|
||||
|
||||
/**
|
||||
* 开关昵称
|
||||
*/
|
||||
private String switchNickname;
|
||||
|
||||
/**
|
||||
* 位置
|
||||
*/
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* mac
|
||||
*/
|
||||
private String mac;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* 智能设备类型
|
||||
*/
|
||||
private String equipmentType;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
private String linkMan;
|
||||
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 归属项目编号
|
||||
*/
|
||||
private String projectCode;
|
||||
|
||||
/**
|
||||
* 是否在线(-1未曾连接;0离线;1在线)
|
||||
*/
|
||||
private String onLine;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 在线的最后时间
|
||||
*/
|
||||
private String onlineLastTime;
|
||||
|
||||
/**
|
||||
* 位置id
|
||||
*/
|
||||
private Integer locationId;
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
private String isActive;
|
||||
|
||||
private String keyWord;
|
||||
private String deviceTypeId;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.bonus.boot.rear.manager.devices.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 包名称:com.bonus.boot.manager.basic.entity
|
||||
* 类名称:StandradBean
|
||||
* 类描述:防区管理bean
|
||||
* 创建时间:2023年08月12日 09:11
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class StandradBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* mac(设备编号)
|
||||
*/
|
||||
private String mac;
|
||||
|
||||
/**
|
||||
* ip
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 1 脉冲电子围栏,2 张力电子围栏
|
||||
*/
|
||||
private String fenceType;
|
||||
|
||||
/**
|
||||
* 防区编号
|
||||
*/
|
||||
private String fenceCode;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* 防区名称
|
||||
*/
|
||||
private String fenceName;
|
||||
|
||||
/**
|
||||
* 设备昵称
|
||||
*/
|
||||
private String fenceNickname;
|
||||
|
||||
/**
|
||||
* 0 离线 1 布防 2 撤防 4 故障 5 报警
|
||||
*/
|
||||
private String fenceStatus;
|
||||
|
||||
/**
|
||||
* 防区描述
|
||||
*/
|
||||
private String fenceMark;
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
private String isActive;
|
||||
|
||||
private String keyWord;
|
||||
private String deviceTypeId;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.bonus.boot.rear.manager.devices.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**光伏设备bean
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Data
|
||||
public class VoltBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/** 主键id */
|
||||
private String id;
|
||||
|
||||
/** 设备名称 */
|
||||
private String voltName;
|
||||
|
||||
/** 设备编号 */
|
||||
private String voltCode;
|
||||
|
||||
/** 设备类型 */
|
||||
private String voltType;
|
||||
|
||||
/** 设备位置 */
|
||||
private String voltLocation;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
private String isActive;
|
||||
|
||||
/** 模糊查询 */
|
||||
private String keyWord;
|
||||
|
||||
/** 设备类型 */
|
||||
private String deviceType;
|
||||
|
||||
/** 设备类型id */
|
||||
private String deviceTypeId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.bonus.boot.rear.manager.devices.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**用水设备bean
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Data
|
||||
public class WaterBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/** 主键id */
|
||||
private String id;
|
||||
|
||||
/** 设备名称 */
|
||||
private String waterName;
|
||||
|
||||
/** 设备编号 */
|
||||
private String waterCode;
|
||||
|
||||
/** 设备类型 */
|
||||
private String waterType;
|
||||
|
||||
/** 设备位置 */
|
||||
private String waterLocation;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
private String isActive;
|
||||
|
||||
/** 模糊查询 */
|
||||
private String keyWord;
|
||||
|
||||
/** 设备类型 */
|
||||
private String deviceType;
|
||||
|
||||
/** 设备类型id */
|
||||
private String deviceTypeId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.bonus.boot.rear.manager.devices.service;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.AirConditionerBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 空调设备 服务
|
||||
* pm_air_condition_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Mapper
|
||||
public interface AirConditionerService {
|
||||
|
||||
List<AirConditionerBean> getList(AirConditionerBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(AirConditionerBean bean);
|
||||
|
||||
AirConditionerBean getListById(String id);
|
||||
|
||||
List<AirConditionerBean> getAirTree();
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.boot.rear.manager.devices.service;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.DevicesBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 球机管理(pm_ball_info)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-12-12 13:57:37
|
||||
*/
|
||||
@Mapper
|
||||
public interface DevicesService {
|
||||
List<DevicesBean> getList(DevicesBean o);
|
||||
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(DevicesBean bean);
|
||||
|
||||
DevicesBean getListById(String id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.boot.rear.manager.devices.service;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.LightBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 空气监测设备 服务
|
||||
* pm_street_light_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Mapper
|
||||
public interface LightService {
|
||||
|
||||
List<LightBean> getList(LightBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(LightBean bean);
|
||||
|
||||
LightBean getListById(String id);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.bonus.boot.rear.manager.devices.service;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.LinearBean;
|
||||
import com.bonus.boot.rear.manager.devices.entity.StandradBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 线路管理(pm_line_info)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-12-12 13:57:37
|
||||
*/
|
||||
@Mapper
|
||||
public interface LinearService {
|
||||
|
||||
List<LinearBean> getList(LinearBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(StandradBean bean);
|
||||
|
||||
int updateInfo(LinearBean bean);
|
||||
|
||||
LinearBean getListById(String id);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.boot.rear.manager.devices.service;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.MonitorBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 空气监测设备 服务
|
||||
* pm_air_quality_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Mapper
|
||||
public interface MonitorService {
|
||||
|
||||
List<MonitorBean> getList(MonitorBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(MonitorBean bean);
|
||||
|
||||
MonitorBean getListById(String id);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.bonus.boot.rear.manager.devices.service;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.SmarterBean;
|
||||
import com.bonus.boot.rear.manager.devices.entity.StandradBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能开关管理(pm_fence_info)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-12-12 13:57:37
|
||||
*/
|
||||
@Mapper
|
||||
public interface SmarterService {
|
||||
|
||||
List<SmarterBean> getList(SmarterBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(StandradBean bean);
|
||||
|
||||
int updateInfo(SmarterBean bean);
|
||||
|
||||
SmarterBean getListById(String id);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.boot.rear.manager.devices.service;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.DevicesBean;
|
||||
import com.bonus.boot.rear.manager.devices.entity.StandradBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 防区管理(pm_fence_info)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-12-12 13:57:37
|
||||
*/
|
||||
@Mapper
|
||||
public interface StandradService {
|
||||
List<StandradBean> getList(StandradBean o);
|
||||
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(StandradBean bean);
|
||||
|
||||
StandradBean getListById(String id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.boot.rear.manager.devices.service;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.VoltBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 光伏设备 服务
|
||||
* pm_photovoltaic_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Mapper
|
||||
public interface VoltService {
|
||||
|
||||
List<VoltBean> getList(VoltBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(VoltBean bean);
|
||||
|
||||
VoltBean getListById(String id);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.boot.rear.manager.devices.service;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.WaterBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 用水设备 服务
|
||||
* pm_water_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Mapper
|
||||
public interface WaterService {
|
||||
|
||||
List<WaterBean> getList(WaterBean o);
|
||||
|
||||
List<ZNode> getDepartmentTree();
|
||||
|
||||
int updateInfo(WaterBean bean);
|
||||
|
||||
WaterBean getListById(String id);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.boot.rear.manager.devices.service.impl;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.dao.AirConditionerDao;
|
||||
import com.bonus.boot.rear.manager.devices.entity.AirConditionerBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.AirConditionerService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 空气监测设备 服务实现类
|
||||
* pm_air_quality_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Service("AirConditionerService")
|
||||
public class AirConditionerServiceImpl implements AirConditionerService {
|
||||
@Resource
|
||||
private AirConditionerDao dao;
|
||||
@Override
|
||||
public List<AirConditionerBean> getList(AirConditionerBean o) {
|
||||
return dao.getList(o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ZNode> getDepartmentTree() {
|
||||
return dao.getDepartmentTree();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int updateInfo(AirConditionerBean bean) {
|
||||
return dao.updateInfo(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AirConditionerBean getListById(String id) {
|
||||
return dao.getListById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AirConditionerBean> getAirTree() {
|
||||
return dao.getAirTree();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.bonus.boot.rear.manager.devices.service.impl;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.dao.DevicesDao;
|
||||
import com.bonus.boot.rear.manager.devices.entity.DevicesBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.DevicesService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 球机管理(pm_ball_info)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-12-12 13:57:46
|
||||
*/
|
||||
@Service("devicesService")
|
||||
public class DevicesServiceImpl implements DevicesService {
|
||||
@Resource
|
||||
private DevicesDao dao;
|
||||
@Override
|
||||
public List<DevicesBean> getList(DevicesBean o) {
|
||||
return dao.getList(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ZNode> getDepartmentTree() {
|
||||
return dao.getDepartmentTree();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateInfo(DevicesBean bean) {
|
||||
return dao.updateInfo(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevicesBean getListById(String id) {
|
||||
return dao.getListById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.bonus.boot.rear.manager.devices.service.impl;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.dao.LightDao;
|
||||
import com.bonus.boot.rear.manager.devices.entity.LightBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.LightService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 空气监测设备 服务实现类
|
||||
* pm_street_light_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Service("LightService")
|
||||
public class LightServiceImpl implements LightService {
|
||||
@Resource
|
||||
private LightDao dao;
|
||||
@Override
|
||||
public List<LightBean> getList(LightBean o) {
|
||||
return dao.getList(o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ZNode> getDepartmentTree() {
|
||||
return dao.getDepartmentTree();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int updateInfo(LightBean bean) {
|
||||
return dao.updateInfo(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LightBean getListById(String id) {
|
||||
return dao.getListById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.bonus.boot.rear.manager.devices.service.impl;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.dao.LinearDao;
|
||||
import com.bonus.boot.rear.manager.devices.entity.LinearBean;
|
||||
import com.bonus.boot.rear.manager.devices.entity.StandradBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.LinearService;
|
||||
import com.bonus.boot.rear.manager.devices.service.SmarterService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 线路管理(pm_line_info)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-12-12 13:57:46
|
||||
*/
|
||||
@Service("linearService")
|
||||
public class LinearServiceImpl implements LinearService {
|
||||
@Resource
|
||||
private LinearDao dao;
|
||||
@Override
|
||||
public List<LinearBean> getList(LinearBean o) {
|
||||
return dao.getList(o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ZNode> getDepartmentTree() {
|
||||
return dao.getDepartmentTree();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateInfo(StandradBean bean) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateInfo(LinearBean bean) {
|
||||
return dao.updateInfo(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinearBean getListById(String id) {
|
||||
return dao.getListById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.bonus.boot.rear.manager.devices.service.impl;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.dao.MonitorDao;
|
||||
import com.bonus.boot.rear.manager.devices.entity.MonitorBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.MonitorService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 空气监测设备 服务实现类
|
||||
* pm_air_quality_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Service("MonitorService")
|
||||
public class MonitorServiceImpl implements MonitorService {
|
||||
@Resource
|
||||
private MonitorDao dao;
|
||||
@Override
|
||||
public List<MonitorBean> getList(MonitorBean o) {
|
||||
return dao.getList(o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ZNode> getDepartmentTree() {
|
||||
return dao.getDepartmentTree();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int updateInfo(MonitorBean bean) {
|
||||
return dao.updateInfo(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MonitorBean getListById(String id) {
|
||||
return dao.getListById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.boot.rear.manager.devices.service.impl;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.dao.SmarterDao;
|
||||
import com.bonus.boot.rear.manager.devices.entity.SmarterBean;
|
||||
import com.bonus.boot.rear.manager.devices.entity.StandradBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.SmarterService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能开关管理(pm_fence_info)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-12-12 13:57:46
|
||||
*/
|
||||
@Service("smarterService")
|
||||
public class SmarterServiceImpl implements SmarterService {
|
||||
@Resource
|
||||
private SmarterDao dao;
|
||||
@Override
|
||||
public List<SmarterBean> getList(SmarterBean o) {
|
||||
return dao.getList(o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ZNode> getDepartmentTree() {
|
||||
return dao.getDepartmentTree();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateInfo(StandradBean bean) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateInfo(SmarterBean bean) {
|
||||
return dao.updateInfo(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmarterBean getListById(String id) {
|
||||
return dao.getListById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.bonus.boot.rear.manager.devices.service.impl;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.dao.StandradDao;
|
||||
import com.bonus.boot.rear.manager.devices.entity.StandradBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.StandradService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 防区管理(pm_fence_info)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-12-12 13:57:46
|
||||
*/
|
||||
@Service("standradService")
|
||||
public class StandradServiceImpl implements StandradService {
|
||||
@Resource
|
||||
private StandradDao dao;
|
||||
@Override
|
||||
public List<StandradBean> getList(StandradBean o) {
|
||||
return dao.getList(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ZNode> getDepartmentTree() {
|
||||
return dao.getDepartmentTree();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateInfo(StandradBean bean) {
|
||||
return dao.updateInfo(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StandradBean getListById(String id) {
|
||||
return dao.getListById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.bonus.boot.rear.manager.devices.service.impl;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.dao.VoltDao;
|
||||
import com.bonus.boot.rear.manager.devices.entity.VoltBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.VoltService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 空气监测设备 服务实现类
|
||||
* pm_air_quality_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Service("VoltService")
|
||||
public class VoltServiceImpl implements VoltService {
|
||||
@Resource
|
||||
private VoltDao dao;
|
||||
@Override
|
||||
public List<VoltBean> getList(VoltBean o) {
|
||||
return dao.getList(o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ZNode> getDepartmentTree() {
|
||||
return dao.getDepartmentTree();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int updateInfo(VoltBean bean) {
|
||||
return dao.updateInfo(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoltBean getListById(String id) {
|
||||
return dao.getListById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.bonus.boot.rear.manager.devices.service.impl;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.dao.WaterDao;
|
||||
import com.bonus.boot.rear.manager.devices.entity.WaterBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.WaterService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 空气监测设备 服务实现类
|
||||
* pm_air_quality_info
|
||||
* @author xcx
|
||||
* @date 2024/08/19
|
||||
*/
|
||||
@Service("WaterService")
|
||||
public class WaterServiceImpl implements WaterService {
|
||||
@Resource
|
||||
private WaterDao dao;
|
||||
@Override
|
||||
public List<WaterBean> getList(WaterBean o) {
|
||||
return dao.getList(o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ZNode> getDepartmentTree() {
|
||||
return dao.getDepartmentTree();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int updateInfo(WaterBean bean) {
|
||||
return dao.updateInfo(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaterBean getListById(String id) {
|
||||
return dao.getListById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package com.bonus.boot.rear.manager.facilityName.controller;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.OrgBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.facilityName.service.OrgService;
|
||||
import com.bonus.boot.rear.manager.facilityName.service.ProjectService;
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.boot.rear.manager.manager.utils.AjaxRes;
|
||||
import com.bonus.boot.rear.manager.manager.utils.GlobalConst;
|
||||
import com.bonus.boot.rear.manager.manager.utils.UserUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "组织管理")
|
||||
@RestController
|
||||
@RequestMapping("/org")
|
||||
public class OrgController {
|
||||
|
||||
@Autowired
|
||||
private OrgService service;
|
||||
|
||||
|
||||
@Resource(name = "ProjectService")
|
||||
private ProjectService proService;
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getOrgList")
|
||||
@ApiOperation(value = "获取组织信息")
|
||||
public AjaxRes getOrgList(){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try {
|
||||
String orgId = UserUtil.getLoginUser().getOrgId();
|
||||
String companyId = proService.getCompanyId(orgId);
|
||||
List<ZNode> list= service.getAll("");
|
||||
for(int i=0;i<list.size();i++){
|
||||
list.get(i).setOpen(true);
|
||||
}
|
||||
ar.setSucceed(list);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getCompanyTreeList")
|
||||
@ApiOperation(value = "获取组织信息")
|
||||
public AjaxRes getCompanyTree(OrgBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try {
|
||||
String orgId = UserUtil.getLoginUser().getOrgId();
|
||||
String companyId = proService.getCompanyId(orgId);
|
||||
if (companyId == null || companyId == ""){
|
||||
companyId = "0";
|
||||
}
|
||||
bean.setCompanyId(Integer.valueOf(companyId));
|
||||
List<ZNode> list= service.getCompanyTree(bean);
|
||||
ar.setSucceed(list);
|
||||
} catch (Exception e) {
|
||||
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("deleteOrg")
|
||||
@ApiOperation(value = "删除组织")
|
||||
public AjaxRes deleteOrg( OrgBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int result = service.deleteOrg(bean);
|
||||
if (result == 1){
|
||||
ar.setSucceed(null, GlobalConst.DEL_SUCCEED);
|
||||
}else {
|
||||
ar.setSucceed(null, GlobalConst.DEL_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("updateOrg")
|
||||
@ApiOperation(value = "修改组织")
|
||||
public AjaxRes updateOrg( OrgBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int result = service.updateOrg(bean);
|
||||
if (result == 1){
|
||||
ar.setSucceed(null, GlobalConst.SAVE_SUCCEED);
|
||||
}else {
|
||||
ar.setSucceed(null, GlobalConst.SAVE_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("/addOrg")
|
||||
@ApiOperation(value = "添加组织")
|
||||
public AjaxRes addOrg( OrgBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int result = service.addOrg(bean);
|
||||
if (result == 1){
|
||||
ar.setSucceed(null, GlobalConst.SAVE_SUCCEED);
|
||||
}else {
|
||||
ar.setSucceed(null, GlobalConst.SAVE_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.boot.rear.manager.facilityName.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.OrgBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository(value = "OrgDao")
|
||||
public interface OrgDao {
|
||||
List<ZNode> getAll(String companyId);
|
||||
|
||||
int addOrg(OrgBean bean);
|
||||
|
||||
int updateOrg(OrgBean bean);
|
||||
|
||||
int deleteOrg(OrgBean bean);
|
||||
|
||||
OrgBean findCompanyInfo(OrgBean o);
|
||||
|
||||
List<ZNode> getCompanyTree(OrgBean bean);
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.bonus.boot.rear.manager.facilityName.dao;
|
||||
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository(value = "ProjectDao")
|
||||
public interface ProjectDao {
|
||||
|
||||
String getCompanyId(String orgId );
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package com.bonus.boot.rear.manager.facilityName.entity;
|
||||
|
||||
public class OrgBean {
|
||||
private int id;
|
||||
private String name;
|
||||
private int parentId;
|
||||
private String isActive;
|
||||
private String updateTime;
|
||||
private int type;
|
||||
private int companyId;
|
||||
private String level;
|
||||
private String companyName;
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(int parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setIsActive(String isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(int companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(String level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrgBean{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", parentId=" + parentId +
|
||||
", isActive='" + isActive + '\'' +
|
||||
", updateTime='" + updateTime + '\'' +
|
||||
", type=" + type +
|
||||
", companyId=" + companyId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,288 @@
|
|||
package com.bonus.boot.rear.manager.facilityName.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ZNode implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
|
||||
private String pId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String code;
|
||||
|
||||
private String pName;
|
||||
|
||||
private String checked;
|
||||
|
||||
private Integer type;
|
||||
private String puid;
|
||||
|
||||
private boolean open = false;
|
||||
|
||||
private boolean existed = true;
|
||||
|
||||
private String icon;
|
||||
|
||||
private String sort;
|
||||
|
||||
private String leasePrice;
|
||||
|
||||
private String internalPrice;
|
||||
|
||||
private String portalPrice;
|
||||
|
||||
private Float num;
|
||||
|
||||
private Integer currency;
|
||||
|
||||
private Integer level;
|
||||
|
||||
private String unitName;
|
||||
|
||||
private String unitValue;
|
||||
|
||||
private String partId;
|
||||
|
||||
private Integer isCount;
|
||||
|
||||
private String storageNum;
|
||||
|
||||
private Integer keepId;
|
||||
private String keepName;
|
||||
|
||||
public String getPuid() {
|
||||
return puid;
|
||||
}
|
||||
|
||||
public void setPuid(String puid) {
|
||||
this.puid = puid;
|
||||
}
|
||||
|
||||
public Integer getIsCount() {
|
||||
return isCount;
|
||||
}
|
||||
|
||||
public void setIsCount(Integer isCount) {
|
||||
this.isCount = isCount;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getPortalPrice() {
|
||||
return portalPrice;
|
||||
}
|
||||
|
||||
public void setPortalPrice(String portalPrice) {
|
||||
this.portalPrice = portalPrice;
|
||||
}
|
||||
|
||||
public String getPartId() {
|
||||
return partId;
|
||||
}
|
||||
|
||||
public void setPartId(String partId) {
|
||||
this.partId = partId;
|
||||
}
|
||||
|
||||
public String getUnitName() {
|
||||
return unitName;
|
||||
}
|
||||
|
||||
public void setUnitName(String unitName) {
|
||||
this.unitName = unitName;
|
||||
}
|
||||
|
||||
public String getUnitValue() {
|
||||
return unitValue;
|
||||
}
|
||||
|
||||
public void setUnitValue(String unitValue) {
|
||||
this.unitValue = unitValue;
|
||||
}
|
||||
|
||||
public String getpName() {
|
||||
return pName;
|
||||
}
|
||||
|
||||
public void setpName(String pName) {
|
||||
this.pName = pName;
|
||||
}
|
||||
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public Integer getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
public void setCurrency(Integer currency) {
|
||||
this.currency = currency;
|
||||
}
|
||||
|
||||
public String getInternalPrice() {
|
||||
return internalPrice;
|
||||
}
|
||||
|
||||
public void setInternalPrice(String internalPrice) {
|
||||
this.internalPrice = internalPrice;
|
||||
}
|
||||
|
||||
public Float getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(Float num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public String getLeasePrice() {
|
||||
return leasePrice;
|
||||
}
|
||||
|
||||
public void setLeasePrice(String leasePrice) {
|
||||
this.leasePrice = leasePrice;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getpId() {
|
||||
return pId;
|
||||
}
|
||||
|
||||
public void setpId(String pId) {
|
||||
this.pId = pId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getChecked() {
|
||||
return checked;
|
||||
}
|
||||
|
||||
public void setChecked(String checked) {
|
||||
this.checked = checked;
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
return open;
|
||||
}
|
||||
|
||||
public void setOpen(boolean open) {
|
||||
this.open = open;
|
||||
}
|
||||
|
||||
public boolean isExisted() {
|
||||
return existed;
|
||||
}
|
||||
|
||||
public void setExisted(boolean existed) {
|
||||
this.existed = existed;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public String getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(String sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public String getStorageNum() {
|
||||
return storageNum;
|
||||
}
|
||||
|
||||
public void setStorageNum(String storageNum) {
|
||||
this.storageNum = storageNum;
|
||||
}
|
||||
|
||||
|
||||
public Integer getKeepId() {
|
||||
return keepId;
|
||||
}
|
||||
|
||||
public void setKeepId(Integer keepId) {
|
||||
this.keepId = keepId;
|
||||
}
|
||||
|
||||
public String getKeepName() {
|
||||
return keepName;
|
||||
}
|
||||
|
||||
public void setKeepName(String keepName) {
|
||||
this.keepName = keepName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ZNode{" +
|
||||
"id='" + id + '\'' +
|
||||
", pId='" + pId + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", code='" + code + '\'' +
|
||||
", pName='" + pName + '\'' +
|
||||
", checked='" + checked + '\'' +
|
||||
", type=" + type +
|
||||
", puid='" + puid + '\'' +
|
||||
", open=" + open +
|
||||
", existed=" + existed +
|
||||
", icon='" + icon + '\'' +
|
||||
", sort='" + sort + '\'' +
|
||||
", leasePrice='" + leasePrice + '\'' +
|
||||
", internalPrice='" + internalPrice + '\'' +
|
||||
", portalPrice='" + portalPrice + '\'' +
|
||||
", num=" + num +
|
||||
", currency=" + currency +
|
||||
", level=" + level +
|
||||
", unitName='" + unitName + '\'' +
|
||||
", unitValue='" + unitValue + '\'' +
|
||||
", partId='" + partId + '\'' +
|
||||
", isCount=" + isCount +
|
||||
", storageNum='" + storageNum + '\'' +
|
||||
", keepId=" + keepId +
|
||||
", keepName='" + keepName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.bonus.boot.rear.manager.facilityName.service;
|
||||
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.OrgBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OrgService {
|
||||
|
||||
List<ZNode> getAll(String companyId);
|
||||
|
||||
int addOrg(OrgBean bean);
|
||||
|
||||
int updateOrg(OrgBean bean);
|
||||
|
||||
int deleteOrg(OrgBean bean);
|
||||
|
||||
List<ZNode> getCompanyTree(OrgBean bean);
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.bonus.boot.rear.manager.facilityName.service;
|
||||
|
||||
public class ProjectService {
|
||||
public String getCompanyId(String orgId) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.bonus.boot.rear.manager.facilityName.service.impl;
|
||||
|
||||
import com.bonus.boot.rear.manager.facilityName.dao.OrgDao;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.OrgBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.facilityName.service.OrgService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service(value = "OrgService")
|
||||
public class OrgServiceImpl implements OrgService {
|
||||
|
||||
@Resource(name = "OrgDao")
|
||||
private OrgDao dao;
|
||||
|
||||
@Override
|
||||
public List<ZNode> getAll(String companyId){
|
||||
List<ZNode> list = dao.getAll(companyId);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addOrg(OrgBean bean){
|
||||
if("1".equals(bean.getLevel())){
|
||||
bean.setType(2);
|
||||
}
|
||||
if("2".equals(bean.getLevel())){
|
||||
bean.setType(3);
|
||||
}
|
||||
return dao.addOrg(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateOrg(OrgBean bean){
|
||||
return dao.updateOrg(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteOrg(OrgBean bean){
|
||||
return dao.deleteOrg(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ZNode> getCompanyTree(OrgBean bean) {
|
||||
return dao.getCompanyTree(bean);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.boot.rear.manager.facilityName.service.impl;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.facilityName.dao.ProjectDao;
|
||||
import com.bonus.boot.rear.manager.facilityName.service.ProjectService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service(value = "ProjectService")
|
||||
public class ProjectServiceImpl extends ProjectService {
|
||||
@Resource(name = "ProjectDao")
|
||||
private ProjectDao dao;
|
||||
public String getCompanyId(String orgId) {
|
||||
return dao.getCompanyId(orgId);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package com.bonus.boot.rear.manager.information.controller;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.dao.DevicesDao;
|
||||
import com.bonus.boot.rear.manager.devices.entity.DevicesBean;
|
||||
import com.bonus.boot.rear.manager.information.dao.InformationDao;
|
||||
import com.bonus.boot.rear.manager.information.entity.InformationBean;
|
||||
import com.bonus.boot.rear.manager.information.service.InformationService;
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableRequest;
|
||||
import com.bonus.boot.rear.manager.manager.utils.ExcelUtils;
|
||||
import com.bonus.boot.rear.manager.manager.utils.R;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 报警信息
|
||||
* @author jjLv
|
||||
* @date 2023-08-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("information")
|
||||
public class InformationController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private InformationService service;
|
||||
|
||||
@Resource
|
||||
private InformationDao dao;
|
||||
|
||||
@PostMapping("getMsgContent")
|
||||
@ApiOperation(value = "报警信息-列表")
|
||||
public R getList(InformationBean o) throws ParseException {
|
||||
List<InformationBean> list = service.getList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 报警信息管理导出
|
||||
* @param request
|
||||
* @param response
|
||||
* @param page
|
||||
*/
|
||||
@RequestMapping(value = "/exportPhysicalCheckResult", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "报警信息-导出")
|
||||
public void exportPayroll(HttpServletRequest request, HttpServletResponse response, PageTableRequest page) throws ParseException {
|
||||
InformationBean b = new InformationBean();
|
||||
b.setPhyTimeStart(request.getParameter("phyTimeStart"));
|
||||
b.setPhyTimeEnd(request.getParameter("phyTimeEnd"));
|
||||
b.setKeyWord(request.getParameter("keyword"));
|
||||
List<InformationBean> list = service.getList(b);
|
||||
List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
|
||||
String[] excelHeader = {"序号","报警类型","设备名称","设备类型","设备位置","报警名称",
|
||||
"报警时间"};
|
||||
int[] ds_format = {2, 2, 2, 2, 2, 2, 2};
|
||||
String fileName = "报警结果信息表";
|
||||
if (list != null) {
|
||||
int i = 0;
|
||||
for (InformationBean bean : list){
|
||||
i++;
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("序号",i);
|
||||
map.put("报警类型",bean.getAlarmType());
|
||||
map.put("设备名称",bean.getDeviceName());
|
||||
map.put("设备类型",bean.getDeviceType());
|
||||
map.put("设备位置",bean.getDeviceLocation());
|
||||
map.put("报警名称",bean.getAlarmName());
|
||||
map.put("报警时间",bean.getAlarmTime());
|
||||
mapList.add(map);
|
||||
}
|
||||
}
|
||||
try {
|
||||
ExcelUtils.export(fileName, fileName, excelHeader, excelHeader, ds_format, null, mapList, request,
|
||||
response);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.boot.rear.manager.information.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.DevicesBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.information.entity.InformationBean;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 球机管理(pm_ball_info)表数据库访问层
|
||||
*
|
||||
* @author jjLv
|
||||
* @date 2023-08-14
|
||||
*/
|
||||
@Mapper
|
||||
public interface InformationDao {
|
||||
|
||||
List<InformationBean> getList(InformationBean o);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.bonus.boot.rear.manager.information.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @description 报警信息统计
|
||||
* @author zhengkai.blog.csdn.net
|
||||
* @date 2023-08-14
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class InformationBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* 设备位置
|
||||
*/
|
||||
private String deviceLocation;
|
||||
|
||||
/**
|
||||
* 报警类型
|
||||
*/
|
||||
private String alarmType;
|
||||
|
||||
/**
|
||||
* 报警名称
|
||||
*/
|
||||
private String alarmName;
|
||||
|
||||
/**
|
||||
* 报警时间
|
||||
*/
|
||||
private String alarmTime;
|
||||
|
||||
/**
|
||||
* 关键字查询
|
||||
*/
|
||||
private String keyWord;
|
||||
|
||||
private String phyTimeStart;
|
||||
private String phyTimeEnd;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.boot.rear.manager.information.service;
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.entity.DevicesBean;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.information.entity.InformationBean;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 球机管理(pm_ball_info)表数据库访问层
|
||||
*
|
||||
* @author jjLv
|
||||
* @date 2023-08-14
|
||||
*/
|
||||
@Mapper
|
||||
public interface InformationService {
|
||||
List<InformationBean> getList(InformationBean o) throws ParseException;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.bonus.boot.rear.manager.information.service.impl;
|
||||
|
||||
|
||||
import com.bonus.boot.rear.manager.devices.dao.DevicesDao;
|
||||
import com.bonus.boot.rear.manager.devices.entity.DevicesBean;
|
||||
import com.bonus.boot.rear.manager.devices.service.DevicesService;
|
||||
import com.bonus.boot.rear.manager.facilityName.entity.ZNode;
|
||||
import com.bonus.boot.rear.manager.information.dao.InformationDao;
|
||||
import com.bonus.boot.rear.manager.information.entity.InformationBean;
|
||||
import com.bonus.boot.rear.manager.information.service.InformationService;
|
||||
import com.bonus.boot.rear.manager.manager.utils.DateTimeHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 球机管理(pm_ball_info)表服务实现类
|
||||
*
|
||||
* @author jjLv
|
||||
* @date 2023-08-14
|
||||
*/
|
||||
@Service("informationService")
|
||||
public class InformationServiceImpl implements InformationService {
|
||||
@Resource
|
||||
private InformationDao dao;
|
||||
@Override
|
||||
public List<InformationBean> getList(InformationBean o) throws ParseException {
|
||||
// List<InformationBean> list = dao.getList(o);
|
||||
// // 创建SimpleDateFormat对象,指定日期和时间的格式
|
||||
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// for (int i = 0; i < list.size(); i++) {
|
||||
// // 解析日期时间字符串并转换为java.util.Date对象
|
||||
// java.util.Date date = dateFormat.parse(list.get(i).getAlarmTime());
|
||||
// list.get(i).setAlarmTime(dateFormat.format(date));
|
||||
// }
|
||||
return dao.getList(o);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.boot.rear.manager.manager.advice;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.entity.ResponseInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.web.bind.MissingServletRequestParameterException;
|
||||
import org.springframework.web.bind.UnsatisfiedServletRequestParameterException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||
|
||||
/**
|
||||
* springmvc异常处理
|
||||
*
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
public class ExceptionHandlerAdvice {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("adminLogger");
|
||||
|
||||
@ExceptionHandler({ IllegalArgumentException.class })
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
public ResponseInfo badRequestException(IllegalArgumentException exception) {
|
||||
return new ResponseInfo(HttpStatus.BAD_REQUEST.value() + "", exception.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler({ AccessDeniedException.class })
|
||||
@ResponseStatus(HttpStatus.FORBIDDEN)
|
||||
public ResponseInfo badRequestException(AccessDeniedException exception) {
|
||||
return new ResponseInfo(HttpStatus.FORBIDDEN.value() + "", exception.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler({ MissingServletRequestParameterException.class, HttpMessageNotReadableException.class,
|
||||
UnsatisfiedServletRequestParameterException.class, MethodArgumentTypeMismatchException.class })
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
public ResponseInfo badRequestException(Exception exception) {
|
||||
return new ResponseInfo(HttpStatus.BAD_REQUEST.value() + "", exception.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(Throwable.class)
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
public ResponseInfo exception(Throwable throwable) {
|
||||
log.error("系统异常", throwable);
|
||||
return new ResponseInfo(HttpStatus.INTERNAL_SERVER_ERROR.value() + "", throwable.getMessage());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.bonus.boot.rear.manager.manager.advice;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.service.SysLogService;
|
||||
import com.bonus.boot.rear.manager.manager.utils.UserUtil;
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.model.SysLogs;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 统一日志处理
|
||||
*
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class LogAdvice {
|
||||
|
||||
@Autowired
|
||||
private SysLogService logService;
|
||||
|
||||
@Around(value = "@annotation(com.bonus.boot.rear.manager.manager.annotation.LogAnnotation)")
|
||||
public Object logSave(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
SysLogs sysLogs = new SysLogs();
|
||||
sysLogs.setUser(UserUtil.getLoginUser()); // 设置当前登录用户
|
||||
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
|
||||
|
||||
String module = null;
|
||||
LogAnnotation logAnnotation = methodSignature.getMethod().getDeclaredAnnotation(LogAnnotation.class);
|
||||
module = logAnnotation.module();
|
||||
if (StringUtils.isEmpty(module)) {
|
||||
ApiOperation apiOperation = methodSignature.getMethod().getDeclaredAnnotation(ApiOperation.class);
|
||||
if (apiOperation != null) {
|
||||
module = apiOperation.value();
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(module)) {
|
||||
throw new RuntimeException("没有指定日志module");
|
||||
}
|
||||
sysLogs.setModule(module);
|
||||
|
||||
try {
|
||||
Object object = joinPoint.proceed();
|
||||
sysLogs.setFlag(true);
|
||||
|
||||
return object;
|
||||
} catch (Exception e) {
|
||||
sysLogs.setFlag(false);
|
||||
sysLogs.setRemark(e.getMessage());
|
||||
throw e;
|
||||
} finally {
|
||||
if (sysLogs.getUser() != null) {
|
||||
logService.save(sysLogs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.bonus.boot.rear.manager.manager.advice;
|
||||
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
|
||||
//验证码错误抛出异常
|
||||
public class VerifyCodeException extends AuthenticationException {
|
||||
|
||||
public VerifyCodeException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public VerifyCodeException(String msg, Throwable t) {
|
||||
super(msg, t);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.boot.rear.manager.manager.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 日志注解
|
||||
*
|
||||
*/
|
||||
@Target({ ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface LogAnnotation {
|
||||
String module() default "";
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.boot.rear.manager.manager.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
/**
|
||||
* 线程池配置、启用异步
|
||||
*
|
||||
*/
|
||||
@EnableAsync(proxyTargetClass = true)
|
||||
@Configuration
|
||||
public class AsycTaskExecutorConfig {
|
||||
|
||||
@Bean
|
||||
public TaskExecutor taskExecutor() {
|
||||
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
|
||||
taskExecutor.setCorePoolSize(50);
|
||||
taskExecutor.setMaxPoolSize(100);
|
||||
|
||||
return taskExecutor;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package com.bonus.boot.rear.manager.manager.config;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.filter.TokenFilter;
|
||||
import com.bonus.boot.rear.manager.manager.filter.VerifyFilter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
|
||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
||||
|
||||
/**
|
||||
* spring security配置
|
||||
*
|
||||
*/
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||
public class BnsSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private AuthenticationSuccessHandler authenticationSuccessHandler;
|
||||
@Autowired
|
||||
private AuthenticationFailureHandler authenticationFailureHandler;
|
||||
@Autowired
|
||||
private LogoutSuccessHandler logoutSuccessHandler;
|
||||
@Autowired
|
||||
private AuthenticationEntryPoint authenticationEntryPoint;
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
@Autowired
|
||||
private TokenFilter tokenFilter;
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
@Value("${loginCode.prefix}")
|
||||
private String prefix;
|
||||
|
||||
@Bean
|
||||
public BCryptPasswordEncoder bCryptPasswordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.csrf().disable();
|
||||
|
||||
// 基于token,所以不需要session
|
||||
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
|
||||
|
||||
http.authorizeRequests()
|
||||
.antMatchers("/", "/*.html", "/favicon.ico", "/css/**", "/js/**", "/fonts/**", "/layui/**", "/img/**",
|
||||
"/v2/api-docs/**", "/swagger-resources/**", "/webjars/**", "/pages/**", "/druid/**",
|
||||
"/statics/**","/dataInfo/**","/getCode/**")
|
||||
.permitAll().anyRequest().authenticated();
|
||||
http.formLogin().loginProcessingUrl("/login")
|
||||
.successHandler(authenticationSuccessHandler).failureHandler(authenticationFailureHandler).and()
|
||||
//.addFilterBefore(new VerifyFilter(redisTemplate,prefix,authenticationFailureHandler), UsernamePasswordAuthenticationFilter.class)
|
||||
.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint);
|
||||
http.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);
|
||||
// 解决不允许显示在iframe的问题
|
||||
http.headers().frameOptions().disable();
|
||||
http.headers().cacheControl();
|
||||
|
||||
http.addFilterBefore(tokenFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,255 @@
|
|||
package com.bonus.boot.rear.manager.manager.config;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.support.http.StatViewServlet;
|
||||
import com.alibaba.druid.support.http.WebStatFilter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Druid数据源配置
|
||||
* 2018.05.24改为配置的方式,配置前缀spring.datasource.druid,看下application.yml
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
//@Configuration
|
||||
public class DruidConfig {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("adminLogger");
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean<StatViewServlet> druidServlet() {
|
||||
log.info("init Druid Servlet Configuration ");
|
||||
ServletRegistrationBean<StatViewServlet> servletRegistrationBean = new ServletRegistrationBean<>(
|
||||
new StatViewServlet(), "/druid/*");
|
||||
// IP白名单
|
||||
servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
|
||||
// IP黑名单(共同存在时,deny优先于allow)
|
||||
// servletRegistrationBean.addInitParameter("deny", "192.168.27.26");
|
||||
// // 控制台管理用户
|
||||
// servletRegistrationBean.addInitParameter("loginUsername", "admin");
|
||||
// servletRegistrationBean.addInitParameter("loginPassword", "admin");
|
||||
// // 是否能够重置数据 禁用HTML页面上的“Reset All”功能
|
||||
// servletRegistrationBean.addInitParameter("resetEnable", "false");
|
||||
return servletRegistrationBean;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean<WebStatFilter> filterRegistrationBean() {
|
||||
FilterRegistrationBean<WebStatFilter> filterRegistrationBean = new FilterRegistrationBean<>(
|
||||
new WebStatFilter());
|
||||
filterRegistrationBean.addUrlPatterns("/*");
|
||||
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
|
||||
return filterRegistrationBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据源配置
|
||||
*
|
||||
* @author 小威老师 xiaoweijiagou@163.com
|
||||
*
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.datasource")
|
||||
public class DataSourceProperties {
|
||||
private String url;
|
||||
private String username;
|
||||
private String password;
|
||||
private String driverClassName;
|
||||
private int initialSize;
|
||||
private int minIdle;
|
||||
private int maxActive;
|
||||
private int maxWait;
|
||||
private int timeBetweenEvictionRunsMillis;
|
||||
private int minEvictableIdleTimeMillis;
|
||||
private String validationQuery;
|
||||
private boolean testWhileIdle;
|
||||
private boolean testOnBorrow;
|
||||
private boolean testOnReturn;
|
||||
private boolean poolPreparedStatements;
|
||||
private int maxPoolPreparedStatementPerConnectionSize;
|
||||
private String filters;
|
||||
private String connectionProperties;
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getDriverClassName() {
|
||||
return driverClassName;
|
||||
}
|
||||
|
||||
public void setDriverClassName(String driverClassName) {
|
||||
this.driverClassName = driverClassName;
|
||||
}
|
||||
|
||||
public int getInitialSize() {
|
||||
return initialSize;
|
||||
}
|
||||
|
||||
public void setInitialSize(int initialSize) {
|
||||
this.initialSize = initialSize;
|
||||
}
|
||||
|
||||
public int getMinIdle() {
|
||||
return minIdle;
|
||||
}
|
||||
|
||||
public void setMinIdle(int minIdle) {
|
||||
this.minIdle = minIdle;
|
||||
}
|
||||
|
||||
public int getMaxActive() {
|
||||
return maxActive;
|
||||
}
|
||||
|
||||
public void setMaxActive(int maxActive) {
|
||||
this.maxActive = maxActive;
|
||||
}
|
||||
|
||||
public int getMaxWait() {
|
||||
return maxWait;
|
||||
}
|
||||
|
||||
public void setMaxWait(int maxWait) {
|
||||
this.maxWait = maxWait;
|
||||
}
|
||||
|
||||
public int getTimeBetweenEvictionRunsMillis() {
|
||||
return timeBetweenEvictionRunsMillis;
|
||||
}
|
||||
|
||||
public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis) {
|
||||
this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
|
||||
}
|
||||
|
||||
public int getMinEvictableIdleTimeMillis() {
|
||||
return minEvictableIdleTimeMillis;
|
||||
}
|
||||
|
||||
public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) {
|
||||
this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
|
||||
}
|
||||
|
||||
public String getValidationQuery() {
|
||||
return validationQuery;
|
||||
}
|
||||
|
||||
public void setValidationQuery(String validationQuery) {
|
||||
this.validationQuery = validationQuery;
|
||||
}
|
||||
|
||||
public boolean isTestWhileIdle() {
|
||||
return testWhileIdle;
|
||||
}
|
||||
|
||||
public void setTestWhileIdle(boolean testWhileIdle) {
|
||||
this.testWhileIdle = testWhileIdle;
|
||||
}
|
||||
|
||||
public boolean isTestOnBorrow() {
|
||||
return testOnBorrow;
|
||||
}
|
||||
|
||||
public void setTestOnBorrow(boolean testOnBorrow) {
|
||||
this.testOnBorrow = testOnBorrow;
|
||||
}
|
||||
|
||||
public boolean isTestOnReturn() {
|
||||
return testOnReturn;
|
||||
}
|
||||
|
||||
public void setTestOnReturn(boolean testOnReturn) {
|
||||
this.testOnReturn = testOnReturn;
|
||||
}
|
||||
|
||||
public boolean isPoolPreparedStatements() {
|
||||
return poolPreparedStatements;
|
||||
}
|
||||
|
||||
public void setPoolPreparedStatements(boolean poolPreparedStatements) {
|
||||
this.poolPreparedStatements = poolPreparedStatements;
|
||||
}
|
||||
|
||||
public int getMaxPoolPreparedStatementPerConnectionSize() {
|
||||
return maxPoolPreparedStatementPerConnectionSize;
|
||||
}
|
||||
|
||||
public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) {
|
||||
this.maxPoolPreparedStatementPerConnectionSize = maxPoolPreparedStatementPerConnectionSize;
|
||||
}
|
||||
|
||||
public String getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
public void setFilters(String filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
public String getConnectionProperties() {
|
||||
return connectionProperties;
|
||||
}
|
||||
|
||||
public void setConnectionProperties(String connectionProperties) {
|
||||
this.connectionProperties = connectionProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public DataSource dataSource() {
|
||||
DruidDataSource datasource = new DruidDataSource();
|
||||
datasource.setUrl(url);
|
||||
datasource.setUsername(username);
|
||||
datasource.setPassword(password);
|
||||
datasource.setDriverClassName(driverClassName);
|
||||
|
||||
datasource.setInitialSize(initialSize);
|
||||
datasource.setMinIdle(minIdle);
|
||||
datasource.setMaxActive(maxActive);
|
||||
datasource.setMaxWait(maxWait);
|
||||
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
|
||||
datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
|
||||
datasource.setValidationQuery(validationQuery);
|
||||
datasource.setTestWhileIdle(testWhileIdle);
|
||||
datasource.setTestOnBorrow(testOnBorrow);
|
||||
datasource.setTestOnReturn(testOnReturn);
|
||||
datasource.setPoolPreparedStatements(poolPreparedStatements);
|
||||
datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
|
||||
try {
|
||||
datasource.setFilters(filters);
|
||||
} catch (SQLException e) {
|
||||
log.error("异常", e);
|
||||
}
|
||||
datasource.setConnectionProperties(connectionProperties);
|
||||
return datasource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.bonus.boot.rear.manager.manager.config;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.view.RedirectView;
|
||||
|
||||
@Controller
|
||||
public class LoginPageConfig {
|
||||
|
||||
@RequestMapping("/")
|
||||
public RedirectView loginPage() {
|
||||
return new RedirectView("/login.html");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,272 @@
|
|||
package com.bonus.boot.rear.manager.manager.config;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.boot.rear.manager.manager.utils.DateTimeHelper;
|
||||
import com.bonus.boot.rear.manager.manager.utils.HttpRequestHelper;
|
||||
import com.bonus.boot.rear.manager.manager.utils.StringHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2023/7/21 9:03
|
||||
*/
|
||||
@Component
|
||||
public class OpenSendConfig {
|
||||
|
||||
@Resource
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
|
||||
// private static String userName = "ahmhckj01";
|
||||
// private static String passWord = "mhc888";
|
||||
// private static String clientId = "O000037092";
|
||||
// private static String appSecret = "F49EACCC95A15583163C4A13F90DDFEC";
|
||||
// private static String projectCode = "P00000016916";
|
||||
// private static String redirectUrl = "http://xxx.com/receive";
|
||||
// private static String codeUrl = "https://open.snd02.com/oauth/authverify2.as";
|
||||
// private static String accessToken = "https://open.snd02.com/oauth/token.as";
|
||||
// private static String routerUrl = "https://open.snd02.com/invoke/router.as";
|
||||
|
||||
private static String userName = "user2";
|
||||
private static String passWord = "abc123";
|
||||
private static String clientId = "O000000063";
|
||||
private static String appSecret = "A7EE9D9F907A6C596F0DA173305DDC44";
|
||||
private static String projectCode = "P00000000001";
|
||||
private static String redirectUrl = "http://xxx.com/receive";
|
||||
// private static String redirectUrl = "http://192.168.2.20:8080/rearService/dataInfo/giveAnAlarm";
|
||||
private static String codeUrl = "http://192.168.1.252:8080/ebx-rook/oauth/authverify2.as";
|
||||
private static String accessToken = "http://192.168.1.252:8080/ebx-rook/oauth/token.as";
|
||||
private static String routerUrl = "http://192.168.1.252:8080/ebx-rook/invoke/router.as";
|
||||
|
||||
|
||||
public String getCode(){
|
||||
Map pm = new HashMap();
|
||||
pm.put("response_type", "code");
|
||||
pm.put("client_id", clientId);
|
||||
pm.put("redirect_uri", redirectUrl);
|
||||
pm.put("uname", userName);
|
||||
pm.put("passwd", passWord);
|
||||
String resParams = JSONArray.toJSON(pm).toString();
|
||||
String result = HttpRequestHelper.doPost(codeUrl,resParams);
|
||||
System.err.println("getCode result="+result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
String success = jsonObject.getString("success");
|
||||
String code = "";
|
||||
if("true".equals(success)){
|
||||
code = jsonObject.getString("code");
|
||||
return getAccessToken(code);
|
||||
}else{
|
||||
System.err.println("getProjectInfo 获取code异常");
|
||||
return "-1";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getAccessToken(String code){
|
||||
String md5 = getMd5Plus(clientId+"authorization_code"+"http://xxx.com/receive"+code+appSecret);
|
||||
System.err.println("getAccessToken md5="+md5);
|
||||
Map pm = new HashMap();
|
||||
pm.put("client_id", clientId);
|
||||
pm.put("client_secret", md5);
|
||||
pm.put("grant_type", "authorization_code");
|
||||
pm.put("redirect_uri", redirectUrl);
|
||||
pm.put("code", code);
|
||||
String resParams = JSONArray.toJSON(pm).toString();
|
||||
String result = HttpRequestHelper.doPost(accessToken,resParams);
|
||||
System.err.println("getAccessToken result="+result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
String success = jsonObject.getString("success");
|
||||
if("true".equals(success)){
|
||||
String data = jsonObject.getString("data");
|
||||
JSONObject dataObject = JSONObject.parseObject(data);
|
||||
String expiresIn = dataObject.getString("expiresIn");
|
||||
String accessToken = dataObject.getString("accessToken");
|
||||
String refreshToken = dataObject.getString("refreshToken");
|
||||
redisTemplate.opsForValue().set("expiresIn", expiresIn,3600, TimeUnit.SECONDS);
|
||||
redisTemplate.opsForValue().set("accessToken", accessToken,3600,TimeUnit.SECONDS);
|
||||
redisTemplate.opsForValue().set("refreshToken", refreshToken,3600,TimeUnit.SECONDS);
|
||||
return accessToken;
|
||||
}else{
|
||||
System.err.println("getProjectInfo 获取getAccessToken异常");
|
||||
return "-2";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getRefreshToken(String accessToken){
|
||||
String md5 = getMd5Plus(clientId+"authorization_code"+"http://xxx.com/receive"+accessToken+appSecret);
|
||||
System.err.println("getRefreshToken md5="+md5);
|
||||
String refreshToken = redisTemplate.opsForValue().get("refreshToken");
|
||||
Map pm = new HashMap();
|
||||
pm.put("client_id", clientId);
|
||||
pm.put("client_secret", md5);
|
||||
pm.put("grant_type", "refresh_token");
|
||||
pm.put("redirect_uri", redirectUrl);
|
||||
pm.put("refresh_token", refreshToken);
|
||||
String resParams = JSONArray.toJSON(pm).toString();
|
||||
String result = HttpRequestHelper.doPost(accessToken,resParams);
|
||||
System.err.println("getRefreshToken result="+result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
String success = jsonObject.getString("success");
|
||||
if("true".equals(success)){
|
||||
String data = jsonObject.getString("data");
|
||||
JSONObject dataObject = JSONObject.parseObject(data);
|
||||
String expiresIn = dataObject.getString("expiresIn");
|
||||
String accessToken_2 = dataObject.getString("accessToken");
|
||||
String refreshToken_2 = dataObject.getString("refreshToken");
|
||||
redisTemplate.opsForValue().set("expiresIn", expiresIn,3600, TimeUnit.SECONDS);
|
||||
redisTemplate.opsForValue().set("accessToken", accessToken_2,3600,TimeUnit.SECONDS);
|
||||
redisTemplate.opsForValue().set("refreshToken", accessToken_2,3600,TimeUnit.SECONDS);
|
||||
return accessToken;
|
||||
}else{
|
||||
System.err.println("getRefreshToken 获取getAccessToken异常");
|
||||
return "-3";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getPost(String method,Map map,String timestamp,String signStr){
|
||||
String accessToken = redisTemplate.opsForValue().get("accessToken");
|
||||
System.err.println("getPost accessToken="+accessToken);
|
||||
if(StringHelper.isEmpty(accessToken)){
|
||||
accessToken = getCode();
|
||||
if("-1".equals(accessToken)){
|
||||
System.err.println("获取code失败");
|
||||
return "-1";
|
||||
}else if("-2".equals(accessToken)){
|
||||
System.err.println("获取accessToken失败");
|
||||
return "-2";
|
||||
}
|
||||
}
|
||||
map.put("client_id", clientId);
|
||||
map.put("method", method);
|
||||
map.put("access_token", accessToken);
|
||||
map.put("timestamp", timestamp);
|
||||
// map.put("projectCode", projectCode);
|
||||
String sign = MD5(signStr);
|
||||
map.put("sign",sign);
|
||||
System.err.println("getPost sign加密后="+sign);
|
||||
String resParams = JSONArray.toJSON(map).toString();
|
||||
System.err.println("getPost resParams="+resParams);
|
||||
String result = HttpRequestHelper.doPost(routerUrl,resParams);
|
||||
System.err.println("getPost result="+result);
|
||||
//getRefreshToken(accessToken);
|
||||
return result;
|
||||
}
|
||||
static char[] hc = "0123456789abcdef".toCharArray();
|
||||
public static String MD5(String param) {
|
||||
MessageDigest md = null;
|
||||
try {
|
||||
md = MessageDigest.getInstance("MD5");
|
||||
md.reset();
|
||||
md.update(param.getBytes("utf-8"));
|
||||
byte[] d = md.digest();
|
||||
StringBuilder r = new StringBuilder(d.length * 2);
|
||||
for (byte b : d) {
|
||||
r.append(hc[(b >> 4) & 0xF]);
|
||||
r.append(hc[(b & 0xF)]);
|
||||
}
|
||||
return r.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
public static String getMd5Plus(String pwd){
|
||||
String md1 = DigestUtils.md5DigestAsHex(pwd.getBytes());
|
||||
return md1;
|
||||
}
|
||||
|
||||
|
||||
public static String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public static void setUserName(String userName) {
|
||||
OpenSendConfig.userName = userName;
|
||||
}
|
||||
|
||||
public static String getPassWord() {
|
||||
return passWord;
|
||||
}
|
||||
|
||||
public static void setPassWord(String passWord) {
|
||||
OpenSendConfig.passWord = passWord;
|
||||
}
|
||||
|
||||
public static String getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public static void setClientId(String clientId) {
|
||||
OpenSendConfig.clientId = clientId;
|
||||
}
|
||||
|
||||
public static String getAppSecret() {
|
||||
return appSecret;
|
||||
}
|
||||
|
||||
public static void setAppSecret(String appSecret) {
|
||||
OpenSendConfig.appSecret = appSecret;
|
||||
}
|
||||
|
||||
public static String getProjectCode() {
|
||||
return projectCode;
|
||||
}
|
||||
|
||||
public static void setProjectCode(String projectCode) {
|
||||
OpenSendConfig.projectCode = projectCode;
|
||||
}
|
||||
|
||||
public static String getRedirectUrl() {
|
||||
return redirectUrl;
|
||||
}
|
||||
|
||||
public static void setRedirectUrl(String redirectUrl) {
|
||||
OpenSendConfig.redirectUrl = redirectUrl;
|
||||
}
|
||||
|
||||
public static String getCodeUrl() {
|
||||
return codeUrl;
|
||||
}
|
||||
|
||||
public static void setCodeUrl(String codeUrl) {
|
||||
OpenSendConfig.codeUrl = codeUrl;
|
||||
}
|
||||
|
||||
public static String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public static void setAccessToken(String accessToken) {
|
||||
OpenSendConfig.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public static String getRouterUrl() {
|
||||
return routerUrl;
|
||||
}
|
||||
|
||||
public static void setRouterUrl(String routerUrl) {
|
||||
OpenSendConfig.routerUrl = routerUrl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.bonus.boot.rear.manager.manager.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.GenericToStringSerializer;
|
||||
|
||||
/**
|
||||
* redis配置<br>
|
||||
* 集群下启动session共享,需打开@EnableRedisHttpSession<br>
|
||||
* 单机下不需要
|
||||
*/
|
||||
//@EnableRedisHttpSession
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Bean("redisTemplate")
|
||||
public RedisTemplate redisTemplate(@Lazy RedisConnectionFactory connectionFactory) {
|
||||
RedisTemplate redis = new RedisTemplate();
|
||||
GenericToStringSerializer<String> keySerializer = new GenericToStringSerializer<String>(String.class);
|
||||
redis.setKeySerializer(keySerializer);
|
||||
redis.setHashKeySerializer(keySerializer);
|
||||
GenericJackson2JsonRedisSerializer valueSerializer = new GenericJackson2JsonRedisSerializer();
|
||||
redis.setValueSerializer(valueSerializer);
|
||||
redis.setHashValueSerializer(valueSerializer);
|
||||
redis.setConnectionFactory(connectionFactory);
|
||||
|
||||
return redis;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
package com.bonus.boot.rear.manager.manager.config;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.service.TokenService;
|
||||
import com.bonus.boot.rear.manager.manager.entity.LoginUser;
|
||||
import com.bonus.boot.rear.manager.manager.entity.ResponseInfo;
|
||||
import com.bonus.boot.rear.manager.manager.entity.Token;
|
||||
import com.bonus.boot.rear.manager.manager.filter.TokenFilter;
|
||||
import com.bonus.boot.rear.manager.manager.utils.ResponseUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
|
||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
||||
|
||||
/**
|
||||
* spring security处理器
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class SecurityHandlerConfig {
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 登陆成功,返回Token
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public AuthenticationSuccessHandler loginSuccessHandler() {
|
||||
return new AuthenticationSuccessHandler() {
|
||||
|
||||
@Override
|
||||
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
|
||||
Authentication authentication) throws IOException, ServletException {
|
||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||
|
||||
Token token = tokenService.saveToken(loginUser);
|
||||
ResponseUtil.responseJson(response, HttpStatus.OK.value(), token);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 登陆失败
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public AuthenticationFailureHandler loginFailureHandler() {
|
||||
return new AuthenticationFailureHandler() {
|
||||
|
||||
@Override
|
||||
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException exception) throws IOException, ServletException {
|
||||
String msg = null;
|
||||
if (exception instanceof BadCredentialsException) {
|
||||
msg = "密码错误";
|
||||
} else {
|
||||
msg = exception.getMessage();
|
||||
}
|
||||
ResponseInfo info = new ResponseInfo(HttpStatus.UNAUTHORIZED.value() + "", msg);
|
||||
ResponseUtil.responseJson(response, HttpStatus.UNAUTHORIZED.value(), info);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 未登录,返回401
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public AuthenticationEntryPoint authenticationEntryPoint() {
|
||||
return new AuthenticationEntryPoint() {
|
||||
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException authException) throws IOException, ServletException {
|
||||
ResponseInfo info = new ResponseInfo(HttpStatus.UNAUTHORIZED.value() + "", "请先登录");
|
||||
ResponseUtil.responseJson(response, HttpStatus.UNAUTHORIZED.value(), info);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出处理
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public LogoutSuccessHandler logoutSussHandler() {
|
||||
return new LogoutSuccessHandler() {
|
||||
|
||||
@Override
|
||||
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response,
|
||||
Authentication authentication) throws IOException, ServletException {
|
||||
ResponseInfo info = new ResponseInfo(HttpStatus.OK.value() + "", "退出成功");
|
||||
|
||||
String token = TokenFilter.getToken(request);
|
||||
tokenService.deleteToken(token);
|
||||
|
||||
ResponseUtil.responseJson(response, HttpStatus.OK.value(), info);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.bonus.boot.rear.manager.manager.config;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.filter.TokenFilter;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* swagger文档
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Bean
|
||||
public Docket docket() {
|
||||
ParameterBuilder builder = new ParameterBuilder();
|
||||
builder.parameterType("header").name(TokenFilter.TOKEN_KEY)
|
||||
.description("header参数")
|
||||
.required(false)
|
||||
.modelRef(new ModelRef("string")); // 在swagger里显示header
|
||||
|
||||
return new Docket(DocumentationType.SWAGGER_2).groupName("swagger接口文档")
|
||||
.apiInfo(new ApiInfoBuilder().title("swagger接口文档")
|
||||
.contact(new Contact("1", "", "1@163.com")).version("1.0").build())
|
||||
.globalOperationParameters(Lists.newArrayList(builder.build()))
|
||||
.select().paths(PathSelectors.any()).build();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.bonus.boot.rear.manager.manager.config;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableArgumentResolver;
|
||||
|
||||
@Configuration
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
* 跨域支持
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public WebMvcConfigurer corsConfigurer() {
|
||||
return new WebMvcConfigurer() {
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**").allowedMethods("*");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* datatable分页解析
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public PageTableArgumentResolver tableHandlerMethodArgumentResolver() {
|
||||
return new PageTableArgumentResolver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||
argumentResolvers.add(tableHandlerMethodArgumentResolver());
|
||||
}
|
||||
|
||||
/**
|
||||
* 外部文件访问
|
||||
*/
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
// registry.addResourceHandler("/statics/**")
|
||||
// .addResourceLocations(ResourceUtils.FILE_URL_PREFIX + filesPath + File.separator);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.bonus.boot.rear.manager.manager.controller;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.dao.DictDao;
|
||||
import com.bonus.boot.rear.manager.manager.entity.Dict;
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableHandler;
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableRequest;
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dicts")
|
||||
public class DictController {
|
||||
|
||||
@Autowired
|
||||
private DictDao dictDao;
|
||||
|
||||
@PreAuthorize("hasAuthority('dict:add')")
|
||||
@PostMapping
|
||||
@ApiOperation(value = "保存")
|
||||
public Dict save(@RequestBody Dict dict) {
|
||||
Dict d = dictDao.getByTypeAndK(dict.getType(), dict.getK());
|
||||
if (d != null) {
|
||||
throw new IllegalArgumentException("类型和key已存在");
|
||||
}
|
||||
dictDao.save(dict);
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "根据id获取")
|
||||
public Dict get(@PathVariable Long id) {
|
||||
return dictDao.getById(id);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('dict:add')")
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改")
|
||||
public Dict update(@RequestBody Dict dict) {
|
||||
dictDao.update(dict);
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('dict:query')")
|
||||
@GetMapping(params = { "start", "length" })
|
||||
@ApiOperation(value = "列表")
|
||||
public PageTableResponse list(PageTableRequest request) {
|
||||
return new PageTableHandler(new PageTableHandler.CountHandler() {
|
||||
|
||||
@Override
|
||||
public int count(PageTableRequest request) {
|
||||
return dictDao.count(request.getParams());
|
||||
}
|
||||
}, new PageTableHandler.ListHandler() {
|
||||
|
||||
@Override
|
||||
public List<Dict> list(PageTableRequest request) {
|
||||
return dictDao.list(request.getParams(), request.getOffset(), request.getLimit());
|
||||
}
|
||||
}).handle(request);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('dict:del')")
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除")
|
||||
public void delete(@PathVariable Long id) {
|
||||
dictDao.delete(id);
|
||||
}
|
||||
|
||||
@GetMapping(params = "type")
|
||||
public List<Dict> listByType(String type) {
|
||||
return dictDao.listByType(type);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,220 @@
|
|||
package com.bonus.boot.rear.manager.manager.controller;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.boot.rear.manager.manager.dao.PermissionDao;
|
||||
import com.bonus.boot.rear.manager.manager.entity.LoginUser;
|
||||
import com.bonus.boot.rear.manager.manager.model.Permission;
|
||||
import com.bonus.boot.rear.manager.manager.service.PermissionService;
|
||||
import com.bonus.boot.rear.manager.manager.utils.UserUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 权限相关接口
|
||||
*/
|
||||
@Api(tags = "权限")
|
||||
@RestController
|
||||
@RequestMapping("/permissions")
|
||||
public class PermissionController {
|
||||
|
||||
@Autowired
|
||||
private PermissionDao permissionDao;
|
||||
@Autowired
|
||||
private PermissionService permissionService;
|
||||
|
||||
@ApiOperation(value = "当前登录用户拥有的权限")
|
||||
@GetMapping("/current")
|
||||
public List<Permission> permissionsCurrent() {
|
||||
LoginUser loginUser = UserUtil.getLoginUser();
|
||||
List<Permission> list = loginUser.getPermissions();
|
||||
final List<Permission> permissions = list.stream().filter(l -> l.getType().equals(1))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// setChild(permissions);
|
||||
//
|
||||
// return permissions.stream().filter(p -> p.getParentId().equals(0L)).collect(Collectors.toList());
|
||||
// 2018.06.09 支持多级菜单
|
||||
List<Permission> firstLevel = permissions.stream().filter(p -> p.getParentId().equals(0L)).collect(Collectors.toList());
|
||||
firstLevel.parallelStream().forEach(p -> {
|
||||
setChild(p, permissions);
|
||||
});
|
||||
|
||||
return firstLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置子元素
|
||||
* 2018.06.09
|
||||
*
|
||||
* @param p
|
||||
* @param permissions
|
||||
*/
|
||||
private void setChild(Permission p, List<Permission> permissions) {
|
||||
List<Permission> child = permissions.parallelStream().filter(a -> a.getParentId().equals(p.getId())).collect(Collectors.toList());
|
||||
p.setChild(child);
|
||||
if (!CollectionUtils.isEmpty(child)) {
|
||||
child.parallelStream().forEach(c -> {
|
||||
//递归设置子元素,多级菜单支持
|
||||
setChild(c, permissions);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// private void setChild(List<Permission> permissions) {
|
||||
// permissions.parallelStream().forEach(per -> {
|
||||
// List<Permission> child = permissions.stream().filter(p -> p.getParentId().equals(per.getId()))
|
||||
// .collect(Collectors.toList());
|
||||
// per.setChild(child);
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* 菜单列表
|
||||
*
|
||||
* @param pId
|
||||
* @param permissionsAll
|
||||
* @param list
|
||||
*/
|
||||
private void setPermissionsList(Long pId, List<Permission> permissionsAll, List<Permission> list) {
|
||||
for (Permission per : permissionsAll) {
|
||||
if (per.getParentId().equals(pId)) {
|
||||
list.add(per);
|
||||
if (permissionsAll.stream().filter(p -> p.getParentId().equals(per.getId())).findAny() != null) {
|
||||
setPermissionsList(per.getId(), permissionsAll, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "菜单列表")
|
||||
@PreAuthorize("hasAuthority('sys:menu:query')")
|
||||
public List<Permission> permissionsList() {
|
||||
List<Permission> permissionsAll = permissionDao.listAll();
|
||||
|
||||
List<Permission> list = Lists.newArrayList();
|
||||
setPermissionsList(0L, permissionsAll, list);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
@ApiOperation(value = "所有菜单")
|
||||
@PreAuthorize("hasAuthority('sys:menu:query')")
|
||||
public JSONArray permissionsAll() {
|
||||
List<Permission> permissionsAll = permissionDao.listAll();
|
||||
JSONArray array = new JSONArray();
|
||||
setPermissionsTree(0L, permissionsAll, array);
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
@GetMapping("/parents")
|
||||
@ApiOperation(value = "一级菜单")
|
||||
@PreAuthorize("hasAuthority('sys:menu:query')")
|
||||
public List<Permission> parentMenu() {
|
||||
List<Permission> parents = permissionDao.listParents();
|
||||
|
||||
return parents;
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单树
|
||||
*
|
||||
* @param pId
|
||||
* @param permissionsAll
|
||||
* @param array
|
||||
*/
|
||||
private void setPermissionsTree(Long pId, List<Permission> permissionsAll, JSONArray array) {
|
||||
for (Permission per : permissionsAll) {
|
||||
if (per.getParentId().equals(pId)) {
|
||||
String string = JSONObject.toJSONString(per);
|
||||
JSONObject parent = (JSONObject) JSONObject.parse(string);
|
||||
array.add(parent);
|
||||
|
||||
if (permissionsAll.stream().filter(p -> p.getParentId().equals(per.getId())).findAny() != null) {
|
||||
JSONArray child = new JSONArray();
|
||||
parent.put("child", child);
|
||||
setPermissionsTree(per.getId(), permissionsAll, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping(params = "roleId")
|
||||
@ApiOperation(value = "根据角色id获取权限")
|
||||
@PreAuthorize("hasAnyAuthority('sys:menu:query','sys:role:query')")
|
||||
public List<Permission> listByRoleId(Long roleId) {
|
||||
return permissionDao.listByRoleId(roleId);
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping
|
||||
@ApiOperation(value = "保存菜单")
|
||||
@PreAuthorize("hasAuthority('sys:menu:add')")
|
||||
public void save(@RequestBody Permission permission) {
|
||||
permissionDao.save(permission);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "根据菜单id获取菜单")
|
||||
@PreAuthorize("hasAuthority('sys:menu:query')")
|
||||
public Permission get(@PathVariable Long id) {
|
||||
return permissionDao.getById(id);
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改菜单")
|
||||
@PreAuthorize("hasAuthority('sys:menu:add')")
|
||||
public void update(@RequestBody Permission permission) {
|
||||
permissionService.update(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验权限
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/owns")
|
||||
@ApiOperation(value = "校验当前用户的权限")
|
||||
public Set<String> ownsPermission() {
|
||||
List<Permission> permissions = UserUtil.getLoginUser().getPermissions();
|
||||
if (CollectionUtils.isEmpty(permissions)) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
return permissions.parallelStream().filter(p -> !StringUtils.isEmpty(p.getPermission()))
|
||||
.map(Permission::getPermission).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除菜单")
|
||||
@PreAuthorize("hasAuthority('sys:menu:del')")
|
||||
public void delete(@PathVariable Long id) {
|
||||
permissionService.delete(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
package com.bonus.boot.rear.manager.manager.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.dao.RoleDao;
|
||||
import com.bonus.boot.rear.manager.manager.entity.RoleDto;
|
||||
import com.bonus.boot.rear.manager.manager.model.Role;
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableHandler;
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableRequest;
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableResponse;
|
||||
import com.bonus.boot.rear.manager.manager.service.RoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
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;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 角色相关接口
|
||||
*
|
||||
* @author 小威老师 xiaoweijiagou@163.com
|
||||
*
|
||||
*/
|
||||
@Api(tags = "角色")
|
||||
@RestController
|
||||
@RequestMapping("/roles")
|
||||
public class RoleController {
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private RoleDao roleDao;
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping
|
||||
@ApiOperation(value = "保存角色")
|
||||
@PreAuthorize("hasAuthority('sys:role:add')")
|
||||
public void saveRole(@RequestBody RoleDto roleDto) {
|
||||
roleService.saveRole(roleDto);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "角色列表")
|
||||
@PreAuthorize("hasAuthority('sys:role:query')")
|
||||
public PageTableResponse listRoles(PageTableRequest request) {
|
||||
return new PageTableHandler(new PageTableHandler.CountHandler() {
|
||||
|
||||
@Override
|
||||
public int count(PageTableRequest request) {
|
||||
return roleDao.count(request.getParams());
|
||||
}
|
||||
}, new PageTableHandler.ListHandler() {
|
||||
|
||||
@Override
|
||||
public List<Role> list(PageTableRequest request) {
|
||||
List<Role> list = roleDao.list(request.getParams(), request.getOffset(), request.getLimit());
|
||||
return list;
|
||||
}
|
||||
}).handle(request);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "根据id获取角色")
|
||||
@PreAuthorize("hasAuthority('sys:role:query')")
|
||||
public Role get(@PathVariable Long id) {
|
||||
return roleDao.getById(id);
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
@ApiOperation(value = "所有角色")
|
||||
@PreAuthorize("hasAnyAuthority('sys:user:query','sys:role:query')")
|
||||
public List<Role> roles() {
|
||||
return roleDao.list(Maps.newHashMap(), null, null);
|
||||
}
|
||||
|
||||
@GetMapping("/alls")
|
||||
@ApiOperation(value = "所有角色")
|
||||
@PreAuthorize("hasAnyAuthority('sys:user:query','sys:role:query')")
|
||||
public List<Role> role() {
|
||||
return roleDao.lists(Maps.newHashMap(), null, null);
|
||||
}
|
||||
|
||||
@GetMapping(params = "userId")
|
||||
@ApiOperation(value = "根据用户id获取拥有的角色")
|
||||
@PreAuthorize("hasAnyAuthority('sys:user:query','sys:role:query')")
|
||||
public List<Role> roles(Long userId) {
|
||||
return roleDao.listByUserId(userId);
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除角色")
|
||||
@PreAuthorize("hasAuthority('sys:role:del')")
|
||||
public void delete(@PathVariable Long id) {
|
||||
roleService.deleteRole(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.bonus.boot.rear.manager.manager.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.dao.SysLogsDao;
|
||||
import com.bonus.boot.rear.manager.manager.model.SysLogs;
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableHandler;
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableRequest;
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableResponse;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@Api(tags = "日志")
|
||||
@RestController
|
||||
@RequestMapping("/logs")
|
||||
public class SysLogsController {
|
||||
|
||||
@Autowired
|
||||
private SysLogsDao sysLogsDao;
|
||||
|
||||
@GetMapping
|
||||
@PreAuthorize("hasAuthority('sys:log:query')")
|
||||
@ApiOperation(value = "日志列表")
|
||||
public PageTableResponse list(PageTableRequest request) {
|
||||
return new PageTableHandler(new PageTableHandler.CountHandler() {
|
||||
|
||||
@Override
|
||||
public int count(PageTableRequest request) {
|
||||
return sysLogsDao.count(request.getParams());
|
||||
}
|
||||
}, new PageTableHandler.ListHandler() {
|
||||
|
||||
@Override
|
||||
public List<SysLogs> list(PageTableRequest request) {
|
||||
return sysLogsDao.list(request.getParams(), request.getOffset(), request.getLimit());
|
||||
}
|
||||
}).handle(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
package com.bonus.boot.rear.manager.manager.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.dao.UserDao;
|
||||
import com.bonus.boot.rear.manager.manager.entity.UserDto;
|
||||
import com.bonus.boot.rear.manager.manager.model.SysUser;
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableHandler;
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableRequest;
|
||||
import com.bonus.boot.rear.manager.manager.table.PageTableResponse;
|
||||
import com.bonus.boot.rear.manager.manager.service.UserService;
|
||||
import com.bonus.boot.rear.manager.manager.utils.UserUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.annotation.LogAnnotation;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 用户相关接口
|
||||
*/
|
||||
@Api(tags = "用户")
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/users")
|
||||
public class UserController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("adminLogger");
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private UserDao userDao;
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping
|
||||
@ApiOperation(value = "保存用户")
|
||||
@PreAuthorize("hasAuthority('sys:user:add')")
|
||||
public SysUser saveUser(@RequestBody UserDto userDto) {
|
||||
SysUser u = userService.getUser(userDto.getUsername());
|
||||
if (u != null) {
|
||||
throw new IllegalArgumentException(userDto.getUsername() + "已存在");
|
||||
}
|
||||
|
||||
return userService.saveUser(userDto);
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改用户")
|
||||
@PreAuthorize("hasAuthority('sys:user:add')")
|
||||
public SysUser updateUser(@RequestBody UserDto userDto) {
|
||||
return userService.updateUser(userDto);
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PutMapping(params = "headImgUrl")
|
||||
@ApiOperation(value = "修改头像")
|
||||
public void updateHeadImgUrl(String headImgUrl) {
|
||||
SysUser user = UserUtil.getLoginUser();
|
||||
UserDto userDto = new UserDto();
|
||||
BeanUtils.copyProperties(user, userDto);
|
||||
userDto.setHeadImgUrl(headImgUrl);
|
||||
|
||||
userService.updateUser(userDto);
|
||||
log.debug("{}修改了头像", user.getUsername());
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PutMapping("/{username}")
|
||||
@ApiOperation(value = "修改密码")
|
||||
@PreAuthorize("hasAuthority('sys:user:password')")
|
||||
public void changePassword(@PathVariable String username, String oldPassword, String newPassword) {
|
||||
userService.changePassword(username, oldPassword, newPassword);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "用户列表")
|
||||
@PreAuthorize("hasAuthority('sys:user:query')")
|
||||
public PageTableResponse listUsers(PageTableRequest request) {
|
||||
return new PageTableHandler(new PageTableHandler.CountHandler() {
|
||||
|
||||
@Override
|
||||
public int count(PageTableRequest request) {
|
||||
return userDao.count(request.getParams());
|
||||
}
|
||||
}, new PageTableHandler.ListHandler() {
|
||||
|
||||
@Override
|
||||
public List<SysUser> list(PageTableRequest request) {
|
||||
List<SysUser> list = userDao.list(request.getParams(), request.getOffset(), request.getLimit());
|
||||
return list;
|
||||
}
|
||||
}).handle(request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "当前登录用户")
|
||||
@GetMapping("/current")
|
||||
public SysUser currentUser(Long id) {
|
||||
return userDao.getLoginUser(id);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据用户id获取用户")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("hasAuthority('sys:user:query')")
|
||||
public SysUser user(@PathVariable Long id) {
|
||||
return userDao.getById(id);
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除用户")
|
||||
@PreAuthorize("hasAuthority('sys:role:del')")
|
||||
public void delete(@PathVariable Long id) {
|
||||
userService.deleteUser(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.bonus.boot.rear.manager.manager.controller;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import com.bonus.boot.rear.manager.manager.entity.ImgResult;
|
||||
import com.bonus.boot.rear.manager.manager.utils.UserUtil;
|
||||
import com.bonus.boot.rear.manager.manager.utils.VerifyCodeUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/getCode")
|
||||
public class VCodeController {
|
||||
|
||||
// 登录验证码过期时间:单位 分钟
|
||||
@Value("${loginCode.expiration}")
|
||||
private Long expiration;
|
||||
|
||||
@Value("${loginCode.prefix}")
|
||||
private String prefix;
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* 获取验证码
|
||||
*/
|
||||
@GetMapping("/vCode")
|
||||
@ResponseBody
|
||||
public ImgResult getCode() throws IOException {
|
||||
// 生成随机字串
|
||||
String verifyCode = VerifyCodeUtils.generateVerifyCode(4);
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
// 存入redis
|
||||
redisTemplate.opsForValue().set(prefix + uuid,verifyCode, expiration, TimeUnit.MINUTES);
|
||||
// 生成图片
|
||||
int w = 111, h = 36;
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
VerifyCodeUtils.outputImage(w, h, stream, verifyCode);
|
||||
try {
|
||||
return new ImgResult(Base64.encode(stream.toByteArray()),uuid);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} finally {
|
||||
stream.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.bonus.boot.rear.manager.manager.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.bonus.boot.rear.manager.manager.entity.Dict;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
@Mapper
|
||||
public interface DictDao {
|
||||
|
||||
@Select("select * from t_dict t where t.id = #{id}")
|
||||
Dict getById(Long id);
|
||||
|
||||
@Delete("delete from t_dict where id = #{id}")
|
||||
int delete(Long id);
|
||||
|
||||
int update(Dict dict);
|
||||
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||
@Insert("insert into t_dict(type, k, val, createTime, updateTime) values(#{type}, #{k}, #{val}, now(), now())")
|
||||
int save(Dict dict);
|
||||
|
||||
int count(@Param("params") Map<String, Object> params);
|
||||
|
||||
List<Dict> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
@Select("select * from t_dict t where t.type = #{type} and k = #{k}")
|
||||
Dict getByTypeAndK(@Param("type") String type, @Param("k") String k);
|
||||
|
||||
@Select("select * from t_dict t where t.type = #{type}")
|
||||
List<Dict> listByType(String type);
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.bonus.boot.rear.manager.manager.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.model.Permission;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
@Mapper
|
||||
public interface PermissionDao {
|
||||
|
||||
@Select("select * from sys_permission t order by t.sort")
|
||||
List<Permission> listAll();
|
||||
|
||||
@Select("select * from sys_permission t where t.type = 1 order by t.sort")
|
||||
List<Permission> listParents();
|
||||
|
||||
@Select("select distinct p.* from sys_permission p inner join sys_role_permission rp on p.id = rp.permissionId inner join sys_role_user ru on ru.roleId = rp.roleId where ru.userId = #{userId} order by p.sort")
|
||||
List<Permission> listByUserId(Long userId);
|
||||
|
||||
@Select("select p.* from sys_permission p inner join sys_role_permission rp on p.id = rp.permissionId where rp.roleId = #{roleId} order by p.sort")
|
||||
List<Permission> listByRoleId(Long roleId);
|
||||
|
||||
@Select("select * from sys_permission t where t.id = #{id}")
|
||||
Permission getById(Long id);
|
||||
|
||||
@Insert("insert into sys_permission(parentId, name, css, href, type, permission, sort) values(#{parentId}, #{name}, #{css}, #{href}, #{type}, #{permission}, #{sort})")
|
||||
int save(Permission permission);
|
||||
|
||||
@Update("update sys_permission t set parentId = #{parentId}, name = #{name}, css = #{css}, href = #{href}, type = #{type}, permission = #{permission}, sort = #{sort} where t.id = #{id}")
|
||||
int update(Permission permission);
|
||||
|
||||
@Delete("delete from sys_permission where id = #{id}")
|
||||
int delete(Long id);
|
||||
|
||||
@Delete("delete from sys_permission where parentId = #{id}")
|
||||
int deleteByParentId(Long id);
|
||||
|
||||
@Delete("delete from sys_role_permission where permissionId = #{permissionId}")
|
||||
int deleteRolePermission(Long permissionId);
|
||||
|
||||
@Select("select ru.userId from sys_role_permission rp inner join sys_role_user ru on ru.roleId = rp.roleId where rp.permissionId = #{permissionId}")
|
||||
Set<Long> listUserIds(Long permissionId);
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.bonus.boot.rear.manager.manager.dao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.model.Role;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
@Mapper
|
||||
public interface RoleDao {
|
||||
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||
@Insert("insert into sys_role(name, description, createTime, updateTime, is_active) values(#{name}, #{description}, now(),now(),#{status})")
|
||||
int save(Role role);
|
||||
|
||||
int count(@Param("params") Map<String, Object> params);
|
||||
|
||||
List<Role> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
@Select("select t.id,t.name as name,t.description , t.is_active as status from sys_role t where t.id = #{id}")
|
||||
Role getById(Long id);
|
||||
|
||||
@Select("select * from sys_role t where t.name = #{name}")
|
||||
Role getRole(String name);
|
||||
|
||||
@Update("update sys_role t set t.name = #{name}, t.description = #{description},t.is_active = #{status}, updateTime = now() where t.id = #{id}")
|
||||
int update(Role role);
|
||||
|
||||
@Select("select * from sys_role r inner join sys_role_user ru on r.id = ru.roleId where ru.userId = #{userId}")
|
||||
List<Role> listByUserId(Long userId);
|
||||
|
||||
@Delete("delete from sys_role_permission where roleId = #{roleId}")
|
||||
int deleteRolePermission(Long roleId);
|
||||
|
||||
int saveRolePermission(@Param("roleId") Long roleId, @Param("permissionIds") List<Long> permissionIds);
|
||||
|
||||
@Delete("delete from sys_role where id = #{id}")
|
||||
int delete(Long id);
|
||||
|
||||
@Delete("delete from sys_role_user where roleId = #{roleId}")
|
||||
int deleteRoleUser(Long roleId);
|
||||
|
||||
List<Role> lists(@Param("params") Map<String, Object> params, @Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
@Delete("delete from sys_role_user where roleId = #{roleId}")
|
||||
int deleteRoleldUser(Long roleId);
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.boot.rear.manager.manager.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.model.SysLogs;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface SysLogsDao {
|
||||
|
||||
@Insert("insert into sys_logs(userId, module, flag, remark, createTime) values(#{user.id}, #{module}, #{flag}, #{remark}, now())")
|
||||
int save(SysLogs sysLogs);
|
||||
|
||||
int count(@Param("params") Map<String, Object> params);
|
||||
|
||||
List<SysLogs> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
@Delete("delete from sys_logs where createTime <= #{time}")
|
||||
int deleteLogs(String time);
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.boot.rear.manager.manager.dao;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.model.TokenModel;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
@Mapper
|
||||
public interface TokenDao {
|
||||
|
||||
@Insert("insert into t_token(id, val, expireTime, createTime, updateTime) values (#{id}, #{val}, #{expireTime}, #{createTime}, #{updateTime})")
|
||||
int save(TokenModel model);
|
||||
|
||||
@Select("select * from t_token t where t.id = #{id}")
|
||||
TokenModel getById(String id);
|
||||
|
||||
@Update("update t_token t set t.val = #{val}, t.expireTime = #{expireTime}, t.updateTime = #{updateTime} where t.id = #{id}")
|
||||
int update(TokenModel model);
|
||||
|
||||
@Delete("delete from t_token where id = #{id}")
|
||||
int delete(String id);
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.bonus.boot.rear.manager.manager.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.bonus.boot.rear.manager.manager.model.SysUser;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
@Mapper
|
||||
public interface UserDao {
|
||||
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||
@Insert("insert into sys_user(username, password, nickname, headImgUrl, phone, telephone, email, birthday, sex, status, createTime, updateTime) values(#{username}, #{password}, #{nickname}, #{headImgUrl}, #{phone}, #{telephone}, #{email}, #{birthday}, #{sex}, #{status}, now(), now())")
|
||||
int save(SysUser user);
|
||||
|
||||
@Select("select * from sys_user t where t.id = #{id}")
|
||||
SysUser getById(Long id);
|
||||
|
||||
@Select("select * from sys_user t where t.username = #{username}")
|
||||
SysUser getUser(String username);
|
||||
|
||||
@Update("update sys_user t set t.password = #{password} where t.id = #{id}")
|
||||
int changePassword(@Param("id") Long id, @Param("password") String password);
|
||||
|
||||
Integer count(@Param("params") Map<String, Object> params);
|
||||
|
||||
List<SysUser> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
@Delete("delete from sys_role_user where userId = #{userId}")
|
||||
int deleteUserRole(Long userId);
|
||||
|
||||
int saveUserRoles(@Param("userId") Long userId, @Param("roleIds") List<Long> roleIds);
|
||||
|
||||
int update(SysUser user);
|
||||
|
||||
@Delete("delete from sys_user where id = #{id}")
|
||||
int delete(Long id);
|
||||
|
||||
@Select("select t.username from sys_user t where t.id = #{id}")
|
||||
SysUser getLoginUser(Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.bonus.boot.rear.manager.manager.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class BeanField implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4279960350136806659L;
|
||||
|
||||
private String columnName;
|
||||
|
||||
private String columnType;
|
||||
|
||||
private String columnComment;
|
||||
|
||||
private String columnDefault;
|
||||
|
||||
private String name;
|
||||
|
||||
private String type;
|
||||
|
||||
public String getColumnName() {
|
||||
return columnName;
|
||||
}
|
||||
|
||||
public void setColumnName(String columnName) {
|
||||
this.columnName = columnName;
|
||||
}
|
||||
|
||||
public String getColumnType() {
|
||||
return columnType;
|
||||
}
|
||||
|
||||
public void setColumnType(String columnType) {
|
||||
this.columnType = columnType;
|
||||
}
|
||||
|
||||
public String getColumnComment() {
|
||||
return columnComment;
|
||||
}
|
||||
|
||||
public void setColumnComment(String columnComment) {
|
||||
this.columnComment = columnComment;
|
||||
}
|
||||
|
||||
public String getColumnDefault() {
|
||||
return columnDefault;
|
||||
}
|
||||
|
||||
public void setColumnDefault(String columnDefault) {
|
||||
this.columnDefault = columnDefault;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue