Commit ca93f94f authored by lixuan's avatar lixuan

Initial commit

parents
Pipeline #142526 canceled with stages
in 9 seconds

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

######################################################################
# Build Tools
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
target/
!.mvn/wrapper/maven-wrapper.jar
######################################################################
# IDE
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.DS_Store
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### JRebel ###
rebel.xml
### NetBeans ###
nbproject/private/
build/*
nbbuild/
dist/
nbdist/
.nb-gradle/
######################################################################
# Others
*.log
*.xml.versionsBackup
*.swp
!*/build/*.java
!*/build/*.html
!*/build/*.xml
variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true -Dmaven.test.skip=true"
USERNAME: eazytec #hub.eazytec-cloud.com用户名
TOKEN: Eazytec2023 #hub.eazytec-cloud.com的CLI密码
REPO: hub.eazytec-cloud.com #hub.eazytec-cloud.com的地址
NAMESPACE: wst2 #项目名
IMAGE: wst-be #项目英文名
OKD: osr.eazytec.intra:8443 #pass平台的地址
OKDUSER: sunf@eazytec.com #pass平台的用户名
OKDPASS: P@44w0rd #pass平台的密码
PROJECT: wst2 #测试环境项目英文名
IMAGESTREAM: wst-be #项目英文名
TAG: $CI_COMMIT_REF_NAME
cache:
paths:
- .m2/repository2
stages:
- package
- deploy
- publish
package:
stage: package
script:
- 'mvn $MAVEN_CLI_OPTS package -Dmaven.test.skip=true'
artifacts:
paths:
- ./ruoyi-admin/target/ruoyi-admin.jar
image: hub.eazytec-cloud.com/devops/maven:3.3.9-jdk-8
deploy:
image: hub.eazytec-cloud.com/devops/docker:18
services:
- name: hub.eazytec-cloud.com/devops/docker:18-dind
command: ["--insecure-registry=https://docker-registry-default.app.eazytec.intra", "--registry-mirror=http://bdex97.eazytec.intra:5000"]
alias: docker
before_script:
- docker info
- docker login -p "${TOKEN}" -u ${USERNAME} ${REPO}
stage: deploy
script:
- if [ $TAG == "master" ]; then TAG="latest"; fi
- docker build --pull -t ${REPO}/${NAMESPACE}/${IMAGE}:${TAG} .
- docker push ${REPO}/${NAMESPACE}/${IMAGE}:${TAG}
publish:
image: hub.eazytec-cloud.com/devops/oc:3.11
before_script:
- oc login -p "${OKDPASS}" -u ${OKDUSER} --insecure-skip-tls-verify ${OKD}
- oc project ${PROJECT}
stage: publish
script:
- if [ $TAG == "master" ]; then TAG="latest"; fi
- oc import-image ${IMAGESTREAM}:${TAG} --from=${REPO}/${NAMESPACE}/${IMAGE}:${TAG} --confirm
FROM hub.eazytec-cloud.com/eazytec/openjdk8-fonts:latest
LABEL maintainer="sunf sunf@eazytec.com"
ENV JAR "ruoyi-admin.jar"
ENV TZ "Asia/Shanghai"
ADD ./ruoyi-admin/target/${JAR} .
ADD arthas-bin/ /home/arthas-bin/
USER root
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && mkdir -p /logs && chmod -R 777 /logs && \
chmod u+s /bin/ping
ENV LANG en_US.UTF-8
USER eazytec
EXPOSE 8080
ENV JVM_ARGS "-Duser.home=$HOME -Xms1024m -Xmx2048m"
# WST2.0服务
#arthas.config.overrideAll=true
arthas.telnetPort=3658
arthas.httpPort=8563
arthas.ip=127.0.0.1
# seconds
arthas.sessionTimeout=1800
#arthas.enhanceLoaders=java.lang.ClassLoader
# https://arthas.aliyun.com/doc/en/auth
# arthas.username=arthas
# arthas.password=arthas
# local connection non auth, like telnet 127.0.0.1 3658
arthas.localConnectionNonAuth=true
#arthas.appName=demoapp
#arthas.tunnelServer=ws://127.0.0.1:7777/ws
#arthas.agentId=mmmmmmyiddddd
#arthas.disabledCommands=stop,dump
#arthas.outputPath=arthas-output
@echo off
REM DON'T CHANGE THE FIRST LINE OF THE FILE, WINDOWS SERVICE RUN BAT NEED IT! (@echo off)
REM don't call 'echo' before 'start as.bat'
REM You can specify Java Home via AS_JAVA_HOME here or Windows System Environment, but not in cmd.exe
REM set AS_JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
set basedir=%~dp0
set filename=%~nx0
set srv_name=arthas
set telnet_port=3658
set http_port=8563
REM parse extend args
set arg1=%1
set pid=
set port=
set ignoreTools=0
set as_remove_srv=0
set as_service=0
set srv_interact=0
for %%a in (%*) do (
if "%%a"=="--remove" set as_remove_srv=1
if "%%a"=="--service" set as_service=1
if "%%a"=="--interact" set srv_interact=1
if "%%a"=="--ignore-tools" set ignoreTools=1
)
REM Parse command line args (https://stackoverflow.com/a/35445653)
:read_params
if not %1/==/ (
if not "%__var%"=="" (
if not "%__var:~0,1%"=="-" (
endlocal
goto read_params
)
endlocal & set %__var:~1%=%~1
) else (
setlocal & set __var=%~1
)
shift
goto read_params
)
if not "%telnet-port%"=="" set telnet_port=%telnet-port%
if not "%http-port%"=="" set http_port=%http-port%
REM Setup JAVA_HOME
REM Decode -java-home: '@' -> ' '
if not "%java-home%"=="" set JAVA_HOME=%java-home:@= %
REM If has AS_JAVA_HOME, overriding JAVA_HOME
if not "%AS_JAVA_HOME%" == "" set JAVA_HOME=%AS_JAVA_HOME%
REM use defined is better then "%var%" == "", avoid trouble of ""
if not defined JAVA_HOME goto noJavaHome
REM Remove "" in path
set JAVA_HOME=%JAVA_HOME:"=%
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if %ignoreTools% == 1 (
echo Ignore tools.jar, make sure the java version ^>^= 9
) else (
if not exist "%JAVA_HOME%\lib\tools.jar" (
echo Can not find lib\tools.jar under %JAVA_HOME%!
echo If java version ^<^= 1.8, please make sure JAVA_HOME point to a JDK not a JRE.
echo If java version ^>^= 9, try to run %filename% ^<pid^> --ignore-tools
goto :end
)
)
set JAVACMD="%JAVA_HOME%\bin\java"
REM Runas Service, don't call 'echo' before 'start as.bat'
set as_args=-telnet-port %telnet_port% -http-port %http_port%
if %srv_interact%==0 set as_args=%as_args% --no-interact
if %ignoreTools%==1 set as_args=%as_args% --ignore-tools
if %as_service%==1 (
REM run as.bat
start /wait %basedir%\as.bat %pid% %as_args%
exit 0
REM DEBUG run args
REM echo as_args: %as_args%
REM echo start /wait %basedir%\as.bat %pid% %as_args%
REM exit /b 0
)
REM If the first arg is a number, then set it as pid
echo %arg1%| findstr /r "^[1-9][0-9]*$">nul
if %errorlevel% equ 0 set pid=%arg1%
echo pid: %pid%
echo port: %port%
if not ["%pid%"] == [""] (
goto :prepare_srv
)
if not ["%port%"] == [""] (
goto :find_port
)
if %as_remove_srv%==1 (
goto :remove_srv
)
goto :usage
:remove_srv
echo Removing service: %srv_name% ...
sc stop %srv_name%
sc delete %srv_name%
exit /b 0
:find_port
netstat -nao |findstr LIST |findstr :%telnet_port%
IF %ERRORLEVEL% EQU 0 (
echo Arthas agent already running, just connect to it!
goto :attachSuccess
)
@rem find pid by port
echo %port%| findstr /r "^[1-9][0-9]*$">nul
if %errorlevel% neq 0 (
echo port is not valid number!
goto :usage
)
echo Finding process of listening on port: %port%
set query_pid_command='netstat -ano ^^^| findstr ":%port%" ^^^| findstr "LISTENING"'
set pid=
for /f "tokens=5" %%i in (%query_pid_command%) do (
set pid=%%i
)
if "%pid%" == "" (
echo None process listening on port: %port%
goto :end
)
echo Target process pid is %pid%
:prepare_srv
REM check telnet port
netstat -nao |findstr LIST |findstr :%telnet_port%
IF %ERRORLEVEL% EQU 0 (
echo Arthas agent already running, just connect to it!
goto :attachSuccess
)
REM validate pid
echo %pid%| findstr /r "^[1-9][0-9]*$">nul
if %errorlevel% neq 0 (
echo PID is not valid number!
goto :usage
)
echo Preparing arthas service and injecting arthas agent to process: %pid% ...
REM encode java path, avoid space in service args: ' ' -> '@'
set srv_java_home=-java-home %JAVA_HOME: =@%
set srv_args=-pid %pid% -telnet-port %telnet_port% -http-port %http_port% %srv_java_home%
if %srv_interact%==1 (
sc start UI0Detect
set srv_type=type= interact type= own
set srv_binpath=binPath= "%basedir%\%filename% %srv_args% --service --interact"
) else (
set srv_type=type= own
set srv_binpath=binPath= "%basedir%\%filename% %srv_args% --service"
)
echo arthas srv type: %srv_type%
echo arthas srv binPath: %srv_binpath%
sc create %srv_name% start= demand %srv_type% %srv_binpath%
sc config %srv_name% start= demand %srv_type% %srv_binpath%
if %errorlevel% NEQ 0 (
echo Config Arthas service failed
exit /b -1
)
sc stop %srv_name%
REM fork start Arthas service, avoid blocking
if %srv_interact%==1 (
start /B sc start %srv_name%
)else (
start /B sc start %srv_name% > nul 2>&1
)
REM check and connect arthas ..
echo Waitting for arthas agent ...
set count=0
:waitfor_loop
echo checking
netstat -nao |findstr LIST |findstr :%telnet_port%
IF %ERRORLEVEL% NEQ 0 (
set /a count+=1
if %count% geq 8 (
echo Arthas agent telnet port is not ready, maybe inject failed.
goto :end
)
ping -w 1 -n 2 0.0.0.0 > nul
goto :waitfor_loop
)
echo Arthas agent telnet port is ready.
:attachSuccess
WHERE telnet
IF %ERRORLEVEL% NEQ 0 (
ECHO telnet wasn't found, please google how to install telnet under windows.
ECHO Try to visit http://127.0.0.1:%http_port% to connecto arthas server.
start http://127.0.0.1:%http_port%
) else (
telnet 127.0.0.1 %telnet_port%
)
echo(
echo Checking arthas telnet port [:%telnet_port%] ...
netstat -nao |findstr LIST |findstr :%telnet_port%
IF %ERRORLEVEL% EQU 0 (
echo Arthas agent is still running!
goto :choice
) else (
echo Arthas agent is shutdown.
goto :end
)
:choice
set /P c=Are you going to shutdown arthas agent [Y/N]?
echo input: %c%
if /I "%c%" EQU "Y" goto :shutdown_agent
if /I "%c%" EQU "N" goto :end
goto :choice
:shutdown_agent
echo Shutting down arthas ...
%JAVACMD% -jar arthas-client.jar -c shutdown 127.0.0.1 %telnet_port%
@rem check telnet port agian
echo Checking arthas telnet port [:%telnet_port%] ...
netstat -nao |findstr LIST |findstr :%telnet_port%
IF %ERRORLEVEL% EQU 0 (
echo Arthas shutdown failed!
) else (
echo Arthas shutdown successfully.
)
goto :end
:usage
echo Arthas for Windows Service.
echo Usage:
echo %filename% java_pid [option] ..
echo %filename% [-pid java_pid] [option] ..
echo %filename% [-port java_port] [option] ..
echo(
echo Options:
echo -pid java_pid : Attach by java process pid
echo -port java_port : Attach by java process listen port
echo -telnet-port port : Change arthas telnet port
echo -http-port port : Change arthas http/websocket port
echo --interact : Enable windows service interactive UI, useful for debug
echo --remove : Remove Arthas windows service
echo --ignore-tools : Ignore checking JAVA_HOME\lib\tools.jar for jdk 9/10/11
echo(
echo Example:
echo %filename% 2351
echo %filename% 2351 -telnet-port 2000 -http-port 2001
echo %filename% -pid 2351
echo %filename% -port 8080 --interact
echo %filename% --remove #remove arthas service
exit /b -1
:noJavaHome
echo JAVA_HOME: %JAVA_HOME%
echo The JAVA_HOME environment variable is not defined correctly.
echo It is needed to run this program.
echo NB: JAVA_HOME should point to a JDK not a JRE.
exit /b -1
:end
@echo off
REM ----------------------------------------------------------------------------
REM program : Arthas
REM author : Core Engine @ Taobao.com
REM date : 2015-11-11
REM version : 3.0
REM ----------------------------------------------------------------------------
set ERROR_CODE=0
set TELNET_PORT=3658
set HTTP_PORT=8563
set BASEDIR=%~dp0
if ["%~1"]==[""] (
echo Example:
echo %~nx0 452
echo %~nx0 452 --ignore-tools # for jdk 9/10/11
echo(
echo Need the pid argument, you can run jps to list all java process ids.
goto exit_bat
)
set JAVA_TOOL_OPTIONS
set AGENT_JAR=%BASEDIR%\arthas-agent.jar
set CORE_JAR=%BASEDIR%\arthas-core.jar
set PID=%1
echo %PID%| findstr /r "^[1-9][0-9]*$">nul
if %errorlevel% neq 0 (
echo PID is not valid number!
echo Example:
echo %~nx0 452
echo %~nx0 452 --ignore-tools # for jdk 9/10/11
echo(
echo Need the pid argument, you can run jps to list all java process ids.
goto exit_bat
)
REM parse extend args
set ignoreTools=0
set exitProcess=0
for %%a in (%*) do (
if "%%a"=="--no-interact" set exitProcess=1
if "%%a"=="--ignore-tools" set ignoreTools=1
)
REM from https://stackoverflow.com/a/35445653
:read_params
if not %1/==/ (
if not "%__var%"=="" (
if not "%__var:~0,1%"=="-" (
endlocal
goto read_params
)
endlocal & set %__var:~1%=%~1
) else (
setlocal & set __var=%~1
)
shift
goto read_params
)
if not "%telnet-port%"=="" set TELNET_PORT=%telnet-port%
if not "%http-port%"=="" set HTTP_PORT=%http-port%
echo JAVA_HOME: %JAVA_HOME%
echo telnet port: %TELNET_PORT%
echo http port: %HTTP_PORT%
REM Setup JAVA_HOME
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if %ignoreTools% == 1 (
echo Ignore tools.jar, make sure the java version ^>^= 9
) else (
if not exist "%JAVA_HOME%\lib\tools.jar" (
echo Can not find lib\tools.jar under %JAVA_HOME%!
echo If java version ^<^= 1.8, please make sure JAVA_HOME point to a JDK not a JRE.
echo If java version ^>^= 9, try to run as.bat ^<pid^> --ignore-tools
goto exit_bat
)
set BOOT_CLASSPATH="-Xbootclasspath/a:%JAVA_HOME%\lib\tools.jar"
)
set JAVACMD="%JAVA_HOME%\bin\java"
goto okJava
:noJavaHome
echo The JAVA_HOME environment variable is not defined correctly.
echo It is needed to run this program.
echo NB: JAVA_HOME should point to a JDK not a JRE.
goto exit_bat
:okJava
%JAVACMD% -Dfile.encoding=UTF-8 %BOOT_CLASSPATH% -jar "%CORE_JAR%" -pid "%PID%" -target-ip 127.0.0.1 -telnet-port %TELNET_PORT% -http-port %HTTP_PORT% -core "%CORE_JAR%" -agent "%AGENT_JAR%"
if %ERRORLEVEL% NEQ 0 goto exit_bat
if %exitProcess%==1 goto exit_bat
goto attachSuccess
:attachSuccess
WHERE telnet
IF %ERRORLEVEL% NEQ 0 (
ECHO telnet wasn't found, please google how to install telnet under windows.
ECHO Try to visit http://127.0.0.1:%HTTP_PORT% to connecto arthas server.
start http://127.0.0.1:%HTTP_PORT%
) else (
telnet 127.0.0.1 %TELNET_PORT%
)
:exit_bat
if %exitProcess%==1 exit %ERROR_CODE%
exit /B %ERROR_CODE%
This diff is collapsed.
#!/bin/bash
# define newest arthas's version
ARTHAS_VERSION=3.5.5
# define newest arthas's lib home
ARTHAS_LIB_HOME=${HOME}/.arthas/lib/${ARTHAS_VERSION}/arthas
# exit shell with err_code
# $1 : err_code
# $2 : err_msg
exit_on_err()
{
[[ ! -z "${2}" ]] && echo "${2}" 1>&2
exit ${1}
}
# install to local if necessary
if [[ ! -x ${ARTHAS_LIB_HOME} ]]; then
# install to local
mkdir -p ${ARTHAS_LIB_HOME} \
|| exit_on_err 1 "create target directory ${ARTHAS_LIB_HOME} failed."
# copy jar files
cp *.jar ${ARTHAS_LIB_HOME}/
# make it -x
chmod +x ./as.sh
fi
echo "install to local succeeded."
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="ARTHAS_LOG_PATH" value="${ARTHAS_LOG_PATH:-${user.home}/logs/arthas}" />
<property name="ARTHAS_LOG_FILE" value="${ARTHAS_LOG_FILE:-${ARTHAS_LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/arthas.log}" />
<property name="RESULT_LOG_FILE" value="${RESULT_LOG_FILE:-${ARTHAS_LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/../arthas-cache/result.log}" />
<!-- arthas.log -->
<appender name="ARTHAS" class="com.alibaba.arthas.deps.ch.qos.logback.core.rolling.RollingFileAppender">
<file>${ARTHAS_LOG_FILE}</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} -%msg%n</pattern>
</encoder>
<rollingPolicy class="com.alibaba.arthas.deps.ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${ARTHAS_LOG_FILE}.%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<maxHistory>7</maxHistory>
<maxFileSize>1MB</maxFileSize>
<totalSizeCap>10MB</totalSizeCap>
</rollingPolicy>
</appender>
<!-- result.log -->
<appender name="RESULT" class="com.alibaba.arthas.deps.ch.qos.logback.core.rolling.RollingFileAppender">
<file>${RESULT_LOG_FILE}</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} -%msg%n</pattern>
</encoder>
<rollingPolicy class="com.alibaba.arthas.deps.ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${RESULT_LOG_FILE}.%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<maxHistory>7</maxHistory>
<maxFileSize>1MB</maxFileSize>
<totalSizeCap>10MB</totalSizeCap>
</rollingPolicy>
</appender>
<logger name="result" level="INFO" additivity="false">
<appender-ref ref="RESULT" />
</logger>
<root level="INFO">
<appender-ref ref="ARTHAS" />
</root>
</configuration>
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<version>3.8.7</version>
<name>wst-be</name>
<description>万事通后台管理框架</description>
<properties>
<ruoyi.version>3.8.7</ruoyi.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<druid.version>1.2.20</druid.version>
<bitwalker.version>1.21</bitwalker.version>
<kaptcha.version>2.3.3</kaptcha.version>
<pagehelper.boot.version>1.2.3</pagehelper.boot.version>
<fastjson.version>2.0.43</fastjson.version>
<oshi.version>6.5.0</oshi.version>
<commons.io.version>2.13.0</commons.io.version>
<poi.version>4.1.2</poi.version>
<velocity.version>2.3</velocity.version>
<jwt.version>0.9.1</jwt.version>
</properties>
<!-- 依赖声明 -->
<dependencyManagement>
<dependencies>
<!-- SpringBoot的依赖配置-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.5.15</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- 阿里数据库连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<!-- 解析客户端操作系统、浏览器等 -->
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>${bitwalker.version}</version>
</dependency>
<!-- pagehelper 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.boot.version}</version>
</dependency>
<!-- 获取系统信息 -->
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>${oshi.version}</version>
</dependency>
<!-- io常用工具类 -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>
<!-- excel工具 -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<!-- velocity代码生成使用模板 -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>${velocity.version}</version>
</dependency>
<!-- 阿里JSON解析器 -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- Token生成与解析-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jwt.version}</version>
</dependency>
<!-- 验证码 -->
<dependency>
<groupId>pro.fessional</groupId>
<artifactId>kaptcha</artifactId>
<version>${kaptcha.version}</version>
</dependency>
<dependency>
<groupId>com.eazytec.platform</groupId>
<artifactId>eform-tool</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-quartz</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-generator</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-framework</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 系统模块-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 党建模块-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-party</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>${ruoyi.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>ruoyi-admin</module>
<module>ruoyi-framework</module>
<module>ruoyi-system</module>
<module>ruoyi-quartz</module>
<module>ruoyi-generator</module>
<module>ruoyi-common</module>
<module>ruoyi-party</module>
</modules>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>public</id>
<name>aliyun nexus</name>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>aliyun nexus</name>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
\ No newline at end of file
<?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>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.8.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>ruoyi-admin</artifactId>
<description>
web服务入口
</description>
<dependencies>
<!-- spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-framework</artifactId>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-quartz</artifactId>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-generator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.5.15</version>
<configuration>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</project>
\ No newline at end of file
package com.ruoyi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* 启动程序
*
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@EnableScheduling
@EnableTransactionManagement
@EnableAsync
public class RuoYiApplication
{
public static void main(String[] args)
{
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}
package com.ruoyi;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* web容器中进行部署
*
* @author ruoyi
*/
public class RuoYiServletInitializer extends SpringBootServletInitializer
{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
{
return application.sources(RuoYiApplication.class);
}
}
package com.ruoyi.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 io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
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.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.sign.Base64;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.service.system.ISysConfigService;
/**
* 验证码操作处理
*
* @author ruoyi
*/
@Api(tags = "基础服务 - 验证码操作处理")
@RestController
public class CaptchaController
{
@Resource(name = "captchaProducer")
private Producer captchaProducer;
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache;
@Autowired
private ISysConfigService configService;
/**
* 生成验证码
*/
@GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException
{
AjaxResult ajax = AjaxResult.success();
boolean captchaEnabled = configService.selectCaptchaEnabled();
ajax.put("captchaEnabled", captchaEnabled);
if (!captchaEnabled)
{
return ajax;
}
// 保存验证码信息
String uuid = IdUtils.simpleUUID();
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
String capStr = null, code = null;
BufferedImage image = null;
// 生成验证码
String captchaType = RuoYiConfig.getCaptchaType();
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());
}
ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray()));
return ajax;
}
}
package com.ruoyi.web.controller.common;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.framework.config.ServerConfig;
/**
* 通用请求处理
*
* @author ruoyi
*/
@Api(tags = "基础服务 - 通用请求处理")
@RestController
@RequestMapping("/common")
public class CommonController
{
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Autowired
private ServerConfig serverConfig;
private static final String FILE_DELIMETER = ",";
/**
* 通用下载请求
*
* @param fileName 文件名称
* @param delete 是否删除
*/
@GetMapping("/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 = RuoYiConfig.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("/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success();
ajax.put("url", url);
ajax.put("fileName", fileName);
ajax.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename());
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
* 通用上传请求(多个)
*/
@PostMapping("/uploads")
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
List<String> urls = new ArrayList<String>();
List<String> fileNames = new ArrayList<String>();
List<String> newFileNames = new ArrayList<String>();
List<String> originalFilenames = new ArrayList<String>();
for (MultipartFile file : files)
{
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
urls.add(url);
fileNames.add(fileName);
newFileNames.add(FileUtils.getName(fileName));
originalFilenames.add(file.getOriginalFilename());
}
AjaxResult ajax = AjaxResult.success();
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
* 本地资源通用下载
*/
@GetMapping("/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 = RuoYiConfig.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.ruoyi.web.controller.common;
import com.easytec.oss.sdk.core.OssClient;
import com.easytec.oss.sdk.dto.EfsRequest;
import com.easytec.oss.sdk.dto.RequestResult;
import com.easytec.oss.sdk.dto.UploadRes;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.UUID;
/**
* @author condey
* @version $$package: com.ruoyi.web.controller.common, v 0.1 2024/6/12 10:57 AM condey Exp $$
*/
@Api(tags = "基础服务 - EFS文件上传")
@RestController
@RequestMapping("/efs")
public class EfsController {
@Value("${app.zqt_id}")
private String appId;
@ApiOperation("图片/视频上传")
@PostMapping(value = "upload", headers = "content-type=multipart/form-data")
public AjaxResult upload(@ApiParam(name = "file", value = "上传文件", required = true)MultipartFile file) {
OssClient ossClient = new OssClient("https://api-efs.eazytec-cloud.com");
String fileName = file.getOriginalFilename();
String prefix = fileName.substring(fileName.lastIndexOf("."));
File tempFile;
try {
tempFile = File.createTempFile(UUID.randomUUID().toString(), prefix);
file.transferTo(tempFile);
EfsRequest efsRequest = new EfsRequest();
efsRequest.setAppId(appId);
efsRequest.setFileName(fileName);
efsRequest.setLiveDay(0);
/**同步上传(随机路径)**/
RequestResult<UploadRes> result = ossClient.syncUpload(tempFile, efsRequest);
return AjaxResult.success(result.getData());
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("上传文件失败");
}
}
}
package com.ruoyi.web.controller.form;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.form.MdFormCategory;
import com.ruoyi.system.domain.form.params.FormQuery;
import com.ruoyi.system.service.form.FormCategoryManager;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 表单分类
*/
@Api(tags = "在线表单 - 表单分类")
@RestController
@RequestMapping("/api/form/category")
public class FormCategoryController extends BaseController {
@Autowired
private FormCategoryManager formCategoryManager;
/**
* @return com.eazytec.zqtong.common.model.AjaxResult
* @Author wp
* @Description //表单分类 查询不分页。
* @Date 10:36 2020/8/17
* @Param [query]
**/
@GetMapping(value = "/list")
@ResponseBody
public AjaxResult list(FormQuery formQuery) {
try {
return AjaxResult.success(formCategoryManager.query(formQuery));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
/**
* 所有表单分类
* @return
*/
@GetMapping(value = "/listAll")
@ResponseBody
public AjaxResult listAll() {
try {
return AjaxResult.success(formCategoryManager.categoryList());
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
/**
* @return com.eazytec.zqtong.common.model.AjaxResult
* @Author wp
* @Description //保存/更新
* @Date 13:06 2020/8/17
* @Param [mdFormCategory]
**/
@RequestMapping(value = "/saveOrUpdate", method = RequestMethod.POST)
@ResponseBody
public AjaxResult saveOrUpdateSetting(@RequestBody MdFormCategory mdFormCategory) {
try {
return AjaxResult.success(formCategoryManager.saveOrUpdate(mdFormCategory));
} catch (RuntimeException e1) {
return AjaxResult.build(600, e1.getMessage(), e1.getMessage());
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
@RequestMapping(value = "/deleteById", method = RequestMethod.POST)
@ResponseBody
public AjaxResult deleteById(@RequestBody MdFormCategory mdFormCategory) {
try {
int count = formCategoryManager.deleteById(mdFormCategory);
if (count > 0) {
return AjaxResult.success("删除成功");
}
return AjaxResult.build(500, "删除失败", "删除失败");
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
}
package com.ruoyi.web.controller.form;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.form.MdForm;
import com.ruoyi.system.domain.form.enums.EnumFormStatus;
import com.ruoyi.system.domain.form.params.FormAddTemplateBody;
import com.ruoyi.system.domain.form.params.FormCopyBody;
import com.ruoyi.system.domain.form.params.FormQuery;
import com.ruoyi.system.service.form.FormManager;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 表单
*/
@Api(tags = "在线表单 - 表单管理")
@RestController
@RequestMapping("/api/form")
public class FormController extends BaseController {
@Autowired
private FormManager formManager;
@GetMapping(value = "/list")
@ResponseBody
public AjaxResult list(FormQuery query) {
if (query == null) {
return AjaxResult.build(400, "参数异常", "query参数不能为空");
}
try {
query.setStatus(EnumFormStatus.normal.code);
return AjaxResult.success(formManager.query(query));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
@GetMapping(value = "/detail")
@ResponseBody
public AjaxResult detail(@RequestParam(name = "id") String id) {
if (StringUtils.isBlank(id)) {
return AjaxResult.build(400, "参数异常", "id不能为空");
}
try {
return AjaxResult.success(formManager.detail2(id));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
@PostMapping(value = "/save")
@ResponseBody
public AjaxResult save(@RequestBody MdForm body) {
try {
return AjaxResult.success(formManager.save(body));
} catch (RuntimeException e1) {
return AjaxResult.build(600, e1.getMessage(), e1.getMessage());
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
@PostMapping(value = "/deleteById")
@ResponseBody
public AjaxResult deleteById(@RequestBody MdForm body) {
try {
int count = formManager.deleteById(body);
if (count > 0) {
return AjaxResult.success("删除成功");
}
return AjaxResult.build(500, "删除失败", "删除失败");
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
@PostMapping(value = "/publish")
@ResponseBody
public AjaxResult publish(@RequestBody FormAddTemplateBody body) {
try {
formManager.publish(body);
return AjaxResult.build(200, "发布成功", "发布成功");
} catch (RuntimeException e1) {
return AjaxResult.build(600, e1.getMessage(), e1.getMessage());
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
@GetMapping(value = "/readAuth")
@ResponseBody
public AjaxResult readAuth(@RequestParam(name = "userId") String userId, @RequestParam(name = "formId") String formId) {
if (StringUtils.isEmpty(userId) || StringUtils.isEmpty(formId)) {
return AjaxResult.build(400, "参数异常", "参数不能为空");
}
try {
return formManager.readAuth(userId, formId);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
/**
* @return com.eazytec.zqtong.common.model.AjaxResult
* @Author wp
* @Description //复制功能
* @Date 11:16 2020/8/20
* @Param [body]
**/
@PostMapping(value = "/copy")
@ResponseBody
public AjaxResult copy(@RequestBody FormCopyBody formCopyBody) {
if (StringUtils.isEmpty(formCopyBody.getFormId()) ||
StringUtils.isEmpty(formCopyBody.getName())
) {
return AjaxResult.build(400, "参数异常", "参数不能为空");
}
try {
int count = formManager.copyForm(formCopyBody);
if (count > 0) {
return AjaxResult.success("复制成功");
}
return AjaxResult.build(500, "服务器内部错误", "复制失败");
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
/**
* @return com.eazytec.zqtong.common.model.AjaxResult
* @Author wp
* @Description //手动关闭收集
* @Date 10:45 2020/8/21
* @Param [id]
**/
@PostMapping(value = "/stopById")
@ResponseBody
public AjaxResult stopById(@RequestParam(name = "id") String id) {
if (StringUtils.isBlank(id)) {
return AjaxResult.build(400, "参数异常", "id不能为空");
}
try {
return AjaxResult.success(formManager.stopById(id));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
}
package com.ruoyi.web.controller.form;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.form.MdFormRecord;
import com.ruoyi.system.domain.form.params.FormRecordQuery;
import com.ruoyi.system.service.form.FormManager;
import com.ruoyi.system.service.form.FormRecordManager;
import io.swagger.annotations.Api;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* 表单数据
*/
@Api(tags = "在线表单 - 表单数据")
@RestController
@RequestMapping("/api/form/record")
public class FormRecordController extends BaseController {
@Autowired
private FormRecordManager recordManager;
@PostMapping(value = "/mind")
@ResponseBody
public AjaxResult mind(@RequestParam(name = "form_id") String form_id,
@RequestParam(name = "noRecord", defaultValue = "0") Integer noRecord) {
if (StringUtils.isBlank(form_id)) {
return AjaxResult.build(400, "参数异常", "form_id参数不能为空");
}
try {
//true 代表发送短信
recordManager.mind(form_id, noRecord, false);
return AjaxResult.success("成功");
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
/**
* 表单标签
*/
@RequestMapping(value = "/labels", method = RequestMethod.GET)
@ResponseBody
public AjaxResult queryLabels(@RequestParam(name = "id") String id) {
if (StringUtils.isBlank(id)) {
return AjaxResult.build(400, "参数异常", "id不能为空");
}
return AjaxResult.success(recordManager.formLabels(id));
}
@GetMapping(value = "/list")
@ResponseBody
public AjaxResult list(FormRecordQuery query) {
if (query == null) {
return AjaxResult.build(400, "参数异常", "query参数不能为空");
}
query.setUserId(getUserId());
try {
return AjaxResult.success(recordManager.list(query));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
@GetMapping(value = "/commit/list")
@ResponseBody
public AjaxResult commit_list(FormRecordQuery query) {
if (query == null || StringUtils.isBlank(query.getForm_id())) {
return AjaxResult.build(400, "参数异常", "query参数不能为空");
}
try {
query.setCommit_status(1);
return AjaxResult.success(recordManager.queryCommit(query));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
@GetMapping(value = "/no/list")
@ResponseBody
public AjaxResult no_list(FormRecordQuery query) {
if (query == null || StringUtils.isBlank(query.getForm_id())) {
return AjaxResult.build(400, "参数异常", "query参数不能为空");
}
try {
query.setCommit_status(0);
return AjaxResult.success(recordManager.queryNoCommit(query));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
@Anonymous
@GetMapping(value = "/export")
public void export(FormRecordQuery query, HttpServletResponse response) throws IOException {
if (query == null || StringUtils.isBlank(query.getForm_id())) {
throw new RuntimeException("参数异常");
}
query.setCommit_status(1);
recordManager.export(response, query);
}
@GetMapping(value = "/no/export")
public void no_export(FormRecordQuery query, HttpServletResponse response) throws IOException {
if (query == null || StringUtils.isBlank(query.getForm_id())) {
throw new RuntimeException("参数异常");
}
query.setCommit_status(0);
recordManager.no_export(response, query);
}
@PostMapping(value = "/save")
@ResponseBody
public AjaxResult save(@RequestBody MdFormRecord body) {
try {
return AjaxResult.success("操作成功",recordManager.save(body));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
@GetMapping(value = "/detail")
@ResponseBody
public AjaxResult detail(@RequestParam(name = "id") String id) {
if (StringUtils.isBlank(id)) {
return AjaxResult.build(400, "参数异常", "id不能为空");
}
try {
return AjaxResult.success(recordManager.detail(id));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
/**
* 删除
*/
@PostMapping(value = "/delete")
public AjaxResult delete(@RequestBody List<String> ids) {
if (CollectionUtils.isEmpty(ids)) {
return AjaxResult.build(400, "参数异常", "id不能为空");
}
return AjaxResult.success(recordManager.deleteRecord(ids));
}
/**
* s
* 导入模版
*/
@GetMapping(value = "/import/template")
public void import_template(@RequestParam(name = "formId", required = true) String formId, HttpServletResponse res) throws IOException {
if (StringUtils.isBlank(formId)) {
throw new RuntimeException("参数异常");
}
recordManager.importTemplate(res, formId);
}
}
package com.ruoyi.web.controller.form;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.form.MdFormTemplate;
import com.ruoyi.system.domain.form.params.FormTemplateQuery;
import com.ruoyi.system.service.form.FormTemplateManager;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 表单模板
*/
@Api(tags = "在线表单 - 表单模板")
@RestController
@RequestMapping("/api/form/template")
public class FormTemplateController extends BaseController {
@Autowired
private FormTemplateManager formTemplateManager;
/**
* @return com.eazytec.zqtong.common.model.AjaxResult
* @Author wp
* @Description //模板 查询
* @Date 10:36 2020/8/17
* @Param [query]
**/
@GetMapping(value = "/list")
@ResponseBody
public AjaxResult list(FormTemplateQuery mdFormTemplate) {
try {
//query.setStatus(EnumFormStatus.normal.code);
return AjaxResult.success(formTemplateManager.queryAll(mdFormTemplate));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
/**
* @return com.eazytec.zqtong.common.model.AjaxResult
* @Author wp
* @Description //模板计数
* @Date 18:40 2020/8/20
* @Param [mdFormTemplate]
**/
@GetMapping(value = "/templateCount")
@ResponseBody
public AjaxResult templateCount(MdFormTemplate mdFormTemplate) {
try {
//query.setStatus(EnumFormStatus.normal.code);
return AjaxResult.success(formTemplateManager.templateCount(mdFormTemplate));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
/**
* @return com.eazytec.zqtong.common.model.AjaxResult
* @Author wp
* @Description //模板 查询
* @Date 10:36 2020/8/17
* @Param [query]
**/
@GetMapping(value = "/selectOneById")
@ResponseBody
public AjaxResult selectOneById(String id) {
if (StringUtils.isEmpty(id)) {
return AjaxResult.build(400, "参数异常", "id不能为空");
}
try {
//query.setStatus(EnumFormStatus.normal.code);
return AjaxResult.success(formTemplateManager.queryOneWithBlob(id));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
/**
* @return com.eazytec.zqtong.common.model.AjaxResult
* @Author wp
* @Description //创建模板
* @Date 13:28 2020/8/17
* @Param [mdFormCategory]
**/
@RequestMapping(value = "/saveOrUpdate", method = RequestMethod.POST)
@ResponseBody
public AjaxResult saveOrUpdateSetting(@RequestBody MdFormTemplate mdFormTemplate) {
try {
int count = formTemplateManager.saveOrUpdate(mdFormTemplate);
if (count > 0) {
return AjaxResult.success("操作成功");
}
return AjaxResult.build(500, "服务器内部错误", "操作失败");
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(400, "模板名称已存在!", e.getMessage());
}
}
@RequestMapping(value = "/deleteById", method = RequestMethod.POST)
@ResponseBody
public AjaxResult deleteById(@RequestBody MdFormTemplate mdFormTemplate) {
try {
//query.setStatus(EnumFormStatus.normal.code);
int count = formTemplateManager.deleteById(mdFormTemplate.getId());
if (count > 0) {
return AjaxResult.success("删除成功");
}
return AjaxResult.build(500, "服务器内部错误", "删除失败");
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
}
package com.ruoyi.web.controller.grid;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanCopyUtil;
import com.ruoyi.common.zqt.ZQTPageUtil;
import com.ruoyi.system.domain.grid.GridCompany;
import com.ruoyi.system.domain.grid.GridCompanyEconomy;
import com.ruoyi.system.domain.grid.GridCompanyPeople;
import com.ruoyi.system.domain.grid.GridRegion;
import com.ruoyi.system.domain.grid.enums.GridCompanyLevelEnum;
import com.ruoyi.system.domain.grid.ext.GridCompanyExt;
import com.ruoyi.system.domain.grid.ext.GridCompanyPeopleExt;
import com.ruoyi.system.domain.grid.vo.GridCompanySearchParam;
import com.ruoyi.system.domain.other.BsCommon;
import com.ruoyi.system.service.grid.GridCompanyPeopleService;
import com.ruoyi.system.service.grid.GridCompanyService;
import com.ruoyi.system.service.grid.GridRegionService;
import com.ruoyi.system.service.other.BsCommonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author : peter
* @date : 2022-05-09 14:33
*/
@Api(tags = "网格管理 - 企业管理")
@RestController
@RequestMapping("/api/grid/company")
public class CompanyController extends BaseController {
@Autowired
private GridCompanyService gridCompanyService;
@Autowired
private GridCompanyPeopleService gridCompanyPeopleService;
@Autowired
private BsCommonService bsCommonService;
@Autowired
private GridRegionService gridRegionService;
@RequestMapping(value = "/page", method = RequestMethod.GET)
public AjaxResult page(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "wgCode", required = false) String wgCode,
@RequestParam(value = "qylxCode", required = false) String qylxCode,
@RequestParam(value = "creditCode", required = false) String creditCode,
@RequestParam(value = "value", required = false) String value,
@RequestParam(value = "isClosed", required = false) Byte isClosed,
@RequestParam(value = "isUnowned", required = false) Byte isUnowned) {
try {
GridCompany wsCompany = new GridCompany();
wsCompany.setWgCode(wgCode);
wsCompany.setQylxCode(qylxCode);
wsCompany.setCreditCode(creditCode);
wsCompany.setIsClosed(isClosed);
wsCompany.setIsUnowned(isUnowned);
PageHelper.startPage(pageNum, pageSize);
PageInfo<GridCompanyExt> pageInfo = gridCompanyService.page(wsCompany, value);
return AjaxResult.success(pageInfo);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error(500, "服务器内部错误");
}
}
/**
* 保存
*/
@PostMapping(value = "/add")
public AjaxResult add(@RequestBody GridCompany wsCompany) {
wsCompany.setCreateId(getUserId());
return gridCompanyService.add(wsCompany);
}
/**
* 修改
*/
@PostMapping(value = "/edit")
public AjaxResult edit(@RequestBody GridCompany wsCompany) {
wsCompany.setUpdateId(getUserId());
return gridCompanyService.edit(wsCompany);
}
/**
* 详情
*/
@GetMapping(value = "/detail/{id}")
public AjaxResult detail(@PathVariable("id") String id) {
return gridCompanyService.detail(id);
}
/**
* 通过id删除
*/
@GetMapping(value = "/delete")
public AjaxResult delete(@RequestParam(value = "id") String id) {
return gridCompanyService.delete(id);
}
/**
* 通过统一社会信用代码查询详情
*/
@GetMapping(value = "/detail")
public AjaxResult detailByCreditCode(@RequestParam(value = "creditCode") String creditCode) {
return gridCompanyService.detailByCreditCode(creditCode);
}
/**
* 企业所在地块的其他企业
*/
@GetMapping(value = "/otherCompanyPage")
public AjaxResult otherCompany(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "creditCode") String creditCode,
@RequestParam(value = "wgCode") String wgCode) {
PageHelper.startPage(pageNum, pageSize);
PageInfo<GridCompany> pageInfo = new PageInfo<>(gridCompanyService.otherCompany(creditCode, wgCode));
return AjaxResult.success(pageInfo);
}
/**
* 企业经济数据
*/
@GetMapping(value = "/economyPage")
public AjaxResult economy(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "creditCode") String creditCode,
@RequestParam(value = "belongTime", required = false) String belongTime) {
PageHelper.startPage(pageNum, pageSize);
PageInfo<GridCompanyEconomy> pageInfo = new PageInfo<>(gridCompanyService.economy(creditCode, belongTime));
return AjaxResult.success(pageInfo);
}
/**
* 企业关联人口信息
*/
@GetMapping(value = "/companyToPeoplePage")
public AjaxResult companyToPeoplePage(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "companyId", required = false) String companyId,
@RequestParam(value = "creditCode", required = false) String creditCode) {
try {
PageHelper.startPage(pageNum, pageSize);
List<GridCompanyPeople> companyPeopleList = gridCompanyPeopleService.selectGridCompanyPeopleByCompanyId(companyId, creditCode, null);
List<GridCompanyPeopleExt> companyPeopleExtList = BeanCopyUtil.bathToBean(companyPeopleList, GridCompanyPeopleExt.class);
Map<String, String> regionMap = gridRegionService.getGridRegionMap().stream().collect(Collectors.toMap(GridRegion::getWgCode, GridRegion::getWgName));
Map<String, String> commonMap = bsCommonService.getBsCommonMap().stream().collect(Collectors.toMap(BsCommon::getCode, BsCommon::getName));
for (GridCompanyPeopleExt c : companyPeopleExtList) {
gridCompanyPeopleService.selectGridCompanyPeopleExt(regionMap, commonMap, c, false, true);
}
PageInfo<GridCompanyPeopleExt> pageInfo = ZQTPageUtil.build(companyPeopleList, companyPeopleExtList);
return AjaxResult.success(pageInfo);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error(500, "服务器内部错误");
}
}
/**
* 企业绑定人口信息
*/
@PostMapping(value = "/companyBindPeople")
public AjaxResult companyBindPeople(@RequestBody GridCompanyPeople wsCompanyPeople) {
return gridCompanyService.companyBindPeople(wsCompanyPeople);
}
/**
* 企业解绑人口信息
*/
@GetMapping(value = "/companyUnbindPeople")
public AjaxResult companyUnbindPeople(@RequestParam(value = "id") String id) {
gridCompanyPeopleService.deleteByStringPrimaryKey(id);
return AjaxResult.success(null);
}
/**
* 企业信息excel导入
*/
@PostMapping(value = "import", headers = "content-type=multipart/form-data")
public AjaxResult importExcel(@RequestParam(value = "file") MultipartFile file,
@RequestParam(value = "createId") String createId) {
return gridCompanyService.importExcel(file, createId);
}
@ApiOperation("企业等级枚举")
@GetMapping("/level/enum")
public AjaxResult companyLevel(){
Map<String, String> map = new LinkedHashMap<>();
map.put(GridCompanyLevelEnum.RED.getCode(), GridCompanyLevelEnum.RED.getValue());
map.put(GridCompanyLevelEnum.YELLOW.getCode(), GridCompanyLevelEnum.YELLOW.getValue());
map.put(GridCompanyLevelEnum.GREEN.getCode(), GridCompanyLevelEnum.GREEN.getValue());
return AjaxResult.success(map);
}
@ApiOperation("所有企业列表")
@GetMapping("/allCompanyList")
public AjaxResult getCompanyList(@RequestParam(value = "wgCode")String wgCode){
GridCompanySearchParam param = new GridCompanySearchParam();
if(StringUtils.isNotBlank(wgCode)){
param.setWgCodeLikes(Arrays.asList(wgCode.split(",")));
}
return AjaxResult.success(gridCompanyService.getAllCompanyList(param));
}
}
package com.ruoyi.web.controller.grid;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.service.grid.GridCompanyEconomyService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author : peter
* @description: TODO
* @date : 2022-05-10 08:47
*/
@Api(tags = "数据看板 - 企业经济统计")
@RestController
@RequestMapping("/api/grid/company/economy")
public class CompanyEconomyController {
@Autowired
private GridCompanyEconomyService gridCompanyEconomyService;
@PostMapping(value = "import", headers = "content-type=multipart/form-data")
public AjaxResult importExcel(@RequestParam(value = "file") MultipartFile file,
@RequestParam(value = "belongTime") String belongTime) {
return gridCompanyEconomyService.importExcel(file, belongTime);
}
@GetMapping(value = "/getNowYearCount")
public AjaxResult getNowYearCount(String wgCode) {
return AjaxResult.success(gridCompanyEconomyService.getNowYearCount(wgCode));
}
@GetMapping(value = "/getMonthCount")
public AjaxResult getMonthCount(@RequestParam(value = "year") Integer year) {
return AjaxResult.success(gridCompanyEconomyService.getMonthCount(year));
}
@GetMapping(value = "/getTopTenCount")
public AjaxResult getTopTenCount(String wgCode, String type) {
return AjaxResult.success(gridCompanyEconomyService.getTopTenCount(wgCode, type));
}
}
package com.ruoyi.web.controller.grid;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.grid.GridCompanyEconomyInfo;
import com.ruoyi.system.domain.grid.ext.GridCompanyEconomyInfoExt;
import com.ruoyi.system.service.grid.GridCompanyEconomyInfoService;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 企业经济信息
*/
@Api(tags = "数据看板 - 企业经济信息")
@RestController
@RequestMapping("/api/grid/company/economyIfo")
public class CompanyEconomyInfoController {
@Autowired
private GridCompanyEconomyInfoService companyEconomyInfoService;
@PostMapping(value = "import", headers = "content-type=multipart/form-data")
public AjaxResult importExcel(@RequestParam(value = "file") MultipartFile file) {
return companyEconomyInfoService.importExcel(file);
}
/**
* 不分页查询企业经济信息
*
* @param companyId
* @return
*/
@GetMapping(value = "/list")
public AjaxResult list(@RequestParam(name = "companyId") String companyId) {
Map<String, Object> result = new HashMap<>();
List<GridCompanyEconomyInfo> infos = companyEconomyInfoService.listEconomyInfos(companyId, null);
result.put("list", infos);
return AjaxResult.success(result);
}
/**
* 分页查询企业经济信息
*/
@GetMapping(value = "/page")
public AjaxResult page(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(value = "companyKeyword", required = false) String companyKeyword,
@RequestParam(value = "qylxCode", required = false) String qylxCode,
@RequestParam(value = "year", required = false) String year,
@RequestParam(value = "orderType", defaultValue = "desc") String orderType,
@RequestParam(value = "orderValue", defaultValue = "year") String orderValue) {
return AjaxResult.success(companyEconomyInfoService.pageEconomyInfos(pageNo, pageSize, year, qylxCode, companyKeyword, orderValue, orderType));
}
/**
* 检查是否需要覆盖
*/
@GetMapping(value = "/check")
public AjaxResult check(@RequestParam(value = "year") String year,
@RequestParam(name = "companyId") String companyId) {
if (StringUtils.isBlank(year) || StringUtils.isBlank(companyId)) {
return AjaxResult.error(400, "缺少必要参数");
}
return AjaxResult.success(companyEconomyInfoService.checkIsExist(year, companyId));
}
/**
* 保存
*/
@PostMapping(value = "/save")
public AjaxResult save(@RequestBody GridCompanyEconomyInfoExt infoExt) {
companyEconomyInfoService.save(infoExt);
return AjaxResult.success("提交成功");
}
/**
* 详情
*/
@GetMapping(value = "/detail/{id}")
public AjaxResult detail(@PathVariable("id") String id) {
return AjaxResult.success(companyEconomyInfoService.detail(id));
}
/**
* 删除
*/
@GetMapping(value = "/delete/{id}")
public AjaxResult delete(@PathVariable("id") String id) {
companyEconomyInfoService.delete(id);
return AjaxResult.success("删除成功");
}
/**
* 亩均经济比例统计
*/
@GetMapping(value = "/perMu/count")
public AjaxResult perMuCount(@RequestParam(value = "year") String year) {
if (StringUtils.isBlank(year)) {
return AjaxResult.error(400, "缺少必要参数");
}
return AjaxResult.success(companyEconomyInfoService.perMuCount(year));
}
/**
* 村级销售排名统计
*/
@GetMapping(value = "/sale/count")
public AjaxResult saleCount(@RequestParam(value = "year") String year) {
if (StringUtils.isBlank(year)) {
return AjaxResult.error(400, "缺少必要参数");
}
return AjaxResult.success(companyEconomyInfoService.saleCount(year));
}
/**
* 村级税收排名统计
*/
@GetMapping(value = "/tax/count")
public AjaxResult taxCount(@RequestParam(value = "year") String year) {
if (StringUtils.isBlank(year)) {
return AjaxResult.error(400, "缺少必要参数");
}
return AjaxResult.success(companyEconomyInfoService.taxCount(year));
}
/**
* 地块信息统计
*/
@GetMapping(value = "/group/info")
public AjaxResult groupInfo(@RequestParam(value = "landId") String landId, @RequestParam(value = "year") String year) {
if (StringUtils.isBlank(year) || StringUtils.isBlank(landId)) {
return AjaxResult.error(400, "缺少必要参数");
}
return AjaxResult.success(companyEconomyInfoService.loadCompanyLandInfo(landId, year));
}
}
\ No newline at end of file
package com.ruoyi.web.controller.grid;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.grid.GridCompanyLand;
import com.ruoyi.system.domain.grid.GridCompanyLandExample;
import com.ruoyi.system.service.grid.GridCompanyLandService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author : yaoqiang
* @description: 经济地块与企业关联
* @date : 2023-04-20 16:09
*/
@Api(tags = "网格管理 - 经济地块与企业关联")
@RestController
@RequestMapping("/api/grid/company/land")
public class CompanyLandController {
@Autowired
private GridCompanyLandService gridCompanyLandService;
@GetMapping(value = "/page")
public AjaxResult page(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "companyId", required = false) String companyId,
@RequestParam(name = "landId", required = false) String landId,
@RequestParam(name = "landPurpose", required = false) String landPurpose) {
return AjaxResult.success(gridCompanyLandService.page(pageNo, pageSize, companyId, landId, landPurpose));
}
/**
* 保存/修改
*/
@PostMapping(value = "/saveOrUpdate")
public AjaxResult saveOrUpdate(@RequestBody GridCompanyLand wsCompanyLand) {
return gridCompanyLandService.saveOrUpdate(wsCompanyLand);
}
/**
* 详情
*/
@GetMapping(value = "/detail")
public AjaxResult detail(@RequestParam(value = "id") String id) {
return AjaxResult.success(gridCompanyLandService.detail(id));
}
/**
* 删除
*/
@GetMapping(value = "/delete")
public AjaxResult delete(@RequestParam(value = "id") String id) {
gridCompanyLandService.delete(id);
return AjaxResult.success("success");
}
/**
* 企业地块信息统计
* 总的经济地块数量,对应的企业数,对应的集团数,年度销售总数,年度税收总数,年度亩均税收数
*/
@GetMapping(value = "bigScreen/info/statistic")
public AjaxResult infoStatistic(@RequestParam(value = "year", required = false) String year) {
return AjaxResult.success(gridCompanyLandService.infoStatistic(year));
}
/**
* 地块租赁情况统计
*/
@GetMapping(value = "bigScreen/lease/statistic")
public AjaxResult leaseStatistic() {
return AjaxResult.success(gridCompanyLandService.leaseStatistic());
}
/**
* 地块亩均税收排名
*/
@GetMapping(value = "bigScreen/permuSort/list")
public AjaxResult permuSortList(@RequestParam(value = "year", required = false) String year) {
return AjaxResult.success(gridCompanyLandService.permuSortList(year));
}
/**
* 地块下的企业个数
* @return
*/
@GetMapping("/companyCount")
public AjaxResult companyCount(@RequestParam("landId")String landId){
GridCompanyLandExample example = new GridCompanyLandExample();
GridCompanyLandExample.Criteria criteria = example.createCriteria();
criteria.andLandIdEqualTo(landId);
criteria.andIsValidEqualTo("1");
return AjaxResult.success(gridCompanyLandService.countByExample(example));
}
}
package com.ruoyi.web.controller.grid;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.grid.GridCompanyLandRemark;
import com.ruoyi.system.service.grid.GridCompanyLandRemarkService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author : yaoqiang
* @description: 经济地块与企业关联备注
* @date : 2023-04-23 11:09
*/
@Api(tags = "网格管理 - 经济地块与企业关联备注")
@RestController
@RequestMapping("/api/grid/company/land/remark")
public class CompanyLandRemarkController {
@Autowired
private GridCompanyLandRemarkService gridCompanyLandRemarkService;
@GetMapping(value = "/page")
public AjaxResult page(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
return AjaxResult.success(gridCompanyLandRemarkService.page(pageNo, pageSize));
}
/**
* 保存/修改
*/
@PostMapping(value = "/saveOrUpdate")
public AjaxResult saveOrUpdate(@RequestBody GridCompanyLandRemark wsCompanyLandRemark) {
return gridCompanyLandRemarkService.saveOrUpdate(wsCompanyLandRemark);
}
/**
* 详情
*/
@GetMapping(value = "/detail")
public AjaxResult detail(@RequestParam(name = "companyId", required = false) String companyId) {
return AjaxResult.success(gridCompanyLandRemarkService.detail(companyId));
}
}
package com.ruoyi.web.controller.grid;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.grid.ext.GridCompanyLawArchivesExt;
import com.ruoyi.system.domain.grid.vo.GridCompanyLawArchivesParam;
import com.ruoyi.system.service.grid.GridCompanyLawArchivesService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 企业执法档案
*/
@Api(tags = "公司信息-执法档案")
@RestController
@RequestMapping("/api/grid/company/lawArchives")
public class CompanyLawArchivesController {
@Autowired
GridCompanyLawArchivesService wsCompanyLawArchivesService;
/**
* 分页查询执法档案列表
*/
@GetMapping(value = "/page")
public AjaxResult page(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "archivesNo", required = false) String archivesNo,
@RequestParam(name = "wgCode", required = false) String wgCode,
@RequestParam(name = "companyId", required = false) String companyId,
@RequestParam(name = "companyName", required = false) String companyName,
@RequestParam(name = "companyType", required = false) String companyType,
@RequestParam(name = "createUserId", required = false) String createUserId,
@RequestParam(name = "creditCode", required = false) String creditCode,
@RequestParam(name = "archivesType", required = false) String archivesType,
@RequestParam(name = "startTime", required = false) String startTime,
@RequestParam(name = "endTime", required = false) String endTime) {
GridCompanyLawArchivesParam param = new GridCompanyLawArchivesParam();
param.setWgCode(wgCode);
param.setCompanyName(companyName);
param.setCompanyType(companyType);
param.setStartTime(startTime);
param.setEndTime(endTime);
param.setCompanyId(companyId);
param.setCreateUserId(createUserId);
param.setCreditCode(creditCode);
param.setArchivesType(archivesType);
param.setArchivesNo(archivesNo);
return AjaxResult.success(wsCompanyLawArchivesService.pageInfos(param, pageNo, pageSize));
}
/**
* 保存
*/
@PostMapping(value = "/add")
public AjaxResult add(@RequestBody GridCompanyLawArchivesExt archivesExt) {
wsCompanyLawArchivesService.save(archivesExt);
return AjaxResult.success("提交成功");
}
/**
* 保存
*/
@PostMapping(value = "/update")
public AjaxResult update(@RequestBody GridCompanyLawArchivesExt archivesExt) {
wsCompanyLawArchivesService.update(archivesExt);
return AjaxResult.success("提交成功");
}
/**
* 详情
*/
@GetMapping(value = "/detail/{id}")
public AjaxResult detail(@PathVariable("id") String id) {
return AjaxResult.success(wsCompanyLawArchivesService.detail(id));
}
/**
* 删除
*/
@GetMapping(value = "/delete/{id}")
public AjaxResult delete(@PathVariable("id") String id) {
wsCompanyLawArchivesService.delete(id);
return AjaxResult.success("删除成功");
}
}
package com.ruoyi.web.controller.grid;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.qcc.EsearchJsonRecord;
import com.ruoyi.system.domain.qcc.EsearchLog;
import com.ruoyi.system.domain.qcc.EsearchRecord;
import com.ruoyi.system.domain.qcc.enums.EsearchTypeEnum;
import com.ruoyi.system.domain.qcc.enums.EsearchWayEnum;
import com.ruoyi.system.domain.qcc.ext.EsearchRecordExt;
import com.ruoyi.system.domain.qcc.ext.EsearchResult;
import com.ruoyi.system.domain.qcc.factory.EsearchFactory;
import com.ruoyi.system.domain.qcc.util.FinalCostHttpHelper;
import com.ruoyi.system.service.grid.qcc.impl.EsearchJsonRecordService;
import com.ruoyi.system.service.grid.qcc.impl.EsearchLogService;
import com.ruoyi.system.service.grid.qcc.impl.EsearchRecordService;
import io.swagger.annotations.Api;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* 企查查 查公司详情
* * Author: brenda
* * 2024/9/3
**/
@Api(tags = "企业管理-一企一档")
@RestController
@RequestMapping("/api/grid/company/qcc")
public class CompanyQccController {
@Autowired
private EsearchJsonRecordService esearchJsonRecordService;
@Autowired
private EsearchFactory searchFactory;
@Autowired
private EsearchLogService logService;
@Autowired
private EsearchRecordService recordService;
@Value("${app.qcc.appKey}")
private String appKey;
@Value("${app.qcc.secKey}")
private String secKey;
//名称模糊搜索
@Value("${app.qcc.searchName}")
private String searchName;
//根据公司完整名称 查询详细信息 搜索关键字(公司名、注册号、统一社会信用代码或KeyNo)
@Value("${app.qcc.searchInfo}")
private String searchInfo;
//据公司完整名称查询纳税人识别号&开户行
@Value("${app.qcc.searchCode}")
private String searchCode;
@GetMapping("getQccCompanyInfo")
public AjaxResult getQccCompanyInfo(@RequestParam("keyword")String keyword){
if(StringUtils.isBlank(keyword)){
throw new ServiceException("参数错误");
}
//本地数据已存在
EsearchJsonRecord existRecord = esearchJsonRecordService.getOne(new LambdaQueryWrapper<EsearchJsonRecord>().eq(EsearchJsonRecord::getCreditCode, keyword));
if(existRecord != null){
EsearchRecordExt esearchRecordExt = new EsearchRecordExt();
BeanUtils.copyProperties(existRecord, esearchRecordExt);
setOriginalNameStr(esearchRecordExt);
return AjaxResult.success(esearchRecordExt);
}
String paramStr = "keyword=" + keyword;
String reqUri = searchInfo.concat("?key=").concat(appKey).concat("&").concat(paramStr);
EsearchResult qccResult = searchFactory.getHandler(EsearchTypeEnum.qcc)
.searchByUrl(reqUri, appKey, secKey);
String status = qccResult.getStatus();
EsearchJsonRecord qccRecord = qccResult.getRecord();
if (FinalCostHttpHelper.isNormalRequest(status)) {
saveLog(reqUri);
}
if (FinalCostHttpHelper.isSuccessResult(status) && qccRecord != null) {
saveInfo(qccRecord, keyword,EsearchWayEnum.precise, reqUri);
EsearchRecordExt esearchRecordExt = new EsearchRecordExt();
BeanUtils.copyProperties(qccRecord, esearchRecordExt);
setOriginalNameStr(esearchRecordExt);
return AjaxResult.success(esearchRecordExt);
}
return AjaxResult.error("查询失败, 无此企业");
}
private void setOriginalNameStr(EsearchRecordExt record){
if(StringUtils.isNotBlank(record.getOriginalName()) && record.getOriginalName().contains("Name")){
JSONArray jsonArray = JSONArray.parseArray(record.getOriginalName());
List<String> nameList = new ArrayList<>();
for(int i = 0; i < jsonArray.size(); i++){
JSONObject jsonObject = (JSONObject) jsonArray.get(i);
String name = jsonObject.getString("Name");
if(StringUtils.isNotBlank(name)){
nameList.add(name);
}
}
if(!CollectionUtils.isEmpty(nameList)){
record.setOriginalNameStr(StringUtils.join(nameList,","));
}
}
}
private void saveLog(String url) {
EsearchLog log = new EsearchLog();
log.setCtime(System.currentTimeMillis());
log.setUrl(url);
logService.save(log);
}
private void saveInfo(EsearchJsonRecord result,String keyWord, EsearchWayEnum way, String url) {
EsearchRecord bean = new EsearchRecord();
bean.setId(UUID.randomUUID().toString());
bean.setUrl(url);
bean.setKeyWord(keyWord);
bean.setWay(way.getMode());
bean.setCtime(System.currentTimeMillis());
bean.setTokenJson(JSON.toJSONString(result));
recordService.save(bean);
if (ObjectUtil.isNotEmpty(result)) {
esearchJsonRecordService.save(result);
}
}
}
package com.ruoyi.web.controller.grid;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.grid.vo.GridCompanySafeCheckExt;
import com.ruoyi.system.domain.grid.vo.GridCompanySafeCheckParam;
import com.ruoyi.system.service.grid.GridCompanySafeCheckService;
import io.swagger.annotations.Api;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 企业安监检查
*/
@Api(tags = "综合执法-企业检查")
@RestController
@RequestMapping("/api/company/safeCheck")
public class GridCompanySafeCheckController {
@Autowired
GridCompanySafeCheckService wsCompanySafeCheckService;
/**
* 分页查询安监检查列表
*/
@GetMapping(value = "/page")
public AjaxResult page(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "wgCode", required = false) String wgCode,
@RequestParam(name = "companyId", required = false) String companyId,
@RequestParam(name = "companyName", required = false) String companyName,
@RequestParam(name = "companyType", required = false) String companyType,
@RequestParam(name = "checkUserId", required = false)String checkUserId,
@RequestParam(name = "creditCode", required = false)String creditCode,
@RequestParam(name = "checkStatus", required = false)String checkStatus,
@RequestParam(name = "startTime", required = false) String startTime,
@RequestParam(name = "endTime", required = false) String endTime,
@RequestParam(name = "checkType", required = false) String checkType) {
GridCompanySafeCheckParam param = new GridCompanySafeCheckParam();
param.setWgCode(wgCode);
param.setCompanyName(companyName);
param.setCompanyType(companyType);
param.setStartTime(startTime);
param.setEndTime(endTime);
param.setCompanyId(companyId);
param.setCheckUserId(checkUserId);
param.setCreditCode(creditCode);
param.setCheckStatus(checkStatus);
param.setCheckType(checkType);
return AjaxResult.success(wsCompanySafeCheckService.pageInfos(param, pageNo, pageSize));
}
/**
* 保存
*/
@PostMapping(value = "/add")
public AjaxResult add(@RequestBody GridCompanySafeCheckExt checkExt) {
wsCompanySafeCheckService.save(checkExt);
return AjaxResult.success("提交成功");
}
/**
* 保存
*/
@PostMapping(value = "/update")
public AjaxResult update(@RequestBody GridCompanySafeCheckExt checkExt) {
wsCompanySafeCheckService.update(checkExt);
return AjaxResult.success("提交成功");
}
/**
* 详情
*/
@GetMapping(value = "/detail/{id}")
public AjaxResult detail(@PathVariable("id") String id) {
return AjaxResult.success(wsCompanySafeCheckService.detail(id));
}
/**
* 删除
*/
@GetMapping(value = "/delete/{id}")
public AjaxResult delete(@PathVariable("id") String id) {
wsCompanySafeCheckService.delete(id);
return AjaxResult.success("删除成功");
}
/**
* 企业近30天检查数量
*/
@GetMapping(value = "/countThirtyNum")
public AjaxResult countThirtyNum(@RequestParam(name = "companyId") String companyId) {
if (StringUtils.isBlank(companyId)) {
throw new RuntimeException("查询失败:企业id不能为空");
}
return AjaxResult.success(wsCompanySafeCheckService.countThirthNum(companyId));
}
/**
* 大屏:安监检查统计信息
*/
@GetMapping(value = "/countSafeCheck")
public AjaxResult countSafeCheck(@RequestParam(name = "wgCode") String wgCode) {
return AjaxResult.success(wsCompanySafeCheckService.countSafeCheckInfo(wgCode));
}
/**
* 大屏:安监检查企业检查情况
*/
@GetMapping(value = "/countCompanyCheckInfo")
public AjaxResult countCompanyCheckInfo(@RequestParam(name = "wgCode") String wgCode) {
return AjaxResult.success(wsCompanySafeCheckService.countCompanyCheckInfo(wgCode));
}
/**
* 大屏:安监检查村级检查企业数
*/
@GetMapping(value = "/countCountryCheckInfo")
public AjaxResult countCountryCheckInfo(@RequestParam(name = "wgCode") String wgCode) {
return AjaxResult.success(wsCompanySafeCheckService.countCountryCheckInfo(wgCode));
}
/**
* 大屏:安监检查村级检查企业数
*/
@GetMapping(value = "/countSevenDayCheckInfo")
public AjaxResult countSevenDayCheckInfo(@RequestParam(name = "wgCode") String wgCode) {
return AjaxResult.success(wsCompanySafeCheckService.countSevenDayCheckInfo(wgCode));
}
/**
* 大屏:分页查询安监检查列表
*/
@GetMapping(value = "/count/pageInfo")
public AjaxResult countPageInfo(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "15") Integer pageSize,
@RequestParam(name = "wgCode", required = false) String wgCode,
@RequestParam(name = "searchName", required = false) String searchName,
@RequestParam(name = "startTime", required = false) String startTime,
@RequestParam(name = "endTime", required = false) String endTime) {
GridCompanySafeCheckParam param = new GridCompanySafeCheckParam();
param.setWgId(wgCode);
param.setSearchName(searchName);
param.setStartTime(startTime);
param.setEndTime(endTime);
return AjaxResult.success(wsCompanySafeCheckService.countPageInfo(param, pageNo, pageSize));
}
/**
* 大屏:分页查询定点安监检查列表
*/
@GetMapping(value = "/count/pointPageInfo")
public AjaxResult countPageInfo(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "15") Integer pageSize,
@RequestParam(name = "longitude", required = false) String longitude,
@RequestParam(name = "latitude", required = false) String latitude) {
GridCompanySafeCheckParam param = new GridCompanySafeCheckParam();
param.setClockLongitude(longitude);
param.setClockLatitude(latitude);
return AjaxResult.success(wsCompanySafeCheckService.countPointPageInfo(param, pageNo, pageSize));
}
}
package com.ruoyi.web.controller.grid;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.grid.GridItemDaily;
import com.ruoyi.system.domain.grid.GridItemDailyExample;
import com.ruoyi.system.service.grid.GridItemDailyFacadeService;
import com.ruoyi.system.service.grid.GridItemDailyService;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* @Auther: hxc
* @Date: 2019/2/28 0028 14:09
* @Description: 网格信息表
*/
@Api(tags = "网格管理 - 日常事项")
@RestController
@RequestMapping("/api/grid/itemDaily")
public class GridItemDailyController {
@Autowired
private GridItemDailyFacadeService gridItemDailyFacadeService;
@Autowired
private GridItemDailyService gridItemDailyService;
//对内接口
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public String list(@RequestParam("pageNum") int pageNum, @RequestParam("pageSize") int pageSize,
@RequestParam("sxbm") String sxbm, @RequestParam("sxmc") String sxmc) {
AjaxResult result = new AjaxResult();
gridItemDailyFacadeService.getRoles(sxbm, sxmc, pageNum, pageSize, result);
return JSON.toJSONString(result);
}
@RequestMapping(value = "/list_search", method = RequestMethod.GET)
@ResponseBody
public String listSearch(@RequestParam("pageNum") int pageNum, @RequestParam("pageSize") int pageSize,
@RequestParam("sxbm") String sxbm, @RequestParam("sxmc") String sxmc,
@RequestParam("sjfl") String sjfl) {
AjaxResult result = new AjaxResult();
gridItemDailyFacadeService.getSearch(sjfl, sxbm, sxmc, pageNum, pageSize, result);
return JSON.toJSONString(result);
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public String add(@RequestBody GridItemDaily itemDaily) {
itemDaily.setId(UUID.randomUUID().toString());
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
itemDaily.setCreateTime(df.format(new Date()));
GridItemDailyExample example = new GridItemDailyExample();
GridItemDailyExample.Criteria criteria = example.createCriteria();
//判断是否有根节点
criteria.andSjflIsNull();
int count = gridItemDailyService.countByExample(example);
if (count == 0 || StringUtils.isNotEmpty(itemDaily.getSjfl())) {
int result = gridItemDailyService.insert(itemDaily);
if (result == 1) {
return JSON.toJSONString(AjaxResult.success("success", itemDaily));
} else {
return JSON.toJSONString(AjaxResult.error(400, "fail"));
}
} else {
return JSON.toJSONString(AjaxResult.error(300, "已存在根节点!"));
}
}
@RequestMapping(value = "/delete", method = RequestMethod.GET)
@ResponseBody
public String delete(@RequestParam String id) {
int result = gridItemDailyService.deleteByStringPrimaryKey(id);
if (result == 1) {
return JSON.toJSONString(AjaxResult.success("success", id));
} else {
return JSON.toJSONString(AjaxResult.error(400, "fail"));
}
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public String update(@RequestBody GridItemDaily itemDaily) {
int result = gridItemDailyService.updateByPrimaryKeySelective(itemDaily);
if (result == 1) {
return JSON.toJSONString(AjaxResult.success("success", itemDaily));
} else {
return JSON.toJSONString(AjaxResult.error(400, "fail"));
}
}
@RequestMapping(value = "/treeNode", method = RequestMethod.GET)
@ResponseBody
public List<Map<String, Object>> treeNode(@RequestParam(value = "sxbm", required = false) String sxbm) {
try {
List<Map<String, Object>> str = gridItemDailyFacadeService.getTreeNode(sxbm);
return str;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@RequestMapping(value = "/getSxbm", method = RequestMethod.GET)
@ResponseBody
public String getSxbm(@RequestParam("sxbm") String sxbm) {
String code = gridItemDailyFacadeService.getSxbm(sxbm);
String name = gridItemDailyFacadeService.getSxmc(sxbm);
return JSON.toJSONString(AjaxResult.success("success", code + ":" + name));
}
@RequestMapping(value = "/addList", method = RequestMethod.GET)
@ResponseBody
public String addList(@RequestParam("createBy") String createBy) {
int num = gridItemDailyFacadeService.rcsxbAddList(createBy);
if (num == 1) {
return JSON.toJSONString(AjaxResult.success("success", "导入成功"));
} else {
return JSON.toJSONString(AjaxResult.error(400, "导入失败"));
}
}
@RequestMapping(value = "/drsxList", method = RequestMethod.GET)
@ResponseBody
public String drsxList(@RequestParam("sxbm") String sxbm,
@RequestParam("createBy") String createBy, @RequestParam("drnr") String drnr) {
drnr = drnr.replaceAll("\"", "");
drnr = drnr.replaceAll("\\]", "");
drnr = drnr.replaceAll("\\[", "");
String nums[] = drnr.split(",");
int result = gridItemDailyFacadeService.rcsxdr(sxbm, createBy, nums);
if (result == 1) {
return JSON.toJSONString(AjaxResult.success("success", "导入成功"));
} else {
return JSON.toJSONString(AjaxResult.error(400, "导入失败"));
}
}
@RequestMapping(value = "/delXjSxbm", method = RequestMethod.GET)
@ResponseBody
public String delXjSxbm(@RequestParam("sxbm") String sxbm) {
List<GridItemDaily> GridItemDaily = gridItemDailyFacadeService.DelXjSxbm(sxbm);
int num = 0;
if (GridItemDaily.size() > 0) {
num = 1;
}
return JSON.toJSONString(AjaxResult.success("success", num));
}
//对外接口
@RequestMapping(value = "/dw/rcsxList", method = RequestMethod.GET)
@ResponseBody
public String getDwRcsxList(@RequestParam(value = "sxbm", required = false) String sxbm) {
try {
AjaxResult result = new AjaxResult();
List<Map<String, Object>> str = gridItemDailyFacadeService.getDwItemDailyList(sxbm, result);
return JSON.toJSONString(AjaxResult.success("success", str));
} catch (Exception e) {
e.printStackTrace();
return JSON.toJSONString(AjaxResult.error(400, e.toString()));
}
}
/**
* 层级级联日常事项,包含最外面一层
* @return
*/
@GetMapping("/eventLevelTree")
@ResponseBody
public AjaxResult getEventLevelTree(String sxbm){
return AjaxResult.success(gridItemDailyFacadeService.getRcsxLevelTreeList(sxbm));
}
}
package com.ruoyi.web.controller.grid;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.grid.GridItemLib;
import com.ruoyi.system.service.grid.GridItemLibFacadeService;
import com.ruoyi.system.service.grid.GridItemLibService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
/**
* @Auther: hxc
* @Date: 2019/2/28 0028 14:09
* @Description: 网格信息表
*/
@Api(tags = "网格管理 - 事项库")
@RestController
@RequestMapping("/api/grid/itemLib")
public class GridItemLibController {
@Autowired
private GridItemLibFacadeService gridItemLibFacadeService;
@Autowired
private GridItemLibService gridItemLibService;
//对内接口
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public String list(@RequestParam("pageNum") int pageNum, @RequestParam("pageSize") int pageSize,
String sxfl, String sxmc) {
AjaxResult result = new AjaxResult();
gridItemLibFacadeService.getRoles(sxfl, sxmc, pageNum, pageSize, result);
return JSON.toJSONString(result);
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public String add(@RequestBody GridItemLib lib) {
lib.setId(UUID.randomUUID().toString());
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
lib.setCreateTime(df.format(new Date()));
int result = gridItemLibService.insert(lib);
if (result == 1) {
return JSON.toJSONString(AjaxResult.success("success", lib));
} else {
return JSON.toJSONString(AjaxResult.error(400, "fail"));
}
}
@RequestMapping(value = "/delete", method = RequestMethod.GET)
@ResponseBody
public String delete(@RequestParam String id) {
int result = gridItemLibService.deleteByStringPrimaryKey(id);
if (result == 1) {
return JSON.toJSONString(AjaxResult.success("success", id));
} else {
return JSON.toJSONString(AjaxResult.error(400, "fail"));
}
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public String update(@RequestBody GridItemLib lib) {
int result = gridItemLibService.updateByPrimaryKeySelective(lib);
if (result == 1) {
return JSON.toJSONString(AjaxResult.success("success", lib));
} else {
return JSON.toJSONString(AjaxResult.error(400, "fail"));
}
}
@RequestMapping(value = "/countSxfl", method = RequestMethod.GET)
@ResponseBody
public String countSxfl() {
AjaxResult result = new AjaxResult();
gridItemLibFacadeService.countSxfl(result);
return JSON.toJSONString(result);
}
@RequestMapping(value = "/countBySxfl", method = RequestMethod.GET)
@ResponseBody
public String countBySxfl() {
AjaxResult result = new AjaxResult();
gridItemLibFacadeService.countBySxfl(result);
return JSON.toJSONString(result);
}
}
package com.ruoyi.web.controller.grid;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.grid.enums.GridRegionSearchParam;
import com.ruoyi.system.mapper.grid.GridRegionMapper;
import com.ruoyi.system.service.grid.*;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.*;
/**
* @author : peter
* @description: 网格对象采集
* @date : 2022-05-04 18:04
*/
@Api(tags = "网格管理 - 网格对象采集")
@RestController
@RequestMapping("/api/grid/object")
public class GridObjectController {
@Autowired
private GridPeopleService gridPeopleService;
@Autowired
private GridHouseService gridHouseService;
@Autowired
private GridCompanyService gridCompanyService;
@Autowired
private GridShopService gridShopService;
@Autowired
private GridRegionMapper gridRegionMapper;
/**
* 网格对象按字典分类型统计和总量
*
* @param wgCode
* @return
*/
@GetMapping(value = "/infoWithType")
public AjaxResult infoWithType(@RequestParam(value = "wgCode", required = false) String wgCode) {
Map<String, Object> map = new HashMap<>();
// 人口
List<Map<String, Object>> peopleList = gridPeopleService.countGridPeople(wgCode);
map.put("people", peopleList);
map.put("peopleAllNum", gridPeopleService.countAll(wgCode));
map.put("peopleRkbq", gridPeopleService.countGridPeopleByRkbq(wgCode));
map.put("specialPeopleNum", gridPeopleService.countSpecialPeople(wgCode) != null ? gridPeopleService.countSpecialPeople(wgCode) : 0);
// 住宅类型分类统计
int houseAllNum = gridHouseService.countAll(wgCode);
List<Map<String, Object>> houseList = gridHouseService.countGridHouse(wgCode);
map.put("house", houseList);
map.put("houseAllNum", houseAllNum);
// 住宅状态分类统计
List<Map<String, Object>> houseFwztList = gridHouseService.countGridHouseByFwzt(wgCode);
map.put("houseFwzt", houseFwztList);
BigDecimal houseAllCount = new BigDecimal(houseAllNum);
Iterator<Map<String, Object>> iterator = houseFwztList.iterator();
while (iterator.hasNext()) {
Map<String, Object> mapH = iterator.next();
if (houseAllNum != 0) {
BigDecimal percent = new BigDecimal(String.valueOf(mapH.get("number"))).divide(houseAllCount, 3, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
NumberFormat perFormat = NumberFormat.getPercentInstance(Locale.CHINA);
perFormat.setMinimumFractionDigits(0);
mapH.put("percent", perFormat.format(percent));
} else {
mapH.put("percent", "0%");
}
}
// 企业
List<Map<String, Object>> companyList = gridCompanyService.countGridCompany(wgCode);
map.put("company", companyList);
map.put("companyAllNum", gridCompanyService.countAll(wgCode));
// 商铺
List<Map<String, Object>> shopList = gridShopService.countGridShop(wgCode);
map.put("shop", shopList);
map.put("shopAllNum", gridShopService.countAll(wgCode));
// 地块
GridRegionSearchParam param = new GridRegionSearchParam();
param.setLevel("4");
if (StringUtils.isNotBlank(wgCode)) {
List<String> wgCodes = Arrays.asList(wgCode.split(","));
param.setWgCodeLikes(wgCodes);
}
int wgCount = gridRegionMapper.countByParams(param);
map.put("wgCount", wgCount);
return AjaxResult.success(map);
}
/**
* 网格对象总量统计
*
* @param wgCode
* @return
*/
@GetMapping(value = "/info")
public AjaxResult info(@RequestParam(value = "wgCode", required = false) String wgCode) {
Map<String, Object> map = new HashMap<>();
map.put("peopleAllNum", gridPeopleService.countAll(wgCode));
map.put("houseAllNum", gridHouseService.countAll(wgCode));
map.put("companyAllNum", gridCompanyService.countAll(wgCode));
map.put("shopAllNum", gridShopService.countAll(wgCode));
return AjaxResult.success(map);
}
/**
* 大屏上村社区基本信息接口
*
* @param wgCode
* @return
*/
@GetMapping(value = "/basicInfo")
public AjaxResult basicInfo(@RequestParam(value = "wgCode", required = false) String wgCode) {
List<Map<String, Object>> list = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
map.put("name", "人口总数");
map.put("number", gridPeopleService.countAll(wgCode));
list.add(map);
Map<String, Object> map1 = new HashMap<>();
map1.put("name", "住宅总数");
map1.put("number", gridHouseService.countAll(wgCode));
list.add(map1);
List<Map<String, Object>> peopleList = gridPeopleService.countGridPeople(wgCode);
Map<String, Object> map2 = new HashMap<>();
map2.put("name", "户籍人口");
map2.put("number", peopleList.get(0).get("number"));
list.add(map2);
Map<String, Object> map3 = new HashMap<>();
map3.put("name", "非户籍人口");
map3.put("number", peopleList.get(1).get("number"));
list.add(map3);
Map<String, Object> map4 = new HashMap<>();
map4.put("name", "特殊人口");
map4.put("number", gridPeopleService.countSpecialPeople(wgCode) != null ? gridPeopleService.countSpecialPeople(wgCode) : 0);
list.add(map4);
return AjaxResult.success(list);
}
/**
* 大屏上二级/三级网格人口类型数量
*/
@GetMapping(value = "/countWsPeopleRklxByGrid")
public AjaxResult countWsPeopleRklxByGrid(@RequestParam(value = "wgCode", required = false) String wgCode) {
return AjaxResult.success(gridPeopleService.countGridPeopleRklxByGrid(wgCode));
}
/**
* 各村社区网格对象数量统计
*/
@GetMapping(value = "/infoWithGrid")
public AjaxResult infoWithGrid() {
Map<String, Object> map = new HashMap<>();
map.put("peopleGrid", gridPeopleService.countGridPeopleByGrid());
map.put("houseGrid", gridHouseService.countGridHouseByGrid());
map.put("companyGrid", gridCompanyService.countGridCompanyByGrid());
map.put("shopGrid", gridShopService.countGridShopByGrid());
return AjaxResult.success(map);
}
}
package com.ruoyi.web.controller.grid;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.grid.GridWgLog;
import com.ruoyi.system.service.grid.GridWgLogService;
import io.swagger.annotations.Api;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @author : peter
* @description: TODO
* @date : 2022-08-18 15:34
*/
@Api(tags = "网格管理 - 网格日志")
@RestController
@RequestMapping("/api/grid/wgLog")
public class GridWgLogController {
@Autowired
private GridWgLogService gridWgLogService;
@GetMapping(value = "/infoAll")
public AjaxResult infoAll(@RequestParam(value = "wgCode", required = false) String wgCode,
@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime) {
return AjaxResult.success(gridWgLogService.infoAll(wgCode, startTime, endTime));
}
/**
* @param pageNum
* @param pageSize
* @param type 对象类型 1-人口 2-住宅 3-企业 4-商铺
* @param operate 操作类型 insert/update/bind/interview
* @param startTime
* @param endTime
* @return
*/
@GetMapping(value = "/infoPage")
public AjaxResult infoPage(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "objectId", required = false) String objectId,
@RequestParam(value = "type") String type,
@RequestParam(value = "operate") String operate,
@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime) {
PageHelper.startPage(pageNum, pageSize);
PageInfo<GridWgLog> pageInfo = new PageInfo<>(gridWgLogService.infoPage(objectId, type, operate, startTime, endTime));
return AjaxResult.success(pageInfo);
}
}
package com.ruoyi.web.controller.grid;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.grid.GridWgNotice;
import com.ruoyi.system.service.grid.GridWgNoticeService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
/**
* 网格公告
*
* @author wujm<wujm @ eazytec.com>
*/
@Api(tags = "网格管理 - 网格公告")
@RestController
@RequestMapping("/api/grid/wgNotice")
public class GridWgNoticeController extends BaseController {
@Autowired
private GridWgNoticeService gridWgNoticeService;
/**
* 列表
*
* @param gridWgNotice
* @return
*/
@GetMapping
public TableDataInfo list(GridWgNotice gridWgNotice) {
startPage();
return getDataTable(gridWgNoticeService.listGridWgNotice(gridWgNotice));
}
/**
* 新增
*
* @param gridWgNotice
* @return
*/
@PostMapping()
public AjaxResult save(@RequestBody GridWgNotice gridWgNotice) {
gridWgNotice.setCreateBy(getUsername());
gridWgNotice.setCreateTime(new Date());
return toAjax(gridWgNoticeService.saveGridWgNotice(gridWgNotice));
}
/**
* 根据id查询详情
*
* @param id
* @return
*/
@GetMapping(value = {"{id}"})
public AjaxResult getById(@PathVariable("id") Long id) {
GridWgNotice gridWgNotice = gridWgNoticeService.getGridWgNoticeById(id);
if(gridWgNotice != null && StringUtils.isNotBlank(gridWgNotice.getNoticeContent())){
String content = gridWgNotice.getNoticeContent().replaceAll("<image ", "<img ");
gridWgNotice.setNoticeContent(content);
}
return AjaxResult.success(gridWgNotice);
}
/**
* 修改
*
* @param gridWgNotice
* @return
*/
@PutMapping
public AjaxResult update(@RequestBody GridWgNotice gridWgNotice) {
gridWgNotice.setUpdateBy(getUsername());
return toAjax(gridWgNoticeService.updateGridWgNotice(gridWgNotice));
}
/**
* 删除
*
* @param ids
* @return
*/
@DeleteMapping
public AjaxResult batchRemove(@RequestBody Long[] ids) {
return toAjax(gridWgNoticeService.batchRemove(ids));
}
}
package com.ruoyi.web.controller.grid;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.grid.GridWorkReport;
import com.ruoyi.system.service.grid.GridWorkReportService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author condey
* @version $$package: com.ruoyi.web.controller.grid, v 0.1 2024/6/24 4:48 PM condey Exp $$
*/
@Api(tags = "数据看板 - 工作简报")
@RestController
@RequestMapping("/api/grid/workReport")
public class GridWorkReportController {
@Autowired
private GridWorkReportService gridWorkReportService;
@GetMapping(value = "/page")
public AjaxResult page(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "year", required = false) String year,
@RequestParam(value = "month", required = false) String month) {
PageHelper.startPage(pageNum, pageSize);
PageInfo<GridWorkReport> pageInfo = new PageInfo<>(gridWorkReportService.queryList(year, month));
return AjaxResult.success(pageInfo);
}
/**
* 重新生成
*
* @param report
* @return
*/
@PostMapping(value = "/reCreate")
public AjaxResult reCreate(@RequestBody GridWorkReport report) {
Long id = gridWorkReportService.createReport(report);
return AjaxResult.success(id);
}
/**
* 加载详情
*
* @param id
* @return
*/
@GetMapping(value = "/detail")
public AjaxResult detail(@RequestParam(value = "id") Long id) {
return AjaxResult.success(gridWorkReportService.detail(id));
}
}
package com.ruoyi.web.controller.grid;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.grid.ext.GridGroupExt;
import com.ruoyi.system.service.grid.GridGroupLandService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author : yaoqiang
* @description: 集团与经济地块关联
* @date : 2023-04-20 16:09
*/
@Api(tags = "网格管理 - 集团与经济地块关联")
@RestController
@RequestMapping("/api/grid/group/land")
public class GroupLandController {
@Autowired
private GridGroupLandService gridGroupLandService;
@GetMapping(value = "/page")
public AjaxResult page(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "groupName", required = false) String groupName) {
return AjaxResult.success(gridGroupLandService.page(pageNo, pageSize, groupName));
}
/**
* 保存/修改
*/
@PostMapping(value = "/saveOrUpdate")
public AjaxResult saveOrUpdate(@RequestBody GridGroupExt wsGroupExt) {
return gridGroupLandService.saveOrUpdate(wsGroupExt);
}
/**
* 详情
*/
@GetMapping(value = "/detail")
public AjaxResult detail(@RequestParam(value = "id") String id) {
return AjaxResult.success(gridGroupLandService.detail(id));
}
/**
* 删除
*/
@GetMapping(value = "/delete")
public AjaxResult delete(@RequestParam(value = "id") String id) {
gridGroupLandService.delete(id);
return AjaxResult.success("success");
}
/**
* 计算集团下的地块总面积
*/
@PostMapping(value = "/sumlandAreaTotal")
public AjaxResult sumlandAreaTotal(@RequestBody List<String> landIds) {
return AjaxResult.success(gridGroupLandService.sumlandAreaTotal(landIds));
}
/**
* 集团下的地块关联的所有企业
*/
@PostMapping(value = "/getRelatedCompanyList")
public AjaxResult getRelatedCompanyList(@RequestBody List<String> landIds) {
return AjaxResult.success(gridGroupLandService.getRelatedCompanyList(landIds));
}
/**
* 集团亩均税收排名
*/
@GetMapping(value = "bigScreen/permuSort/list")
public AjaxResult permuSortList(@RequestParam(value = "year", required = false) String year) {
return AjaxResult.success(gridGroupLandService.permuSortList(year));
}
}
package com.ruoyi.web.controller.grid;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.grid.GridHouse;
import com.ruoyi.system.domain.grid.GridHouseInterview;
import com.ruoyi.system.domain.grid.GridHousePeople;
import com.ruoyi.system.domain.grid.ext.GridHouseExt;
import com.ruoyi.system.domain.grid.ext.GridHousePeopleExt;
import com.ruoyi.system.domain.grid.vo.GridHouseSearchParam;
import com.ruoyi.system.service.grid.GridHouseInterviewService;
import com.ruoyi.system.service.grid.GridHousePeopleService;
import com.ruoyi.system.service.grid.GridHouseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Arrays;
/**
* @author : peter
* @description: TODO
* @date : 2022-05-04 10:24
*/
@Api(tags = "网格管理 - 房屋管理")
@RestController
@RequestMapping("/api/grid/house")
public class HouseController {
@Autowired
private GridHouseService gridHouseService;
@Autowired
private GridHousePeopleService gridHousePeopleService;
@Autowired
private GridHouseInterviewService gridHouseInterviewService;
@RequestMapping(value = "/page", method = RequestMethod.GET)
public AjaxResult list(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "wgCode", required = false) String wgCode,
@RequestParam(value = "fwlxCode", required = false) String fwlxCode,
@RequestParam(value = "fwztCode", required = false) String fwztCode,
@RequestParam(value = "houseName", required = false) String houseName,
@RequestParam(value = "value", required = false) String value) {
try {
GridHouseSearchParam wsHouse = new GridHouseSearchParam();
if(StringUtils.isNotBlank(wgCode)){
wsHouse.setWgCodeLikes(Arrays.asList(wgCode.split(",")));
}
wsHouse.setFwlxCode(fwlxCode);
wsHouse.setFwztCode(fwztCode);
wsHouse.setHouseName(houseName);
PageHelper.startPage(pageNum, pageSize);
PageInfo<GridHouseExt> pageInfo = gridHouseService.page(wsHouse, value);
return AjaxResult.success(pageInfo);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error(500, "服务器内部错误");
}
}
/**
* 保存
*/
@PostMapping(value = "/add")
public AjaxResult add(@RequestBody GridHouse wsHouse) {
return gridHouseService.add(wsHouse);
}
/**
* 修改
*/
@PostMapping(value = "/edit")
public AjaxResult edit(@RequestBody GridHouse wsHouse) {
return gridHouseService.edit(wsHouse);
}
/**
* 详情
*/
@GetMapping(value = "/detail/{id}")
public AjaxResult detail(@PathVariable("id") String id) {
return gridHouseService.detail(id);
}
/**
* 通过id删除
*/
@GetMapping(value = "/delete")
public AjaxResult delete(@RequestParam(value = "id") String id) {
return gridHouseService.delete(id);
}
/**
* 房屋关联人口信息
*/
@GetMapping(value = "/houseToPeoplePage")
public AjaxResult houseToPeoplePage(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "houseId") String houseId) {
try {
PageHelper.startPage(pageNum, pageSize);
PageInfo<GridHousePeopleExt> pageInfo = gridHouseService.houseToPeoplePage(houseId);
return AjaxResult.success(pageInfo);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error(500, "服务器内部错误");
}
}
/**
* 房屋绑定人口信息
*/
@PostMapping(value = "/houseBindPeople")
public AjaxResult houseBindPeople(@RequestBody GridHousePeople wsHousePeople) {
return gridHouseService.houseBindPeople(wsHousePeople);
}
/**
* 房屋解绑人口信息
*/
@GetMapping(value = "/houseUnbindPeople")
public AjaxResult houseUnbindPeople(@RequestParam(value = "id") String id) {
gridHousePeopleService.deleteByStringPrimaryKey(id);
return AjaxResult.success(null);
}
/**
* 房屋信息excel导入
*/
@PostMapping(value = "import", headers = "content-type=multipart/form-data")
public AjaxResult importExcel(@RequestParam(value = "file") MultipartFile file,
@RequestParam(value = "createId") String createId) {
return gridHouseService.importExcel(file, createId);
}
/**
* 房屋走访日志列表
*/
@GetMapping(value = "/interview/page")
public AjaxResult interviewPage(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "houseId") String houseId) {
try {
PageHelper.startPage(pageNum, pageSize);
PageInfo<GridHouseInterview> pageInfo = new PageInfo<>(gridHouseInterviewService.interviewPage(houseId));
return AjaxResult.success(pageInfo);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error(500, "服务器内部错误");
}
}
/**
* 房屋走访日志新增
*/
@PostMapping(value = "/interview/add")
public AjaxResult interviewAdd(@RequestBody GridHouseInterview wsHouseInterview) {
return AjaxResult.success(gridHouseInterviewService.interviewAdd(wsHouseInterview));
}
/**
* 房屋走访日志详情
*/
@GetMapping(value = "interview/detail/{id}")
public AjaxResult interviewDetail(@PathVariable("id") String id) {
return AjaxResult.success(gridHouseInterviewService.detail(id));
}
@ApiOperation("所有房屋列表")
@GetMapping("/allHouseList")
public AjaxResult getHouseList(){
return AjaxResult.success(gridHouseService.getAllHouseList());
}
}
package com.ruoyi.web.controller.grid;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.grid.GridInterview;
import com.ruoyi.system.service.grid.GridInterviewService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author : peter
* @description: TODO
* @date : 2022-05-31 15:29
*/
@Api(tags = "网格管理 - 企业/商铺安全走访日志")
@RestController
@RequestMapping("/api/grid/interview")
public class InterviewController {
@Autowired
private GridInterviewService gridInterviewService;
/**
* 走访日志列表
*/
@GetMapping(value = "/page")
public AjaxResult interviewPage(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "cid") String cid) {
try {
PageHelper.startPage(pageNum, pageSize);
PageInfo<GridInterview> pageInfo = new PageInfo<>(gridInterviewService.interviewPage(cid));
return AjaxResult.success(pageInfo);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.build(500, "服务器内部错误", e.getMessage());
}
}
/**
* 走访日志新增
*/
@PostMapping(value = "/add")
public AjaxResult interviewAdd(@RequestBody GridInterview wsInterview) {
return AjaxResult.success(gridInterviewService.interviewAdd(wsInterview));
}
/**
* 走访日志编辑
*/
@PostMapping(value = "/edit")
public AjaxResult interviewEdit(@RequestBody GridInterview wsInterview) {
gridInterviewService.edit(wsInterview);
return AjaxResult.success(null);
}
/**
* 走访日志详情
*/
@GetMapping(value = "/detail/{id}")
public AjaxResult interviewDetail(@PathVariable("id") String id) {
return AjaxResult.success(gridInterviewService.detail(id));
}
/**
* 走访日志删除
*/
@GetMapping(value = "/delete")
public AjaxResult interviewDelete(@RequestParam(value = "ids") String ids) {
gridInterviewService.delete(ids);
return AjaxResult.success(null);
}
/**
* 30天内走访日志数量
*
* @param type 1-人口 2-住宅 3-企业 4-商铺
* @param id 对象的id
* @return
*/
@GetMapping(value = "/count")
public AjaxResult interviewCount(@RequestParam(value = "type") String type,
@RequestParam(value = "id") String id) {
return AjaxResult.success(gridInterviewService.count(type, id));
}
/**
* 判断该对象(企业,房屋,商铺有无绑定人)下面有无绑定
*
* @param type 1-人口 2-住宅 3-企业 4-商铺
* @param id 对象的id
* @return
*/
@GetMapping(value = "/pending")
public AjaxResult pending(@RequestParam(value = "type") String type,
@RequestParam(value = "id") String id) {
long a = gridInterviewService.pending(type, id);
if (a > 0) {
return AjaxResult.success(true);
} else {
return AjaxResult.success(false);
}
}
}
package com.ruoyi.web.controller.monitor;
import io.swagger.annotations.Api;
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.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.web.domain.Server;
/**
* 服务器监控
*
* @author ruoyi
*/
@Api(tags = "基础服务 - 服务器监控")
@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);
}
}
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.
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