Commit bf1fcec5 authored by 军师中郎将's avatar 军师中郎将

【基础项目】【init】first commit

parents

Too many changes to show.

To preserve performance only 1000 of ${real_size} files are displayed.

## 内置功能
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。
8. 通知公告:系统通知公告信息发布维护。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
10. 登录日志:系统登录日志记录查询包含登录异常。
11. 在线用户:当前系统中活跃用户状态监控。
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。
14. 系统接口:根据业务代码自动生成相关的api接口文档。
15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。
16. 缓存监控:对系统的缓存信息查询,命令统计等。
17. 在线构建器:拖动表单元素生成相应的HTML代码。
18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。
\ No newline at end of file
This diff is collapsed.
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>zehong</artifactId>
<groupId>com.zehong</groupId>
<version>3.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>zh-baseversion-admin</artifactId>
<description>
web服务入口
</description>
<dependencies>
<!-- spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency>
<!-- swagger3-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
</dependency>
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>com.zehong</groupId>
<artifactId>zh-baseversion-framework</artifactId>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.zehong</groupId>
<artifactId>zh-baseversion-quartz</artifactId>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.zehong</groupId>
<artifactId>zh-baseversion-generator</artifactId>
</dependency>
<!--海康-->
<dependency>
<groupId>com.hikvision.ga</groupId>
<artifactId>artemis-http-client</artifactId>
<version>1.1.3</version>
</dependency>
</dependencies>
<build>
<finalName>gassafetyprogress-${project.version}</finalName>
<plugins>
<!--<plugin>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-maven-plugin</artifactId>-->
<!--<version>2.1.3.RELEASE</version>-->
<!--<executions>-->
<!--<execution>-->
<!--<goals>-->
<!--<goal>repackage</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
<!--</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<excludes>
<!--<exclude>*</exclude>-->
<!--<exclude>*.sh</exclude>-->
<!--<exclude>*.bat</exclude>-->
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/gassafetyprogress-${project.version}/lib
</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-config</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.build.directory}/gassafetyprogress-${project.version}/conf</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.yml</include>
<include>**/logback.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-sh</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.build.directory}/gassafetyprogress-${project.version}/bin</outputDirectory>
<resources>
<resource>
<directory>src/main/bin</directory>
<includes>
<include>*.sh</include>
<include>*.bat</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-dist-jar</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.build.directory}/gassafetyprogress-${project.version}/lib</outputDirectory>
<resources>
<resource>
<directory>target</directory>
<includes>
<include>*.jar</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
#!/bin/bash
cd `dirname $0`
cd ..
DEPLOY_DIR=`pwd`
CONF_DIR=$DEPLOY_DIR/conf
LOGS_DIR=$DEPLOY_DIR/logs
#部署需修改
APP_MAINCLASS=com.zehong.GassafetyProgressApplication
PIDS=`ps -ef | grep -v grep | grep "$CONF_DIR" |awk '{print $2}'`
if [ -n "$PIDS" ]; then
echo "ERROR: already started!"
echo "PID: $PIDS"
exit 1
fi
if [ ! -d $LOGS_DIR ]; then
mkdir $LOGS_DIR
fi
STDOUT_FILE=$LOGS_DIR/stdout.log
CLOG_FILE=$LOGS_DIR/gc.logli
#SYS_FILE=$LOGS_DIR/communication.log
LIB_DIR=$DEPLOY_DIR/lib
LIB_JARS=`ls $LIB_DIR|grep .jar|awk '{print "'$LIB_DIR'/"$0}'| xargs | sed "s/ /:/g"`
JAVA_OPTS=" -Djava.awt.headless=true"
JAVA_DEBUG_OPTS=""
if [ "$1" = "debug" ]; then
JAVA_DEBUG_OPTS=" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n "
fi
JAVA_JMX_OPTS=""
if [ "$1" = "jmx" ]; then
JAVA_JMX_OPTS=" -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
fi
JAVA_MEM_OPTS="-server -Xms2048M -Xmx2048M -Xmn1024M"
#JAVA_MEM_OPTS="-server -Xms5120M -Xmx5120M -Xmn1024M -Xnoclassgc -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=80 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+PrintClassHistogram -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -Xloggc:$CLOG_FILE"
echo -e "Starting the GassafetyProgressApplication ...\c"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DEPLOY_DIR/libs/linux_64
nohup java -Dlog.path=$LOGS_DIR -Dapp.home=$DEPLOY_DIR $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS -classpath $CONF_DIR:$LIB_JARS $APP_MAINCLASS >/dev/null 2>&1 &
sleep 1
echo "started"
PIDS=`ps -ef | grep java | grep "$DEPLOY_DIR" | awk '{print $2}'`
echo "PID: $PIDS"
#!/bin/bash
cd `dirname $0`
BIN_DIR=`pwd`
cd ..
DEPLOY_DIR=`pwd`
LOGS_DIR=$DEPLOY_DIR/logs
if [ ! -d $LOGS_DIR ]; then
mkdir $LOGS_DIR
fi
STDOUT_FILE=$LOGS_DIR/stdout.log
PID=`ps -ef | grep -v grep | grep "$DEPLOY_DIR/conf" | awk '{print $2}'`
echo "PID: $PID"
if [ -z "$PID" ]; then
echo "ERROR: The Application does not started!"
exit 1
fi
echo -e "Stopping the Application ...\c"
kill $PID > $STDOUT_FILE 2>&1
COUNT=0
while [ $COUNT -lt 1 ]; do
echo -e ".\c"
sleep 1
COUNT=1
PID_EXIST=`ps -f -p $PID | grep java`
if [ -n "$PID_EXIST" ]; then
COUNT=0
fi
done
echo "stopped"
echo "PID: $PID"
package com.zehong;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/**
* 启动程序
*
* @author zehong
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class GassafetyProgressApplication
{
public static void main(String[] args)
{
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(GassafetyProgressApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 泽宏启动成功");
}
}
package com.zehong;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* web容器中进行部署
*
* @author zehong
*/
public class GassafetyProgressServletInitializer extends SpringBootServletInitializer
{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
{
return application.sources(GassafetyProgressApplication.class);
}
}
package com.zehong.web.codeconfig;
import java.util.Random;
public class CodeConFig {
//生成四位随机数
public static String RandomCode(){
//生成一个6位随机数
String radom = String.valueOf(new Random().nextInt(999999));
String substring = radom.substring(0,4);
return substring;
}
}
package com.zehong.web.controller.api;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
/**
* HttpClient发送GET、POST请求
* @Author libin
* @CreateDate 2018.5.28 16:56
*/
public class HttpClient {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpClient.class);
/**
* 返回成功状态码
*/
private static final int SUCCESS_CODE = 200;
/**
* 发送GET请求
* @param url 请求url
* @param nameValuePairList 请求参数
* @return JSON或者字符串
* @throws Exception
*/
public static Object sendGet(String url, List<NameValuePair> nameValuePairList) throws Exception{
JSONObject jsonObject = null;
CloseableHttpClient client = null;
CloseableHttpResponse response = null;
try{
/**
* 创建HttpClient对象
*/
client = HttpClients.createDefault();
/**
* 创建URIBuilder
*/
URIBuilder uriBuilder = new URIBuilder(url);
/**
* 设置参数
*/
uriBuilder.addParameters(nameValuePairList);
/**
* 创建HttpGet
*/
HttpGet httpGet = new HttpGet(uriBuilder.build());
/**
* 设置请求头部编码
*/
httpGet.setHeader(new BasicHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"));
/**
* 设置返回编码
*/
httpGet.setHeader(new BasicHeader("Accept", "text/plain;charset=utf-8"));
/**
* 请求服务
*/
response = client.execute(httpGet);
/**
* 获取响应吗
*/
int statusCode = response.getStatusLine().getStatusCode();
if (SUCCESS_CODE == statusCode){
/**
* 获取返回对象
*/
HttpEntity entity = response.getEntity();
/**
* 通过EntityUitls获取返回内容
*/
String result = EntityUtils.toString(entity,"UTF-8");
/**
* 转换成json,根据合法性返回json或者字符串
*/
try{
jsonObject = JSONObject.parseObject(result);
return jsonObject;
}catch (Exception e){
return result;
}
}else{
LOGGER.error("HttpClientService-line: {}, errorMsg{}", 97, "GET请求失败!");
}
}catch (Exception e){
LOGGER.error("HttpClientService-line: {}, Exception: {}", 100, e);
} finally {
response.close();
client.close();
}
return null;
}
/**
* 发送POST请求
* @param url
* @param nameValuePairList
* @return JSON或者字符串
* @throws Exception
*/
public static <JSONObject> Object sendPost(String url, List<NameValuePair> nameValuePairList) throws Exception{
JSONObject jsonObject = null;
CloseableHttpClient client = null;
CloseableHttpResponse response = null;
try{
/**
* 创建一个httpclient对象
*/
client = HttpClients.createDefault();
/**
* 创建一个post对象
*/
HttpPost post = new HttpPost(url);
/**
* 包装成一个Entity对象
*/
StringEntity entity = new UrlEncodedFormEntity(nameValuePairList, "UTF-8");
/**
* 设置请求的内容
*/
post.setEntity(entity);
/**
* 设置请求的报文头部的编码
*/
post.setHeader(new BasicHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"));
/**
* 设置请求的报文头部的编码
*/
post.setHeader(new BasicHeader("Accept", "text/plain;charset=utf-8"));
/**
* 执行post请求
*/
response = client.execute(post);
/**
* 获取响应码
*/
int statusCode = response.getStatusLine().getStatusCode();
if (SUCCESS_CODE == statusCode){
/**
* 通过EntityUitls获取返回内容
*/
String result = EntityUtils.toString(response.getEntity(),"UTF-8");
/**
* 转换成json,根据合法性返回json或者字符串
*/
try{
jsonObject = (JSONObject) com.alibaba.fastjson.JSONObject.parseObject(result);
return jsonObject;
}catch (Exception e){
return result;
}
}else{
LOGGER.error("HttpClientService-line: {}, errorMsg:{}", 146, "POST请求失败!");
}
}catch (Exception e){
LOGGER.error("HttpClientService-line: {}, Exception:{}", 149, e);
}finally {
response.close();
client.close();
}
return null;
}
/**
* 组织请求参数{参数名和参数值下标保持一致}
* @param params 参数名数组
* @param values 参数值数组
* @return 参数对象
*/
public static List<NameValuePair> getParams(Object[] params, Object[] values){
/**
* 校验参数合法性
*/
boolean flag = params.length>0 && values.length>0 && params.length == values.length;
if (flag){
List<NameValuePair> nameValuePairList = new ArrayList<>();
for(int i =0; i<params.length; i++){
nameValuePairList.add(new BasicNameValuePair(params[i].toString(),values[i].toString()));
}
return nameValuePairList;
}else{
LOGGER.error("HttpClientService-line: {}, errorMsg:{}", 197, "请求参数为空且参数长度不一致");
}
return null;
}
public static Object doPostData(String url, String json,String header) throws Exception {
JSONObject jsonObject = null;
DefaultHttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
String result = "";
HttpResponse res = null;
try {
StringEntity s = new StringEntity(json.toString(), "UTF-8");
s.setContentType("application/json");
post.setHeader("Accept", "application/json");
post.setHeader("Content-type", "application/json; charset=utf-8");
post.setHeader("enterpriseCode", header);
post.setEntity(s);
res = client.execute(post);
if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
result = EntityUtils.toString(res.getEntity());
jsonObject = JSONObject.parseObject(result);
return jsonObject;
// return HttpStatus.SC_OK + "";
}
} catch (Exception e) {
if(res == null) {
return "HttpResponse 为 null!";
}
throw new RuntimeException(e);
}
if(res == null || res.getStatusLine() == null) {
return "无响应";
}
return res.getStatusLine() + "";
}
public static String doPost(String url, String map, String charset) {
org.apache.http.client.HttpClient httpClient = null;
HttpPost httpPost = null;
String result = null;
try {
httpClient = new SSLClient();
httpPost = new HttpPost(url);
//设置参数
httpPost.addHeader("Accept", "application/json");
httpPost.addHeader("Content-Type", "application/json;charset=UTF-8");
StringEntity stringEntity = new StringEntity(map);
stringEntity.setContentEncoding("UTF-8");
stringEntity.setContentType("application/json");
httpPost.setEntity(stringEntity);
HttpResponse response = httpClient.execute(httpPost);
if (response != null) {
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
result = EntityUtils.toString(resEntity, charset);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
}
package com.zehong.web.controller.api;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;
import java.lang.annotation.Annotation;
import java.util.Map;
@Service
public class ManageSpringBeans implements ApplicationContextAware {
private static ApplicationContext context;
public static <T> T getBean(final Class<T> requiredType) {
return context.getBean(requiredType);
}
public static <T> T getBean(final String beanName) {
@SuppressWarnings("unchecked") final T bean = (T) context.getBean(beanName);
return bean;
}
public static <T> Map<String, T> getBeans(final Class<T> requiredType) {
return context.getBeansOfType(requiredType);
}
public static Map<String, Object> getBeansWithAnnotation(final Class<? extends Annotation> annotationType) {
return context.getBeansWithAnnotation(annotationType);
}
@Override
public void setApplicationContext(final ApplicationContext applicationContext) {
context = applicationContext;
}
}
package com.zehong.web.controller.api;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
public class SSLClient extends DefaultHttpClient {
public SSLClient() throws Exception {
super();
//传输协议需要根据自己的判断
SSLContext ctx = SSLContext.getInstance("TLS");
X509TrustManager tm = new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain,
String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] chain,
String authType) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
};
ctx.init(null, new TrustManager[]{tm}, null);
SSLSocketFactory ssf = new SSLSocketFactory(ctx, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
ClientConnectionManager ccm = this.getConnectionManager();
SchemeRegistry sr = ccm.getSchemeRegistry();
sr.register(new Scheme("https", 443, ssf));
}
}
package com.zehong.web.controller.api;
public class test {
public static void main(String[] args) throws Exception {
RsaToClient rsaToClient=new RsaToClient();
}
}
package com.zehong.web.controller.common;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.google.code.kaptcha.Producer;
import com.zehong.common.constant.Constants;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.redis.RedisCache;
import com.zehong.common.utils.sign.Base64;
import com.zehong.common.utils.uuid.IdUtils;
/**
* 验证码操作处理
*
* @author zehong
*/
@RestController
public class CaptchaController
{
@Resource(name = "captchaProducer")
private Producer captchaProducer;
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache;
// 验证码类型
@Value("${zehong.captchaType}")
private String captchaType;
/**
* 生成验证码
*/
@GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException
{
// 保存验证码信息
String uuid = IdUtils.simpleUUID();
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
String capStr = null, code = null;
BufferedImage image = null;
// 生成验证码
if ("math".equals(captchaType))
{
String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1);
image = captchaProducerMath.createImage(capStr);
}
else if ("char".equals(captchaType))
{
capStr = code = captchaProducer.createText();
image = captchaProducer.createImage(capStr);
}
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try
{
ImageIO.write(image, "jpg", os);
}
catch (IOException e)
{
return AjaxResult.error(e.getMessage());
}
AjaxResult ajax = AjaxResult.success();
ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray()));
return ajax;
}
}
package com.zehong.web.controller.common;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.zehong.common.config.GassafetyProgressConfig;
import com.zehong.common.constant.Constants;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.utils.StringUtils;
import com.zehong.common.utils.file.FileUploadUtils;
import com.zehong.common.utils.file.FileUtils;
import com.zehong.framework.config.ServerConfig;
/**
* 通用请求处理
*
* @author zehong
*/
@RestController
public class CommonController
{
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Autowired
private ServerConfig serverConfig;
/**
* 通用下载请求
*
* @param fileName 文件名称
* @param delete 是否删除
*/
@GetMapping("common/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
{
try
{
if (!FileUtils.checkAllowDownload(fileName))
{
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
}
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
String filePath = GassafetyProgressConfig.getDownloadPath() + fileName;
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete)
{
FileUtils.deleteFile(filePath);
}
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
/**
* 通用上传请求
*/
@PostMapping("/common/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = GassafetyProgressConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = file.getOriginalFilename();
//本地存储地址
// String fileName=filePath+FileUploadUtils.upload(filePath, file);
String fileServer = serverConfig.getUrl();
if(fileServer.contains("frrq.zhkjgf.com")){
fileServer = serverConfig.getUrl().replace("http://frrq.zhkjgf.com","https://frrq.zhkjgf.com:8908");
}
String url = fileServer + FileUploadUtils.upload(filePath, file);
AjaxResult ajax = AjaxResult.success();
// ajax.put("fileName", fileName);
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
* 本地资源通用下载
*/
@GetMapping("/common/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception
{
try
{
if (!FileUtils.checkAllowDownload(resource))
{
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
}
// 本地资源路径
String localPath = GassafetyProgressConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
}
package com.zehong.web.controller.common;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TSupervise;
import com.zehong.system.service.ITSuperviseService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 监督检查Controller
*
* @author zehong
* @date 2024-02-04
*/
@RestController
@RequestMapping("/system/supervise")
public class TSuperviseController extends BaseController
{
@Autowired
private ITSuperviseService tSuperviseService;
/**
* 查询监督检查列表
*/
//@PreAuthorize("@ss.hasPermi('system:supervise:list')")
@GetMapping("/list")
public TableDataInfo list(TSupervise tSupervise)
{
startPage();
List<TSupervise> list = tSuperviseService.selectTSuperviseList(tSupervise);
return getDataTable(list);
}
/**
* 导出监督检查列表
*/
//@PreAuthorize("@ss.hasPermi('system:supervise:export')")
@Log(title = "监督检查", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TSupervise tSupervise)
{
List<TSupervise> list = tSuperviseService.selectTSuperviseList(tSupervise);
ExcelUtil<TSupervise> util = new ExcelUtil<TSupervise>(TSupervise.class);
return util.exportExcel(list, "监督检查数据");
}
/**
* 获取监督检查详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:supervise:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tSuperviseService.selectTSuperviseById(id));
}
/**
* 新增监督检查
*/
//@PreAuthorize("@ss.hasPermi('system:supervise:add')")
@Log(title = "监督检查", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TSupervise tSupervise)
{
return toAjax(tSuperviseService.insertTSupervise(tSupervise));
}
/**
* 修改监督检查
*/
//@PreAuthorize("@ss.hasPermi('system:supervise:edit')")
@Log(title = "监督检查", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TSupervise tSupervise)
{
return toAjax(tSuperviseService.updateTSupervise(tSupervise));
}
/**
* 删除监督检查
*/
//@PreAuthorize("@ss.hasPermi('system:supervise:remove')")
@Log(title = "监督检查", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tSuperviseService.deleteTSuperviseByIds(ids));
}
}
package com.zehong.web.controller.complainDeal;
import java.util.Date;
import java.util.List;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.framework.web.service.TokenService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TComplainDeal;
import com.zehong.system.service.ITComplainDealService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
import javax.servlet.http.HttpServletRequest;
/**
* 投诉处置Controller
*
* @author zehong
* @date 2022-02-15
*/
@RestController
@RequestMapping("/complainDeal")
public class TComplainDealController extends BaseController
{
@Autowired
private ITComplainDealService tComplainDealService;
@Autowired
private TokenService tokenService;
/**
* 查询投诉处置列表
*/
//@PreAuthorize("@ss.hasPermi('complainDeal:complainDeal:list')")
@GetMapping("/list")
public TableDataInfo list(TComplainDeal tComplainDeal, HttpServletRequest request)
{
LoginUser loginUser = tokenService.getLoginUser(request);
if(loginUser.getUser().getDeptId()!=-2){
tComplainDeal.setComplainAssignEnterproseId(loginUser.getUser().getDeptId());
}
startPage();
List<TComplainDeal> list = tComplainDealService.selectTComplainDealList(tComplainDeal);
return getDataTable(list);
}
/**
* 导出投诉处置列表
*/
@PreAuthorize("@ss.hasPermi('complainDeal:complainDeal:export')")
@Log(title = "投诉处置", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TComplainDeal tComplainDeal)
{
List<TComplainDeal> list = tComplainDealService.selectTComplainDealList(tComplainDeal);
ExcelUtil<TComplainDeal> util = new ExcelUtil<TComplainDeal>(TComplainDeal.class);
return util.exportExcel(list, "投诉处置数据");
}
/**
* 获取投诉处置详细信息
*/
@PreAuthorize("@ss.hasPermi('complainDeal:complainDeal:query')")
@GetMapping(value = "/{complainDealId}")
public AjaxResult getInfo(@PathVariable("complainDealId") Long complainDealId)
{
return AjaxResult.success(tComplainDealService.selectTComplainDealById(complainDealId));
}
/**
* 新增投诉处置
*/
@PreAuthorize("@ss.hasPermi('complainDeal:complainDeal:add')")
@Log(title = "投诉处置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TComplainDeal tComplainDeal)
{
return toAjax(tComplainDealService.insertTComplainDeal(tComplainDeal));
}
/**
* 修改投诉处置
*/
@PreAuthorize("@ss.hasPermi('complainDeal:complainDeal:edit')")
@Log(title = "投诉处置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TComplainDeal tComplainDeal)
{
if(tComplainDeal.getComplainStatus().equals("2")){
tComplainDeal.setDealTime(new Date());
}
return toAjax(tComplainDealService.updateTComplainDeal(tComplainDeal));
}
/**
* 删除投诉处置
*/
@PreAuthorize("@ss.hasPermi('complainDeal:complainDeal:remove')")
@Log(title = "投诉处置", businessType = BusinessType.DELETE)
@DeleteMapping("/{complainDealIds}")
public AjaxResult remove(@PathVariable Long[] complainDealIds)
{
return toAjax(tComplainDealService.deleteTComplainDealByIds(complainDealIds));
}
@GetMapping("/getuserList/{enterproseId}")
public AjaxResult selectUserByenterproseId(@PathVariable("enterproseId") String enterproseId)
{
return AjaxResult.success(tComplainDealService.selectUserByenterproseId(enterproseId));
}
}
package com.zehong.web.controller.message;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TMessageDetailInfo;
import com.zehong.system.service.ITMessageDetailInfoService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 消息详情Controller
*
* @author zehong
* @date 2023-09-14
*/
@RestController
@RequestMapping("/message/detail")
public class TMessageDetailInfoController extends BaseController
{
@Autowired
private ITMessageDetailInfoService tMessageDetailInfoService;
/**
* 查询消息详情列表
*/
//@PreAuthorize("@ss.hasPermi('message:detail:list')")
@GetMapping("/list")
public TableDataInfo list(TMessageDetailInfo tMessageDetailInfo)
{
startPage();
List<TMessageDetailInfo> list = tMessageDetailInfoService.selectTMessageDetailInfoList(tMessageDetailInfo);
return getDataTable(list);
}
/**
* 导出消息详情列表
*/
//@PreAuthorize("@ss.hasPermi('message:detail:export')")
@Log(title = "消息详情", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TMessageDetailInfo tMessageDetailInfo)
{
List<TMessageDetailInfo> list = tMessageDetailInfoService.selectTMessageDetailInfoList(tMessageDetailInfo);
ExcelUtil<TMessageDetailInfo> util = new ExcelUtil<TMessageDetailInfo>(TMessageDetailInfo.class);
return util.exportExcel(list, "消息详情数据");
}
/**
* 获取消息详情详细信息
*/
//@PreAuthorize("@ss.hasPermi('message:detail:query')")
@GetMapping(value = "/{messageDetailId}")
public AjaxResult getInfo(@PathVariable("messageDetailId") Long messageDetailId)
{
return AjaxResult.success(tMessageDetailInfoService.selectTMessageDetailInfoById(messageDetailId));
}
/**
* 新增消息详情
*/
//@PreAuthorize("@ss.hasPermi('message:detail:add')")
@Log(title = "消息详情", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TMessageDetailInfo tMessageDetailInfo)
{
return toAjax(tMessageDetailInfoService.insertTMessageDetailInfo(tMessageDetailInfo));
}
/**
* 修改消息详情
*/
//@PreAuthorize("@ss.hasPermi('message:detail:edit')")
@Log(title = "消息详情", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TMessageDetailInfo tMessageDetailInfo)
{
return toAjax(tMessageDetailInfoService.updateTMessageDetailInfo(tMessageDetailInfo));
}
/**
* 删除消息详情
*/
//@PreAuthorize("@ss.hasPermi('message:detail:remove')")
@Log(title = "消息详情", businessType = BusinessType.DELETE)
@DeleteMapping("/{messageDetailIds}")
public AjaxResult remove(@PathVariable Long[] messageDetailIds)
{
return toAjax(tMessageDetailInfoService.deleteTMessageDetailInfoByIds(messageDetailIds));
}
}
package com.zehong.web.controller.message;
import java.util.List;
import com.zehong.system.domain.TMessageDetailInfo;
import com.zehong.system.service.ITMessageDetailInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TMessageInfo;
import com.zehong.system.service.ITMessageInfoService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 消息Controller
*
* @author zehong
* @date 2023-09-14
*/
@RestController
@RequestMapping("/message/info")
public class TMessageInfoController extends BaseController
{
@Autowired
private ITMessageInfoService tMessageInfoService;
@Autowired
private ITMessageDetailInfoService itMessageDetailInfoService;
/**
* 查询消息列表
*/
//@PreAuthorize("@ss.hasPermi('message:info:list')")
@GetMapping("/list")
public TableDataInfo list(TMessageInfo tMessageInfo)
{
startPage();
List<TMessageInfo> list = tMessageInfoService.selectTMessageInfoList(tMessageInfo);
for(TMessageInfo messageInfo : list){
TMessageDetailInfo detailInfo = new TMessageDetailInfo();
detailInfo.setMessageId(messageInfo.getMessageId());
List<TMessageDetailInfo> detailInfoList = itMessageDetailInfoService.selectTMessageDetailInfoList(detailInfo);
messageInfo.setMessageDetailInfoList(detailInfoList);
}
return getDataTable(list);
}
/**
* 小程序通知消息
* @param tMessageInfo
* @return
*/
@GetMapping("/applist")
public TableDataInfo applist(TMessageInfo tMessageInfo)
{
startPage();
List<TMessageInfo> list = tMessageInfoService.selectTMessageInfoListapp(tMessageInfo);
return getDataTable(list);
}
/**
* 导出消息列表
*/
//@PreAuthorize("@ss.hasPermi('message:info:export')")
@Log(title = "消息", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TMessageInfo tMessageInfo)
{
List<TMessageInfo> list = tMessageInfoService.selectTMessageInfoList(tMessageInfo);
ExcelUtil<TMessageInfo> util = new ExcelUtil<TMessageInfo>(TMessageInfo.class);
return util.exportExcel(list, "消息数据");
}
/**
* 获取消息详细信息
*/
//@PreAuthorize("@ss.hasPermi('message:info:query')")
@GetMapping(value = "/{messageId}")
public AjaxResult getInfo(@PathVariable("messageId") Long messageId)
{
TMessageInfo messageInfo = tMessageInfoService.selectTMessageInfoById(messageId);
TMessageDetailInfo detailInfo = new TMessageDetailInfo();
detailInfo.setMessageId(messageInfo.getMessageId());
List<TMessageDetailInfo> detailInfoList = itMessageDetailInfoService.selectTMessageDetailInfoList(detailInfo);
messageInfo.setMessageDetailInfoList(detailInfoList);
return AjaxResult.success(messageInfo);
}
/**
* 新增消息
*/
//@PreAuthorize("@ss.hasPermi('message:info:add')")
@Log(title = "消息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TMessageInfo tMessageInfo)
{
return toAjax(tMessageInfoService.insertTMessageInfo(tMessageInfo));
}
/**
* 修改消息
*/
//@PreAuthorize("@ss.hasPermi('message:info:edit')")
@Log(title = "消息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TMessageInfo tMessageInfo)
{
return toAjax(tMessageInfoService.updateTMessageInfo(tMessageInfo));
}
/**
* 删除消息
*/
//@PreAuthorize("@ss.hasPermi('message:info:remove')")
@Log(title = "消息", businessType = BusinessType.DELETE)
@DeleteMapping("/{messageIds}")
public AjaxResult remove(@PathVariable Long[] messageIds)
{
return toAjax(tMessageInfoService.deleteTMessageInfoByIds(messageIds));
}
}
package com.zehong.web.controller.monitor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
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 com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.utils.StringUtils;
/**
* 缓存监控
*
* @author zehong
*/
@RestController
@RequestMapping("/monitor/cache")
public class CacheController
{
@Autowired
private RedisTemplate<String, String> redisTemplate;
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception
{
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
Map<String, Object> result = new HashMap<>(3);
result.put("info", info);
result.put("dbSize", dbSize);
List<Map<String, String>> pieList = new ArrayList<>();
commandStats.stringPropertyNames().forEach(key -> {
Map<String, String> data = new HashMap<>(2);
String property = commandStats.getProperty(key);
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
pieList.add(data);
});
result.put("commandStats", pieList);
return AjaxResult.success(result);
}
}
package com.zehong.web.controller.monitor;
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 com.zehong.common.core.domain.AjaxResult;
import com.zehong.framework.web.domain.Server;
/**
* 服务器监控
*
* @author zehong
*/
@RestController
@RequestMapping("/monitor/server")
public class ServerController
{
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception
{
Server server = new Server();
server.copyTo();
return AjaxResult.success(server);
}
}
package com.zehong.web.controller.monitor;
import java.util.List;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.SysLogininfor;
import com.zehong.system.service.ISysLogininforService;
/**
* 系统访问记录
*
* @author zehong
*/
@RestController
@RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController
{
@Autowired
private ISysLogininforService logininforService;
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
@GetMapping("/list")
public TableDataInfo list(SysLogininfor logininfor)
{
startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
}
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
@GetMapping("/export")
public AjaxResult export(SysLogininfor logininfor)
{
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
return util.exportExcel(list, "登录日志");
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}")
public AjaxResult remove(@PathVariable Long[] infoIds)
{
return toAjax(logininforService.deleteLogininforByIds(infoIds));
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean")
public AjaxResult clean()
{
logininforService.cleanLogininfor();
return AjaxResult.success();
}
}
package com.zehong.web.controller.monitor;
import java.util.List;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.SysOperLog;
import com.zehong.system.service.ISysOperLogService;
/**
* 操作日志记录
*
* @author zehong
*/
@RestController
@RequestMapping("/monitor/operlog")
public class SysOperlogController extends BaseController
{
@Autowired
private ISysOperLogService operLogService;
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
@GetMapping("/list")
public TableDataInfo list(SysOperLog operLog)
{
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
}
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
@GetMapping("/export")
public AjaxResult export(SysOperLog operLog)
{
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
return util.exportExcel(list, "操作日志");
}
@Log(title = "操作日志", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/{operIds}")
public AjaxResult remove(@PathVariable Long[] operIds)
{
return toAjax(operLogService.deleteOperLogByIds(operIds));
}
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/clean")
public AjaxResult clean()
{
operLogService.cleanOperLog();
return AjaxResult.success();
}
}
package com.zehong.web.controller.monitor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.constant.Constants;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.core.redis.RedisCache;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.SysUserOnline;
import com.zehong.system.service.ISysUserOnlineService;
/**
* 在线用户监控
*
* @author zehong
*/
@RestController
@RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController
{
@Autowired
private ISysUserOnlineService userOnlineService;
@Autowired
private RedisCache redisCache;
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName)
{
Collection<String> keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys)
{
LoginUser user = redisCache.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
{
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
{
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
}
}
else if (StringUtils.isNotEmpty(ipaddr))
{
if (StringUtils.equals(ipaddr, user.getIpaddr()))
{
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
}
}
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
{
if (StringUtils.equals(userName, user.getUsername()))
{
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
}
}
else
{
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
}
}
Collections.reverse(userOnlineList);
userOnlineList.removeAll(Collections.singleton(null));
return getDataTable(userOnlineList);
}
/**
* 强退用户
*/
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId)
{
redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
return AjaxResult.success();
}
}
package com.zehong.web.controller.operationMonitor;
import java.util.List;
import com.zehong.system.domain.form.TDetectorReportDataQueryForm;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TDetectorReportData;
import com.zehong.system.service.ITDetectorReportDataService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 燃气用户设备上报的数据Controller
*
* @author zehong
* @date 2022-03-04
*/
@RestController
@RequestMapping("/detector/detectorReportData")
public class TDetectorReportDataController extends BaseController
{
@Autowired
private ITDetectorReportDataService tDetectorReportDataService;
/**
* 查询燃气用户设备上报的数据列表
*/
@PreAuthorize("@ss.hasPermi('detector:detectorReportData:list')")
@GetMapping("/list")
public TableDataInfo list(TDetectorReportDataQueryForm tDetectorReportDataQueryForm)
{
startPage();
List<TDetectorReportData> list = tDetectorReportDataService.selectTDetectorReportDataList(tDetectorReportDataQueryForm);
return getDataTable(list);
}
/**
* 导出燃气用户设备上报的数据列表
*/
@PreAuthorize("@ss.hasPermi('detector:detectorReportData:export')")
@Log(title = "燃气用户设备上报的数据", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TDetectorReportDataQueryForm tDetectorReportDataQueryForm)
{
List<TDetectorReportData> list = tDetectorReportDataService.selectTDetectorReportDataList(tDetectorReportDataQueryForm);
ExcelUtil<TDetectorReportData> util = new ExcelUtil<TDetectorReportData>(TDetectorReportData.class);
return util.exportExcel(list, "燃气用户设备上报的数据数据");
}
/**
* 获取燃气用户设备上报的数据详细信息
*/
@PreAuthorize("@ss.hasPermi('detector:detectorReportData:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tDetectorReportDataService.selectTDetectorReportDataById(id));
}
/**
* 新增燃气用户设备上报的数据
*/
@PreAuthorize("@ss.hasPermi('detector:detectorReportData:add')")
@Log(title = "燃气用户设备上报的数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TDetectorReportData tDetectorReportData)
{
return toAjax(tDetectorReportDataService.insertTDetectorReportData(tDetectorReportData));
}
/**
* 修改燃气用户设备上报的数据
*/
@PreAuthorize("@ss.hasPermi('detector:detectorReportData:edit')")
@Log(title = "燃气用户设备上报的数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TDetectorReportData tDetectorReportData)
{
return toAjax(tDetectorReportDataService.updateTDetectorReportData(tDetectorReportData));
}
/**
* 删除燃气用户设备上报的数据
*/
@PreAuthorize("@ss.hasPermi('detector:detectorReportData:remove')")
@Log(title = "燃气用户设备上报的数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tDetectorReportDataService.deleteTDetectorReportDataByIds(ids));
}
}
package com.zehong.web.controller.operationMonitor;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TDeviceReportData;
import com.zehong.system.service.ITDeviceReportDataService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 设备监控Controller
*
* @author zehong
* @date 2022-02-16
*/
@RestController
@RequestMapping("/system/data")
public class TDeviceReportDataController extends BaseController
{
@Autowired
private ITDeviceReportDataService tDeviceReportDataService;
/**
* 查询设备监控列表
*/
@PreAuthorize("@ss.hasPermi('system:data:list')")
@GetMapping("/list")
public TableDataInfo list(TDeviceReportData tDeviceReportData)
{
startPage();
List<TDeviceReportData> list = tDeviceReportDataService.selectTDeviceReportDataList(tDeviceReportData);
return getDataTable(list);
}
/**
* 导出设备监控列表
*/
@PreAuthorize("@ss.hasPermi('system:data:export')")
@Log(title = "设备监控", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TDeviceReportData tDeviceReportData)
{
List<TDeviceReportData> list = tDeviceReportDataService.selectTDeviceReportDataList(tDeviceReportData);
ExcelUtil<TDeviceReportData> util = new ExcelUtil<TDeviceReportData>(TDeviceReportData.class);
return util.exportExcel(list, "设备监控数据");
}
/**
* 获取设备监控详细信息
*/
@PreAuthorize("@ss.hasPermi('system:data:query')")
@GetMapping(value = "/{deviceReportDataId}")
public AjaxResult getInfo(@PathVariable("deviceReportDataId") Long deviceReportDataId)
{
return AjaxResult.success(tDeviceReportDataService.selectTDeviceReportDataById(deviceReportDataId));
}
/**
* 新增设备监控
*/
@PreAuthorize("@ss.hasPermi('system:data:add')")
@Log(title = "设备监控", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TDeviceReportData tDeviceReportData)
{
return toAjax(tDeviceReportDataService.insertTDeviceReportData(tDeviceReportData));
}
/**
* 修改设备监控
*/
@PreAuthorize("@ss.hasPermi('system:data:edit')")
@Log(title = "设备监控", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TDeviceReportData tDeviceReportData)
{
return toAjax(tDeviceReportDataService.updateTDeviceReportData(tDeviceReportData));
}
/**
* 删除设备监控
*/
@PreAuthorize("@ss.hasPermi('system:data:remove')")
@Log(title = "设备监控", businessType = BusinessType.DELETE)
@DeleteMapping("/{deviceReportDataIds}")
public AjaxResult remove(@PathVariable Long[] deviceReportDataIds)
{
return toAjax(tDeviceReportDataService.deleteTDeviceReportDataByIds(deviceReportDataIds));
}
}
package com.zehong.web.controller.operationMonitor;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.THiddenTroubleInfo;
import com.zehong.system.service.ITHiddenTroubleInfoService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 燃气隐患Controller
*
* @author zehong
* @date 2022-03-24
*/
@RestController
@RequestMapping("/system/hidden")
public class THiddenTroubleInfoController extends BaseController
{
@Autowired
private ITHiddenTroubleInfoService tHiddenTroubleInfoService;
/**
* 查询燃气隐患列表
*/
@PreAuthorize("@ss.hasPermi('system:hidden:list')")
@GetMapping("/list")
public TableDataInfo list(THiddenTroubleInfo tHiddenTroubleInfo)
{
startPage();
List<THiddenTroubleInfo> list = tHiddenTroubleInfoService.selectTHiddenTroubleInfoList(tHiddenTroubleInfo);
return getDataTable(list);
}
@GetMapping("/hiddenTroubleList")
public AjaxResult hiddenTroubleList(THiddenTroubleInfo tHiddenTroubleInfo){
return AjaxResult.success(tHiddenTroubleInfoService.selectTHiddenTroubleInfoList(tHiddenTroubleInfo));
}
/**
* 导出燃气隐患列表
*/
@PreAuthorize("@ss.hasPermi('system:hidden:export')")
@Log(title = "燃气隐患", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(THiddenTroubleInfo tHiddenTroubleInfo)
{
List<THiddenTroubleInfo> list = tHiddenTroubleInfoService.selectTHiddenTroubleInfoList(tHiddenTroubleInfo);
ExcelUtil<THiddenTroubleInfo> util = new ExcelUtil<THiddenTroubleInfo>(THiddenTroubleInfo.class);
return util.exportExcel(list, "燃气隐患数据");
}
/**
* 获取燃气隐患详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:hidden:query')")
@GetMapping(value = "/{hiddenTroubleId}")
public AjaxResult getInfo(@PathVariable("hiddenTroubleId") Long hiddenTroubleId)
{
return AjaxResult.success(tHiddenTroubleInfoService.selectTHiddenTroubleInfoById(hiddenTroubleId));
}
/**
* 新增燃气隐患
*/
@PreAuthorize("@ss.hasPermi('system:hidden:add')")
@Log(title = "燃气隐患", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody THiddenTroubleInfo tHiddenTroubleInfo)
{
return toAjax(tHiddenTroubleInfoService.insertTHiddenTroubleInfo(tHiddenTroubleInfo));
}
/**
* 修改燃气隐患
*/
@PreAuthorize("@ss.hasPermi('system:hidden:edit')")
@Log(title = "燃气隐患", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody THiddenTroubleInfo tHiddenTroubleInfo)
{
return toAjax(tHiddenTroubleInfoService.updateTHiddenTroubleInfo(tHiddenTroubleInfo));
}
/**
* 删除燃气隐患
*/
@PreAuthorize("@ss.hasPermi('system:hidden:remove')")
@Log(title = "燃气隐患", businessType = BusinessType.DELETE)
@DeleteMapping("/{hiddenTroubleIds}")
public AjaxResult remove(@PathVariable Long[] hiddenTroubleIds)
{
return toAjax(tHiddenTroubleInfoService.deleteTHiddenTroubleInfoByIds(hiddenTroubleIds));
}
}
package com.zehong.web.controller.operationMonitor;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TSupervisorInfo;
import com.zehong.system.service.ITSupervisorInfoService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 燃气督办Controller
*
* @author zehong
* @date 2022-03-31
*/
@RestController
@RequestMapping("/supervisor/info")
public class TSupervisorInfoController extends BaseController
{
@Autowired
private ITSupervisorInfoService tSupervisorInfoService;
/**
* 查询燃气督办列表
*/
@PreAuthorize("@ss.hasPermi('supervisor:info:list')")
@GetMapping("/list")
public TableDataInfo list(TSupervisorInfo tSupervisorInfo)
{
startPage();
List<TSupervisorInfo> list = tSupervisorInfoService.selectTSupervisorInfoList(tSupervisorInfo);
return getDataTable(list);
}
/**
* 查询燃气督办list
* @param tSupervisorInfo
* @return
*/
@GetMapping("/supervisorInfoList")
public AjaxResult supervisorInfoList(TSupervisorInfo tSupervisorInfo)
{
return AjaxResult.success( tSupervisorInfoService.selectTSupervisorInfoList(tSupervisorInfo));
}
/**
* 导出燃气督办列表
*/
@PreAuthorize("@ss.hasPermi('supervisor:info:export')")
@Log(title = "燃气督办", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TSupervisorInfo tSupervisorInfo)
{
List<TSupervisorInfo> list = tSupervisorInfoService.selectTSupervisorInfoList(tSupervisorInfo);
ExcelUtil<TSupervisorInfo> util = new ExcelUtil<TSupervisorInfo>(TSupervisorInfo.class);
return util.exportExcel(list, "燃气督办数据");
}
/**
* 获取燃气督办详细信息
*/
@PreAuthorize("@ss.hasPermi('supervisor:info:query')")
@GetMapping(value = "/{supervisorId}")
public AjaxResult getInfo(@PathVariable("supervisorId") Long supervisorId)
{
return AjaxResult.success(tSupervisorInfoService.selectTSupervisorInfoById(supervisorId));
}
/**
* 新增燃气督办
*/
@PreAuthorize("@ss.hasPermi('supervisor:info:add')")
@Log(title = "燃气督办", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TSupervisorInfo tSupervisorInfo)
{
return toAjax(tSupervisorInfoService.insertTSupervisorInfo(tSupervisorInfo));
}
/**
* 修改燃气督办
*/
@PreAuthorize("@ss.hasPermi('supervisor:info:edit')")
@Log(title = "燃气督办", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TSupervisorInfo tSupervisorInfo)
{
return toAjax(tSupervisorInfoService.updateTSupervisorInfo(tSupervisorInfo));
}
/**
* 删除燃气督办
*/
@PreAuthorize("@ss.hasPermi('supervisor:info:remove')")
@Log(title = "燃气督办", businessType = BusinessType.DELETE)
@DeleteMapping("/{supervisorIds}")
public AjaxResult remove(@PathVariable Long[] supervisorIds)
{
return toAjax(tSupervisorInfoService.deleteTSupervisorInfoByIds(supervisorIds));
}
}
package com.zehong.web.controller.operationMonitor;
import java.util.List;
import com.zehong.system.domain.TVehicleLocationInfo;
import com.zehong.system.service.ITVehicleLocationInfoService;
import io.jsonwebtoken.lang.Collections;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TVehicleInfo;
import com.zehong.system.service.ITVehicleInfoService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 燃气车辆信息Controller
*
* @author zehong
* @date 2022-03-17
*/
@RestController
@RequestMapping("/system/vehicleInfo")
public class TVehicleInfoController extends BaseController
{
@Autowired
private ITVehicleInfoService tVehicleInfoService;
@Autowired
private ITVehicleLocationInfoService itVehicleLocationInfoService;
@Autowired
private ITVehicleLocationInfoService tVehicleLocationInfoService;
/**
* 查询燃气车辆信息列表
*/
//@PreAuthorize("@ss.hasPermi('system:vehicleInfo:list')")
@GetMapping("/list")
public TableDataInfo list(TVehicleInfo tVehicleInfo)
{
startPage();
List<TVehicleInfo> list = tVehicleInfoService.selectTVehicleInfoList(tVehicleInfo);
return getDataTable(list);
}
/**
* 查询车辆最终位置
* @param vehicleId 车辆信息id
* @return
*/
@GetMapping("/getLastLocation")
public AjaxResult getLastLocation(@RequestParam(value="vehicleId") Long vehicleId){
//获取车辆信息
TVehicleInfo tVehicleInfo = tVehicleInfoService.selectTVehicleInfoById(vehicleId);
//获取最后位置信息
TVehicleLocationInfo tVehicleLocationInfo = new TVehicleLocationInfo();
tVehicleLocationInfo.setCarNum(tVehicleInfo.getCarNum());
tVehicleLocationInfo.setLast(true);
List<TVehicleLocationInfo> tVehicleLocationInfoList=itVehicleLocationInfoService.selectTVehicleLocationInfoList(tVehicleLocationInfo);
//车辆最后位置
if(!Collections.isEmpty(tVehicleLocationInfoList) && tVehicleLocationInfoList.size() > 0){
tVehicleInfo.setLongitude(tVehicleLocationInfoList.get(0).getLongitude());
tVehicleInfo.setLatitude(tVehicleLocationInfoList.get(0).getLatitude());
}
return AjaxResult.success(tVehicleInfo);
}
/**
* 导出燃气车辆信息列表
*/
@PreAuthorize("@ss.hasPermi('system:vehicleInfo:export')")
@Log(title = "燃气车辆信息", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TVehicleInfo tVehicleInfo)
{
List<TVehicleInfo> list = tVehicleInfoService.selectTVehicleInfoList(tVehicleInfo);
ExcelUtil<TVehicleInfo> util = new ExcelUtil<TVehicleInfo>(TVehicleInfo.class);
return util.exportExcel(list, "燃气车辆信息数据");
}
/**
* 获取燃气车辆信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:vehicleInfo:query')")
@GetMapping(value = "/{vehicleId}")
public AjaxResult getInfo(@PathVariable("vehicleId") Long vehicleId)
{
return AjaxResult.success(tVehicleInfoService.selectTVehicleInfoById(vehicleId));
}
/**
* 新增燃气车辆信息
*/
@PreAuthorize("@ss.hasPermi('system:vehicleInfo:add')")
@Log(title = "燃气车辆信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TVehicleInfo tVehicleInfo)
{
return toAjax(tVehicleInfoService.insertTVehicleInfo(tVehicleInfo));
}
/**
* 修改燃气车辆信息
*/
@PreAuthorize("@ss.hasPermi('system:vehicleInfo:edit')")
@Log(title = "燃气车辆信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TVehicleInfo tVehicleInfo)
{
return toAjax(tVehicleInfoService.updateTVehicleInfo(tVehicleInfo));
}
/**
* 删除燃气车辆信息
*/
@PreAuthorize("@ss.hasPermi('system:vehicleInfo:remove')")
@Log(title = "燃气车辆信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{vehicleIds}")
public AjaxResult remove(@PathVariable Long[] vehicleIds)
{
return toAjax(tVehicleInfoService.deleteTVehicleInfoByIds(vehicleIds));
}
}
package com.zehong.web.controller.operationMonitor;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TVehicleLocationInfo;
import com.zehong.system.service.ITVehicleLocationInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 燃气车辆位置信息Controller
*
* @author zehong
* @date 2022-03-17
*/
@RestController
@RequestMapping("/system/vehicleLocationInfo")
public class TVehicleLocationInfoController extends BaseController
{
@Autowired
private ITVehicleLocationInfoService tVehicleLocationInfoService;
/**
* 查询燃气车辆位置信息列表
*/
@PreAuthorize("@ss.hasPermi('system:vehicleLocationInfo:list')")
@GetMapping("/list")
public TableDataInfo list(TVehicleLocationInfo tVehicleLocationInfo)
{
startPage();
List<TVehicleLocationInfo> list = tVehicleLocationInfoService.selectTVehicleLocationInfoList(tVehicleLocationInfo);
return getDataTable(list);
}
/**
* 获取车辆位置信息
* @param tVehicleLocationInfo
* @return
*/
@GetMapping("/getVehicleLocations")
public AjaxResult getVehicleLocations(TVehicleLocationInfo tVehicleLocationInfo){
return AjaxResult.success( tVehicleLocationInfoService.selectTVehicleLocationInfoList(tVehicleLocationInfo));
}
/**
* 导出燃气车辆位置信息列表
*/
@PreAuthorize("@ss.hasPermi('system:vehicleLocationInfo:export')")
@Log(title = "燃气车辆位置信息", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TVehicleLocationInfo tVehicleLocationInfo)
{
List<TVehicleLocationInfo> list = tVehicleLocationInfoService.selectTVehicleLocationInfoList(tVehicleLocationInfo);
ExcelUtil<TVehicleLocationInfo> util = new ExcelUtil<TVehicleLocationInfo>(TVehicleLocationInfo.class);
return util.exportExcel(list, "燃气车辆位置信息数据");
}
/**
* 获取燃气车辆位置信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:vehicleLocationInfo:query')")
@GetMapping(value = "/{vehicleLocationId}")
public AjaxResult getInfo(@PathVariable("vehicleLocationId") Long vehicleLocationId)
{
return AjaxResult.success(tVehicleLocationInfoService.selectTVehicleLocationInfoById(vehicleLocationId));
}
/**
* 新增燃气车辆位置信息
*/
@PreAuthorize("@ss.hasPermi('system:vehicleLocationInfo:add')")
@Log(title = "燃气车辆位置信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TVehicleLocationInfo tVehicleLocationInfo)
{
return toAjax(tVehicleLocationInfoService.insertTVehicleLocationInfo(tVehicleLocationInfo));
}
/**
* 修改燃气车辆位置信息
*/
@PreAuthorize("@ss.hasPermi('system:vehicleLocationInfo:edit')")
@Log(title = "燃气车辆位置信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TVehicleLocationInfo tVehicleLocationInfo)
{
return toAjax(tVehicleLocationInfoService.updateTVehicleLocationInfo(tVehicleLocationInfo));
}
/**
* 删除燃气车辆位置信息
*/
@PreAuthorize("@ss.hasPermi('system:vehicleLocationInfo:remove')")
@Log(title = "燃气车辆位置信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{vehicleLocationIds}")
public AjaxResult remove(@PathVariable Long[] vehicleLocationIds)
{
return toAjax(tVehicleLocationInfoService.deleteTVehicleLocationInfoByIds(vehicleLocationIds));
}
}
package com.zehong.web.controller.operationMonitor;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.ServletUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.framework.web.service.TokenService;
import com.zehong.system.domain.*;
import com.zehong.system.service.ISysPostService;
import com.zehong.system.service.ITHiddenTroubleInfoService;
import com.zehong.system.service.ITSupervisorInfoService;
import com.zehong.system.service.ITWorkOrderService;
import com.zehong.system.service.impl.TSupervisorInfoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.xml.stream.Location;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* 燃气任务Controller
*
* @author zehong
* @date 2022-02-10
*/
@RestController
@RequestMapping("/system/order")
public class TWorkOrderController extends BaseController
{
@Autowired
private ITWorkOrderService tWorkOrderService;
@Autowired
private ISysPostService iSysPostService;
@Autowired
private ITHiddenTroubleInfoService troubleInfoService;
@Autowired
private ITSupervisorInfoService itSupervisorInfoService;
@Autowired
private TokenService tokenService;
/**
* 查询燃气任务列表
*/
//@PreAuthorize("@ss.hasPermi('system:order:list')")
@GetMapping("/list")
public TableDataInfo list(TWorkOrder tWorkOrder)
{
startPage();
judgeUserRole(tWorkOrder);
List<TWorkOrder> list = tWorkOrderService.selectTWorkOrderList(tWorkOrder);
if(null != tWorkOrder.getWorkAssignEnterproseId()){
for(TWorkOrder order : list){
TSupervisorInfo tSupervisorInfo = new TSupervisorInfo();
tSupervisorInfo.setWorkId(order.getWorkId());
List<TSupervisorInfo> supervisorInfos = itSupervisorInfoService.selectTSupervisorInfoList(tSupervisorInfo);
if(null != supervisorInfos && supervisorInfos.size()>0){
order.setSupervisorInfoList(supervisorInfos);
}
}
}
return getDataTable(list);
}
@GetMapping("/listCount")
public AjaxResult listCount(TWorkOrder tWorkOrder)
{
judgeUserRole(tWorkOrder);
List<Map<String,Object>> list = tWorkOrderService.selectTWorkOrderListCount(tWorkOrder);
return AjaxResult.success(list);
}
/**
* 导出燃气任务列表
*/
//@PreAuthorize("@ss.hasPermi('system:order:export')")
@Log(title = "燃气任务", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TWorkOrder tWorkOrder)
{
judgeUserRole(tWorkOrder);
List<TWorkOrder> list = tWorkOrderService.selectTWorkOrderList(tWorkOrder);
ExcelUtil<TWorkOrder> util = new ExcelUtil<TWorkOrder>(TWorkOrder.class);
return util.exportExcel(list, "燃气任务数据");
}
/**
* 判断用户角色
* @param tWorkOrder
*/
private void judgeUserRole(TWorkOrder tWorkOrder){
SysUser user = SecurityUtils.getLoginUser().getUser();
//获取用户所属单位
long enterpriseId = user.getDeptId();
//判断是否为政府用户
if(!"-2".equals(String.valueOf(enterpriseId))){
tWorkOrder.setWorkAssignEnterproseId(enterpriseId);
//判断是否为巡线员
List<Integer> postIds = iSysPostService.selectPostListByUserId(user.getUserId());
for(Integer postId : postIds){
SysPost postInfo = iSysPostService.selectPostById(postId.longValue());
if("se".equals(postInfo.getPostCode()) && postIds.size()==1){
tWorkOrder.setWorkAssignManId(user.getUserId());
}
}
}
}
/**
* 获取燃气任务详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:order:query')")
@GetMapping(value = "/{workId}")
public AjaxResult getInfo(@PathVariable("workId") Long workId)
{
return AjaxResult.success(tWorkOrderService.selectTWorkOrderById(workId));
}
/**
* 新增燃气任务
*/
//@PreAuthorize("@ss.hasPermi('system:order:add')")
@Log(title = "燃气任务", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TWorkOrder tWorkOrder)
{
return toAjax(tWorkOrderService.insertTWorkOrder(tWorkOrder));
}
@PostMapping("/location")
public AjaxResult insertsLocations(@RequestParam String locations)
{
return toAjax(tWorkOrderService.insertsLocations(locations));
}
@PostMapping("/location2")
public AjaxResult insertsLocations2(@RequestBody TUserLocation location)
{
return toAjax(tWorkOrderService.insertsLocation(location));
}
/**
* 修改燃气任务
*/
//@PreAuthorize("@ss.hasPermi('system:order:edit')")
@Log(title = "燃气任务", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TWorkOrder tWorkOrder)
{
int edit = tWorkOrderService.updateTWorkOrder(tWorkOrder);
if(1 == edit && null != tWorkOrder.getHiddenList() && !tWorkOrder.getHiddenList().isEmpty()){
for(THiddenTroubleInfo tHiddenTroubleInfo : tWorkOrder.getHiddenList()){
troubleInfoService.insertTHiddenTroubleInfo(tHiddenTroubleInfo);
}
}
return AjaxResult.success();
}
/**
* 删除燃气任务
*/
//@PreAuthorize("@ss.hasPermi('system:order:remove')")
@Log(title = "燃气任务", businessType = BusinessType.DELETE)
@DeleteMapping("/{workIds}")
public AjaxResult remove(@PathVariable Long[] workIds)
{
return toAjax(tWorkOrderService.deleteTWorkOrderByIds(workIds));
}
@GetMapping("/selectWorkOrderNum")
public AjaxResult selectWorkOrderNum(String enterpriseId)
{
/**
* 判断是否是政府单位登录 如果不是 就只查询出本企业下面的数据
*/
//获取当前登录用户信息
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser();
if (user.getDeptId()==-2){
// user.setDeptId((long) 0);
}else {
enterpriseId= String.valueOf(user.getDeptId());
}
return AjaxResult.success(tWorkOrderService.selectWorkOrderNum(enterpriseId));
}
}
package com.zehong.web.controller.standingBook;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.zehong.system.domain.Statistics;
import com.zehong.system.domain.form.THiddenDangerStandingBookForm;
import com.zehong.web.controller.tool.TimeConfig;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.THiddenDangerStandingBook;
import com.zehong.system.service.ITHiddenDangerStandingBookService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 隐患整治台账Controller
*
* @author zehong
* @date 2022-02-09
*/
@RestController
@RequestMapping("/standingBook/hidden")
public class THiddenDangerStandingBookController extends BaseController
{
@Autowired
private ITHiddenDangerStandingBookService tHiddenDangerStandingBookService;
/**
* 查询隐患整治台账列表
*/
@PreAuthorize("@ss.hasPermi('standingBook:hidden:list')")
@GetMapping("/list")
public TableDataInfo list(THiddenDangerStandingBookForm tHiddenDangerStandingBook)
{
startPage();
List<THiddenDangerStandingBook> list = tHiddenDangerStandingBookService.selectTHiddenDangerStandingBookList(tHiddenDangerStandingBook);
return getDataTable(list);
}
/**
* 统计每个月隐患数量
* @return
*/
@GetMapping("/selectCountByMonth")
public AjaxResult selectCountByMonth(){
List<Map<String,Object>> list = tHiddenDangerStandingBookService.selectCountByMonth();
return AjaxResult.success(list);
}
/**
* 统计每年隐患数量
* @return
*/
@GetMapping("/selectCountByYear")
public AjaxResult selectCountByYear(){
List<Map<String,Object>> list = tHiddenDangerStandingBookService.selectCountByYear();
return AjaxResult.success(list);
}
/**
* 根据乡镇统计隐患数量
* @return
*/
@GetMapping("/selectHiddenRanking")
public AjaxResult selectHiddenRanking(){
List<Map<String,Object>> list = tHiddenDangerStandingBookService.selectHiddenRanking();
return AjaxResult.success(list);
}
/**
* 根据隐患来源统计隐患数量
* @return
*/
@GetMapping("/selectHiddenSource")
public AjaxResult selectHiddenSource(){
List<Map<String,Object>> list = tHiddenDangerStandingBookService.selectHiddenSource();
return AjaxResult.success(list);
}
/**
* 获取隐患整治台账统计信息
*/
@GetMapping("/hazardStatistics")
public AjaxResult hazardStatistics()
{
//生成近7天数据
List<String> sevenDate = TimeConfig.getSevenDate();
List<Statistics> list=new ArrayList<>();
//查询统计日期和数量
List<Statistics> statistics = tHiddenDangerStandingBookService.hazardStatistics(TimeConfig.getSevenDate());
if (statistics.size()==0){
for (int n=0;n<7;n++){
Statistics statisticsn=new Statistics();
statisticsn.setCount(0);
statisticsn.setDate(sevenDate.get(n));
list.add(statisticsn);
}
}
for (int i=0;i<sevenDate.size();i++){
Statistics statistics1=new Statistics();
boolean isExist = false;
for (int s=0;s<statistics.size();s++){
if (statistics.get(s).getDate().equals(sevenDate.get(i))){
statistics1.setCount(statistics.get(s).getCount());
statistics1.setDate(sevenDate.get(i));
list.add(statistics1);
isExist = true;
}
}
if(!isExist){
statistics1.setCount(0);
statistics1.setDate(sevenDate.get(i));
list.add(statistics1);
}
}
return AjaxResult.success(list);
}
/**
* 导出隐患整治台账列表
*/
@Log(title = "隐患整治台账", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(THiddenDangerStandingBookForm tHiddenDangerStandingBook)
{
List<THiddenDangerStandingBook> list = tHiddenDangerStandingBookService.selectTHiddenDangerStandingBookList(tHiddenDangerStandingBook);
ExcelUtil<THiddenDangerStandingBook> util = new ExcelUtil<THiddenDangerStandingBook>(THiddenDangerStandingBook.class);
return util.exportExcel(list, "隐患整治台账数据");
}
/**
* 获取隐患整治台账详细信息
*/
@GetMapping(value = "/{hiddenId}")
public AjaxResult getInfo(@PathVariable("hiddenId") Long hiddenId)
{
return AjaxResult.success(tHiddenDangerStandingBookService.selectTHiddenDangerStandingBookById(hiddenId));
}
/**
* 新增隐患整治台账
*/
@Log(title = "隐患整治台账", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody THiddenDangerStandingBook tHiddenDangerStandingBook)
{
return toAjax(tHiddenDangerStandingBookService.insertTHiddenDangerStandingBook(tHiddenDangerStandingBook));
}
/**
* 修改隐患整治台账
*/
@Log(title = "隐患整治台账", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody THiddenDangerStandingBook tHiddenDangerStandingBook)
{
return toAjax(tHiddenDangerStandingBookService.updateTHiddenDangerStandingBook(tHiddenDangerStandingBook));
}
/**
* 删除隐患整治台账
*/
@Log(title = "隐患整治台账", businessType = BusinessType.DELETE)
@DeleteMapping("/{hiddenIds}")
public AjaxResult remove(@PathVariable Long[] hiddenIds)
{
return toAjax(tHiddenDangerStandingBookService.deleteTHiddenDangerStandingBookByIds(hiddenIds));
}
/**
* 隐患统计
* @return
*/
@GetMapping("/hiddenBookStatistics")
public AjaxResult hiddenBookStatistics(){
return AjaxResult.success(tHiddenDangerStandingBookService.hiddenBookStatistics());
}
}
package com.zehong.web.controller.standingBook;
import java.util.List;
import com.zehong.system.domain.form.TSafeEquipmentStandingBookForm;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TSafeEquipmentStandingBook;
import com.zehong.system.service.ITSafeEquipmentStandingBookService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 用户加装安全装置台账Controller
*
* @author zehong
* @date 2022-02-09
*/
@RestController
@RequestMapping("/standingBook/equipment")
public class TSafeEquipmentStandingBookController extends BaseController
{
@Autowired
private ITSafeEquipmentStandingBookService tSafeEquipmentStandingBookService;
/**
* 查询用户加装安全装置台账列表
*/
@PreAuthorize("@ss.hasPermi('standingBook:equipment:list')")
@GetMapping("/list")
public TableDataInfo list(TSafeEquipmentStandingBookForm tSafeEquipmentStandingBook)
{
startPage();
List<TSafeEquipmentStandingBook> list = tSafeEquipmentStandingBookService.selectTSafeEquipmentStandingBookList(tSafeEquipmentStandingBook);
return getDataTable(list);
}
/**
* 导出用户加装安全装置台账列表
*/
@Log(title = "用户加装安全装置台账", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TSafeEquipmentStandingBookForm tSafeEquipmentStandingBook)
{
List<TSafeEquipmentStandingBook> list = tSafeEquipmentStandingBookService.selectTSafeEquipmentStandingBookList(tSafeEquipmentStandingBook);
ExcelUtil<TSafeEquipmentStandingBook> util = new ExcelUtil<TSafeEquipmentStandingBook>(TSafeEquipmentStandingBook.class);
return util.exportExcel(list, "用户加装安全装置台账数据");
}
/**
* 获取用户加装安全装置台账详细信息
*/
@GetMapping(value = "/{safeEquipmentId}")
public AjaxResult getInfo(@PathVariable("safeEquipmentId") Long safeEquipmentId)
{
return AjaxResult.success(tSafeEquipmentStandingBookService.selectTSafeEquipmentStandingBookById(safeEquipmentId));
}
/**
* 新增用户加装安全装置台账
*/
@Log(title = "用户加装安全装置台账", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TSafeEquipmentStandingBook tSafeEquipmentStandingBook)
{
return toAjax(tSafeEquipmentStandingBookService.insertTSafeEquipmentStandingBook(tSafeEquipmentStandingBook));
}
/**
* 修改用户加装安全装置台账
*/
@Log(title = "用户加装安全装置台账", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TSafeEquipmentStandingBook tSafeEquipmentStandingBook)
{
return toAjax(tSafeEquipmentStandingBookService.updateTSafeEquipmentStandingBook(tSafeEquipmentStandingBook));
}
/**
* 删除用户加装安全装置台账
*/
@Log(title = "用户加装安全装置台账", businessType = BusinessType.DELETE)
@DeleteMapping("/{safeEquipmentIds}")
public AjaxResult remove(@PathVariable Long[] safeEquipmentIds)
{
return toAjax(tSafeEquipmentStandingBookService.deleteTSafeEquipmentStandingBookByIds(safeEquipmentIds));
}
@GetMapping(value = "/selectCountByYears")
public AjaxResult selectCountByYears()
{
return AjaxResult.success(tSafeEquipmentStandingBookService.selectCountByYears());
}
@GetMapping(value = "/selectCountByUserType")
public AjaxResult selectCountByUserType()
{
return AjaxResult.success(tSafeEquipmentStandingBookService.selectCountByUserType());
}
}
package com.zehong.web.controller.standingBook;
import java.util.ArrayList;
import java.util.List;
import com.zehong.system.domain.Statistics;
import com.zehong.system.domain.form.TTroubleStandingBookForm;
import com.zehong.web.controller.tool.TimeConfig;
import com.zehong.web.timeconfig.TimeConFig;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TTroubleStandingBook;
import com.zehong.system.service.ITTroubleStandingBookService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 事故台账Controller
*
* @author zehong
* @date 2022-02-09
*/
@RestController
@RequestMapping("/standingBook/trouble")
public class TTroubleStandingBookController extends BaseController
{
@Autowired
private ITTroubleStandingBookService tTroubleStandingBookService;
/**
* 查询事故台账列表
*/
@PreAuthorize("@ss.hasPermi('standingBook:trouble:list')")
@GetMapping("/list")
public TableDataInfo list(TTroubleStandingBookForm tTroubleStandingBook)
{
startPage();
List<TTroubleStandingBook> list = tTroubleStandingBookService.selectTTroubleStandingBookList(tTroubleStandingBook);
return getDataTable(list);
}
/**
* 统计每个月事故数量
* @return
*/
@GetMapping("/selectTrobleCountByMonth")
public AjaxResult selectTrobleCountByMonth() {
return AjaxResult.success(tTroubleStandingBookService.selectTrobleCountByMonth());
}
/**
* 统计每年事故数量
* @return
*/
@GetMapping("/selectTrobleCountByYear")
public AjaxResult selectTrobleCountByYear() {
return AjaxResult.success(tTroubleStandingBookService.selectTrobleCountByYear());
}
/**
* 统计乡镇事故数量
* @return
*/
@GetMapping("/selectTrobleRanking")
public AjaxResult selectTrobleRanking() {
return AjaxResult.success(tTroubleStandingBookService.selectTrobleRanking());
}
/**
* 根据事故原因统计数量
* @return
*/
@GetMapping("/selectTrobleReason")
public AjaxResult selectTrobleReason() {
return AjaxResult.success(tTroubleStandingBookService.selectTrobleReason());
}
/**
* 获取事故台账统计
*/
@GetMapping("/accidentLedger")
public AjaxResult accidentLedger()
{
List<Statistics> list=new ArrayList<>();
//查询统计日期和数量
List<Statistics> statistics = tTroubleStandingBookService.accidentLedger(TimeConfig.getSevenDate());
//生成近7天数据
List<String> sevenDate = TimeConfig.getSevenDate();
if (statistics.size()==0){
for (int n=0;n<7;n++){
Statistics statisticsn=new Statistics();
statisticsn.setCount(0);
statisticsn.setDate(sevenDate.get(n));
list.add(statisticsn);
}
}
for (int s=0;s<statistics.size();s++){
for (int i=0;i<sevenDate.size();i++){
Statistics statistics1=new Statistics();
if (statistics.get(s).getDate().equals(sevenDate.get(i))){
statistics1.setCount(statistics.get(s).getCount());
statistics1.setDate(sevenDate.get(i));
list.add(statistics1);
}else {
statistics1.setCount(0);
statistics1.setDate(sevenDate.get(i));
list.add(statistics1);
}
}
}
return AjaxResult.success(list);
}
/**
* 导出事故台账列表
*/
@Log(title = "事故台账", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TTroubleStandingBookForm tTroubleStandingBook)
{
List<TTroubleStandingBook> list = tTroubleStandingBookService.selectTTroubleStandingBookList(tTroubleStandingBook);
ExcelUtil<TTroubleStandingBook> util = new ExcelUtil<TTroubleStandingBook>(TTroubleStandingBook.class);
return util.exportExcel(list, "事故台账数据");
}
/**
* 获取事故台账详细信息
*/
@GetMapping(value = "/{troubleId}")
public AjaxResult getInfo(@PathVariable("troubleId") Long troubleId)
{
return AjaxResult.success(tTroubleStandingBookService.selectTTroubleStandingBookById(troubleId));
}
/**
* 新增事故台账
*/
@Log(title = "事故台账", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TTroubleStandingBook tTroubleStandingBook)
{
return toAjax(tTroubleStandingBookService.insertTTroubleStandingBook(tTroubleStandingBook));
}
/**
* 修改事故台账
*/
@Log(title = "事故台账", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TTroubleStandingBook tTroubleStandingBook)
{
return toAjax(tTroubleStandingBookService.updateTTroubleStandingBook(tTroubleStandingBook));
}
/**
* 删除事故台账
*/
@Log(title = "事故台账", businessType = BusinessType.DELETE)
@DeleteMapping("/{troubleIds}")
public AjaxResult remove(@PathVariable Long[] troubleIds)
{
return toAjax(tTroubleStandingBookService.deleteTTroubleStandingBookByIds(troubleIds));
}
}
package com.zehong.web.controller.statistic;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.ServletUtils;
import com.zehong.framework.web.service.TokenService;
import com.zehong.system.domain.THiddenDangerStandingBook;
import com.zehong.system.domain.TSafeEquipmentStandingBook;
import com.zehong.system.domain.TTroubleStandingBook;
import com.zehong.system.domain.TVideoManager;
import com.zehong.system.domain.form.THiddenDangerStandingBookForm;
import com.zehong.system.domain.vo.HomepageVo;
import com.zehong.system.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 统计分析
*
* @author zehong
*/
@RestController
@RequestMapping("/statistic")
public class StatisticController
{
private static final Logger log = LoggerFactory.getLogger(StatisticController.class);
@Autowired
private ITVideoManagerService tVideoManagerService;
@Autowired
private ITSafeEquipmentStandingBookService tSafeEquipmentStandingBookService;
@Autowired
private ITTroubleStandingBookService tTroubleStandingBookService;
@Autowired
private ITHiddenDangerStandingBookService tHiddenDangerStandingBookService;
@Autowired
private ITComplainDealService tComplainDealService;
@Autowired
private TokenService tokenService;
@Autowired
private ITWorkOrderService tWorkOrderService;
/**
* 燃气事故台账统计
*/
@GetMapping("/troubleStatistic")
public AjaxResult troubleStatistic()
{
return AjaxResult.success(tTroubleStandingBookService.selectTTroubleStandingBookStatistic());
}
/**
* 隐患整治台账统计
*/
@GetMapping("/hiddenStatistic")
public AjaxResult hiddenStatistic()
{
return AjaxResult.success(tHiddenDangerStandingBookService.selectTHiddenDangerStandingBookStatistic());
}
/**
* 首页统计
*/
@GetMapping("/homepageStatistic")
public AjaxResult homepageStatistic()
{
HomepageVo homepageVo = new HomepageVo();
//获取当前登录用户信息
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser();
homepageVo = tComplainDealService.countTComplainDeal();
/*homepageVo.setTaskTotal(itVehicleInfoService.countCar(user.getDeptId()));
homepageVo.setTaskFeedbackTotal(0);*/
HomepageVo info = tWorkOrderService.countTWorkOrder();
homepageVo.setTaskTotal(info.getTaskTotal());
homepageVo.setTaskFeedbackTotal(info.getTaskFeedbackTotal());
List<TVideoManager> tVideoManagerList = tVideoManagerService.selectTVideoManagerList(null);
List<TSafeEquipmentStandingBook> tSafeEquipmentStandingBookList = tSafeEquipmentStandingBookService.selectTSafeEquipmentStandingBookList(null);
List<TTroubleStandingBook> tTroubleStandingBookList = tTroubleStandingBookService.selectTTroubleStandingBookList(null);
THiddenDangerStandingBookForm tHiddenDangerStandingBook = new THiddenDangerStandingBookForm();
if(!SecurityUtils.isAdmin(SecurityUtils.getLoginUser().getUser().getUserId())){
tHiddenDangerStandingBook.setBeyondEnterpriseId(SecurityUtils.getLoginUser().getUser().getDeptId());
}
List<THiddenDangerStandingBook> tHiddenDangerStandingBookList = tHiddenDangerStandingBookService.selectTHiddenDangerStandingBookList(tHiddenDangerStandingBook);
homepageVo.setVideoTotal(tVideoManagerList.size());
homepageVo.setEquipmentTotal(tSafeEquipmentStandingBookList.size());
homepageVo.setTroubleTotal(tTroubleStandingBookList.size());
homepageVo.setHiddenTotal(tHiddenDangerStandingBookList.size());
return AjaxResult.success(homepageVo);
}
}
package com.zehong.web.controller.tool;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.zehong.common.core.controller.BaseController;
/**
* swagger 接口
*
* @author zehong
*/
@Controller
@RequestMapping("/tool/swagger")
public class SwaggerController extends BaseController
{
@PreAuthorize("@ss.hasPermi('tool:swagger:view')")
@GetMapping()
public String index()
{
return redirect("/swagger-ui.html");
}
}
restart.include.json=/com.alibaba.fastjson.*.jar
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
restart.include.json=/com.alibaba.fastjson.*.jar
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment