first commit
This commit is contained in:
Generated
+8
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
Generated
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="cn.fjdmy.uniapp.UniappProjectDataService">
|
||||
<option name="generalBasePath" value="$PROJECT_DIR$" />
|
||||
<option name="manifestPath" value="$PROJECT_DIR$/manifest.json" />
|
||||
<option name="pagesPath" value="$PROJECT_DIR$/pages.json" />
|
||||
<option name="scanNum" value="1" />
|
||||
<option name="type" value="store" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+14
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="mini" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8" addBOMForNewFiles="with BOM">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+45
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://mirrors.huaweicloud.com/repository/maven/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="nutz" />
|
||||
<option name="name" value="nutz" />
|
||||
<option name="url" value="https://jfrog.nutz.cn/artifactory/libs-release" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="nutz-snapshots" />
|
||||
<option name="name" value="nutz-snapshots" />
|
||||
<option name="url" value="https://jfrog.nutz.cn/artifactory/snapshots" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="http://maven.aliyun.com/nexus/content/repositories/central/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://maven.aliyun.com/repository/central" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+25
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_15" default="true" project-jdk-name="adopt-15" project-jdk-type="JavaSDK" />
|
||||
<component name="SvnBranchConfigurationManager">
|
||||
<option name="myConfigurationMap">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$">
|
||||
<value>
|
||||
<SvnBranchConfiguration>
|
||||
<option name="trunkUrl" value="http://192.168.21.203:8443/svn/UNION_NSI" />
|
||||
</SvnBranchConfiguration>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/mini.iml" filepath="$PROJECT_DIR$/mini.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="svn" />
|
||||
</component>
|
||||
</project>
|
||||
Binary file not shown.
@@ -0,0 +1,163 @@
|
||||
<?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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.v</groupId>
|
||||
<artifactId>mini</artifactId>
|
||||
<version>5.3.0</version>
|
||||
<description>java web development framework, base on budwk and nutz</description>
|
||||
<url>https://budwk.com</url>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>wizzercn</id>
|
||||
<name>Wizzer</name>
|
||||
<email>wizzer@qq.com</email>
|
||||
<url>https://wizzer.cn</url>
|
||||
</developer>
|
||||
</developers>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<configuration>
|
||||
<source>15</source>
|
||||
<target>15</target>
|
||||
<useIncrementalCompilation>false</useIncrementalCompilation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<charset>UTF-8</charset>
|
||||
<docencoding>UTF-8</docencoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<attach>true</attach>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.0</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.nutz.boot</groupId>
|
||||
<artifactId>nutzboot-maven-plugin</artifactId>
|
||||
<version>${nutzboot.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>15</source>
|
||||
<target>15</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>nutz</id>
|
||||
<url>https://jfrog.nutz.cn/artifactory/libs-release</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots>
|
||||
<id>nutz-snapshots</id>
|
||||
<url>https://jfrog.nutz.cn/artifactory/snapshots</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots>
|
||||
<id>nutz-snapshots</id>
|
||||
<url>https://jfrog.nutz.cn/artifactory/snapshots</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.nutz</groupId>
|
||||
<artifactId>nutzboot-starter-test-junit4</artifactId>
|
||||
<version>2.4.2-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.1</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.nutz</groupId>
|
||||
<artifactId>nutzboot-parent</artifactId>
|
||||
<version>${nutzboot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>${jaxb-api.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<properties>
|
||||
<jsoup.veision>1.12.1</jsoup.veision>
|
||||
<mysql-connector-java.version>8.0.16</mysql-connector-java.version>
|
||||
<easy-captcha.version>1.6.2</easy-captcha.version>
|
||||
<emoji-java.veision>4.0.0</emoji-java.veision>
|
||||
<jaxb-api.version>2.3.1</jaxb-api.version>
|
||||
<lombok.version>1.18.12</lombok.version>
|
||||
<slf4j.version>1.7.30</slf4j.version>
|
||||
<poi.version>4.1.2</poi.version>
|
||||
<v.version>1.0.1</v.version>
|
||||
<commons-lang3.version>3.8.1</commons-lang3.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<pinyin4j.veision>2.5.1</pinyin4j.veision>
|
||||
<nutzboot.version>2.4.2-SNAPSHOT</nutzboot.version>
|
||||
<logback.version>1.2.3</logback.version>
|
||||
<nutz.version>1.r.68-SNAPSHOT</nutz.version>
|
||||
<tencentcloud-sdk-java.version>4.0.11</tencentcloud-sdk-java.version>
|
||||
</properties>
|
||||
</project>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="AdditionalModuleElements">
|
||||
<content url="file://$MODULE_DIR$" dumb="true">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
|
||||
</content>
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<project version="4" relativePaths="false">
|
||||
<component name="ProjectRootManager" version="2" assert-keyword="true" project-jdk-name="15." jdk-15="true"/>
|
||||
<component name="CodeStyleManager">
|
||||
<option name="USE_DEFAULT_CODE_STYLE_SCHEME" value="true"/>
|
||||
<option name="CODE_STYLE_SCHEME" value=""/>
|
||||
</component>
|
||||
<component name="libraryTable"/>
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac"/>
|
||||
<option name="CLEAR_OUTPUT_DIRECTORY" value="false"/>
|
||||
<!--
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="${wildcardResourcePattern}"/>
|
||||
</wildcardResourcePatterns>
|
||||
-->
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java"/>
|
||||
</wildcardResourcePatterns>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="DEBUGGING_INFO" value="true"/>
|
||||
<option name="GENERATE_NO_WARNINGS" value="false"/>
|
||||
<option name="DEPRECATION" value="true"/>
|
||||
<option name="ADDITIONAL_OPTIONS_STRING" value=""/>
|
||||
<option name="MAXIMUM_HEAP_SIZE" value="128"/>
|
||||
<option name="USE_GENERICS_COMPILER" value="false"/>
|
||||
</component>
|
||||
<component name="JikesSettings">
|
||||
<option name="DEBUGGING_INFO" value="true"/>
|
||||
<option name="DEPRECATION" value="true"/>
|
||||
<option name="GENERATE_NO_WARNINGS" value="false"/>
|
||||
<option name="GENERATE_MAKE_FILE_DEPENDENCIES" value="false"/>
|
||||
<option name="DO_FULL_DEPENDENCE_CHECK" value="false"/>
|
||||
<option name="IS_INCREMENTAL_MODE" value="false"/>
|
||||
<option name="IS_EMACS_ERRORS_MODE" value="true"/>
|
||||
<option name="ADDITIONAL_OPTIONS_STRING" value=""/>
|
||||
<option name="MAXIMUM_HEAP_SIZE" value="128"/>
|
||||
</component>
|
||||
<component name="AntConfiguration">
|
||||
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false"/>
|
||||
<option name="FILTER_TARGETS" value="false"/>
|
||||
</component>
|
||||
<component name="JavadocGenerationManager">
|
||||
<option name="OUTPUT_DIRECTORY"/>
|
||||
<option name="OPTION_SCOPE" value="protected"/>
|
||||
<option name="OPTION_HIERARCHY" value="false"/>
|
||||
<option name="OPTION_NAVIGATOR" value="false"/>
|
||||
<option name="OPTION_INDEX" value="false"/>
|
||||
<option name="OPTION_SEPARATE_INDEX" value="false"/>
|
||||
<option name="OPTION_USE_1_1" value="false"/>
|
||||
<option name="OPTION_DOCUMENT_TAG_USE" value="false"/>
|
||||
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false"/>
|
||||
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false"/>
|
||||
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="false"/>
|
||||
<option name="OPTION_DEPRECATED_LIST" value="false"/>
|
||||
<option name="OTHER_OPTIONS"/>
|
||||
<option name="HEAP_SIZE"/>
|
||||
<option name="OPEN_IN_BROWSER" value="false"/>
|
||||
</component>
|
||||
<component name="JUnitProjectSettings">
|
||||
<option name="TEST_RUNNER" value="UI"/>
|
||||
</component>
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points/>
|
||||
</component>
|
||||
<component name="DataSourceManager"/>
|
||||
<component name="ExportToHTMLSettings">
|
||||
<option name="PRINT_LINE_NUMBERS" value="false"/>
|
||||
<option name="OPEN_IN_BROWSER" value="false"/>
|
||||
<option name="OUTPUT_DIRECTORY"/>
|
||||
</component>
|
||||
<component name="ImportConfiguration">
|
||||
<option name="VENDOR"/>
|
||||
<option name="RELEASE_TAG"/>
|
||||
<option name="LOG_MESSAGE"/>
|
||||
<option name="CHECKOUT_AFTER_IMPORT" value="true"/>
|
||||
</component>
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<!-- module filepath="$$PROJECT_DIR$$/${pom.artifactId}.iml"/ -->
|
||||
<module filepath="$PROJECT_DIR$/mini.iml"/>
|
||||
</modules>
|
||||
</component>
|
||||
<UsedPathMacros>
|
||||
<!--<macro name="cargo"></macro>-->
|
||||
</UsedPathMacros>
|
||||
</project>
|
||||
@@ -0,0 +1,418 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<project version="4" relativePaths="false">
|
||||
<component name="LvcsProjectConfiguration">
|
||||
<option name="ADD_LABEL_ON_PROJECT_OPEN" value="true"/>
|
||||
<option name="ADD_LABEL_ON_PROJECT_COMPILATION" value="true"/>
|
||||
<option name="ADD_LABEL_ON_FILE_PACKAGE_COMPILATION" value="true"/>
|
||||
<option name="ADD_LABEL_ON_PROJECT_MAKE" value="true"/>
|
||||
<option name="ADD_LABEL_ON_RUNNING" value="true"/>
|
||||
<option name="ADD_LABEL_ON_DEBUGGING" value="true"/>
|
||||
<option name="ADD_LABEL_ON_UNIT_TEST_PASSED" value="true"/>
|
||||
<option name="ADD_LABEL_ON_UNIT_TEST_FAILED" value="true"/>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="MemberChooser.copyJavadoc" value="false"/>
|
||||
<property name="GoToClass.includeLibraries" value="false"/>
|
||||
<property name="MemberChooser.showClasses" value="true"/>
|
||||
<property name="MemberChooser.sorted" value="false"/>
|
||||
<property name="GoToFile.includeJavaFiles" value="false"/>
|
||||
<property name="GoToClass.toSaveIncludeLibraries" value="false"/>
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-4" y="-4" width="1032" height="746" extended-state="6"/>
|
||||
<editor active="false"/>
|
||||
<layout>
|
||||
<window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="-1"/>
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="7"/>
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="0"/>
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="1"/>
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1"/>
|
||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="-1"/>
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.4" order="6"/>
|
||||
<window_info id="Aspects" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="-1"/>
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1"/>
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="2"/>
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2"/>
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.4" order="4"/>
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="sliding" type="sliding" visible="false" weight="0.4" order="0"/>
|
||||
<window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2"/>
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="0"/>
|
||||
<window_info id="EJB" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="3"/>
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="5"/>
|
||||
</layout>
|
||||
</component>
|
||||
<component name="ErrorTreeViewConfiguration">
|
||||
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false"/>
|
||||
<option name="HIDE_WARNINGS" value="false"/>
|
||||
</component>
|
||||
<component name="StructureViewFactory">
|
||||
<option name="SORT_MODE" value="0"/>
|
||||
<option name="GROUP_INHERITED" value="true"/>
|
||||
<option name="AUTOSCROLL_MODE" value="true"/>
|
||||
<option name="SHOW_FIELDS" value="true"/>
|
||||
<option name="AUTOSCROLL_FROM_SOURCE" value="false"/>
|
||||
<option name="GROUP_GETTERS_AND_SETTERS" value="true"/>
|
||||
<option name="SHOW_INHERITED" value="false"/>
|
||||
<option name="HIDE_NOT_PUBLIC" value="false"/>
|
||||
</component>
|
||||
<component name="ProjectViewSettings">
|
||||
<navigator currentView="ProjectPane" flattenPackages="false" showMembers="false" showStructure="false" autoscrollToSource="false" splitterProportion="0.5"/>
|
||||
<view id="ProjectPane">
|
||||
<expanded_node type="directory" url="file://$PROJECT_DIR$"/>
|
||||
</view>
|
||||
<view id="SourcepathPane"/>
|
||||
<view id="ClasspathPane"/>
|
||||
</component>
|
||||
<component name="Commander">
|
||||
<leftPanel view="Project"/>
|
||||
<rightPanel view="Project"/>
|
||||
<splitter proportion="0.5"/>
|
||||
</component>
|
||||
<component name="AspectsView"/>
|
||||
<component name="SelectInManager"/>
|
||||
<component name="HierarchyBrowserManager">
|
||||
<option name="SHOW_PACKAGES" value="false"/>
|
||||
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false"/>
|
||||
<option name="SORT_ALPHABETICALLY" value="false"/>
|
||||
</component>
|
||||
<component name="TodoView" selected-index="0">
|
||||
<todo-panel id="selected-file">
|
||||
<are-packages-shown value="false"/>
|
||||
<flatten-packages value="false"/>
|
||||
<is-autoscroll-to-source value="true"/>
|
||||
</todo-panel>
|
||||
<todo-panel id="all">
|
||||
<are-packages-shown value="true"/>
|
||||
<flatten-packages value="false"/>
|
||||
<is-autoscroll-to-source value="true"/>
|
||||
</todo-panel>
|
||||
</component>
|
||||
<component name="editorManager"/>
|
||||
<component name="editorHistoryManager"/>
|
||||
<component name="DaemonCodeAnalyzer">
|
||||
<disable_hints/>
|
||||
</component>
|
||||
<component name="InspectionManager">
|
||||
<option name="AUTOSCROLL_TO_SOURCE" value="false"/>
|
||||
<option name="SPLITTER_PROPORTION" value="0.5"/>
|
||||
<profile name="Default"/>
|
||||
</component>
|
||||
<component name="BookmarkManager"/>
|
||||
<component name="DebuggerManager">
|
||||
<line_breakpoints/>
|
||||
<exception_breakpoints>
|
||||
<breakpoint_any>
|
||||
<option name="NOTIFY_CAUGHT" value="true"/>
|
||||
<option name="NOTIFY_UNCAUGHT" value="true"/>
|
||||
<option name="ENABLED" value="false"/>
|
||||
<option name="SUSPEND_VM" value="true"/>
|
||||
<option name="COUNT_FILTER_ENABLED" value="false"/>
|
||||
<option name="COUNT_FILTER" value="0"/>
|
||||
<option name="CONDITION_ENABLED" value="false"/>
|
||||
<option name="CONDITION"/>
|
||||
<option name="LOG_ENABLED" value="false"/>
|
||||
<option name="LOG_EXPRESSION_ENABLED" value="false"/>
|
||||
<option name="LOG_MESSAGE"/>
|
||||
<option name="CLASS_FILTERS_ENABLED" value="false"/>
|
||||
<option name="INVERSE_CLASS_FILLTERS" value="false"/>
|
||||
<option name="SUSPEND_POLICY" value="SuspendAll"/>
|
||||
</breakpoint_any>
|
||||
</exception_breakpoints>
|
||||
<field_breakpoints/>
|
||||
<method_breakpoints/>
|
||||
</component>
|
||||
<component name="DebuggerSettings">
|
||||
<option name="TRACING_FILTERS_ENABLED" value="true"/>
|
||||
<option name="TOSTRING_CLASSES_ENABLED" value="false"/>
|
||||
<option name="VALUE_LOOKUP_DELAY" value="700"/>
|
||||
<option name="DEBUGGER_TRANSPORT" value="0"/>
|
||||
<option name="FORCE_CLASSIC_VM" value="true"/>
|
||||
<option name="HIDE_DEBUGGER_ON_PROCESS_TERMINATION" value="false"/>
|
||||
<option name="SKIP_SYNTHETIC_METHODS" value="true"/>
|
||||
<option name="SKIP_CONSTRUCTORS" value="false"/>
|
||||
<option name="STEP_THREAD_SUSPEND_POLICY" value="SuspendThread"/>
|
||||
<default_breakpoint_settings>
|
||||
<option name="NOTIFY_CAUGHT" value="true"/>
|
||||
<option name="NOTIFY_UNCAUGHT" value="true"/>
|
||||
<option name="WATCH_MODIFICATION" value="true"/>
|
||||
<option name="WATCH_ACCESS" value="true"/>
|
||||
<option name="WATCH_ENTRY" value="true"/>
|
||||
<option name="WATCH_EXIT" value="true"/>
|
||||
<option name="ENABLED" value="true"/>
|
||||
<option name="SUSPEND_VM" value="true"/>
|
||||
<option name="COUNT_FILTER_ENABLED" value="false"/>
|
||||
<option name="COUNT_FILTER" value="0"/>
|
||||
<option name="CONDITION_ENABLED" value="false"/>
|
||||
<option name="CONDITION"/>
|
||||
<option name="LOG_ENABLED" value="false"/>
|
||||
<option name="LOG_EXPRESSION_ENABLED" value="false"/>
|
||||
<option name="LOG_MESSAGE"/>
|
||||
<option name="CLASS_FILTERS_ENABLED" value="false"/>
|
||||
<option name="INVERSE_CLASS_FILLTERS" value="false"/>
|
||||
<option name="SUSPEND_POLICY" value="SuspendAll"/>
|
||||
</default_breakpoint_settings>
|
||||
<filter>
|
||||
<option name="PATTERN" value="com.sun.*"/>
|
||||
<option name="ENABLED" value="true"/>
|
||||
</filter>
|
||||
<filter>
|
||||
<option name="PATTERN" value="java.*"/>
|
||||
<option name="ENABLED" value="true"/>
|
||||
</filter>
|
||||
<filter>
|
||||
<option name="PATTERN" value="javax.*"/>
|
||||
<option name="ENABLED" value="true"/>
|
||||
</filter>
|
||||
<filter>
|
||||
<option name="PATTERN" value="org.omg.*"/>
|
||||
<option name="ENABLED" value="true"/>
|
||||
</filter>
|
||||
<filter>
|
||||
<option name="PATTERN" value="sun.*"/>
|
||||
<option name="ENABLED" value="true"/>
|
||||
</filter>
|
||||
<filter>
|
||||
<option name="PATTERN" value="junit.*"/>
|
||||
<option name="ENABLED" value="true"/>
|
||||
</filter>
|
||||
</component>
|
||||
<component name="CompilerWorkspaceConfiguration">
|
||||
<option name="COMPILE_IN_BACKGROUND" value="false"/>
|
||||
<option name="AUTO_SHOW_ERRORS_IN_EDITOR" value="true"/>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<activeType name="Application"/>
|
||||
<configuration selected="false" default="true" type="Applet" factoryName="Applet">
|
||||
<module name=""/>
|
||||
<option name="MAIN_CLASS_NAME"/>
|
||||
<option name="HTML_FILE_NAME"/>
|
||||
<option name="HTML_USED" value="false"/>
|
||||
<option name="WIDTH" value="400"/>
|
||||
<option name="HEIGHT" value="300"/>
|
||||
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy"/>
|
||||
<option name="VM_PARAMETERS"/>
|
||||
</configuration>
|
||||
<configuration selected="false" default="true" type="Remote" factoryName="Remote">
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true"/>
|
||||
<option name="SERVER_MODE" value="false"/>
|
||||
<option name="SHMEM_ADDRESS" value="javadebug"/>
|
||||
<option name="HOST" value="localhost"/>
|
||||
<option name="PORT" value="5005"/>
|
||||
</configuration>
|
||||
<configuration selected="false" default="true" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME"/>
|
||||
<option name="VM_PARAMETERS"/>
|
||||
<option name="PROGRAM_PARAMETERS"/>
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"/>
|
||||
<module name=""/>
|
||||
</configuration>
|
||||
<configuration selected="false" default="true" type="JUnit" factoryName="JUnit">
|
||||
<module name=""/>
|
||||
<option name="PACKAGE_NAME"/>
|
||||
<option name="MAIN_CLASS_NAME"/>
|
||||
<option name="METHOD_NAME"/>
|
||||
<option name="TEST_OBJECT" value="class"/>
|
||||
<option name="VM_PARAMETERS"/>
|
||||
<option name="PARAMETERS"/>
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"/>
|
||||
<option name="ADDITIONAL_CLASS_PATH"/>
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="wholeProject"/>
|
||||
</option>
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="ACTIVE_VCS_NAME" value=""/>
|
||||
<option name="STATE" value="0"/>
|
||||
</component>
|
||||
<component name="VssConfiguration">
|
||||
<CheckoutOptions>
|
||||
<option name="COMMENT" value=""/>
|
||||
<option name="DO_NOT_GET_LATEST_VERSION" value="false"/>
|
||||
<option name="REPLACE_WRITABLE" value="false"/>
|
||||
<option name="RECURSIVE" value="false"/>
|
||||
</CheckoutOptions>
|
||||
<CheckinOptions>
|
||||
<option name="COMMENT" value=""/>
|
||||
<option name="KEEP_CHECKED_OUT" value="false"/>
|
||||
<option name="RECURSIVE" value="false"/>
|
||||
</CheckinOptions>
|
||||
<AddOptions>
|
||||
<option name="COMMENT" value=""/>
|
||||
<option name="STORE_ONLY_LATEST_VERSION" value="false"/>
|
||||
<option name="CHECK_OUT_IMMEDIATELY" value="false"/>
|
||||
<option name="FILE_TYPE" value="0"/>
|
||||
</AddOptions>
|
||||
<UndocheckoutOptions>
|
||||
<option name="MAKE_WRITABLE" value="false"/>
|
||||
<option name="REPLACE_LOCAL_COPY" value="0"/>
|
||||
<option name="RECURSIVE" value="false"/>
|
||||
</UndocheckoutOptions>
|
||||
<DiffOptions>
|
||||
<option name="IGNORE_WHITE_SPACE" value="false"/>
|
||||
<option name="IGNORE_CASE" value="false"/>
|
||||
</DiffOptions>
|
||||
<GetOptions>
|
||||
<option name="REPLACE_WRITABLE" value="0"/>
|
||||
<option name="MAKE_WRITABLE" value="false"/>
|
||||
<option name="RECURSIVE" value="false"/>
|
||||
</GetOptions>
|
||||
<option name="CLIENT_PATH" value=""/>
|
||||
<option name="SRCSAFEINI_PATH" value=""/>
|
||||
<option name="USER_NAME" value=""/>
|
||||
<option name="PWD" value=""/>
|
||||
<option name="SHOW_CHECKOUT_OPTIONS" value="true"/>
|
||||
<option name="SHOW_ADD_OPTIONS" value="true"/>
|
||||
<option name="SHOW_UNDOCHECKOUT_OPTIONS" value="true"/>
|
||||
<option name="SHOW_DIFF_OPTIONS" value="true"/>
|
||||
<option name="SHOW_GET_OPTIONS" value="true"/>
|
||||
<option name="USE_EXTERNAL_DIFF" value="false"/>
|
||||
<option name="EXTERNAL_DIFF_PATH" value=""/>
|
||||
<option name="REUSE_LAST_COMMENT" value="false"/>
|
||||
<option name="PUT_FOCUS_INTO_COMMENT" value="false"/>
|
||||
<option name="SHOW_CHECKIN_OPTIONS" value="true"/>
|
||||
<option name="LAST_COMMIT_MESSAGE" value=""/>
|
||||
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8"/>
|
||||
</component>
|
||||
<component name="CheckinPanelState"/>
|
||||
<component name="WebViewSettings">
|
||||
<webview flattenPackages="false" showMembers="false" autoscrollToSource="false"/>
|
||||
</component>
|
||||
<component name="EjbViewSettings">
|
||||
<EjbView showMembers="false" autoscrollToSource="false"/>
|
||||
</component>
|
||||
<component name="AppServerRunManager"/>
|
||||
<component name="StarteamConfiguration">
|
||||
<option name="SERVER" value=""/>
|
||||
<option name="PORT" value="49201"/>
|
||||
<option name="USER" value=""/>
|
||||
<option name="PASSWORD" value=""/>
|
||||
<option name="PROJECT" value=""/>
|
||||
<option name="VIEW" value=""/>
|
||||
<option name="ALTERNATIVE_WORKING_PATH" value=""/>
|
||||
<option name="PUT_FOCUS_INTO_COMMENT" value="false"/>
|
||||
<option name="SHOW_CHECKIN_OPTIONS" value="true"/>
|
||||
<option name="LAST_COMMIT_MESSAGE" value=""/>
|
||||
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8"/>
|
||||
</component>
|
||||
<component name="Cvs2Configuration">
|
||||
<option name="ON_FILE_ADDING" value="0"/>
|
||||
<option name="ON_FILE_REMOVING" value="0"/>
|
||||
<option name="PRUNE_EMPTY_DIRECTORIES" value="true"/>
|
||||
<option name="SHOW_UPDATE_OPTIONS" value="true"/>
|
||||
<option name="SHOW_ADD_OPTIONS" value="true"/>
|
||||
<option name="SHOW_REMOVE_OPTIONS" value="true"/>
|
||||
<option name="MERGING_MODE" value="0"/>
|
||||
<option name="MERGE_WITH_BRANCH1_NAME" value="HEAD"/>
|
||||
<option name="MERGE_WITH_BRANCH2_NAME" value="HEAD"/>
|
||||
<option name="RESET_STICKY" value="false"/>
|
||||
<option name="CREATE_NEW_DIRECTORIES" value="true"/>
|
||||
<option name="DEFAULT_TEXT_FILE_SUBSTITUTION" value="kv"/>
|
||||
<option name="PROCESS_UNKNOWN_FILES" value="false"/>
|
||||
<option name="PROCESS_DELETED_FILES" value="false"/>
|
||||
<option name="SHOW_EDIT_DIALOG" value="true"/>
|
||||
<option name="RESERVED_EDIT" value="false"/>
|
||||
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6"/>
|
||||
<option name="SHOW_CHECKOUT_OPTIONS" value="true"/>
|
||||
<option name="CHECKOUT_DATE_OR_REVISION_SETTINGS">
|
||||
<value>
|
||||
<option name="BRANCH" value=""/>
|
||||
<option name="DATE" value=""/>
|
||||
<option name="USE_BRANCH" value="false"/>
|
||||
<option name="USE_DATE" value="false"/>
|
||||
</value>
|
||||
</option>
|
||||
<option name="UPDATE_DATE_OR_REVISION_SETTINGS">
|
||||
<value>
|
||||
<option name="BRANCH" value=""/>
|
||||
<option name="DATE" value=""/>
|
||||
<option name="USE_BRANCH" value="false"/>
|
||||
<option name="USE_DATE" value="false"/>
|
||||
</value>
|
||||
</option>
|
||||
<option name="SHOW_CHANGES_REVISION_SETTINGS">
|
||||
<value>
|
||||
<option name="BRANCH" value=""/>
|
||||
<option name="DATE" value=""/>
|
||||
<option name="USE_BRANCH" value="false"/>
|
||||
<option name="USE_DATE" value="false"/>
|
||||
</value>
|
||||
</option>
|
||||
<option name="SHOW_OUTPUT" value="false"/>
|
||||
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false"/>
|
||||
<option name="UPDATE_GROUP_BY_PACKAGES" value="false"/>
|
||||
<option name="ADD_WATCH_INDEX" value="0"/>
|
||||
<option name="REMOVE_WATCH_INDEX" value="0"/>
|
||||
<option name="UPDATE_KEYWORD_SUBSTITUTION"/>
|
||||
<option name="MAKE_NEW_FILES_READONLY" value="false"/>
|
||||
<option name="SHOW_CORRUPTED_PROJECT_FILES" value="0"/>
|
||||
<option name="TAG_AFTER_FILE_COMMIT" value="false"/>
|
||||
<option name="TAG_AFTER_FILE_COMMIT_NAME" value=""/>
|
||||
<option name="TAG_AFTER_PROJECT_COMMIT" value="false"/>
|
||||
<option name="TAG_AFTER_PROJECT_COMMIT_NAME" value=""/>
|
||||
<option name="PUT_FOCUS_INTO_COMMENT" value="false"/>
|
||||
<option name="SHOW_CHECKIN_OPTIONS" value="true"/>
|
||||
<option name="FORCE_NON_EMPTY_COMMENT" value="false"/>
|
||||
<option name="LAST_COMMIT_MESSAGE" value=""/>
|
||||
<option name="SAVE_LAST_COMMIT_MESSAGE" value="true"/>
|
||||
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8"/>
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false"/>
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_FILE_COMMIT" value="false"/>
|
||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false"/>
|
||||
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false"/>
|
||||
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8"/>
|
||||
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5"/>
|
||||
</component>
|
||||
<component name="CvsTabbedWindow"/>
|
||||
<component name="SvnConfiguration">
|
||||
<option name="USER" value=""/>
|
||||
<option name="PASSWORD" value=""/>
|
||||
<option name="AUTO_ADD_FILES" value="0"/>
|
||||
<option name="AUTO_DEL_FILES" value="0"/>
|
||||
</component>
|
||||
<component name="PerforceConfiguration">
|
||||
<option name="PORT" value="magic:1666"/>
|
||||
<option name="USER" value=""/>
|
||||
<option name="PASSWORD" value=""/>
|
||||
<option name="CLIENT" value=""/>
|
||||
<option name="TRACE" value="false"/>
|
||||
<option name="PERFORCE_STATUS" value="true"/>
|
||||
<option name="CHANGELIST_OPTION" value="false"/>
|
||||
<option name="SYSTEMROOT" value=""/>
|
||||
<option name="P4_EXECUTABLE" value="p4"/>
|
||||
<option name="SHOW_BRANCH_HISTORY" value="false"/>
|
||||
<option name="GENERATE_COMMENT" value="false"/>
|
||||
<option name="SYNC_OPTION" value="Sync"/>
|
||||
<option name="PUT_FOCUS_INTO_COMMENT" value="false"/>
|
||||
<option name="SHOW_CHECKIN_OPTIONS" value="true"/>
|
||||
<option name="FORCE_NON_EMPTY_COMMENT" value="true"/>
|
||||
<option name="LAST_COMMIT_MESSAGE" value=""/>
|
||||
<option name="SAVE_LAST_COMMIT_MESSAGE" value="true"/>
|
||||
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8"/>
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false"/>
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_FILE_COMMIT" value="false"/>
|
||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false"/>
|
||||
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false"/>
|
||||
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8"/>
|
||||
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5"/>
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,541 @@
|
||||
<?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>
|
||||
<packaging>jar</packaging>
|
||||
<groupId>io.v</groupId>
|
||||
<artifactId>mini</artifactId>
|
||||
<version>5.3.0</version>
|
||||
|
||||
<properties>
|
||||
<nutzboot.version>2.4.2-SNAPSHOT</nutzboot.version>
|
||||
<nutz.version>1.r.68-SNAPSHOT</nutz.version>
|
||||
<mysql-connector-java.version>8.0.16</mysql-connector-java.version>
|
||||
<jaxb-api.version>2.3.1</jaxb-api.version>
|
||||
<slf4j.version>1.7.30</slf4j.version>
|
||||
<logback.version>1.2.3</logback.version>
|
||||
<easy-captcha.version>1.6.2</easy-captcha.version>
|
||||
<commons-lang3.version>3.8.1</commons-lang3.version>
|
||||
<emoji-java.veision>4.0.0</emoji-java.veision>
|
||||
<jsoup.veision>1.12.1</jsoup.veision>
|
||||
<pinyin4j.veision>2.5.1</pinyin4j.veision>
|
||||
<poi.version>4.1.2</poi.version>
|
||||
<tencentcloud-sdk-java.version>4.0.11</tencentcloud-sdk-java.version>
|
||||
<lombok.version>1.18.12</lombok.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<v.version>1.0.1</v.version>
|
||||
</properties>
|
||||
|
||||
<url>https://budwk.com</url>
|
||||
<description>java web development framework, base on budwk and nutz</description>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>wizzercn</id>
|
||||
<name>Wizzer</name>
|
||||
<email>wizzer@qq.com</email>
|
||||
<url>https://wizzer.cn</url>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mountcloud</groupId>
|
||||
<artifactId>graphql-client</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>pdfbox</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<artifactId>asm-util</artifactId>
|
||||
<version>7.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>asm</groupId>
|
||||
<artifactId>asm-all</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.openjdk.nashorn</groupId>
|
||||
<artifactId>nashorn-core</artifactId>
|
||||
<version>15.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>darabonba-java-core</artifactId>
|
||||
<version>0.1.5-beta</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>alibabacloud-dysmsapi20170525</artifactId>
|
||||
<version>2.0.22</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.draco1023</groupId>
|
||||
<artifactId>poi-tl-ext</artifactId>
|
||||
<version>0.3.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
<version>1.4.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<!--<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>ooxml-schemas</artifactId>
|
||||
<version>1.3</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>xmlbeans</artifactId>
|
||||
<groupId>org.apache.xmlbeans</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.artofsolving</groupId>
|
||||
<artifactId>jodconverter</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>jurt</artifactId>
|
||||
<groupId>org.openoffice</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.7.20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ws.schild</groupId>
|
||||
<artifactId>jave-all-deps</artifactId>
|
||||
<version>2.5.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qcloud</groupId>
|
||||
<artifactId>vod_api</artifactId>
|
||||
<version>2.1.5</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>tencentcloud-sdk-java</artifactId>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.coobird</groupId>
|
||||
<artifactId>thumbnailator</artifactId>
|
||||
<version>0.4.8</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.poi</groupId>-->
|
||||
<!-- <artifactId>ooxml-schemas</artifactId>-->
|
||||
<!-- <version>1.4</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>io.v</groupId>
|
||||
<artifactId>vi-nutz</artifactId>
|
||||
<version>${v.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<groupId>cn.hutool</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<groupId>javax.annotation</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>juh</artifactId>
|
||||
<groupId>org.openoffice</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>poi</artifactId>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>ridl</artifactId>
|
||||
<groupId>org.openoffice</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>unoil</artifactId>
|
||||
<groupId>org.openoffice</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>poi-tl</artifactId>
|
||||
<groupId>com.deepoove</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>javase</artifactId>
|
||||
<version>3.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>2.3.28</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.13</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<groupId>commons-codec</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.56</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-cas</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java</artifactId>
|
||||
<version>${tencentcloud-sdk-java.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>okio</artifactId>
|
||||
<groupId>com.squareup.okio</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.vdurmont</groupId>
|
||||
<artifactId>emoji-java</artifactId>
|
||||
<version>${emoji-java.veision}</version>
|
||||
</dependency>
|
||||
<!-- api token web server -->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>0.9.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- html -->
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>${jsoup.veision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>${pinyin4j.veision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons-lang3.version}</version>
|
||||
</dependency>
|
||||
<!-- json4excel,poi -->
|
||||
<dependency>
|
||||
<groupId>org.nutz</groupId>
|
||||
<artifactId>nutz-integration-json4excel</artifactId>
|
||||
<version>${nutz.version}</version>
|
||||
<exclusions><!-- 手动排除依赖,瘦身 -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>ooxml-schemas</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.nutz</groupId>
|
||||
<artifactId>nutzboot-starter-test-junit4</artifactId>
|
||||
<version>${nutzboot.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-core</artifactId>
|
||||
<version>${logback.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>${logback.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.whvcse</groupId>
|
||||
<artifactId>easy-captcha</artifactId>
|
||||
<version>${easy-captcha.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-validator</groupId>
|
||||
<artifactId>commons-validator</artifactId>
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.nutz</groupId>
|
||||
<artifactId>nutzboot-parent</artifactId>
|
||||
<version>${nutzboot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>${jaxb-api.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<configuration>
|
||||
<source>15</source>
|
||||
<target>15</target>
|
||||
<useIncrementalCompilation>false</useIncrementalCompilation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<charset>UTF-8</charset>
|
||||
<docencoding>UTF-8</docencoding>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<configuration>
|
||||
<attach>true</attach>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.0</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.nutz.boot</groupId>
|
||||
<artifactId>nutzboot-maven-plugin</artifactId>
|
||||
<version>${nutzboot.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>15</source>
|
||||
<target>15</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>nutz</id>
|
||||
<url>https://jfrog.nutz.cn/artifactory/libs-release</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>nutz-snapshots</id>
|
||||
<url>https://jfrog.nutz.cn/artifactory/snapshots</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>nutz-snapshots</id>
|
||||
<url>https://jfrog.nutz.cn/artifactory/snapshots</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</project>
|
||||
@@ -0,0 +1,999 @@
|
||||
package io.v.nutz;
|
||||
|
||||
import io.v.nutz.base.utils.AppIocUtil;
|
||||
import io.v.nutz.proposal.models.ProposalUndertake;
|
||||
import io.v.nutz.sys.models.*;
|
||||
import io.v.nutz.sys.services.SysTaskService;
|
||||
import io.v.nutz.task.services.TaskPlatformService;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import io.v.nutz.web.commons.ext.pubsub.WebPubSub;
|
||||
import io.v.nutz.web.commons.filter.CsrfFilter;
|
||||
import io.v.nutz.web.commons.filter.SsrfFilter;
|
||||
import io.v.nutz.web.tags.*;
|
||||
import org.beetl.core.GroupTemplate;
|
||||
import org.nutz.boot.NbApp;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.impl.FileSqlManager;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.integration.jedis.JedisAgent;
|
||||
import org.nutz.integration.shiro.ShiroSessionProvider;
|
||||
import org.nutz.ioc.Ioc;
|
||||
import org.nutz.ioc.impl.PropertiesProxy;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Mirror;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.Mvcs;
|
||||
import org.nutz.mvc.annotation.*;
|
||||
import org.quartz.Scheduler;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.ObjectName;
|
||||
import javax.servlet.ServletContext;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.sql.Driver;
|
||||
import java.sql.DriverManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author wizzer@qq.com
|
||||
*/
|
||||
@IocBean(create = "init", depose = "depose")
|
||||
@Localization(value = "locales/", defaultLocalizationKey = "zh_CN")
|
||||
@Encoding(input = "UTF-8", output = "UTF-8")
|
||||
@ChainBy(args = "chain/mvc-chain.json")
|
||||
@SessionBy(ShiroSessionProvider.class)
|
||||
@IocBy(args = {
|
||||
"*io.v.nutz.aop.ViReturnAopLoader",
|
||||
})
|
||||
@Filters(value = {@By(type = CsrfFilter.class), @By(type = SsrfFilter.class)})
|
||||
public class MainLauncher {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject("refer:$ioc")
|
||||
private Ioc ioc;
|
||||
@Inject
|
||||
private PropertiesProxy conf;
|
||||
@Inject
|
||||
private JedisAgent jedisAgent;
|
||||
@Inject
|
||||
private WebPubSub webPubSub;//注入一下为了初始化
|
||||
@Inject
|
||||
private GroupTemplate groupTemplate;
|
||||
@Inject
|
||||
private TaskPlatformService taskPlatformService;
|
||||
@Inject
|
||||
private SysTaskService sysTaskService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
NbApp nb = new NbApp().setArgs(args).setPrintProcDoc(true);
|
||||
nb.getAppContext().setMainPackage("io.v");
|
||||
nb.run();
|
||||
}
|
||||
|
||||
public static NbApp warMain(ServletContext sc) {
|
||||
NbApp nb = new NbApp().setPrintProcDoc(true);
|
||||
nb.getAppContext().setMainPackage("io.v");
|
||||
return nb;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Mvcs.DISABLE_X_POWERED_BY = true;
|
||||
Globals.AppBase = Mvcs.getServletContext().getContextPath();
|
||||
Globals.AppRoot = Mvcs.getServletContext().getRealPath("/");
|
||||
//注册自定义标签
|
||||
groupTemplate.registerTagFactory("cms_channel_list", () -> ioc.get(CmsChannelListTag.class));
|
||||
groupTemplate.registerTagFactory("cms_channel", () -> ioc.get(CmsChannelTag.class));
|
||||
groupTemplate.registerTagFactory("cms_article_list", () -> ioc.get(CmsArticleListTag.class));
|
||||
groupTemplate.registerTagFactory("cms_article", () -> ioc.get(CmsArticleTag.class));
|
||||
groupTemplate.registerTagFactory("cms_link_list", () -> ioc.get(CmsLinkListTag.class));
|
||||
init_sys();
|
||||
init_task();
|
||||
init_proposal_undertake();
|
||||
ioc.get(Globals.class);
|
||||
|
||||
// 存储Ioc
|
||||
AppIocUtil.setIoc(ioc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化承办单位表
|
||||
*/
|
||||
private void init_proposal_undertake() {
|
||||
int count = dao.count(ProposalUndertake.class, Cnd.NEW());
|
||||
if (count == 0) {
|
||||
List<Sys_unit> units = dao.query(Sys_unit.class, Cnd.where("unitlevel", "=", 2).and("parentId", "IS NOT", null));
|
||||
List<ProposalUndertake> proposalUnderTakes = units.stream().map(v -> {
|
||||
ProposalUndertake proposalUndertake = new ProposalUndertake();
|
||||
proposalUndertake.setUnitCode(v.getUnitcode());
|
||||
proposalUndertake.setUnitName(v.getName());
|
||||
proposalUndertake.setIsEnable(true);
|
||||
return proposalUndertake;
|
||||
}).collect(Collectors.toList());
|
||||
dao.insert(proposalUnderTakes);
|
||||
}
|
||||
}
|
||||
|
||||
private void init_task() {
|
||||
if (!dao.exists("sys_qrtz_triggers")) {
|
||||
//执行Quartz SQL脚本
|
||||
String dbType = dao.getJdbcExpert().getDatabaseType();
|
||||
log.debug("dbType:::" + dbType);
|
||||
FileSqlManager fmq = new FileSqlManager("quartz/" + dbType.toLowerCase() + ".sql");
|
||||
List<Sql> sqlListq = fmq.createCombo(fmq.keys());
|
||||
Sql[] sqlsq = sqlListq.toArray(new Sql[sqlListq.size()]);
|
||||
for (Sql sql : sqlsq) {
|
||||
dao.execute(sql);
|
||||
}
|
||||
}
|
||||
if (0 == sysTaskService.count()) {
|
||||
//定时任务示例
|
||||
Sys_task task = new Sys_task();
|
||||
task.setDisabled(true);
|
||||
task.setName("测试任务");
|
||||
task.setJobClass("io.v.nutz.task.job.TestJob");
|
||||
task.setCron("*/5 * * * * ?");
|
||||
task.setData("{\"hi\":\"Wechat:wizzer | send red packets of support,thank u\"}");
|
||||
task.setNote("微信号:wizzer | 欢迎发送红包以示支持,多谢。。");
|
||||
sysTaskService.insert(task);
|
||||
}
|
||||
}
|
||||
|
||||
private void init_sys() {
|
||||
//通过POJO类创建表结构
|
||||
try {
|
||||
Daos.createTablesInPackage(dao, "io.v", false);
|
||||
//通过POJO类修改表结构
|
||||
Daos.migration(dao, "io.v", true, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 若必要的数据表不存在,则初始化数据库
|
||||
if (0 == dao.count(Sys_user.class)) {
|
||||
//初始化配置表
|
||||
Sys_config conf = new Sys_config();
|
||||
conf.setConfigKey("AppName");
|
||||
conf.setConfigValue("BudWk-V5 mini");
|
||||
conf.setNote("系统名称");
|
||||
dao.insert(conf);
|
||||
conf = new Sys_config();
|
||||
conf.setConfigKey("AppShrotName");
|
||||
conf.setConfigValue("budwk");
|
||||
conf.setNote("系统短名称");
|
||||
dao.insert(conf);
|
||||
conf = new Sys_config();
|
||||
conf.setConfigKey("AppDomain");
|
||||
conf.setConfigValue("http://127.0.0.1:8080");
|
||||
conf.setNote("系统域名");
|
||||
dao.insert(conf);
|
||||
conf = new Sys_config();
|
||||
conf.setConfigKey("AppFileDomain");
|
||||
conf.setConfigValue("");
|
||||
conf.setNote("文件访问域名");
|
||||
dao.insert(conf);
|
||||
conf = new Sys_config();
|
||||
conf.setConfigKey("AppUploadBase");
|
||||
conf.setConfigValue("/upload");
|
||||
conf.setNote("文件访问路径");
|
||||
dao.insert(conf);
|
||||
conf = new Sys_config();
|
||||
conf.setConfigKey("SessionOnlyOne");
|
||||
conf.setConfigValue("true");
|
||||
conf.setNote("用户登录只允许一个Session实例(为true时退出登录会更新sys_user表在线状态)");
|
||||
dao.insert(conf);
|
||||
conf = new Sys_config();
|
||||
conf.setConfigKey("WebNotification");
|
||||
conf.setConfigValue("false");
|
||||
conf.setNote("启用浏览器通知");
|
||||
dao.insert(conf);
|
||||
//初始化单位
|
||||
Sys_unit unit = new Sys_unit();
|
||||
unit.setPath("0001");
|
||||
unit.setName("系统管理");
|
||||
unit.setAliasName("System");
|
||||
unit.setUnitcode("system");
|
||||
unit.setLocation(0);
|
||||
unit.setAddress("银河-太阳系-地球");
|
||||
unit.setEmail("wizzer@qq.com");
|
||||
unit.setTelephone("");
|
||||
unit.setHasChildren(false);
|
||||
unit.setParentId("");
|
||||
unit.setWebsite("https://budwk.com");
|
||||
Sys_unit dbunit = dao.insert(unit);
|
||||
//初始化菜单
|
||||
List<Sys_menu> menuList = new ArrayList<Sys_menu>();
|
||||
Sys_menu menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001");
|
||||
menu.setName("系统");
|
||||
menu.setNote("系统");
|
||||
menu.setAliasName("System");
|
||||
menu.setIcon("ti-settings");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("");
|
||||
menu.setTarget("");
|
||||
menu.setShowit(true);
|
||||
menu.setHasChildren(true);
|
||||
menu.setParentId("");
|
||||
menu.setType("menu");
|
||||
menu.setPermission("sys");
|
||||
Sys_menu m0 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("00010001");
|
||||
menu.setName("系统管理");
|
||||
menu.setNote("系统管理");
|
||||
menu.setAliasName("Manager");
|
||||
menu.setIcon("ti-settings");
|
||||
menu.setLocation(1);
|
||||
menu.setHref("");
|
||||
menu.setTarget("");
|
||||
menu.setShowit(true);
|
||||
menu.setHasChildren(true);
|
||||
menu.setParentId(m0.getId());
|
||||
menu.setType("menu");
|
||||
menu.setPermission("sys.manager");
|
||||
Sys_menu m1 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100010001");
|
||||
menu.setName("单位管理");
|
||||
menu.setAliasName("Unit");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("/platform/sys/unit");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.manager.unit");
|
||||
menu.setParentId(m1.getId());
|
||||
menu.setType("menu");
|
||||
Sys_menu m2 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100010001");
|
||||
menu.setName("添加单位");
|
||||
menu.setAliasName("Add");
|
||||
menu.setLocation(0);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.unit.add");
|
||||
menu.setParentId(m2.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m21 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100010002");
|
||||
menu.setName("修改单位");
|
||||
menu.setAliasName("Edit");
|
||||
menu.setLocation(0);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.unit.edit");
|
||||
menu.setParentId(m2.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m22 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100010003");
|
||||
menu.setName("删除单位");
|
||||
menu.setAliasName("Delete");
|
||||
menu.setLocation(0);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.unit.delete");
|
||||
menu.setParentId(m2.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m23 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100010002");
|
||||
menu.setName("用户管理");
|
||||
menu.setAliasName("User");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("/platform/sys/user");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.manager.user");
|
||||
menu.setHasChildren(false);
|
||||
menu.setParentId(m1.getId());
|
||||
menu.setType("menu");
|
||||
Sys_menu m3 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100020001");
|
||||
menu.setName("添加用户");
|
||||
menu.setAliasName("Add");
|
||||
menu.setLocation(0);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.user.add");
|
||||
menu.setParentId(m3.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m31 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100020002");
|
||||
menu.setName("修改用户");
|
||||
menu.setAliasName("Edit");
|
||||
menu.setLocation(1);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.user.edit");
|
||||
menu.setParentId(m3.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m32 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100020003");
|
||||
menu.setName("删除用户");
|
||||
menu.setAliasName("Delete");
|
||||
menu.setLocation(2);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.user.delete");
|
||||
menu.setParentId(m3.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m33 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100010003");
|
||||
menu.setName("角色管理");
|
||||
menu.setAliasName("Role");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("/platform/sys/role");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.manager.role");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setParentId(m1.getId());
|
||||
menu.setType("menu");
|
||||
Sys_menu m4 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100030001");
|
||||
menu.setName("添加角色");
|
||||
menu.setAliasName("Add");
|
||||
menu.setLocation(1);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.role.add");
|
||||
menu.setParentId(m4.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m41 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100030002");
|
||||
menu.setName("修改角色");
|
||||
menu.setAliasName("Edit");
|
||||
menu.setLocation(2);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.role.edit");
|
||||
menu.setParentId(m4.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m42 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100030003");
|
||||
menu.setName("删除角色");
|
||||
menu.setAliasName("Delete");
|
||||
menu.setLocation(3);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.role.delete");
|
||||
menu.setParentId(m4.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m43 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100030004");
|
||||
menu.setName("分配菜单");
|
||||
menu.setAliasName("SetMenu");
|
||||
menu.setLocation(4);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.role.menu");
|
||||
menu.setParentId(m4.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m44 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100030005");
|
||||
menu.setName("分配用户");
|
||||
menu.setAliasName("SetUser");
|
||||
menu.setLocation(5);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.role.user");
|
||||
menu.setParentId(m4.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m45 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100010004");
|
||||
menu.setName("菜单管理");
|
||||
menu.setAliasName("Menu");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("/platform/sys/menu");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.manager.menu");
|
||||
menu.setParentId(m1.getId());
|
||||
menu.setType("menu");
|
||||
Sys_menu m5 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100040001");
|
||||
menu.setName("添加菜单");
|
||||
menu.setAliasName("Add");
|
||||
menu.setLocation(1);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.menu.add");
|
||||
menu.setParentId(m5.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m51 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100040002");
|
||||
menu.setName("修改菜单");
|
||||
menu.setAliasName("Edit");
|
||||
menu.setLocation(2);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.menu.edit");
|
||||
menu.setParentId(m5.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m52 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100040003");
|
||||
menu.setName("删除菜单");
|
||||
menu.setAliasName("Delete");
|
||||
menu.setLocation(3);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.menu.delete");
|
||||
menu.setParentId(m5.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m53 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100010005");
|
||||
menu.setName("系统参数");
|
||||
menu.setAliasName("Param");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("/platform/sys/conf");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.manager.conf");
|
||||
menu.setParentId(m1.getId());
|
||||
menu.setType("menu");
|
||||
Sys_menu m6 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100050001");
|
||||
menu.setName("添加参数");
|
||||
menu.setAliasName("Add");
|
||||
menu.setLocation(1);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.conf.add");
|
||||
menu.setParentId(m6.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m61 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100050002");
|
||||
menu.setName("修改参数");
|
||||
menu.setAliasName("Edit");
|
||||
menu.setLocation(2);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.conf.edit");
|
||||
menu.setParentId(m6.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m62 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100050003");
|
||||
menu.setName("删除参数");
|
||||
menu.setAliasName("Delete");
|
||||
menu.setLocation(3);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.conf.delete");
|
||||
menu.setParentId(m6.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m63 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100010006");
|
||||
menu.setName("日志管理");
|
||||
menu.setAliasName("Log");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("/platform/sys/log");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.manager.log");
|
||||
menu.setParentId(m1.getId());
|
||||
menu.setType("menu");
|
||||
Sys_menu m7 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100060001");
|
||||
menu.setName("清除日志");
|
||||
menu.setAliasName("Delete");
|
||||
menu.setLocation(1);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.log.delete");
|
||||
menu.setParentId(m7.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m71 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100010007");
|
||||
menu.setName("定时任务");
|
||||
menu.setAliasName("Task");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("/platform/sys/task");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.manager.task");
|
||||
menu.setParentId(m1.getId());
|
||||
menu.setType("menu");
|
||||
Sys_menu m8 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100070001");
|
||||
menu.setName("添加任务");
|
||||
menu.setAliasName("Add");
|
||||
menu.setLocation(1);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.task.add");
|
||||
menu.setParentId(m8.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m81 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100070002");
|
||||
menu.setName("修改任务");
|
||||
menu.setAliasName("Edit");
|
||||
menu.setLocation(2);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.task.edit");
|
||||
menu.setParentId(m8.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m82 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100070003");
|
||||
menu.setName("删除任务");
|
||||
menu.setAliasName("Delete");
|
||||
menu.setLocation(3);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.task.delete");
|
||||
menu.setParentId(m8.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m83 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100010008");
|
||||
menu.setName("自定义路由");
|
||||
menu.setAliasName("Route");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("/platform/sys/route");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.manager.route");
|
||||
menu.setParentId(m1.getId());
|
||||
menu.setType("menu");
|
||||
Sys_menu m9 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100080001");
|
||||
menu.setName("添加路由");
|
||||
menu.setAliasName("Add");
|
||||
menu.setLocation(1);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.route.add");
|
||||
menu.setParentId(m9.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m91 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100080002");
|
||||
menu.setName("修改路由");
|
||||
menu.setAliasName("Edit");
|
||||
menu.setLocation(2);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.route.edit");
|
||||
menu.setParentId(m9.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m92 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100080003");
|
||||
menu.setName("删除路由");
|
||||
menu.setAliasName("Delete");
|
||||
menu.setLocation(3);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.route.delete");
|
||||
menu.setParentId(m9.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu m93 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setParentId(m0.getId());
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("00010002");
|
||||
menu.setName("系统配置");
|
||||
menu.setAliasName("Config");
|
||||
menu.setType("menu");
|
||||
menu.setLocation(2);
|
||||
menu.setIcon("ti-pencil-alt");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.config");
|
||||
menu.setHasChildren(true);
|
||||
Sys_menu pp1 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100020001");
|
||||
menu.setName("数据字典");
|
||||
menu.setAliasName("Dict");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("/platform/sys/dict");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.manager.dict");
|
||||
menu.setParentId(pp1.getId());
|
||||
menu.setType("menu");
|
||||
Sys_menu d = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000200010001");
|
||||
menu.setName("添加字典");
|
||||
menu.setAliasName("Add");
|
||||
menu.setLocation(1);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.dict.add");
|
||||
menu.setParentId(d.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu d1 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000200010002");
|
||||
menu.setName("修改字典");
|
||||
menu.setAliasName("Edit");
|
||||
menu.setLocation(2);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.dict.edit");
|
||||
menu.setParentId(d.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu d2 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000200010003");
|
||||
menu.setName("删除字典");
|
||||
menu.setAliasName("Delete");
|
||||
menu.setLocation(3);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.dict.delete");
|
||||
menu.setParentId(d.getId());
|
||||
menu.setType("data");
|
||||
Sys_menu d3 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100020002");
|
||||
menu.setName("密钥管理");
|
||||
menu.setAliasName("Api");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("/platform/sys/api");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.manager.api");
|
||||
menu.setParentId(pp1.getId());
|
||||
menu.setType("menu");
|
||||
Sys_menu appManger = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000200020001");
|
||||
menu.setName("添加密钥");
|
||||
menu.setAliasName("Add");
|
||||
menu.setLocation(0);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.api.add");
|
||||
menu.setParentId(appManger.getId());
|
||||
menu.setType("data");
|
||||
dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000200020002");
|
||||
menu.setName("修改密钥");
|
||||
menu.setAliasName("Edit");
|
||||
menu.setLocation(1);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.api.edit");
|
||||
menu.setParentId(appManger.getId());
|
||||
menu.setType("data");
|
||||
dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000200020003");
|
||||
menu.setName("删除密钥");
|
||||
menu.setAliasName("Delete");
|
||||
menu.setLocation(2);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.api.delete");
|
||||
menu.setParentId(appManger.getId());
|
||||
menu.setType("data");
|
||||
dao.insert(menu);
|
||||
|
||||
//消息中心及消息管理
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("00010003");
|
||||
menu.setName("消息中心");
|
||||
menu.setNote("消息中心");
|
||||
menu.setAliasName("InnerMsg");
|
||||
menu.setIcon("ti-bell");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("");
|
||||
menu.setTarget("");
|
||||
menu.setShowit(true);
|
||||
menu.setHasChildren(true);
|
||||
menu.setParentId(m0.getId());
|
||||
menu.setType("menu");
|
||||
menu.setPermission("sys.msg");
|
||||
Sys_menu msg0 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100030001");
|
||||
menu.setName("全部消息");
|
||||
menu.setAliasName("All");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("/platform/sys/msg/user/all");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.msg.all");
|
||||
menu.setParentId(msg0.getId());
|
||||
menu.setType("menu");
|
||||
dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100030002");
|
||||
menu.setName("未读消息");
|
||||
menu.setAliasName("Unread");
|
||||
menu.setLocation(1);
|
||||
menu.setHref("/platform/sys/msg/user/unread");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.msg.unread");
|
||||
menu.setParentId(msg0.getId());
|
||||
menu.setType("menu");
|
||||
dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100030003");
|
||||
menu.setName("已读消息");
|
||||
menu.setAliasName("Read");
|
||||
menu.setLocation(2);
|
||||
menu.setHref("/platform/sys/msg/user/read");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.msg.read");
|
||||
menu.setParentId(msg0.getId());
|
||||
menu.setType("menu");
|
||||
dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100010009");
|
||||
menu.setName("消息管理");
|
||||
menu.setAliasName("Msg");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("/platform/sys/msg");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.manager.msg");
|
||||
menu.setParentId(m1.getId());
|
||||
menu.setType("menu");
|
||||
Sys_menu msgManger = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100090001");
|
||||
menu.setName("添加消息");
|
||||
menu.setAliasName("Add");
|
||||
menu.setLocation(0);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.msg.add");
|
||||
menu.setParentId(msgManger.getId());
|
||||
menu.setType("data");
|
||||
dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100090002");
|
||||
menu.setName("修改消息");
|
||||
menu.setAliasName("Edit");
|
||||
menu.setLocation(1);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.msg.edit");
|
||||
menu.setParentId(msgManger.getId());
|
||||
menu.setType("data");
|
||||
dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000100090003");
|
||||
menu.setName("删除消息");
|
||||
menu.setAliasName("Delete");
|
||||
menu.setLocation(2);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.manager.msg.delete");
|
||||
menu.setParentId(msgManger.getId());
|
||||
menu.setType("data");
|
||||
dao.insert(menu);
|
||||
|
||||
//运维中心
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("00010004");
|
||||
menu.setName("运维中心");
|
||||
menu.setNote("运维中心");
|
||||
menu.setAliasName("Operation");
|
||||
menu.setIcon("ti-shield");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("");
|
||||
menu.setTarget("");
|
||||
menu.setShowit(true);
|
||||
menu.setHasChildren(true);
|
||||
menu.setParentId(m0.getId());
|
||||
menu.setType("menu");
|
||||
menu.setPermission("sys.operation");
|
||||
Sys_menu op0 = dao.insert(menu);
|
||||
//应用管理
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("000100040002");
|
||||
menu.setName("应用管理");
|
||||
menu.setAliasName("App");
|
||||
menu.setLocation(0);
|
||||
menu.setHref("/platform/sys/app");
|
||||
menu.setTarget("data-pjax");
|
||||
menu.setShowit(true);
|
||||
menu.setPermission("sys.operation.app");
|
||||
menu.setParentId(op0.getId());
|
||||
menu.setType("menu");
|
||||
Sys_menu op02 = dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000400020001");
|
||||
menu.setName("配置文件管理");
|
||||
menu.setAliasName("AppConfig");
|
||||
menu.setLocation(1);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.operation.app.conf");
|
||||
menu.setParentId(op02.getId());
|
||||
menu.setType("data");
|
||||
dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000400020002");
|
||||
menu.setName("Jar包管理");
|
||||
menu.setAliasName("AppJar");
|
||||
menu.setLocation(2);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.operation.app.jar");
|
||||
menu.setParentId(op02.getId());
|
||||
menu.setType("data");
|
||||
dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000400020003");
|
||||
menu.setName("实例管理");
|
||||
menu.setAliasName("AppInstance");
|
||||
menu.setLocation(3);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.operation.app.instance");
|
||||
menu.setParentId(op02.getId());
|
||||
menu.setType("data");
|
||||
dao.insert(menu);
|
||||
menu = new Sys_menu();
|
||||
menu.setDisabled(false);
|
||||
menu.setPath("0001000400020004");
|
||||
menu.setName("修改日志等级");
|
||||
menu.setAliasName("Loglevel");
|
||||
menu.setLocation(4);
|
||||
menu.setShowit(false);
|
||||
menu.setPermission("sys.operation.app.loglevel");
|
||||
menu.setParentId(op02.getId());
|
||||
menu.setType("data");
|
||||
dao.insert(menu);
|
||||
|
||||
|
||||
//初始化角色
|
||||
Sys_role role = new Sys_role();
|
||||
role.setName("公共角色");
|
||||
role.setCode("public");
|
||||
role.setAliasName("Public");
|
||||
role.setNote("All user has role");
|
||||
role.setUnitid("");
|
||||
role.setDisabled(false);
|
||||
dao.insert(role);
|
||||
role = new Sys_role();
|
||||
role.setName("系统管理员");
|
||||
role.setCode("sysadmin");
|
||||
role.setAliasName("Sysadmin");
|
||||
role.setNote("System Admin");
|
||||
role.setUnitid("");
|
||||
role.setMenus(menuList);
|
||||
role.setDisabled(false);
|
||||
Sys_role dbrole = dao.insert(role);
|
||||
//初始化用户
|
||||
Sys_user user = new Sys_user();
|
||||
user.setId("43d2c4a34fc64f88acf2d95d2908d8ed");
|
||||
user.setLoginname("superadmin");
|
||||
user.setUsername("超级管理员");
|
||||
user.setCreateAt(System.currentTimeMillis());
|
||||
//String slat=R.UU32();
|
||||
//new Sha256Hash("1",ByteSource.Util.bytes(s), 1024).toHex();
|
||||
user.setSalt("r5tdr01s7uglfokpsdmtu15602");
|
||||
user.setPassword("1bba9287ebc50b766bff84273d11ccefaa7a8da95d078960f05f116e9d970fb0");
|
||||
user.setLoginIp("127.0.0.1");
|
||||
user.setLoginAt(0L);
|
||||
user.setLoginCount(0);
|
||||
user.setEmail("wizzer@qq.com");
|
||||
user.setLoginTheme("palette.3.css");
|
||||
user.setLoginBoxed(false);
|
||||
user.setLoginScroll(true);
|
||||
user.setLoginSidebar(false);
|
||||
user.setLoginPjax(true);
|
||||
user.setUnitid(dbunit.getId());
|
||||
Sys_user dbuser = dao.insert(user);
|
||||
//不同的插入数据方式(安全)
|
||||
dao.insert("sys_user_unit", org.nutz.dao.Chain.make("userId", dbuser.getId()).add("unitId", dbunit.getId()));
|
||||
dao.insert("sys_user_role", Chain.make("userId", dbuser.getId()).add("roleId", dbrole.getId()));
|
||||
//执行SQL脚本
|
||||
FileSqlManager fm = new FileSqlManager("db/");
|
||||
List<Sql> sqlList = fm.createCombo(fm.keys());
|
||||
Sql[] sqls = sqlList.toArray(new Sql[sqlList.size()]);
|
||||
for (Sql sql : sqls) {
|
||||
dao.execute(sql);
|
||||
}
|
||||
//菜单关联到角色
|
||||
dao.execute(Sqls.create("INSERT INTO sys_role_menu(roleId,menuId) SELECT @roleId,id FROM sys_menu").setParam("roleId", dbrole.getId()));
|
||||
//消息中心放第一个位置
|
||||
dao.execute(Sqls.create("update sys_menu set location=0 where path='00010003'"));
|
||||
//初始化自定义路由
|
||||
Sys_route route = new Sys_route();
|
||||
route.setDisabled(false);
|
||||
route.setUrl("/sysadmin");
|
||||
route.setToUrl("/");
|
||||
route.setType("hide");
|
||||
dao.insert(route);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void depose() {
|
||||
// 非mysql数据库,或多webapp共享mysql驱动的话,以下语句删掉
|
||||
try {
|
||||
Mirror.me(Class.forName("com.mysql.jdbc.AbandonedConnectionCleanupThread")).invoke(null, "shutdown");
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
// 解决quartz有时候无法停止的问题
|
||||
try {
|
||||
ioc.get(Scheduler.class).shutdown(true);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
// 解决com.alibaba.druid.proxy.DruidDriver和com.mysql.jdbc.Driver在reload时报warning的问题
|
||||
// 多webapp共享mysql驱动的话,以下语句删掉
|
||||
Enumeration<Driver> en = DriverManager.getDrivers();
|
||||
while (en.hasMoreElements()) {
|
||||
try {
|
||||
Driver driver = en.nextElement();
|
||||
String className = driver.getClass().getName();
|
||||
log.debug("deregisterDriver: " + className);
|
||||
DriverManager.deregisterDriver(driver);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
try {
|
||||
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
|
||||
ObjectName objectName = new ObjectName("com.alibaba.druid:type=MockDriver");
|
||||
if (mbeanServer.isRegistered(objectName))
|
||||
mbeanServer.unregisterMBean(objectName);
|
||||
objectName = new ObjectName("com.alibaba.druid:type=DruidDriver");
|
||||
if (mbeanServer.isRegistered(objectName))
|
||||
mbeanServer.unregisterMBean(objectName);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package io.v.nutz.activity.controller.applets;
|
||||
|
||||
import io.v.nutz.activity.models.ActivitySchoolApply;
|
||||
import io.v.nutz.activity.services.ActivitySchoolApplyService;
|
||||
import io.v.nutz.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.adaptor.JsonAdaptor;
|
||||
import org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-16 10:19
|
||||
* @description: 小程序活动
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/applets/list")
|
||||
public class ActivityListController {
|
||||
|
||||
@Inject("Sys_user")
|
||||
private ViService<Sys_user> sysUserService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolApplyService activitySchoolApplyService;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page, @Param(value = "userId",required = false) String userId,
|
||||
@Param(value = "time",required = false) String time) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
school.id,
|
||||
school.`name`,
|
||||
school.address,
|
||||
school.applyStartTime,
|
||||
school.applyEndTime,
|
||||
school.startTime,
|
||||
school.endTime,
|
||||
school.image,
|
||||
(SELECT count( 1 ) FROM activity_school_apply app WHERE app.activityId = school.id AND app.`status` = 2 ) personNum,
|
||||
(SELECT count( 1 ) FROM activity_school_apply app WHERE app.activityId = school.id AND ( app.applyUser = @userid OR app.userId = @userid )) > 0 applied
|
||||
FROM
|
||||
activity_school school
|
||||
LEFT JOIN activity_school_apply asa ON asa.activityId = school.id
|
||||
$condition
|
||||
""").setParam("userid", userId);
|
||||
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
cnd.and("school.close", "!=", true);
|
||||
|
||||
cnd.and("school.isSave", "!=", true);
|
||||
|
||||
cnd.where().andLike("school.applyWay ", "3");
|
||||
|
||||
if (time.equals("recent")) {
|
||||
cnd.and(new Static("CURRENT_DATE() < school.endTime"));
|
||||
} else if (time.equals("history")) {
|
||||
cnd.and(new Static("CURRENT_DATE() > school.endTime"));
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(userId)) {
|
||||
cnd.and("asa.applyUser", "=", userId);
|
||||
}
|
||||
|
||||
cnd.groupBy("school.id");
|
||||
cnd.desc("school.startTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return activitySchoolService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getActivity(String id, String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
school.id,
|
||||
school.`name`,
|
||||
school.address,
|
||||
school.applyStartTime,
|
||||
school.applyEndTime,
|
||||
school.startTime,
|
||||
school.endTime,
|
||||
school.image,
|
||||
school.applyWay,
|
||||
school.eventNotification,
|
||||
(SELECT count( 1 ) FROM activity_school_apply app WHERE app.activityId = school.id AND app.`status` = 2 ) personNum,
|
||||
(SELECT count( 1 ) FROM activity_school_apply app WHERE app.activityId = school.id AND ( app.applyUser = @userId OR app.userId = @userid )) > 0 applied
|
||||
FROM
|
||||
activity_school school
|
||||
WHERE
|
||||
school.id = @id
|
||||
$condition
|
||||
""").setParam("id", id).setParam("userId", userId);
|
||||
|
||||
return activitySchoolService.fetch(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@AdaptBy(type = JsonAdaptor.class)
|
||||
public Object doApply(@Param("apply") ActivitySchoolApply apply) {
|
||||
apply.setStatus(2);
|
||||
activitySchoolApplyService.insert(apply);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@AdaptBy(type = JsonAdaptor.class)
|
||||
public Object doUniteApply(@Param("apply") List<ActivitySchoolApply> apply, @Param("activityId") String activityId, @Param("unionId") String unionId) {
|
||||
activitySchoolApplyService.clear(Cnd.where("activityId", "=", activityId).and("unionId", "=", unionId));
|
||||
|
||||
apply.forEach(v -> {
|
||||
v.setStatus(2);
|
||||
v.setActivityId(activityId);
|
||||
activitySchoolApplyService.insert(v);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@AdaptBy(type = JsonAdaptor.class)
|
||||
public Object removeApply(@Param("activityId") String activityId, @Param("userId") String userId) {
|
||||
activitySchoolApplyService.clear(Cnd.where("activityId", "=", activityId).and("applyUser", "=", userId));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@AdaptBy(type = JsonAdaptor.class)
|
||||
public Object findUser(@Param("userId") String userId, @Param("searchName") String searchName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT id applyUser, loginname, username, sex, mobile, unitid unitId, unionid unionId FROM `user` $condition
|
||||
""").setParam("userId", userId).setParam("roleId", Roles.UNION_MANGER);
|
||||
|
||||
cnd.and("unionid", "in", "(SELECT sur.unionid FROM sys_user_role sur WHERE sur.userId = '" + userId + "' AND sur.roleId = '" + Roles.UNION_MANGER + "')");
|
||||
|
||||
if (Strings.isNotBlank(searchName)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.andLike("username", searchName).orLike("loginname", searchName);
|
||||
cnd.and(group);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return sysUserService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@AdaptBy(type = JsonAdaptor.class)
|
||||
public Object getApplyPerson(@Param("activityId") String activityId, @Param("unionId") String unionId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("activityId", "=", activityId).and("unionId", "=", unionId);
|
||||
return activitySchoolApplyService.query(cnd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,421 @@
|
||||
package io.v.nutz.activity.controller.basic;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.activity.models.ActivityUserCnd;
|
||||
import io.v.nutz.activity.models.ActivityUserScope;
|
||||
import io.v.nutz.activity.services.ActivityBasicScopeService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_role;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.POST;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 活动人员分组设置
|
||||
* @createTime 2022年01月04日 10:15:00
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/activity/basic/scope")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class ActivityBasicScopeController {
|
||||
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@Inject
|
||||
private ActivityBasicScopeService activityBasicScopeService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/basic/ActivityScope.html")
|
||||
@RequiresPermissions("activity.basic.scope")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询可以设置活动的人员
|
||||
*
|
||||
* @param pageForm 页面形式
|
||||
* @param unionId 工会id
|
||||
* @param unitId 单位id
|
||||
* @param personTypes 人类型
|
||||
* @param userStates 用户状态
|
||||
* @param memberTypes 成员类型
|
||||
* @param sexTypes 性类型
|
||||
* @param age 年龄
|
||||
* @param teacherMeetingId 教师会议id
|
||||
* @param roleIds 角色id
|
||||
* @param userId 用户id
|
||||
* @param clubId 俱乐部id
|
||||
* @param reverseSelection 逆向选择
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@POST
|
||||
@RequiresPermissions("activity.basic.scope")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "userStates", required = false) String[] userStates,
|
||||
@Param(value = "memberTypes", required = false) String[] memberTypes,
|
||||
@Param(value = "sexTypes", required = false) String[] sexTypes,
|
||||
@Param(value = "age", required = false) String[] age,
|
||||
@Param(value = "teacherMeetingId", required = false) String teacherMeetingId,
|
||||
@Param(value = "roleIds", required = false) String[] roleIds,
|
||||
@Param(value = "userId", required = false) String[] userId,
|
||||
@Param(value = "clubId", required = false) String clubId,
|
||||
@Param(value = "reverseSelection") boolean reverseSelection,
|
||||
@Param(value = "activityGroupId", required = false) Integer activityGroupId,
|
||||
@Param(value = "activityUserCnd", required = false) String activityUserCndStr) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
DISTINCT(u.id) as id,
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.mobile,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.unitname AS unitName,
|
||||
u.unionname AS unionName,
|
||||
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age
|
||||
FROM
|
||||
`user` u
|
||||
LEFT JOIN sys_user_role sur on sur.userid = u.id
|
||||
LEFT JOIN sys_club_user clubuser ON clubuser.userid=u.id
|
||||
$condition
|
||||
""");
|
||||
String IN_OR_NIN_OP = reverseSelection ? "NOT IN" : "IN";
|
||||
String EQ_OR_NEQ_OP = reverseSelection ? "!=" : "=";
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
}
|
||||
|
||||
if (activityGroupId != null) {
|
||||
Sql sqlx = Sqls.createf("SELECT userId FROM activity_user_scope where groupId = '%s'", activityGroupId);
|
||||
cnd.and("u.id", reverseSelection ? "IN" : "NOT IN", sqlx);
|
||||
}
|
||||
|
||||
cnd.andEX("u.id", IN_OR_NIN_OP, userId);
|
||||
|
||||
if (Lang.isNotEmpty(memberTypes)) {
|
||||
if (ArrayUtils.contains(memberTypes, "工会会员")) {
|
||||
cnd.and("u.member", EQ_OR_NEQ_OP, 1);
|
||||
}
|
||||
if (ArrayUtils.contains(memberTypes, "福利会员")) {
|
||||
cnd.and("u.welfareMember", EQ_OR_NEQ_OP, 1);
|
||||
}
|
||||
if (ArrayUtils.contains(memberTypes, "基金会员")) {
|
||||
cnd.and(new Static(" u.loginname " + IN_OR_NIN_OP + " (select loginname from sick_fund_member)"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!Lang.isEmptyArray(age)) {
|
||||
if (!age[1].equals("0")) {
|
||||
if (reverseSelection) {
|
||||
cnd.andNot("TIMESTAMPDIFF(YEAR, u.birthday, CURDATE())", "between", age);
|
||||
} else {
|
||||
cnd.and("TIMESTAMPDIFF(YEAR, u.birthday, CURDATE())", "between", age);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
SqlExpressionGroup sqlExpressionGroup = ActivityUserCnd.formatSql("u", activityUserCndStr, reverseSelection);
|
||||
if (!sqlExpressionGroup.isEmpty()) {
|
||||
cnd.and(sqlExpressionGroup);
|
||||
}
|
||||
|
||||
cnd.andEX("u.unionid", EQ_OR_NEQ_OP, unionId);
|
||||
cnd.andEX("u.unitid", EQ_OR_NEQ_OP, unitId);
|
||||
cnd.andEX("u.personType", IN_OR_NIN_OP, personTypes);
|
||||
cnd.andEX("u.userState", IN_OR_NIN_OP, userStates);
|
||||
cnd.andEX("u.sex", IN_OR_NIN_OP, sexTypes);
|
||||
cnd.andEX("sur.jdhid", EQ_OR_NEQ_OP, teacherMeetingId);
|
||||
cnd.andEX("sur.roleid", IN_OR_NIN_OP, roleIds);
|
||||
cnd.andEX("clubuser.clubid", EQ_OR_NEQ_OP, clubId);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return simpleService.list(pageForm, sql);
|
||||
} catch (NumberFormatException e) {
|
||||
return Result.error(e.getMessage() + "请输入数字类型的值");
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置活动人员
|
||||
*
|
||||
* @param unionId 工会id
|
||||
* @param unitId 单位id
|
||||
* @param personTypes 人员类型
|
||||
* @param userStates 在职状态
|
||||
* @return Result
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@POST
|
||||
@RequiresPermissions("activity.basic.scope")
|
||||
public Object doSetActivityUser(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "userStates", required = false) String[] userStates,
|
||||
@Param(value = "memberTypes", required = false) String[] memberTypes,
|
||||
@Param(value = "sexTypes", required = false) String[] sexTypes,
|
||||
@Param(value = "age", required = false) String[] age,
|
||||
@Param(value = "activityGroupId", required = false) String activityGroupId,
|
||||
@Param(value = "setGroupType", required = false) Integer setGroupType,
|
||||
@Param(value = "setGroupId", required = false) Integer setGroupId,
|
||||
@Param(value = "setGroupName", required = false) String setGroupName,
|
||||
@Param(value = "teacherMeetingId", required = false) String teacherMeetingId,
|
||||
@Param(value = "roleIds", required = false) String[] roleIds,
|
||||
@Param(value = "userId", required = false) String[] userId,
|
||||
@Param(value = "clubId", required = false) String clubId,
|
||||
@Param(value = "reverseSelection") boolean reverseSelection,
|
||||
@Param(value = "activityUserCnd", required = false) String activityUserCndStr) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT DISTINCT
|
||||
( u.id ) AS userId
|
||||
FROM
|
||||
`user` u
|
||||
LEFT JOIN sys_user_role sur ON sur.userid = u.id
|
||||
LEFT JOIN sys_club_user clubuser ON clubuser.userid=u.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
String IN_OR_NIN_OP = reverseSelection ? "NOT IN" : "IN";
|
||||
String EQ_OR_NEQ_OP = reverseSelection ? "!=" : "=";
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
}
|
||||
|
||||
if (activityGroupId != null) {
|
||||
Sql sqlx = Sqls.createf("SELECT userId FROM activity_user_scope where groupId = '%s'", activityGroupId);
|
||||
cnd.and("u.id", reverseSelection ? "IN" : "NOT IN", sqlx);
|
||||
}
|
||||
|
||||
cnd.andEX("u.id", IN_OR_NIN_OP, userId);
|
||||
|
||||
if (Lang.isNotEmpty(memberTypes)) {
|
||||
if (ArrayUtils.contains(memberTypes, "工会会员")) {
|
||||
cnd.and("u.member", EQ_OR_NEQ_OP, 1);
|
||||
}
|
||||
if (ArrayUtils.contains(memberTypes, "福利会员")) {
|
||||
cnd.and("u.welfareMember", EQ_OR_NEQ_OP, 1);
|
||||
}
|
||||
if (ArrayUtils.contains(memberTypes, "基金会员")) {
|
||||
cnd.and(new Static(" u.loginname " + IN_OR_NIN_OP + " (select loginname from sick_fund_member)"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!Lang.isEmptyArray(age)) {
|
||||
if (!age[1].equals("0")) {
|
||||
if (reverseSelection) {
|
||||
cnd.andNot("TIMESTAMPDIFF(YEAR, u.birthday, CURDATE())", "between", age);
|
||||
} else {
|
||||
cnd.and("TIMESTAMPDIFF(YEAR, u.birthday, CURDATE())", "between", age);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
SqlExpressionGroup sqlExpressionGroup = ActivityUserCnd.formatSql("u", activityUserCndStr, reverseSelection);
|
||||
if (!sqlExpressionGroup.isEmpty()) {
|
||||
cnd.and(sqlExpressionGroup);
|
||||
}
|
||||
|
||||
cnd.andEX("u.unionid", EQ_OR_NEQ_OP, unionId);
|
||||
cnd.andEX("u.unitid", EQ_OR_NEQ_OP, unitId);
|
||||
cnd.andEX("u.personType", IN_OR_NIN_OP, personTypes);
|
||||
cnd.andEX("u.userState", IN_OR_NIN_OP, userStates);
|
||||
cnd.andEX("u.sex", IN_OR_NIN_OP, sexTypes);
|
||||
cnd.andEX("sur.jdhid", EQ_OR_NEQ_OP, teacherMeetingId);
|
||||
cnd.andEX("sur.roleid", IN_OR_NIN_OP, roleIds);
|
||||
cnd.andEX("clubuser.clubid", EQ_OR_NEQ_OP, clubId);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.entities());
|
||||
sql.setEntity(dao.getEntity(ActivityUserScope.class));
|
||||
dao.execute(sql);
|
||||
|
||||
List<ActivityUserScope> list = sql.getList(ActivityUserScope.class);
|
||||
|
||||
NutMap groupMap = null;
|
||||
int maxCount = 0;
|
||||
|
||||
if (setGroupType == 1) {
|
||||
groupMap = simpleService.fetch(Sqls.create("select groupName from activity_user_scope where groupId = @groupId").setParam("groupId", setGroupId));
|
||||
} else if (setGroupType == 2) {
|
||||
maxCount = simpleService.count(Sqls.create("select max(groupId) from activity_user_scope"));
|
||||
}
|
||||
|
||||
for (ActivityUserScope userScope : list) {
|
||||
if (setGroupType == 1) {
|
||||
userScope.setGroupId(setGroupId);
|
||||
userScope.setGroupName(groupMap.getString("groupName"));
|
||||
} else if (setGroupType == 2) {
|
||||
userScope.setGroupId(maxCount + 1);
|
||||
userScope.setGroupName(setGroupName);
|
||||
}
|
||||
userScope.setCreator((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
|
||||
if (list.size() < 500) {
|
||||
dao.insert(list);
|
||||
return setGroupType == 1 ? setGroupId : maxCount + 1;
|
||||
}
|
||||
//多线程插入
|
||||
activityBasicScopeService.largeDataInsert(list);
|
||||
return setGroupType == 1 ? setGroupId : maxCount + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组别
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
// @RequiresPermissions("activity.basic.scope")
|
||||
public Object getActivityUserScopeGroup() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
groupId,
|
||||
groupName
|
||||
FROM
|
||||
activity_user_scope
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H06,H10")) {
|
||||
if (ShiroUtil.hasAnyRoles(new String[]{"H04", "club01"})) {
|
||||
cnd.and("creator", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
}
|
||||
cnd.and("groupId", "IS NOT", null);
|
||||
cnd.and("groupName", "IS NOT", null);
|
||||
cnd.groupBy("groupId");
|
||||
sql.setCondition(cnd);
|
||||
return simpleService.listMap(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看该人员是否在活动范围中
|
||||
*
|
||||
* @param activityGroupId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
// @RequiresPermissions("activity.basic.scope")
|
||||
public Object getScopeUser(String activityGroupId, @Param(value = "userId", required = false) String userId) {
|
||||
String userid = StrUtil.isNotBlank(userId) ? userId : io.v.nutz.util.ShiroUtil.getUserId();
|
||||
// return simpleService.dao().count(ActivityUserScope.class, Cnd.where("groupId", "=", activityGroupId).and("userId", "=", userid));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getRoleListByMenuId(String menuId) {
|
||||
return simpleService.dao().query(Sys_role.class, Cnd.where("system_name", "=", menuId).desc("code"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断用户权限及获取工会id
|
||||
*
|
||||
* @return java.lang.Object
|
||||
* @author zhf
|
||||
* @description
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getRolesAndUnion() {
|
||||
return new NutMap() {{
|
||||
addv("is_H10", ShiroUtil.hasRole("H10"));
|
||||
addv("is_A06", ShiroUtil.hasRole("A06"));
|
||||
addv("is_H04", ShiroUtil.hasAnyRoles("H04,ghzl"));
|
||||
addv("is_H02", ShiroUtil.hasRole("club01"));
|
||||
addv("is_H03", ShiroUtil.hasRole("H03"));
|
||||
addv("is_sysadmin", ShiroUtil.hasRole("sysadmin"));
|
||||
addv("unionid", Vi.getUnionId());
|
||||
}};
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息表列
|
||||
* 提供两种方式
|
||||
*
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getUserTableColumnInfo() {
|
||||
try {
|
||||
//2.从数据库查询
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
COLUMN_NAME,
|
||||
DATA_TYPE,
|
||||
CHARACTER_MAXIMUM_LENGTH,
|
||||
COLUMN_COMMENT
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_NAME = 'sys_user'
|
||||
AND TABLE_SCHEMA = 'union_nsi'
|
||||
""");
|
||||
List<NutMap> sqlDataList = activityBasicScopeService.listMap(sql);
|
||||
sqlDataList.forEach(v -> v.put("DATA_TYPE", new String((byte[]) v.get("DATA_TYPE"))));
|
||||
return sqlDataList;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
package io.v.nutz.activity.controller.basic;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.activity.models.ActivityBasicSettings;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.AsyncService;
|
||||
import io.v.nutz.service.ViService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/2/23 15:44
|
||||
* @description 活动基础设置
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/basic/basic/settings")
|
||||
public class ActivityBasicSettingsController {
|
||||
|
||||
@Inject("ActivityBasicSettings")
|
||||
private ViService<ActivityBasicSettings> basicSettingsViService;
|
||||
|
||||
@Inject
|
||||
private AsyncService asyncService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/basic/ActivityBasic.html")
|
||||
@RequiresPermissions("activity.basic.settings")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.settings")
|
||||
public Object pageData(String parentId, PageForm pageForm) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.andExcludeEmpty("parentId", "=", parentId);
|
||||
cnd.asc("code");
|
||||
|
||||
return basicSettingsViService.list(pageForm, cnd);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.settings")
|
||||
public Object getTreeData() {
|
||||
List list = new ArrayList();
|
||||
ActivityBasicSettings parentId = basicSettingsViService.fetch(Cnd.where("parentId", "=", "0"));
|
||||
if (parentId != null) {
|
||||
parentId.setChild(child(parentId.getId()));
|
||||
list.add(parentId);
|
||||
return Result.success().addData(list);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<ActivityBasicSettings> child(String parentId) {
|
||||
List<ActivityBasicSettings> basicSettings = basicSettingsViService.query(Cnd.where("parentId", "=", parentId).asc("code"));
|
||||
|
||||
basicSettings.forEach(v -> {
|
||||
v.setChild(child(v.getId()));
|
||||
});
|
||||
|
||||
return basicSettings;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.settings")
|
||||
public Object doAdd(ActivityBasicSettings activityBasicSettings) {
|
||||
if (basicSettingsViService.count(Cnd.where("code", "=", activityBasicSettings.getCode())) > 0) {
|
||||
return Result.error("代码已存在");
|
||||
}
|
||||
basicSettingsViService.update(Chain.make("hasChildren", true), Cnd.where("id", "=", activityBasicSettings.getParentId()));
|
||||
basicSettingsViService.insert(activityBasicSettings);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.settings")
|
||||
public Object doEditType(ActivityBasicSettings activityBasicSettings) {
|
||||
basicSettingsViService.updateIgnoreNull(activityBasicSettings);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.settings")
|
||||
public Object doDelete(String id) {
|
||||
basicSettingsViService.delete(id);
|
||||
basicSettingsViService.clear(Cnd.where("parentId", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getActivityTwoLevelType(String code) {
|
||||
ActivityBasicSettings fetch = basicSettingsViService.fetch(Cnd.where("code", "=", code));
|
||||
List<ActivityBasicSettings> query = basicSettingsViService.query(Cnd.where("parentId", "=", fetch.getId()).asc("code"));
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
package io.v.nutz.activity.controller.basic;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.activity.models.ActivityUserScope;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.POST;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年01月04日 10:15:00
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/activity/basic/user")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class ActivityBasicUserController {
|
||||
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/basic/ActivityUser.html")
|
||||
@RequiresPermissions("activity.basic.user")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@POST
|
||||
@RequiresPermissions("activity.basic.user")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "groupId", required = false) Integer groupId,
|
||||
@Param(value = "activityUnionId", required = false) String activityUnionId,
|
||||
@Param(value = "activityUnitId", required = false) String activityUnitId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
aus.id,
|
||||
u.username AS userName,
|
||||
u.loginname AS loginName,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.mobile,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.unitname AS unitName,
|
||||
u.unionname AS unionName,
|
||||
aus.groupId,
|
||||
aus.groupName,
|
||||
actun.unionname AS activityUnionName
|
||||
FROM
|
||||
activity_user_scope aus
|
||||
LEFT JOIN `user` u ON u.id = aus.userId
|
||||
LEFT JOIN activity_basic_unit actit ON actit.id=u.unitid
|
||||
LEFT JOIN activity_basic_union actun ON actit.unionid=actun.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
cnd.andEX("actit.unionid", "=", activityUnionId);
|
||||
cnd.andEX("actit.id", "=", activityUnitId);
|
||||
cnd.andEX("aus.groupId", "=", groupId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.personType", "=", personType);
|
||||
cnd.andEX("u.userState", "=", userState);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
cnd.andEX("aus.creator", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return simpleService.list(pageForm, sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一条记录
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.user")
|
||||
public Object doDelete(@Param(value = "id", required = false) String id,
|
||||
@Param(value = "groupId", required = false) Integer groupId,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "activityUnionId", required = false) String activityUnionId,
|
||||
@Param(value = "activityUnitId", required = false) String activityUnitId,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(id)) {
|
||||
cnd.and("id", "=", id);
|
||||
simpleService.dao().clear(ActivityUserScope.class, cnd);
|
||||
} else {
|
||||
List<User> users = simpleService.dao().query(User.class, Cnd.NEW());
|
||||
if (StrUtil.isNotBlank(searchKeyword) && StrUtil.isNotBlank(searchName)) {
|
||||
users = users.stream().filter(v -> v.getLoginname().equals(searchKeyword) || v.getUsername().equals(searchKeyword)).collect(Collectors.toList());
|
||||
}
|
||||
if (StrUtil.isNotBlank(unionId)) {
|
||||
users = users.stream().filter(v -> StrUtil.isNotBlank(v.getUnionid()) && v.getUnionid().equals(unionId)).collect(Collectors.toList());
|
||||
}
|
||||
if (StrUtil.isNotBlank(unitId)) {
|
||||
users = users.stream().filter(v -> StrUtil.isNotBlank(v.getUnitid()) && v.getUnitid().equals(unitId)).collect(Collectors.toList());
|
||||
}
|
||||
if (StrUtil.isNotBlank(personType)) {
|
||||
users = users.stream().filter(v -> StrUtil.isNotBlank(v.getPersonType()) && v.getPersonType().equals(personType)).collect(Collectors.toList());
|
||||
}
|
||||
if (StrUtil.isNotBlank(userState)) {
|
||||
users = users.stream().filter(v -> StrUtil.isNotBlank(v.getUserState()) && v.getUserState().equals(userState)).collect(Collectors.toList());
|
||||
}
|
||||
if (StrUtil.isNotBlank(activityUnitId)) {
|
||||
users = users.stream().filter(v -> StrUtil.isNotBlank(v.getActivityUnitId()) && v.getActivityUnitId().equals(activityUnitId)).collect(Collectors.toList());
|
||||
}
|
||||
if (StrUtil.isNotBlank(activityUnionId)) {
|
||||
users = users.stream().filter(v -> StrUtil.isNotBlank(v.getActivityUnionId()) && v.getActivityUnionId().equals(activityUnionId)).collect(Collectors.toList());
|
||||
}
|
||||
List<String> ids = users.stream().map(User::getId).collect(Collectors.toList());
|
||||
cnd.andEX("userId", "in", ids);
|
||||
cnd.andEX("groupId", "=", groupId);
|
||||
if (Lang.isEmpty(ids)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
simpleService.dao().clear(ActivityUserScope.class, cnd);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void doExportUser(Integer groupId, HttpServletResponse response) {
|
||||
|
||||
|
||||
try {
|
||||
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.username AS userName,
|
||||
u.loginname AS loginName,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.unitname AS unitName,
|
||||
u.unionName AS unionName
|
||||
FROM
|
||||
activity_user_scope aus
|
||||
LEFT JOIN `user` u ON u.id = aus.userId
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("aus.groupId", "=", groupId);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> listMap = simpleService.listMap(sql);
|
||||
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("工会", "unionName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("手机号码", "mobile", 20));
|
||||
|
||||
|
||||
ViTool.excelResponse(response, "活动分组人员.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, listMap);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package io.v.nutz.activity.controller.basic;
|
||||
|
||||
import io.v.nutz.activity.models.ActivityBasicSettings;
|
||||
import io.v.nutz.activity.models.ActivityEvent;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/2/24 14:09
|
||||
* @description 比赛项目
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/basic/event")
|
||||
public class ActivityEventController {
|
||||
|
||||
//运动类型id
|
||||
public static final String EXERCISE_TYPE = "f708d6343c9542b791d32532f860d120";
|
||||
|
||||
//比赛组别id
|
||||
public static final String COMPETITION_CATEGORY = "60f9c36cadce493494a2373cc64d216f";
|
||||
//距离id
|
||||
public static final String DISTANCE = "d6d9196e87184729abd0dca1bd5df984";
|
||||
|
||||
@Inject("ActivityEvent")
|
||||
private ViService<ActivityEvent> activityEventViService;
|
||||
|
||||
@Inject("ActivityBasicSettings")
|
||||
private ViService<ActivityBasicSettings> basicSettingsViService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/basic/ActivityEvent.html")
|
||||
@RequiresPermissions("activity.basic.event")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.event")
|
||||
public Object focusGroup() {
|
||||
return basicSettingsViService.query(Cnd.where("parentId", "=", COMPETITION_CATEGORY).asc("code"));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.event")
|
||||
public Object exerciseType() {
|
||||
return basicSettingsViService.query(Cnd.where("parentId", "=", EXERCISE_TYPE));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.event")
|
||||
public Object focusDistance() {
|
||||
return basicSettingsViService.query(Cnd.where("parentId", "=", DISTANCE).asc("name"));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.event")
|
||||
public Object changeExercise_typeList(String exerciseType) {
|
||||
return basicSettingsViService.query(Cnd.where("parentId", "=", exerciseType));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.event")
|
||||
public Object pageData(PageForm page, @Param(value = "group", required = false) String group,@Param(value = "events", required = false) String events,@Param(value = "isMenWomen", required = false) String[] isMenWomen,@Param(value = "activityId", required = false) String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
even.*,
|
||||
ba.`name` baname,
|
||||
di.`name` diname,
|
||||
sp.`name` spname,
|
||||
exe.`name` exename
|
||||
FROM
|
||||
activity_event even
|
||||
LEFT JOIN activity_school_event ase ON ase.eventId = even.id
|
||||
LEFT JOIN activity_basic_settings ba ON even.competitionCategory = ba.id
|
||||
LEFT JOIN activity_basic_settings di ON even.distance = di.id
|
||||
LEFT JOIN activity_basic_settings sp ON even.sports = sp.id
|
||||
LEFT JOIN activity_basic_settings exe ON even.exerciseType = exe.id $condition
|
||||
""");
|
||||
Cnd cnd = CndPlus.create();
|
||||
SqlExpressionGroup sqlExpressionGroup = new SqlExpressionGroup();
|
||||
if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("2"))) {
|
||||
sqlExpressionGroup.and("even.isMenWomen", "=", 1);
|
||||
}
|
||||
if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("3"))) {
|
||||
sqlExpressionGroup.or("even.isMenWomen", "=", 2);
|
||||
}
|
||||
if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("4"))) {
|
||||
sqlExpressionGroup.and("even.projectType", "=", 1);
|
||||
}
|
||||
if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("5"))) {
|
||||
sqlExpressionGroup.or("even.projectType", "=", 2);
|
||||
}
|
||||
if (sqlExpressionGroup.getExps().size() > 0) {
|
||||
cnd.and(sqlExpressionGroup);
|
||||
}
|
||||
cnd.groupBy("even.id");
|
||||
cnd.andEX("even.competitionCategory", "=", group);
|
||||
cnd.andEX("exe.id", "=", events);
|
||||
cnd.andEX("ase.activityId", "=", activityId);
|
||||
cnd.desc("projectCode");
|
||||
cnd.asc("projectType");
|
||||
cnd.desc("baname");
|
||||
cnd.asc("isMenWomen");
|
||||
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return activityEventViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.event")
|
||||
public Object doAdd(ActivityEvent activityEvent) {
|
||||
activityEvent.setWhetherEnable(true);
|
||||
activityEventViService.insert(activityEvent);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.event")
|
||||
public Object doEdit(ActivityEvent activityEvent) {
|
||||
activityEventViService.update(activityEvent);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.event")
|
||||
public Object doDelete(String id) {
|
||||
activityEventViService.delete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.event")
|
||||
public Object doAssignmentDate(String[] eventIds, String startAgeDate, String endAgeDate) {
|
||||
for (String eventId : eventIds) {
|
||||
activityEventViService.update(Chain.make("startAgeDate", startAgeDate).add("endAgeDate", endAgeDate), Cnd.where("id", "=", eventId));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.event")
|
||||
public Object getProjectCodeIsExist(String projectCode) {
|
||||
return activityEventViService.fetch(Cnd.where("projectCode", "=", projectCode));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,595 @@
|
||||
package io.v.nutz.activity.controller.basic;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.activity.models.ActivityBasicUnion;
|
||||
import io.v.nutz.activity.models.ActivityBasicUnit;
|
||||
import io.v.nutz.activity.models.ActivitySchoolApply;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.lang.Lang;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.*;
|
||||
import io.v.nutz.sys.services.SysDictService;
|
||||
import io.v.nutz.sys.services.SysRoleService;
|
||||
import io.v.nutz.sys.services.SysUserRoleService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.controller.ViCommonCon;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/7/28 13:56
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At({"/platform/activity/basic/union", "/platform/activity/basic/union2"})
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class ActivityUnionController {
|
||||
|
||||
@Inject("ActivityBasicUnion")
|
||||
private ViService<ActivityBasicUnion> sysUnionService;
|
||||
|
||||
@Inject("ActivityBasicUnit")
|
||||
private ViService<ActivityBasicUnit> sysUnitService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/basic/ActivityUnion.html")
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public void index() {
|
||||
}
|
||||
|
||||
private boolean checkRole() {
|
||||
if (ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "A06"})) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改角色
|
||||
*
|
||||
* @param unionid
|
||||
* @param roleId
|
||||
* @param userId
|
||||
* @param type 1 添加 2 删除
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object changeSchoolUnionRole(String unionid, String roleId, String roleCode, String userId, int type) {
|
||||
if (type == 1) {
|
||||
Sys_user_role role = new Sys_user_role();
|
||||
role.setUserId(userId);
|
||||
Sys_role sysRole = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
role.setRoleId(sysRole.getId());
|
||||
if (Strings.isNotBlank(unionid)) {
|
||||
role.setUnionid(unionid);
|
||||
}
|
||||
sysUserRoleService.insert(role);
|
||||
} else if (type == 2) {
|
||||
Cnd cnd = Cnd.where("roleId", "=", roleId).and("userId", "=", userId);
|
||||
sysUserRoleService.clear(cnd);
|
||||
}
|
||||
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取校工会 / 院级工会 的角色/人员
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object schoolUnionRoles(String unionid, String searchName, String searchKeyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
role.`name` rolename,
|
||||
role.id roleid,
|
||||
u.id,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.mobile
|
||||
FROM
|
||||
sys_user_role sur
|
||||
LEFT JOIN sys_role role ON sur.roleId = role.id
|
||||
LEFT JOIN sys_dict dict ON dict.`code` = role.`code`
|
||||
LEFT JOIN `user` u ON sur.userId = u.id
|
||||
$condition
|
||||
order by FIELD( role.`code`, 'wyh01', 'wyh02', 'A06', 'wyh03', 'tamange', 'flwyh01', 'H10', 'xghng', 'xghkj' )
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
if (Strings.isNotBlank(unionid)) {
|
||||
cnd.and(new Static("dict.parentId = ( SELECT id FROM sys_dict WHERE `code` = 'GrassrootsCadres' LIMIT 1)"));
|
||||
cnd.and("u.unionid", "=", unionid);
|
||||
} else {
|
||||
cnd.and(new Static("dict.parentId = ( SELECT id FROM sys_dict WHERE `code` = 'SchoolRoles' LIMIT 1)"));
|
||||
}
|
||||
|
||||
if (Lang.notNull(searchName, searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return sysDictService.list(sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object unionTree() {
|
||||
try {
|
||||
ActivityBasicUnit basicUnit = sysUnionService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", Vi.getUnit().getId()));
|
||||
|
||||
Record record = new Record();
|
||||
record.set("unionname", "工会委员会");
|
||||
if (checkRole()) {
|
||||
record.set("sysadmin", true);
|
||||
record.set("childrens", sysUnionService.query(Cnd.NEW().asc("unioncode")));
|
||||
} else {
|
||||
record.set("sysadmin", true);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.*
|
||||
FROM
|
||||
activity_basic_union gh
|
||||
WHERE
|
||||
gh.id = @id
|
||||
""").setParam("id", basicUnit.getUnionid());
|
||||
record.set("childrens", sysUnionService.list(sql));
|
||||
}
|
||||
|
||||
return Result.success().addData(record);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object unionPageData(String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
try {
|
||||
ActivityBasicUnit basicUnit = sysUnionService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", Vi.getUnit().getId()));
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"\tgh.*,\n" +
|
||||
"\tun.isEnable AS unisEnable,\n" +
|
||||
"\t(SELECT COUNT(*) FROM activity_basic_unit WHERE unionid=gh.id) unitnum,\n" +
|
||||
"\tGROUP_CONCAT( fzr.username,'(',fzr.loginname,')' ) fzr\n" +
|
||||
"FROM\n" +
|
||||
"\tactivity_basic_union gh\n" +
|
||||
"\tLEFT JOIN sys_union un ON un.id = gh.id\n" +
|
||||
"\tLEFT JOIN sys_user_role sur ON gh.id = sur.unionid \n" +
|
||||
"\tAND (sur.roleId = @ghfzrrole)\n" +
|
||||
"\tLEFT JOIN sys_user fzr ON sur.userId = fzr.id $condition");
|
||||
sql.setParam("ghfzrrole", Roles.UNION_MANGER);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.groupBy("gh.id");
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.and(searchName, "like", "%" + searchKeyword + "%");
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
cnd.and("gh.id", "=", basicUnit.getUnionid());
|
||||
}
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
} else {
|
||||
cnd.asc("unioncode");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return Result.success().addData(sysUnionService.listPageMap(pageNumber, pageSize, sql));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
|
||||
/**
|
||||
* 添加工会
|
||||
*
|
||||
* @param union
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object doAddUnion(ActivityBasicUnion union) {
|
||||
try {
|
||||
union.setSource("activity");
|
||||
sysUnionService.insert(union);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H04,ghzl")) {
|
||||
sysUnitService.dao().update(ActivityBasicUnit.class, Chain.make("unionid", union.getId()), Cnd.where("id", "=", Vi.getUnit().getId()));
|
||||
}
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看工会信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object editUnion(String id) {
|
||||
try {
|
||||
return Result.success().addData(sysUnionService.fetch(id));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工会
|
||||
*
|
||||
* @param union
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object doEditUnion(ActivityBasicUnion union) {
|
||||
try {
|
||||
sysUnionService.update(union);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
private void flushDict() {
|
||||
sysDictService.clear(Cnd.where("parentId", "=", ViCommonCon.DICT_UNION_ID));
|
||||
List<ActivityBasicUnion> unions = sysUnionService.query();
|
||||
for (ActivityBasicUnion union : unions) {
|
||||
Sys_dict dict = new Sys_dict();
|
||||
dict.setParentId(ViCommonCon.DICT_UNION_ID);
|
||||
dict.setName(union.getUnionname());
|
||||
dict.setCode(union.getUnioncode());
|
||||
sysDictService.insert(dict);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工会
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object doDeleteUnion(String id, boolean flag) {
|
||||
try {
|
||||
|
||||
if (flag) {
|
||||
sysUnionService.delete(id);
|
||||
sysUnionService.dao().clear(ActivitySchoolApply.class, Cnd.where("activityUnionId", "=", id));
|
||||
} else {
|
||||
List<ActivityBasicUnit> unitList = sysUnitService.query(Cnd.where("unionId", "=", id));
|
||||
unitList.forEach(v -> {
|
||||
Sys_unit unit = sysUnionService.dao().fetch(Sys_unit.class, v.getId());
|
||||
sysUnitService.update(Chain.make("unionid", unit.getUnionid()), Cnd.where("id", "=", unit.getId()));
|
||||
});
|
||||
}
|
||||
//再清除单位对应的工会id
|
||||
sysUnionService.update("activity_basic_unit", Chain.make("unionid", ""), Cnd.where("unionid", "=", id));
|
||||
|
||||
|
||||
//再删除工会负责人的权限
|
||||
// sysUnionService.clear("sys_user_role", Cnd.where("unionid", "=", id).and("roleid", "=", Roles.UNION_MANGER));
|
||||
|
||||
|
||||
// flushDict();
|
||||
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工会的用户和负责人
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object getUserAndFzr(String id) {
|
||||
try {
|
||||
Sql sql = Sqls.create("SELECT u.id,u.username,u.loginname,CONCAT( u.username, '(', u.loginname, ')','-',u.unitname ) name from `user` u left join activity_basic_unit un on u.unitid=un.id WHERE un.unionid = @id").setParam("id", id);
|
||||
Sql sql1 = Sqls.create("SELECT u.id,u.username,u.loginname,CONCAT( u.username, '(', u.loginname, ')','-',u.unitname ) name from `user` u left join activity_basic_unit un on u.unitid=un.id left join sys_user_role sur on u.id = sur.userId WHERE sur.unionid = @id and sur.userId is not null and sur.roleId = @roleid").setParam("id", id).setParam("roleid", Roles.UNION_MANGER);
|
||||
return Result.success().addData(Record.create().set("data", sysUnionService.list(sql)).set("value", sysUnionService.list(sql1)));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工会负责人
|
||||
*
|
||||
* @param unionid
|
||||
* @param userids
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object doEditFzr(String unionid, String userids) {
|
||||
try {
|
||||
//再删除工会负责人的权限
|
||||
sysUnionService.clear("sys_user_role", Cnd.where("unionid", "=", unionid).and("roleid", "=", Roles.UNION_MANGER));
|
||||
for (String id : Json.fromJsonAsList(String.class, userids)) {
|
||||
sysUnionService.insert("sys_user_role", Chain.make("roleid", Roles.UNION_MANGER).add("userid", id).add("unionid", unionid));
|
||||
}
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public Object getUnitsByUnion(String unionid) {
|
||||
try {
|
||||
if (Strings.isNotBlank(unionid)) {
|
||||
return Result.success().addData(sysUnitService.query(Cnd.where("unionid", "=", unionid).and("unitlevel", "=", 2)));
|
||||
}
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object hyPageData(String unitid, String unionid, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
try {
|
||||
// Sql sql = Sqls.create("SELECT u.id,u.username,u.loginname,u.sex,un.`name` unitname,u.mobile from sys_user u left join sys_unit un on u.unitid = un.id $condition");
|
||||
|
||||
Sql sql = Sqls.create("SELECT u.id,u.username,u.loginname,u.sex,u.unitname,u.mobile from member u $condition");
|
||||
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("u.unitid", "in", Sqls.create("select id from activity_basic_unit where unionid=@unionid").setParam("unionid", unionid));
|
||||
|
||||
// cnd.and("u.unionid", "=", unionid);
|
||||
|
||||
|
||||
if (Strings.isNotBlank(unitid)) {
|
||||
cnd.and("u.unitid", "=", unitid);
|
||||
}
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.and(searchName, "like", "%" + searchKeyword + "%");
|
||||
}
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
} else {
|
||||
cnd.asc("u.unitid");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return Result.success().addData(sysUnionService.listPage(pageNumber, pageSize, sql));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
private SysUserRoleService sysUserRoleService;
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object delSpy(String userid, String roleid) {
|
||||
try {
|
||||
sysUserRoleService.clear(Cnd.where("userid", "=", userid).and("roleid", "=", roleid));
|
||||
sysRoleService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object doAddSpy(String[] userids, String[] roleids) {
|
||||
try {
|
||||
for (String userid : userids) {
|
||||
for (String roleid : roleids) {
|
||||
sysUserRoleService.clear(Cnd.where("userId", "=", userid).and("roleId", "=", roleid));
|
||||
Sys_user user = sysUserService.fetch(userid);
|
||||
ActivityBasicUnit unit = sysUnitService.fetch(user.getUnitid());
|
||||
Sys_user_role sysUserRole = new Sys_user_role();
|
||||
sysUserRole.setUserId(userid);
|
||||
sysUserRole.setRoleId(roleid);
|
||||
sysUserRole.setUnionid(unit.getUnionid());
|
||||
sysUserRoleService.insert(sysUserRole);
|
||||
}
|
||||
}
|
||||
sysRoleService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object spyPageData(String qxid, String unionid, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
try {
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"\tsur.roleId,\n" +
|
||||
"\tsur.userId,\n" +
|
||||
"\tu.username,\n" +
|
||||
"\tu.loginname,\n" +
|
||||
"\tun.`name` unitname,\n" +
|
||||
"\tfgh.unionname,\n" +
|
||||
"\trole.`name` rolename\n" +
|
||||
"FROM\n" +
|
||||
"\t`sys_user_role` sur\n" +
|
||||
"\tleft join sys_role role on sur.roleId = role.id\n" +
|
||||
"\tLEFT JOIN sys_user u ON u.id = sur.userId\n" +
|
||||
"\tLEFT JOIN activity_basic_unit un ON u.unitid = un.id\n" +
|
||||
"\tLEFT JOIN activity_basic_union fgh ON un.unionid = fgh.id $condition");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and("un.unionid", "=", unionid);
|
||||
|
||||
if (Strings.isNotBlank(qxid)) {
|
||||
cnd.and("sur.roleId", "=", qxid);
|
||||
} else {
|
||||
cnd.and("sur.roleId in (SELECT role.id from sys_dict dict left join sys_role role on dict.`code` = role.`code` WHERE parentId = '" + ViCommonCon.DICT_SPYJS_ID + "') and 1", "=", 1);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
} else {
|
||||
cnd.asc("sur.roleId");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return Result.success().addData(sysUnionService.listPage(pageNumber, pageSize, sql));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object getDwAndZcdw(String unionid) {
|
||||
try {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.and("unionid", "is", null).or("unionid", "=", "").or("unionid", "=", unionid);
|
||||
return Result.success().addData(Record.create().set("data", sysUnitService.query(Cnd.where("unitlevel", "=", 2))).set("value", sysUnitService.query(Cnd.where("unionid", "=", unionid).and("unitlevel", "=", 2))));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改工会组成单位
|
||||
*
|
||||
* @param unionid
|
||||
* @param unitids
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object doEditZcdw(String unionid, String unitids) {
|
||||
try {
|
||||
sysUnitService.execute(Sqls.create("UPDATE activity_basic_unit set unionid = null WHERE unionid=@id").setParam("id", unionid));
|
||||
for (String id : Json.fromJsonAsList(String.class, unitids)) {
|
||||
sysUnitService.update(Chain.make("unionid", unionid), Cnd.where("id", "=", id));
|
||||
}
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 根据关键字和工会id找用户
|
||||
*
|
||||
* @param query
|
||||
* @param unionid
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object getUserByUnionId(String query, String unionid) {
|
||||
try {
|
||||
return Result.success().addData(sysUserService.listPage(1, 50, Sqls.create("SELECT u.id,u.username,u.loginname,u.sex,u.mobile,u.zw,u.email\n" +
|
||||
"from sys_user u left join activity_basic_unit un on u.unitid = un.id WHERE un.unionid = @unionid and (u.username LIKE @query or u.loginname like @query)").setParam("unionid", unionid).setParam("query", "%" + query + "%")));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object isEnableChange(String id, boolean isEnable) {
|
||||
sysUnionService.update(Chain.make("isEnable", isEnable), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object getActivityUnions() {
|
||||
return sysUnionService.query();
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.basic.union", "activity.basic.union2"}, logical = Logical.OR)
|
||||
public Object getActivityUnits(String unionId) {
|
||||
if (Strings.isBlank(unionId)) {
|
||||
return sysUnitService.dao().query(ActivityBasicUnit.class, Cnd.where("unitlevel", "=", 2).asc("id"));
|
||||
}
|
||||
return sysUnitService.dao().query(ActivityBasicUnit.class, Cnd.where("unionid", "=", unionId).and("unitlevel", "=", 2).asc("id"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
package io.v.nutz.activity.controller.basic;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.activity.models.ActivityBasicUnit;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.AsyncService;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_unit;
|
||||
import io.v.nutz.sys.services.SysUnitClassService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/7/28 10:46
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/activity/basic/unit")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class ActivityUnitController {
|
||||
|
||||
|
||||
@Inject("ActivityBasicUnit")
|
||||
private ViService<ActivityBasicUnit> sysUnitService;
|
||||
|
||||
@Inject
|
||||
private SysUnitClassService sysUnitClassService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/basic/ActivityUnit.html")
|
||||
@RequiresPermissions("activity.basic.unit")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.unit")
|
||||
public Object pageData(@Param(value = "parentId", required = false) String parentId, PageForm pageForm) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.andExcludeEmpty("parentId", "=", parentId);
|
||||
return sysUnitService.list(pageForm, cnd);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.unit")
|
||||
public Object findOne(String id) {
|
||||
return sysUnitService.fetch(id);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.unit")
|
||||
public Object doAdd(ActivityBasicUnit activityBasicUnit) {
|
||||
if (sysUnitService.count(Cnd.where("unitcode", "=", activityBasicUnit.getUnitcode())) > 0) {
|
||||
return Result.error("单位代码已存在");
|
||||
}
|
||||
sysUnitService.update(Chain.make("hasChildren", true), Cnd.where("id", "=", activityBasicUnit.getParentId()));
|
||||
sysUnitService.insert(activityBasicUnit);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.unit")
|
||||
public Object doEdit(Sys_unit sys_unit) {
|
||||
if (sysUnitService.count(Cnd.where("unitcode", "=", sys_unit.getUnitcode()).and("id", "!=", sys_unit.getId())) > 0) {
|
||||
return Result.error("单位代码已存在");
|
||||
}
|
||||
sysUnitService.update(sys_unit);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.unit")
|
||||
public Object doDelete(String id) {
|
||||
ActivityBasicUnit unit = sysUnitService.fetch(id);
|
||||
int count = sysUnitService.count(Cnd.where("parentId", "=", unit.getParentId()).and("id", "!=", id));
|
||||
sysUnitService.update(Chain.make("hasChildren", count > 0), Cnd.where("id", "=", unit.getParentId()));
|
||||
delete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
private void delete(String id) {
|
||||
Cnd cnd = Cnd.where("parentId", "=", id);
|
||||
List<ActivityBasicUnit> units = sysUnitService.query(cnd);
|
||||
for (ActivityBasicUnit unit : units) {
|
||||
delete(unit.getId());
|
||||
}
|
||||
sysUnitService.clear(cnd);
|
||||
sysUnitService.delete(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取树形数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("activity.basic.unit")
|
||||
public Object getUnitTreeData() {
|
||||
try {
|
||||
List list = new ArrayList();
|
||||
|
||||
ActivityBasicUnit school = sysUnitService.fetch("999999");
|
||||
if(school == null) {
|
||||
return Result.success();
|
||||
}
|
||||
school.setChild(child(school.getId()));
|
||||
|
||||
list.add(school);
|
||||
|
||||
return Result.success().addData(list);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("获取单位信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
private AsyncService asyncService;
|
||||
|
||||
private List<ActivityBasicUnit> child(String parentId) {
|
||||
List<ActivityBasicUnit> units = sysUnitService.query(Cnd.where("parentId", "=", parentId));
|
||||
|
||||
units.forEach(unit -> {
|
||||
unit.setChild(child(unit.getId()));
|
||||
});
|
||||
|
||||
return units;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@RequiresPermissions("activity.basic.unit")
|
||||
public Object getUnit2() {
|
||||
try {
|
||||
return Result.success().addData(sysUnitService.query(Cnd.where("unitlevel", "=", 2).asc("location")));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.unit")
|
||||
public Object findPersonByUnitId(PageForm pageForm, String unitId) {
|
||||
NutMap map = new NutMap();
|
||||
|
||||
CndPlus cndPlus = CndPlus.create();
|
||||
cndPlus.andExcludeEmpty("unitid", "=", unitId);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cndPlus.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword());
|
||||
}
|
||||
cndPlus.asc("member");
|
||||
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
su.*
|
||||
FROM
|
||||
sys_user su
|
||||
LEFT JOIN sys_user_role sur ON sur.userId = su.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
CndPlus cndPlus2 = CndPlus.create();
|
||||
cndPlus2.andExcludeEmpty("sur.roleId", "=", Roles.UNIT_MANGER);
|
||||
cndPlus2.andExcludeEmpty("su.unitid", "=", unitId);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cndPlus2.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword());
|
||||
}
|
||||
|
||||
sql.setCondition(cndPlus2);
|
||||
|
||||
map.setv("userList", sysUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cndPlus));
|
||||
map.setv("principal", sysUserService.listMap(sql));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,824 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.activity.models.*;
|
||||
import io.v.nutz.activity.services.ActivitySchoolApplyService;
|
||||
import io.v.nutz.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.activity.services.ActivitySchoolTeamService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_unit;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.async.Async;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-02-24 16:31
|
||||
* @description: 活动报名
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/apply")
|
||||
@RequiresAuthentication
|
||||
public class ActivityApplyController {
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@Inject
|
||||
protected SysUserService sysUserService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolApplyService activitySchoolApplyService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolTeamService activitySchoolTeamService;
|
||||
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@Inject("ActivitySchoolEvent")
|
||||
private ViService<ActivitySchoolEvent> activitySchoolEventViService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/school/ActivityApply.html")
|
||||
@RequiresPermissions("activity.apply")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object applyPageData(PageForm page,
|
||||
@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "eventId", required = false) String eventId) {
|
||||
Cnd cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
apply.*,team.`name`,acts.name actsname,ev.allName
|
||||
FROM
|
||||
Activity_School_Apply apply LEFT JOIN activity_school_team team ON apply.teamId=team.id
|
||||
LEFT JOIN activity_school acts ON acts.id=apply.activityId
|
||||
LEFT JOIN activity_event ev ON ev.id = apply.eventId $condition
|
||||
""");
|
||||
cnd.and("apply.activityUnionId", "=", getUnionId());
|
||||
/* if (!ShiroUtil.hasAnyRoles("A06,sysadmin")) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
if (ShiroUtil.hasAnyRoles("H01")) {
|
||||
group.or("applyUser", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
if (ShiroUtil.hasAnyRoles("H04,ghzl")) {
|
||||
group.or("unionId", "=", getUnionId());
|
||||
}
|
||||
cnd.and(group);
|
||||
}*/
|
||||
Vi.cndPlus(cnd, "apply.activityId", "=", activityId);
|
||||
Vi.cndPlus(cnd, "apply.eventId", "=", eventId);
|
||||
cnd.asc("team.`name`");
|
||||
cnd.desc("apply.identity");
|
||||
sql.setCondition(cnd);
|
||||
return activitySchoolService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object activityData(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "isActivity", required = false) Integer isActivity) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ba.`name` activityLevelName,
|
||||
school.id,
|
||||
school.planId,
|
||||
school.NAME,
|
||||
school.address,
|
||||
school.applyStartTime,
|
||||
school.applyEndTime,
|
||||
school.startTime,
|
||||
school.endTime,
|
||||
school.unitSponsor,
|
||||
school.unitJointly,
|
||||
school.gameStyle,
|
||||
school.funding,
|
||||
school.applyWay,
|
||||
school.personType,
|
||||
school.activityLevel,
|
||||
school.applyType,
|
||||
(SELECT count( 1 ) FROM activity_school_apply app WHERE app.activityId = school.id AND app.`status` = 2 ) apply_num,
|
||||
(SELECT count( 1 ) FROM activity_school_apply app WHERE app.activityId = school.id AND ( app.applyUser = @userid OR app.userId = @userid )) > 0 applyed,
|
||||
(SELECT COUNT(1) FROM activity_school_apply app WHERE app.activityId=school.id AND app.unionId=@unionId AND app.unionLeader=TRUE) LeaderCount,
|
||||
(SELECT COUNT(1) FROM activity_school_apply app WHERE app.activityId=school.id AND app.unionId=@unionId AND app.unionCoach=TRUE) CoachCount
|
||||
FROM
|
||||
activity_school school
|
||||
LEFT JOIN activity_basic_settings ba ON ba.`code` = school.activityLevel
|
||||
$condition
|
||||
""").setParam("userid", ShiroUtil.getPrincipalProperty("id")).setParam("unionId", getUnionId());
|
||||
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
cnd.and("school.close", "!=", true);
|
||||
|
||||
cnd.and("school.isSave", "!=", true);
|
||||
|
||||
//查询报名中
|
||||
if (isActivity == 2) {
|
||||
cnd.and(new Static("now() >applyStartTime and now() < applyEndTime"));
|
||||
}//查询已结束的
|
||||
else if (isActivity == 3) {
|
||||
cnd.and(new Static("now() > school.applyEndTime"));
|
||||
}
|
||||
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("H04,ghzl,sysadmin")) {
|
||||
cnd.and(new Static("JSON_CONTAINS(school.applyWay,JSON_ARRAY( 1))>0"));
|
||||
cnd.and(new Static("(SELECT COUNT(1) FROM activity_user_scope WHERE groupId=school.activityGroupId AND userId='%s') >0".formatted(ShiroUtil.getUserId())));
|
||||
}
|
||||
Vi.cndPlus(cnd, "YEAR(school.applyStartTime)", "=", year);
|
||||
cnd.desc("school.applyStartTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return activitySchoolService.listMap(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取这个活动统一报名的信息
|
||||
*
|
||||
* @param activityId 活动id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object getUniteApplyInfo(@Param(value = "endAgeDate", required = false) String endAgeDate,
|
||||
@Param(value = "startAgeDate", required = false) String startAgeDate,
|
||||
@Param(value = "activityId") String activityId,
|
||||
@Param(value = "eventId", required = false) String eventId,
|
||||
@Param(value = "schoolEventId", required = false) String schoolEventId,
|
||||
@Param(value = "projectType", required = false) String projectType,
|
||||
@Param(value = "isMenWomen", required = false) Integer isMenWomen) {
|
||||
String union_id = getUnionId();
|
||||
|
||||
Map result = new HashMap();
|
||||
|
||||
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
Sys_unit unit = user.getUnit();
|
||||
|
||||
//根据当前登入人的单位查询他所属的活动分工会属于哪个
|
||||
ActivityBasicUnit activityBasicUnit = activitySchoolService.dao().fetch(ActivityBasicUnit.class, unit.getId());
|
||||
|
||||
ActivitySchool activity = activitySchoolService.fetch(activityId);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.username,
|
||||
u.unitid,
|
||||
u.loginname,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.mobile,
|
||||
un.`name` unitname,
|
||||
u.userState as userStateX
|
||||
FROM
|
||||
sys_user u
|
||||
LEFT JOIN activity_basic_unit un ON u.unitid = un.id
|
||||
LEFT JOIN activity_basic_union uni ON un.unionid=uni.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and(new Static("u.id not in (SELECT IFNULL(app.userId,'') from activity_school_apply app WHERE app.activityId = '" + activityId + "' AND app.eventId='" + eventId + "')"));
|
||||
cnd.and(new Static("u.id IN (SELECT userId FROM activity_user_scope aus WHERE aus.groupId='" + activity.getActivityGroupId() + "')"));
|
||||
cnd.and("un.unionid", "=", activityBasicUnit.getUnionid());
|
||||
if (isMenWomen != null && isMenWomen == 1) cnd.and("u.sex", "=", "男");
|
||||
if (isMenWomen != null && isMenWomen == 2) cnd.and("u.sex", "=", "女");
|
||||
if (Strings.isNotBlank(startAgeDate)) {
|
||||
cnd.and("u.birthday", ">", startAgeDate);
|
||||
cnd.and("u.birthday", "<=", endAgeDate);
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
List<Record> userList = activitySchoolService.list(sql);
|
||||
userList.forEach(v -> {
|
||||
if (Strings.isNotBlank(v.getString("birthday"))) {
|
||||
v.set("age", cn.hutool.core.date.DateUtil.ageOfNow(v.getString("birthday")));
|
||||
}
|
||||
});
|
||||
result.put("users", userList);
|
||||
/*AND asa.`status` = 2*/
|
||||
Sql applySql = Sqls.create("""
|
||||
SELECT
|
||||
asa.*
|
||||
FROM
|
||||
activity_school_apply asa
|
||||
LEFT JOIN activity_school_team team ON asa.teamId = team.id
|
||||
LEFT JOIN sys_unit unit ON asa.unitId = unit.id
|
||||
WHERE
|
||||
asa.eventId = @eventId
|
||||
AND asa.activityId=@activityId
|
||||
AND asa.activityUnionId = @unionid
|
||||
AND asa.`status` != 3
|
||||
ORDER BY
|
||||
asa.identity DESC,
|
||||
asa.sex
|
||||
""").setParam("eventId", eventId).setParam("unionid", union_id).setParam("activityId", activityId);
|
||||
List<ActivitySchoolApply> list = activitySchoolApplyService.listEntity(applySql);
|
||||
//团体人数
|
||||
List<ActivitySchoolApply> awardsModeT = list.stream().filter(v -> v.getAwardsMode().equals("2")).collect(Collectors.toList());
|
||||
//单项人数
|
||||
List<ActivitySchoolApply> awardsModeG = list.stream().filter(v -> v.getAwardsMode().equals("1")).collect(Collectors.toList());
|
||||
|
||||
list.forEach(v -> {
|
||||
if (Strings.isNotBlank(v.getBirthday())) {
|
||||
v.setAge(cn.hutool.core.date.DateUtil.ageOfNow(v.getBirthday()));
|
||||
}
|
||||
});
|
||||
|
||||
result.put("list", list);
|
||||
result.put("awardsModeT", awardsModeT);
|
||||
result.put("awardsModeG", awardsModeG);
|
||||
|
||||
result.put("team", activitySchoolTeamService.query(Cnd.where("eventId", "=", eventId).and("activityId", "=", activityId).asc("location")));
|
||||
|
||||
result.put("activity", activity);
|
||||
List<NutMap> events = (List<NutMap>) getEvents(activityId);
|
||||
NutMap eve = events.stream().filter(v -> v.getString("id").equals(schoolEventId)).findFirst().orElse(null);
|
||||
result.put("getEvent", eve);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据活动名称查找小队
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getTeamId(String id) {
|
||||
return activitySchoolTeamService.query(Cnd.where("activityId", "=", id).asc("location"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据活动加项目查找小队
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getActivityTeamId(String activityId, String eventId) {
|
||||
return activitySchoolTeamService.query(Cnd.where("activityId", "=", activityId).and("eventId", "=", eventId).asc("location"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 领队的查找方法
|
||||
*
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object leaderSearch(@Param(value = "eventId", required = false) String eventId,
|
||||
@Param(value = "keyWord", required = false) String keyWord,
|
||||
@Param(value = "personType", required = false) String personType) {
|
||||
|
||||
String union_id = getUnionId();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.username,
|
||||
u.unitid,
|
||||
u.loginname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
un.`name` unitname
|
||||
FROM
|
||||
sys_user u
|
||||
LEFT JOIN activity_basic_unit un ON u.unitid = un.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (personType.equals(1)) {
|
||||
cnd.and("u.member", "=", "1");
|
||||
}
|
||||
cnd.and(new Static("u.id not in (SELECT IFNULL(app.userId,'') from activity_school_apply app WHERE app.eventId = '" + eventId + "' AND app.identity = 3)"));
|
||||
cnd.and("un.unionid", "=", union_id);
|
||||
cnd.limit(1, 20);
|
||||
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.orLike("u.username", keyWord);
|
||||
group.orLike("u.loginname", keyWord);
|
||||
cnd.and(group);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return activitySchoolApplyService.list(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一报名
|
||||
*
|
||||
* @param applies
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object doApply(@Param(value = "data",required = false) ActivitySchoolApply[] applies,
|
||||
@Param(value = "appliedData3",required = false) ActivitySchoolApply[] applies2,
|
||||
@Param(value = "eventId",required = false) String eventId,
|
||||
@Param(value = "pass",required = false)boolean pass) {
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
Sys_unit unit = user.getUnit();
|
||||
String activityId = "";
|
||||
ActivityBasicUnit basicUnit = activitySchoolService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", unit.getId()));
|
||||
ActivityBasicUnion basicUnion = activitySchoolService.dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", basicUnit.getUnionid()));
|
||||
for (ActivitySchoolApply apply : applies) {
|
||||
activityId = applies[0].getActivityId();
|
||||
apply.setApplyUser(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
apply.setStatus(pass ? 2 : 0);
|
||||
apply.setAwardsMode("2");
|
||||
apply.setApplyDate(DateUtil.getDate());
|
||||
apply.setUnionId(unit.getUnionid());
|
||||
apply.setActivityUnionId(basicUnit.getUnionid());
|
||||
apply.setActivityUnionName(basicUnion.getUnionname());
|
||||
}
|
||||
|
||||
for (ActivitySchoolApply apply2 : applies2) {
|
||||
activityId = applies2[0].getActivityId();
|
||||
apply2.setApplyUser(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
apply2.setStatus(pass ? 2 : 0);
|
||||
apply2.setAwardsMode("1");
|
||||
apply2.setApplyDate(DateUtil.getDate());
|
||||
apply2.setUnionId(unit.getUnionid());
|
||||
apply2.setActivityUnionId(basicUnit.getUnionid());
|
||||
apply2.setActivityUnionName(basicUnion.getUnionname());
|
||||
}
|
||||
if (applies.length > 0) {
|
||||
activitySchoolApplyService.doApplies(activityId, basicUnit.getUnionid(), eventId, Arrays.asList(applies));
|
||||
}
|
||||
if (applies2.length > 0) {
|
||||
activitySchoolApplyService.doApplies(activityId, basicUnit.getUnionid(), eventId, Arrays.asList(applies2));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人报名
|
||||
*
|
||||
* @param personalEnter
|
||||
* @param teammateEnter
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object doAddTeammateEnter(@Param(value = "personalEnter") ActivitySchoolApply personalEnter,
|
||||
@Param(value = "teammateEnter") ActivitySchoolApply teammateEnter) {
|
||||
personalEnter.setApplyUser(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
personalEnter.setStatus(2);
|
||||
personalEnter.setAwardsMode("2");
|
||||
personalEnter.setApplyDate(DateUtil.getDate());
|
||||
|
||||
if (teammateEnter.getUserId() != null) {
|
||||
teammateEnter.setApplyUser(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
teammateEnter.setStatus(2);
|
||||
teammateEnter.setAwardsMode("2");
|
||||
teammateEnter.setApplyDate(DateUtil.getDate());
|
||||
activitySchoolApplyService.insert(teammateEnter);
|
||||
}
|
||||
activitySchoolApplyService.insert(personalEnter);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object doDelete(String id) {
|
||||
activitySchoolApplyService.delete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private String getUnionId() {
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
Sys_unit unit = user.getUnit();
|
||||
ActivityBasicUnit basicUnit = activitySchoolService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", unit.getId()));
|
||||
ActivityBasicUnion basicUnion = activitySchoolService.dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", basicUnit.getUnionid()));
|
||||
|
||||
return unit == null ? "" : basicUnion.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询人
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object getUserData(String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
us.sex,
|
||||
us.username,
|
||||
us.loginname,
|
||||
us.mobile,
|
||||
er.unitid,
|
||||
er.unitname,
|
||||
er.unionid,
|
||||
er.unionname
|
||||
FROM
|
||||
sys_user us
|
||||
LEFT JOIN `user` er ON us.id = er.id WHERE us.id=@userId
|
||||
""");
|
||||
sql.setParam("userId", userId);
|
||||
return Result.success().addData(sysUserService.list(sql).get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询该小队报名人数
|
||||
*
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object getActivityCount(String teamId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT COUNT(*) FROM activity_school_apply WHERE teamId=@teamId and activityUnionId=@unionId
|
||||
""");
|
||||
sql.setParam("teamId", teamId);
|
||||
sql.setParam("unionId", getUnionId());
|
||||
return activitySchoolApplyService.count(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询该人有没有参加过这个活动
|
||||
*
|
||||
* @param eventId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object getActivityUserCount(String eventId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT COUNT(*) FROM activity_school_apply WHERE userId=@userId and eventId=@eventId
|
||||
""");
|
||||
sql.setParam("userId", ShiroUtil.getPrincipalProperty("id"));
|
||||
sql.setParam("eventId", eventId);
|
||||
return activitySchoolApplyService.count(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object getUserUnion(String query) {
|
||||
String union_id = getUnionId();
|
||||
Sql sql = Sqls.create("select u.* FROM `user` u LEFT JOIN activity_basic_unit un ON u.unitid = un.id $condition");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
|
||||
if (Strings.isNotBlank(query)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.orLike("u.username", query);
|
||||
group.orLike("u.loginname", query);
|
||||
cnd.and(group);
|
||||
}
|
||||
cnd.and("un.unionid", "=", union_id);
|
||||
sql.setCondition(cnd);
|
||||
return sysUserService.list(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object findUserOne(String id) {
|
||||
try {
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"\tu.id,u.username,u.unitid,\n" +
|
||||
"\tu.loginname,\n" +
|
||||
"\tu.sex,\n" +
|
||||
"\tu.mobile,\n" +
|
||||
"\tun.`name` unitname \n" +
|
||||
"FROM\n" +
|
||||
"\tsys_user u\n" +
|
||||
"\tLEFT JOIN sys_unit un ON u.unitid = un.id Where u.id = @id").setParam("id", id);
|
||||
|
||||
return Result.success().addData(activitySchoolService.list(sql).get(0));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object doDeleteTeamUser(String id) {
|
||||
return activitySchoolApplyService.clear(Cnd.where("id", "=", id));
|
||||
}
|
||||
|
||||
@At
|
||||
public Object getActivits(Integer year) {
|
||||
return activitySchoolService.query(Cnd.where("YEAR(applyStartTime)", "=", year).desc("applyStartTime"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据活动查询项目
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
public Object getEvents(String activityId) {
|
||||
Cnd cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
ev.competitionCategory,
|
||||
ev.distance,
|
||||
ev.sports,
|
||||
ev.projectType,
|
||||
ev.whetherEnable,
|
||||
ev.note,
|
||||
ev.allName,
|
||||
ev.isMenWomen,
|
||||
ev.isInterest
|
||||
FROM
|
||||
activity_school_event act
|
||||
LEFT JOIN activity_event ev ON act.eventId = ev.id $condition
|
||||
""");
|
||||
Vi.cndPlus(cnd, "activityId", "=", activityId);
|
||||
sql.setCondition(cnd);
|
||||
return activitySchoolService.listMap(sql);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.apply")
|
||||
public Object joinMemberFamily(String[] applysId) {
|
||||
for (String s : applysId) {
|
||||
activitySchoolApplyService.clear(Cnd.where("id", "=", s));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(@Param(value = "applyType", required = false) String applyType,
|
||||
@Param(value = "isAudit", required = false) String isAudit,
|
||||
@Param(value = "groupName", required = false) String groupName,
|
||||
@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "eventId", required = false) String eventId,
|
||||
@Param(value = "year", required = false) Integer year, PageForm page,
|
||||
@Param(value = "isMenWomen", required = false) String[] isMenWomen) {
|
||||
Cnd cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ase.*,
|
||||
school.`name`,
|
||||
school.applyWay,
|
||||
school.applyStartTime,
|
||||
school.applyEndTime,
|
||||
school.applyType,
|
||||
school.activityGroupId,
|
||||
eve.allName,
|
||||
eve.isInterest,
|
||||
eve.projectType,
|
||||
eve.isMenWomen,
|
||||
(SELECT ast.`name` FROM activity_school_apply app LEFT JOIN activity_school_team ast ON ast.id = app.teamId WHERE app.eventId = ase.eventId AND app.activityId = ase.activityId AND app.userId = @userId) activityTeamName,
|
||||
(SELECT COUNT(1) FROM activity_school_apply WHERE eventId=ase.eventId AND activityId=ase.activityId and status=2 and activityUnionId=@unionId) applyNum,
|
||||
(SELECT COUNT(1) FROM activity_school_apply WHERE eventId=ase.eventId AND activityId=ase.activityId and activityUnionId=@unionId) applyNum2,
|
||||
(SELECT COUNT(1) FROM activity_school_apply WHERE eventId = ase.eventId AND activityId = ase.activityId AND userId=@userId) userApply,
|
||||
(SELECT COUNT(1) FROM activity_school_apply WHERE eventId=ase.eventId AND activityId=ase.activityId and status=2) totalApplyNum
|
||||
FROM
|
||||
activity_school_event ase
|
||||
LEFT JOIN activity_school school ON ase.activityId = school.id
|
||||
LEFT JOIN activity_event eve ON ase.eventId=eve.id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.id=eve.competitionCategory
|
||||
$condition
|
||||
""").setParam("unionId", getUnionId()).setParam("userId", ShiroUtil.getUserId());
|
||||
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("H04,ghzl,sysadmin")) {
|
||||
cnd.where().andLike("school.applyWay ", "1");
|
||||
cnd.and(new Static("(SELECT COUNT(1) FROM activity_user_scope WHERE groupId=school.activityGroupId AND userId='%s') >0".formatted(ShiroUtil.getUserId())));
|
||||
|
||||
}
|
||||
Vi.cndPlus(cnd, "abs.`name`", "=", groupName);
|
||||
//如果不是超级管理员就按男女查询,isMenWomen 1是男2是女projectType 2是团体
|
||||
/* if (!ShiroUtil.hasAnyRoles("sysadmin,H04,ghzl,A06")) {
|
||||
if (StrUtil.isNotBlank(applyType)) {
|
||||
if (!applyType.equals("1")) {
|
||||
if (ShiroUtil.getPrincipalProperty("sex").equals("男")) {
|
||||
cnd.and(new Static("(eve.isMenWomen =1 OR eve.isMenWomen IS NULL )"));
|
||||
} else {
|
||||
cnd.and(new Static("(eve.isMenWomen =2 OR eve.isMenWomen IS NULL)"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (Strings.isNotBlank(isAudit)) {
|
||||
cnd.and(new Static("(SELECT COUNT(1) FROM activity_school_apply WHERE eventId = ase.eventId AND activityId = ase.activityId AND userId='%s')%s0".formatted(ShiroUtil.getUserId(), (isAudit.equals("true") ? ">" : "="))));
|
||||
}
|
||||
|
||||
Vi.cndPlus(cnd, "ase.activityId", "=", activityId);
|
||||
Vi.cndPlus(cnd, "ase.eventId", "=", eventId);
|
||||
|
||||
|
||||
Vi.cndPlus(cnd, "YEAR(school.applyStartTime)", "=", year);
|
||||
cnd.asc("eve.projectType").desc("eve.allName");
|
||||
sql.setCondition(cnd);
|
||||
return activitySchoolEventViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 如果当前项目是综合类活动就添加工会总领队和教练
|
||||
*
|
||||
* @param LeaderData
|
||||
* @param CoachData
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doLeaderCoachHead(@Param(value = "staffData", required = false) ActivitySchoolApply staffData,
|
||||
@Param(value = "LeaderData", required = false) ActivitySchoolApply LeaderData,
|
||||
@Param(value = "CoachData", required = false) ActivitySchoolApply CoachData,
|
||||
@Param(value = "headData", required = false) ActivitySchoolApply headData) {
|
||||
|
||||
if (staffData.getUserId() != null) {
|
||||
ActivityBasicUnit basicUnit = activitySchoolService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", staffData.getUnitId()));
|
||||
ActivityBasicUnion basicUnion = activitySchoolService.dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", basicUnit.getUnionid()));
|
||||
activitySchoolApplyService.clear(Cnd.where("activityId", "=", staffData.getActivityId()).and("unionStaff", "=", true).and("unionId", "=", getUnionId()));
|
||||
staffData.setApplyUser(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
staffData.setApplyDate(DateUtil.getDate());
|
||||
staffData.setUnitname(basicUnit.getName());
|
||||
staffData.setActivityUnionId(basicUnion.getId());
|
||||
staffData.setActivityUnionName(basicUnion.getUnionname());
|
||||
activitySchoolApplyService.insert(staffData);
|
||||
}
|
||||
if (LeaderData.getUserId() != null) {
|
||||
ActivityBasicUnit basicUnit = activitySchoolService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", LeaderData.getUnitId()));
|
||||
ActivityBasicUnion basicUnion = activitySchoolService.dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", basicUnit.getUnionid()));
|
||||
activitySchoolApplyService.clear(Cnd.where("activityId", "=", LeaderData.getActivityId()).and("unionLeader", "=", true).and("unionId", "=", getUnionId()));
|
||||
LeaderData.setApplyUser(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
LeaderData.setApplyDate(DateUtil.getDate());
|
||||
LeaderData.setUnitname(basicUnit.getName());
|
||||
LeaderData.setActivityUnionId(basicUnion.getId());
|
||||
LeaderData.setActivityUnionName(basicUnion.getUnionname());
|
||||
activitySchoolApplyService.insert(LeaderData);
|
||||
}
|
||||
if (CoachData.getUserId() != null) {
|
||||
ActivityBasicUnit basicUnit = activitySchoolService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", CoachData.getUnitId()));
|
||||
ActivityBasicUnion basicUnion = activitySchoolService.dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", basicUnit.getUnionid()));
|
||||
activitySchoolApplyService.clear(Cnd.where("activityId", "=", CoachData.getActivityId()).and("unionCoach", "=", true).and("unionId", "=", getUnionId()));
|
||||
CoachData.setApplyUser(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
CoachData.setApplyDate(DateUtil.getDate());
|
||||
CoachData.setUnitname(basicUnit.getName());
|
||||
CoachData.setActivityUnionId(basicUnion.getId());
|
||||
CoachData.setActivityUnionName(basicUnion.getUnionname());
|
||||
activitySchoolApplyService.insert(CoachData);
|
||||
}
|
||||
if (headData.getUserId() != null) {
|
||||
ActivityBasicUnit basicUnit = activitySchoolService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", headData.getUnitId()));
|
||||
ActivityBasicUnion basicUnion = activitySchoolService.dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", basicUnit.getUnionid()));
|
||||
activitySchoolApplyService.clear(Cnd.where("activityId", "=", headData.getActivityId()).and("unionHead", "=", true).and("unionId", "=", getUnionId()));
|
||||
headData.setApplyUser(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
headData.setApplyDate(DateUtil.getDate());
|
||||
headData.setUnitname(basicUnit.getName());
|
||||
headData.setActivityUnionId(basicUnion.getId());
|
||||
headData.setActivityUnionName(basicUnion.getUnionname());
|
||||
activitySchoolApplyService.insert(headData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getUnionCoachLeaderHead(@Param(value = "activityId", required = false) String activityId) {
|
||||
Map result = new HashMap();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT apply.*,us.unitname FROM activity_school_apply apply LEFT JOIN `user` us ON us.id=apply.userId WHERE apply.activityId=@activityId and apply.unionId=@unionId
|
||||
""");
|
||||
sql.setParam("unionId", getUnionId());
|
||||
sql.setParam("activityId", activityId);
|
||||
List<NutMap> list = activitySchoolApplyService.listMap(sql);
|
||||
NutMap unionCoach = list.stream().filter(v -> {
|
||||
return v.getBoolean("unionCoach");
|
||||
}).findFirst().orElse(null);
|
||||
NutMap unionLeader = list.stream().filter(v -> {
|
||||
return v.getBoolean("unionLeader");
|
||||
}).findFirst().orElse(null);
|
||||
NutMap unionHead = list.stream().filter(v -> {
|
||||
return v.getBoolean("unionHead");
|
||||
}).findFirst().orElse(null);
|
||||
NutMap unionStaff = list.stream().filter(v -> {
|
||||
return v.getBoolean("unionStaff");
|
||||
}).findFirst().orElse(null);
|
||||
result.put("unionCoach", unionCoach);
|
||||
result.put("unionLeader", unionLeader);
|
||||
result.put("unionHead", unionHead);
|
||||
result.put("unionStaff", unionStaff);
|
||||
|
||||
List userOptions = List.of();
|
||||
|
||||
ArrayList arrayList = new ArrayList<>(userOptions);
|
||||
|
||||
if (unionCoach != null) {
|
||||
arrayList.add(sysUserService.fetch(unionCoach.getString("userId")));
|
||||
}
|
||||
|
||||
if (unionLeader != null) {
|
||||
arrayList.add(sysUserService.fetch(unionLeader.getString("userId")));
|
||||
}
|
||||
if (unionHead != null) {
|
||||
arrayList.add(sysUserService.fetch(unionHead.getString("userId")));
|
||||
}
|
||||
if (unionStaff != null) {
|
||||
arrayList.add(sysUserService.fetch(unionStaff.getString("userId")));
|
||||
}
|
||||
|
||||
|
||||
result.put("userOptions", arrayList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getActivityData(@Param(value = "activityId", required = false) String activityId) {
|
||||
return activitySchoolApplyService.query(Cnd.where("activityId", "=", activityId).and("awardsMode", "=", 1));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDeleteApply(@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "userId", required = false) String userId,
|
||||
@Param(value = "eventId", required = false) String eventId) {
|
||||
return activitySchoolApplyService.clear(Cnd.where("activityId", "=", activityId).and("eventId", "=", eventId).and("userId", "=", userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除报名人员
|
||||
*
|
||||
* @param activityId 活动
|
||||
* @param userId 用户
|
||||
* @return ?
|
||||
*/
|
||||
@At
|
||||
@Async
|
||||
public Object doDeleteActivityRegister(
|
||||
@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "userId", required = false) String userId) {
|
||||
Cnd cnd = Cnd.where("tissueId", "=", activityId).and("userId", "=", userId);
|
||||
simpleService.dao().clear(ActivityTissuePerson.class, cnd);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
import io.v.nutz.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-02-24 16:32
|
||||
* @description: 活动日历
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/calendar")
|
||||
@RequiresAuthentication
|
||||
public class ActivityCalendarController {
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/school/ActivityCalendar.html")
|
||||
@RequiresPermissions("activity.calendar")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getData() {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
school.id,
|
||||
school.`name`,
|
||||
school.address,
|
||||
school.applyStartTime,
|
||||
school.applyEndTime,
|
||||
school.startTime,
|
||||
school.endTime,
|
||||
un.`name` unitName
|
||||
FROM
|
||||
activity_school school
|
||||
LEFT JOIN sys_unit un ON un.id = school.unitSponsor
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.desc("school.startTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return activitySchoolService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getWyData() {
|
||||
Sql sql = Sqls.create("""
|
||||
|
||||
SELECT
|
||||
id,
|
||||
`name`,
|
||||
address,
|
||||
applyStartTime,
|
||||
applyEndTime,
|
||||
startTime,
|
||||
endTime,
|
||||
type activityType
|
||||
FROM
|
||||
activity_tissue
|
||||
WHERE
|
||||
signUpMethod = 1
|
||||
|
||||
""");
|
||||
|
||||
|
||||
return activitySchoolService.listMap(sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,811 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||
import io.v.nutz.activity.models.*;
|
||||
import io.v.nutz.activity.services.ActivityPlanService;
|
||||
import io.v.nutz.activity.services.ActivitySchoolApplyService;
|
||||
import io.v.nutz.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import io.v.nutz.sys.models.Sys_unit;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysUnionService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-02-23 14:32
|
||||
* @description: 活动通用
|
||||
**/
|
||||
|
||||
@At("/platform/activity/common")
|
||||
@IocBean
|
||||
@RequiresAuthentication
|
||||
@Ok("json:full")
|
||||
public class ActivityCommonController {
|
||||
|
||||
/*@Inject
|
||||
private HdTypeService hdTypeService;*/
|
||||
|
||||
@Inject
|
||||
private SysUnionService sysUnionService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@Inject
|
||||
private ActivityPlanService activityPlanService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolApplyService activitySchoolApplyService;
|
||||
|
||||
@Inject("ActivityEvent")
|
||||
private ViService<ActivityEvent> activityEventService;
|
||||
|
||||
@Inject("ActivitySchoolTeam")
|
||||
private ViService<ActivitySchoolTeam> activitySchoolTeamViService;
|
||||
|
||||
@Inject("ActivitySchoolEvent")
|
||||
private ViService<ActivitySchoolEvent> activitySchoolEventService;
|
||||
|
||||
|
||||
@Inject
|
||||
private OfficeTemplateUtil officeTemplateUtil;
|
||||
|
||||
|
||||
/**
|
||||
* 获取活动类型
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
/* @At
|
||||
@ViReturn
|
||||
public Object getType() {
|
||||
return hdTypeService.query(Cnd.where("parentid", "=", "0").asc("pxbh"));
|
||||
}*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getActivityType() {
|
||||
return activityPlanService.list(Sqls.create("select * from activity_basic_settings where parentId = 'b3b6bafe6dd74aa8b69691b6b75b50fd' order by code asc"));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取小队
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getTeam() {
|
||||
return activitySchoolTeamViService.query(Cnd.orderBy().asc("location"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取活动项目
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getEvents(Integer type) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ae.*
|
||||
FROM
|
||||
activity_event ae
|
||||
LEFT JOIN activity_basic_settings ba ON ae.competitionCategory = ba.id
|
||||
$condition
|
||||
""");
|
||||
cnd.and("ae.whetherEnable", "=", 1);
|
||||
|
||||
if (type != null && type == 1) {
|
||||
cnd.and("ae.projectType", "=", 2);
|
||||
} else if (type != null && type == 3) {
|
||||
cnd.and("ae.projectType", "=", 1);
|
||||
}
|
||||
cnd.and(new Static("""
|
||||
1=1
|
||||
ORDER BY
|
||||
ae.isMenWomen DESC,
|
||||
CASE
|
||||
ba.`name`
|
||||
WHEN '甲组' THEN
|
||||
1
|
||||
WHEN '乙组' THEN
|
||||
2
|
||||
WHEN '丙组' THEN
|
||||
3
|
||||
WHEN '丁组' THEN
|
||||
4
|
||||
WHEN '团体' THEN
|
||||
5
|
||||
END
|
||||
"""));
|
||||
sql.setCondition(cnd);
|
||||
return activityEventService.listMap(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取校级活动计划
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getSchoolActivityPlan(@Param(value = "type", required = false) Integer type) {
|
||||
return activityPlanService.listMap(Sqls.create("select * from activity_plan where type = @type").setParam("type", type));
|
||||
}
|
||||
|
||||
private String getUnionId() {
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
Sys_unit unit = user.getUnit();
|
||||
return unit == null ? "" : unit.getUnionid();
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findOne(String id) {
|
||||
|
||||
String unionid = getUnionId();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
plan.`name` plan
|
||||
FROM
|
||||
activity_school act
|
||||
LEFT JOIN activity_plan plan ON act.planId = plan.id
|
||||
WHERE
|
||||
act.id = @id
|
||||
""").setParam("id", id);
|
||||
|
||||
NutMap nutMap = activitySchoolService.listMap(sql).get(0);
|
||||
|
||||
Sql eventSql = Sqls.create("""
|
||||
SELECT
|
||||
ase.*,
|
||||
ae.allName,
|
||||
ae.projectType,
|
||||
sch.applyType
|
||||
FROM
|
||||
activity_school_event ase
|
||||
LEFT JOIN activity_event ae ON ae.id = ase.eventId
|
||||
LEFT JOIN activity_school sch ON sch.id=ase.activityId
|
||||
WHERE
|
||||
activityId = @activityId
|
||||
""").setParam("activityId", id);
|
||||
|
||||
List<NutMap> eventMap = activitySchoolEventService.listMap(eventSql);
|
||||
nutMap.setv("events", eventMap);
|
||||
|
||||
Sql sql1 = Sqls.create("""
|
||||
SELECT
|
||||
app.*,
|
||||
team.`name` team,
|
||||
unit.`name` unitname
|
||||
FROM
|
||||
activity_school_apply app
|
||||
LEFT JOIN activity_school_team team ON app.teamId = team.id
|
||||
LEFT JOIN sys_unit unit ON app.unitId = unit.id
|
||||
WHERE
|
||||
app.activityId = @id
|
||||
ORDER BY
|
||||
app.identity DESC,
|
||||
team.location ASC,
|
||||
app.sex
|
||||
""").setParam("id", id);
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06") && ShiroUtil.hasAnyRoles("H04,ghzl")) {
|
||||
sql1.setVar("union", " AND app.unionId = '" + unionid + "' ");
|
||||
}
|
||||
|
||||
List<NutMap> applies = activitySchoolApplyService.listMap(sql1);
|
||||
|
||||
List<Integer> applyWay = Json.fromJsonAsList(Integer.class, nutMap.getString("applyWay"));
|
||||
if (applyWay.stream().anyMatch(v -> v.equals(2))) {
|
||||
|
||||
List<NutMap> apply = new ArrayList();
|
||||
|
||||
Cnd unionCnd = Cnd.NEW();
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06") && ShiroUtil.hasAnyRoles("H04,ghzl")) {
|
||||
unionCnd.and("id", "=", unionid);
|
||||
}
|
||||
|
||||
List<Sys_union> unions = sysUnionService.query(unionCnd);
|
||||
|
||||
for (Sys_union union : unions) {
|
||||
String union_id = union.getId();
|
||||
NutMap map = new NutMap();
|
||||
|
||||
List<NutMap> applyList = applies.stream().filter(v -> {
|
||||
return v.getString("unionId").equals(union_id);
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
map.setv("id", union_id);
|
||||
map.setv("unionname", union.getUnionname());
|
||||
map.setv("unioncode", union.getUnioncode());
|
||||
map.setv("num", applyList.size());
|
||||
map.setv("apply", applyList);
|
||||
|
||||
apply.add(map);
|
||||
}
|
||||
nutMap.setv("apply", apply);
|
||||
}
|
||||
return nutMap;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void exportXlsx(String id, String unionId, HttpServletResponse response) throws IOException {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
app.username,
|
||||
app.loginname,
|
||||
app.identity,
|
||||
app.activityUnionName unionname,
|
||||
app.unitname,
|
||||
app.sex,
|
||||
app.mobile,
|
||||
u.idCard,
|
||||
u.userState,
|
||||
ev.allName,
|
||||
sc.`name` activityName,
|
||||
app.`team` team,
|
||||
app.notes,
|
||||
u.unioncode
|
||||
FROM
|
||||
`activity_school_apply` app
|
||||
LEFT JOIN `user` u ON u.id = app.userId
|
||||
LEFT JOIN activity_event ev ON ev.id = app.eventId
|
||||
LEFT JOIN activity_school sc ON sc.id=app.activityId
|
||||
WHERE
|
||||
activityId = @id
|
||||
$cnd
|
||||
ORDER BY
|
||||
u.unitcode ASC,
|
||||
ev.projectCode ASC
|
||||
""").setParam("id", id);
|
||||
if (Strings.isNotBlank(unionId)) {
|
||||
sql.setVar("cnd", "and u.unionid='" + unionId + "'");
|
||||
}
|
||||
List<Record> list = activitySchoolApplyService.list(sql);
|
||||
// String activityName = list.get(0).getString("activityName");
|
||||
String activityName = "";
|
||||
List<ActivitySchoolApply> excels = new ArrayList<>();
|
||||
|
||||
list.forEach(z -> {
|
||||
ActivitySchoolApply schoolApply = z.toPojo(ActivitySchoolApply.class);
|
||||
String s = schoolApply.getIdentity().stream().map(personType::getName).collect(Collectors.toList()).toString();
|
||||
schoolApply.setSf(s);
|
||||
excels.add(schoolApply);
|
||||
});
|
||||
|
||||
Map<String, String> unionCodeMap = sysUnionService.query().stream().collect(Collectors.toMap(Sys_union::getUnionname, Sys_union::getUnioncode));
|
||||
|
||||
Map<String, List<ActivitySchoolApply>> listMap = excels.stream().collect(Collectors.groupingBy(ActivitySchoolApply::getUnionname, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
entityList.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
entityList.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
entityList.add(new ExcelExportEntity("分工会", "unionname", 20));
|
||||
entityList.add(new ExcelExportEntity("单位", "unitname", 20));
|
||||
entityList.add(new ExcelExportEntity("手机号", "mobile", 20));
|
||||
entityList.add(new ExcelExportEntity("身份证号", "idCard", 20));
|
||||
entityList.add(new ExcelExportEntity("所属项目", "allName", 20));
|
||||
entityList.add(new ExcelExportEntity("备注", "notes", 20));
|
||||
|
||||
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
listMap.forEach((k, v) -> {
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setTitle(k.replaceAll("/", "、"));
|
||||
String code = unionCodeMap.get(k);
|
||||
exportParams.setSheetName(k.replaceAll("/", "、") + "-" + code);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
service.createSheetForMap(workbook, exportParams, entityList, v);
|
||||
});
|
||||
|
||||
try {
|
||||
ViTool.excelResponse(response, activityName + "报名表.xlsx");
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void exportXlsx2(String id, String unionId, HttpServletResponse response) {
|
||||
ActivitySchool school = activitySchoolService.fetch(id);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
app.username,
|
||||
app.loginname,
|
||||
app.identity,
|
||||
un.unionname,
|
||||
app.unitname,
|
||||
app.sex,
|
||||
app.mobile,
|
||||
app.campus,
|
||||
u.idCard,
|
||||
u.userState,
|
||||
ev.allName,
|
||||
sc.`name` activityName,
|
||||
app.`team` team,
|
||||
app.notes,
|
||||
un.unioncode,
|
||||
ev.projectCode
|
||||
FROM
|
||||
`activity_school_apply` app
|
||||
LEFT JOIN `user` u ON u.id = app.userId
|
||||
left join sys_union un on un.id=app.unionId
|
||||
LEFT JOIN activity_event ev ON ev.id = app.eventId
|
||||
LEFT JOIN activity_school sc ON sc.id=app.activityId
|
||||
WHERE
|
||||
activityId = @id
|
||||
$cnd
|
||||
ORDER BY
|
||||
u.unitcode ASC,
|
||||
ev.projectCode ASC
|
||||
""").setParam("id", id);
|
||||
if (Strings.isNotBlank(unionId)) {
|
||||
sql.setVar("cnd", "and u.unionid='" + unionId + "'");
|
||||
}
|
||||
List<NutMap> list = activitySchoolApplyService.listMap(sql);
|
||||
|
||||
|
||||
Map<String, List<NutMap>> listMap = list.stream().collect(Collectors.groupingBy(l -> l.getString("unionname"), LinkedHashMap::new, Collectors.toList()));
|
||||
try {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("content-disposition", "attachment;filename="
|
||||
+ URLEncoder.encode(school.getName() + "报名表.zip", "UTF-8"));
|
||||
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
|
||||
listMap.forEach((k, v) -> {
|
||||
try {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String fileName = k + "-" + v.get(0).getString("unioncode") + ".xlsx";
|
||||
zipOutputStream.putNextEntry(new ZipEntry(fileName));
|
||||
|
||||
List<NutMap> maplist1 = v.stream().filter(vv -> vv.getString("projectCode").equals("1112")).collect(Collectors.toList());
|
||||
for (int i = 0; i < maplist1.size(); i++) {
|
||||
maplist1.get(i).put("index", i + 1);
|
||||
}
|
||||
List<NutMap> maplist2 = v.stream().filter(vv -> vv.getString("projectCode").equals("1113")).collect(Collectors.toList());
|
||||
for (int i = 0; i < maplist2.size(); i++) {
|
||||
maplist2.get(i).put("index", maplist1.size() + i + 1);
|
||||
}
|
||||
map.put("maplist1", maplist1);
|
||||
map.put("maplist2", maplist2);
|
||||
map.put("activityName", school.getName() + "报名表");
|
||||
map.put("unionname", k);
|
||||
map.put("totalNum", maplist1.size() + maplist2.size());
|
||||
map.put("applyDate", DateUtil.today());
|
||||
TemplateExportParams params = new TemplateExportParams(
|
||||
officeTemplateUtil.getPath("activityApply"));
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(params, map);
|
||||
workbook.write(zipOutputStream);
|
||||
zipOutputStream.closeEntry();
|
||||
response.flushBuffer();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
});
|
||||
zipOutputStream.flush();
|
||||
zipOutputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class personType {
|
||||
|
||||
private static String getName(String v) {
|
||||
switch (v) {
|
||||
case "1":
|
||||
return "运动员";
|
||||
case "2":
|
||||
return "教练";
|
||||
case "3":
|
||||
return "领队";
|
||||
case "4":
|
||||
return "处级领导";
|
||||
case "5":
|
||||
return "替补";
|
||||
case "6":
|
||||
return "团长";
|
||||
case "7":
|
||||
return "工作人员";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*
|
||||
* @param id
|
||||
* @param response
|
||||
*/
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void export(String id, String unionId, HttpServletResponse response) throws IOException {
|
||||
ActivitySchool activity = activitySchoolService.fetch(id);
|
||||
|
||||
Map map = new HashMap();
|
||||
|
||||
List list = new ArrayList();
|
||||
|
||||
CndPlus unionCnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT * FROM sys_union un $condition
|
||||
""");
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (ShiroUtil.hasAnyRoles("ghzl,H04")) {
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
Sys_unit unit = user.getUnit();
|
||||
unionCnd.and("un.id", "=", unit.getUnionid());
|
||||
}
|
||||
} else {
|
||||
unionCnd.andExcludeEmpty("un.id", "=", unionId);
|
||||
}
|
||||
unionCnd.and(new Static("(SELECT count(1) from activity_school_apply app WHERE app.unionId = un.id and app.status = 2 and app.activityId='%s') > 0".formatted(id)));
|
||||
sql.setCondition(unionCnd);
|
||||
|
||||
List<Sys_union> unions = sysUnionService.listEntity(sql);
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql1 = Sqls.create("""
|
||||
SELECT
|
||||
ae.allName,
|
||||
app.*,
|
||||
team.`name` teamName,
|
||||
unit.`name` unitName,
|
||||
gh.unionname AS unionName
|
||||
FROM
|
||||
activity_school_apply app
|
||||
LEFT JOIN activity_event ae ON ae.id = app.eventId
|
||||
LEFT JOIN activity_school_team team ON app.teamId = team.id
|
||||
LEFT JOIN sys_unit unit ON app.unitId = unit.id
|
||||
LEFT JOIN sys_union gh ON gh.id = unit.unionid
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.andExcludeEmpty("app.activityId", "=", id);
|
||||
cnd.andExcludeEmpty("app.unionId", "=", unionId);
|
||||
|
||||
cnd.desc("app.divisionLevelLeadership").asc("team.location").asc("app.sex");
|
||||
|
||||
sql1.setCondition(cnd);
|
||||
List<ActivitySchoolApply> applies = activitySchoolApplyService.listEntity(sql1, ActivitySchoolApply.class);
|
||||
List<NutMap> mapList = activitySchoolApplyService.listMap(sql1);
|
||||
|
||||
|
||||
for (NutMap apply : mapList) {
|
||||
String oldUsername = apply.getString("username");
|
||||
String username = apply.getString("username");
|
||||
|
||||
String sex = apply.getString("sex");
|
||||
boolean unionHead = apply.getBoolean("unionHead");
|
||||
boolean coach = Json.fromJsonAsList(String.class, apply.getString("identity")).stream().anyMatch(v -> v.equals("2"));
|
||||
boolean leader = Json.fromJsonAsList(String.class, apply.getString("identity")).stream().anyMatch(v -> v.equals("3"));
|
||||
boolean substitute = Json.fromJsonAsList(String.class, apply.getString("identity")).stream().anyMatch(v -> v.equals("5"));
|
||||
boolean divisionLevelLeadership = Json.fromJsonAsList(String.class, apply.getString("identity")).stream().anyMatch(v -> v.equals("4"));
|
||||
|
||||
boolean women = "女".equals(sex);
|
||||
|
||||
if (women || divisionLevelLeadership || coach || leader) {
|
||||
username += "(";
|
||||
|
||||
if (women) {
|
||||
username += "女 ";
|
||||
}
|
||||
if (coach && username.equals(oldUsername)) {
|
||||
username += "教练 ";
|
||||
}
|
||||
if (leader && username.equals(oldUsername)) {
|
||||
username += "领队 ";
|
||||
}
|
||||
if (unionHead && username.equals(oldUsername)) {
|
||||
username += "团长 ";
|
||||
}
|
||||
if (substitute && username.equals(oldUsername)) {
|
||||
username += "替补 ";
|
||||
}
|
||||
if (divisionLevelLeadership && username.equals(oldUsername)) {
|
||||
username += "处级领导 ";
|
||||
}
|
||||
username += ")";
|
||||
String subUserName = username.substring(0, username.length() - 2);
|
||||
if (!women && subUserName.equals(oldUsername)) {
|
||||
apply.setv("username", oldUsername);
|
||||
} else {
|
||||
apply.setv("username", username);
|
||||
}
|
||||
// apply.setv("username", (!women && username.equals(oldUsername)) ? oldUsername : username);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (Sys_union union : unions) {
|
||||
String union_id = union.getId();
|
||||
|
||||
Map m = new HashMap<>();
|
||||
m.put("id", union_id);
|
||||
m.put("name", union.getUnionname());
|
||||
|
||||
List<NutMap> users = mapList.stream().filter(v -> {
|
||||
return v.getString("unionId").equals("2b113edb7e7d4494a9cdfd7672a0ed90");
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
/* List<NutMap> users = mapList.stream().filter(v -> {
|
||||
return v.getString("unionId").equals(union_id);
|
||||
}).collect(Collectors.toList());*/
|
||||
|
||||
|
||||
List<NutMap> collect1 = users.stream().filter(v -> v.getString("team") != null).collect(Collectors.toList());
|
||||
|
||||
Map<String, List<NutMap>> allName = collect1.stream().collect(Collectors.groupingBy(all -> all.getString("allName"), Collectors.toList()));
|
||||
|
||||
LinkedHashMap<String, List<NutMap>> collect = collect1.stream().filter(v -> {
|
||||
return Json.fromJsonAsList(String.class, v.getString("identity")).stream().anyMatch(x -> x.equals("1") || x.equals("2") || x.equals("3") || x.equals("4") || x.equals("5"));
|
||||
}).collect(Collectors.groupingBy(record -> record.getString("team"), LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
|
||||
List<Map> teams = new ArrayList();
|
||||
List<NutMap> leaderList = new ArrayList<>();
|
||||
collect.forEach((key, val) -> {
|
||||
List<NutMap> ydy = val.stream().filter(v -> Json.fromJsonAsList(String.class, v.getString("identity")).stream().anyMatch(x -> x.equals("1") || x.equals("5"))).collect(Collectors.toList());
|
||||
List<NutMap> coach = val.stream().filter(v -> Json.fromJsonAsList(String.class, v.getString("identity")).stream().anyMatch(x -> x.equals("2"))).collect(Collectors.toList());
|
||||
List<NutMap> leader = val.stream().filter(v -> Json.fromJsonAsList(String.class, v.getString("identity")).stream().anyMatch(x -> x.equals("3"))).collect(Collectors.toList());
|
||||
List<NutMap> divisionLevelLeadership = val.stream().filter(v -> Json.fromJsonAsList(String.class, v.getString("identity")).stream().anyMatch(x -> x.equals("4"))).collect(Collectors.toList());
|
||||
|
||||
Map mm = new HashMap<>();
|
||||
mm.put("name", key);
|
||||
mm.put("coach", coach);
|
||||
mm.put("leader", leader);
|
||||
mm.put("divisionLevelLeadership", divisionLevelLeadership);
|
||||
mm.put("users", ydy);
|
||||
if (key.equals("第1队") && leader.size() > 0) {
|
||||
leaderList.add(leader.get(0));
|
||||
}
|
||||
teams.add(mm);
|
||||
});
|
||||
|
||||
m.put("id1", teams);
|
||||
|
||||
if (activity.getApplyType() == 1) {
|
||||
m.put("id3", leaderList);
|
||||
} else {
|
||||
//教练
|
||||
List<NutMap> id2 = users.stream().filter(v -> StrUtil.isNotBlank(v.getString("unionCoach")) && v.getBoolean("unionCoach")).collect(Collectors.toList());
|
||||
|
||||
m.put("id2", id2);
|
||||
if (id2.size() > 0) m.put("coachName", "基层工会教练:");
|
||||
|
||||
|
||||
//领队
|
||||
List<NutMap> id3 = users.stream().filter(v -> StrUtil.isNotBlank(v.getString("unionLeader")) && v.getBoolean("unionLeader")).collect(Collectors.toList());
|
||||
m.put("id3", id3);
|
||||
if (id3.size() > 0) m.put("leaderName", "基层工会领队:");
|
||||
|
||||
//领队
|
||||
List<NutMap> id4 = users.stream().filter(v -> StrUtil.isNotBlank(v.getString("unionHead")) && v.getBoolean("unionHead")).collect(Collectors.toList());
|
||||
m.put("id4", id4);
|
||||
if (id4.size() > 0) m.put("unionHead", "基层工会团长:");
|
||||
}
|
||||
|
||||
list.add(m);
|
||||
}
|
||||
|
||||
map.put("list", list);
|
||||
|
||||
String fileName = activity.getName() + "人员名单";
|
||||
response.addHeader("Content-Type", "application/octet-stream");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
|
||||
|
||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.newBuilder().bind("users", policy).build();
|
||||
String templateUrl = "";
|
||||
if (activity.getApplyType() == 1) {
|
||||
templateUrl = officeTemplateUtil.getPath("activity_list1");
|
||||
} else if (activity.getApplyType() == 2) {
|
||||
templateUrl = officeTemplateUtil.getPath("activity_list");
|
||||
}
|
||||
XWPFTemplate.compile(templateUrl, config).render(map).writeAndClose(response.getOutputStream());
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* @At
|
||||
public void export(String id, HttpServletResponse response) throws IOException {
|
||||
ActivitySchool activity = activitySchoolService.fetch(id);
|
||||
|
||||
Map map = new HashMap();
|
||||
|
||||
List list = new ArrayList();
|
||||
|
||||
Cnd unionCnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT * FROM sys_union un $condition
|
||||
""");
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06") && ShiroUtil.hasAnyRoles("H04,ghzl")) {
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
Sys_unit unit = user.getUnit();
|
||||
unionCnd.and("un.id", "=", unit.getUnionid());
|
||||
}
|
||||
unionCnd.and(new Static("(SELECT count(1) from activity_school_apply app WHERE app.unionId = un.id and app.status = 2) > 0"));
|
||||
sql.setCondition(unionCnd);
|
||||
|
||||
List<Sys_union> unions = sysUnionService.listEntity(sql);
|
||||
|
||||
Sql sql1 = Sqls.create("""
|
||||
SELECT
|
||||
app.*,
|
||||
team.`name` team,
|
||||
unit.`name` unitname
|
||||
FROM
|
||||
activity_school_apply app
|
||||
LEFT JOIN activity_school_team team ON app.teamId = team.id
|
||||
LEFT JOIN sys_unit unit ON app.unitId = unit.id
|
||||
WHERE
|
||||
app.activityId = @id
|
||||
ORDER BY
|
||||
app.divisionLevelLeadership DESC,
|
||||
app.identity DESC,
|
||||
team.location ASC,
|
||||
app.sex
|
||||
""").setParam("id", id);
|
||||
List<Record> applies = activitySchoolApplyService.list(sql1);
|
||||
|
||||
for (Record apply : applies) {
|
||||
String username = apply.getString("username");
|
||||
|
||||
String sex = apply.getString("sex");
|
||||
boolean division_level_leadership = Boolean.parseBoolean(apply.getString("divisionLevelLeadership"));
|
||||
|
||||
boolean women = "女".equals(sex);
|
||||
|
||||
if (women || division_level_leadership) {
|
||||
username += "(";
|
||||
|
||||
if (women) {
|
||||
username += "女";
|
||||
}
|
||||
|
||||
if (division_level_leadership) {
|
||||
if (women) {
|
||||
username += " 处级领导";
|
||||
} else {
|
||||
username += "处级领导";
|
||||
}
|
||||
}
|
||||
|
||||
username += ")";
|
||||
apply.set("username", username);
|
||||
}
|
||||
}
|
||||
|
||||
for (Sys_union union : unions) {
|
||||
String union_id = union.getId();
|
||||
|
||||
Map m = new HashMap<>();
|
||||
m.put("id", union_id);
|
||||
m.put("name", union.getUnionname());
|
||||
|
||||
List<Record> users = applies.stream().filter(v -> {
|
||||
return v.getString("unionId").equals(union_id);
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
//运动员
|
||||
Map<String, List<Record>> collect = users.stream().filter(v -> {
|
||||
return v.getInt("identity") == 1;
|
||||
}).collect(Collectors.groupingBy(record -> record.getString("team"), LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
|
||||
List<Map> teams = new ArrayList();
|
||||
collect.forEach((key, val) -> {
|
||||
Map mm = new HashMap<>();
|
||||
mm.put("name", key);
|
||||
mm.put("users", val);
|
||||
teams.add(mm);
|
||||
});
|
||||
|
||||
m.put("id1", teams);
|
||||
|
||||
//教练
|
||||
List<Record> id2 = users.stream().filter(v -> {
|
||||
return v.getInt("identity") == 2;
|
||||
}).collect(Collectors.toList());
|
||||
id2 = id2;
|
||||
m.put("id2", id2);
|
||||
|
||||
|
||||
//领队
|
||||
List<Record> id3 = users.stream().filter(v -> {
|
||||
return v.getInt("identity") == 3;
|
||||
}).collect(Collectors.toList());
|
||||
m.put("id3", id3);
|
||||
|
||||
|
||||
list.add(m);
|
||||
}
|
||||
|
||||
map.put("list", list);
|
||||
|
||||
String fileName = activity.getName() + "人员名单";
|
||||
response.addHeader("Content-Type", "application/octet-stream");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
|
||||
|
||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.newBuilder().bind("users", policy).build();
|
||||
|
||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/activity/list.docx");
|
||||
XWPFTemplate.compile(inputStream, config).render(map, response.getOutputStream());
|
||||
inputStream.close();
|
||||
}*/
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findOnePlan(String id) {
|
||||
return activityPlanService.findOne(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.activity.models.ActivitySchoolApply;
|
||||
import io.v.nutz.activity.models.SchoolAssignGrades;
|
||||
import io.v.nutz.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.services.SysUnitService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by djx on 2019/6/28.
|
||||
* 活动成绩管理Controller
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/activity/school/grades")
|
||||
public class ActivityGradesController {
|
||||
|
||||
/* @Inject
|
||||
private HdXhdService hdXhdService;*/
|
||||
|
||||
|
||||
@Inject
|
||||
private SysUnitService sysUnitService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/school/ActivityGrades.html")
|
||||
@RequiresPermissions("activity.school.grades")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@ViReturn
|
||||
public Object data(String name, String activityId, String eventId, String jsms, String year, int pageNumber, int pageSize) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
school.id,
|
||||
school.planId,
|
||||
school.`name`,
|
||||
school.address,
|
||||
ase.eventId,
|
||||
school.applyStartTime,
|
||||
school.applyEndTime,
|
||||
school.startTime,
|
||||
school.endTime,
|
||||
school.unitSponsor,
|
||||
school.unitJointly,
|
||||
school.gameStyle,
|
||||
ase.awardsMode,
|
||||
school.funding,
|
||||
school.applyWay,
|
||||
ase.combinationMethod,
|
||||
school.personType,
|
||||
school.activityLevel,
|
||||
even.allName,
|
||||
( SELECT COUNT(1) FROM activity_school_apply WHERE eventId=ase.eventId AND activityId=ase.activityId ) applyNum\s
|
||||
FROM
|
||||
activity_school school
|
||||
LEFT JOIN activity_school_event ase ON ase.activityId=school.id
|
||||
LEFT JOIN activity_event even ON even.id = ase.eventId
|
||||
$condition
|
||||
""");
|
||||
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
// cnd.and(new Static("CURRENT_DATE() >= school.endTime"));
|
||||
|
||||
if (Strings.isNotBlank(name)) {
|
||||
cnd.where().andLike("school.name", name);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(jsms)) {
|
||||
cnd.and("asa.gameStyle", "=", jsms);
|
||||
}
|
||||
|
||||
cnd.andExcludeEmpty("YEAR(school.startTime)", "=", year);
|
||||
|
||||
if (Strings.isNotBlank(activityId)) {
|
||||
cnd.and("school.id", "=", activityId);
|
||||
}
|
||||
if (Strings.isNotBlank(eventId)) {
|
||||
cnd.and("ase.eventId", "=", eventId);
|
||||
}
|
||||
|
||||
cnd.desc("school.startTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
Pagination pagination = activitySchoolService.listPageMap(pageNumber, pageSize, sql);
|
||||
|
||||
NutMap map = new NutMap();
|
||||
map.put("hds", pagination);
|
||||
map.put("unit", sysUnitService.query(Cnd.where("unitlevel", "=", "2")));
|
||||
return map;
|
||||
}
|
||||
|
||||
@Inject
|
||||
private ViService<ActivitySchoolApply> activitySchoolApplyViService;
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
public Object findUnit(String id) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
apply.activityId,
|
||||
apply.unitId,
|
||||
us.unitname,
|
||||
apply.id
|
||||
FROM
|
||||
activity_school_apply apply
|
||||
LEFT JOIN `user` us ON apply.unitId = us.unitid
|
||||
WHERE apply.activityId=@id
|
||||
GROUP BY
|
||||
us.unitname
|
||||
""");
|
||||
sql.params().set("id", id);
|
||||
|
||||
List<Record> re = activitySchoolApplyViService.list(sql);
|
||||
|
||||
return Result.success().addData(re);
|
||||
}
|
||||
|
||||
/*查询参赛人员*/
|
||||
@At
|
||||
@Ok("json")
|
||||
public Object findCyRy(String unitid, String hdid) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
us.username,
|
||||
us.sex
|
||||
FROM
|
||||
activity_school_apply apply
|
||||
LEFT JOIN `user` us ON apply.userId = us.id
|
||||
WHERE identity=1 AND apply.activityId=@hdid AND apply.unitId=@unitid
|
||||
""").setParam("hdid", hdid).setParam("unitid", unitid);
|
||||
return Result.success().addData(activitySchoolApplyViService.list(sql));
|
||||
}
|
||||
|
||||
@Inject("SchoolAssignGrades")
|
||||
private ViService<SchoolAssignGrades> schoolAssignGradesViService;
|
||||
|
||||
/*团队获奖设置*/
|
||||
@At
|
||||
@Ok("json")
|
||||
public Object tdDo(@Param("grades") SchoolAssignGrades[] grades, String unitid, String eventId) {
|
||||
schoolAssignGradesViService.clear(Cnd.where("unitId", "=", unitid).and("eventId", "=", eventId));
|
||||
schoolAssignGradesViService.insert(grades);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
public Object findGrUser(String id, String eventId, @Param("searchKeyword") String searchKeyword, @Param("unit") String unit, @Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
us.unitname,
|
||||
apply.*
|
||||
FROM
|
||||
activity_school_apply apply
|
||||
LEFT JOIN `user` us ON apply.userId = us.id $condition
|
||||
""");
|
||||
|
||||
|
||||
Vi.cndPlus(cnd, "apply.activityId", "=", id);
|
||||
Vi.cndPlus(cnd, "apply.eventId", "=", eventId);
|
||||
Vi.cndPlus(cnd, "apply.unitId", "=", unit);
|
||||
Vi.cndPlus(cnd, "apply.userId", "NOT IN", "(SELECT userId FROM school_assign_grades WHERE userId IS NOT NULL)");
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.orLike("us.username", searchKeyword);
|
||||
group.orLike("us.loginname", searchKeyword);
|
||||
cnd.and(group);
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return Result.success().addData(schoolAssignGradesViService.listPage(pageNumber, pageSize, sql));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
public Object findSaveCj(String id, String eventId) {
|
||||
return Result.success().addData(schoolAssignGradesViService.query(Cnd.where("activityId", "=", id).and("eventId", "=", eventId)));
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
public Object findGrCj(String id, String eventId) {
|
||||
|
||||
return Result.success().addData(schoolAssignGradesViService.query(Cnd.where("activityId", "=", id).and("eventId", "=", eventId)));
|
||||
}
|
||||
|
||||
/*个人获奖设置*/
|
||||
@At
|
||||
@Ok("json")
|
||||
public Object grjxDo(@Param("grades") SchoolAssignGrades[] grades, String unitid, String eventId) {
|
||||
|
||||
/*hdXhdService.clear("hd_hdcj", Cnd.where("hdid", "=", nutMap.getString("hdid")));
|
||||
|
||||
List<NutMap> list = Json.fromJsonAsList(NutMap.class, nutMap.getString("data"));
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
|
||||
NutMap cc = list.get(i);
|
||||
hdXhdService.insert("hd_hdcj", Chain.make("id", R.UU32()).add("hdid", cc.getString("hdid")).add("userid", cc.getString("userid")).add("mc", cc.getString("mc")).add("unitid", cc.getString("unitid")).add("hdms", cc.getString("hdms")).add("jpmc", cc.getString("jpmc")).add("money", cc.getString("money")).add("jplx", cc.getString("jplx")));
|
||||
}
|
||||
if (nutMap.getString("save").equals("1")) {
|
||||
hdXhdService.update(Chain.make("sftj", "1"), Cnd.where("id", "=", nutMap.getString("hdid")));
|
||||
}*/
|
||||
schoolAssignGradesViService.insert(grades);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.activity.models.*;
|
||||
import io.v.nutz.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import io.v.nutz.sys.services.SysMsgService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-02-22 14:52
|
||||
* @description: 活动信息管理
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/school/info/mange")
|
||||
@RequiresAuthentication
|
||||
public class ActivityInfoManageController {
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject("ActivitySchoolEvent")
|
||||
private ViService<ActivitySchoolEvent> activitySchoolEventService;
|
||||
|
||||
@Inject
|
||||
private SysMsgService sysMsgService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/school/ActivityManage.html")
|
||||
@RequiresPermissions("activity.school.info")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "name", required = false) String name,
|
||||
@Param(value = "gameStyle", required = false) String gameStyle,
|
||||
@Param(value = "query", required = false) String query,
|
||||
@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "activityLevel", required = false) String activityLevel) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
cl.`name` clubName,
|
||||
un.unionname,
|
||||
ba.`name` activityLevelName,
|
||||
school.id,
|
||||
school.planId,
|
||||
school.name,
|
||||
school.address,
|
||||
school.applyStartTime,
|
||||
school.applyEndTime,
|
||||
school.startTime,
|
||||
school.endTime,
|
||||
school.unitSponsor,
|
||||
school.unitJointly,
|
||||
school.gameStyle,
|
||||
school.funding,
|
||||
school.applyWay,
|
||||
school.personType,
|
||||
school.activityLevel,
|
||||
school.isSave,
|
||||
school.activityGroupId,
|
||||
school.activityCode,
|
||||
school.foundDate,
|
||||
school.applyType,
|
||||
(SELECT COUNT(1) FROM activity_school_apply asa WHERE asa.activityId = school.id) applyNum
|
||||
FROM
|
||||
activity_school school
|
||||
LEFT JOIN activity_basic_settings ba ON ba.`code` = school.activityLevel
|
||||
LEFT JOIN sys_union un ON un.id = school.belongUnionId
|
||||
LEFT JOIN sys_club cl ON cl.id = school.belongClubId
|
||||
$condition
|
||||
""");
|
||||
|
||||
if ("one".equals(query)) {
|
||||
cnd.and(new Static("now() > school.applyStartTime and now() < school.applyEndTime"));
|
||||
} else if ("two".equals(query)) {
|
||||
cnd.and(new Static("now() > school.applyEndTime and now() < school.startTime"));
|
||||
} else if ("three".equals(query)) {
|
||||
cnd.and(new Static("now() > school.startTime and now() < school.endTime"));
|
||||
} else if ("four".equals(query)) {
|
||||
cnd.and(new Static("now() > school.endTime"));
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (ShiroUtil.hasAnyRoles("H04,ghzl")) {
|
||||
cnd.and("school.belongUnionId", "=", Vi.getUnionId());
|
||||
}
|
||||
if (ShiroUtil.hasRole("club01")) {
|
||||
cnd.and("school.belongClubId", "in", vi.getMangeClubStr());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cnd.andExcludeEmpty("school.activityLevel", "=", activityLevel);
|
||||
cnd.andExcludeEmpty("school.gameStyle", "=", gameStyle);
|
||||
cnd.andExcludeEmpty("YEAR(school.applyStartTime)", "=", year);
|
||||
cnd.andExcludeEmpty("school.id", "=", activityId);
|
||||
|
||||
cnd.desc("school.startTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return activitySchoolService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.school.info")
|
||||
public Object doAdd(@Param(value = "data", required = false) ActivitySchool activitySchool, @Param(value = "events", required = false) ActivitySchoolEvent[] events) {
|
||||
|
||||
List<ActivityBasicUnion> activityBasicUnions = activitySchoolService.dao().query(ActivityBasicUnion.class, Cnd.where("isEnable", "=", true));
|
||||
ActivityBasicUnit activityBasicUnit = activitySchoolService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", ShiroUtil.getUnitId()));
|
||||
|
||||
if (activitySchool.getActivityLevel() == 40002) {
|
||||
activitySchool.setBelongUnionId(activityBasicUnit.getUnionid());
|
||||
}
|
||||
activitySchool.setFoundDate(DateUtil.getDate());
|
||||
String id = activitySchoolService.doAdd(activitySchool, events);
|
||||
|
||||
|
||||
activityBasicUnions.forEach(v -> {
|
||||
ActivityUnion activityUnion = new ActivityUnion();
|
||||
activityUnion.setActivityId(id);
|
||||
activityUnion.setUnionname(v.getUnionname());
|
||||
activitySchoolService.insert(activityUnion);
|
||||
});
|
||||
|
||||
|
||||
List<Sys_file> image = activitySchool.getImage();
|
||||
ActivityTissue activityTissue = new ActivityTissue();
|
||||
activityTissue.setApplyTime(DateUtil.getDate());
|
||||
activityTissue.setType(activitySchool.getActivityLevel());
|
||||
activityTissue.setProjectTypeCode("50004");
|
||||
activityTissue.setActivityCode(activitySchool.getActivityCode());
|
||||
activityTissue.setName(activitySchool.getName());
|
||||
activityTissue.setUserId(ShiroUtil.getUserId());
|
||||
if (activitySchool.getActivityLevel() == 40002) {
|
||||
activitySchool.setBelongUnionId(activityBasicUnit.getUnionid());
|
||||
}
|
||||
activityTissue.setState(3);
|
||||
activityTissue.setClubId(activitySchool.getBelongClubId());
|
||||
activityTissue.setAddress(activitySchool.getAddress());
|
||||
activityTissue.setApplyStartTime(activitySchool.getApplyStartTime());
|
||||
activityTissue.setApplyEndTime(activitySchool.getApplyEndTime());
|
||||
activityTissue.setStartTime(activitySchool.getStartTime());
|
||||
activityTissue.setEndTime(activitySchool.getEndTime());
|
||||
if (image != null) {
|
||||
activityTissue.setCover(image.get(0).getId());
|
||||
}
|
||||
|
||||
activitySchoolService.insert(activityTissue);
|
||||
activitySchoolService.update("activity_tissue", Chain.make("id", activitySchool.getId()), Cnd.where("id", "=", activityTissue.getId()));
|
||||
|
||||
activitySchoolEventService.clear(Cnd.where("eventId", "=", "allItems"));
|
||||
activitySchoolEventService.clear(Cnd.where("eventId", "IS", null));
|
||||
if (activitySchool.getXlFlag() != null && activitySchool.getXlFlag()) {
|
||||
String time = activitySchool.getStartTime() + "至" + activitySchool.getEndTime();
|
||||
sysMsgService.sendMsgByActivityGroupId(activitySchool.getId(), activitySchool.getActivityGroupId(), "体育比赛活动", activitySchool.getName(), "/platform/activity/apply", "/mobile/activity/unionActivity", time);
|
||||
}
|
||||
return id;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.school.info")
|
||||
public Object doEdit(@Param(value = "data", required = false) ActivitySchool activitySchool,
|
||||
@Param(value = "events", required = false) ActivitySchoolEvent[] events) {
|
||||
ActivitySchool school = activitySchoolService.fetch(activitySchool.getId());
|
||||
if (school.getActivityLevel() == 40002) {
|
||||
school.setBelongUnionId(Vi.getUnionId());
|
||||
}
|
||||
activitySchoolService.doEdit(activitySchool, events, school.getApplyEndTime());
|
||||
|
||||
activitySchoolEventService.clear(Cnd.where("eventId", "=", "allItems"));
|
||||
activitySchoolEventService.clear(Cnd.where("eventId", "IS", null));
|
||||
sysMsgService.deleteMsgByActivityId(activitySchool.getId());
|
||||
if (activitySchool.getXlFlag() != null && activitySchool.getXlFlag()) {
|
||||
String time = activitySchool.getStartTime() + "至" + activitySchool.getEndTime();
|
||||
sysMsgService.sendMsgByActivityGroupId(activitySchool.getId(), activitySchool.getActivityGroupId(), "体育比赛活动", activitySchool.getName(), "/platform/activity/apply", "/mobile/activity/unionActivity", time);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.school.info")
|
||||
public Object doDelete(String id) {
|
||||
activitySchoolService.doDelete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findOne(String id) {
|
||||
NutMap nutMap = activitySchoolService.fetch(Sqls.create("SELECT * FROM `activity_school` WHERE id = @id").setParam("id", id));
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ase.*,
|
||||
ae.projectType
|
||||
FROM
|
||||
activity_school_event ase
|
||||
LEFT JOIN activity_event ae ON ae.id = ase.eventId
|
||||
WHERE
|
||||
ase.activityId = @activityId
|
||||
""").setParam("activityId", id);
|
||||
|
||||
nutMap.setv("schoolEvents", activitySchoolEventService.listMap(sql));
|
||||
return nutMap;
|
||||
}
|
||||
|
||||
@Inject("ActivityEvent")
|
||||
private ViService<ActivityEvent> activityEventViService;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getEventData(String id) {
|
||||
return activityEventViService.fetch(id);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getEventApply(@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "eventId", required = false) String[] eventId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ev.allName
|
||||
FROM
|
||||
activity_school_apply asa LEFT JOIN activity_event ev ON ev.id=asa.eventId
|
||||
$condition
|
||||
""");
|
||||
cnd.and("asa.activityId", "=", activityId);
|
||||
cnd.and("asa.eventId", "in", eventId);
|
||||
cnd.groupBy("ev.allName");
|
||||
sql.setCondition(cnd);
|
||||
return activityEventViService.list(sql);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.school.info")
|
||||
public Object doAssignmentDate(@Param(value = "eventIds", required = false) String[] eventIds,
|
||||
ActivitySchoolEvent[] events) {
|
||||
for (ActivitySchoolEvent event : events) {
|
||||
ActivityEvent activityEvent = activityEventViService.fetch(event.getEventId());
|
||||
if (!event.getEventId().equals("allItems")) {
|
||||
event.setStartAgeDate(activityEvent.getStartAgeDate());
|
||||
event.setEndAgeDate(activityEvent.getEndAgeDate());
|
||||
activitySchoolEventService.updateIgnoreNull(event);
|
||||
}
|
||||
}
|
||||
return Result.success(events);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getUnionLimit(@Param(value = "activityScopeId", required = false) String activityScopeId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.unionname,
|
||||
gh.unioncode,
|
||||
(select count(1) from `user` where unionid = gh.id $cnd) as teacherCount,
|
||||
NULL as ratio,
|
||||
NULL as limitCount
|
||||
FROM
|
||||
sys_union gh
|
||||
order by gh.unioncode
|
||||
""");
|
||||
if (StrUtil.isNotBlank(activityScopeId)) {
|
||||
sql.setVar("cnd", "AND id in (select userId from activity_user_scope where groupId = '" + activityScopeId + "')");
|
||||
}
|
||||
return activitySchoolEventService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
import io.v.nutz.activity.models.ActivityPlan;
|
||||
import io.v.nutz.activity.services.ActivityPlanService;
|
||||
import io.v.nutz.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-01 14:26
|
||||
* @description: 活动计划
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/school/plan")
|
||||
@RequiresAuthentication
|
||||
public class ActivityPlanController {
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@Inject
|
||||
private ActivityPlanService activityPlanService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/school/ActivityPlan.html")
|
||||
@RequiresPermissions("activity.plan")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page, @Param(value = "year",required = false) String year,
|
||||
@Param(value = "name",required = false) String name) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.andExcludeEmpty("ap.type", "=", 1);
|
||||
return activityPlanService.pageData(page, year, name, null, cnd);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAdd(String name,String time,String content, String event) {
|
||||
ActivityPlan activityPlan = new ActivityPlan();
|
||||
activityPlan.setName(name);
|
||||
activityPlan.setTime(time);
|
||||
activityPlan.setContent(content);
|
||||
activityPlan.setEvent(event);
|
||||
activityPlan.setType("1");
|
||||
activityPlanService.insert(activityPlan);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doEdit(ActivityPlan activityPlan) {
|
||||
activityPlanService.updateIgnoreNull(activityPlan);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDelete(String id) {
|
||||
activityPlanService.delete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.activity.models.ActivityResults;
|
||||
import io.v.nutz.activity.models.ActivitySchoolEvent;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import io.v.nutz.sys.services.SysUnionService;
|
||||
import lombok.Data;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/5/27 15:57
|
||||
* @description 奖品名单
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/prize/list")
|
||||
@RequiresAuthentication
|
||||
public class ActivityPrizeListController {
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/school/ActivityPrize.html")
|
||||
@RequiresPermissions("activity.prize.list")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
private SysUnionService sysUnionService;
|
||||
|
||||
@Inject("ActivitySchoolEvent")
|
||||
private ViService<ActivitySchoolEvent> eventViService;
|
||||
|
||||
@Inject("ActivityResults")
|
||||
private ViService<ActivityResults> resultsViService;
|
||||
|
||||
private static NutMap nullMap = NutMap.NEW();
|
||||
;
|
||||
|
||||
/**
|
||||
* 各个分工会奖品
|
||||
*
|
||||
* @param activityId
|
||||
* @param unionId
|
||||
* @return
|
||||
*/
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getPrizes(Integer year, String activityId, String unionId) {
|
||||
|
||||
Dao dao = resultsViService.dao();
|
||||
// List<ActivitySchool> activitySchoolList = dao.query(ActivitySchool.class, Cnd.where("YEAR(applyStartTime)", "=", year));
|
||||
//
|
||||
// Optional<ActivitySchool> ydhOptional = activitySchoolList.stream().filter(v -> v.getName().contains("运动会")).findFirst();
|
||||
//
|
||||
// if (ydhOptional.isEmpty()) {
|
||||
// return Map.of("团体项目", nullMap, "男子项目", nullMap, "女子项目", nullMap, "其他", nullMap);
|
||||
// }
|
||||
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
acr.activityId,
|
||||
ace.allName,
|
||||
acr.userId,
|
||||
acr.ranking,
|
||||
acr.numberOfPeople,
|
||||
ace.isMenWomen,
|
||||
acs.`name` as activityName,
|
||||
u.username,
|
||||
RIGHT(ace.allName,4) xmlx,
|
||||
LEFT(ace.allName,2) xblx
|
||||
FROM activity_school_event acse
|
||||
left join activity_school acs on acs.id = acse.activityId AND acs.id=@activityId
|
||||
left join activity_event ace on ace.id = acse.eventId
|
||||
left join activity_results acr on acr.eventId = acse.eventId
|
||||
left join sys_user u on u.id = acr.userId
|
||||
$condition
|
||||
""").setParam("activityId", activityId);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("acr.activityId", "=", activityId);
|
||||
cnd.and("YEAR(acs.applyStartTime)", "=", year);
|
||||
// cnd.and("ace.isInterest", "=", 0);
|
||||
cnd.and("acr.unionId", "=", unionId);
|
||||
cnd.asc("ace.allName").asc("acr.ranking");
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.maps());
|
||||
dao.execute(sql);
|
||||
List<NutMap> allList = sql.getList(NutMap.class);
|
||||
if (Lang.isEmpty(allList)) {
|
||||
return Map.of("团体项目", nullMap, "男子项目", nullMap, "女子项目", nullMap, "其他", nullMap);
|
||||
}
|
||||
// List<NutMap> yhdlist = allList.stream().filter(v -> v.getString("activityId").equals(ydhOptional.get().getId())).collect(Collectors.toList());
|
||||
// List<NutMap> otherList = allList.stream().filter(v -> !v.getString("activityId").equals(ydhOptional.get().getId())).collect(Collectors.toList());
|
||||
|
||||
Map maleMap = NutMap.NEW();
|
||||
Map femaleMap = NutMap.NEW();
|
||||
Map teamMap = NutMap.NEW();
|
||||
Map otherMap = NutMap.NEW();
|
||||
// if (Lang.isNotEmpty(yhdlist)) {
|
||||
|
||||
Map<String, List<NutMap>> xmlxList = allList.stream().collect(Collectors.groupingBy(v -> v.getString("xmlx")));
|
||||
|
||||
if (Lang.isNotEmpty(xmlxList.get("(团体)"))) {
|
||||
teamMap = xmlxList.get("(团体)").stream().collect(Collectors.groupingBy(v -> v.getString("allName")));
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(xmlxList.get("(单项)")) && xmlxList.get("(单项)").stream().anyMatch(v -> v.getString("xblx").equals("男子"))) {
|
||||
maleMap = xmlxList.get("(单项)").stream().filter(v -> v.getString("xblx").equals("男子")).collect(Collectors.groupingBy(h -> h.getString("allName")));
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(xmlxList.get("(单项)")) && xmlxList.get("(单项)").stream().anyMatch(v -> v.getString("xblx").equals("女子"))) {
|
||||
femaleMap = xmlxList.get("(单项)").stream().filter(v -> v.getString("xblx").equals("女子")).collect(Collectors.groupingBy(h -> h.getString("allName")));
|
||||
}
|
||||
|
||||
|
||||
return Map.of("团体项目", teamMap, "男子项目", maleMap, "女子项目", femaleMap, "其他", otherMap);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object summary(String activityId) {
|
||||
|
||||
NutMap map = new NutMap();
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
|
||||
|
||||
//查询所有的工会
|
||||
List<Sys_union> query = sysUnionService.query();
|
||||
for (Sys_union sys_union : query) {
|
||||
NutMap nutMap = new NutMap();
|
||||
|
||||
//记录总人数
|
||||
int totalPeople = 0;
|
||||
nutMap.setv("unionname", sys_union.getUnionname());
|
||||
for (int i = 1; i <= 8; i++) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
IFNULL((
|
||||
SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
activity_results ar1
|
||||
WHERE
|
||||
ar1.activityId = ar2.activityId
|
||||
AND ar1.ranking = ar2.ranking
|
||||
AND ar1.isTeamPersonal = 1
|
||||
AND ar1.unionId = ar2.unionId
|
||||
),
|
||||
0
|
||||
) num,
|
||||
IFNULL( SUM( numberOfPeople ), 0 ) numberOfPeople
|
||||
FROM
|
||||
activity_results ar2 $condition
|
||||
""");
|
||||
CndPlus cnd = new CndPlus();
|
||||
cnd.and("ar2.activityId", "=", activityId);
|
||||
cnd.and("ar2.ranking", "=", i);
|
||||
cnd.and("ar2.unionId", "=", sys_union.getId());
|
||||
cnd.and("ar2.isTeamPersonal", "in", "1,2");
|
||||
sql.setCondition(cnd);
|
||||
int number = 0;
|
||||
List<Record> list = resultsViService.list(sql);
|
||||
if (list.size() > 0) {
|
||||
number = list.get(0).getInt("num") + list.get(0).getInt("numberOfPeople");
|
||||
}
|
||||
totalPeople += number;
|
||||
if (i == 1) {
|
||||
nutMap.setv("one", number);
|
||||
} else if (i == 2) {
|
||||
nutMap.setv("two", number);
|
||||
} else if (i == 3) {
|
||||
nutMap.setv("three", number);
|
||||
} else if (i == 4) {
|
||||
nutMap.setv("four", number);
|
||||
} else if (i == 5) {
|
||||
nutMap.setv("fives", number);
|
||||
} else if (i == 6) {
|
||||
nutMap.setv("six", number);
|
||||
} else if (i == 7) {
|
||||
nutMap.setv("seven", number);
|
||||
} else if (i == 8) {
|
||||
nutMap.setv("eight", number);
|
||||
}
|
||||
|
||||
}
|
||||
nutMap.setv("totalPeople", totalPeople);
|
||||
result.add(nutMap);
|
||||
|
||||
|
||||
}
|
||||
map.put("score", result);
|
||||
return Result.success().addData(map);
|
||||
}
|
||||
|
||||
@Data
|
||||
private class Ranking {
|
||||
|
||||
private int one;
|
||||
private int two;
|
||||
private int three;
|
||||
private int four;
|
||||
private int fives;
|
||||
private int six;
|
||||
private int seven;
|
||||
private int eight;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,499 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.activity.controller.school.constant.SchoolActivityApplyExportEntity;
|
||||
import io.v.nutz.activity.models.*;
|
||||
import io.v.nutz.activity.services.ActivitySchoolApplyService;
|
||||
import io.v.nutz.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.*;
|
||||
import io.v.nutz.sys.services.SysClubService;
|
||||
import io.v.nutz.sys.services.SysUnionService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
import org.nutz.trans.Molecule;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-05 10:18
|
||||
* @description: 报名信息阅览
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/reading")
|
||||
@RequiresAuthentication
|
||||
public class ActivityReadingController {
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolApplyService activitySchoolApplyService;
|
||||
|
||||
@Inject
|
||||
private SysUnionService sysUnionService;
|
||||
|
||||
@Inject
|
||||
private SysClubService sysClubService;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/school/ActivityReading.html")
|
||||
@RequiresPermissions("activity.reading")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getNearActivity(Integer year, String activityLevel) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("close", "!=", true);
|
||||
cnd.and("YEAR(startTime)", "=", year);
|
||||
cnd.and("activityLevel", "=", activityLevel);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (activityLevel.equals("40002")) {
|
||||
cnd.and("belongUnionId", "=", getUnionId());
|
||||
}
|
||||
if (activityLevel.equals("40003")) {
|
||||
cnd.and("belongClubId", "in", vi.getMangeClubStr());
|
||||
}
|
||||
}
|
||||
|
||||
return activitySchoolService.query(cnd.desc("applyEndTime"));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getData(String id, Integer year, String activityLevel) {
|
||||
String unitId = getUnitId();
|
||||
String unionid = getUnionId();
|
||||
ActivityBasicUnit basicUnit = activitySchoolService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", unitId));
|
||||
ActivityBasicUnion basicUnion = activitySchoolService.dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", basicUnit.getUnionid()));
|
||||
ActivitySchool activitySchool = activitySchoolService.fetch(id);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
app.*,
|
||||
school.`name` activityName,
|
||||
school.applyType applyType,
|
||||
school.belongUnionId belongUnionId,
|
||||
school.belongClubId belongClubId,
|
||||
team.`name` team,
|
||||
unit.`name` unitname,
|
||||
ev.allName,
|
||||
ev.id evid,
|
||||
ev.projectType
|
||||
FROM
|
||||
activity_school_apply app
|
||||
LEFT JOIN activity_school school ON school.id = app.activityId
|
||||
LEFT JOIN activity_school_team team ON app.teamId = team.id
|
||||
LEFT JOIN activity_event ev ON ev.id = app.eventId
|
||||
LEFT JOIN sys_unit unit ON app.unitId = unit.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.and("app.activityId", "=", id);
|
||||
// cnd.and("YEAR(app.applyDate)", "=", year);
|
||||
sql.setCondition(cnd);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (ShiroUtil.hasAnyRoles("H04,ghzl") && activityLevel.equals("40002")) {
|
||||
cnd.and("app.activityUnionId", "=", basicUnit.getUnionid());
|
||||
cnd.and("school.belongUnionId", "=", basicUnit.getUnionid());
|
||||
}
|
||||
if (ShiroUtil.hasAnyRoles("H02,") && activityLevel.equals("40003")) {
|
||||
cnd.and("school.belongClubId", "in", vi.getMangeClubStr());
|
||||
}
|
||||
}
|
||||
cnd.desc("ev.allName").asc("ev.projectType").asc("team.`name`");
|
||||
List<NutMap> applies = activitySchoolApplyService.listMap(sql);
|
||||
|
||||
List<NutMap> apply = new ArrayList();
|
||||
|
||||
Cnd unionCnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (ShiroUtil.hasAnyRoles("H04,ghzl")) {
|
||||
unionCnd.and("id", "=", basicUnit.getUnionid());
|
||||
}
|
||||
}
|
||||
if (activityLevel.equals("40002")) {
|
||||
unionCnd.and("id", "=", activitySchool.getBelongUnionId());
|
||||
}
|
||||
unionCnd.and("isEnable", "=", true);
|
||||
unionCnd.asc("unioncode");
|
||||
|
||||
if (!activityLevel.equals("40003")) {
|
||||
List<ActivityBasicUnion> unions = sysUnionService.dao().query(ActivityBasicUnion.class, unionCnd);
|
||||
|
||||
for (ActivityBasicUnion union : unions) {
|
||||
String unionId = union.getId();
|
||||
NutMap map = new NutMap();
|
||||
|
||||
List<NutMap> applyList = applies.stream().filter(v -> {
|
||||
return v.getString("activityUnionId").equals(unionId);
|
||||
}).collect(Collectors.toList());
|
||||
map.setv("id", unionId);
|
||||
map.setv("unionname", union.getUnionname());
|
||||
map.setv("unioncode", union.getUnioncode());
|
||||
map.setv("num", applyList.size());
|
||||
map.setv("apply", applyList);
|
||||
|
||||
apply.add(map);
|
||||
}
|
||||
} else {
|
||||
NutMap map = new NutMap();
|
||||
Sys_club sysClub = sysClubService.fetch(cnd.where("id", "=", activitySchool.getBelongClubId()));
|
||||
map.setv("id", sysClub.getId());
|
||||
map.setv("unionname", sysClub.getName());
|
||||
map.setv("unioncode", sysClub.getCode());
|
||||
map.setv("num", applies.size());
|
||||
map.setv("apply", applies);
|
||||
|
||||
apply.add(map);
|
||||
}
|
||||
|
||||
return apply;
|
||||
}
|
||||
|
||||
private String getUnitId() {
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
Sys_unit unit = user.getUnit();
|
||||
String unitId = unit == null ? "" : unit.getId();
|
||||
return unitId;
|
||||
}
|
||||
|
||||
private String getUnionId() {
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
Sys_union unit = user.getUnion();
|
||||
String unionId = unit == null ? "" : unit.getId();
|
||||
return unionId;
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public void doExportByEnroll(String id, String unionId, HttpServletResponse response) throws Exception {
|
||||
//查询该活动的信息
|
||||
ActivitySchool school = activitySchoolService.fetch(id);
|
||||
Sys_union sysUnion = sysUnionService.fetch(unionId);
|
||||
|
||||
|
||||
//领队
|
||||
ActivitySchoolApply leader = activitySchoolApplyService.fetch(Cnd.where("unionLeader", "=", 1).and("activityId", "=", id).and("unionId", "=", unionId));
|
||||
//教练
|
||||
ActivitySchoolApply coach = activitySchoolApplyService.fetch(Cnd.where("unionCoach", "=", 1).and("activityId", "=", id).and("unionId", "=", unionId));
|
||||
//团长
|
||||
ActivitySchoolApply head = activitySchoolApplyService.fetch(Cnd.where("unionHead", "=", 1).and("activityId", "=", id).and("unionId", "=", unionId));
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
apply.loginname,
|
||||
apply.username,
|
||||
apply.sex,
|
||||
IF(apply.sex='男',1,2) AS sexOrder,
|
||||
`event`.allName,
|
||||
groupSetting.`name` AS groupName,
|
||||
projectNameSetting.location AS projectNameLocation,
|
||||
IF ( distanceSetting.`name` is NULL, 0,distanceSetting.`name`) AS distance,
|
||||
(case groupSetting.`name` when '甲组' then 1 when '乙组' then 2 when '丙组' then 3 when '丁组' then 4 else 5 end) AS groupNameOrder,
|
||||
CONCAT( IF ( distanceSetting.`name` is NULL, '', CONCAT( distanceSetting.`name`, '米' )), projectNameSetting.`name`) AS projectName,
|
||||
apply.awardsMode
|
||||
FROM
|
||||
`activity_school_apply` apply
|
||||
LEFT JOIN activity_event `event` ON `event`.id = apply.eventId
|
||||
LEFT JOIN activity_basic_settings groupSetting ON groupSetting.id = `event`.competitionCategory
|
||||
LEFT JOIN activity_basic_settings projectNameSetting ON projectNameSetting.id = `event`.sports
|
||||
LEFT JOIN activity_basic_settings distanceSetting ON distanceSetting.id = `event`.distance
|
||||
WHERE
|
||||
apply.activityId = @id
|
||||
AND apply.unionId = @unionId
|
||||
AND JSON_CONTAINS(apply.identity,JSON_Array( '1' ))
|
||||
ORDER BY
|
||||
FIELD( apply.sex, '男', '女 ' ),
|
||||
FIELD(groupSetting.`name`,'甲组','乙组','丙组','丁组'),
|
||||
projectNameSetting.location DESC
|
||||
|
||||
""");
|
||||
sql.setParam("id", id).setParam("unionId", unionId);
|
||||
List<NutMap> list = activitySchoolApplyService.listMap(sql);
|
||||
|
||||
Map<String, List<NutMap>> loginnameMap = list.stream().collect(Collectors.groupingBy(v -> v.getString("loginname")));
|
||||
|
||||
List<SchoolActivityApplyExportEntity> exportList = new ArrayList<>();
|
||||
|
||||
loginnameMap.forEach((k, v) -> {
|
||||
SchoolActivityApplyExportEntity entity = new SchoolActivityApplyExportEntity();
|
||||
|
||||
for (int i = 0; i < v.size(); i++) {
|
||||
switch (i) {
|
||||
case 0 -> {
|
||||
if (v.get(i).getInt("awardsMode") == 1) {
|
||||
entity.setUserName(v.get(i).getString("username"));
|
||||
entity.setSex(v.get(i).getString("sex"));
|
||||
// entity.setGroupName(v.get(i).getString("groupName"));
|
||||
entity.setSexOrder(v.get(i).getInt("sexOrder"));
|
||||
} else {
|
||||
entity.setUserName(sysUnion.getUnionname());
|
||||
entity.setSex(null);
|
||||
// entity.setGroupName("团体");
|
||||
entity.setSexOrder(3);
|
||||
}
|
||||
entity.setGroupName(v.get(i).getString("groupName"));
|
||||
entity.setAwardsMode(v.get(i).getInt("awardsMode"));
|
||||
entity.setGroupNameOrder(v.get(i).getInt("groupNameOrder"));
|
||||
entity.setProjectNameOne(v.get(i).getString("projectName"));
|
||||
entity.setProjectNameLocation(v.get(i).getInt("projectNameLocation"));
|
||||
entity.setDistance(v.get(i).getInt("distance"));
|
||||
}
|
||||
case 1 -> entity.setProjectNameTwo(v.get(i).getString("projectName"));
|
||||
case 2 -> entity.setProjectNameThree(v.get(i).getString("projectName"));
|
||||
case 3 -> entity.setProjectNameFour(v.get(i).getString("projectName"));
|
||||
case 4 -> entity.setProjectNameFive(v.get(i).getString("projectName"));
|
||||
case 5 -> entity.setProjectNameSix(v.get(i).getString("projectName"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
exportList.add(entity);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 排序顺序
|
||||
* 1.单人还是团体
|
||||
* 2.性别
|
||||
* 3.组别
|
||||
* 4.项目location 对应activity_basic_settings location
|
||||
* 5.距离 有些项目为空 为空的默认给0 对应activity_basic_settings distance
|
||||
*/
|
||||
List<SchoolActivityApplyExportEntity> sortedExportList = exportList.stream().sorted(
|
||||
Comparator.comparing(SchoolActivityApplyExportEntity::getAwardsMode)
|
||||
.thenComparing(SchoolActivityApplyExportEntity::getSexOrder)
|
||||
.thenComparing(SchoolActivityApplyExportEntity::getGroupNameOrder)
|
||||
.thenComparing(SchoolActivityApplyExportEntity::getProjectNameLocation)
|
||||
.thenComparing(SchoolActivityApplyExportEntity::getDistance)
|
||||
).collect(Collectors.toList());
|
||||
|
||||
ViTool.excelResponse(response, school.getName() + "报名人员名单.xlsx");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setTitle("参赛队名:" + sysUnion.getUnionname() + " 团长:" + (head != null ? head.getUsername() : "暂无") + ",领队:" + (leader != null ? leader.getUsername() : "暂无") + ",教练:" + (coach != null ? coach.getUsername() : "暂无"));
|
||||
|
||||
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SchoolActivityApplyExportEntity.class, sortedExportList);
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
outputStream.close();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresAuthentication
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Object importUserActivitys(TempFile file, String activityId) {
|
||||
try {
|
||||
Trans.exec(new Molecule<String>() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<ActivityImport.applyUser> applyUsers = ExcelImportUtil.importExcel(file.getFile(), ActivityImport.applyUser.class, new ImportParams());
|
||||
applyUsers.forEach(v -> {
|
||||
|
||||
//首先查询有没有这个人
|
||||
User user = baseService.dao().fetch(User.class, Cnd.where("loginname", "=", v.getLoginName()));
|
||||
if (user == null) {
|
||||
setObj(v.getLoginName() + "此用户不存在请检查");
|
||||
throw new RuntimeException(v.getLoginName() + "此用户不存在请检查");
|
||||
}
|
||||
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,H10")) {
|
||||
if (!user.getUnionid().equals(getUnionId())) {
|
||||
setObj(v.getLoginName() + "此用户不是本工会人员");
|
||||
throw new RuntimeException(v.getLoginName() + "此用户不是本工会人员");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//根据code查询有没有这个项目
|
||||
ActivityEvent activityEvent = baseService.dao().fetch(ActivityEvent.class, Cnd.where("projectCode", "=", v.getProjectCode()));
|
||||
//查询活动单位
|
||||
ActivityBasicUnit activityBasicUnit = baseService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", user.getUnitid()));
|
||||
if (activityBasicUnit == null) {
|
||||
setObj("请检查" + user.getLoginname() + "的活动单位是否正确");
|
||||
throw new RuntimeException("请检查" + user.getLoginname() + "的活动单位是否正确");
|
||||
}
|
||||
//查询活动工会
|
||||
ActivityBasicUnion basicUnion = activitySchoolService.dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", activityBasicUnit.getUnionid()));
|
||||
if (basicUnion == null) {
|
||||
setObj("请检查" + user.getLoginname() + "的活动单位:" + activityBasicUnit.getName() + "是否有活动工会");
|
||||
throw new RuntimeException("请检查" + user.getLoginname() + "的活动单位:" + activityBasicUnit.getName() + "是否有活动工会");
|
||||
}
|
||||
|
||||
ActivitySchoolApply activitySchoolApply = new ActivitySchoolApply();
|
||||
activitySchoolApply.setActivityId(activityId);
|
||||
activitySchoolApply.setUnitId(user.getUnitid());
|
||||
activitySchoolApply.setUnionId(user.getUnionid());
|
||||
activitySchoolApply.setApplyUser(ShiroUtil.getUserId());
|
||||
activitySchoolApply.setUserId(user.getId());
|
||||
activitySchoolApply.setLoginname(user.getLoginname());
|
||||
activitySchoolApply.setUsername(user.getUsername());
|
||||
activitySchoolApply.setSex(user.getSex());
|
||||
activitySchoolApply.setMobile(user.getMobile());
|
||||
activitySchoolApply.setApplyDate(DateUtil.getDate());
|
||||
activitySchoolApply.setStatus(2);
|
||||
activitySchoolApply.setUnitname(user.getUnitname());
|
||||
activitySchoolApply.setActivityUnionId(basicUnion.getId());
|
||||
activitySchoolApply.setActivityUnionName(basicUnion.getUnionname());
|
||||
//判断是否有除运动员以外的身份
|
||||
if (v.getIdentity() != null && v.getIdentity().equals("教练")) {
|
||||
activitySchoolApply.setUnionCoach(true);
|
||||
} else if (v.getIdentity() != null && v.getIdentity().equals("领队")) {
|
||||
activitySchoolApply.setUnionLeader(true);
|
||||
} else if (v.getIdentity() != null && v.getIdentity().equals("团长")) {
|
||||
activitySchoolApply.setUnionHead(true);
|
||||
} else if (v.getIdentity() != null && v.getIdentity().equals("工作人员")) {
|
||||
activitySchoolApply.setUnionStaff(true);
|
||||
}
|
||||
|
||||
if (v.getProjectCode() == null && v.getIdentity() != null) {
|
||||
//如果这个人没有报名的项目并且有职位,说明这个人不是运动员,直接加入数据
|
||||
baseService.insert(activitySchoolApply);
|
||||
} else {
|
||||
//否则是运动员
|
||||
// Integer identity = getIdentity(v.getIdentity());
|
||||
// activitySchoolApply.setIdentity(List.of(String.valueOf(identity)));
|
||||
if (activityEvent == null) {
|
||||
setObj("请检查" + v.getProjectCode() + "项目编号是否存在");
|
||||
throw new RuntimeException("请检查" + v.getProjectCode() + "项目编号是否存在");
|
||||
}
|
||||
//然后在查询这个活动有没有这个项目
|
||||
ActivitySchoolEvent schoolEvent = baseService.dao().fetch(ActivitySchoolEvent.class, Cnd.where("activityId", "=", activityId).and("eventId", "=", activityEvent.getId()));
|
||||
if (schoolEvent == null) {
|
||||
setObj(v.getProjectCode() + "项目编号在此活动中没有,请检查数据是否正确");
|
||||
throw new RuntimeException(v.getProjectCode() + "项目编号在此活动中没有,请检查数据是否正确");
|
||||
}
|
||||
//查询这个人在这次活动的项目中有没有报过,有报过就删除再添加
|
||||
ActivitySchoolApply schoolApply = baseService.dao().fetch(ActivitySchoolApply.class, Cnd.where("activityId", "=", activityId).and("userId", "=", user.getId()).and("eventId", "=", schoolEvent.getEventId()));
|
||||
if (schoolApply != null) {
|
||||
baseService.dao().delete(ActivitySchoolApply.class, schoolApply.getId());
|
||||
}
|
||||
|
||||
//查询这个活动下的项目第一个小队是多少
|
||||
ActivitySchoolTeam schoolTeam = baseService.dao().fetch(ActivitySchoolTeam.class, Cnd.where("activityId", "=", activityId).and("eventId", "=", schoolEvent.getEventId()).asc("location"));
|
||||
if (schoolTeam == null && activityEvent.getProjectType().equals("2")) {
|
||||
setObj("请检查" + v.getProjectCode() + "编号项目下是否存在小队");
|
||||
throw new RuntimeException("请检查" + v.getProjectCode() + "编号项目下是否存在小队");
|
||||
}
|
||||
activitySchoolApply.setEventId(schoolEvent.getEventId());
|
||||
activitySchoolApply.setAwardsMode(activityEvent.getProjectType());
|
||||
if (activityEvent.getProjectType().equals("2")) {
|
||||
activitySchoolApply.setTeamId(schoolTeam.getId());
|
||||
activitySchoolApply.setTeam(schoolTeam.getName());
|
||||
}
|
||||
activitySchoolApply.setIdentity(List.of(String.valueOf(1)));
|
||||
baseService.insert(activitySchoolApply);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return Result.success();
|
||||
} catch (Throwable e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出分工会报名人数
|
||||
*
|
||||
* @param activityId
|
||||
* @param activityLevel
|
||||
* @param response
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("activity.reading")
|
||||
public void exportUnionNum(String activityId, String activityLevel, HttpServletResponse response) {
|
||||
try (ServletOutputStream os = response.getOutputStream()) {
|
||||
Result result = (Result) getData(activityId, 0, activityLevel);
|
||||
List<NutMap> list = (List<NutMap>) result.getData();
|
||||
NutMap map = new NutMap();
|
||||
map.setv("unionname","总计");
|
||||
map.setv("num",list.stream().mapToInt(v -> v.getInt("num")).sum());
|
||||
list.add(map);
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("分工会名称", "unionname", 30));
|
||||
exportEntities.add(new ExcelExportEntity("报名人数", "num", 20));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
|
||||
|
||||
ActivitySchool activitySchool = activitySchoolService.dao().fetch(ActivitySchool.class, activityId);
|
||||
|
||||
ViTool.excelResponse(response, activitySchool.getName() + ".xlsx");
|
||||
workbook.write(os);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private Integer getIdentity(String identity) {
|
||||
if (identity.equals("运动员")) {
|
||||
return 1;
|
||||
} else if (identity.equals("教练")) {
|
||||
return 2;
|
||||
} else if (identity.equals("领队")) {
|
||||
return 3;
|
||||
} else if (identity.equals("处级领导")) {
|
||||
return 4;
|
||||
} else if (identity.equals("替补")) {
|
||||
return 5;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
import io.v.nutz.activity.models.ActivitySchoolEvent;
|
||||
import io.v.nutz.activity.services.ActivitySchoolApplyService;
|
||||
import io.v.nutz.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.RCSCloudAPI;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.services.SysUnionService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-03 17:27
|
||||
* @description: 活动报名提醒
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/remind")
|
||||
@RequiresAuthentication
|
||||
public class ActivityRemindController {
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@Inject("ActivitySchoolEvent")
|
||||
private ViService<ActivitySchoolEvent> activitySchoolEventViService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolApplyService activitySchoolApplyService;
|
||||
|
||||
@Inject
|
||||
private SysUnionService sysUnionService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/school/ActivityRemind.html")
|
||||
@RequiresPermissions("activity.remind")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.remind")
|
||||
public Object pageData(PageForm page, @Param(value = "name", required = false) String name,
|
||||
@Param(value = "activityId", required = false) String activityId) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
school.id,
|
||||
school.planId,
|
||||
school.`name`,
|
||||
school.address,
|
||||
school.applyStartTime,
|
||||
school.applyEndTime,
|
||||
school.startTime,
|
||||
school.endTime,
|
||||
school.unitSponsor,
|
||||
school.unitJointly,
|
||||
school.gameStyle,
|
||||
school.funding,
|
||||
school.applyWay,
|
||||
school.personType,
|
||||
school.activityLevel,
|
||||
(SELECT COUNT(1) FROM activity_school_apply asa WHERE asa.activityId = school.id) applyNum
|
||||
FROM
|
||||
activity_school school
|
||||
$condition
|
||||
""");
|
||||
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
cnd.and("school.close", "!=", true);
|
||||
|
||||
cnd.and("school.isSave", "!=", true);
|
||||
|
||||
cnd.and(new Static("CURRENT_DATE() >= school.applyStartTime AND CURRENT_DATE() <= school.applyEndTime"));
|
||||
|
||||
cnd.andExcludeEmpty("school.id", "=", activityId);
|
||||
|
||||
if (Strings.isNotBlank(name)) {
|
||||
cnd.where().andLike("school.name", name);
|
||||
}
|
||||
|
||||
cnd.desc("school.startTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return activitySchoolService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.remind")
|
||||
public Object getUnionRemind(String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
un.id,
|
||||
un.unionname,
|
||||
(
|
||||
SELECT
|
||||
GROUP_CONCAT(su.mobile)
|
||||
FROM
|
||||
sys_user_role sur
|
||||
LEFT JOIN sys_user su ON su.id = sur.userId
|
||||
LEFT JOIN sys_role sr ON sr.id = sur.roleId
|
||||
WHERE
|
||||
sur.unionid = un.id
|
||||
AND sr.id = @roleId
|
||||
) telephone,
|
||||
|
||||
(
|
||||
SELECT
|
||||
GROUP_CONCAT(su.username)
|
||||
FROM
|
||||
sys_user_role sur
|
||||
LEFT JOIN sys_user su ON su.id = sur.userId
|
||||
LEFT JOIN sys_role sr ON sr.id = sur.roleId
|
||||
WHERE
|
||||
sur.unionid = un.id
|
||||
AND sr.id = @roleId
|
||||
) unionleader,
|
||||
( SELECT COUNT( 1 ) FROM activity_school_apply asp WHERE asp.unionId = un.id AND asp.activityId = @activityId ) num
|
||||
FROM
|
||||
`sys_union` un
|
||||
ORDER BY
|
||||
un.unioncode
|
||||
""").setParam("roleId", Roles.UNION_MANGER).setParam("activityId", activityId);
|
||||
|
||||
List<Record> unions = sysUnionService.list(sql);
|
||||
|
||||
unions.forEach(v -> {
|
||||
v.set("users", activitySchoolApplyService.query(Cnd.where("unionId", "=", v.getString("id")).and("activityId", "=", activityId).desc("identity")));
|
||||
});
|
||||
|
||||
return unions;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.remind")
|
||||
public Object sendRemind(@Param(value = "phone", required = false) String phone,
|
||||
@Param(value = "unionname", required = false) String unionname) {
|
||||
String[] pe = phone.split(",");
|
||||
for (String p : pe) {
|
||||
RCSCloudAPI.sendTplSms("399ac7a7901c49df9f5939d0f10d566b", p, "@1@=" + unionname + "", "");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.remind")
|
||||
public Object sendAllRemind(String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
un.id,
|
||||
un.unionname,
|
||||
(
|
||||
SELECT
|
||||
su.mobile
|
||||
FROM
|
||||
sys_user_role sur
|
||||
LEFT JOIN sys_user su ON su.id = sur.userId
|
||||
LEFT JOIN sys_role sr ON sr.id = sur.roleId
|
||||
WHERE
|
||||
sur.unionid = un.id
|
||||
AND sr.id = @roleId
|
||||
) telephone,
|
||||
( SELECT COUNT( 1 ) FROM activity_school_apply asp WHERE asp.unionId = un.id AND asp.activityId = @activityId ) num
|
||||
FROM
|
||||
`sys_union` un
|
||||
ORDER BY
|
||||
un.unioncode
|
||||
""").setParam("roleId", Roles.UNION_MANGER).setParam("activityId", activityId);
|
||||
|
||||
List<Record> unions = sysUnionService.list(sql);
|
||||
|
||||
List<Record> collect = unions.stream().filter(v -> {
|
||||
return v.getInt("num") <= 0 && v.getString("telephone") != null;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
collect.forEach(v -> {
|
||||
RCSCloudAPI.sendTplSms("399ac7a7901c49df9f5939d0f10d566b", v.getString("telephone"), "@1@=" + v.getString("unionname") + "", "");
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getActivitys() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
if (ShiroUtil.hasAnyRoles("H04,ghzl")) {
|
||||
cnd.and("belongUnionId", "=", Vi.getUnionId());
|
||||
}
|
||||
if (ShiroUtil.hasRole("club01")) {
|
||||
cnd.and("belongClubId", "in", vi.getMangeClubStr());
|
||||
}
|
||||
}
|
||||
return activitySchoolService.query(cnd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.activity.models.ActivityBasicUnion;
|
||||
import io.v.nutz.activity.models.ActivityBasicUnit;
|
||||
import io.v.nutz.activity.models.ActivityResults;
|
||||
import io.v.nutz.activity.models.ActivitySchoolApply;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.crypto.hash.Sha256Hash;
|
||||
import org.apache.shiro.util.ByteSource;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/5/19 14:58
|
||||
* @description 运动会成绩录入
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/results/input")
|
||||
@RequiresAuthentication
|
||||
public class ActivityResultsController {
|
||||
|
||||
@Inject("ActivityResults")
|
||||
private ViService<ActivityResults> resultsViService;
|
||||
|
||||
@Inject("ActivitySchoolApply")
|
||||
private ViService<ActivitySchoolApply> activitySchoolApplyViService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/school/ActivityResults.html")
|
||||
@RequiresPermissions("activity.results.input")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.results.input")
|
||||
public Object pageData(@Param(value = "groupName", required = false) String groupName,
|
||||
PageForm page,
|
||||
@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "eventId", required = false) String eventId,
|
||||
@Param(value = "isMenWomen", required = false) String[] isMenWomen) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ase.id,
|
||||
ase.activityId,
|
||||
ase.eventId,
|
||||
ae.projectType awardsMode,
|
||||
ae.allName,
|
||||
ae.isMenWomen,
|
||||
school.`name` ,
|
||||
( SELECT COUNT( 1 ) FROM activity_results ar WHERE ar.eventId = ase.eventId and ar.activityId=ase.activityId) rs
|
||||
FROM
|
||||
activity_school_event ase
|
||||
LEFT JOIN activity_event ae ON ase.eventId = ae.id
|
||||
LEFT JOIN activity_school school ON school.id = ase.activityId
|
||||
LEFT JOIN activity_basic_settings abs ON abs.id=ae.competitionCategory
|
||||
$condition
|
||||
""");
|
||||
cnd.and("ase.activityId", "=", activityId);
|
||||
Vi.cndPlus(cnd, "abs.`name`", "=", groupName);
|
||||
cnd.andExcludeEmpty("ae.id", "=", eventId);
|
||||
SqlExpressionGroup sqlExpressionGroup = new SqlExpressionGroup();
|
||||
if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("2"))) {
|
||||
sqlExpressionGroup.and("ae.isMenWomen", "=", 1);
|
||||
}
|
||||
if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("3"))) {
|
||||
sqlExpressionGroup.or("ae.isMenWomen", "=", 2);
|
||||
}
|
||||
if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("4"))) {
|
||||
sqlExpressionGroup.and("ae.projectType", "=", 1);
|
||||
}
|
||||
if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("5"))) {
|
||||
sqlExpressionGroup.or("ae.projectType", "=", 2);
|
||||
}
|
||||
if (sqlExpressionGroup.getExps().size() > 0) {
|
||||
cnd.and(sqlExpressionGroup);
|
||||
}
|
||||
cnd.desc("allName");
|
||||
sql.setCondition(cnd);
|
||||
return resultsViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.results.input")
|
||||
public Object doAdd(@Param(value = "activityResults") ActivityResults[] activityResults, String activityId, String eventId) {
|
||||
|
||||
resultsViService.clear(Cnd.where("activityId", "=", activityId).and("eventId", "=", eventId));
|
||||
|
||||
|
||||
resultsViService.insert(activityResults);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.results.input")
|
||||
public Object doAddUser(ActivitySchoolApply activitySchoolApply) {
|
||||
|
||||
|
||||
Sys_user sysUser = sysUserViService.fetch(Cnd.where("loginname", "=", activitySchoolApply.getLoginname()));
|
||||
if (sysUser != null && sysUser.getLoginname().equals(activitySchoolApply.getLoginname()) && !sysUser.getUsername().equals(activitySchoolApply.getUsername())) {
|
||||
return Result.error("工号已存在,请检查姓名和工号是否一致!");
|
||||
}
|
||||
if (sysUser == null) {
|
||||
Trans.exec(() -> {
|
||||
Sys_user user = new Sys_user();
|
||||
user.setId(R.UU32());
|
||||
user.setSalt(R.UU32());
|
||||
user.setPassword(new Sha256Hash("dd3s@#2022", ByteSource.Util.bytes(R.UU32()), 1024).toHex());
|
||||
user.setUsername(activitySchoolApply.getUsername());
|
||||
user.setLoginname(activitySchoolApply.getLoginname());
|
||||
user.setSex(activitySchoolApply.getSex());
|
||||
user.setUnitid(activitySchoolApply.getUnitId());
|
||||
user.setMobile(activitySchoolApply.getMobile());
|
||||
sysUserViService.insert(user);
|
||||
ActivityBasicUnit activityBasicUnit = activitySchoolApplyViService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", user.getUnitid()));
|
||||
ActivityBasicUnion basicUnion = activitySchoolApplyViService.dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", activityBasicUnit.getUnionid()));
|
||||
|
||||
activitySchoolApply.setUserId(user.getId());
|
||||
activitySchoolApply.setApplyDate(DateUtil.getDate());
|
||||
activitySchoolApply.setSex(user.getSex());
|
||||
activitySchoolApply.setUnitId(user.getUnitid());
|
||||
activitySchoolApply.setActivityUnionId(basicUnion.getId());
|
||||
activitySchoolApply.setActivityUnionName(basicUnion.getUnionname());
|
||||
activitySchoolApplyViService.insert(activitySchoolApply);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
ActivityBasicUnit activityBasicUnit = activitySchoolApplyViService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", sysUser.getUnitid()));
|
||||
ActivityBasicUnion basicUnion = activitySchoolApplyViService.dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", activityBasicUnit.getUnionid()));
|
||||
activitySchoolApply.setUserId(sysUser.getId());
|
||||
activitySchoolApply.setApplyDate(DateUtil.getDate());
|
||||
activitySchoolApply.setSex(sysUser.getSex());
|
||||
activitySchoolApply.setUnitId(sysUser.getUnitid());
|
||||
activitySchoolApply.setActivityUnionId(basicUnion.getId());
|
||||
activitySchoolApply.setActivityUnionName(basicUnion.getUnionname());
|
||||
activitySchoolApplyViService.insert(activitySchoolApply);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询个人参赛人员
|
||||
*
|
||||
* @param activityId
|
||||
* @param eventId
|
||||
* @param isMenWomen
|
||||
* @return
|
||||
*/
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.results.input")
|
||||
public Object getUserList(String activityId,
|
||||
@Param(value = "eventId", required = false) String eventId,
|
||||
@Param(value = "isMenWomen", required = false) Integer isMenWomen) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,u.username,u.loginname,u.unionId,
|
||||
u.unionname,u.sex
|
||||
FROM
|
||||
activity_school_apply asa
|
||||
LEFT JOIN `user` u ON u.id = asa.userId $condition
|
||||
""");
|
||||
|
||||
cnd.and("asa.activityId", "=", activityId);
|
||||
cnd.and("asa.eventId", "=", eventId);
|
||||
cnd.and("asa.awardsMode", "=", 1);
|
||||
if (isMenWomen != null && isMenWomen == 1) cnd.and("u.sex", "=", "男");
|
||||
if (isMenWomen != null && isMenWomen == 2) cnd.and("u.sex", "=", "女");
|
||||
sql.setCondition(cnd);
|
||||
return activitySchoolApplyViService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.results.input")
|
||||
public Object getUnionDetails(String activityId, String eventId, String unionId) {
|
||||
return activitySchoolApplyViService.count(Cnd.where("activityId", "=", activityId).and("eventId", "=", eventId).and("unionId", "=", unionId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询团体参赛分工会
|
||||
*
|
||||
* @param activityId
|
||||
* @param eventId
|
||||
* @return
|
||||
*/
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.results.input")
|
||||
public Object getUnionList(@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "eventId", required = false) String eventId) {
|
||||
Sql sql = Sqls.create("""
|
||||
|
||||
SELECT
|
||||
un.id,
|
||||
un.unionname
|
||||
FROM
|
||||
activity_school_apply asa
|
||||
LEFT JOIN sys_union un ON un.id = asa.unionId
|
||||
WHERE
|
||||
asa.activityId = @activityId
|
||||
AND asa.eventId = @eventId
|
||||
|
||||
GROUP BY
|
||||
un.unionname
|
||||
""").setParam("activityId", activityId).setParam("eventId", eventId);
|
||||
return activitySchoolApplyViService.list(sql);
|
||||
}
|
||||
|
||||
@Inject("Sys_user")
|
||||
private ViService<Sys_user> sysUserViService;
|
||||
|
||||
|
||||
/**
|
||||
* 根据活动项目性别查询有没有获奖人员
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.results.input")
|
||||
public Object getUserData(@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "eventId", required = false) String eventId,
|
||||
@Param(value = "isMenWomen", required = false) Integer isMenWomen) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ar.id,
|
||||
ar.userId,
|
||||
ar.activityId,
|
||||
ar.eventId,
|
||||
u.username,
|
||||
u.unionId unionId,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
ar.integral,
|
||||
ar.numberOfPeople,
|
||||
ar.ranking,
|
||||
ar.isTeamPersonal
|
||||
FROM
|
||||
`activity_results` ar
|
||||
LEFT JOIN `user` u ON ar.userId = u.id $condition
|
||||
""");
|
||||
cnd.and("ar.activityId", "=", activityId);
|
||||
cnd.and("ar.eventId", "=", eventId);
|
||||
if (isMenWomen != null && isMenWomen == 1) cnd.and("u.sex", "=", "男");
|
||||
if (isMenWomen != null && isMenWomen == 2) cnd.and("u.sex", "=", "女");
|
||||
cnd.asc("ar.ranking");
|
||||
sql.setCondition(cnd);
|
||||
return resultsViService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.results.input")
|
||||
public Object getUnionData(@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "eventId", required = false) String eventId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ar.id,
|
||||
ar.activityId,
|
||||
ar.eventId,
|
||||
ar.ranking,
|
||||
ar.unionId,
|
||||
ar.numberOfPeople,
|
||||
ar.integral,
|
||||
ar.isTeamPersonal
|
||||
FROM
|
||||
activity_results ar
|
||||
WHERE
|
||||
ar.isTeamPersonal = 2
|
||||
AND ar.activityId = @activityId
|
||||
AND ar.eventId = @eventId
|
||||
ORDER BY ar.ranking asc
|
||||
""").setParam("activityId", activityId).setParam("eventId", eventId);
|
||||
return resultsViService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
import io.v.nutz.activity.services.ActivitySchoolApplyService;
|
||||
import io.v.nutz.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/3/4 16:39
|
||||
* @description 活动审核
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/review")
|
||||
@RequiresAuthentication
|
||||
public class ActivityReviewController {
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolApplyService activitySchoolApplyService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/school/ActivityReview.html")
|
||||
@RequiresPermissions("activity.review")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page, String name, String events) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
apply.id,
|
||||
apply.loginname,
|
||||
apply.username,
|
||||
apply.mobile,
|
||||
apply.identity,
|
||||
school.id schoolId,
|
||||
school.eventsId,
|
||||
school.applyStartTime,
|
||||
school.applyEndTime,
|
||||
school.startTime,
|
||||
school.endTime,
|
||||
even.allName
|
||||
FROM
|
||||
activity_school_apply apply
|
||||
LEFT JOIN activity_school school ON apply.activityId = school.id
|
||||
LEFT JOIN activity_event even ON even.id = school.eventsId
|
||||
$condition
|
||||
""");
|
||||
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
cnd.and(new Static("CURRENT_DATE() >= school.applyStartTime AND CURRENT_DATE() <= school.applyEndTime"));
|
||||
|
||||
cnd.andExcludeEmpty("school.eventsId", "=", events);
|
||||
|
||||
if (Strings.isNotBlank(name)) {
|
||||
cnd.where().andLike("school.name", name);
|
||||
}
|
||||
cnd.and("apply.`status`", "=", 1);
|
||||
cnd.desc("school.startTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return activitySchoolService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doPassFail(String id, String status) {
|
||||
Chain chain = Chain.make("status", status);
|
||||
Cnd cnd = Cnd.where("id", "=", id);
|
||||
return activitySchoolApplyService.update(chain, cnd);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+611
@@ -0,0 +1,611 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||
import io.v.nutz.activity.models.ActivityResults;
|
||||
import io.v.nutz.activity.models.ActivitySchool;
|
||||
import io.v.nutz.activity.models.ActivitySchoolEvent;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import io.v.nutz.sys.services.SysUnionService;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/5/24 14:12
|
||||
* @description 运动会成绩统计
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/score/statistics")
|
||||
@RequiresAuthentication
|
||||
public class ActivityScoreStatisticsController {
|
||||
|
||||
@Inject
|
||||
private SysUnionService sysUnionService;
|
||||
|
||||
@Inject("ActivitySchoolEvent")
|
||||
private ViService<ActivitySchoolEvent> eventViService;
|
||||
|
||||
@Inject("ActivityResults")
|
||||
private ViService<ActivityResults> resultsViService;
|
||||
|
||||
@Inject("ActivitySchool")
|
||||
private ViService<ActivitySchool> schoolViService;
|
||||
|
||||
@Inject
|
||||
private OfficeTemplateUtil officeTemplateUtil;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/school/ScoreStatistics.html")
|
||||
@RequiresPermissions("activity.score.statistics")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object isMaleFemale(String activityId, String sex, Integer awardsMode) {
|
||||
|
||||
NutMap map = new NutMap();
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
|
||||
//查询所有的工会
|
||||
List<Sys_union> query = sysUnionService.query();
|
||||
CndPlus cndX = new CndPlus();
|
||||
//查询所有的项目
|
||||
Sql sqlX = Sqls.create("""
|
||||
SELECT
|
||||
ev.id,
|
||||
ev.eventId,
|
||||
ba.`name` baname,
|
||||
eve.projectType awardsMode,
|
||||
eve.allName label,
|
||||
eve.isMenWomen
|
||||
FROM
|
||||
activity_school_event ev
|
||||
LEFT JOIN activity_event eve ON ev.eventId = eve.id
|
||||
LEFT JOIN activity_basic_settings ba ON eve.competitionCategory = ba.id $condition
|
||||
""");
|
||||
cndX.and("ev.activityId", "=", activityId);
|
||||
if (awardsMode < 3) {
|
||||
cndX.and("eve.projectType", "=", awardsMode);
|
||||
cndX.and("eve.isInterest", "=", false);
|
||||
cndX.and("eve.isMenWomen", "=", sex.equals("男") ? 1 : 2);
|
||||
}
|
||||
if (awardsMode == 3) {
|
||||
cndX.and("eve.isInterest", "=", true);
|
||||
}
|
||||
if (awardsMode == 4) {
|
||||
cndX.and(Cnd.exps("eve.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("eve.isMenWomen", "is", null));
|
||||
}
|
||||
cndX.and(new Static("1=1 order by case ba.`name` when '甲组' then 1 when '乙组' then 2 when '丙组' then 3 when '丁组' then 4 when '团体' then 5 end"));
|
||||
sqlX.setCondition(cndX);
|
||||
List<Record> eventList = eventViService.list(sqlX);
|
||||
|
||||
//查询每个工会下每个项目的成绩
|
||||
for (Sys_union sys_union : query) {
|
||||
NutMap nutMap = new NutMap();
|
||||
//记录总积分
|
||||
double totalScore = 0;
|
||||
nutMap.setv("unionname", sys_union.getUnionname());
|
||||
for (Record event : eventList) {
|
||||
Sql sqlC = Sqls.create("""
|
||||
SELECT
|
||||
IF ( sum( integral ) IS NULL, 0, sum( integral )) AS integral,
|
||||
ev.allName,ev.projectType,abs.`name` AS zb,ev.isInterest
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event ev ON ar.eventId = ev.id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.id=ev.competitionCategory $condition
|
||||
""");
|
||||
CndPlus cndC = new CndPlus();
|
||||
if ((awardsMode == 1 && event.getString("awardsMode").equals("1")) || (awardsMode == 2 && event.getString("awardsMode").equals("2"))) {
|
||||
cndC.and("ev.isInterest", "=", false);
|
||||
cndC.and("ev.isMenWomen", "=", sex.equals("男") ? 1 : 2);
|
||||
} else if (awardsMode == 3) {
|
||||
cndC.and("ev.isInterest", "=", true);
|
||||
} else if (awardsMode == 4) {
|
||||
cndC.and(Cnd.exps("ev.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("ev.isMenWomen", "is", null));
|
||||
}
|
||||
cndC.and("ar.eventId", "=", event.getString("eventid"));
|
||||
cndC.and("ar.unionid", "=", sys_union.getId());
|
||||
cndC.and("ar.activityId", "=", activityId);
|
||||
sqlC.setCondition(cndC);
|
||||
Double score = 0.0;
|
||||
List<NutMap> list = resultsViService.listMap(sqlC);
|
||||
boolean isInterest = list.get(0).getBoolean("isInterest");
|
||||
|
||||
if (list.size() > 0) {
|
||||
score = list.get(0).getDouble("integral");
|
||||
}
|
||||
|
||||
if (list.get(0).getString("allName") != null) {
|
||||
if (!isInterest) {
|
||||
nutMap.setv(list.get(0).getString("allName"), score);
|
||||
} else {
|
||||
nutMap.setv(list.get(0).getString("allName"), score / 2);
|
||||
}
|
||||
}
|
||||
totalScore += isInterest ? (score / 2) : score;
|
||||
if (list.get(0).getString("zb") != null) {
|
||||
nutMap.setv("projectType", list.get(0).getString("projectType"));
|
||||
nutMap.setv("zb", list.get(0).getString("zb"));
|
||||
}
|
||||
}
|
||||
nutMap.setv("totalScore", totalScore);
|
||||
result.add(nutMap);
|
||||
}
|
||||
|
||||
map.put("score", result);
|
||||
map.put("eventList", eventList);
|
||||
return Result.success().addData(map);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object isTopEight(String activityId, String sex, Integer awardsMode) {
|
||||
NutMap map = new NutMap();
|
||||
List<Record> result = new ArrayList<>();
|
||||
CndPlus cndX = new CndPlus();
|
||||
//查询所有的项目
|
||||
Sql sqlX = Sqls.create("""
|
||||
SELECT
|
||||
ev.id,
|
||||
ev.eventId,
|
||||
ba.`name` baname,
|
||||
eve.projectType awardsMode,
|
||||
eve.allName label
|
||||
FROM
|
||||
activity_school_event ev
|
||||
LEFT JOIN activity_event eve ON ev.eventId = eve.id
|
||||
LEFT JOIN activity_basic_settings ba ON eve.competitionCategory = ba.id $condition
|
||||
""");
|
||||
cndX.and("ev.activityId", "=", activityId);
|
||||
if (awardsMode == 1) {
|
||||
cndX.and("eve.isMenWomen", "!=", sex.equals("男") ? 2 : 1);
|
||||
cndX.and("eve.projectType", "=", 1);
|
||||
|
||||
} else {
|
||||
cndX.and("eve.projectType", "=", 2);
|
||||
}
|
||||
cndX.and(new Static("1=1 order by case ba.`name` when '甲组' then 1 when '乙组' then 2 when '丙组' then 3 when '丁组' then 4 when '团体' then 5 end"));
|
||||
sqlX.setCondition(cndX);
|
||||
List<Record> eventList = eventViService.list(sqlX);
|
||||
|
||||
|
||||
Sql sqlC = Sqls.create("");
|
||||
CndPlus cnd = new CndPlus();
|
||||
if (awardsMode == 1) {
|
||||
sqlC = Sqls.create("""
|
||||
SELECT
|
||||
CONCAT( apply.username, '(', apply.activityUnionName, ')' ) username,
|
||||
ar.integral,
|
||||
ar.ranking,
|
||||
eve.allName
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event eve ON ar.eventId = eve.id
|
||||
LEFT JOIN activity_school_apply apply ON apply.userId = ar.userId
|
||||
AND ar.activityId = apply.activityId $condition
|
||||
""");
|
||||
cnd.and("ar.isTeamPersonal", "=", awardsMode);
|
||||
cnd.and("apply.sex", "=", sex);
|
||||
cnd.and("ar.activityId", "=", activityId);
|
||||
cnd.and("ar.ranking", "<=", 8);
|
||||
cnd.groupBy("ar.id");
|
||||
} else {
|
||||
sqlC = Sqls.create("""
|
||||
SELECT
|
||||
CONCAT(sun.unionname) username,
|
||||
eve.allName,ar.ranking
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event eve ON ar.eventId = eve.id
|
||||
LEFT JOIN sys_union sun ON sun.id = ar.unionId $condition
|
||||
""");
|
||||
cnd.and("ar.isTeamPersonal", "=", awardsMode);
|
||||
cnd.and("ar.activityId", "=", activityId);
|
||||
cnd.and("ar.ranking", "<=", 8);
|
||||
|
||||
|
||||
}
|
||||
|
||||
sqlC.setCondition(cnd);
|
||||
List<Record> list = resultsViService.list(sqlC);
|
||||
|
||||
map.put("userList", list);
|
||||
map.put("eventList", eventList);
|
||||
return Result.success().addData(map);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getActivitys(Integer year) {
|
||||
return schoolViService.query(Cnd.where("YEAR(applyEndTime)", "=", year));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object isScoreTopEight(String activityId, String sex) {
|
||||
|
||||
NutMap map = new NutMap();
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
CndPlus cndX = new CndPlus();
|
||||
//查询所有的项目
|
||||
Sql sqlX = Sqls.create("""
|
||||
SELECT
|
||||
ev.id,
|
||||
ev.eventId,
|
||||
ba.`name` baname,
|
||||
eve.projectType awardsMode,
|
||||
eve.allName label
|
||||
FROM
|
||||
activity_school_event ev
|
||||
LEFT JOIN activity_event eve ON ev.eventId = eve.id
|
||||
LEFT JOIN activity_basic_settings ba ON eve.competitionCategory = ba.id $condition
|
||||
""");
|
||||
cndX.and("ev.activityId", "=", activityId);
|
||||
cndX.and(Cnd.exps("eve.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("eve.isMenWomen", "is", null));
|
||||
cndX.and(new Static("1=1 order by case ba.`name` when '甲组' then 1 when '乙组' then 2 when '丙组' then 3 when '丁组' then 4 when '团体' then 5 end"));
|
||||
sqlX.setCondition(cndX);
|
||||
List<Record> eventList = eventViService.list(sqlX);
|
||||
|
||||
//查询所有的工会
|
||||
List<Sys_union> query = sysUnionService.query();
|
||||
|
||||
for (Sys_union sys_union : query) {
|
||||
NutMap nutMap = new NutMap();
|
||||
|
||||
//记录总积分
|
||||
double totalScore = 0;
|
||||
nutMap.setv("unionname", sys_union.getUnionname());
|
||||
for (Record event : eventList) {
|
||||
Sql sqlC = Sqls.create("""
|
||||
SELECT
|
||||
IF ( sum( integral ) IS NULL, 0, sum( integral )) AS integral,
|
||||
ev.allName,ev.isInterest
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event ev ON ar.eventId = ev.id $condition
|
||||
""");
|
||||
CndPlus cndC = new CndPlus();
|
||||
cndC.and(Cnd.exps("ev.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("ev.isMenWomen", "is", null));
|
||||
cndC.and("ar.unionid", "=", sys_union.getId());
|
||||
cndC.and("ar.eventId", "=", event.getString("eventid"));
|
||||
cndC.and("ar.activityId", "=", activityId);
|
||||
sqlC.setCondition(cndC);
|
||||
Double score = 0.0;
|
||||
List<NutMap> list = resultsViService.listMap(sqlC);
|
||||
boolean isInterest = list.get(0).getBoolean("isInterest");
|
||||
if (list.size() > 0) {
|
||||
score = list.get(0).getDouble("integral");
|
||||
}
|
||||
totalScore += isInterest ? (score / 2) : score;
|
||||
|
||||
}
|
||||
nutMap.setv("totalScore", totalScore);
|
||||
result.add(nutMap);
|
||||
|
||||
}
|
||||
|
||||
map.put("score", result);
|
||||
return Result.success().addData(map);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getAnnualResults(Integer year) {
|
||||
|
||||
ArrayList<Map> resultMap = new ArrayList<>();
|
||||
|
||||
|
||||
Dao dao = sysUnionService.dao();
|
||||
List<Sys_union> unionList = sysUnionService.query();
|
||||
List<ActivitySchool> activitySchoolList = dao.query(ActivitySchool.class, Cnd.where("YEAR(applyStartTime)", "=", year));
|
||||
|
||||
List<String> labelList = activitySchoolList.stream().map(v -> v.getName()).collect(Collectors.toList());
|
||||
labelList.add(0, "分工会");
|
||||
|
||||
unionList.forEach(u -> {
|
||||
NutMap unionMap = Lang.obj2nutmap(u);
|
||||
AtomicReference<Double> scoreSum = new AtomicReference<>((double) 0);
|
||||
activitySchoolList.forEach(x -> {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT sum(integral) as sumScore FROM `activity_results` ar
|
||||
where ar.activityId = @activityId and ar.unionId = @unionId
|
||||
""");
|
||||
sql.setParam("activityId", x.getId());
|
||||
sql.setParam("unionId", u.getId());
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap scoreMap = (NutMap) sql.getResult();
|
||||
double score = scoreMap.getDouble("sumScore");
|
||||
scoreSum.updateAndGet(v -> new Double((v + score)));
|
||||
unionMap.put(x.getName(), score);
|
||||
});
|
||||
unionMap.put("总分", scoreSum.get());
|
||||
unionMap.put("分工会", unionMap.getString("unionname"));
|
||||
resultMap.add(unionMap);
|
||||
});
|
||||
labelList.add("总分");
|
||||
|
||||
return Map.of("label", labelList, "score", resultMap);
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getYear8(Integer isMenWomen, Integer year) {
|
||||
ArrayList<Map> resultMap = new ArrayList<>();
|
||||
|
||||
// int isMenWomen = sex.equals("男") ? 1 : 2;
|
||||
|
||||
Dao dao = sysUnionService.dao();
|
||||
List<Sys_union> unionList = sysUnionService.query();
|
||||
|
||||
List<ActivitySchool> activityList = dao.query(ActivitySchool.class, Cnd.where("YEAR(applyStartTime)", "=", year));
|
||||
List<String> activityIdList = activityList.stream().map(ActivitySchool::getId).collect(Collectors.toList());
|
||||
List<String> activityNameList = activityList.stream().map(ActivitySchool::getName).collect(Collectors.toList());
|
||||
|
||||
List<String> eventIdList = dao.query(ActivitySchoolEvent.class, Cnd.where("activityId", "in", activityIdList)).stream().map(v -> v.getEventId()).collect(Collectors.toList());
|
||||
|
||||
activityNameList.add(0, "分工会");
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ae.isMenWomen,
|
||||
ae.isInterest,
|
||||
ar.integral,
|
||||
ar.unionId,
|
||||
ar.activityId
|
||||
FROM
|
||||
activity_event ae
|
||||
LEFT JOIN activity_results ar ON ar.eventId = ae.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("ae.id", "in", eventIdList);
|
||||
cnd.and("ar.activityId", "in", activityIdList);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.maps());
|
||||
dao.execute(sql);
|
||||
List<NutMap> list = sql.getList(NutMap.class);
|
||||
|
||||
unionList.forEach(u -> {
|
||||
NutMap unionMap = Lang.obj2nutmap(u);
|
||||
AtomicReference<Double> scoreSum = new AtomicReference<>((double) 0);
|
||||
|
||||
activityList.forEach(a -> {
|
||||
double sexScore = list.stream().filter(x -> x.getString("unionId").equals(u.getId()) && x.getInt("isMenWomen") == isMenWomen && x.getString("activityId").equals(a.getId())).mapToDouble(h -> h.getDouble("integral")).sum();
|
||||
double qwScore = list.stream().filter(x -> x.getString("unionId").equals(u.getId()) && x.getInt("isInterest") == 1 && x.getString("activityId").equals(a.getId())).mapToDouble(h -> h.getDouble("integral")).sum();
|
||||
scoreSum.updateAndGet(v -> new Double((double) (v + (sexScore + (qwScore * 0.5)))));
|
||||
unionMap.put(a.getName(), sexScore + (qwScore * 0.5));
|
||||
});
|
||||
unionMap.put("总分", scoreSum.get());
|
||||
unionMap.put("分工会", unionMap.getString("unionname"));
|
||||
resultMap.add(unionMap);
|
||||
|
||||
});
|
||||
activityNameList.add("总分");
|
||||
return Map.of("label", activityNameList, "score", resultMap);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public void doGetYear8(HttpServletResponse response, Integer isMenWomen, Integer year) throws Exception {
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
|
||||
List<Sys_union> unionList = sysUnionService.query();
|
||||
|
||||
unionList.forEach(u -> {
|
||||
NutMap nutMap = new NutMap();
|
||||
nutMap.setv("unionname", u.getUnionname());
|
||||
double score = 0;
|
||||
for (int i = 1; i <= 2; i++) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
SUM( ar.integral ) score
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event eve ON ar.eventId = eve.id
|
||||
LEFT JOIN activity_school `as` ON `as`.id = ar.activityId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("YEAR ( `as`.applyStartTime )", "=", year);
|
||||
cnd.and("ar.unionId", "=", u.getId());
|
||||
if (i == 1) {
|
||||
cnd.and("eve.isMenWomen", "=", isMenWomen);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = resultsViService.listMap(sql);
|
||||
score += list.get(0).getDouble("score");
|
||||
} else {
|
||||
cnd.and("eve.isInterest", "=", 1);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = resultsViService.listMap(sql);
|
||||
score += list.get(0).getDouble("score") * 0.5;
|
||||
}
|
||||
}
|
||||
nutMap.setv("score", score);
|
||||
result.add(nutMap);
|
||||
});
|
||||
List<NutMap> scoreList = result.stream().sorted(Comparator.comparing(ActivityScoreStatisticsController::getDouble).reversed()).collect(Collectors.toList()).subList(0, 8);
|
||||
|
||||
for (int i = 0; i < scoreList.size(); i++) {
|
||||
scoreList.get(i).put("ranking", i + 1);
|
||||
}
|
||||
|
||||
|
||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.newBuilder().bind("scoreList", policy).build();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("year", year);
|
||||
map.put("sex", isMenWomen == 1 ? '男' : '女');
|
||||
map.put("scoreList", scoreList);
|
||||
String fileName = "%s年运动会%s子积分表".formatted(year, isMenWomen == 1 ? '男' : '女');
|
||||
|
||||
response.addHeader("Content-Type", "application/octet-stream");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
||||
XWPFTemplate.compile(officeTemplateUtil.getPath("activity_getYear8"), config).render(map).writeAndClose(response.getOutputStream());;
|
||||
}
|
||||
|
||||
public static Double getDouble(NutMap o) {
|
||||
return o.getDouble("score");
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ViReturn
|
||||
public void doExport8ByActivity(HttpServletResponse response, String activityId, Integer isMenWomen) throws Exception {
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
|
||||
List<Sys_union> unionList = sysUnionService.query();
|
||||
unionList.forEach(u -> {
|
||||
NutMap nutMap = new NutMap();
|
||||
nutMap.setv("unionname", u.getUnionname());
|
||||
double score = 0;
|
||||
for (int i = 1; i <= 2; i++) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
SUM( ar.integral ) score
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event eve ON ar.eventId = eve.id
|
||||
LEFT JOIN activity_school `as` ON `as`.id = ar.activityId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("activityId", "=", activityId);
|
||||
cnd.and("ar.unionId", "=", u.getId());
|
||||
if (i == 1) {
|
||||
cnd.and("eve.isMenWomen", "=", isMenWomen);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = resultsViService.listMap(sql);
|
||||
score += list.get(0).getDouble("score");
|
||||
} else {
|
||||
cnd.and("eve.isInterest", "=", 1);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = resultsViService.listMap(sql);
|
||||
score += list.get(0).getDouble("score") * 0.5;
|
||||
}
|
||||
}
|
||||
nutMap.setv("score", score);
|
||||
result.add(nutMap);
|
||||
});
|
||||
List<NutMap> scoreList = result.stream().sorted(Comparator.comparing(ActivityScoreStatisticsController::getDouble).reversed()).collect(Collectors.toList()).subList(0, 8);
|
||||
|
||||
for (int i = 0; i < scoreList.size(); i++) {
|
||||
scoreList.get(i).put("ranking", i + 1);
|
||||
}
|
||||
|
||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.newBuilder().bind("scoreList", policy).build();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("sex", isMenWomen == 1 ? '男' : '女');
|
||||
map.put("scoreList", scoreList);
|
||||
String fileName = "%s子积分表".formatted(isMenWomen == 1 ? '男' : '女');
|
||||
|
||||
response.addHeader("Content-Type", "application/octet-stream");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
||||
XWPFTemplate.compile(officeTemplateUtil.getPath("activity_getYear8"), config).render(map, response.getOutputStream());
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ViReturn
|
||||
public void doExcelCj(String activityId, String unionId, HttpServletResponse response) throws IOException {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
un.unioncode,
|
||||
un.unionname,
|
||||
us.loginname,
|
||||
us.username,
|
||||
us.sex,
|
||||
eve.projectCode,
|
||||
abs.`name` competitionCategoryName,
|
||||
eve.allName,
|
||||
ar.integral,
|
||||
CEILING(
|
||||
IF
|
||||
( us.loginname IS NOT NULL, ar.integral, ar.integral / 2 )) jf,
|
||||
ar.ranking
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event eve ON ar.eventId = eve.id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.id = eve.competitionCategory
|
||||
LEFT JOIN activity_school_apply apply ON apply.userId = ar.userId
|
||||
AND ar.activityId = apply.activityId
|
||||
LEFT JOIN sys_union un ON un.id = ar.unionId
|
||||
LEFT JOIN sys_user us ON us.id = ar.userId
|
||||
$condition
|
||||
ORDER BY
|
||||
un.unioncode ASC,
|
||||
us.sex DESC,
|
||||
FIELD( abs.`name`, '甲组', '乙组', '丙组', '丁组', '团体' ) ASC
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("ar.activityId", "=", activityId);
|
||||
cnd.andEX("ar.unionId", "=", unionId);
|
||||
cnd.groupBy("ar.id");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> list = schoolViService.listMap(sql);
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("分工会代码", "unioncode", 40));
|
||||
entityList.add(new ExcelExportEntity("分工会名称", "unionname", 20));
|
||||
entityList.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
entityList.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
entityList.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
entityList.add(new ExcelExportEntity("项目代码", "projectCode", 20));
|
||||
entityList.add(new ExcelExportEntity("组别", "competitionCategoryName", 20));
|
||||
entityList.add(new ExcelExportEntity("项目名称", "allName", 40));
|
||||
entityList.add(new ExcelExportEntity("成绩", "integral", 20));
|
||||
entityList.add(new ExcelExportEntity("名次", "ranking", 20));
|
||||
entityList.add(new ExcelExportEntity("积分", "jf", 20));
|
||||
ViTool.excelResponse(response, "成绩名单.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, list);
|
||||
workbook.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+482
@@ -0,0 +1,482 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import io.v.nutz.activity.models.ActivitySchool;
|
||||
import io.v.nutz.activity.models.ActivitySchoolEvent;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import io.v.nutz.sys.services.SysUnionService;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/statistics/export")
|
||||
@RequiresAuthentication
|
||||
public class ActivityStatisticsTypeExportController {
|
||||
|
||||
@Inject
|
||||
private SysUnionService sysUnionService;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Ok("void")
|
||||
@At
|
||||
public void getYear8(Integer isMenWomen, Integer year, HttpServletResponse response) {
|
||||
ArrayList<Map> resultMap = new ArrayList<>();
|
||||
List<Sys_union> unionList = sysUnionService.query();
|
||||
|
||||
List<ActivitySchool> activityList = baseService.dao().query(ActivitySchool.class, Cnd.where("YEAR(applyStartTime)", "=", year));
|
||||
List<String> activityIdList = activityList.stream().map(ActivitySchool::getId).collect(Collectors.toList());
|
||||
List<String> activityNameList = activityList.stream().map(ActivitySchool::getName).collect(Collectors.toList());
|
||||
|
||||
List<String> eventIdList = baseService.dao().query(ActivitySchoolEvent.class, Cnd.where("activityId", "in", activityIdList)).stream().map(v -> v.getEventId()).collect(Collectors.toList());
|
||||
|
||||
activityNameList.add(0, "分工会");
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ae.isMenWomen,
|
||||
ae.isInterest,
|
||||
ar.integral,
|
||||
ar.unionId,
|
||||
ar.activityId
|
||||
FROM
|
||||
activity_event ae
|
||||
LEFT JOIN activity_results ar ON ar.eventId = ae.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("ae.id", "in", eventIdList);
|
||||
cnd.and("ar.activityId", "in", activityIdList);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
unionList.forEach(u -> {
|
||||
NutMap unionMap = Lang.obj2nutmap(u);
|
||||
AtomicReference<Double> scoreSum = new AtomicReference<>((double) 0);
|
||||
|
||||
activityList.forEach(a -> {
|
||||
double sexScore = list.stream().filter(x -> x.getString("unionId").equals(u.getId()) && x.getInt("isMenWomen") == isMenWomen && x.getString("activityId").equals(a.getId())).mapToDouble(h -> h.getDouble("integral")).sum();
|
||||
double qwScore = list.stream().filter(x -> x.getString("unionId").equals(u.getId()) && x.getInt("isInterest") == 1 && x.getString("activityId").equals(a.getId())).mapToDouble(h -> h.getDouble("integral")).sum();
|
||||
scoreSum.updateAndGet(v -> new Double((double) (v + (sexScore + (qwScore * 0.5)))));
|
||||
unionMap.put(a.getName(), sexScore + (qwScore * 0.5));
|
||||
});
|
||||
unionMap.put("总分", scoreSum.get());
|
||||
unionMap.put("分工会", unionMap.getString("unionname"));
|
||||
resultMap.add(unionMap);
|
||||
|
||||
});
|
||||
activityNameList.add("总分");
|
||||
|
||||
resultMap.sort(Comparator.comparing((Map m) -> (new BigDecimal(m.get("总分").toString()))).reversed());
|
||||
for (int i = 0; i < resultMap.size(); i++) {
|
||||
resultMap.get(i).put("名次", i + 1);
|
||||
}
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("名次", "名次", 20));
|
||||
activityNameList.forEach(v -> {
|
||||
entityList.add(new ExcelExportEntity(v, v, 40));
|
||||
});
|
||||
try {
|
||||
ViTool.excelResponse(response, "年度" + (isMenWomen == 1 ? "男子" : "女子") + "团体总分.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, resultMap);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Ok("void")
|
||||
@At
|
||||
public void getAnnualResults(Integer year, HttpServletResponse response) {
|
||||
ArrayList<Map> resultMap = new ArrayList<>();
|
||||
|
||||
|
||||
Dao dao = sysUnionService.dao();
|
||||
List<Sys_union> unionList = sysUnionService.query();
|
||||
List<ActivitySchool> activitySchoolList = dao.query(ActivitySchool.class, Cnd.where("YEAR(applyStartTime)", "=", year));
|
||||
|
||||
List<String> labelList = activitySchoolList.stream().map(v -> v.getName()).collect(Collectors.toList());
|
||||
labelList.add(0, "分工会");
|
||||
|
||||
unionList.forEach(u -> {
|
||||
NutMap unionMap = Lang.obj2nutmap(u);
|
||||
AtomicReference<Double> scoreSum = new AtomicReference<>((double) 0);
|
||||
activitySchoolList.forEach(x -> {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT sum(integral) as sumScore FROM `activity_results` ar
|
||||
where ar.activityId = @activityId and ar.unionId = @unionId
|
||||
""");
|
||||
sql.setParam("activityId", x.getId());
|
||||
sql.setParam("unionId", u.getId());
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap scoreMap = (NutMap) sql.getResult();
|
||||
double score = scoreMap.getDouble("sumScore");
|
||||
scoreSum.updateAndGet(v -> new Double((v + score)));
|
||||
unionMap.put(x.getName(), score);
|
||||
});
|
||||
unionMap.put("总分", scoreSum.get());
|
||||
unionMap.put("分工会", unionMap.getString("unionname"));
|
||||
resultMap.add(unionMap);
|
||||
});
|
||||
labelList.add("总分");
|
||||
|
||||
resultMap.sort(Comparator.comparing((Map m) -> (new BigDecimal(m.get("总分").toString()))).reversed());
|
||||
for (int i = 0; i < resultMap.size(); i++) {
|
||||
resultMap.get(i).put("名次", i + 1);
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("名次", "名次", 20));
|
||||
labelList.forEach(v -> {
|
||||
entityList.add(new ExcelExportEntity(v, v, 40));
|
||||
|
||||
});
|
||||
try {
|
||||
ViTool.excelResponse(response, "年度团体总分.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, resultMap);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void isMaleFemale(String activityId, String sex, Integer awardsMode, HttpServletResponse response) {
|
||||
NutMap map = new NutMap();
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
|
||||
//查询所有的工会
|
||||
List<Sys_union> query = sysUnionService.query();
|
||||
CndPlus cndX = new CndPlus();
|
||||
//查询所有的项目
|
||||
Sql sqlX = Sqls.create("""
|
||||
SELECT
|
||||
ev.id,
|
||||
ev.eventId,
|
||||
ba.`name` baname,
|
||||
eve.projectType awardsMode,
|
||||
eve.allName label,
|
||||
eve.isMenWomen
|
||||
FROM
|
||||
activity_school_event ev
|
||||
LEFT JOIN activity_event eve ON ev.eventId = eve.id
|
||||
LEFT JOIN activity_basic_settings ba ON eve.competitionCategory = ba.id $condition
|
||||
""");
|
||||
cndX.and("ev.activityId", "=", activityId);
|
||||
if (awardsMode < 3) {
|
||||
cndX.and("eve.projectType", "=", awardsMode);
|
||||
cndX.and("eve.isInterest", "=", false);
|
||||
cndX.and("eve.isMenWomen", "=", sex.equals("男") ? 1 : 2);
|
||||
}
|
||||
if (awardsMode == 3) {
|
||||
cndX.and("eve.isInterest", "=", true);
|
||||
}
|
||||
if (awardsMode == 4) {
|
||||
cndX.and(Cnd.exps("eve.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("eve.isMenWomen", "is", null));
|
||||
}
|
||||
cndX.and(new Static("1=1 order by case ba.`name` when '甲组' then 1 when '乙组' then 2 when '丙组' then 3 when '丁组' then 4 when '团体' then 5 end"));
|
||||
sqlX.setCondition(cndX);
|
||||
List<Record> eventList = baseService.list(sqlX);
|
||||
|
||||
//查询每个工会下每个项目的成绩
|
||||
for (Sys_union sys_union : query) {
|
||||
NutMap nutMap = new NutMap();
|
||||
//记录总积分
|
||||
double totalScore = 0;
|
||||
nutMap.setv("unionname", sys_union.getUnionname());
|
||||
for (Record event : eventList) {
|
||||
Sql sqlC = Sqls.create("""
|
||||
SELECT
|
||||
IF ( sum( integral ) IS NULL, 0, sum( integral )) AS integral,
|
||||
ev.allName,ev.projectType,abs.`name` AS zb,ev.isInterest
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event ev ON ar.eventId = ev.id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.id=ev.competitionCategory $condition
|
||||
""");
|
||||
CndPlus cndC = new CndPlus();
|
||||
if ((awardsMode == 1 && event.getString("awardsMode").equals("1")) || (awardsMode == 2 && event.getString("awardsMode").equals("2"))) {
|
||||
cndC.and("ev.isInterest", "=", false);
|
||||
cndC.and("ev.isMenWomen", "=", sex.equals("男") ? 1 : 2);
|
||||
} else if (awardsMode == 3) {
|
||||
cndC.and("ev.isInterest", "=", true);
|
||||
} else if (awardsMode == 4) {
|
||||
cndC.and(Cnd.exps("ev.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("ev.isMenWomen", "is", null));
|
||||
}
|
||||
cndC.and("ar.eventId", "=", event.getString("eventid"));
|
||||
cndC.and("ar.unionid", "=", sys_union.getId());
|
||||
cndC.and("ar.activityId", "=", activityId);
|
||||
sqlC.setCondition(cndC);
|
||||
Double score = 0.0;
|
||||
List<NutMap> list = baseService.listMap(sqlC);
|
||||
boolean isInterest = list.get(0).getBoolean("isInterest");
|
||||
|
||||
if (list.size() > 0) {
|
||||
score = list.get(0).getDouble("integral");
|
||||
}
|
||||
|
||||
if (list.get(0).getString("allName") != null) {
|
||||
if (!isInterest) {
|
||||
nutMap.setv(list.get(0).getString("allName"), score);
|
||||
} else {
|
||||
nutMap.setv(list.get(0).getString("allName"), score / 2);
|
||||
}
|
||||
}
|
||||
totalScore += isInterest ? (score / 2) : score;
|
||||
if (list.get(0).getString("zb") != null) {
|
||||
nutMap.setv("projectType", list.get(0).getString("projectType"));
|
||||
nutMap.setv("zb", list.get(0).getString("zb"));
|
||||
}
|
||||
}
|
||||
nutMap.setv("totalScore", totalScore);
|
||||
result.add(nutMap);
|
||||
}
|
||||
|
||||
result.sort(Comparator.comparing((Map m) -> (new BigDecimal(m.get("totalScore").toString()))).reversed());
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
result.get(i).put("名次", i + 1);
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("名次", "名次", 20));
|
||||
entityList.add(new ExcelExportEntity("分工会", "unionname", 40));
|
||||
eventList.forEach(v -> {
|
||||
entityList.add(new ExcelExportEntity(v.getString("label"), v.getString("label"), 40));
|
||||
});
|
||||
entityList.add(new ExcelExportEntity("总分", "totalScore", 40));
|
||||
try {
|
||||
ViTool.excelResponse(response, "分工会" + sex + "项目积分.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, result);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void isTopEight(String activityId, String sex, Integer awardsMode, HttpServletResponse response) {
|
||||
NutMap map = new NutMap();
|
||||
List<Record> result = new ArrayList<>();
|
||||
CndPlus cndX = new CndPlus();
|
||||
//查询所有的项目
|
||||
Sql sqlX = Sqls.create("""
|
||||
SELECT
|
||||
ev.id,
|
||||
ev.eventId,
|
||||
ba.`name` baname,
|
||||
eve.projectType awardsMode,
|
||||
eve.allName label
|
||||
FROM
|
||||
activity_school_event ev
|
||||
LEFT JOIN activity_event eve ON ev.eventId = eve.id
|
||||
LEFT JOIN activity_basic_settings ba ON eve.competitionCategory = ba.id $condition
|
||||
""");
|
||||
cndX.and("ev.activityId", "=", activityId);
|
||||
if (awardsMode == 1) {
|
||||
cndX.and("eve.isMenWomen", "!=", sex.equals("男") ? 2 : 1);
|
||||
cndX.and("eve.projectType", "=", 1);
|
||||
|
||||
} else {
|
||||
cndX.and("eve.projectType", "=", 2);
|
||||
}
|
||||
cndX.and(new Static("1=1 order by case ba.`name` when '甲组' then 1 when '乙组' then 2 when '丙组' then 3 when '丁组' then 4 when '团体' then 5 end"));
|
||||
sqlX.setCondition(cndX);
|
||||
List<Record> eventList = baseService.list(sqlX);
|
||||
|
||||
|
||||
List<NutMap> nutMaps = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
NutMap nutMap = new NutMap();
|
||||
Sql sqlC = Sqls.create("");
|
||||
CndPlus cnd = new CndPlus();
|
||||
if (awardsMode == 1) {
|
||||
sqlC = Sqls.create("""
|
||||
SELECT
|
||||
CONCAT( apply.username, '(', apply.activityUnionName, ')' ) username,
|
||||
ar.integral,
|
||||
ar.ranking,
|
||||
eve.allName
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event eve ON ar.eventId = eve.id
|
||||
LEFT JOIN activity_school_apply apply ON apply.userId = ar.userId
|
||||
AND ar.activityId = apply.activityId $condition
|
||||
""");
|
||||
cnd.and("ar.isTeamPersonal", "=", awardsMode);
|
||||
cnd.and("apply.sex", "=", sex);
|
||||
cnd.and("ar.activityId", "=", activityId);
|
||||
cnd.and("ar.ranking", "=", i + 1);
|
||||
cnd.groupBy("ar.id");
|
||||
} else {
|
||||
sqlC = Sqls.create("""
|
||||
SELECT
|
||||
CONCAT(sun.unionname) username,
|
||||
eve.allName,ar.ranking
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event eve ON ar.eventId = eve.id
|
||||
LEFT JOIN sys_union sun ON sun.id = ar.unionId $condition
|
||||
""");
|
||||
cnd.and("ar.isTeamPersonal", "=", awardsMode);
|
||||
cnd.and("ar.activityId", "=", activityId);
|
||||
cnd.and("ar.ranking", "=", i + 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
sqlC.setCondition(cnd);
|
||||
List<Record> list = baseService.list(sqlC);
|
||||
list.forEach(l -> {
|
||||
nutMap.setv(l.getString("allName"), l.getString("username"));
|
||||
});
|
||||
|
||||
nutMaps.add(nutMap);
|
||||
}
|
||||
|
||||
for (int i = 0; i < nutMaps.size(); i++) {
|
||||
nutMaps.get(i).put("名次", i + 1);
|
||||
}
|
||||
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("名次", "名次", 20));
|
||||
eventList.forEach(v -> {
|
||||
entityList.add(new ExcelExportEntity(v.getString("label"), v.getString("label"), 40));
|
||||
});
|
||||
String sex2 = awardsMode == 2 ? "团体" : sex.equals("男") ? "男子" : "女子";
|
||||
try {
|
||||
ViTool.excelResponse(response, sex2 + "项目前八.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, nutMaps);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void isScoreTopEight(String activityId, String sex, HttpServletResponse response) {
|
||||
|
||||
NutMap map = new NutMap();
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
CndPlus cndX = new CndPlus();
|
||||
//查询所有的项目
|
||||
Sql sqlX = Sqls.create("""
|
||||
SELECT
|
||||
ev.id,
|
||||
ev.eventId,
|
||||
ba.`name` baname,
|
||||
eve.projectType awardsMode,
|
||||
eve.allName label
|
||||
FROM
|
||||
activity_school_event ev
|
||||
LEFT JOIN activity_event eve ON ev.eventId = eve.id
|
||||
LEFT JOIN activity_basic_settings ba ON eve.competitionCategory = ba.id $condition
|
||||
""");
|
||||
cndX.and("ev.activityId", "=", activityId);
|
||||
cndX.and(Cnd.exps("eve.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("eve.isMenWomen", "is", null));
|
||||
cndX.and(new Static("1=1 order by case ba.`name` when '甲组' then 1 when '乙组' then 2 when '丙组' then 3 when '丁组' then 4 when '团体' then 5 end"));
|
||||
sqlX.setCondition(cndX);
|
||||
List<Record> eventList = baseService.list(sqlX);
|
||||
|
||||
//查询所有的工会
|
||||
List<Sys_union> query = sysUnionService.query();
|
||||
|
||||
for (Sys_union sys_union : query) {
|
||||
NutMap nutMap = new NutMap();
|
||||
|
||||
//记录总积分
|
||||
double totalScore = 0;
|
||||
nutMap.setv("unionname", sys_union.getUnionname());
|
||||
for (Record event : eventList) {
|
||||
Sql sqlC = Sqls.create("""
|
||||
SELECT
|
||||
IF ( sum( integral ) IS NULL, 0, sum( integral )) AS integral,
|
||||
ev.allName,ev.isInterest
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event ev ON ar.eventId = ev.id $condition
|
||||
""");
|
||||
CndPlus cndC = new CndPlus();
|
||||
cndC.and(Cnd.exps("ev.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("ev.isMenWomen", "is", null));
|
||||
cndC.and("ar.unionid", "=", sys_union.getId());
|
||||
cndC.and("ar.eventId", "=", event.getString("eventid"));
|
||||
cndC.and("ar.activityId", "=", activityId);
|
||||
sqlC.setCondition(cndC);
|
||||
Double score = 0.0;
|
||||
List<NutMap> list = baseService.listMap(sqlC);
|
||||
boolean isInterest = list.get(0).getBoolean("isInterest");
|
||||
if (list.size() > 0) {
|
||||
score = list.get(0).getDouble("integral");
|
||||
}
|
||||
totalScore += isInterest ? (score / 2) : score;
|
||||
|
||||
}
|
||||
nutMap.setv("totalScore", totalScore);
|
||||
result.add(nutMap);
|
||||
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("名次", "名次", 20));
|
||||
entityList.add(new ExcelExportEntity("分工会", "unionname", 40));
|
||||
entityList.add(new ExcelExportEntity("总分", "totalScore", 40));
|
||||
|
||||
result.sort(Comparator.comparing((Map m) -> (new BigDecimal(m.get("totalScore").toString()))).reversed());
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
result.get(i).put("名次", i + 1);
|
||||
}
|
||||
|
||||
try {
|
||||
ViTool.excelResponse(response, "分工会" + sex + "子总分.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, result);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package io.v.nutz.activity.controller.school.constant;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/7/11 15:48
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SchoolActivityApplyExportEntity {
|
||||
|
||||
@Excel(name = "号码", width = 20d)
|
||||
private String number;
|
||||
@Excel(name = "姓名", width = 20d)
|
||||
private String userName;
|
||||
@Excel(name = "性别", width = 20d)
|
||||
private String sex;
|
||||
|
||||
private Integer sexOrder;
|
||||
|
||||
@Excel(name = "组别", width = 20d)
|
||||
private String groupName;
|
||||
|
||||
private Integer groupNameOrder;
|
||||
|
||||
@Excel(name = "项目1", width = 20d)
|
||||
private String projectNameOne;
|
||||
@Excel(name = "报名成绩", width = 20d)
|
||||
private String scoreOne;
|
||||
@Excel(name = "项目2", width = 20d)
|
||||
private String projectNameTwo;
|
||||
@Excel(name = "报名成绩", width = 20d)
|
||||
private String scoreTwo;
|
||||
@Excel(name = "项目3", width = 20d)
|
||||
private String projectNameThree;
|
||||
@Excel(name = "报名成绩", width = 20d)
|
||||
private String scoreThree;
|
||||
@Excel(name = "项目4", width = 20d)
|
||||
private String projectNameFour;
|
||||
@Excel(name = "报名成绩", width = 20d)
|
||||
private String scoreFour;
|
||||
@Excel(name = "项目5", width = 20d)
|
||||
private String projectNameFive;
|
||||
@Excel(name = "报名成绩", width = 20d)
|
||||
private String scoreFive;
|
||||
@Excel(name = "项目6", width = 20d)
|
||||
private String projectNameSix;
|
||||
@Excel(name = "报名成绩", width = 20d)
|
||||
private String scoreSix;
|
||||
@Excel(name = "身高", width = 20d)
|
||||
private String height;
|
||||
@Excel(name = "体重", width = 20d)
|
||||
private String weight;
|
||||
@Excel(name = "备注", width = 20d)
|
||||
private String remark;
|
||||
@Excel(name = "身份证", width = 20d)
|
||||
private String idCard;
|
||||
@Excel(name = "注册号", width = 20d)
|
||||
private String registerNum;
|
||||
|
||||
|
||||
private Integer awardsMode;
|
||||
|
||||
private Integer projectNameLocation;
|
||||
|
||||
private int distance;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package io.v.nutz.activity.controller.site;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.activity.models.ActivityType;
|
||||
import io.v.nutz.activity.services.ActivityCommonService;
|
||||
import io.v.nutz.activity.services.ActivityTypeService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.modules.models.AuditState;
|
||||
import io.v.nutz.modules.models.AuditStateUser;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/5/11
|
||||
* @Description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/activity/site/type")
|
||||
public class ActivityTypeController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private ActivityTypeService activityTypeService;
|
||||
|
||||
@Inject
|
||||
private ActivityCommonService activityCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/activity/site/SiteType.html")
|
||||
@RequiresPermissions("activity.site.type")
|
||||
public void index(HttpServletRequest request) {
|
||||
|
||||
}
|
||||
|
||||
@At("/findAll")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object findAll() {
|
||||
List<ActivityType> meetingTypeList = dao.query(ActivityType.class, Cnd.NEW().asc("sortNum"));
|
||||
dao.fetchLinks(meetingTypeList, "^auditStateList$");
|
||||
for (ActivityType ActivityType : meetingTypeList) {
|
||||
List<AuditState> auditStateList = ActivityType.getAuditStateList();
|
||||
dao.fetchLinks(auditStateList, "^auditStateUserList$");
|
||||
}
|
||||
return meetingTypeList;
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.type")
|
||||
public Object findOne(String module) {
|
||||
|
||||
List<AuditState> auditStateList = dao.query(AuditState.class, Cnd.where("module", "=", module));
|
||||
auditStateList.forEach(v -> {
|
||||
v.setAuditStateUserList(dao.query(AuditStateUser.class, Cnd.where("stateId", "=", v.getStateId())));
|
||||
});
|
||||
return auditStateList;
|
||||
}
|
||||
|
||||
@At("/doHandle")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.type")
|
||||
public Object doHandle(@Param("data") String data) {
|
||||
ActivityType activityType = Json.fromJson(ActivityType.class, data);
|
||||
|
||||
if (null == activityType.getId()) {
|
||||
int count = dao.count(AuditState.class, Cnd.where("module", "=", activityType.getModuleName()));
|
||||
if (count > 0) {
|
||||
return Result.error("模块名称已存在,换一个试试");
|
||||
}
|
||||
activityTypeService.add(activityType);
|
||||
} else {
|
||||
activityTypeService.edit(activityType);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At("/delete/?")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.type")
|
||||
public Object delete(Integer id) {
|
||||
if (id == 1) {
|
||||
return Result.error("此记录不可删除");
|
||||
}
|
||||
ActivityType activityType = dao.fetch(ActivityType.class, id);
|
||||
dao.clear(ActivityType.class, Cnd.where("id", "=", id));
|
||||
dao.count(AuditState.class, Cnd.where("module", "=", activityType.getModuleName()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At("/findUserList")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.type")
|
||||
public Object findUserList(@Param("keyWords") String[] keyWords) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
username,
|
||||
loginname,
|
||||
mobile,
|
||||
sex,
|
||||
unitname,
|
||||
unionname,
|
||||
unionid,
|
||||
unitid
|
||||
FROM
|
||||
`user`
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String keyWord : keyWords) {
|
||||
seg.andLike("loginname", keyWord);
|
||||
seg.orLike("username", keyWord);
|
||||
}
|
||||
cnd.and(seg);
|
||||
sql.setCondition(cnd);
|
||||
return Daos.query(dao, sql.toString(), Sqls.callback.maps());
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object findMaxStateId() {
|
||||
return activityTypeService.findMaxStateId();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.type")
|
||||
public Object checkStateId(@Param("stateId") Integer stateId, @Param("stateIndex") Integer stateIndex) {
|
||||
if (stateId == null) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
int count = dao.count(AuditState.class, Cnd.where("stateId", "=", stateId));
|
||||
if (count == 0) {
|
||||
return Result.success().addData(stateId);
|
||||
} else {
|
||||
return Result.success(activityTypeService.findMaxStateId() + 10 * stateIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package io.v.nutz.activity.controller.site;
|
||||
|
||||
|
||||
import io.v.nutz.activity.models.ActivitySiteInfo;
|
||||
import io.v.nutz.activity.services.SiteInfoService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-12-13 09:39
|
||||
* @description: 场地管理
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/site/mange")
|
||||
public class SiteManageController {
|
||||
|
||||
@Inject
|
||||
private SiteInfoService siteInfoService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/site/SiteManage.html")
|
||||
@RequiresPermissions("activity.site.manage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.manage")
|
||||
public Object pageData(@Param(value = "siteType",required = false) String siteType,
|
||||
@Param(value = "year",required = false) Integer year,
|
||||
@Param(value = "searchName",required = false) String searchName,
|
||||
@Param(value = "searchKeyword",required = false) String searchKeyword,
|
||||
@Param("pageNumber") int pageNumber,@Param("pageSize") int pageSize,
|
||||
@Param(value = "pageOrderName",required = false) String pageOrderName,
|
||||
@Param(value = "pageOrderBy",required = false) String pageOrderBy) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
if (year != null && year != 0) {
|
||||
cnd.and("YEAR(create_time)", "=", year);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(siteType)) {
|
||||
cnd.and("typeId", "=", siteType);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderName)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
} else {
|
||||
cnd.desc("create_time");
|
||||
}
|
||||
|
||||
return siteInfoService.listPage(pageNumber, pageSize, cnd);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.manage")
|
||||
public Object doAdd(@Param("data") ActivitySiteInfo activitySiteInfo) {
|
||||
siteInfoService.insert(activitySiteInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.manage")
|
||||
public Object doEdit(@Param("data") ActivitySiteInfo activitySiteInfo) {
|
||||
siteInfoService.updateIgnoreNull(activitySiteInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.manage")
|
||||
public Object doDelete(String id) {
|
||||
siteInfoService.delete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.manage")
|
||||
public Object findOneSite(String id) {
|
||||
return siteInfoService.fetch(id);
|
||||
}
|
||||
}
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
package io.v.nutz.activity.controller.site;
|
||||
|
||||
import io.v.nutz.activity.models.ActivitySiteInfo;
|
||||
import io.v.nutz.activity.models.ActivitySiteReserve;
|
||||
import io.v.nutz.activity.services.SiteReserveService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.Audit;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/activity/site/partyMemberHomeAudit")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class SitePartyMemberHomeAuditController {
|
||||
|
||||
/**
|
||||
* 党员之家Id
|
||||
*/
|
||||
public static final String DY_HOME_ID = "a6486481018b479ab137bac53936f15e";
|
||||
|
||||
@Inject
|
||||
private SiteReserveService siteReserveService;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/site/partyMemberHomeAudit.html")
|
||||
@RequiresPermissions("activity.site.partyMemberHomeAudit")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.partyMemberHomeAudit")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "siteType", required = false) String siteType,
|
||||
@Param(value = "time", required = false) String time,
|
||||
@Param(value = "isAudit", required = false) String isAudit,
|
||||
@Param(value = "siteId", required = false) String siteId,
|
||||
@Param(value = "siteName", required = false) String siteName) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
asr.*,
|
||||
asi.`name` site_name,
|
||||
ass.`stateName` state_name,
|
||||
ass.`stateColor` state_color,
|
||||
ass.stateAuditType
|
||||
FROM
|
||||
activity_site_reserve asr
|
||||
LEFT JOIN
|
||||
activity_site_info asi ON asi.id = asr.site_id
|
||||
LEFT JOIN
|
||||
audit_state ass ON ass.stateId = asr.reserve_state
|
||||
LEFT JOIN
|
||||
`user` u on u.id = asr.reserve_person_id
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("asr.reserve_state", "true".equals(isAudit) ? ">" : "false".equals(isAudit) ? "=" : ">=", 6118);
|
||||
|
||||
cnd.and("asr.site_id", "=", DY_HOME_ID);
|
||||
|
||||
//如果不是超管和校工会管理,那就只能看党员之家的审核信息
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
cnd.and("asr.site_id", "=", DY_HOME_ID);
|
||||
}
|
||||
if (Strings.isNotBlank(time)) {
|
||||
cnd.and("left(asr.reserve_start_time, 7)", "=", time);
|
||||
}
|
||||
if (Strings.isNotBlank(siteId)) {
|
||||
cnd.and("site_id", "=", siteId);
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
if (Strings.isNotBlank(siteType)) {
|
||||
cnd.and("typeId", "=", siteType);
|
||||
}
|
||||
cnd.andEX("asi.`name`", "=", siteName);
|
||||
cnd.asc("asr.reserve_start_time");
|
||||
sql.setCondition(cnd);
|
||||
return siteReserveService.listPage(pageForm.getPageNumber(),pageForm.getPageSize(),sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.partyMemberHomeAudit")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doProcess(String id, String schoolOption ,boolean isPass){
|
||||
Audit audit = new Audit();
|
||||
audit.setAuditPass(isPass);
|
||||
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setAuditOpinion(schoolOption);
|
||||
audit.setAuditTime(new Date());
|
||||
siteReserveService.dao().insert(audit);
|
||||
Chain chain = Chain.make("reserve_person_school_process", audit.getId());
|
||||
chain.add("reserve_state", isPass ? 6138 : 6128);
|
||||
siteReserveService.dao().update(ActivitySiteReserve.class, chain, Cnd.where("id", "=", id));
|
||||
|
||||
ActivitySiteReserve siteReserve = siteReserveService.dao().fetch(ActivitySiteReserve.class, Cnd.where("id", "=", id));
|
||||
ActivitySiteInfo siteInfo = siteReserveService.dao().fetch(ActivitySiteInfo.class, Cnd.where("id", "=", siteReserve.getSite_id()));
|
||||
|
||||
String sendUserLoginName = ShiroUtil.getPrincipalProperty("loginname").toString();
|
||||
String reserve_person = siteReserve.getReserve_person_username();
|
||||
String reserve_person_loginname = siteReserve.getReserve_person_loginname();
|
||||
|
||||
if (isPass){
|
||||
String content = "%s老师您好!您预约的%s申请已通过审批,祝您使用愉快!"
|
||||
.formatted(reserve_person,
|
||||
siteInfo.getName());
|
||||
msgApi.sendQiyeMsg(sendUserLoginName, reserve_person_loginname, "场地预约提醒", content);
|
||||
}else {
|
||||
String content = "%s老师您好!您预约的%s申请未通过审批,请到我的预约里查看详细信息!"
|
||||
.formatted(reserve_person,
|
||||
siteInfo.getName());
|
||||
System.out.println(content);
|
||||
msgApi.sendQiyeMsg(sendUserLoginName, reserve_person_loginname, "场地预约提醒", content);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package io.v.nutz.activity.controller.site;
|
||||
|
||||
import io.v.nutz.activity.models.ActivitySiteInfo;
|
||||
import io.v.nutz.activity.services.SiteReserveService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.activity.controller.site.SiteRecordController
|
||||
* @Description: 预约记录查询
|
||||
* @Author zxc
|
||||
* @Date 2022/5/19:15:21
|
||||
* @Version V1.0
|
||||
**/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/site/record")
|
||||
public class SiteRecordController {
|
||||
|
||||
@Inject
|
||||
private SiteReserveService siteReserveService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/site/SiteRecord.html")
|
||||
@RequiresPermissions("activity.site.record")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.record")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "siteType", required = false) String siteType,
|
||||
@Param(value = "time", required = false) String time,
|
||||
@Param(value = "siteId", required = false) String siteId,
|
||||
@Param(value = "siteName",required = false)String siteName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
asr.*,
|
||||
asi.`name` site_name,
|
||||
ass.`stateName` state_name,
|
||||
ass.`stateColor` state_color,
|
||||
ass.stateAuditType
|
||||
FROM
|
||||
activity_site_reserve asr
|
||||
LEFT JOIN activity_site_info asi ON asi.id = asr.site_id
|
||||
LEFT JOIN audit_state ass ON ass.stateId = asr.reserve_state
|
||||
LEFT JOIN `user` u ON u.id = asr.reserve_person_id
|
||||
$condition
|
||||
""");
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
cnd.and("asr.reserve_person_unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
if (Strings.isNotBlank(time)) {
|
||||
cnd.and("left(asr.reserve_start_time, 7)", "=", time);
|
||||
}
|
||||
if (Strings.isNotBlank(siteId)) {
|
||||
cnd.and("site_id", "=", siteId);
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
if (Strings.isNotBlank(siteType)) {
|
||||
cnd.and("typeId", "=", siteType);
|
||||
}
|
||||
cnd.andEX("asi.`name`","=",siteName);
|
||||
cnd.groupBy("asr.id");
|
||||
sql.setCondition(cnd);
|
||||
return siteReserveService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.record")
|
||||
public Object getSites() {
|
||||
List<ActivitySiteInfo> sites = siteReserveService.dao().query(ActivitySiteInfo.class, Cnd.NEW());
|
||||
return sites;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.record")
|
||||
public Object getCalendarData(@Param(required = false, value = "siteId") String siteId, Date startTimeTs, Date endTimeTs) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
asr.*,
|
||||
asi.name as site_name,
|
||||
asi.name as title,
|
||||
ass.`stateName` state_name,
|
||||
IF(ass.stateAuditType=0,true,false) as is_auditing,
|
||||
reserve_start_time as start,
|
||||
reserve_end_time as end
|
||||
from
|
||||
activity_site_reserve asr
|
||||
left join activity_site_info asi on asi.id = asr.site_id
|
||||
LEFT JOIN audit_state ass ON ass.stateId = asr.reserve_state
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// cnd.and("asr.site_id", "=", siteId);
|
||||
cnd.and("reserve_start_time", ">=", startTimeTs);
|
||||
cnd.and("reserve_end_time", "<=", endTimeTs);
|
||||
sql.setCondition(cnd);
|
||||
return siteReserveService.list(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,346 @@
|
||||
package io.v.nutz.activity.controller.site;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import io.v.nutz.activity.models.ActivitySiteInfo;
|
||||
import io.v.nutz.activity.models.ActivitySiteReserve;
|
||||
import io.v.nutz.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.activity.services.SiteInfoService;
|
||||
import io.v.nutz.activity.services.SiteReserveService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.AuditState;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/site/apply")
|
||||
public class SiteReserveApplyController {
|
||||
|
||||
@Inject
|
||||
private SiteInfoService siteInfoService;
|
||||
|
||||
@Inject
|
||||
private SiteReserveService siteReserveService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService baseService;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/site/SiteApply.html")
|
||||
@RequiresPermissions("activity.site.apply")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请
|
||||
*
|
||||
* @param activitySiteReserve 申请信息
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.apply")
|
||||
@SLog(tag = "场地预约", msg = "预约申请")
|
||||
public Object insert(@Param("siteReserve") ActivitySiteReserve activitySiteReserve) {
|
||||
activitySiteReserve.setReserve_state(6098);
|
||||
dao.insert(activitySiteReserve);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username
|
||||
FROM
|
||||
`user` u
|
||||
LEFT JOIN `sys_user_role` sur ON u.id = sur.userId
|
||||
WHERE
|
||||
sur.roleId = @roleId
|
||||
AND u.unionid = @unionid
|
||||
""").setParam("roleId", "5d342e614e9a48288d50154bcdcc75d3")
|
||||
.setParam("unionid", Vi.getUnionId());
|
||||
List<Record> processList = baseService.list(sql);
|
||||
ActivitySiteInfo siteInfo = siteInfoService.fetch(activitySiteReserve.getSite_id());
|
||||
String auditUrl = "https://zhgh.nsi.edu.cn/mobile/activity/site/unionAudit";
|
||||
String sendUserLoginName = (String) ShiroUtil.getPrincipalProperty("loginname");
|
||||
processList.forEach(item -> {
|
||||
String auditLoginName = item.getString("loginname");
|
||||
String content = item.getString("username") + "您好!"+ activitySiteReserve.getReserve_person_username() +"申请的【" + siteInfo.getName() + "】场地待您审核,请您通过门户网站登录智慧工会平台进行审核。";
|
||||
// msgApi.sendQiyeMsgTemplate(sendUserLoginName, auditLoginName, "场地预约审核", auditUrl, content);
|
||||
msgApi.sendMsg(auditLoginName,content);
|
||||
});
|
||||
// List<String> list = Lang.list("2007080352", "1996070092");
|
||||
// String content = "%s的%s老师申请了一条%s的场地预约,您可登录智慧工会平台查看详情"
|
||||
// .formatted(Vi.getUnion().getUnionname(),
|
||||
// ShiroUtil.getPrincipalProperty("username"),
|
||||
// siteInfo.getName());
|
||||
// list.forEach(item -> {
|
||||
// msgApi.sendMsg(item,content);
|
||||
// });
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请人基本信息
|
||||
*
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.apply")
|
||||
public Object applyUserInfo() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id as reserve_person_id,
|
||||
username as reserve_person_username,
|
||||
loginname as reserve_person_loginname,
|
||||
sex as reserve_person_sex,
|
||||
mobile as reserve_person_phone,
|
||||
unitname as reserve_person_unitname,
|
||||
unionname as reserve_person_unionname,
|
||||
unionid as reserve_person_unionid
|
||||
FROM
|
||||
`user`
|
||||
WHERE id = @userId
|
||||
""");
|
||||
sql.setParam("userId", ShiroUtil.getUserId());
|
||||
return baseService.fetch(sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 撤销预约
|
||||
*
|
||||
* @param id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.apply")
|
||||
public Object revoke(String id) {
|
||||
dao.clear(ActivitySiteReserve.class, Cnd.where("id", "=", id));
|
||||
//发送短信提醒
|
||||
|
||||
//获取分工会主席
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username
|
||||
FROM
|
||||
`user` u
|
||||
LEFT JOIN `sys_user_role` sur ON u.id = sur.userId
|
||||
WHERE
|
||||
sur.roleId = @roleId
|
||||
AND u.unionid = @unionid
|
||||
""").setParam("roleId", "5d342e614e9a48288d50154bcdcc75d3")
|
||||
.setParam("unionid", Vi.getUnionId());
|
||||
List<Record> processList = baseService.list(sql);
|
||||
|
||||
ActivitySiteReserve reserve = dao.fetch(ActivitySiteReserve.class, Cnd.where("id", "=", id));
|
||||
ActivitySiteInfo siteInfo = dao.fetch(ActivitySiteInfo.class, Cnd.where("id", "=", reserve.getSite_id()));
|
||||
//申请人姓名(发件人)
|
||||
String reserveName = reserve.getReserve_person_username();
|
||||
//申请人工号(发件人)
|
||||
String sendUserLoginName = (String) ShiroUtil.getPrincipalProperty("loginname");
|
||||
processList.forEach(item -> {
|
||||
//审核人姓名
|
||||
String username = item.getString("username");
|
||||
//审核人工号
|
||||
String auditLoginName = item.getString("loginname");
|
||||
String content = "%s老师您好!%s老师预约的%s申请已撤销,您已无需审核!"
|
||||
.formatted(username, reserveName,
|
||||
siteInfo.getName());
|
||||
msgApi.sendQiyeMsg(sendUserLoginName, auditLoginName, "场地预约撤销通知", content);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.apply")
|
||||
public Object doClean(String id) {
|
||||
dao.clear(ActivitySiteReserve.class, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部场地
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.apply")
|
||||
public Object getAllSite() {
|
||||
return siteInfoService.query(Cnd.where("state", "=", 1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据场地查询后七天的预约情况
|
||||
*
|
||||
* @param siteId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.apply")
|
||||
public Object siteChange(String siteId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
asr.*,
|
||||
asi.`name` AS siteName
|
||||
FROM
|
||||
`activity_site_reserve` asr
|
||||
LEFT JOIN `activity_site_info` asi ON asi.id = asr.site_id
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("asr.site_id", "=", siteId);
|
||||
// cnd.and("asr.reserve_start_time", "<=", DateUtil.nextWeek());
|
||||
// cnd.and("asr.reserve_end_time", ">", DateUtil.now());
|
||||
cnd.and("asr.reserve_start_time",">",DateUtil.now());
|
||||
List<AuditState> stateList = dao.query(AuditState.class, Cnd.where("module", "=", "dyHome").and("stateName", "like", "%拒绝"));
|
||||
if (Lang.isNotEmpty(stateList)) {
|
||||
List<Integer> stateIds = stateList.stream().map(AuditState::getStateId).collect(Collectors.toList());
|
||||
cnd.and("asr.reserve_state", "not in", stateIds);
|
||||
}
|
||||
cnd.asc("asr.reserve_start_time");
|
||||
sql.setCondition(cnd);
|
||||
return siteReserveService.list(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有场地使用情况
|
||||
*
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.apply")
|
||||
public Object allSiteUsage() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
asr.*,
|
||||
asi.`name` AS siteName
|
||||
FROM
|
||||
`activity_site_reserve` asr
|
||||
LEFT JOIN `activity_site_info` asi ON asi.id = asr.site_id
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
// cnd.and("asr.reserve_start_time", "<=", DateUtil.nextWeek());
|
||||
// cnd.and("asr.reserve_end_time", ">", DateUtil.now());
|
||||
cnd.and("asr.reserve_start_time",">",DateUtil.now());
|
||||
cnd.asc("asr.reserve_start_time");
|
||||
sql.setCondition(cnd);
|
||||
List<Record> list = siteReserveService.list(sql);
|
||||
return list.stream().collect(Collectors.groupingBy(v -> v.getString("siteName")));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验申请时间是否已经被人预约
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("activity.site.apply")
|
||||
public Object checkApplyTime(String time, @Param(value = "endTime", required = false) String endTime, String siteId) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("DATE(reserve_start_time)", "=", time.substring(0, 10));
|
||||
cnd.and("site_id","=",siteId);
|
||||
List<AuditState> stateList = dao.query(AuditState.class, Cnd.where("module", "=", "dyHome").and("stateName", "like", "%拒绝"));
|
||||
if (Lang.isNotEmpty(stateList)) {
|
||||
List<Integer> stateIds = stateList.stream().map(AuditState::getStateId).collect(Collectors.toList());
|
||||
cnd.and("reserve_state", "not in", stateIds);
|
||||
}
|
||||
|
||||
|
||||
DateTime startTime = DateUtil.parseDateTime(time);//1
|
||||
DateTime closeTime = DateUtil.parseDateTime(endTime);//5
|
||||
List<ActivitySiteReserve> reserveList = siteReserveService.query(cnd);
|
||||
|
||||
boolean isJJ = false;
|
||||
|
||||
for (ActivitySiteReserve reserve : reserveList) {
|
||||
Date reserve_start_time = reserve.getReserve_start_time();
|
||||
Date reserve_end_time = reserve.getReserve_end_time();
|
||||
|
||||
if (startTime.isAfterOrEquals(reserve_start_time) && startTime.isBeforeOrEquals(reserve_end_time)) {
|
||||
isJJ = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (closeTime.isAfterOrEquals(reserve_start_time) && closeTime.isBeforeOrEquals(reserve_end_time)) {
|
||||
isJJ = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(startTime.isBeforeOrEquals(reserve_start_time) && closeTime.isAfterOrEquals(reserve_end_time)){
|
||||
isJJ = true;
|
||||
break;
|
||||
}
|
||||
// if (startTime.isBefore(reserve_start_time)) {
|
||||
// isJJ = closeTime.isAfter(reserve_start_time);
|
||||
// } else {
|
||||
// isJJ = reserve_end_time.compareTo(startTime) > 0;
|
||||
// }
|
||||
// if (isJJ) {
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
System.out.println(isJJ);
|
||||
|
||||
if (isJJ) {
|
||||
return Result.error("该时间段已被预约,请重新填写预约开始时间");
|
||||
} else {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
// if (Lang.isNotEmpty(reserveList)) {
|
||||
// return Result.error("该时间段已被预约,请重新填写预约开始时间");
|
||||
// } else {
|
||||
// return Result.success();
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
package io.v.nutz.activity.controller.site;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.activity.models.ActivitySiteInfo;
|
||||
import io.v.nutz.activity.models.ActivitySiteReserve;
|
||||
import io.v.nutz.activity.services.ActivityCommonService;
|
||||
import io.v.nutz.activity.services.SiteInfoService;
|
||||
import io.v.nutz.activity.services.SiteReserveService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.modules.models.Audit;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysUnitService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-12-13 14:33
|
||||
* @description: 场地预约
|
||||
**/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/site/reserve")
|
||||
public class SiteReserveController {
|
||||
|
||||
@Inject
|
||||
private SiteInfoService siteInfoService;
|
||||
|
||||
@Inject
|
||||
private SiteReserveService siteReserveService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Inject
|
||||
private ActivityCommonService activityCommonService;
|
||||
|
||||
@Inject
|
||||
private SysUnitService sysUnitService;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/site/SiteReserve.html")
|
||||
@RequiresPermissions("activity.site.reserve")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.reserve")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "siteType", required = false) String siteType,
|
||||
@Param(value = "time", required = false) String time,
|
||||
@Param(value = "siteId", required = false) String siteId,
|
||||
@Param(value = "siteName", required = false) String siteName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
asr.*,
|
||||
asi.`name` site_name,
|
||||
ass.`stateName` state_name,
|
||||
ass.`stateColor` state_color,
|
||||
ass.stateAuditType
|
||||
FROM
|
||||
activity_site_reserve asr
|
||||
LEFT JOIN activity_site_info asi ON asi.id = asr.site_id
|
||||
LEFT JOIN audit_state ass ON ass.stateId = asr.reserve_state
|
||||
LEFT JOIN `user` u ON u.id = asr.reserve_person_id
|
||||
$condition
|
||||
""");
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
cnd.and("reserve_person_id", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
if (Strings.isNotBlank(time)) {
|
||||
cnd.and("left(asr.reserve_start_time, 7)", "=", time);
|
||||
}
|
||||
if (Strings.isNotBlank(siteId)) {
|
||||
cnd.and("site_id", "=", siteId);
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
if (Strings.isNotBlank(siteType)) {
|
||||
cnd.and("typeId", "=", siteType);
|
||||
}
|
||||
cnd.andEX("asi.`name`", "=", siteName);
|
||||
cnd.groupBy("asr.id");
|
||||
sql.setCondition(cnd);
|
||||
return siteReserveService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.reserve")
|
||||
public Object findAllOpenSite(@Param(value = "time", required = false) String time,
|
||||
@Param(value = "siteType", required = false) String siteType) {
|
||||
String sb = "SELECT " +
|
||||
"asi.*," +
|
||||
" (select unitname from `user` where username = asi.contact_person limit 1) as unitname," +
|
||||
"( SELECT count( 1 ) FROM activity_site_reserve WHERE site_id = asi.id AND reserve_state = (select stateId from audit_state where module = (select moduleName from activity_type where id = asi.typeId) and stateAuditType = 3) ";
|
||||
if (StrUtil.isNotBlank(time)) {
|
||||
sb += " AND left(reserve_day, 7) = '" + time + "'";
|
||||
}
|
||||
sb += " ) count FROM activity_site_info asi $condition ";
|
||||
|
||||
Sql sql = Sqls.create(sb);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("state", "=", true);
|
||||
if (StrUtil.isNotBlank(siteType)) {
|
||||
cnd.and("typeId", "=", siteType);
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return siteInfoService.list(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("activity.site.reserve")
|
||||
public Object findUser(@Param(value = "keywords", required = false) String keywords) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("SELECT ur.username,ur.id,ut.name unit_name,ur.unitid,ur.mobile FROM sys_user ur LEFT JOIN sys_unit ut ON ut.id=ur.unitid $condition LIMIT 0,30 ");
|
||||
if (Strings.isNotBlank(keywords)) {
|
||||
cnd.where().orLike("loginname", keywords).orLike("username", keywords);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<Record> list = sysUserService.list(sql);
|
||||
return Result.success().addData(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.reserve")
|
||||
public Object findReserveInfo(@Param(value = "siteId", required = false) String siteId,
|
||||
@Param(value = "day", required = false) String day) {
|
||||
Sql sql = Sqls.create("SELECT ar.*,`as`.stateAuditType FROM activity_site_reserve ar left join audit_state `as` on ar.reserve_state=`as`.stateId $condition");
|
||||
|
||||
String moduleName = activityCommonService.findModuleNameByActivityId(siteId);
|
||||
//根据moduleName找审核失败的数据
|
||||
Sql s = Sqls.create("""
|
||||
select
|
||||
stateId
|
||||
from
|
||||
audit_state
|
||||
where
|
||||
stateAuditType = 1 and
|
||||
module = @module
|
||||
""").setParam("module", moduleName);
|
||||
|
||||
List<Record> list = siteReserveService.list(s);
|
||||
List<String> stateList = list.stream().map(o -> o.getString("stateId")).collect(Collectors.toList());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("site_id", "=", siteId);
|
||||
if (StrUtil.isNotBlank(day)) {
|
||||
cnd.and("reserve_day", "=", day);
|
||||
cnd.and("reserve_state", "not in ", stateList);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return siteReserveService.list(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.reserve")
|
||||
public Object checkReserve(String reserve_day, String start_time, String end_time, String site_id) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("site_id", "=", site_id)
|
||||
.and("reserve_state", "!=", 40)
|
||||
.and("reserve_day", "=", reserve_day);
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.or("start_time", "<=", start_time).and("end_time", ">=", start_time);
|
||||
group.or("start_time", "<=", end_time).and("start_time", ">=", end_time);
|
||||
cnd.and(group);
|
||||
return siteReserveService.count(cnd);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.reserve")
|
||||
public Object findOne(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
asr.*,
|
||||
asi.`name` site_name,
|
||||
ass.`stateName` state_name,
|
||||
ass.stateAuditType,
|
||||
su.username,
|
||||
sm.username smusername,
|
||||
su.sex,
|
||||
su.unionname,
|
||||
su.loginname
|
||||
FROM
|
||||
activity_site_reserve asr
|
||||
LEFT JOIN activity_site_info asi ON asi.id = asr.site_id
|
||||
LEFT JOIN audit_state ass ON ass.stateId = asr.reserve_state
|
||||
LEFT JOIN `user` su ON su.id = asr.reserve_person_id
|
||||
LEFT JOIN sys_user sm ON sm.id = asr.site_manager_id
|
||||
WHERE
|
||||
asr.id = @id
|
||||
group by asr.id
|
||||
""").setParam("id", id);
|
||||
NutMap record = (NutMap) Daos.query(siteInfoService.dao(), sql.toString(), Sqls.callback.map());
|
||||
|
||||
if (Strings.isNotBlank(record.getString("reserve_person_union_process"))) {
|
||||
Audit audit = siteInfoService.dao().fetch(Audit.class, Cnd.where("id", "=", record.getString("reserve_person_union_process")));
|
||||
record.put("unionProcess", audit);
|
||||
}
|
||||
if (Strings.isNotBlank(record.getString("reserve_person_school_process"))) {
|
||||
Audit audit = siteInfoService.dao().fetch(Audit.class, Cnd.where("id", "=", record.getString("reserve_person_school_process")));
|
||||
record.put("schoolProcess", audit);
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package io.v.nutz.activity.controller.site;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import io.v.nutz.activity.models.ActivitySiteInfo;
|
||||
import io.v.nutz.activity.models.ActivitySiteReserve;
|
||||
import io.v.nutz.activity.services.ActivityCommonService;
|
||||
import io.v.nutz.activity.services.SiteInfoService;
|
||||
import io.v.nutz.activity.services.SiteReserveService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.SendMsg;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.lang.Enum;
|
||||
import io.v.nutz.meeting.models.CustomAuditTypeHandle;
|
||||
import io.v.nutz.modules.models.Audit;
|
||||
import io.v.nutz.modules.models.AuditState;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.msgNotify.service.MsgNotifyService;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-12-15 13:52
|
||||
* @description: 预约审核
|
||||
**/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/site/review")
|
||||
public class SiteReviewController {
|
||||
|
||||
@Inject
|
||||
private SiteReserveService siteReserveService;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
/**
|
||||
* 党员之家Id
|
||||
*/
|
||||
public static final String DY_HOME_ID = "a6486481018b479ab137bac53936f15e";
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/site/SiteReview.html")
|
||||
@RequiresPermissions("activity.site.review")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.review")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "siteType", required = false) String siteType,
|
||||
@Param(value = "time", required = false) String time,
|
||||
@Param(value = "isAudit", required = false) String isAudit,
|
||||
@Param(value = "siteId", required = false) String siteId,
|
||||
@Param(value = "siteName", required = false) String siteName) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
asr.*,
|
||||
asi.`name` site_name,
|
||||
ass.`stateName` state_name,
|
||||
ass.`stateColor` state_color,
|
||||
ass.stateAuditType
|
||||
FROM
|
||||
activity_site_reserve asr
|
||||
LEFT JOIN
|
||||
activity_site_info asi ON asi.id = asr.site_id
|
||||
LEFT JOIN
|
||||
audit_state ass ON ass.stateId = asr.reserve_state
|
||||
LEFT JOIN
|
||||
`user` u on u.id = asr.reserve_person_id
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("asr.reserve_state", "true".equals(isAudit) ? ">" : "false".equals(isAudit) ? "=" : ">=", 6118);
|
||||
//如果不是超管和校工会管理,那就只能看党员之家的审核信息
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
cnd.and("asr.site_id", "=", DY_HOME_ID);
|
||||
}
|
||||
if (Strings.isNotBlank(time)) {
|
||||
cnd.and("left(asr.reserve_start_time, 7)", "=", time);
|
||||
}
|
||||
if (Strings.isNotBlank(siteId)) {
|
||||
cnd.and("site_id", "=", siteId);
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
if (Strings.isNotBlank(siteType)) {
|
||||
cnd.and("typeId", "=", siteType);
|
||||
}
|
||||
cnd.andEX("asi.`name`", "=", siteName);
|
||||
cnd.asc("asr.reserve_start_time");
|
||||
sql.setCondition(cnd);
|
||||
return siteReserveService.listPage(pageForm.getPageNumber(),pageForm.getPageSize(),sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.review")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doProcess(String id, String schoolOption ,boolean isPass){
|
||||
Audit audit = new Audit();
|
||||
audit.setAuditPass(isPass);
|
||||
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setAuditOpinion(schoolOption);
|
||||
audit.setAuditTime(new Date());
|
||||
siteReserveService.dao().insert(audit);
|
||||
Chain chain = Chain.make("reserve_person_school_process", audit.getId());
|
||||
chain.add("reserve_state", isPass ? 6138 : 6128);
|
||||
siteReserveService.dao().update(ActivitySiteReserve.class, chain, Cnd.where("id", "=", id));
|
||||
|
||||
ActivitySiteReserve siteReserve = siteReserveService.dao().fetch(ActivitySiteReserve.class, Cnd.where("id", "=", id));
|
||||
ActivitySiteInfo siteInfo = siteReserveService.dao().fetch(ActivitySiteInfo.class, Cnd.where("id", "=", siteReserve.getSite_id()));
|
||||
|
||||
String sendUserLoginName = ShiroUtil.getPrincipalProperty("loginname").toString();
|
||||
String reserve_person = siteReserve.getReserve_person_username();
|
||||
String reserve_person_loginname = siteReserve.getReserve_person_loginname();
|
||||
|
||||
if (isPass){
|
||||
String content = "%s老师您好!您预约的%s申请已通过审批,祝您使用愉快!"
|
||||
.formatted(reserve_person,
|
||||
siteInfo.getName());
|
||||
msgApi.sendQiyeMsg(sendUserLoginName, reserve_person_loginname, "场地预约提醒", content);
|
||||
}else {
|
||||
String content = "%s老师您好!您预约的%s申请未通过审批,请到我的预约里查看详细信息!"
|
||||
.formatted(reserve_person,
|
||||
siteInfo.getName());
|
||||
System.out.println(content);
|
||||
msgApi.sendQiyeMsg(sendUserLoginName, reserve_person_loginname, "场地预约提醒", content);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package io.v.nutz.activity.controller.site;
|
||||
|
||||
import cn.hutool.core.io.unit.DataUnit;
|
||||
import io.v.nutz.activity.models.ActivitySiteInfo;
|
||||
import io.v.nutz.activity.models.ActivitySiteReserve;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.Audit;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 场地预约分工会审核
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/site/unionProcess")
|
||||
public class SiteUnionProcessController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/site/SiteUnionProcess.html")
|
||||
@RequiresPermissions("activity.site.unionProcess")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.unionProcess")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "siteType", required = false) String siteType,
|
||||
@Param(value = "time", required = false) String time,
|
||||
@Param(value = "isAudit", required = false) String isAudit,
|
||||
@Param(value = "siteId", required = false) String siteId,
|
||||
@Param(value = "siteName", required = false) String siteName) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
asr.*,
|
||||
asi.`name` site_name,
|
||||
ass.`stateName` state_name,
|
||||
ass.`stateColor` state_color,
|
||||
ass.stateAuditType
|
||||
FROM
|
||||
activity_site_reserve asr
|
||||
LEFT JOIN
|
||||
activity_site_info asi ON asi.id = asr.site_id
|
||||
LEFT JOIN
|
||||
audit_state ass ON ass.stateId = asr.reserve_state
|
||||
LEFT JOIN
|
||||
`user` u on u.id = asr.reserve_person_id
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("asr.reserve_state", "true".equals(isAudit) ? ">" : "false".equals(isAudit) ? "=" : ">=", 6098);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
cnd.and("reserve_person_unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
if (Strings.isNotBlank(time)) {
|
||||
cnd.and("left(asr.reserve_start_time, 7)", "=", time);
|
||||
}
|
||||
if (Strings.isNotBlank(siteId)) {
|
||||
cnd.and("site_id", "=", siteId);
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
if (Strings.isNotBlank(siteType)) {
|
||||
cnd.and("typeId", "=", siteType);
|
||||
}
|
||||
cnd.andEX("asi.`name`", "=", siteName);
|
||||
cnd.asc("asr.reserve_start_time");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 党员之家Id
|
||||
*/
|
||||
public static final String DY_HOME_ID = "a6486481018b479ab137bac53936f15e";
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.site.unionProcess")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doProcess(String id, String unionOption, boolean isPass) {
|
||||
Audit audit = new Audit();
|
||||
audit.setAuditPass(isPass);
|
||||
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setAuditOpinion(unionOption);
|
||||
audit.setAuditTime(new Date());
|
||||
baseService.dao().insert(audit);
|
||||
|
||||
Chain chain = Chain.make("reserve_person_union_process", audit.getId());
|
||||
chain.add("reserve_state", isPass ? 6118 : 6108);
|
||||
baseService.dao().update(ActivitySiteReserve.class, chain, Cnd.where("id", "=", id));
|
||||
|
||||
ActivitySiteReserve siteReserve = baseService.dao().fetch(ActivitySiteReserve.class, Cnd.where("id", "=", id));
|
||||
ActivitySiteInfo siteInfo = baseService.dao().fetch(ActivitySiteInfo.class, Cnd.where("id", "=", siteReserve.getSite_id()));
|
||||
|
||||
String sendUserLoginName = ShiroUtil.getPrincipalProperty("loginname").toString();
|
||||
String reserve_person = siteReserve.getReserve_person_username();
|
||||
String reserve_person_loginname = siteReserve.getReserve_person_loginname();
|
||||
String auditUrl = "https://zhgh.nsi.edu.cn/mobile/activity/site/schoolAudit";
|
||||
|
||||
//闫燕琴(党员之家审核人) 徐淑文
|
||||
String dyHomeReserve = "9020230075";
|
||||
// String dyHomeReserve = "2007080352";
|
||||
//校工会审核人(邓研,苏新荣)
|
||||
String schoolReserve = "2007080352,1996070092";
|
||||
// String schoolReserve = "2007080352";
|
||||
|
||||
if (isPass){
|
||||
// String schoolContent = siteInfo.getName() + ",您有一条场地预约待审核,请您通过门户网站或点击详情登录智慧工会平台进行审核。,"
|
||||
// + siteReserve.getReserve_person_username();
|
||||
|
||||
String msgContent = "%s的%s老师申请的%s的场地预约,分工会审核已通过,转为校工会审核,请您通过门户网站或点击企业微信消息前往智慧工会平台进行审核。"
|
||||
.formatted(Vi.getUnion().getUnionname(),
|
||||
reserve_person,
|
||||
siteInfo.getName());
|
||||
if (DY_HOME_ID.equals(siteInfo.getId())){
|
||||
// msgApi.sendQiyeMsgTemplate(sendUserLoginName,dyHomeReserve,"场地预约审核",auditUrl,schoolContent);
|
||||
msgApi.sendMsg(dyHomeReserve,msgContent);
|
||||
}else {
|
||||
// msgApi.sendQiyeMsgTemplate(sendUserLoginName,schoolReserve,"场地预约审核",auditUrl,schoolContent);
|
||||
msgApi.sendMsg(schoolReserve,msgContent);
|
||||
}
|
||||
List<String> list = Lang.list("2007080352", "1996070092");
|
||||
list.forEach(item -> {
|
||||
msgApi.sendMsg(item,msgContent);
|
||||
});
|
||||
}else {
|
||||
String content = "%s老师您好!您预约的%s申请未通过审批,请到我的预约里查看详细信息!"
|
||||
.formatted(reserve_person,
|
||||
siteInfo.getName());
|
||||
System.out.println(content);
|
||||
msgApi.sendQiyeMsg(sendUserLoginName, reserve_person_loginname, "场地预约提醒", content);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package io.v.nutz.activity.controller.union;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.activity.models.ActivityTissue;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.Audit;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/12/4 9:31
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/audit")
|
||||
public class ActivityAuditController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
|
||||
@At("/union")
|
||||
@Ok("beetl:platform/activity/union/unionActivityAudit.html")
|
||||
@RequiresPermissions("activity.union.audit")
|
||||
public void unionIndex() {
|
||||
}
|
||||
|
||||
|
||||
@At("/club")
|
||||
@Ok("beetl:platform/activity/union/clubActivityAudit.html")
|
||||
@RequiresPermissions("activity.club.audit")
|
||||
public void clubIndex() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.club.audit", "activity.union.audit", "activity.union.audit"}, logical = Logical.OR)
|
||||
public Object pageData(PageForm page, boolean state,
|
||||
@Param(value = "year", required = false) String year,
|
||||
@Param(value = "name", required = false) String name,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "type", required = false) Integer type) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tissue.*,
|
||||
uni.unionname ,
|
||||
club.`name` clubName,
|
||||
abs.`name` projectTypeName
|
||||
FROM
|
||||
activity_tissue tissue
|
||||
LEFT JOIN sys_union uni ON uni.id = tissue.unionId
|
||||
LEFT JOIN sys_club club ON club.id = tissue.clubId
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code`=tissue.projectTypeCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.andExcludeEmpty("YEAR(tissue.startTime)", "=", year);
|
||||
cnd.andExcludeEmpty("tissue.unionId", "=", unionId);
|
||||
cnd.andExcludeEmpty("tissue.type", "=", type);
|
||||
cnd.andExcludeEmpty("tissue.state", state ? ">" : "=", 1);
|
||||
|
||||
if (Strings.isNotBlank(name)) {
|
||||
cnd.where().andLike("tissue.name", name);
|
||||
}
|
||||
|
||||
|
||||
if (StrUtil.isNotBlank(page.getPageOrderName()) && StrUtil.isNotBlank(page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
} else {
|
||||
cnd.desc("tissue.startTime");
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.club.audit", "activity.union.audit", "activity.union.audit"}, logical = Logical.OR)
|
||||
public Object doReview(String id, boolean flag, Audit audit) {
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
baseService.insert(audit);
|
||||
baseService.dao().update(ActivityTissue.class, Chain.make("state", flag ? 3 : 2).add("auditId", audit.getId()), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package io.v.nutz.activity.controller.union;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.activity.models.ActivityTissue;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/11/2 10:07
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/apply")
|
||||
public class ActivityUnionApplyController {
|
||||
|
||||
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
|
||||
@At("/union")
|
||||
@Ok("beetl:platform/activity/union/unionActivityApply.html")
|
||||
@RequiresPermissions("activity.union.apply")
|
||||
public void unionIndex() {
|
||||
}
|
||||
|
||||
|
||||
@At("/club")
|
||||
@Ok("beetl:platform/activity/union/clubActivityApply.html")
|
||||
@RequiresPermissions("activity.club.apply")
|
||||
public void clubIndex() {
|
||||
}
|
||||
|
||||
|
||||
@At("/school")
|
||||
@Ok("beetl:platform/activity/union/schoolActivityApply.html")
|
||||
@RequiresPermissions("activity.school.apply")
|
||||
public void schoolIndex() {
|
||||
}
|
||||
|
||||
|
||||
private static final NutMap activityCodeMap = new NutMap() {{
|
||||
put("40002", "JC");
|
||||
put("40003", "XH");
|
||||
put("40001", "GH");
|
||||
}};
|
||||
|
||||
/**
|
||||
* 活动编号生成
|
||||
*
|
||||
* @param activity_type
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object generateActivityCode(String activity_type) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
int year = Calendar.getInstance().get(Calendar.YEAR);
|
||||
cnd.and("LEFT(activityCode,6)", "=", year + activityCodeMap.getString(activity_type));
|
||||
String code = String.format("%03d", baseService.dao().count(ActivityTissue.class, cnd) + 1);
|
||||
return year + activityCodeMap.getString(activity_type) + code;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getUnionData(@Param(value = "activityScopeGroupId", required = false) String activityScopeGroupId) {
|
||||
if (StrUtil.isBlank(activityScopeGroupId)) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.unionname,
|
||||
count( u.id ) AS teacherCount
|
||||
FROM
|
||||
sys_union gh
|
||||
LEFT JOIN `user` u ON u.unionid = gh.id
|
||||
GROUP BY
|
||||
gh.id
|
||||
""");
|
||||
return simpleService.listMap(sql);
|
||||
} else {
|
||||
// count( u.id ) AS unionNum,
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.unionname,
|
||||
( SELECT count( 1 ) FROM `user` WHERE id IN ( SELECT userid FROM activity_user_scope WHERE groupId = @activityScopeGroupId ) AND unionId = gh.id ) as teacherCount
|
||||
|
||||
FROM
|
||||
sys_union gh
|
||||
LEFT JOIN `user` u ON u.unionid = gh.id
|
||||
GROUP BY
|
||||
gh.id
|
||||
""");
|
||||
sql.setParam("activityScopeGroupId", activityScopeGroupId);
|
||||
return simpleService.listMap(sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
package io.v.nutz.activity.controller.union;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||
import io.v.nutz.activity.models.ActivityTissue;
|
||||
import io.v.nutz.activity.models.ActivityTissuePerson;
|
||||
import io.v.nutz.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.activity.services.ActivityTissueService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysMsgService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-08 16:07
|
||||
* @description: 分工会活动信息管理
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/info/mange")
|
||||
public class ActivityUnionManageController {
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@Inject
|
||||
private ActivityTissueService activityTissueService;
|
||||
|
||||
@Inject("Sys_user")
|
||||
private ViService<Sys_user> sysUserService;
|
||||
|
||||
@Inject
|
||||
private OfficeTemplateUtil officeTemplateUtil;
|
||||
@Inject
|
||||
private SysMsgService sysMsgService;
|
||||
|
||||
@Inject("ActivityTissuePerson")
|
||||
private ViService<ActivityTissuePerson> tissuePersonService;
|
||||
|
||||
@At("/union")
|
||||
@Ok("beetl:platform/activity/union/unionActivity.html")
|
||||
@RequiresPermissions("activity.union.info")
|
||||
public void unionIndex() {
|
||||
}
|
||||
|
||||
@At("/club")
|
||||
@Ok("beetl:platform/activity/union/clubActivity.html")
|
||||
@RequiresPermissions("activity.club.info")
|
||||
public void clubIndex() {
|
||||
}
|
||||
|
||||
@At("/school")
|
||||
@Ok("beetl:platform/activity/union/schoolActivity.html")
|
||||
@RequiresPermissions("activity.school.info2")
|
||||
public void schoolIndex() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object pageData(PageForm page, @Param(value = "year", required = false) String year,
|
||||
@Param(value = "name", required = false) String name,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "type", required = false) Integer type) {
|
||||
return activityTissueService.pageData(page, year, name, unionId, type);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.union.info", "activity.club.info", "activity.school.info2"}, logical = Logical.OR)
|
||||
public Object findUser(@Param(value = "serachWord", required = false) String serachWord,
|
||||
@Param(value = "activity_type", required = false) Integer activity_type) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT id userId,username userName,loginname loginName,sex,mobile,unitname unitName,unionname unionName FROM `user` $condition
|
||||
""");
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
if (activity_type == 40002) {
|
||||
cnd.and("unionId", "=", vi.getUnionId());
|
||||
} else if (activity_type == 40003) {
|
||||
cnd.and("id", "in", " SELECT userid FROM sys_club_user WHERE clubid = '%s' ".formatted(vi.getClubId()));
|
||||
}
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(serachWord)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.andLike("username", serachWord);
|
||||
group.orLike("loginname", serachWord);
|
||||
cnd.and(group);
|
||||
}
|
||||
|
||||
cnd.limit(1, 30);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return sysUserService.listMap(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校工会添加
|
||||
*
|
||||
* @param tissue
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.union.info", "activity.club.info", "activity.school.info2"}, logical = Logical.OR)
|
||||
public Object doAdd(@Param(value = "tissue") ActivityTissue tissue) {
|
||||
tissue.setUserId(ShiroUtil.getUserId());
|
||||
tissue.setApplyTime(DateUtil.getDate());
|
||||
String title = "校工会文化活动";
|
||||
String url = "/platform/activity/info/mange/school";
|
||||
if (tissue.getType() == 40002) {
|
||||
tissue.setState(1);
|
||||
tissue.setUnionId(Vi.getUnionId());
|
||||
title = "分工会活动";
|
||||
url = "/platform/activity/info/mange/union";
|
||||
} else if (tissue.getType() == 40003) {
|
||||
tissue.setState(1);
|
||||
tissue.setClubId(vi.getClubId());
|
||||
title = "社团活动";
|
||||
url = "/platform/activity/info/mange/club";
|
||||
} else {
|
||||
tissue.setState(3);
|
||||
}
|
||||
|
||||
Trans.exec(() -> {
|
||||
activityTissueService.insertWith(tissue, "tissuePersonList");
|
||||
tissue.getGoods().forEach(v -> {
|
||||
v.setActivityCode(tissue.getActivityCode());
|
||||
v.setReid(tissue.getId());
|
||||
});
|
||||
activitySchoolService.dao().insert(tissue.getGoods());
|
||||
tissue.getCover();
|
||||
});
|
||||
if (tissue.getXlFlag() != null && tissue.getXlFlag()) {
|
||||
String time = tissue.getStartTime() + "至" + tissue.getEndTime();
|
||||
sysMsgService.sendMsgByActivityGroupId(tissue.getId(), tissue.getGroupId(), title, tissue.getName(), url, "/mobile/activity/unionActivity", time);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.union.info", "activity.club.info", "activity.school.info2"}, logical = Logical.OR)
|
||||
public Object doEdit(@Param("tissue") ActivityTissue tissue) {
|
||||
activityTissueService.doEdit(tissue);
|
||||
String title = "校工会文化活动";
|
||||
String url = "/platform/activity/info/mange/school";
|
||||
if (tissue.getType() == 40002) {
|
||||
title = "分工会活动";
|
||||
url = "/platform/activity/info/mange/union";
|
||||
} else if (tissue.getType() == 40003) {
|
||||
title = "社团活动";
|
||||
url = "/platform/activity/info/mange/club";
|
||||
}
|
||||
sysMsgService.deleteMsgByActivityId(tissue.getId());
|
||||
if (tissue.getXlFlag() != null && tissue.getXlFlag()) {
|
||||
String time = tissue.getStartTime() + "至" + tissue.getEndTime();
|
||||
sysMsgService.sendMsgByActivityGroupId(tissue.getId(), tissue.getGroupId(), title, tissue.getName(), url, "/mobile/activity/unionActivity", time);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.union.info", "activity.club.info", "activity.school.info2"}, logical = Logical.OR)
|
||||
public Object doDelete(String id) {
|
||||
activityTissueService.doDelete(id);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findOne(String id) {
|
||||
return activityTissueService.findOne(id);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.union.info", "activity.club.info", "activity.school.info2"}, logical = Logical.OR)
|
||||
public Object searchTissueUser(String id, @Param(value = "search", required = false) String search) {
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tissueId", "=", id);
|
||||
|
||||
if (Strings.isNotBlank(search)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.andLike("userName", search);
|
||||
group.orLike("loginName", search);
|
||||
cnd.and(group);
|
||||
}
|
||||
|
||||
return tissuePersonService.query(cnd);
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions(value = {"activity.union.info", "activity.club.info", "activity.school.info2"}, logical = Logical.OR)
|
||||
public void export(String id, HttpServletResponse response) throws IOException {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tissue.*,
|
||||
uni.unionname,
|
||||
club.`name` clubName
|
||||
FROM
|
||||
activity_tissue tissue
|
||||
LEFT JOIN sys_union uni ON uni.id = tissue.unionId
|
||||
LEFT JOIN sys_club club ON club.id = tissue.clubId
|
||||
WHERE
|
||||
tissue.id = @id
|
||||
""").setParam("id", id);
|
||||
|
||||
NutMap nutMap = activityTissueService.fetch(sql);
|
||||
|
||||
List<ActivityTissuePerson> personList = tissuePersonService.query(Cnd.where("tissueId", "=", nutMap.getString("id")));
|
||||
nutMap.setv("users", personList);
|
||||
nutMap.setv("unitName", nutMap.getString("unionname") != null ? nutMap.getString("unionname") : nutMap.getString("clubName"));
|
||||
nutMap.setv("time", new SimpleDateFormat("yyyy年MM月dd日").format(new Date()));
|
||||
|
||||
String fileName = nutMap.getString("name") + "活动登记表";
|
||||
nutMap.setv("fileName", fileName);
|
||||
|
||||
response.addHeader("Content-Type", "application/octet-stream");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
|
||||
|
||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.newBuilder().bind("users", policy).build();
|
||||
XWPFTemplate.compile(officeTemplateUtil.getPath("activity_tissue"), config).render(nutMap).writeAndClose(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions(value = {"activity.union.info", "activity.club.info", "activity.school.info2"}, logical = Logical.OR)
|
||||
public void doExportUser(String id, @Param(value = "unionId", required = false) String unionId, HttpServletResponse response) throws IOException {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
atp.applyDateTime,
|
||||
atp.notes
|
||||
FROM
|
||||
`activity_tissue_person` atp
|
||||
LEFT JOIN `user` u ON u.id = atp.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("atp.tissueId", "=", id);
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<ActivityTissuePerson> tissuePeople = tissuePersonService.listEntity(sql);
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entityList.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
entityList.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
entityList.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
entityList.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
entityList.add(new ExcelExportEntity("工会", "unionName", 20));
|
||||
// entityList.add(new ExcelExportEntity("备注", "notes", 20));
|
||||
try {
|
||||
ViTool.excelResponse(response, "活动人员.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, tissuePeople);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package io.v.nutz.activity.controller.union;
|
||||
|
||||
import io.v.nutz.activity.models.ActivityPlan;
|
||||
import io.v.nutz.activity.services.ActivityPlanService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-08 16:08
|
||||
* @description: 分工会活动计划管理
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/plan")
|
||||
public class ActivityUnionPlanController {
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private ActivityPlanService activityPlanService;
|
||||
|
||||
@At("/union")
|
||||
@Ok("beetl:platform/activity/union/unionPlan.html")
|
||||
@RequiresPermissions("activityYear.union.plan")
|
||||
public void unionIndex() {
|
||||
}
|
||||
|
||||
@At("/addUnionPlan")
|
||||
@Ok("beetl:platform/activity/union/addUnionPlan.html")
|
||||
@RequiresPermissions("activityYear.union.addPlan")
|
||||
public void addUnionPlan() {
|
||||
}
|
||||
|
||||
@At("/club")
|
||||
@Ok("beetl:platform/activity/union/clubPlan.html")
|
||||
@RequiresPermissions("activityYear.club.plan")
|
||||
public void clubIndex() {
|
||||
}
|
||||
|
||||
@At("/addClubPlan")
|
||||
@Ok("beetl:platform/activity/union/addClubPlan.html")
|
||||
@RequiresPermissions("activityYear.club.addPlan")
|
||||
public void addClubPlan() {
|
||||
}
|
||||
|
||||
@At("/school")
|
||||
@Ok("beetl:platform/activity/union/schoolPlan.html")
|
||||
@RequiresPermissions("activityYear.school.plan")
|
||||
public void schoolIndex() {
|
||||
}
|
||||
|
||||
@At("/addSchoolPlan")
|
||||
@Ok("beetl:platform/activity/union/addSchoolPlan.html")
|
||||
@RequiresPermissions("activityYear.school.addPlan")
|
||||
public void addSchoolPlan() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activityYear.club.plan", "activityYear.school.plan", "activityYear.union.plan"}, logical = Logical.OR)
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "year", required = false) String year,
|
||||
@Param(value = "name", required = false) String name,
|
||||
@Param(value = "tissueId", required = false) String tissueId,
|
||||
@Param(value = "type", required = false) Integer type) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("ap.type", "=", type);
|
||||
return activityPlanService.pageData(page, year, name, tissueId, cnd);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activityYear.school.addPlan", "activityYear.union.addPlan", "activityYear.club.addPlan"}, logical = Logical.OR)
|
||||
public Object doAdd(@Param(value = "name", required = false) String name,
|
||||
@Param(value = "time", required = false) String time,
|
||||
@Param(value = "content", required = false) String content,
|
||||
@Param(value = "event", required = false) String event,
|
||||
@Param(value = "type", required = false) String type,
|
||||
@Param(value = "money", required = false) Double money,
|
||||
@Param(value = "activityType", required = false) String activityType) {
|
||||
ActivityPlan activityPlan = new ActivityPlan();
|
||||
activityPlan.setName(name);
|
||||
activityPlan.setMoney(money);
|
||||
activityPlan.setTime(time);
|
||||
activityPlan.setContent(content);
|
||||
activityPlan.setEvent(event);
|
||||
activityPlan.setActivityType(activityType);
|
||||
if (type.equals("40002")) {
|
||||
activityPlan.setType("40002");
|
||||
activityPlan.setTissueId(Vi.getUnionId());
|
||||
} else if (type.equals("40003")) {
|
||||
activityPlan.setType("40003");
|
||||
activityPlan.setTissueId(vi.getClubId());
|
||||
} else {
|
||||
activityPlan.setType("40001");
|
||||
}
|
||||
activityPlanService.insert(activityPlan);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activityYear.school.addPlan", "activityYear.union.addPlan", "activityYear.club.addPlan"}, logical = Logical.OR)
|
||||
public Object doEdit(ActivityPlan activityPlan) {
|
||||
activityPlanService.updateIgnoreNull(activityPlan);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activityYear.club.plan", "activityYear.school.plan", "activityYear.union.plan"}, logical = Logical.OR)
|
||||
public Object doDelete(String id) {
|
||||
activityPlanService.delete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activityYear.club.plan", "activityYear.school.plan", "activityYear.union.plan"}, logical = Logical.OR)
|
||||
public Object findOne(String id) {
|
||||
return activityPlanService.fetch(id);
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package io.v.nutz.activity.controller.union;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.activity.models.ActivityTissue;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityUnionUserStatisticsController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/7/5 10:29
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/user/statistics")
|
||||
public class ActivityUnionUserStatisticsController {
|
||||
|
||||
|
||||
@At("/union")
|
||||
@Ok("beetl:platform/activity/union/unionStatisticsActivity.html")
|
||||
@RequiresPermissions("activity.union.user.statistics")
|
||||
public void unionIndex() {
|
||||
}
|
||||
|
||||
@At("/club")
|
||||
@Ok("beetl:platform/activity/union/clubStatisticsActivity.html")
|
||||
@RequiresPermissions("activity.club.user.statistics")
|
||||
public void clubIndex() {
|
||||
}
|
||||
|
||||
@At("/school")
|
||||
@Ok("beetl:platform/activity/union/schoolStatisticsActivity.html")
|
||||
@RequiresPermissions("activity.school.user.statistics")
|
||||
public void schoolIndex() {
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.school.user.statistics", "activity.club.user.statistics", "activity.union.user.statistics"}, logical = Logical.OR)
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "activityId", required = false) String activityId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
atp.applyDateTime,
|
||||
atp.notes
|
||||
FROM
|
||||
`activity_tissue_person` atp
|
||||
LEFT JOIN `user` u ON u.id = atp.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("atp.tissueId", "=", activityId);
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
}
|
||||
if (StrUtil.isNotBlank(page.getPageOrderName()) && StrUtil.isNotBlank(page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
} else {
|
||||
cnd.desc("atp.applyDateTime");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activity.school.user.statistics", "activity.club.user.statistics", "activity.union.user.statistics"}, logical = Logical.OR)
|
||||
public Object getActivityByYearOrType(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "type", required = false) Integer type) {
|
||||
return baseService.dao().query(ActivityTissue.class, Cnd.where("type", "=", type).andEX("YEAR(startTime)", "=", year).desc("startTime"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
package io.v.nutz.activity.controller.union;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.activity.models.ActivityYearSummary;
|
||||
import io.v.nutz.activity.services.ActivityYearSummaryService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/6/29
|
||||
* @Description
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/yearSummary")
|
||||
public class ActivityUnionYearSummaryController {
|
||||
|
||||
private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private FtpService ftpService;
|
||||
@Inject
|
||||
private Vi vi;
|
||||
@Inject
|
||||
private ActivityYearSummaryService activityYearSummaryService;
|
||||
|
||||
@At("/union")
|
||||
@Ok("beetl:platform/activity/summary/union/unionSummary.html")
|
||||
@RequiresPermissions("activityYear.union.summary")
|
||||
public void unionIndex() {
|
||||
}
|
||||
|
||||
@At("/addUnionSummary")
|
||||
@Ok("beetl:platform/activity/summary/union/addSummary.html")
|
||||
@RequiresPermissions("activityYear.union.addSummary")
|
||||
public void addUnionSummary() {
|
||||
}
|
||||
|
||||
@At("/club")
|
||||
@Ok("beetl:platform/activity/summary/club/clubSummary.html")
|
||||
@RequiresPermissions("activityYear.club.summary")
|
||||
public void clubIndex() {
|
||||
}
|
||||
|
||||
@At("/addClubSummary")
|
||||
@Ok("beetl:platform/activity/summary/club/addSummary.html")
|
||||
@RequiresPermissions("activityYear.club.addSummary")
|
||||
public void addClubSummary() {
|
||||
}
|
||||
|
||||
@At("/school")
|
||||
@Ok("beetl:platform/activity/summary/school/schoolSummary.html")
|
||||
@RequiresPermissions("activityYear.school.summary")
|
||||
public void schoolIndex() {
|
||||
}
|
||||
|
||||
@At("/addSchoolSummary")
|
||||
@Ok("beetl:platform/activity/summary/school/addSummary.html")
|
||||
@RequiresPermissions("activityYear.school.addSummary")
|
||||
public void addSchoolSummary() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activityYear.school.summary", "activityYear.union.summary", "activityYear.club.summary"}, logical = Logical.OR)
|
||||
public Object pageData(@Param(value = "year", required = false) String year,
|
||||
@Param(value = "tissueId", required = false)String tissueId,
|
||||
@Param(value = "summaryType", required = false)String summaryType,
|
||||
@Param(value = "pageSize", required = false)Integer pageSize,
|
||||
@Param(value = "pageNumber", required = false)Integer pageNumber,
|
||||
@Param(value = "summaryFrom", required = false)String summaryFrom) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
String str = "select " +
|
||||
" su.*," +
|
||||
" year(su.ctime) as `year`, " +
|
||||
" dic.name as typename," +
|
||||
" u.username ";
|
||||
|
||||
if ("2".equals(summaryFrom)) {
|
||||
str += ",un.unionname as name";
|
||||
}
|
||||
if ("3".equals(summaryFrom)) {
|
||||
str += ",club.name as name";
|
||||
}
|
||||
str += " from activity_summary su ";
|
||||
str += " left join `user` u on su.userId = u.id";
|
||||
if ("2".equals(summaryFrom)) {
|
||||
str += " left join sys_union un on su.tissueId = un.id";
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "A06"})) {
|
||||
cnd.and("su.tissueId", "=", Vi.getUnionId());
|
||||
}
|
||||
}
|
||||
if ("3".equals(summaryFrom)) {
|
||||
str += " left join sys_club club on su.tissueId = club.id";
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "A06"})) {
|
||||
cnd.and("su.tissueId", "=", vi.getClubId());
|
||||
}
|
||||
}
|
||||
str += " left join sys_dict dic on su.summaryType = dic.id ";
|
||||
|
||||
str += " $condition";
|
||||
Sql sql = Sqls.create(str);
|
||||
|
||||
if (StrUtil.isNotBlank(year)) {
|
||||
cnd.and("year(su.ctime)", "=", year);
|
||||
}
|
||||
if (StrUtil.isNotBlank(tissueId)) {
|
||||
cnd.and("su.tissueId", "=", tissueId);
|
||||
}
|
||||
if (StrUtil.isNotBlank(summaryType)) {
|
||||
cnd.and("su.summaryType", "=", summaryType);
|
||||
}
|
||||
if (StrUtil.isNotBlank(summaryFrom)) {
|
||||
cnd.and("su.summaryFrom", "=", summaryFrom);
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return activityYearSummaryService.listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@RequiresPermissions(value = {"activityYear.school.addSummary", "activityYear.union.addSummary", "activityYear.club.addSummary"}, logical = Logical.OR)
|
||||
public Object doHandle(@Param("..") ActivityYearSummary activityYearSummary) {
|
||||
try {
|
||||
if (activityYearSummary.getId() == null) {
|
||||
activityYearSummary.setCtime(SIMPLE_DATE_FORMAT.format(new Date()));
|
||||
activityYearSummaryService.insert(activityYearSummary);
|
||||
} else {
|
||||
activityYearSummaryService.updateIgnoreNull(activityYearSummary);
|
||||
}
|
||||
return Result.success().addMsg("上传成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error().addMsg("上传失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activityYear.school.summary", "activityYear.union.summary", "activityYear.club.summary"}, logical = Logical.OR)
|
||||
public Object findOne(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
select su.*,u.username,u.loginname from
|
||||
activity_summary su
|
||||
left join
|
||||
`user` u on su.userId = u.id
|
||||
$condition
|
||||
""");
|
||||
sql.setCondition(Cnd.NEW().and("su.id", "=", id));
|
||||
return activityYearSummaryService.fetch(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"activityYear.school.summary", "activityYear.union.summary", "activityYear.club.summary"}, logical = Logical.OR)
|
||||
public Object doDelete(String id) {
|
||||
ActivityYearSummary summary = activityYearSummaryService.fetch(id);
|
||||
List<NutMap> files = summary.getFiles();
|
||||
for (NutMap file : files) {
|
||||
Record filedata = baseService.dao().fetch("sys_file", Cnd.where("id", "=", id));
|
||||
if (filedata != null) {
|
||||
baseService.clear("sys_file", Cnd.where("id", "=", file.getString("id")));
|
||||
ftpService.delete(filedata.getString("filepath"));
|
||||
}
|
||||
}
|
||||
activityYearSummaryService.delete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
public Object getMyClub() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT sur.stid FROM sys_user_role sur
|
||||
$condition
|
||||
""");
|
||||
sql.setCondition(Cnd.NEW().and("sur.userId", "=", ShiroUtil.getPrincipalProperty("id")).and("sur.roleId", "=", Roles.club01));
|
||||
List<Record> list = baseService.list(sql);
|
||||
List<String> stids = list.stream().map(x -> x.getString("stid")).collect(Collectors.toList());
|
||||
return stids;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package io.v.nutz.activity.listener;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.v.nutz.activity.models.ActivityBasicUnion;
|
||||
import io.v.nutz.base.event.SysCommonDataChange;
|
||||
import io.v.nutz.base.event.SysCommonDataChangeType;
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/8/15 08:46
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
public class SysActivityUnionListener implements SysCommonDataChange {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
|
||||
@Override
|
||||
public void exec(SysCommonDataChangeType changeType, Class<?> sysUnionClass, String bizId) {
|
||||
if (sysUnionClass.getSimpleName().equals(Sys_union.class.getSimpleName())) {
|
||||
switch (changeType) {
|
||||
case INSERT -> {
|
||||
Sys_union sys_union = dao.fetch(Sys_union.class, bizId);
|
||||
ActivityBasicUnion basicUnion = BeanUtil.copyProperties(sys_union, ActivityBasicUnion.class);
|
||||
dao.insert(basicUnion);
|
||||
}
|
||||
case UPDATE -> {
|
||||
Sys_union sys_union = dao.fetch(Sys_union.class, bizId);
|
||||
ActivityBasicUnion basicUnion = dao.fetch(ActivityBasicUnion.class, Cnd.where("id", "=", sys_union.getId()));
|
||||
BeanUtil.copyProperties(sys_union, basicUnion);
|
||||
dao.update(basicUnion);
|
||||
}
|
||||
case DELETE -> {
|
||||
dao.clear(ActivityBasicUnion.class, Cnd.where("id", "=", bizId));
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package io.v.nutz.activity.listener;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.v.nutz.activity.models.ActivityBasicUnit;
|
||||
import io.v.nutz.base.event.SysCommonDataChange;
|
||||
import io.v.nutz.base.event.SysCommonDataChangeType;
|
||||
import io.v.nutz.sys.models.Sys_unit;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/8/14 17:30
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
public class SysActivityUnitListener implements SysCommonDataChange {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Override
|
||||
public void exec(SysCommonDataChangeType changeType, Class<?> sysUnitClass, String bizId) {
|
||||
if (sysUnitClass.getSimpleName().equals(Sys_unit.class.getSimpleName())) {
|
||||
switch (changeType) {
|
||||
case INSERT -> {
|
||||
Sys_unit sys_unit = dao.fetch(Sys_unit.class, bizId);
|
||||
ActivityBasicUnit basicUnit = BeanUtil.copyProperties(sys_unit, ActivityBasicUnit.class);
|
||||
dao.insert(basicUnit);
|
||||
}
|
||||
case UPDATE -> {
|
||||
Sys_unit sys_unit = dao.fetch(Sys_unit.class, bizId);
|
||||
ActivityBasicUnit basicUnit = dao.fetch(ActivityBasicUnit.class, Cnd.where("id", "=", sys_unit.getId()));
|
||||
BeanUtil.copyProperties(sys_unit, basicUnit, "id");
|
||||
dao.update(basicUnit);
|
||||
}
|
||||
case DELETE -> {
|
||||
dao.clear(ActivityBasicUnit.class, Cnd.where("id", "=", bizId));
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import io.v.nutz.annontation.SelectEnum;
|
||||
|
||||
@SelectEnum
|
||||
public enum ActivityAuditTypeEnum {
|
||||
|
||||
ALL("ALL", "不限制"),
|
||||
CLUB("CLUB", "审核本社团"),
|
||||
DW("DW", "审核本单位"),
|
||||
FGH("FGH", "审核本分工会");
|
||||
|
||||
public String value;
|
||||
public String desc;
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return this.desc;
|
||||
}
|
||||
|
||||
private ActivityAuditTypeEnum(String value, String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/2/23 15:36
|
||||
* @description 活动基础设置
|
||||
*/
|
||||
@Data
|
||||
@Table("activity_basic_settings")
|
||||
public class ActivityBasicSettings extends BaseModel implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("父级ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String parentId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("代码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String code;
|
||||
|
||||
@Column
|
||||
@Comment("名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String note;
|
||||
|
||||
@Column
|
||||
@Comment("有子节点")
|
||||
private boolean hasChildren;
|
||||
|
||||
@Column
|
||||
@Comment("排序字段")
|
||||
@Prev({
|
||||
@SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM activity_basic_settings"),
|
||||
@SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM activity_basic_settings")
|
||||
})
|
||||
private Integer location;
|
||||
|
||||
private List<ActivityBasicSettings> child;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/7/28 13:49
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table
|
||||
public class ActivityBasicUnion extends Sys_union {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true, nullEffective = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("添加来源")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String source;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import io.v.nutz.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/7/28 10:57
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table
|
||||
@TableIndexes({@Index(name = "INDEX_SYS_UNIT_PATH", fields = {"path"}, unique = true),
|
||||
@Index(name = "INDEX_SYS_UNIT_UNITCODE", fields = {"unitcode"}, unique = true),
|
||||
@Index(name = "INDEX_SYS_UNION", fields = {"unionid"}, unique = false),
|
||||
})
|
||||
public class ActivityBasicUnit extends BaseModel implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("父级ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String parentId;
|
||||
|
||||
@Column
|
||||
@Comment("树路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String path;
|
||||
|
||||
@Column
|
||||
@Comment("单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("单位别名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String aliasName;
|
||||
|
||||
@Column
|
||||
@Comment("机构编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitcode;
|
||||
|
||||
@Column
|
||||
@Comment("单位介绍")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String note;
|
||||
|
||||
@Column
|
||||
@Comment("单位地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String address;
|
||||
|
||||
@Column
|
||||
@Comment("联系电话")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String telephone;
|
||||
|
||||
@Column
|
||||
@Comment("单位邮箱")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String email;
|
||||
|
||||
@Column
|
||||
@Comment("单位网站")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String website;
|
||||
|
||||
@Column
|
||||
@Comment("排序字段")
|
||||
@Prev({
|
||||
@SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM sys_unit"),
|
||||
@SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM sys_unit")
|
||||
})
|
||||
private Integer location;
|
||||
|
||||
@Column
|
||||
@Comment("有子节点")
|
||||
private boolean hasChildren;
|
||||
|
||||
@Column
|
||||
@Comment("单位logo")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String logo;
|
||||
|
||||
@Column
|
||||
@Comment("单位级别")
|
||||
@ColDefine(type = ColType.INT, width = 3)
|
||||
private int unitlevel;
|
||||
|
||||
@Column
|
||||
@Comment("工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionid;
|
||||
|
||||
@Column
|
||||
@Comment("所属校区")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String xqid;
|
||||
|
||||
@Column
|
||||
@Comment("所属类别id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String classid;
|
||||
|
||||
@Column
|
||||
@Comment("福利单位id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String welfareUnitId;
|
||||
|
||||
private List<ActivityBasicUnit> child;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/2/24 14:29
|
||||
* @description 比赛组别
|
||||
*/
|
||||
@Data
|
||||
@Table("activity_event")
|
||||
public class ActivityEvent extends BaseModel implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("比赛组别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String competitionCategory;
|
||||
|
||||
@Column
|
||||
@Comment("距离")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String distance;
|
||||
|
||||
@Column
|
||||
@Comment("运动项目")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String sports;
|
||||
|
||||
@Column
|
||||
@Comment("项目类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String projectType;
|
||||
|
||||
@Column
|
||||
@Comment("比赛项目编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String projectCode;
|
||||
|
||||
@Column
|
||||
@Comment("男女分组")
|
||||
@ColDefine(type = ColType.INT, width = 50)
|
||||
private Integer isMenWomen;
|
||||
|
||||
@Column
|
||||
@Comment("是否趣味")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean isInterest;
|
||||
|
||||
@Column
|
||||
@Comment("属于那个运动类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String exerciseType;
|
||||
|
||||
@Column
|
||||
@Comment("项目全名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String allName;
|
||||
|
||||
@Column
|
||||
@Comment("开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String startAgeDate;
|
||||
|
||||
@Column
|
||||
@Comment("结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String endAgeDate;
|
||||
|
||||
@Column
|
||||
@Comment("是否启用")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean whetherEnable;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String note;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
public interface ActivityImport {
|
||||
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
class applyUser {
|
||||
@Excel(name = "工会", width = 20d)
|
||||
private String unionName;
|
||||
@Excel(name = "工号", width = 20d)
|
||||
private String loginName;
|
||||
@Excel(name = "姓名", width = 20d)
|
||||
private String userName;
|
||||
@Excel(name = "性别", width = 20d)
|
||||
private String sex;
|
||||
@Excel(name = "项目编号", width = 20d)
|
||||
private String projectCode;
|
||||
@Excel(name = "身份", width = 20d)
|
||||
private String identity;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-01 14:29
|
||||
* @description: 活动计划
|
||||
**/
|
||||
|
||||
@Data
|
||||
@Table("activity_plan")
|
||||
public class ActivityPlan {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("计划名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("计划时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String time;
|
||||
|
||||
@Column
|
||||
@Comment("项目数组")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String event;
|
||||
|
||||
@Column
|
||||
@Comment("项目id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String eventId;
|
||||
|
||||
@Column
|
||||
@Comment("计划内容")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String content;
|
||||
|
||||
@Column
|
||||
@Comment("预算费用")
|
||||
|
||||
@ColDefine(type = ColType.FLOAT)
|
||||
private Double money;
|
||||
|
||||
@Column
|
||||
@Comment("计划类型(1-校活动、2-分工会活动、3社团社团活动)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 7)
|
||||
private String type;
|
||||
|
||||
@Column
|
||||
@Comment("分工会ID或社团ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String tissueId;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityType;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/5/19 14:43
|
||||
* @description 运动会成绩
|
||||
*/
|
||||
@Data
|
||||
@Table("activity_results")
|
||||
public class ActivityResults implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 单项活动使用
|
||||
*/
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("用户男女")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@Comment("对应的活动")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("对应的项目")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String eventId;
|
||||
|
||||
@Column
|
||||
@Comment("名次")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer ranking;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("人数")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String numberOfPeople;
|
||||
|
||||
@Column
|
||||
@Comment("积分")
|
||||
@ColDefine(type = ColType.FLOAT, width = 5)
|
||||
private double integral;
|
||||
|
||||
@Column
|
||||
@Comment("个人1团队2")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer isTeamPersonal;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-02-22 11:31
|
||||
* @description: 校级活动
|
||||
*/
|
||||
@Data
|
||||
@Table("activity_school")
|
||||
public class ActivitySchool extends BaseModel implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("关联计划")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String planId;
|
||||
|
||||
@Column
|
||||
@Comment("活动名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("活动地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String address;
|
||||
|
||||
@Column
|
||||
@Comment("关联活动类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String typeId;
|
||||
|
||||
@Column
|
||||
@Comment("活动编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String activityCode;
|
||||
|
||||
@Column
|
||||
@Comment("报名开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyStartTime;
|
||||
|
||||
@Column
|
||||
@Comment("报名结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyEndTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String startTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String endTime;
|
||||
|
||||
@Column
|
||||
@Comment("关联主办单位")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> unitSponsor;
|
||||
|
||||
@Column
|
||||
@Comment("关联承办单位")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> undertakeUnit;
|
||||
|
||||
@Column
|
||||
@Comment("关联协办单位")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> unitJointly;
|
||||
|
||||
@Column
|
||||
@Comment("活动项目")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> eventsIds;
|
||||
|
||||
@Column
|
||||
@Comment("活动方式(1:竞赛 2:非竞赛)")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer gameStyle;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型(2:综合类活动 1:单一活动)")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer applyType;
|
||||
|
||||
@Column
|
||||
@Comment("可报名范围组别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private Integer activityGroupId;
|
||||
|
||||
@Column
|
||||
@Comment("经费预算")
|
||||
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||
private Double funding;
|
||||
|
||||
@Column
|
||||
@Comment("报名方式(1:个人 2:分工会 3:小程序)")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Integer> applyWay;
|
||||
|
||||
@Column
|
||||
@Comment("报名人员类型(1:会员 2:普通教职工)")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer personType;
|
||||
|
||||
@Column
|
||||
@Comment("运动员资格(竞赛)")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String athleteQualification;
|
||||
|
||||
@Column
|
||||
@Comment("报名方法(竞赛)")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String registrationMethod;
|
||||
|
||||
@Column
|
||||
@Comment("竞赛方法(竞赛)")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String competitionMethod;
|
||||
|
||||
@Column
|
||||
@Comment("奖励方法(竞赛)")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String rewardMethod;
|
||||
|
||||
@Column
|
||||
@Comment("注意事项(竞赛)")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String precautions;
|
||||
|
||||
@Column
|
||||
@Comment("活动通知(非竞赛)")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String eventNotification;
|
||||
|
||||
@Column
|
||||
@Comment("是否关闭")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean close;
|
||||
|
||||
@Column
|
||||
@Comment("活动级别(40001-校级、40002-分工会、40003-社团或社团)")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer activityLevel;
|
||||
|
||||
@Column
|
||||
@Comment("是否保存")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Integer isSave;
|
||||
|
||||
@Column
|
||||
@Comment("小程序活动封面")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Sys_file> image;
|
||||
|
||||
@Many(field = "activityId")
|
||||
private List<ActivitySchoolEvent> schoolEvents;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("活动所属工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String belongUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("活动所属社团")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String belongClubId;
|
||||
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String foundDate;
|
||||
|
||||
@Column
|
||||
@Comment("是否发送系统消息")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean xlFlag;
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-02-22 11:31
|
||||
* @description: 校活动报名
|
||||
*/
|
||||
@Data
|
||||
@Table("activity_school_apply")
|
||||
@TableIndexes({
|
||||
@Index(name = "ASA_ACTIVITY", fields = {"activityId"}, unique = false),
|
||||
@Index(name = "ASA_UNIT", fields = {"unitId"}, unique = false),
|
||||
@Index(name = "ASA_UNION", fields = {"unionId"}, unique = false),
|
||||
@Index(name = "ASA_USER", fields = {"userId"}, unique = false),
|
||||
@Index(name = "ASA_APPLYUSER", fields = {"userId"}, unique = false),
|
||||
})
|
||||
public class ActivitySchoolApply implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("对应的活动")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@Comment("对应的项目")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String eventId;
|
||||
|
||||
@Column
|
||||
@Comment("对应的是单项还是团体(1是个人2是团体)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String awardsMode;
|
||||
|
||||
@Column
|
||||
@Comment("所属队")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String teamId;
|
||||
|
||||
@Column
|
||||
@Comment("所属单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("所属工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("所属活动工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("所属活动工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityUnionName;
|
||||
|
||||
@Column
|
||||
@Comment("报名人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String applyUser;
|
||||
|
||||
@Column
|
||||
@Comment("参加人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("出生年月")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String birthday;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("报名时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String applyDate;
|
||||
|
||||
@Column
|
||||
@Comment("身份(1 运动员 2 教练 3 领队4 处级领导5 替补6 团长7工作人员)")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> identity;
|
||||
|
||||
@Column
|
||||
@Comment("是否处级领导")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean divisionLevelLeadership;
|
||||
|
||||
@Column
|
||||
@Comment("是否兼运动员")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isAthlete;
|
||||
|
||||
@Column
|
||||
@Comment("是否为工会总领队")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean unionLeader;
|
||||
|
||||
@Column
|
||||
@Comment("是否为工会总教练")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean unionCoach;
|
||||
|
||||
@Column
|
||||
@Comment("是否为工会团长")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean unionHead;
|
||||
|
||||
@Column
|
||||
@Comment("是否为工会工作人员")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean unionStaff;
|
||||
|
||||
@Column
|
||||
@Comment("状态(0 保存 1 待审核 2 报名成功 3 审核不通过)")
|
||||
private Integer status;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String unitname;
|
||||
|
||||
|
||||
@Excel(name = "分工会", width = 30)
|
||||
private String unionname;
|
||||
|
||||
private String unioncode;
|
||||
|
||||
@Column
|
||||
@Comment("小队名称")
|
||||
// @Excel(name = "小队名称", width = 20)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String team;
|
||||
|
||||
// @Excel(name = "项目名称", width = 40)
|
||||
private String allName;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@Excel(name = "工号", width = 20)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String loginname;
|
||||
|
||||
@Column
|
||||
@Comment("姓名")
|
||||
@Excel(name = "姓名", width = 20)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String username;
|
||||
@Column
|
||||
@Comment("电话")
|
||||
@Excel(name = "手机号码", width = 20)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String mobile;
|
||||
|
||||
|
||||
@Excel(name = "身份证号", width = 20)
|
||||
private String idCard;
|
||||
|
||||
@Column
|
||||
@Comment("性别")
|
||||
@Excel(name = "性别", width = 20)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String sex;
|
||||
|
||||
@Excel(name = "在职状态", width = 20)
|
||||
private String userState;
|
||||
|
||||
// @Excel(name = "身份", width = 40)
|
||||
private String sf;
|
||||
private int age;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Excel(name = "备注", width = 20)
|
||||
private String notes;
|
||||
|
||||
@Column
|
||||
@Comment("参加校区")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String campus;
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-04-06 10:05
|
||||
* @description: 校级活动活动项目关联表
|
||||
**/
|
||||
|
||||
@Data
|
||||
@Table("Activity_school_event")
|
||||
public class ActivitySchoolEvent {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("活动ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@Comment("项目ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String eventId;
|
||||
|
||||
@Column
|
||||
@Comment("比赛模式(1:单项 2:团队)")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private Integer awardsMode;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式(1:单项报名人数 2:团体报名人数)")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Integer> combinationMethod;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式1:最多人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer restrictTotalPeople;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式1:报名方式(1-单人、2-双人)")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer registrationWays;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:最少人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer restrictMinNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:最多人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer restrictMaxNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:最大队数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer restrictTotalTeam;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:运动员最多人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer athletesMaxNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:运动员最少人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer athletesMinNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:领队人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer leanderNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:教练人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer coachNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:女队人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer restrictGirlNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:男队人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer restrictBoyNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:副处长(级)以上至少人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer deputyDirectorNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:替补人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer substituteNum;
|
||||
|
||||
@Column
|
||||
@Comment("每人限报项目数")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer restrictRegNumber;
|
||||
|
||||
@Column
|
||||
@Comment("开始年龄")
|
||||
@ColDefine(type = ColType.VARCHAR,width = 10)
|
||||
private String startAgeDate;
|
||||
|
||||
@Column
|
||||
@Comment("截至年龄")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String endAgeDate;
|
||||
|
||||
@Column
|
||||
@Comment("是否只报领队")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean isLeader;
|
||||
|
||||
@Column
|
||||
@Comment("每对运动员男女不做限制")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean isManGirlNum;
|
||||
|
||||
@One(field = "activityId", key = "id")
|
||||
private ActivitySchool activitySchool;
|
||||
|
||||
@Column
|
||||
@Comment("分工会人数限制")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> unionLimit;
|
||||
|
||||
@Column
|
||||
@Comment("报名人数限制模式")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer applyUserModel;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-02-22 11:31
|
||||
* @description: 校活动 队
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Table("activity_school_team")
|
||||
@TableIndexes({
|
||||
@Index(name = "AST_ACTIVITY", fields = {"activityId"}, unique = false),
|
||||
})
|
||||
public class ActivitySchoolTeam implements Serializable {
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("对应的活动")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@Comment("项目ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String eventId;
|
||||
|
||||
@Column
|
||||
@Comment("队名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("最少人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer minNum;
|
||||
|
||||
@Column
|
||||
@Comment("最多人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer maxNum;
|
||||
|
||||
@Column
|
||||
@Comment("排序")
|
||||
@Prev({
|
||||
@SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM Activity_School_Team"),
|
||||
@SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM Activity_School_Team")
|
||||
})
|
||||
private Integer location;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-12-13 09:31
|
||||
* @description: 活动场地信息
|
||||
**/
|
||||
|
||||
@Data
|
||||
@Table("activity_site_info")
|
||||
public class ActivitySiteInfo {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("场地名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("场地地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String address;
|
||||
|
||||
@Column
|
||||
@Comment("联系人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String contact_person;
|
||||
|
||||
@Column
|
||||
@Comment("联系电话")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String contact_phone;
|
||||
|
||||
@Column
|
||||
@Comment("开启状态")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean state;
|
||||
|
||||
@Column
|
||||
@Comment("开放时段")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List open_hours;
|
||||
|
||||
@Column
|
||||
@Comment("创建人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String create_username;
|
||||
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String create_time;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer typeId;
|
||||
|
||||
@Column
|
||||
@Comment("是否多次预约")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean multiple;
|
||||
|
||||
@Column
|
||||
@Comment("限定工作日预约")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean workday;
|
||||
|
||||
@Column
|
||||
@Comment("限制男女,0表示不限制,1表示限制男,2表示限制女")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer sexLimit;
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-12-13 14:19
|
||||
* @description: 活动场地预约信息
|
||||
**/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table("activity_site_reserve")
|
||||
public class ActivitySiteReserve extends BaseModel {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("场地id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String site_id;
|
||||
|
||||
@Column
|
||||
@Comment("预约人ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String reserve_person_id;
|
||||
|
||||
@Column
|
||||
@Comment("预约人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String reserve_person_username;
|
||||
|
||||
@Column
|
||||
@Comment("预约人性别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String reserve_person_sex;
|
||||
|
||||
@Column
|
||||
@Comment("预约人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String reserve_person_loginname;
|
||||
|
||||
@Column
|
||||
@Comment("预约人联系方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String reserve_person_phone;
|
||||
|
||||
@Column
|
||||
@Comment("预约人部门")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String reserve_person_unitname;
|
||||
|
||||
@Column
|
||||
@Comment("预约人工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String reserve_person_unionname;
|
||||
|
||||
@Column
|
||||
@Comment("预约人工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String reserve_person_unionid;
|
||||
|
||||
@Column
|
||||
@Comment("预约开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date reserve_start_time;
|
||||
|
||||
@Column
|
||||
@Comment("预约结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date reserve_end_time;
|
||||
|
||||
@Column
|
||||
@Comment("预约活动项目")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String reserve_activity;
|
||||
|
||||
@Column
|
||||
@Comment("参加人数")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String reserve_join_user_num;
|
||||
|
||||
@Column
|
||||
@Comment("预约事由")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String reserve_cause;
|
||||
|
||||
@Column
|
||||
@Comment("场地需求")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String reserve_demand;
|
||||
|
||||
@Column
|
||||
@Comment("预约状态id")
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
private Integer reserve_state;
|
||||
|
||||
@Column
|
||||
@Comment("场地管理员id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String site_manager_id;
|
||||
|
||||
@Column
|
||||
@Comment("分工会审核id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String reserve_person_union_process;
|
||||
|
||||
@Column
|
||||
@Comment("校工会审核id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String reserve_person_school_process;
|
||||
|
||||
@Column
|
||||
@Comment("审核记录")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private List<NutMap> auditList;
|
||||
|
||||
@Column
|
||||
@Comment("反馈意见")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String back_option;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import io.v.nutz.common.models.Goods;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-09 13:57
|
||||
* @description: 社团或分工会活动校工会活动
|
||||
**/
|
||||
|
||||
@Data
|
||||
@Table("activity_tissue")
|
||||
public class ActivityTissue {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("创建人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("联系方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("举办单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String helpUnitIds;
|
||||
|
||||
@Column
|
||||
@Comment("协办单位")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> unitId;
|
||||
|
||||
@Column
|
||||
@Comment("活动名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("活动编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String activityCode;
|
||||
|
||||
@Column
|
||||
@Comment("活动项目类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String projectTypeCode;
|
||||
|
||||
@Column
|
||||
@Comment("活动计划开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String startPlannedDate;
|
||||
|
||||
@Column
|
||||
@Comment("活动计划结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String endPlannedDate;
|
||||
|
||||
@Column
|
||||
@Comment("报名开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyStartTime;
|
||||
|
||||
@Column
|
||||
@Comment("报名结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyEndTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String startTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String endTime;
|
||||
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动人数")
|
||||
@ColDefine(type = ColType.INT, width = 6)
|
||||
private Integer peopleNum;
|
||||
|
||||
@Column
|
||||
@Comment("活动地点")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String address;
|
||||
|
||||
@Column
|
||||
@Comment("发票")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Sys_file> billFiles;
|
||||
|
||||
@Column
|
||||
@Comment("照片")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Sys_file> photoFiles;
|
||||
|
||||
@Column
|
||||
@Comment("其他")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Sys_file> otherFiles;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer type;
|
||||
|
||||
@Column
|
||||
@Comment("创建人所属工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("创建人所属社团")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String clubId;
|
||||
|
||||
@Column
|
||||
@Comment("活动内容")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String activityContent;
|
||||
|
||||
@Column
|
||||
@Comment("活动考核内容")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String activityExamineContent;
|
||||
|
||||
@Column
|
||||
@Comment("报名方式(1.个人 2.分工会 null.不需要报名)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer signUpMethod;
|
||||
|
||||
@Column
|
||||
@Comment("限制方式(1.总人数限制 2.分工会人数限制 null.不限制)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer userNumberLimit;
|
||||
|
||||
@Column
|
||||
@Comment("是否需要签到")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean needSign;
|
||||
|
||||
@Column
|
||||
@Comment("签到经纬度")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> location;
|
||||
|
||||
@Column
|
||||
@Comment("签到范围")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer rangeMeter;
|
||||
|
||||
@Column
|
||||
@Comment("总人数限制")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer totalUserNumberLimit;
|
||||
|
||||
@Column
|
||||
@Comment("组队人数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer teamNum;
|
||||
|
||||
@Column
|
||||
@Comment("分工会人数限制")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> unionUserNumberLimit;
|
||||
|
||||
@Column
|
||||
@Comment("活动总结")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String activitySummary;
|
||||
|
||||
@Column
|
||||
@Comment("活动分组id")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer groupId;
|
||||
|
||||
@Column
|
||||
@Comment("封面图")
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
private String cover;
|
||||
@Column
|
||||
@Comment("审核状态")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer state;
|
||||
@Column
|
||||
@Comment("审核id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String auditId;
|
||||
@Column
|
||||
@Comment("是否报名系统")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean isEnrollSystem;
|
||||
|
||||
@Many(field = "tissueId")
|
||||
private List<ActivityTissuePerson> tissuePersonList;
|
||||
|
||||
@Many(field = "reid")
|
||||
private List<Goods> goods;
|
||||
|
||||
@Column
|
||||
@Comment("是否发送系统消息")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean xlFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-09 14:02
|
||||
* @description: 活动人员列表
|
||||
**/
|
||||
|
||||
@Data
|
||||
@Table("activity_tissue_person")
|
||||
public class ActivityTissuePerson {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("分工会或社团活动ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String tissueId;
|
||||
|
||||
@Column
|
||||
@Comment("用户ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("报名人ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String applyUserId;
|
||||
|
||||
@Column
|
||||
@Comment("报名人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String applyUserUserName;
|
||||
|
||||
@Column
|
||||
@Comment("签字ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String signId;
|
||||
|
||||
@Column
|
||||
@Comment("用户姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("用户工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("用户性别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 2)
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@Comment("用户手机号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("用户单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("用户工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("是否签到")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean isSign;
|
||||
|
||||
@Column
|
||||
@Comment("签到时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String signTime;
|
||||
|
||||
@Column
|
||||
@Comment("报名时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String applyDateTime;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String notes;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import io.v.nutz.modules.models.AuditState;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ActivityType {
|
||||
|
||||
@Id
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer id;
|
||||
|
||||
@Column
|
||||
@Comment("名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String meetingTypeName;
|
||||
|
||||
@Column
|
||||
@Comment("模块名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String moduleName;
|
||||
|
||||
@Column
|
||||
@Comment("排序")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private int sortNum;
|
||||
|
||||
@Many(field = "meetingTypeId")
|
||||
private List<AuditState> auditStateList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/7/29 14:12
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
public class ActivityUnion {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true, nullEffective = true)
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String unionname;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("活动id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.v.nutz.data.constant.ConditionalOperational;
|
||||
import io.v.nutz.data.constant.MatchMethod;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.util.cri.SqlExpression;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class ActivityUserCnd {
|
||||
|
||||
private MatchMethod matchMethod;
|
||||
|
||||
private List<Rule> rules;
|
||||
|
||||
/**
|
||||
* sql格式
|
||||
*
|
||||
* @param userTablePrefix 用户表前缀
|
||||
* @param activityUserCndStr 活动用户cnd str
|
||||
* @param reverseSelection 逆向选择
|
||||
* @return {@link SqlExpressionGroup}
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public static SqlExpressionGroup formatSql(String userTablePrefix, String activityUserCndStr, boolean reverseSelection) throws Exception {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
if (StrUtil.isBlank(activityUserCndStr)) {
|
||||
return seg;
|
||||
}
|
||||
|
||||
String prefix = StrUtil.blankToDefault(userTablePrefix, "user");
|
||||
|
||||
ActivityUserCnd activityUserCnd = Json.fromJson(ActivityUserCnd.class, activityUserCndStr);
|
||||
if (activityUserCnd.getMatchMethod() != null && Lang.isNotEmpty(activityUserCnd.getRules())) {
|
||||
List<Rule> filterRules = activityUserCnd.getRules().stream().filter(v -> StrUtil.isAllNotBlank(v.getName(), v.getCnd())).collect(Collectors.toList());
|
||||
|
||||
ConditionalOperational[] conditionalOperationals = ConditionalOperational.values();
|
||||
Map<String, ConditionalOperational> conditionalOperationalMap = Arrays.stream(conditionalOperationals).collect(Collectors.toMap(v -> v.getValue(), v -> v));
|
||||
|
||||
for (Rule rule : filterRules) {
|
||||
ConditionalOperational conditionalOperational = conditionalOperationalMap.get(rule.getCnd());
|
||||
conditionalOperational.exec(seg, prefix + "." + rule.getName(), rule.getValue(), activityUserCnd.getMatchMethod());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (reverseSelection) {
|
||||
List<SqlExpression> exps = seg.getExps();
|
||||
for (SqlExpression exp : exps) {
|
||||
exp.setNot(true);
|
||||
}
|
||||
}
|
||||
|
||||
return seg;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Rule {
|
||||
private String name;
|
||||
private String cnd;
|
||||
private String value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 活动人员范围设置
|
||||
* @createTime 2022年01月04日 11:36:00
|
||||
*/
|
||||
|
||||
@Table
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class ActivityUserScope extends BaseModel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -5794884307112120554L;
|
||||
|
||||
@Id
|
||||
@Comment("id")
|
||||
private Integer id;
|
||||
|
||||
@Column
|
||||
@ColDefine
|
||||
@Comment("groupId")
|
||||
private Integer groupId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
@Comment("name")
|
||||
private String groupName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("userid")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("创建人")
|
||||
private String creator;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/6/29
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
@Table("activity_summary")
|
||||
public class ActivityYearSummary {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("提交人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("提交时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String ctime;
|
||||
|
||||
@Column
|
||||
@Comment("工会/社团id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String tissueId;
|
||||
|
||||
@Column
|
||||
@Comment("总结类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String summaryType;
|
||||
|
||||
@Column
|
||||
@Comment("总结来源(1-校活动、2-分工会活动、3社团社团活动)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String summaryFrom;
|
||||
|
||||
@Column
|
||||
@Comment("文件")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> files;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/4/10 15:26
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@Table("school_assign_grades")
|
||||
public class SchoolAssignGrades {
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("对应的活动")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@Comment("单项活动才有userid")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("对应的项目")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String eventId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("所属单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("荣誉奖项")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String mc;
|
||||
|
||||
@Column
|
||||
@Comment("奖品名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String jpmc;
|
||||
|
||||
@Column
|
||||
@Comment("金额")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String money;
|
||||
|
||||
@Column
|
||||
@Comment("奖品类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String jplx;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package io.v.nutz.activity.services;
|
||||
|
||||
import io.v.nutz.activity.models.ActivityUserScope;
|
||||
import io.v.nutz.service.ViService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年01月06日 09:02:00
|
||||
*/
|
||||
public interface ActivityBasicScopeService extends ViService<ActivityUserScope> {
|
||||
|
||||
Sql createSql(Cnd cnd);
|
||||
|
||||
/**
|
||||
* 大量数据插入
|
||||
*/
|
||||
void largeDataInsert(List<ActivityUserScope> list) ;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package io.v.nutz.activity.services;
|
||||
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会议通用方法
|
||||
*/
|
||||
@IocBean
|
||||
public interface ActivityCommonService {
|
||||
|
||||
/**
|
||||
* 根据typeId查询所属模块名称
|
||||
*
|
||||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
String findModuleNameByTypeId(Integer typeId);
|
||||
|
||||
/**
|
||||
* 根据MeetId查询所属模块名称
|
||||
*
|
||||
* @param meetingId
|
||||
* @return
|
||||
*/
|
||||
String findModuleNameByActivityId(String meetingId);
|
||||
|
||||
/**
|
||||
* 根据模块名称查找对应stateCode 最开始的那个
|
||||
*
|
||||
* @param moduleName
|
||||
* @return
|
||||
*/
|
||||
Integer findStartStateCodeByModuleName(String moduleName);
|
||||
|
||||
Integer findAfterStateCode(Integer stateCode, boolean isPass);
|
||||
|
||||
Integer findAfterStateCodeByModuleName(Integer stateCode, String moduleName);
|
||||
|
||||
/**
|
||||
* 根据会议id查询请假成功的code
|
||||
*
|
||||
* @param meetingId
|
||||
* @return
|
||||
*/
|
||||
Integer findSuccessStateCode(String meetingId);
|
||||
|
||||
/**
|
||||
* 获取当前用户关联哪些会议
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Object find();
|
||||
|
||||
/**
|
||||
* 查询当前登录用户能审核的状态Id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Integer> findStateIdForMeCanAudit();
|
||||
|
||||
List<NutMap> getNextAuditUser(Integer stateCode, String moduleName);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package io.v.nutz.activity.services;
|
||||
|
||||
import io.v.nutz.activity.models.ActivityPlan;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-09 10:27
|
||||
* @description:
|
||||
**/
|
||||
public interface ActivityPlanService extends ViService<ActivityPlan> {
|
||||
|
||||
/**
|
||||
* 首页数据
|
||||
*
|
||||
* @param page
|
||||
* @param year
|
||||
* @param name
|
||||
* @param tissueId
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Object pageData(PageForm page, String year, String name, String tissueId, CndPlus cnd);
|
||||
|
||||
|
||||
/**
|
||||
* 根据id查询单个
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Object findOne(String id);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.v.nutz.activity.services;
|
||||
|
||||
import io.v.nutz.activity.models.ActivitySchoolApply;
|
||||
import io.v.nutz.service.ViService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Aaron
|
||||
*/
|
||||
public interface ActivitySchoolApplyService extends ViService<ActivitySchoolApply> {
|
||||
|
||||
void doApplies(List<ActivitySchoolApply> applies);
|
||||
|
||||
void doApplies(String activity, String union_id, String eventId,List<ActivitySchoolApply> applies);
|
||||
|
||||
void doApply(ActivitySchoolApply apply);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.v.nutz.activity.services;
|
||||
|
||||
|
||||
import io.v.nutz.activity.models.ActivitySchool;
|
||||
import io.v.nutz.activity.models.ActivitySchoolEvent;
|
||||
import io.v.nutz.service.ViService;
|
||||
|
||||
/**
|
||||
* @author Aaron
|
||||
*/
|
||||
public interface ActivitySchoolService extends ViService<ActivitySchool> {
|
||||
|
||||
String doAdd(ActivitySchool activitySchool, ActivitySchoolEvent[] events);
|
||||
|
||||
void doEdit(ActivitySchool activitySchool, ActivitySchoolEvent[] events, String applyEndTime);
|
||||
|
||||
void doDelete(String id);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package io.v.nutz.activity.services;
|
||||
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.activity.models.ActivitySchoolTeam;
|
||||
|
||||
/**
|
||||
* @author Aaron
|
||||
*/
|
||||
public interface ActivitySchoolTeamService extends BaseService<ActivitySchoolTeam> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package io.v.nutz.activity.services;
|
||||
|
||||
import io.v.nutz.activity.models.ActivityTissue;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-09 10:27
|
||||
* @description:
|
||||
**/
|
||||
public interface ActivityTissueService extends ViService<ActivityTissue> {
|
||||
|
||||
|
||||
/**
|
||||
* 首页数据
|
||||
*
|
||||
* @param page
|
||||
* @param year
|
||||
* @param name
|
||||
* @param unionId
|
||||
* @return
|
||||
*/
|
||||
Object pageData(PageForm page, String year, String name, String unionId,Integer type);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void doDelete(String id);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param tissue
|
||||
*/
|
||||
void doEdit(ActivityTissue tissue);
|
||||
|
||||
/**
|
||||
* 根据id查询单个
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Object findOne(String id);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package io.v.nutz.activity.services;
|
||||
|
||||
import io.v.nutz.activity.models.ActivityType;
|
||||
import io.v.nutz.service.ViService;
|
||||
|
||||
/**
|
||||
* 会议类型 流程 service
|
||||
*/
|
||||
public interface ActivityTypeService extends ViService<ActivityType> {
|
||||
|
||||
/**
|
||||
* 找出最大的那行stateId
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int findMaxStateId();
|
||||
|
||||
void add(ActivityType activityType);
|
||||
|
||||
void edit(ActivityType activityType);
|
||||
|
||||
void delete(ActivityType activityType);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package io.v.nutz.activity.services;
|
||||
|
||||
import io.v.nutz.activity.models.ActivityYearSummary;
|
||||
import io.v.nutz.service.ViService;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/6/29
|
||||
* @Description
|
||||
*/
|
||||
public interface ActivityYearSummaryService extends ViService<ActivityYearSummary> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package io.v.nutz.activity.services;
|
||||
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.activity.models.ActivitySiteInfo;
|
||||
|
||||
public interface SiteInfoService extends BaseService<ActivitySiteInfo> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package io.v.nutz.activity.services;
|
||||
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.activity.models.ActivitySiteReserve;
|
||||
|
||||
public interface SiteReserveService extends BaseService<ActivitySiteReserve> {
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package io.v.nutz.activity.services.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import io.v.nutz.activity.models.ActivityUserScope;
|
||||
import io.v.nutz.activity.services.ActivityBasicScopeService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.impl.NutTxDao;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年01月06日 09:03:00
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@Slf4j
|
||||
public class ActivityBasicScopeServiceImpl extends ViServiceImpl<ActivityUserScope> implements ActivityBasicScopeService {
|
||||
public ActivityBasicScopeServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Sql createSql(Cnd cnd) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 大量数据插入
|
||||
* 注:Future.get()可以同步等待线程执行完成,并且可以监听执行结果
|
||||
* 你也可以用countDownLatch
|
||||
*/
|
||||
@Override
|
||||
public void largeDataInsert(List<ActivityUserScope> list) {
|
||||
log.info("开始时间" + DateUtil.getDateTime());
|
||||
List<List<ActivityUserScope>> splitList = CollectionUtil.split(list, 500);
|
||||
NutTxDao nutTxDao = new NutTxDao(dao()).setDebug(true);
|
||||
nutTxDao.beginRC();
|
||||
ExecutorService executorService = Executors.newWorkStealingPool();
|
||||
|
||||
List<Callable<Object>> taskList = new ArrayList<>();
|
||||
|
||||
for (List<ActivityUserScope> everyList : splitList) {
|
||||
taskList.add(() -> nutTxDao.insert(everyList).size());
|
||||
}
|
||||
|
||||
List<Future<Object>> futureList = null;
|
||||
|
||||
AtomicInteger atomicInteger = new AtomicInteger();
|
||||
|
||||
try {
|
||||
futureList = executorService.invokeAll(taskList);
|
||||
for (Future<Object> future : futureList) {
|
||||
atomicInteger.getAndAdd((Integer) future.get());
|
||||
}
|
||||
if (atomicInteger.get() != list.size()) {
|
||||
throw new RuntimeException("插入数据与期望数据条数不符");
|
||||
}
|
||||
nutTxDao.commit();
|
||||
} catch (Exception e) {
|
||||
nutTxDao.rollback();
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
executorService.shutdown();
|
||||
}
|
||||
log.info("结束时间" + DateUtil.getDateTime());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package io.v.nutz.activity.services.impl;
|
||||
|
||||
import io.v.nutz.activity.models.ActivitySiteInfo;
|
||||
import io.v.nutz.activity.models.ActivityType;
|
||||
import io.v.nutz.activity.services.ActivityCommonService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.constant.AuditTypeEnum;
|
||||
import io.v.nutz.modules.models.AuditState;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ActivityCommonServiceImpl extends ViServiceImpl implements ActivityCommonService {
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
public ActivityCommonServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findModuleNameByTypeId(Integer typeId) {
|
||||
ActivityType activityType = dao().fetch(ActivityType.class, Cnd.where("id", "=", typeId));
|
||||
if (Lang.isNotEmpty(activityType)) {
|
||||
return activityType.getModuleName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findModuleNameByActivityId(String activityId) {
|
||||
ActivitySiteInfo activitySiteInfo = dao().fetch(ActivitySiteInfo.class, activityId);
|
||||
if (Lang.isNotEmpty(activitySiteInfo) && null != activitySiteInfo.getTypeId()) {
|
||||
return findModuleNameByTypeId(activitySiteInfo.getTypeId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer findStartStateCodeByModuleName(String moduleName) {
|
||||
List<AuditState> auditStateList = dao().query(AuditState.class, Cnd.where("module", "=", moduleName).asc("stateId"));
|
||||
Optional<Integer> minOptional = auditStateList.stream().map(v -> v.getStateId()).min(Comparator.comparingInt(a -> a)).stream().findFirst();
|
||||
return minOptional.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer findAfterStateCode(Integer stateCode, boolean isPass) {
|
||||
AuditState auditState = dao().fetch(AuditState.class, stateCode);
|
||||
return isPass ? auditState.getAfterPassStateId() : auditState.getAfterRejectStateId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer findSuccessStateCode(String meetingId) {
|
||||
String moduleName = findModuleNameByActivityId(meetingId);
|
||||
Cnd cnd = Cnd.where("module", "=", moduleName).and("stateAuditType", "=", AuditTypeEnum.PROCESS_PASS.getValue());
|
||||
AuditState auditState = dao().fetch(AuditState.class, cnd);
|
||||
return auditState.getStateId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer findAfterStateCodeByModuleName(Integer stateCode, String moduleName) {
|
||||
AuditState auditState = dao().fetch(AuditState.class, Cnd.where("stateId", "=", stateCode));
|
||||
if (Lang.isNotEmpty(auditState)) {
|
||||
return auditState.getAfterStateId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object find() {
|
||||
List<ActivityType> typeList = dao().query(ActivityType.class, null);
|
||||
List<String> typeModuleNameList = typeList.stream().map(ActivityType::getModuleName).collect(Collectors.toList());
|
||||
|
||||
List<AuditState> auditStateList = dao().query(AuditState.class, Cnd.where("module", "in", typeModuleNameList));
|
||||
|
||||
for (AuditState state : auditStateList) {
|
||||
dao().fetchLinks(state, "auditStateUserList");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> findStateIdForMeCanAudit() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("stateId", "in", Sqls.create("select stateId from audit_state_user where userId = @userid").setParam("userid", ShiroUtil.getPrincipalProperty("id")));
|
||||
List<AuditState> auditStateList = dao().query(AuditState.class, cnd);
|
||||
return auditStateList.stream().map(v -> v.getStateId()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/*根据状态码获取下一节点审核人*/
|
||||
@Override
|
||||
public List<NutMap> getNextAuditUser(Integer stateCode, String moduleName) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
au.userId as userId,
|
||||
u.username as userName,
|
||||
u.loginname as loginName,
|
||||
u.unitname as unitName,
|
||||
u.mobile as mobile
|
||||
from
|
||||
audit_state_user au
|
||||
left join
|
||||
`user` u on au.userid = u.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and("stateId", "=", stateCode);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return listMap(sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package io.v.nutz.activity.services.impl;
|
||||
|
||||
import io.v.nutz.activity.models.ActivityPlan;
|
||||
import io.v.nutz.activity.services.ActivityPlanService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-09 10:29
|
||||
* @description:
|
||||
**/
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ActivityPlanServiceImpl extends ViServiceImpl<ActivityPlan> implements ActivityPlanService {
|
||||
|
||||
public ActivityPlanServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Override
|
||||
public Object pageData(PageForm page, String year, String name, String tissueId, CndPlus cnd) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ap.*,
|
||||
ab.name as activityTypeName,
|
||||
year(ap.time) as `year`,
|
||||
(SELECT GROUP_CONCAT(ev.allName) from activity_event ev WHERE JSON_CONTAINS(ap.`event`, CONCAT('"',ev.id,'"'))) allName,
|
||||
((SELECT COUNT(1) FROM activity_school acs WHERE acs.planId = ap.id) >0 ) carryOut
|
||||
FROM
|
||||
activity_plan ap
|
||||
left join activity_basic_settings ab on ab.id = ap.activityType
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.andExcludeEmpty("YEAR(ap.time)", "=", year);
|
||||
cnd.andExcludeEmpty("ap.tissueId", "=", tissueId);
|
||||
|
||||
if (Strings.isNotBlank(name)) {
|
||||
cnd.where().andLike("ap.name", name);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H10,A06")) {
|
||||
if (ShiroUtil.hasAnyRoles("H04,ghzl")) {
|
||||
cnd.and("tissueId", "in", vi.getMangeUnionStr());
|
||||
} else if (ShiroUtil.hasRole("club01")) {
|
||||
cnd.and("tissueId", "in", vi.getMangeClubStr());
|
||||
}
|
||||
}
|
||||
|
||||
cnd.desc("ap.time");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return this.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object findOne(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ap.*,
|
||||
(SELECT GROUP_CONCAT(ev.allName) from activity_event ev WHERE JSON_CONTAINS(ap.`event`, CONCAT('"',ev.id,'"'))) allName
|
||||
FROM
|
||||
activity_plan ap
|
||||
WHERE
|
||||
ap.id = @id
|
||||
""").setParam("id", id);
|
||||
|
||||
return this.listMap(sql).get(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package io.v.nutz.activity.services.impl;
|
||||
|
||||
|
||||
import io.v.nutz.activity.models.ActivitySchoolApply;
|
||||
import io.v.nutz.activity.services.ActivitySchoolApplyService;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ActivitySchoolApplyServiceImpl extends ViServiceImpl<ActivitySchoolApply> implements ActivitySchoolApplyService {
|
||||
|
||||
public ActivitySchoolApplyServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doApplies(List<ActivitySchoolApply> applies) {
|
||||
/*for (ActivitySchoolApply apply : applies) {
|
||||
insert(apply);
|
||||
}*/
|
||||
dao().insert(applies);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doApplies(String activity, String union_id, String eventId,List<ActivitySchoolApply> applies) {
|
||||
clear(Cnd.where("activityId", "=", activity).and("unionId", "=", union_id).and("eventId","=",eventId));
|
||||
doApplies(applies);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doApply(ActivitySchoolApply apply) {
|
||||
insert(apply);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package io.v.nutz.activity.services.impl;
|
||||
|
||||
|
||||
import io.v.nutz.activity.models.*;
|
||||
import io.v.nutz.activity.services.ActivitySchoolApplyService;
|
||||
import io.v.nutz.activity.services.ActivitySchoolService;
|
||||
import io.v.nutz.activity.services.ActivitySchoolTeamService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-02-22 15:50
|
||||
* @description: 活动信息管理 service
|
||||
**/
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ActivitySchoolServiceImpl extends ViServiceImpl<ActivitySchool> implements ActivitySchoolService {
|
||||
|
||||
public ActivitySchoolServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolTeamService activitySchoolTeamService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolApplyService activitySchoolApplyService;
|
||||
|
||||
@Inject("ActivitySchoolEvent")
|
||||
private ViService<ActivitySchoolEvent> activitySchoolEventService;
|
||||
|
||||
@Inject("ActivitySchoolEvent")
|
||||
private ViService<ActivitySchoolEvent> activitySchoolEventViService;
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public String doAdd(ActivitySchool activitySchool, ActivitySchoolEvent[] events) {
|
||||
activitySchool.setClose(false);
|
||||
ActivitySchool school = insert(activitySchool);
|
||||
addTeam(school.getId(), events);
|
||||
return school.getId();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doEdit(ActivitySchool activitySchool, ActivitySchoolEvent[] events, String applyEndTime) {
|
||||
long time = DateUtil.formatDate(applyEndTime);
|
||||
long l = System.currentTimeMillis();
|
||||
|
||||
if (l < time) {
|
||||
/* activitySchoolApplyService.clear(Cnd.where("activityId", "=", activitySchool.getId()));
|
||||
activitySchoolEventService.clear(Cnd.where("activityId", "=", activitySchool.getId()));
|
||||
activitySchoolTeamService.clear(Cnd.where("activityId", "=", activitySchool.getId()));
|
||||
addTeam(activitySchool.getId(), events);*/
|
||||
}
|
||||
update(activitySchool);
|
||||
List<ActivitySchoolEvent> query = activitySchoolEventViService.query(Cnd.where("activityId", "=", activitySchool.getId()));
|
||||
|
||||
|
||||
List<ActivitySchoolEvent> collect = query.stream().filter(v -> {
|
||||
return !activitySchool.getEventsIds().contains(v.getEventId());
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
List<ActivitySchoolEvent> collect1 = Lang.array2list(events).stream().filter(v -> {
|
||||
return !query.stream().map(x -> x.getEventId()).collect(Collectors.toList()).contains(v.getEventId()) && (v.getId() == null || !v.getId().equals("allItems"));
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
if (collect.size() > 0) {
|
||||
collect.forEach(v -> {
|
||||
activitySchoolApplyService.clear(Cnd.where("activityId", "=", activitySchool.getId()).and("eventId", "=", v.getEventId()));
|
||||
activitySchoolEventService.clear(Cnd.where("activityId", "=", activitySchool.getId()).and("eventId", "=", v.getEventId()));
|
||||
activitySchoolTeamService.clear(Cnd.where("activityId", "=", activitySchool.getId()).and("eventId", "=", v.getEventId()));
|
||||
});
|
||||
}
|
||||
if (collect1.size() > 0) {
|
||||
addTeam(activitySchool.getId(), collect1.toArray(new ActivitySchoolEvent[collect1.size()]));
|
||||
}
|
||||
for (ActivitySchoolEvent event : events) {
|
||||
update(event);
|
||||
}
|
||||
|
||||
|
||||
/* activitySchoolTeamService.clear(Cnd.where("activityId", "=", activitySchool.getId()));
|
||||
addTeam(activitySchool.getId(), events);*/
|
||||
}
|
||||
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
private void addTeam(String schoolId, ActivitySchoolEvent[] events) {
|
||||
if (events.length > 0) {
|
||||
Arrays.stream(events).forEach(v -> {
|
||||
v.setActivityId(schoolId);
|
||||
activitySchoolEventService.insert(v);
|
||||
Integer totalTeam = v.getRestrictTotalTeam();
|
||||
if (totalTeam != null && totalTeam > 0) {
|
||||
for (int i = 1; i <= totalTeam; i++) {
|
||||
ActivitySchoolTeam team = new ActivitySchoolTeam();
|
||||
team.setActivityId(schoolId);
|
||||
team.setEventId(v.getEventId());
|
||||
team.setName(String.format("第%d队", i));
|
||||
team.setMinNum(v.getRestrictMinNum());
|
||||
team.setMaxNum(v.getRestrictMaxNum());
|
||||
activitySchoolTeamService.insert(team);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doDelete(String id) {
|
||||
activitySchoolApplyService.clear(Cnd.where("activityId", "=", id));
|
||||
activitySchoolEventService.clear(Cnd.where("activityId", "=", id));
|
||||
activitySchoolTeamService.clear(Cnd.where("activityId", "=", id));
|
||||
activitySchoolEventService.dao().clear(ActivityTissue.class, Cnd.where("id", "=", id));
|
||||
dao().clear(ActivityUnion.class, Cnd.where("activityId", "=", id));
|
||||
this.delete(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.v.nutz.activity.services.impl;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseServiceImpl;
|
||||
import io.v.nutz.activity.models.ActivitySchoolTeam;
|
||||
import io.v.nutz.activity.services.ActivitySchoolTeamService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ActivitySchoolTeamServiceImpl extends BaseServiceImpl<ActivitySchoolTeam> implements ActivitySchoolTeamService {
|
||||
|
||||
public ActivitySchoolTeamServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package io.v.nutz.activity.services.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.activity.models.ActivityTissue;
|
||||
import io.v.nutz.activity.models.ActivityTissuePerson;
|
||||
import io.v.nutz.activity.services.ActivityTissueService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.common.models.Goods;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.jf.model.ActivityBx;
|
||||
import io.v.nutz.modules.models.Audit;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-09 10:29
|
||||
* @description:
|
||||
**/
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ActivityTissueServiceImpl extends ViServiceImpl<ActivityTissue> implements ActivityTissueService {
|
||||
|
||||
public ActivityTissueServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject("ActivityTissuePerson")
|
||||
private ViService<ActivityTissuePerson> tissuePersonService;
|
||||
|
||||
@Override
|
||||
public Object pageData(PageForm page, String year, String name, String unionId, Integer type) {
|
||||
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tissue.*,
|
||||
uni.unionname ,
|
||||
club.`name` clubName,
|
||||
abs.`name` projectTypeName
|
||||
FROM
|
||||
activity_tissue tissue
|
||||
LEFT JOIN sys_union uni ON uni.id = tissue.unionId
|
||||
LEFT JOIN sys_club club ON club.id = tissue.clubId
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code`=tissue.projectTypeCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.andExcludeEmpty("YEAR(tissue.startTime)", "=", year);
|
||||
cnd.andExcludeEmpty("tissue.projectTypeCode", "!=", "50004");
|
||||
cnd.andExcludeEmpty("tissue.unionId", "=", unionId);
|
||||
cnd.andExcludeEmpty("tissue.type", "=", type);
|
||||
|
||||
if (Strings.isNotBlank(name)) {
|
||||
cnd.where().andLike("tissue.name", name);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H10,A06")) {
|
||||
if (ShiroUtil.hasAnyRoles("H04,ghzl")) {
|
||||
cnd.and("tissue.unionId", "in", vi.getMangeUnionStr());
|
||||
} else if (ShiroUtil.hasRole("club01")) {
|
||||
cnd.and("tissue.clubId", "in", vi.getMangeClubStr());
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(page.getPageOrderName()) && StrUtil.isNotBlank(page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
} else {
|
||||
cnd.desc("tissue.startTime");
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return this.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doDelete(String id) {
|
||||
this.delete(id);
|
||||
tissuePersonService.clear(Cnd.where("tissueId", "=", id));
|
||||
tissuePersonService.dao().clear(Goods.class, Cnd.where("reid", "=", id));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doEdit(ActivityTissue tissue) {
|
||||
tissuePersonService.clear(Cnd.where("tissueId", "=", tissue.getId()));
|
||||
tissuePersonService.dao().clear(Goods.class, Cnd.where("reid", "=", tissue.getId()));
|
||||
if (tissue.getSignUpMethod() == null) {
|
||||
tissue.setUserNumberLimit(null);
|
||||
tissue.setTotalUserNumberLimit(null);
|
||||
tissue.setUnionUserNumberLimit(null);
|
||||
}
|
||||
if (tissue.getUserNumberLimit() == null) {
|
||||
tissue.setTotalUserNumberLimit(null);
|
||||
tissue.setUnionUserNumberLimit(null);
|
||||
} else if (tissue.getUserNumberLimit() == 1) {
|
||||
tissue.setUnionUserNumberLimit(null);
|
||||
} else if (tissue.getUserNumberLimit() == 2) {
|
||||
tissue.setTotalUserNumberLimit(null);
|
||||
}
|
||||
this.update(tissue);
|
||||
List<ActivityTissuePerson> tissuePersonList = tissue.getTissuePersonList();
|
||||
tissuePersonList.forEach(v -> {
|
||||
v.setTissueId(tissue.getId());
|
||||
|
||||
});
|
||||
tissuePersonService.insert(tissuePersonList);
|
||||
tissue.getGoods().forEach(v -> {
|
||||
v.setActivityCode(tissue.getActivityCode());
|
||||
v.setReid(tissue.getId());
|
||||
});
|
||||
tissuePersonService.dao().insert(tissue.getGoods());
|
||||
|
||||
if (tissue.getBillFiles() != null) {
|
||||
tissuePersonService.dao().update(ActivityBx.class, Chain.make("billFiles", tissue.getBillFiles()),
|
||||
Cnd.where("activity_id", "=", tissue.getId()));
|
||||
}
|
||||
if (tissue.getOtherFiles() != null) {
|
||||
tissuePersonService.dao().update(ActivityBx.class, Chain.make("otherFiles", tissue.getOtherFiles()),
|
||||
Cnd.where("activity_id", "=", tissue.getId()));
|
||||
}
|
||||
if (tissue.getPhotoFiles() != null) {
|
||||
tissuePersonService.dao().update(ActivityBx.class, Chain.make("photoFiles", tissue.getPhotoFiles()),
|
||||
Cnd.where("activity_id", "=", tissue.getId()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object findOne(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tissue.*,
|
||||
uni.unionname,
|
||||
club.`name` clubName,
|
||||
u.username,
|
||||
u.loginname,
|
||||
abs.`name` projectTypeName
|
||||
FROM
|
||||
activity_tissue tissue
|
||||
LEFT JOIN sys_union uni ON uni.id = tissue.unionId
|
||||
LEFT JOIN sys_club club ON club.id = tissue.clubId
|
||||
LEFT JOIN `user` u ON u.id=tissue.userId
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code`=tissue.projectTypeCode
|
||||
WHERE
|
||||
tissue.id = @id
|
||||
""").setParam("id", id);
|
||||
|
||||
NutMap nutMap = this.fetch(sql);
|
||||
|
||||
List<ActivityTissuePerson> personList = tissuePersonService.query(Cnd.where("tissueId", "=", nutMap.getString("id")));
|
||||
List<Goods> goodsList = tissuePersonService.dao().query(Goods.class, Cnd.where("reid", "=", nutMap.getString("id")));
|
||||
nutMap.setv("tissuePersonList", personList);
|
||||
nutMap.setv("goods", goodsList);
|
||||
if (Strings.isNotBlank(nutMap.getString("auditId"))) {
|
||||
nutMap.setv("audit", tissuePersonService.dao().fetch(Audit.class, nutMap.getString("auditId")));
|
||||
}
|
||||
|
||||
return nutMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package io.v.nutz.activity.services.impl;
|
||||
|
||||
import io.v.nutz.activity.models.ActivityType;
|
||||
import io.v.nutz.activity.services.ActivityCommonService;
|
||||
import io.v.nutz.activity.services.ActivityTypeService;
|
||||
import io.v.nutz.modules.models.AuditState;
|
||||
import io.v.nutz.modules.models.AuditStateUser;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ActivityTypeServiceImpl extends ViServiceImpl<ActivityType> implements ActivityTypeService {
|
||||
|
||||
@Inject
|
||||
private ActivityCommonService activityCommonService;
|
||||
|
||||
public ActivityTypeServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int findMaxStateId() {
|
||||
return dao().func(AuditState.class, "max", "stateId");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据模块名称查找stateId
|
||||
*
|
||||
* @param moduleName
|
||||
* @return
|
||||
*/
|
||||
private String[] findStateIdArray(String moduleName) {
|
||||
//查询该类型原来关联的stateId
|
||||
Sql stateSql = Sqls.create("select stateId from audit_state where module = @moduleName").setParam("moduleName", moduleName);
|
||||
return (String[]) Daos.query(dao(), stateSql.toString(), Sqls.callback.strs());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加流程信息
|
||||
*
|
||||
* @param activityType
|
||||
*/
|
||||
private void insertAuditInfo(ActivityType activityType) {
|
||||
List<AuditState> auditStateList = activityType.getAuditStateList();
|
||||
if (Lang.isNotEmpty(auditStateList)) {
|
||||
for (int i = 0; i < auditStateList.size(); i++) {
|
||||
AuditState state = auditStateList.get(i);
|
||||
state.setModule(activityType.getModuleName());
|
||||
state.setMeetingTypeId(activityType.getId());
|
||||
dao().insertWith(state, "^auditStateUserList$");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void add(ActivityType activityType) {
|
||||
dao().insert(activityType);
|
||||
insertAuditInfo(activityType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void edit(ActivityType activityType) {
|
||||
dao().update(activityType);
|
||||
|
||||
//查询该类型原来关联的stateId
|
||||
String[] stateIdStr = findStateIdArray(activityType.getModuleName());
|
||||
|
||||
//删除原来审核状态下的审核人员
|
||||
dao().clear(AuditStateUser.class, Cnd.where("stateId", "in", stateIdStr));
|
||||
//删除原来的审核状态
|
||||
dao().clear(AuditState.class, Cnd.where("stateId", "in", stateIdStr));
|
||||
|
||||
//添加新的审核流程
|
||||
insertAuditInfo(activityType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void delete(ActivityType activityType) {
|
||||
//查询该类型原来关联的stateId
|
||||
String[] stateIdStr = findStateIdArray(activityType.getModuleName());
|
||||
|
||||
//删除原来审核状态下的审核人员
|
||||
dao().clear(AuditStateUser.class, Cnd.where("stateId", "in", stateIdStr));
|
||||
//删除原来的审核状态
|
||||
dao().clear(AuditState.class, Cnd.where("stateId", "in", stateIdStr));
|
||||
|
||||
dao().delete(activityType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package io.v.nutz.activity.services.impl;
|
||||
|
||||
import io.v.nutz.activity.models.ActivityYearSummary;
|
||||
import io.v.nutz.activity.services.ActivityYearSummaryService;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/6/29
|
||||
* @Description
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ActivityYearSummaryServiceImpl extends ViServiceImpl<ActivityYearSummary> implements ActivityYearSummaryService {
|
||||
public ActivityYearSummaryServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package io.v.nutz.activity.services.impl;
|
||||
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseServiceImpl;
|
||||
import io.v.nutz.activity.models.ActivitySiteInfo;
|
||||
import io.v.nutz.activity.services.SiteInfoService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-12-13 09:38
|
||||
* @description:
|
||||
**/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SiteInfoServiceImpl extends BaseServiceImpl<ActivitySiteInfo> implements SiteInfoService {
|
||||
|
||||
public SiteInfoServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package io.v.nutz.activity.services.impl;
|
||||
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseServiceImpl;
|
||||
import io.v.nutz.activity.models.ActivitySiteReserve;
|
||||
import io.v.nutz.activity.services.SiteReserveService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-12-13 14:32
|
||||
* @description:
|
||||
**/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SiteReserveServiceImpl extends BaseServiceImpl<ActivitySiteReserve> implements SiteReserveService {
|
||||
public SiteReserveServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package io.v.nutz.base.constant;
|
||||
|
||||
/**
|
||||
* @author wizzer@qq.com
|
||||
*/
|
||||
public class RedisConstant {
|
||||
public final static String PLATFORM_REDIS_PREFIX = "budwk5mini:";
|
||||
public final static String PLATFORM_REDIS_WKCACHE_PREFIX = PLATFORM_REDIS_PREFIX + "wkcache:";
|
||||
public final static String REDIS_KEY_WSROOM = PLATFORM_REDIS_PREFIX + "wsroom:";
|
||||
public final static String REDIS_KEY_LOGIN_ADMIN_CAPTCHA = PLATFORM_REDIS_PREFIX + "admin:login:captcha:";
|
||||
public final static String REDIS_KEY_ADMIN_PUBSUB = PLATFORM_REDIS_PREFIX + "admin:pubsub:";
|
||||
public final static String REDIS_KEY_WX_TOKEN = PLATFORM_REDIS_PREFIX + "wx:token:";
|
||||
public final static String REDIS_CAPTCHA_KEY = PLATFORM_REDIS_PREFIX + "platfrom:captcha:";
|
||||
public final static String REDIS_SMSCODE_KEY = PLATFORM_REDIS_PREFIX + "platfrom:smscode:";
|
||||
|
||||
public final static String REDIS_KEY_API_SIGN_DEPLOY_NONCE = PLATFORM_REDIS_PREFIX + "api:sign:deploy:nonce:";
|
||||
public final static String REDIS_KEY_API_SIGN_OPEN_NONCE = PLATFORM_REDIS_PREFIX + "api:sign:open:nonce:";
|
||||
|
||||
//企业微信TOKEN
|
||||
public final static String REDIS_KEY_QIYE_WECHAT_ACCESS_TOKEN = "qiyewx:token:";
|
||||
//企业微信解密TOKEN
|
||||
public final static String REDIS_KEY_QIYE_WECHAT_DECRYPT_TOKEN = "qiyewx:decrypttoken:";
|
||||
|
||||
//信息中心待办token
|
||||
public final static String REDIS_KEY_TODO_TOKEN = "todo:token:";
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package io.v.nutz.base.event;
|
||||
|
||||
public interface SysCommonDataChange {
|
||||
|
||||
|
||||
/**
|
||||
* 系统通用数据变更
|
||||
*
|
||||
* @param changeType 变更类型
|
||||
* @param tClass 数据类型 例如user、unit...............
|
||||
* @param bizId 业务ID
|
||||
*/
|
||||
void exec(SysCommonDataChangeType changeType, Class<?> tClass, String bizId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package io.v.nutz.base.event;
|
||||
|
||||
import org.nutz.mvc.Mvcs;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/8/14 17:23
|
||||
* @description
|
||||
*/
|
||||
public class SysCommonDataChangeCenter {
|
||||
|
||||
public static void publish(SysCommonDataChangeType changeType, Class<?> tClass, String bizId){
|
||||
String[] names = Mvcs.getIoc().getNamesByType(SysCommonDataChange.class);
|
||||
for (String listener : names) {
|
||||
SysCommonDataChange listenerBean = Mvcs.getIoc().get(SysCommonDataChange.class, listener);
|
||||
listenerBean.exec(changeType, tClass, bizId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user