first commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
/.idea/
|
||||
@@ -0,0 +1,93 @@
|
||||
# zhgh_hhu
|
||||
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
||||
|
||||
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
||||
|
||||
## Add your files
|
||||
|
||||
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
||||
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
||||
|
||||
```
|
||||
cd existing_repo
|
||||
git remote add origin https://jihulab.com/zhgh/zhgh_hhu.git
|
||||
git branch -M main
|
||||
git push -uf origin main
|
||||
```
|
||||
|
||||
## Integrate with your tools
|
||||
|
||||
- [ ] [Set up project integrations](https://jihulab.com/zhgh/zhgh_hhu/-/settings/integrations)
|
||||
|
||||
## Collaborate with your team
|
||||
|
||||
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
||||
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
||||
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
||||
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
||||
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
||||
|
||||
## Test and Deploy
|
||||
|
||||
Use the built-in continuous integration in GitLab.
|
||||
|
||||
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
||||
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
||||
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
||||
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
||||
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
||||
|
||||
***
|
||||
|
||||
# Editing this README
|
||||
|
||||
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
||||
|
||||
## Suggestions for a good README
|
||||
|
||||
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
||||
|
||||
## Name
|
||||
Choose a self-explaining name for your project.
|
||||
|
||||
## Description
|
||||
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
||||
|
||||
## Badges
|
||||
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
||||
|
||||
## Visuals
|
||||
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
||||
|
||||
## Installation
|
||||
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
||||
|
||||
## Usage
|
||||
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
||||
|
||||
## Support
|
||||
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
||||
|
||||
## Roadmap
|
||||
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
||||
|
||||
## Contributing
|
||||
State if you are open to contributions and what your requirements are for accepting them.
|
||||
|
||||
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
||||
|
||||
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
||||
|
||||
## Authors and acknowledgment
|
||||
Show your appreciation to those who have contributed to the project.
|
||||
|
||||
## License
|
||||
For open source projects, say how it is licensed.
|
||||
|
||||
## Project status
|
||||
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
||||
@@ -0,0 +1,164 @@
|
||||
<?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>
|
||||
<compilerArgs>--enable-preview</compilerArgs>
|
||||
<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.11.2</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,532 @@
|
||||
<?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.11.2</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.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>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>xmlbeans</artifactId>
|
||||
<groupId>org.apache.xmlbeans</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<groupId>commons-io</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>ooxml-schemas</artifactId>
|
||||
</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>okhttp</artifactId>
|
||||
<groupId>com.squareup.okhttp</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>
|
||||
<compilerArgs>--enable-preview</compilerArgs>
|
||||
<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,998 @@
|
||||
package io.v.nutz;
|
||||
|
||||
import io.v.nutz.proposal.models.ProposalUndertake;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.*;
|
||||
import io.v.nutz.sys.services.SysTaskService;
|
||||
import io.v.nutz.sys.services.SysUnitService;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* @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",
|
||||
})
|
||||
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.X_POWERED_BY = "BudWK-V5 <budwk.com>";
|
||||
|
||||
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();
|
||||
initUndertake();
|
||||
ioc.get(Globals.class);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private SysUnitService sysUnitService;
|
||||
|
||||
@Inject("ProposalUndertake")
|
||||
private ViService<ProposalUndertake> proposalUndertakeService;
|
||||
|
||||
private void initUndertake() {
|
||||
if (proposalUndertakeService.count() == 0) {
|
||||
List<Sys_unit> unitLevel2 = sysUnitService.query(Cnd.where("unitlevel", "=", 2).and("parentId", "IS NOT", null).asc("unitcode"));
|
||||
if (!unitLevel2.isEmpty()) {
|
||||
unitLevel2.forEach(v -> {
|
||||
ProposalUndertake undertake = new ProposalUndertake();
|
||||
undertake.setIsEnable(Boolean.TRUE);
|
||||
undertake.setUnitCode(v.getUnitcode());
|
||||
undertake.setUnitName(v.getName());
|
||||
proposalUndertakeService.insert(undertake);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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("/platform/login");
|
||||
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,183 @@
|
||||
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, String userId, 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,465 @@
|
||||
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 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.util.ViTool;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
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.json.Json;
|
||||
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.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
""");
|
||||
try {
|
||||
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr);
|
||||
|
||||
|
||||
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) Integer 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
|
||||
""");
|
||||
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr);
|
||||
|
||||
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", "=", io.v.nutz.util.ShiroUtil.getUserId()));
|
||||
}
|
||||
|
||||
@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.hasRole("H04"));
|
||||
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_hhu'
|
||||
""");
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("activity.basic.scope")
|
||||
@Ok("void")
|
||||
public void doExportUser(PageForm pageForm,
|
||||
@Param(value = "props", required = false) String props,
|
||||
@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, HttpServletResponse response) {
|
||||
|
||||
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
|
||||
""");
|
||||
|
||||
try {
|
||||
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> map = simpleService.listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10);
|
||||
no.setFormat("isAddIndex");
|
||||
entityList.add(no);
|
||||
Map<String, String> propMap = Json.fromJson(Map.class, props);
|
||||
propMap.forEach((k, v) -> {
|
||||
entityList.add(new ExcelExportEntity(v, k, 40));
|
||||
});
|
||||
|
||||
ViTool.excelResponse(response, "人员名单.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, map);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Cnd getCnd(PageForm pageForm,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String[] personTypes,
|
||||
String[] userStates,
|
||||
String[] memberTypes,
|
||||
String[] sexTypes,
|
||||
String[] age,
|
||||
String teacherMeetingId,
|
||||
String[] roleIds,
|
||||
String[] userId,
|
||||
String clubId,
|
||||
boolean reverseSelection,
|
||||
Integer activityGroupId,
|
||||
String activityUserCndStr) {
|
||||
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);
|
||||
}
|
||||
return cnd;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
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")
|
||||
@RequiresAuthentication
|
||||
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
|
||||
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
|
||||
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"));
|
||||
|
||||
asyncService.exe2(basicSettings, settings -> {
|
||||
settings.setChild(child(settings.getId()));
|
||||
});
|
||||
return basicSettings;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
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
|
||||
public Object doEditType(ActivityBasicSettings activityBasicSettings) {
|
||||
basicSettingsViService.updateIgnoreNull(activityBasicSettings);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDelete(String id) {
|
||||
basicSettingsViService.delete(id);
|
||||
basicSettingsViService.clear(Cnd.where("parentId", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
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,161 @@
|
||||
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 java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/2/24 14:09
|
||||
* @description 比赛项目
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/basic/event")
|
||||
@RequiresAuthentication
|
||||
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
|
||||
public Object focusGroup() {
|
||||
return basicSettingsViService.query(Cnd.where("parentId", "=", COMPETITION_CATEGORY).asc("code"));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object exerciseType() {
|
||||
return basicSettingsViService.query(Cnd.where("parentId", "=", EXERCISE_TYPE));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object focusDistance() {
|
||||
return basicSettingsViService.query(Cnd.where("parentId", "=", DISTANCE).asc("name"));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object changeExercise_typeList(String exerciseType) {
|
||||
return basicSettingsViService.query(Cnd.where("parentId", "=", exerciseType));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page, String group, String events, String[] isMenWomen, 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.andEX("even.competitionCategory", "=", group);
|
||||
cnd.andEX("exe.id", "=", events);
|
||||
cnd.andEX("ase.activityId", "=", activityId);
|
||||
cnd.asc("projectType");
|
||||
cnd.desc("baname");
|
||||
cnd.asc("isMenWomen");
|
||||
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return activityEventViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAdd(ActivityEvent activityEvent) {
|
||||
activityEvent.setWhetherEnable(true);
|
||||
activityEventViService.insert(activityEvent);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doEdit(ActivityEvent activityEvent) {
|
||||
activityEventViService.updateIgnoreNull(activityEvent);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDelete(String id) {
|
||||
activityEventViService.delete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,543 @@
|
||||
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.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.lang.Lang;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_dict;
|
||||
import io.v.nutz.sys.models.Sys_role;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
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.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")
|
||||
@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("activity.basic.union")
|
||||
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
|
||||
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
|
||||
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
|
||||
public Object unionTree() {
|
||||
try {
|
||||
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", false);
|
||||
record.set("childrens", sysUnionService.list(Sqls.create("SELECT gh.* from sys_user_role sur left join activity_basic_union gh on sur.unionid = gh.id\n" +
|
||||
"WHERE sur.userId = @userid and sur.roleId = @roleid GROUP BY sur.unionid").setParam("userid", ShiroUtil.getPrincipalProperty("id")).setParam("roleid", Roles.UNION_MANGER)));
|
||||
}
|
||||
|
||||
return Result.success().addData(record);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public Object unionPageData(String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
try {
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"\tgh.*,\n" +
|
||||
"\tun.isEnable AS unisEnable,\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 (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
|
||||
public Object doAddUnion(ActivityBasicUnion union) {
|
||||
try {
|
||||
union.setSource("activity");
|
||||
sysUnionService.insert(union);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看工会信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
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
|
||||
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
|
||||
public Object doDeleteUnion(String id) {
|
||||
try {
|
||||
sysUnionService.delete(id);
|
||||
//再清除单位对应的工会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
|
||||
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
|
||||
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 {
|
||||
return Result.success().addData(sysUnitService.query(Cnd.where("unionid", "=", unionid).and("unitlevel", "=", 2)));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At // 会员档案
|
||||
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")
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
public Object isEnableChange(String id, boolean isEnable) {
|
||||
sysUnionService.update(Chain.make("isEnable", isEnable), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getActivityUnions() {
|
||||
return sysUnionService.query();
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
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,200 @@
|
||||
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 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
|
||||
public Object pageData(String parentId, PageForm pageForm) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.andExcludeEmpty("parentId", "=", parentId);
|
||||
return sysUnitService.list(pageForm, cnd);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findOne(String id) {
|
||||
return sysUnitService.fetch(id);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
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
|
||||
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
|
||||
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
|
||||
public Object getUnitTreeData() {
|
||||
try {
|
||||
List list = new ArrayList();
|
||||
|
||||
ActivityBasicUnit school = sysUnitService.fetch(Cnd.NEW());
|
||||
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));
|
||||
|
||||
asyncService.exe2(units, unit -> {
|
||||
unit.setChild(child(unit.getId()));
|
||||
});
|
||||
|
||||
return units;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
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
|
||||
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,734 @@
|
||||
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
|
||||
public Object applyPageData(PageForm page, String activityId, 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.unionId", "=", getUnionId());
|
||||
/* if (!ShiroUtil.hasAnyRoles("A06,sysadmin")) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
if (ShiroUtil.hasAnyRoles("H01")) {
|
||||
group.or("applyUser", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
if (ShiroUtil.hasAnyRoles("H04")) {
|
||||
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(Integer year, 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() < school.applyEndTime"));
|
||||
}//查询已结束的
|
||||
else if (isActivity == 3) {
|
||||
cnd.and(new Static("now() > school.applyEndTime"));
|
||||
}
|
||||
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("H04,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
|
||||
public Object getUniteApplyInfo(String endAgeDate, String startAgeDate, String activityId, String eventId, String schoolEventId, String projectType, 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
|
||||
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);
|
||||
|
||||
result.put("users", activitySchoolService.list(sql));
|
||||
/*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.unionId = @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());
|
||||
|
||||
|
||||
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);
|
||||
result.put("getEvent", activitySchoolEventViService.fetch(schoolEventId));
|
||||
|
||||
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
|
||||
public Object leaderSearch(String eventId, String keyWord, 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 sys_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
|
||||
public Object doApply(@Param("data") ActivitySchoolApply[] applies, @Param("appliedData3") ActivitySchoolApply[] applies2, String eventId, 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
|
||||
public Object doAddTeammateEnter(@Param("personalEnter") ActivitySchoolApply personalEnter, @Param("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
|
||||
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();
|
||||
return unit == null ? "" : unit.getUnionid();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询人
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
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
|
||||
public Object getActivityCount(String teamId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT COUNT(*) FROM activity_school_apply WHERE teamId=@teamId and unionId=@unionId
|
||||
""");
|
||||
sql.setParam("teamId", teamId);
|
||||
sql.setParam("unionId", getUnionId());
|
||||
return activitySchoolApplyService.count(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询该人有没有参加过这个活动
|
||||
*
|
||||
* @param eventId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
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
|
||||
public Object getUserUnion(String query) {
|
||||
String union_id = getUnionId();
|
||||
Sql sql = Sqls.create("select * FROM `user` $condition");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
|
||||
if (Strings.isNotBlank(query)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.orLike("username", query);
|
||||
group.orLike("loginname", query);
|
||||
cnd.and(group);
|
||||
}
|
||||
cnd.and("unionid", "=", union_id);
|
||||
sql.setCondition(cnd);
|
||||
return sysUserService.list(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
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);
|
||||
List<Record> list = activitySchoolService.list(sql);
|
||||
|
||||
return Result.success().addData(activitySchoolService.list(sql).get(0));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
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.id,
|
||||
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
|
||||
public Object joinMemberFamily(String[] applysId) {
|
||||
for (String s : applysId) {
|
||||
activitySchoolApplyService.clear(Cnd.where("id", "=", s));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(String applyType, String isAudit, String groupName, String activityId, String eventId, Integer year, PageForm page, String[] isMenWomen) {
|
||||
Cnd cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ase.*,
|
||||
school.`name`,
|
||||
school.applyWay,
|
||||
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 unionId=@unionId) applyNum,
|
||||
(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", Vi.getUnionId()).setParam("userId", ShiroUtil.getUserId());
|
||||
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("H04,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,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("LeaderData") ActivitySchoolApply LeaderData, @Param("CoachData") ActivitySchoolApply CoachData, @Param("headData") ActivitySchoolApply headData) {
|
||||
|
||||
if (LeaderData.getUserId() != null) {
|
||||
activitySchoolApplyService.clear(Cnd.where("activityId", "=", LeaderData.getActivityId()).and("unionLeader", "=", true).and("unionId", "=", getUnionId()));
|
||||
LeaderData.setApplyUser(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
LeaderData.setApplyDate(DateUtil.getDate());
|
||||
activitySchoolApplyService.insert(LeaderData);
|
||||
}
|
||||
if (CoachData.getUserId() != null) {
|
||||
activitySchoolApplyService.clear(Cnd.where("activityId", "=", CoachData.getActivityId()).and("unionCoach", "=", true).and("unionId", "=", getUnionId()));
|
||||
CoachData.setApplyUser(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
CoachData.setApplyDate(DateUtil.getDate());
|
||||
activitySchoolApplyService.insert(CoachData);
|
||||
}
|
||||
if (headData.getUserId() != null) {
|
||||
activitySchoolApplyService.clear(Cnd.where("activityId", "=", headData.getActivityId()).and("unionHead", "=", true).and("unionId", "=", getUnionId()));
|
||||
headData.setApplyUser(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
headData.setApplyDate(DateUtil.getDate());
|
||||
activitySchoolApplyService.insert(headData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getUnionCoachLeaderHead(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);
|
||||
result.put("unionCoach", unionCoach);
|
||||
result.put("unionLeader", unionLeader);
|
||||
result.put("unionHead", unionHead);
|
||||
|
||||
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")));
|
||||
}
|
||||
|
||||
|
||||
result.put("userOptions", arrayList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getActivityData(String activityId) {
|
||||
return activitySchoolApplyService.query(Cnd.where("activityId", "=", activityId).and("awardsMode", "=", 1));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDeleteApply(String activityId, String userId, 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(String activityId, 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,
|
||||
school.applyWay,
|
||||
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
|
||||
AND state =3
|
||||
""");
|
||||
|
||||
|
||||
return activitySchoolService.listMap(sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,668 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
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.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 org.apache.poi.ss.usermodel.Workbook;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-02-23 14:32
|
||||
* @description: 活动通用
|
||||
**/
|
||||
|
||||
@At("/platform/activity/common")
|
||||
@IocBean
|
||||
@RequiresAuthentication
|
||||
@Ok("json")
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* 获取活动类型
|
||||
*
|
||||
* @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(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.hasRole("H04")) {
|
||||
sql1.setVar("union", " AND app.unionId = '" + unionid + "' ");
|
||||
}
|
||||
|
||||
List<Record> applies = activitySchoolApplyService.list(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.hasRole("H04")) {
|
||||
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<Record> 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
|
||||
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.sex,
|
||||
app.mobile,
|
||||
u.idCard,
|
||||
u.userState,
|
||||
ev.allName,
|
||||
sc.`name` activityName,
|
||||
app.`team` team
|
||||
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
|
||||
ev.allName DESC,
|
||||
u.unionname DESC,
|
||||
app.`team` 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");
|
||||
|
||||
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);
|
||||
});
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String((activityName + "报名表.xls").getBytes("utf-8"), "ISO8859-1"));
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ActivitySchoolApply.class, excels);
|
||||
workbook.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
|
||||
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 "替补";
|
||||
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.hasRole("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 name = "";
|
||||
if (activity.getApplyType() == 1) {
|
||||
name = "docTemplate/activity/list1.docx";
|
||||
} else if (activity.getApplyType() == 2) {
|
||||
name = "docTemplate/activity/list.docx";
|
||||
}
|
||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
|
||||
XWPFTemplate.compile(inputStream, config).render(map, response.getOutputStream());
|
||||
inputStream.close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* @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.hasRole("H04")) {
|
||||
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,266 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
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.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;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/school/ActivityManage.html")
|
||||
@RequiresPermissions("activity.school.info")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page, Integer year, String name, String gameStyle, String query, String activityId, 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,
|
||||
(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.hasRole("H04")) {
|
||||
cnd.and("school.belongUnionId", "=", Vi.getUnionId());
|
||||
}
|
||||
if (ShiroUtil.hasRole("H02")) {
|
||||
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
|
||||
public Object doAdd(@Param("data") ActivitySchool activitySchool, @Param("events") 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.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));
|
||||
return id;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doEdit(@Param("data") ActivitySchool activitySchool, @Param("events") 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));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
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(String activityId, 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
|
||||
public Object doAssignmentDate(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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* @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, String year, 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,298 @@
|
||||
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
|
||||
acse.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
|
||||
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
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("acse.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")));
|
||||
}
|
||||
// }
|
||||
|
||||
// if (Lang.isNotEmpty(otherList)) {
|
||||
// otherMap = otherList.stream().collect(Collectors.groupingBy(v -> v.getString("activityName")));
|
||||
// }
|
||||
|
||||
return Map.of("团体项目", teamMap, "男子项目", maleMap, "女子项目", femaleMap, "其他", otherMap);
|
||||
|
||||
|
||||
// NutMap map = new NutMap();
|
||||
// List<Record> result = new ArrayList<>();
|
||||
//
|
||||
//
|
||||
// Sql sqlX = Sqls.create("""
|
||||
// SELECT
|
||||
// ev.id,
|
||||
// ev.eventId,
|
||||
// ev.awardsMode,
|
||||
// eve.allName label
|
||||
// FROM
|
||||
// activity_school_event ev
|
||||
// LEFT JOIN activity_event eve ON ev.eventId = eve.id $condition
|
||||
// """);
|
||||
// CndPlus cndX = new CndPlus();
|
||||
// cndX.and("ev.activityId", "=", activityId);
|
||||
// cndX.asc("ev.awardsMode");
|
||||
// sqlX.setCondition(cndX);
|
||||
// List<Record> eventList = eventViService.list(sqlX);
|
||||
//
|
||||
//
|
||||
// Sql sqlC = Sqls.create("""
|
||||
// SELECT
|
||||
// ev.allName,
|
||||
// CONCAT(us.username,'(',us.sex,')') username,
|
||||
// ar.isTeamPersonal,
|
||||
// ar.numberOfPeople,
|
||||
// ar.ranking
|
||||
// FROM
|
||||
// activity_results ar
|
||||
// LEFT JOIN activity_event ev ON ar.eventId = ev.id
|
||||
// LEFT JOIN `user` us ON us.id = ar.userId
|
||||
// LEFT JOIN sys_union un ON un.id = ar.unionId $condition
|
||||
// """);
|
||||
// CndPlus cndC = new CndPlus();
|
||||
// cndC.and("ar.activityId", "=", activityId);
|
||||
// cndC.and("ar.unionId", "=", unionId);
|
||||
// cndC.asc("ar.ranking");
|
||||
// sqlC.setCondition(cndC);
|
||||
// int number = 0;
|
||||
// List<Record> list = resultsViService.list(sqlC);
|
||||
// list.forEach(z -> {
|
||||
// if (z.getString("isteampersonal").equals("2")) {
|
||||
// z.set(z.getString("allName"), z.getString("numberofpeople"));
|
||||
// } else {
|
||||
// z.set(z.getString("allName"), z.getString("username"));
|
||||
// }
|
||||
//
|
||||
// result.add(z);
|
||||
// });
|
||||
// map.put("score", result);
|
||||
// map.put("eventList", eventList);
|
||||
// return Result.success().addData(map);
|
||||
}
|
||||
|
||||
|
||||
@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,189 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
import io.v.nutz.activity.models.ActivityBasicUnion;
|
||||
import io.v.nutz.activity.models.ActivityBasicUnit;
|
||||
import io.v.nutz.activity.models.ActivitySchool;
|
||||
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.Vi;
|
||||
import io.v.nutz.sys.models.Sys_club;
|
||||
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.SysClubService;
|
||||
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.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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
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 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.hasRole("H04") && activityLevel.equals("40002")) {
|
||||
cnd.and("app.activityUnionId", "=", basicUnit.getUnionid());
|
||||
cnd.and("school.belongUnionId", "=", basicUnit.getUnionid());
|
||||
}
|
||||
if (ShiroUtil.hasRole("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.hasRole("H04")) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
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 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
|
||||
public Object pageData(PageForm page, String name, 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
|
||||
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
|
||||
public Object sendRemind(String phone, String unionname) {
|
||||
String[] pe = phone.split(",");
|
||||
for (String p : pe) {
|
||||
RCSCloudAPI.sendTplSms("399ac7a7901c49df9f5939d0f10d566b", p, "@1@=" + unionname + "", "");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
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.hasRole("H04")) {
|
||||
cnd.and("school.belongUnionId", "=", Vi.getUnionId());
|
||||
}
|
||||
if (ShiroUtil.hasRole("H02")) {
|
||||
cnd.and("school.belongClubId", "in", vi.getMangeClubStr());
|
||||
}
|
||||
}
|
||||
return activitySchoolService.query(cnd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
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.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
|
||||
public Object pageData(String groupName, PageForm page, String activityId, String eventId, 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.eventId", "=", 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
|
||||
public Object doAdd(@Param("activityResults") ActivityResults[] activityResults, String activityId, String eventId) {
|
||||
|
||||
resultsViService.clear(Cnd.where("activityId", "=", activityId).and("eventId", "=", eventId));
|
||||
|
||||
|
||||
resultsViService.insert(activityResults);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
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);
|
||||
|
||||
activitySchoolApply.setUserId(user.getId());
|
||||
activitySchoolApply.setApplyDate(DateUtil.getDate());
|
||||
activitySchoolApply.setSex(user.getSex());
|
||||
activitySchoolApply.setUnitId(user.getUnitid());
|
||||
activitySchoolApplyViService.insert(activitySchoolApply);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
activitySchoolApply.setUserId(sysUser.getId());
|
||||
activitySchoolApply.setApplyDate(DateUtil.getDate());
|
||||
activitySchoolApply.setSex(sysUser.getSex());
|
||||
activitySchoolApply.setUnitId(sysUser.getUnitid());
|
||||
activitySchoolApplyViService.insert(activitySchoolApply);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询个人参赛人员
|
||||
*
|
||||
* @param activityId
|
||||
* @param eventId
|
||||
* @param isMenWomen
|
||||
* @return
|
||||
*/
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getUserList(String activityId, String eventId, 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
|
||||
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
|
||||
public Object getUnionList(String activityId, 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
|
||||
public Object getUserData(String activityId, String eventId, 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
|
||||
public Object getUnionData(String activityId, 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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+490
@@ -0,0 +1,490 @@
|
||||
package io.v.nutz.activity.controller.school;
|
||||
|
||||
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.dao.CndPlus;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import io.v.nutz.sys.services.SysUnionService;
|
||||
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.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;
|
||||
|
||||
@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( us.username, '(', us.unionname, ')' ) username,
|
||||
ar.integral,
|
||||
ar.ranking,
|
||||
eve.allName
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event eve ON ar.eventId = eve.id
|
||||
LEFT JOIN `user` us ON us.id = ar.userId $condition
|
||||
""");
|
||||
cnd.and("ar.isTeamPersonal", "=", awardsMode);
|
||||
cnd.and("us.sex", "=", sex);
|
||||
cnd.and("ar.activityId", "=", activityId);
|
||||
cnd.and("ar.ranking", "<=", 8);
|
||||
} 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");
|
||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/activity/GetYear8.docx");
|
||||
assert inputStream != null;
|
||||
XWPFTemplate.compile(inputStream, config).render(map, response.getOutputStream());
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
public static Double getDouble(NutMap o) {
|
||||
return o.getDouble("score");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
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 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("/doHandle")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
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
|
||||
public Object delete(Integer id) {
|
||||
if (id == 1) {
|
||||
return Result.error("此记录不可删除");
|
||||
}
|
||||
dao.clear(ActivityType.class, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At("/findUserList")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
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
|
||||
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,91 @@
|
||||
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")
|
||||
@RequiresAuthentication
|
||||
public class SiteManageController {
|
||||
|
||||
@Inject
|
||||
private SiteInfoService siteInfoService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/site/SiteManage.html")
|
||||
@RequiresPermissions("activity.site.manage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(String siteType, Integer year, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, 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
|
||||
public Object doAdd(@Param("data") ActivitySiteInfo activitySiteInfo) {
|
||||
siteInfoService.insert(activitySiteInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doEdit(@Param("data") ActivitySiteInfo activitySiteInfo) {
|
||||
siteInfoService.updateIgnoreNull(activitySiteInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDelete(String id) {
|
||||
siteInfoService.delete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findOneSite(String id) {
|
||||
return siteInfoService.fetch(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package io.v.nutz.activity.controller.site;
|
||||
|
||||
import io.v.nutz.activity.services.SiteReserveService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @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")
|
||||
@RequiresAuthentication
|
||||
public class SiteRecordController {
|
||||
|
||||
@Inject
|
||||
private SiteReserveService siteReserveService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/site/SiteRecord.html")
|
||||
@RequiresPermissions("activity.site.record")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(String month, String siteType, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
asr.*,
|
||||
asi.`name` site_name,
|
||||
ass.`stateName` state_name,
|
||||
ass.`stateColor` state_color,
|
||||
ass.stateAuditType,
|
||||
count(sqid) days,
|
||||
GROUP_CONCAT(reserve_day order by reserve_day asc) concat_day
|
||||
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
|
||||
sys_user u on u.id = asr.reserve_person_id
|
||||
$condition
|
||||
""");
|
||||
|
||||
if (ShiroUtil.hasAnyRoles(new String[]{"gh10"})) {
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
cnd.and("u.unitid", "=", user.getUnitid());
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(siteType)) {
|
||||
cnd.and("asi.typeId", "=", siteType);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(month)) {
|
||||
cnd.and("left(reserve_day, 7)", "=", month);
|
||||
}
|
||||
|
||||
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.asc("asr.reserve_state").desc("u.unitid");
|
||||
}
|
||||
|
||||
cnd.groupBy("sqid");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return siteReserveService.listPage(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,371 @@
|
||||
package io.v.nutz.activity.controller.site;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
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.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 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.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")
|
||||
@RequiresAuthentication
|
||||
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
|
||||
public Object pageData(String siteType, String time, String siteId, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
asr.*,
|
||||
asi.`name` site_name,
|
||||
ass.`stateName` state_name,
|
||||
ass.`stateColor` state_color,
|
||||
ass.stateAuditType,
|
||||
count(sqid) days,
|
||||
GROUP_CONCAT(reserve_day order by reserve_day asc) concat_day
|
||||
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
|
||||
""");
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "siteManage"})) {
|
||||
cnd.and("reserve_person_id", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(time)) {
|
||||
cnd.and("left(asr.reserve_day, 7)", "=", time);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(siteId)) {
|
||||
cnd.and("site_id", "=", siteId);
|
||||
}
|
||||
|
||||
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.asc("asr.reserve_state").desc("asr.reserve_day");
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(siteType)) {
|
||||
cnd.and("typeId", "=", siteType);
|
||||
}
|
||||
|
||||
cnd.groupBy("sqid");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return siteReserveService.listPage(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDelete(String id, Integer op) {
|
||||
ActivitySiteReserve fetch = siteReserveService.fetch(id);
|
||||
if (op == 1) {
|
||||
siteReserveService.clear(Cnd.NEW().and("sqid", "=", fetch.getSqid()));
|
||||
} else if (op == 2) {
|
||||
//siteReserveService.update(Chain.make("reserve_state", 50), Cnd.where("id", "=", id));
|
||||
siteReserveService.clear(Cnd.NEW().and("sqid", "=", fetch.getSqid()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
public Object isCanRollBack(String id) {
|
||||
//根据活动id查询第一个审核节点
|
||||
ActivitySiteReserve fetch = siteReserveService.fetch(id);
|
||||
String moduleName = activityCommonService.findModuleNameByActivityId(fetch.getSite_id());
|
||||
Integer stateCode = activityCommonService.findStartStateCodeByModuleName(moduleName);
|
||||
|
||||
return fetch.getReserve_state() > stateCode;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAdd(@Param("data") ActivitySiteReserve activitySiteReserve, @Param("days") String[] days) {
|
||||
|
||||
String r = R.UU32();
|
||||
activitySiteReserve.setSqid(r);
|
||||
|
||||
String moduleName = activityCommonService.findModuleNameByActivityId(activitySiteReserve.getSite_id());
|
||||
Integer stateCode = activityCommonService.findStartStateCodeByModuleName(moduleName);
|
||||
|
||||
if (stateCode == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (String d : days) {
|
||||
activitySiteReserve.setReserve_day(d);
|
||||
//查询这个人是否已经预约这个时间段
|
||||
int count = siteReserveService.count("activity_site_reserve", Cnd.NEW().and("reserve_person_id", "=", ShiroUtil.getPrincipalProperty("id"))
|
||||
.and("reserve_day", "=", activitySiteReserve.getReserve_day()).and("start_time", "=", activitySiteReserve.getStart_time())
|
||||
.and("end_time", "=", activitySiteReserve.getEnd_time()));
|
||||
if (count > 0) {
|
||||
return Result.error("您已预约该时间段!");
|
||||
}
|
||||
|
||||
activitySiteReserve.setReserve_state(stateCode);
|
||||
activitySiteReserve.setReserve_person_id(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
siteReserveService.insert(activitySiteReserve);
|
||||
}
|
||||
|
||||
//发送微信提醒审核人
|
||||
//查询状态码对应的审核人
|
||||
Sql sql = Sqls.create("""
|
||||
select userId,u.loginname,u.username from audit_state_user asu
|
||||
left join `user` u on u.id = asu.userId left join audit_state s on s.stateId=asu.stateId $condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("asu.stateId", "=", stateCode);
|
||||
cnd.and("s.stateAuditType", "=", "0");
|
||||
if ("infantRoom".equals(moduleName)) {
|
||||
//获取当前登录人的单位id
|
||||
String unitId = ShiroUtil.getPrincipalProperty("unitid").toString();
|
||||
cnd.and("u.unitid", "=", unitId);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<Record> list = siteReserveService.list(sql);
|
||||
|
||||
list.forEach(item -> {
|
||||
String content = "%s老师您好!%s老师预约%s日使用%s,请您通过门户网站或企业微信登录智慧工会平台进行审核。"
|
||||
.formatted(item.getString("username"),
|
||||
activitySiteReserve.getReserve_person(),
|
||||
StringUtils.join(days, ","),
|
||||
siteInfoService.fetch(activitySiteReserve.getSite_id()).getName());
|
||||
msgApi.sendMsg(content, List.of(item.getString("loginname")));
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findAllOpenSite(String time, 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
|
||||
public Object findUser(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
|
||||
public Object findReserveInfo(String siteId, 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
|
||||
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
|
||||
public Object findOne(String id) {
|
||||
ActivitySiteReserve fetch = siteReserveService.fetch(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.loginname,
|
||||
count(sqid) days,
|
||||
GROUP_CONCAT(reserve_day order by reserve_day asc) concat_day
|
||||
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 sys_user su ON su.id = asr.reserve_person_id
|
||||
LEFT JOIN sys_user sm ON sm.id = asr.site_manager_id
|
||||
WHERE
|
||||
asr.sqid = @id
|
||||
group by sqid
|
||||
""").setParam("id", fetch.getSqid());
|
||||
Record record = siteReserveService.list(sql).get(0);
|
||||
String auditList = record.getString("auditList");
|
||||
if (auditList != null) {
|
||||
List<NutMap> nutMaps = Json.fromJsonAsList(NutMap.class, auditList);
|
||||
nutMaps.forEach(item -> {
|
||||
item.put("auditListName", item.getBoolean("auditState") ? "审核通过" : "审核拒绝");
|
||||
Sys_user auditUSer = sysUserService.fetch(item.getString("auditUser"));
|
||||
item.put("auditUserName", auditUSer.getUsername());
|
||||
item.put("auditUserUnionName", sysUnitService.fetch(auditUSer.getUnitid()).getName());
|
||||
Sql sqlStr = Sqls.create("select stateName from audit_state where stateId = '" + item.getString("stateCode") + "'");
|
||||
Record re = sysUserService.list(sqlStr).get(0);
|
||||
item.put("auditStateName", re.getString("stateName"));
|
||||
});
|
||||
record.put("auditListTable", nutMaps);
|
||||
} else {
|
||||
record.put("auditListTable", new ArrayList<>());
|
||||
}
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
String site_id = record.getString("site_id");
|
||||
String reserve_day = record.getString("reserve_day");
|
||||
|
||||
String moduleName = activityCommonService.findModuleNameByActivityId(record.getString("site_id"));
|
||||
//根据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());
|
||||
|
||||
Sql i = Sqls.create("""
|
||||
SELECT
|
||||
ar.*,
|
||||
`as`.stateAuditType
|
||||
FROM
|
||||
activity_site_reserve ar
|
||||
left join audit_state `as` on `as`.stateId = ar.reserve_state
|
||||
$condition
|
||||
""");
|
||||
cnd.and("site_id", "=", site_id)
|
||||
//.and("reserve_day", "=", reserve_day)
|
||||
.and("reserve_state", "not in", stateList);
|
||||
|
||||
i.setCondition(cnd);
|
||||
List<Record> list1 = siteReserveService.list(i);
|
||||
record.set("site_info", list1);
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
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.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.modules.models.Audit;
|
||||
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 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.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.Strings;
|
||||
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.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-12-15 13:52
|
||||
* @description: 预约审核
|
||||
**/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/site/review")
|
||||
@RequiresAuthentication
|
||||
public class SiteReviewController {
|
||||
|
||||
@Inject
|
||||
private SiteInfoService siteInfoService;
|
||||
|
||||
@Inject
|
||||
private SiteReserveService siteReserveService;
|
||||
|
||||
@Inject
|
||||
private ActivityCommonService activityCommonService;
|
||||
|
||||
@Inject
|
||||
private SendMsg sendMsg;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@Inject
|
||||
private MsgNotifyService msgNotifyService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/site/SiteReview.html")
|
||||
@RequiresPermissions("activity.site.review")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(String month, String siteType, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy, Boolean isAudit) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
asr.*,
|
||||
asi.`name` site_name,
|
||||
ass.`stateName` state_name,
|
||||
ass.`stateColor` state_color,
|
||||
ass.stateAuditType,
|
||||
count(sqid) days,
|
||||
GROUP_CONCAT(reserve_day order by reserve_day asc) concat_day
|
||||
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
|
||||
sys_user u on u.id = asr.reserve_person_id
|
||||
$condition
|
||||
""");
|
||||
|
||||
/*if (ShiroUtil.hasAnyRoles(new String[]{"gh10"})) {
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
cnd.and("u.unitid", "=", user.getUnitid());
|
||||
}*/
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "A06"})) {
|
||||
cnd.and(new Static("if(asi.typeId=1, u.unionId = '" + Vi.getUnionId() + "', 1=1)"));
|
||||
}
|
||||
|
||||
//查询未审核,获取当前用户可以审核的节点
|
||||
Sql s = Sqls.create("""
|
||||
select stateId from audit_state_user where userId=@userId
|
||||
""").setParam("userId", ShiroUtil.getPrincipalProperty("id"));
|
||||
List<Record> sList = siteReserveService.list(s);
|
||||
List<String> stateList = sList.stream().map(o -> o.getString("stateId")).collect(Collectors.toList());
|
||||
|
||||
if (isAudit == null) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.and(new Static("JSON_CONTAINS(auditList, JSON_OBJECT('auditUser', '" + ShiroUtil.getPrincipalProperty("id") + "'))"))
|
||||
.or("reserve_state", "in", stateList);
|
||||
cnd.and(group);
|
||||
} else if (isAudit) {
|
||||
//查询已审核
|
||||
cnd.and(new Static("JSON_CONTAINS(auditList, JSON_OBJECT('auditUser', '" + ShiroUtil.getPrincipalProperty("id") + "'))"));
|
||||
} else {
|
||||
cnd.and("reserve_state", "in", stateList);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(siteType)) {
|
||||
cnd.and("asi.typeId", "=", siteType);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(month)) {
|
||||
cnd.and("left(reserve_day, 7)", "=", month);
|
||||
}
|
||||
|
||||
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.asc("asr.reserve_state").desc("u.unitid");
|
||||
}
|
||||
|
||||
cnd.groupBy("sqid");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return siteReserveService.listPage(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doReview(String[] id, Audit audit, Boolean isPass) {
|
||||
siteReserveService.insert(audit);
|
||||
|
||||
for (String s : id) {
|
||||
ActivitySiteReserve fetch = siteReserveService.fetch(s);
|
||||
|
||||
Integer stateCode = fetch.getReserve_state();
|
||||
Integer afterStateCode = activityCommonService.findAfterStateCode(stateCode, isPass);
|
||||
|
||||
List<ActivitySiteReserve> reserves = siteReserveService.query(Cnd.NEW().and("sqid", "=", fetch.getSqid()));
|
||||
String days = "";
|
||||
for (ActivitySiteReserve siteReserve : reserves) {
|
||||
|
||||
siteReserve.setReserve_state(afterStateCode);
|
||||
|
||||
List<NutMap> auditList = siteReserve.getAuditList();
|
||||
if (Lang.isEmpty(auditList)) {
|
||||
auditList = new ArrayList<>();
|
||||
}
|
||||
|
||||
auditList.add(NutMap.NEW().addv("stateCode", stateCode).addv("auditId", audit.getId())
|
||||
.addv("auditUser", ShiroUtil.getPrincipalProperty("id"))
|
||||
.addv("auditState", isPass)
|
||||
.addv("auditOption", audit.getAuditOpinion())
|
||||
);
|
||||
siteReserve.setAuditList(auditList);
|
||||
|
||||
days += siteReserve.getReserve_day() + ",";
|
||||
siteReserveService.update(siteReserve);
|
||||
}
|
||||
days = days.substring(0, days.length() - 1);
|
||||
|
||||
Integer successCode = activityCommonService.findSuccessStateCode(fetch.getSite_id());
|
||||
ActivitySiteInfo siteInfo = siteInfoService.fetch(fetch.getSite_id());
|
||||
|
||||
if (afterStateCode.equals(successCode) && siteInfo.getTypeId() == 1) {
|
||||
String content = "%s老师您好!您提交的%s使用申请已通过审批,如有疑问,欢迎咨询校工会。"
|
||||
.formatted(fetch.getReserve_person(), siteInfo.getName());
|
||||
Sys_user user = sysUserService.dao().fetch(Sys_user.class, fetch.getReserve_person_id());
|
||||
msgApi.sendMsg(content, List.of(user.getLoginname()));
|
||||
} else if (!afterStateCode.equals(successCode)) {
|
||||
//发送微信提醒审核人
|
||||
//查询状态码对应的审核人
|
||||
Sql sql = Sqls.create("""
|
||||
select userId,u.loginname,u.username from audit_state_user asu
|
||||
left join `user` u on u.id = asu.userId left join audit_state s on s.stateId=asu.stateId $condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("asu.stateId", "=", afterStateCode);
|
||||
cnd.and("s.stateAuditType", "=", "0");
|
||||
String moduleName = activityCommonService.findModuleNameByActivityId(fetch.getSite_id());
|
||||
if ("infantRoom".equals(moduleName)) {
|
||||
//获取当前登录人的单位id
|
||||
String unitId = ShiroUtil.getPrincipalProperty("unitid").toString();
|
||||
cnd.and("u.unitid", "=", unitId);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<Record> list = siteReserveService.list(sql);
|
||||
|
||||
for (Record item : list) {
|
||||
String content = "%s老师您好!%s老师预约%s日使用%s,请您通过门户网站或企业微信登录智慧工会平台进行审核。"
|
||||
.formatted(item.getString("username"),
|
||||
fetch.getReserve_person(),
|
||||
days,
|
||||
siteInfo.getName());
|
||||
msgApi.sendMsg(content, List.of(item.getString("loginname")));
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -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.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.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;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/12/4 9:31
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/audit")
|
||||
@RequiresAuthentication
|
||||
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
|
||||
public Object pageData(PageForm page, boolean state, 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.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
|
||||
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,121 @@
|
||||
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")
|
||||
@RequiresAuthentication
|
||||
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("activityScopeGroupId") String activityScopeGroupId) {
|
||||
if (StrUtil.isBlank(activityScopeGroupId)) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.unionname AS unionName,
|
||||
count( u.id ) AS unionNum,
|
||||
ROUND(count( u.id ) * 0.5) AS limitNum
|
||||
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 AS unionName,
|
||||
( SELECT count( 1 ) FROM `user` WHERE id IN ( SELECT userid FROM activity_user_scope WHERE groupId = @activityScopeGroupId ) AND unionId = gh.id ) as unionNum,
|
||||
ROUND( count( u.id ) * 0.5 ) AS limitNum
|
||||
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,260 @@
|
||||
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.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.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.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.io.InputStream;
|
||||
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")
|
||||
@RequiresAuthentication
|
||||
public class ActivityUnionManageController {
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@Inject
|
||||
private ActivityTissueService activityTissueService;
|
||||
|
||||
@Inject("Sys_user")
|
||||
private ViService<Sys_user> sysUserService;
|
||||
|
||||
@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
|
||||
public Object pageData(PageForm page, String year, String name, String unionId, Integer type) {
|
||||
return activityTissueService.pageData(page, year, name, unionId, type);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findUser(String serachWord, 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
|
||||
public Object doAdd(@Param("tissue") ActivityTissue tissue) {
|
||||
tissue.setApplyTime(DateUtil.getDate());
|
||||
if (tissue.getType() == 40002) {
|
||||
tissue.setUnionId(Vi.getUnionId());
|
||||
} else if (tissue.getType() == 40003) {
|
||||
tissue.setClubId(vi.getClubId());
|
||||
}
|
||||
tissue.setState(tissue.getType() == 40001?3:1);
|
||||
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();
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doEdit(@Param("tissue") ActivityTissue tissue) {
|
||||
activityTissueService.doEdit(tissue);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDelete(String id) {
|
||||
activityTissueService.doDelete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findOne(String id) {
|
||||
return activityTissueService.findOne(id);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object searchTissueUser(String id, 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
|
||||
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();
|
||||
|
||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/activity/tissue.docx");
|
||||
XWPFTemplate.compile(inputStream, config).render(nutMap, response.getOutputStream());
|
||||
inputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void doExportUser(String id, HttpServletResponse response) throws IOException {
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tissueId", "=", id);
|
||||
|
||||
List<ActivityTissuePerson> tissuePeople = tissuePersonService.query(cnd);
|
||||
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));
|
||||
try {
|
||||
ViTool.excelResponse(response, "参赛人数.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, tissuePeople);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-08 16:08
|
||||
* @description: 分工会活动计划管理
|
||||
**/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/plan")
|
||||
@RequiresAuthentication
|
||||
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
|
||||
public Object pageData(PageForm page, String year, String name, String tissueId, Integer type) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("ap.type", "=", type);
|
||||
return activityPlanService.pageData(page, year, name, tissueId, cnd);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAdd(String name, String time, String content, String event, String type, Double money, 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
|
||||
public Object doEdit(ActivityPlan activityPlan) {
|
||||
activityPlanService.updateIgnoreNull(activityPlan);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDelete(String id) {
|
||||
activityPlanService.delete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findOne(String id) {
|
||||
return activityPlanService.fetch(id);
|
||||
}
|
||||
}
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
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.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 {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private FtpService ftpService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private ActivityYearSummaryService activityYearSummaryService;
|
||||
|
||||
private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@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
|
||||
public Object pageData(String year, String tissueId, String summaryType, Integer pageSize, Integer pageNumber, 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")
|
||||
@RequiresAuthentication
|
||||
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
|
||||
@RequiresAuthentication
|
||||
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
|
||||
@RequiresAuthentication
|
||||
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.CLUB_FZR));
|
||||
List<Record> list = baseService.list(sql);
|
||||
List<String> stids = list.stream().map(x -> x.getString("stid")).collect(Collectors.toList());
|
||||
return stids;
|
||||
}
|
||||
}
|
||||
@@ -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,85 @@
|
||||
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.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,67 @@
|
||||
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.DOUBLE)
|
||||
private Double money;
|
||||
|
||||
@Column
|
||||
@Comment("计划类型(1-校活动、2-分工会活动、3协会社团活动)")
|
||||
@ColDefine(customType = "int")
|
||||
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,190 @@
|
||||
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(customType = "int")
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
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 = 50)
|
||||
private String applyDate;
|
||||
|
||||
@Column
|
||||
@Comment("身份(1 运动员 2 教练 3 领队4 处级领导5 替补6 团长)")
|
||||
@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("状态(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;
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
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;
|
||||
|
||||
@One(field = "activityId", key = "id")
|
||||
private ActivitySchool activitySchool;
|
||||
}
|
||||
@@ -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,125 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-12-13 14:19
|
||||
* @description: 活动场地预约信息
|
||||
**/
|
||||
@Data
|
||||
@Table("activity_site_reserve")
|
||||
public class ActivitySiteReserve extends BaseModel {
|
||||
|
||||
@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 site_id;
|
||||
|
||||
@Column
|
||||
@Comment("预约人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String reserve_person;
|
||||
|
||||
@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_unit;
|
||||
|
||||
@Column
|
||||
@Comment("预约人联系方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String reserve_person_phone;
|
||||
|
||||
@Column
|
||||
@Comment("预约事由")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
private String reserve_cause;
|
||||
|
||||
@Column
|
||||
@Comment("预约状态id")
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
private Integer reserve_state;
|
||||
|
||||
@Column
|
||||
@Comment("预约日期(天)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String reserve_day;
|
||||
|
||||
@Column
|
||||
@Comment("预约开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String start_time;
|
||||
|
||||
@Column
|
||||
@Comment("预约结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String end_time;
|
||||
|
||||
@Column
|
||||
@Comment("场地管理员id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String site_manager_id;
|
||||
|
||||
@Column
|
||||
@Comment("场地管理员审核时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String site_manager_time;
|
||||
|
||||
@Column
|
||||
@Comment("场地管理员退回理由")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String back_out_opinion;
|
||||
|
||||
@Column
|
||||
@Comment("主席审核人id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String chairman_review_person;
|
||||
|
||||
@Column
|
||||
@Comment("主席审核时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String chairman_review_time;
|
||||
|
||||
@Column
|
||||
@Comment("主席审核意见")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String chairman_review_opinion;
|
||||
|
||||
@Column
|
||||
@Comment("审核记录")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private List<NutMap> auditList;
|
||||
|
||||
@Column
|
||||
@Comment("反馈意见")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String back_option;
|
||||
|
||||
@Column
|
||||
@Comment("申请id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String sqid;
|
||||
|
||||
@Column
|
||||
@Comment("参与人员")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String joinUser;
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
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.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;
|
||||
|
||||
@Many(field = "tissueId")
|
||||
private List<ActivityTissuePerson> tissuePersonList;
|
||||
|
||||
@Many(field = "reid")
|
||||
private List<Goods> goods;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
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 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;
|
||||
|
||||
}
|
||||
@@ -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,72 @@
|
||||
package io.v.nutz.activity.models;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.data.constant.ConditionalOperational;
|
||||
import io.v.nutz.data.constant.MatchMethod;
|
||||
import lombok.Data;
|
||||
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.hasRole("H04")) {
|
||||
cnd.and("tissueId", "in", vi.getMangeUnionStr());
|
||||
} else if (ShiroUtil.hasRole("H02")) {
|
||||
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,181 @@
|
||||
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.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.hasRole("H04")) {
|
||||
cnd.and("tissue.unionId", "in", vi.getMangeUnionStr());
|
||||
} else if (ShiroUtil.hasRole("H02")) {
|
||||
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_WECHAT_ACCESS_TOKEN = "wx:token:";
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package io.v.nutz.base.field;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import org.nutz.dao.FieldFilter;
|
||||
|
||||
/**
|
||||
* Todo
|
||||
*
|
||||
* @author : 1V
|
||||
* @date : 2021-03-25
|
||||
* @since :
|
||||
*/
|
||||
public interface FieldFilterUtil {
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param type type
|
||||
* @param fields fields
|
||||
* @return FieldFilter
|
||||
*/
|
||||
static FieldFilter create(Class<?> type, Iterable<String> fields) {
|
||||
return create(type, String.format("^%s$", Joiner.on("|").join(fields)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param type type
|
||||
* @param regex regex
|
||||
* @return FieldFilter
|
||||
*/
|
||||
static FieldFilter create(Class<?> type, String regex) {
|
||||
return FieldFilter.create(type, regex);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.v.nutz.base.field;
|
||||
|
||||
import io.v.nutz.sys.models.User;
|
||||
import org.nutz.dao.FieldFilter;
|
||||
|
||||
/**
|
||||
* Todo
|
||||
*
|
||||
* @author : 1V
|
||||
* @date : 2021-03-25
|
||||
* @since :
|
||||
*/
|
||||
public interface UserField {
|
||||
|
||||
FieldFilter NAME = FieldFilter.create(User.class, "^username$");
|
||||
|
||||
FieldFilter SIMPLE = FieldFilter.create(User.class, "^loginname|username|sex|mobile|unitname|unionname$");
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package io.v.nutz.base.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.dao.interceptor.annotation.PrevUpdate;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.json.JsonFormat;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.Mvcs;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/21.
|
||||
*/
|
||||
@Data
|
||||
public abstract class BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column
|
||||
@Comment("创建人")
|
||||
@PrevInsert(els = @EL("$me.createdByUid()"))
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* Long不要用ColDefine定义,兼容oracle/mysql,支持2038年以后的时间戳
|
||||
* 13位时间戳哦,不再是11位
|
||||
*/
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@PrevInsert(now = true)
|
||||
private Long createdAt;
|
||||
|
||||
@Column
|
||||
@Comment("修改人")
|
||||
@PrevInsert(els = @EL("$me.updatedByUid()"))
|
||||
@PrevUpdate(els = @EL("$me.updatedByUid()"))
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String updatedBy;
|
||||
|
||||
/**
|
||||
* Long不要用ColDefine定义,兼容oracle/mysql,支持2038年以后的时间戳
|
||||
* 13位时间戳哦,不再是11位
|
||||
*/
|
||||
@Column
|
||||
@Comment("修改时间")
|
||||
@PrevInsert(now = true)
|
||||
@PrevUpdate(now = true)
|
||||
private Long updatedAt;
|
||||
|
||||
@Column
|
||||
@Comment("删除标记")
|
||||
@PrevInsert(els = @EL("$me.flag()"))
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean delFlag;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("opBy")
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
private String opBy;
|
||||
|
||||
@Column
|
||||
@Comment("opAt")
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
private String opAt;
|
||||
|
||||
public String toJsonString() {
|
||||
return Json.toJson(this, JsonFormat.compact());
|
||||
}
|
||||
|
||||
public Boolean flag() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String createdByUid() {
|
||||
String uid = getCreatedBy();
|
||||
if (Strings.isNotBlank(uid)) {
|
||||
return uid;
|
||||
}
|
||||
try {
|
||||
HttpServletRequest request = Mvcs.getReq();
|
||||
if (request != null) {
|
||||
return Strings.sNull(request.getSession(true).getAttribute("platform_uid"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String updatedByUid() {
|
||||
String uid = getUpdatedBy();
|
||||
if (Strings.isNotBlank(uid)) {
|
||||
return uid;
|
||||
}
|
||||
try {
|
||||
HttpServletRequest request = Mvcs.getReq();
|
||||
if (request != null) {
|
||||
return Strings.sNull(request.getSession(true).getAttribute("platform_uid"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package io.v.nutz.base.page;
|
||||
|
||||
import org.nutz.dao.pager.Pager;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 指定偏移量及大小的Pager, 这样就不会受限于原生Pager的offset=(pageNumber-1)*pageSize
|
||||
*
|
||||
* @author wendal
|
||||
*/
|
||||
|
||||
public class OffsetPager extends Pager implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1385308131663113162L;
|
||||
|
||||
protected int offset = -1;
|
||||
|
||||
protected OffsetPager() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建一个指定偏移量及大小的Pager
|
||||
*
|
||||
* @param offset 偏移量
|
||||
* @param size 数据大小
|
||||
*/
|
||||
public OffsetPager(int offset, int size) {
|
||||
super();
|
||||
this.offset = offset;
|
||||
setPageSize(size);
|
||||
}
|
||||
|
||||
/**
|
||||
* 覆盖超类的计算得到的offset
|
||||
*/
|
||||
public int getOffset() {
|
||||
if (offset > -1)
|
||||
return offset;
|
||||
return super.getOffset();
|
||||
}
|
||||
|
||||
public void setOffset(int offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package io.v.nutz.base.page;
|
||||
|
||||
public interface Paginable {
|
||||
|
||||
/**
|
||||
* 总记录数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getTotalCount();
|
||||
|
||||
/**
|
||||
* 总页数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getTotalPage();
|
||||
|
||||
/**
|
||||
* 每页记录数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getPageSize();
|
||||
|
||||
/**
|
||||
* 当前页号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getPageNo();
|
||||
|
||||
/**
|
||||
* 是否第一页
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isFirstPage();
|
||||
|
||||
/**
|
||||
* 是否最后一页
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isLastPage();
|
||||
|
||||
/**
|
||||
* 返回下页的页号
|
||||
*/
|
||||
public int getNextPage();
|
||||
|
||||
/**
|
||||
* 返回上页的页号
|
||||
*/
|
||||
public int getPrePage();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package io.v.nutz.base.page;
|
||||
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Pagination extends SimplePage implements java.io.Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Pagination() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造器
|
||||
*
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 每页几条数据
|
||||
* @param totalCount 总共几条数据
|
||||
*/
|
||||
public Pagination(int pageNo, int pageSize, int totalCount) {
|
||||
super(pageNo, pageSize, totalCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造器
|
||||
*
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 每页几条数据
|
||||
* @param totalCount 总共几条数据
|
||||
* @param list 分页内容
|
||||
*/
|
||||
public Pagination(int pageNo, int pageSize, int totalCount, List list) {
|
||||
super(pageNo, pageSize, totalCount);
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 第一条数据位置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getFirstResult() {
|
||||
return (pageNo - 1) * pageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前页的数据
|
||||
*/
|
||||
private List list;
|
||||
|
||||
/**
|
||||
* 获得分页内容
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public <T> List<T> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param classOfT 列表容器內的元素类型
|
||||
* @param <T> 列表容器內的元素类型
|
||||
* @return
|
||||
*/
|
||||
public <T> List<T> getList(Class<T> classOfT) {
|
||||
return Lang.collection2list(list, classOfT);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置分页内容
|
||||
*
|
||||
* @param list
|
||||
*/
|
||||
public void setList(List list) {
|
||||
this.list = list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
package io.v.nutz.base.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SimplePage implements java.io.Serializable, Paginable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static final int DEF_COUNT = 10;
|
||||
private List<Integer> localArrayList = new ArrayList<Integer>();
|
||||
|
||||
public List<Integer> getSegment() {
|
||||
return localArrayList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查页码 checkPageNo
|
||||
*
|
||||
* @param pageNo
|
||||
* @return if pageNo==null or pageNo 小于 1 then return 1 else return pageNo
|
||||
*/
|
||||
public static int cpn(Integer pageNo) {
|
||||
return (pageNo == null || pageNo < 1) ? 1 : pageNo;
|
||||
}
|
||||
|
||||
public SimplePage() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造器
|
||||
*
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 每页几条数据
|
||||
* @param totalCount 总共几条数据
|
||||
*/
|
||||
public SimplePage(int pageNo, int pageSize, int totalCount) {
|
||||
setTotalCount(totalCount);
|
||||
setPageSize(pageSize);
|
||||
setPageNo(pageNo);
|
||||
adjustPageNo();
|
||||
int totalPages = getTotalPage();
|
||||
minPage = minPage < 1 ? 1 : minPage;
|
||||
maxPage = maxPage > totalPages ? totalPages : maxPage;
|
||||
for (int i = minPage; i <= maxPage; i++) {
|
||||
localArrayList.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调整页码,使不超过最大页数
|
||||
*/
|
||||
public void adjustPageNo() {
|
||||
if (pageNo == 1) {
|
||||
return;
|
||||
}
|
||||
int tp = getTotalPage();
|
||||
if (pageNo > tp) {
|
||||
pageNo = tp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得页码
|
||||
*/
|
||||
public int getPageNo() {
|
||||
return pageNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 每页几条数据
|
||||
*/
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 总共几条数据
|
||||
*/
|
||||
public int getTotalCount() {
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 总共几页
|
||||
*/
|
||||
public int getTotalPage() {
|
||||
int totalPage = totalCount / pageSize;
|
||||
if (totalPage == 0 || totalCount % pageSize != 0) {
|
||||
totalPage++;
|
||||
}
|
||||
return totalPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否第一页
|
||||
*/
|
||||
public boolean isFirstPage() {
|
||||
return pageNo <= 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否最后一页
|
||||
*/
|
||||
public boolean isLastPage() {
|
||||
return pageNo >= getTotalPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 下一页页码
|
||||
*/
|
||||
public int getNextPage() {
|
||||
if (isLastPage()) {
|
||||
return pageNo;
|
||||
} else {
|
||||
return pageNo + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上一页页码
|
||||
*/
|
||||
public int getPrePage() {
|
||||
if (isFirstPage()) {
|
||||
return pageNo;
|
||||
} else {
|
||||
return pageNo - 1;
|
||||
}
|
||||
}
|
||||
|
||||
protected int totalCount = 0;
|
||||
protected int pageSize = 20;
|
||||
protected int pageNo = 1;
|
||||
|
||||
/**
|
||||
* if totalCount 小于 0 then totalCount=0
|
||||
*
|
||||
* @param totalCount
|
||||
*/
|
||||
public void setTotalCount(int totalCount) {
|
||||
if (totalCount < 0) {
|
||||
this.totalCount = 0;
|
||||
} else {
|
||||
this.totalCount = totalCount;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* if pageSize 小于 1 then pageSize=DEF_COUNT
|
||||
*
|
||||
* @param pageSize
|
||||
*/
|
||||
public void setPageSize(int pageSize) {
|
||||
if (pageSize < 1) {
|
||||
this.pageSize = DEF_COUNT;
|
||||
} else {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* if pageNo 小于 1 then pageNo=1
|
||||
*
|
||||
* @param pageNo
|
||||
*/
|
||||
public void setPageNo(int pageNo) {
|
||||
if (pageNo < 1) {
|
||||
this.pageNo = 1;
|
||||
} else {
|
||||
this.pageNo = pageNo;
|
||||
}
|
||||
}
|
||||
|
||||
int minPage = pageNo - (int) Math.floor((pageSize - 1) / 2.0D);
|
||||
int maxPage = pageNo + (int) Math.ceil((pageSize - 1) / 2.0D);
|
||||
int totalPage = getTotalPage();
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package io.v.nutz.base.page.datatable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/27.
|
||||
*/
|
||||
public class DataTableColumn implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected String data;
|
||||
protected String name;
|
||||
protected boolean searchable;
|
||||
protected boolean orderable;
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isSearchable() {
|
||||
return searchable;
|
||||
}
|
||||
|
||||
public void setSearchable(boolean searchable) {
|
||||
this.searchable = searchable;
|
||||
}
|
||||
|
||||
public boolean isOrderable() {
|
||||
return orderable;
|
||||
}
|
||||
|
||||
public void setOrderable(boolean orderable) {
|
||||
this.orderable = orderable;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package io.v.nutz.base.page.datatable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/27.
|
||||
*/
|
||||
public class DataTableOrder implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected int column;
|
||||
protected String dir;
|
||||
|
||||
public int getColumn() {
|
||||
return column;
|
||||
}
|
||||
|
||||
public void setColumn(int column) {
|
||||
this.column = column;
|
||||
}
|
||||
|
||||
public String getDir() {
|
||||
return dir;
|
||||
}
|
||||
|
||||
public void setDir(String dir) {
|
||||
this.dir = dir;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package io.v.nutz.base.result;
|
||||
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.json.JsonFormat;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.Mvcs;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/12/21.
|
||||
*/
|
||||
public class Result implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int code;
|
||||
private String msg;
|
||||
private Object data;
|
||||
private long time;
|
||||
|
||||
public Result() {
|
||||
this.time = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public static Result NEW() {
|
||||
return new Result();
|
||||
}
|
||||
|
||||
|
||||
public Result addCode(int code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Result addMsg(String msg) {
|
||||
if (Strings.isBlank(msg) || Mvcs.getActionContext() == null || Mvcs.getActionContext().getRequest() == null || Mvcs.getMessage(Mvcs.getActionContext().getRequest(), msg) == null) {
|
||||
this.msg = Strings.sNull(msg);
|
||||
} else {
|
||||
this.msg = Mvcs.getMessage(Mvcs.getActionContext().getRequest(), msg);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Result addData(Object data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Result(int code, String msg, Object data) {
|
||||
this.code = code;
|
||||
if (Strings.isBlank(msg) || Mvcs.getActionContext() == null || Mvcs.getActionContext().getRequest() == null || Mvcs.getMessage(Mvcs.getActionContext().getRequest(), msg) == null) {
|
||||
this.msg = Strings.sNull(msg);
|
||||
} else {
|
||||
this.msg = Mvcs.getMessage(Mvcs.getActionContext().getRequest(), msg);
|
||||
}
|
||||
this.data = data;
|
||||
this.time = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public static Result success(String content) {
|
||||
return new Result(0, content, null);
|
||||
}
|
||||
|
||||
public static Result success(String content, Object data) {
|
||||
return new Result(0, content, data);
|
||||
}
|
||||
|
||||
public static Result success(Object data) {
|
||||
return new Result(0, "system.success", data);
|
||||
}
|
||||
|
||||
public static Result error(int code, String content) {
|
||||
return new Result(code, content, null);
|
||||
}
|
||||
|
||||
public static Result error(String content) {
|
||||
return new Result(1, content, null);
|
||||
}
|
||||
|
||||
public static Result success() {
|
||||
return new Result(0, "system.success", null);
|
||||
}
|
||||
|
||||
public static Result error() {
|
||||
return new Result(1, "system.error", null);
|
||||
}
|
||||
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public static Result condition(boolean flag) {
|
||||
return flag ? success("system.error") : error("system.error");
|
||||
}
|
||||
|
||||
public String toJsonString() {
|
||||
return Json.toJson(this, JsonFormat.compact());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,914 @@
|
||||
package io.v.nutz.base.service;
|
||||
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.page.datatable.DataTableColumn;
|
||||
import io.v.nutz.base.page.datatable.DataTableOrder;
|
||||
import org.nutz.dao.*;
|
||||
import org.nutz.dao.entity.Entity;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.pager.Pager;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/12/22.
|
||||
*/
|
||||
public interface BaseService<T> {
|
||||
|
||||
Dao dao();
|
||||
|
||||
/**
|
||||
* 获取实体的Entity
|
||||
*
|
||||
* @return 实体的Entity
|
||||
*/
|
||||
Entity<T> getEntity();
|
||||
|
||||
/**
|
||||
* 获取实体类型
|
||||
*
|
||||
* @return 实体类型
|
||||
*/
|
||||
Class<T> getEntityClass();
|
||||
|
||||
/**
|
||||
* 统计符合条件的对象表条数
|
||||
*
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
int count(Condition cnd);
|
||||
|
||||
/**
|
||||
* 统计对象表条数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int count();
|
||||
|
||||
/**
|
||||
* 统计符合条件的记录条数
|
||||
*
|
||||
* @param tableName
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
int count(String tableName, Condition cnd);
|
||||
|
||||
/**
|
||||
* 统计表记录条数
|
||||
*
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
int count(String tableName);
|
||||
|
||||
/**
|
||||
* 自定义SQL统计
|
||||
*
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
int count(Sql sql);
|
||||
|
||||
/**
|
||||
* 通过数字型主键查询对象
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
T fetch(long id);
|
||||
|
||||
/**
|
||||
* 通过字符型主键查询对象
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
T fetch(String id);
|
||||
|
||||
/**
|
||||
* 查询关联表
|
||||
*
|
||||
* @param obj 数据对象,可以是普通对象或集合,但不是类
|
||||
* @param regex 为null查询全部,支持通配符 ^(a|b)$
|
||||
* @return
|
||||
*/
|
||||
<T> T fetchLinks(T obj, String regex);
|
||||
|
||||
/**
|
||||
* 查询关联表
|
||||
*
|
||||
* @param obj 数据对象,可以是普通对象或集合,但不是类
|
||||
* @param regex 为null查询全部,支持通配符 ^(a|b)$
|
||||
* @param cnd 关联字段的过滤(排序,条件语句,分页等)
|
||||
* @return
|
||||
*/
|
||||
<T> T fetchLinks(T obj, String regex, Condition cnd);
|
||||
|
||||
|
||||
/**
|
||||
* 查出符合条件的第一条记录
|
||||
*
|
||||
* @param cnd 查询条件
|
||||
* @return 实体, 如不存在则为null
|
||||
*/
|
||||
T fetch(Condition cnd);
|
||||
|
||||
/**
|
||||
* 复合主键专用
|
||||
*
|
||||
* @param pks 键值
|
||||
* @return 对象 T
|
||||
*/
|
||||
T fetchx(Object... pks);
|
||||
|
||||
/**
|
||||
* 复合主键专用
|
||||
*
|
||||
* @param pks 键值
|
||||
* @return 对象 T
|
||||
*/
|
||||
boolean exists(Object... pks);
|
||||
|
||||
/**
|
||||
* 将一个对象插入到一个数据库
|
||||
*
|
||||
* @param obj 要被插入的对象
|
||||
* 它可以是:
|
||||
* 普通 POJO
|
||||
* 集合
|
||||
* 数组
|
||||
* Map
|
||||
* 注意:如果是集合,数组或者 Map,所有的对象必须类型相同,否则可能会出错
|
||||
* @return 插入后的对象
|
||||
*/
|
||||
<T> T insert(T obj);
|
||||
|
||||
/**
|
||||
* 将一个对象按FieldFilter过滤后,插入到一个数据源。
|
||||
* <p>
|
||||
* <code>dao.insert(pet, FieldFilter.create(Pet.class, FieldMatcher.create(false)));</code>
|
||||
*
|
||||
* @param obj 要被插入的对象
|
||||
* @param filter 字段过滤器, 其中FieldMatcher.isIgnoreId生效
|
||||
* @return 插入后的对象
|
||||
* @see Dao#insert(Object)
|
||||
*/
|
||||
<T> T insert(T obj, FieldFilter filter);
|
||||
|
||||
/**
|
||||
* 根据对象的主键(@Id/@Name/@Pk)先查询, 如果存在就更新, 不存在就插入
|
||||
*
|
||||
* @param obj 对象
|
||||
* @return 原对象
|
||||
*/
|
||||
<T> T insertOrUpdate(T obj);
|
||||
|
||||
/**
|
||||
* 根据对象的主键(@Id/@Name/@Pk)先查询, 如果存在就更新, 不存在就插入
|
||||
*
|
||||
* @param obj 对象
|
||||
* @param insertFieldFilter 插入时的字段过滤, 可以是null
|
||||
* @param updateFieldFilter 更新时的字段过滤,可以是null
|
||||
* @return 原对象
|
||||
*/
|
||||
<T> T insertOrUpdate(T obj, FieldFilter insertFieldFilter, FieldFilter updateFieldFilter);
|
||||
|
||||
/**
|
||||
* 自由的向一个数据表插入一条数据
|
||||
*
|
||||
* @param tableName 表名
|
||||
* @param chain 数据名值链
|
||||
*/
|
||||
void insert(String tableName, Chain chain);
|
||||
|
||||
/**
|
||||
* 快速插入一个对象,对象的 '@Prev' 以及 '@Next' 在这个函数里不起作用
|
||||
*
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
<T> T fastInsert(T obj);
|
||||
|
||||
/**
|
||||
* 将对象插入数据库同时,也将符合一个正则表达式的所有关联字段关联的对象统统插入相应的数据库
|
||||
* <p>
|
||||
* 关于关联字段更多信息,请参看 '@One' | '@Many' | '@ManyMany' 更多的描述
|
||||
*
|
||||
* @param obj 数据对象
|
||||
* @param regex 正则表达式,描述了什么样的关联字段将被关注。如果为 null,则表示全部的关联字段都会被插入
|
||||
* @return 数据对象本身
|
||||
* @see org.nutz.dao.entity.annotation.One
|
||||
* @see org.nutz.dao.entity.annotation.Many
|
||||
* @see org.nutz.dao.entity.annotation.ManyMany
|
||||
*/
|
||||
<T> T insertWith(T obj, String regex);
|
||||
|
||||
/**
|
||||
* 根据一个正则表达式,仅将对象所有的关联字段插入到数据库中,并不包括对象本身
|
||||
*
|
||||
* @param obj 数据对象
|
||||
* @param regex 正则表达式,描述了什么样的关联字段将被关注。如果为 null,则表示全部的关联字段都会被插入
|
||||
* @return 数据对象本身
|
||||
* @see org.nutz.dao.entity.annotation.One
|
||||
* @see org.nutz.dao.entity.annotation.Many
|
||||
* @see org.nutz.dao.entity.annotation.ManyMany
|
||||
*/
|
||||
<T> T insertLinks(T obj, String regex);
|
||||
|
||||
/**
|
||||
* 将对象的一个或者多个,多对多的关联信息,插入数据表
|
||||
*
|
||||
* @param obj 对象
|
||||
* @param regex 正则表达式,描述了那种多对多关联字段将被执行该操作
|
||||
* @return 对象自身
|
||||
* @see org.nutz.dao.entity.annotation.ManyMany
|
||||
*/
|
||||
<T> T insertRelation(T obj, String regex);
|
||||
|
||||
/**
|
||||
* 更新数据
|
||||
*
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
int update(Object obj);
|
||||
|
||||
/**
|
||||
* 更新数据忽略值为null的字段
|
||||
*
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
int updateIgnoreNull(Object obj);
|
||||
|
||||
/**
|
||||
* 部分更新实体表
|
||||
*
|
||||
* @param chain
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
int update(Chain chain, Condition cnd);
|
||||
|
||||
/**
|
||||
* 部分更新表
|
||||
*
|
||||
* @param tableName
|
||||
* @param chain
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
int update(String tableName, Chain chain, Condition cnd);
|
||||
|
||||
/**
|
||||
* 将对象更新的同时,也将符合一个正则表达式的所有关联字段关联的对象统统更新
|
||||
* <p>
|
||||
* 关于关联字段更多信息,请参看 '@One' | '@Many' | '@ManyMany' 更多的描述
|
||||
*
|
||||
* @param obj 数据对象
|
||||
* @param regex 正则表达式,描述了什么样的关联字段将被关注。如果为 null,则表示全部的关联字段都会被更新
|
||||
* @return 数据对象本身
|
||||
* @see org.nutz.dao.entity.annotation.One
|
||||
* @see org.nutz.dao.entity.annotation.Many
|
||||
* @see org.nutz.dao.entity.annotation.ManyMany
|
||||
*/
|
||||
<T> T updateWith(T obj, String regex);
|
||||
|
||||
/**
|
||||
* 根据一个正则表达式,仅更新对象所有的关联字段,并不包括对象本身
|
||||
*
|
||||
* @param obj 数据对象
|
||||
* @param regex 正则表达式,描述了什么样的关联字段将被关注。如果为 null,则表示全部的关联字段都会被更新
|
||||
* @return 数据对象本身
|
||||
* @see org.nutz.dao.entity.annotation.One
|
||||
* @see org.nutz.dao.entity.annotation.Many
|
||||
* @see org.nutz.dao.entity.annotation.ManyMany
|
||||
*/
|
||||
<T> T updateLinks(T obj, String regex);
|
||||
|
||||
/**
|
||||
* 多对多关联是通过一个中间表将两条数据表记录关联起来。
|
||||
* <p>
|
||||
* 而这个中间表可能还有其他的字段,比如描述关联的权重等
|
||||
* <p>
|
||||
* 这个操作可以让你一次更新某一个对象中多个多对多关联的数据
|
||||
*
|
||||
* @param classOfT 对象类型
|
||||
* @param regex 正则表达式,描述了那种多对多关联字段将被执行该操作
|
||||
* @param chain 针对中间关联表的名值链。
|
||||
* @param cnd 针对中间关联表的 WHERE 条件
|
||||
* @return 共有多少条数据被更新
|
||||
* @see org.nutz.dao.entity.annotation.ManyMany
|
||||
*/
|
||||
int updateRelation(Class<?> classOfT, String regex, Chain chain, Condition cnd);
|
||||
|
||||
/**
|
||||
* 基于版本的更新,版本不一样无法更新到数据
|
||||
*
|
||||
* @param obj 需要更新的对象, 必须有version属性
|
||||
* @return 若更新成功, 大于0, 否则小于0
|
||||
*/
|
||||
int updateWithVersion(Object obj);
|
||||
|
||||
/**
|
||||
* 基于版本的更新,版本不一样无法更新到数据
|
||||
*
|
||||
* @param obj 需要更新的对象, 必须有version属性
|
||||
* @param filter 需要过滤的字段设置
|
||||
* @return 若更新成功, 大于0, 否则小于0
|
||||
*/
|
||||
int updateWithVersion(Object obj, FieldFilter filter);
|
||||
|
||||
/**
|
||||
* 乐观锁, 以特定字段的值作为限制条件,更新对象,并自增该字段.
|
||||
* <p>
|
||||
* 执行的sql如下:
|
||||
* <p>
|
||||
* <code>update t_user set age=30, city="广州", version=version+1 where name="wendal" and version=124;</code>
|
||||
*
|
||||
* @param obj 需要更新的对象, 必须带@Id/@Name/@Pk中的其中一种.
|
||||
* @param fieldFilter 需要过滤的属性. 若设置了哪些字段不更新,那务必确保过滤掉fieldName的字段
|
||||
* @param fieldName 参考字段的Java属性名.默认是"version",可以是任意数值字段
|
||||
* @return 若更新成功, 返回值大于0, 否则小于等于0
|
||||
*/
|
||||
int updateAndIncrIfMatch(Object obj, FieldFilter fieldFilter, String fieldName);
|
||||
|
||||
/**
|
||||
* 获取某个对象,最大的 ID 值,这个对象必须声明了 '@Id'
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getMaxId();
|
||||
|
||||
/**
|
||||
* 通过long主键删除数据
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int delete(long id);
|
||||
|
||||
/**
|
||||
* 通过int主键删除数据
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int delete(int id);
|
||||
|
||||
/**
|
||||
* 通过string主键删除数据
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int delete(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void delete(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void delete(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void delete(String[] ids);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void delete(List<String> ids);
|
||||
|
||||
/**
|
||||
* 清空表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int clear();
|
||||
|
||||
/**
|
||||
* 清空表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int clear(String tableName);
|
||||
|
||||
/**
|
||||
* 按条件清除一组数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int clear(Condition cnd);
|
||||
|
||||
/**
|
||||
* 按条件清除一组数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int clear(String tableName, Condition cnd);
|
||||
|
||||
/**
|
||||
* 伪删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int vDelete(String id);
|
||||
|
||||
/**
|
||||
* 批量伪删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int vDelete(String[] ids);
|
||||
|
||||
/**
|
||||
* 批量伪删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int vDelete(List<String> ids);
|
||||
|
||||
/**
|
||||
* 根据条件进行伪删除
|
||||
*
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
int vDelete(Condition cnd);
|
||||
|
||||
/**
|
||||
* 根据条件进行伪删除
|
||||
*
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
int vDelete(String tableName, Condition cnd);
|
||||
|
||||
/**
|
||||
* 通过LONG主键获取部分字段值
|
||||
*
|
||||
* @param fieldName
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
T getField(String fieldName, long id);
|
||||
|
||||
/**
|
||||
* 通过INT主键获取部分字段值
|
||||
*
|
||||
* @param fieldName
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
T getField(String fieldName, int id);
|
||||
|
||||
/**
|
||||
* 通过NAME主键获取部分字段值
|
||||
*
|
||||
* @param fieldName 支持通配符 ^(a|b)$
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
T getField(String fieldName, String name);
|
||||
|
||||
/**
|
||||
* 通过条件获取部分字段值
|
||||
*
|
||||
* @param fieldName 支持通配符 ^(a|b)$
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
T getField(String fieldName, Condition cnd);
|
||||
|
||||
/**
|
||||
* 查询获取部分字段
|
||||
*
|
||||
* @param fieldName 支持通配符 ^(a|b)$
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
List<T> query(String fieldName, Condition cnd);
|
||||
|
||||
/**
|
||||
* 查询一组对象。你可以为这次查询设定条件
|
||||
*
|
||||
* @param cnd WHERE 条件。如果为 null,将获取全部数据,顺序为数据库原生顺序<br>
|
||||
* 只有在调用这个函数的时候, cnd.limit 才会生效
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<T> query(Condition cnd);
|
||||
|
||||
/**
|
||||
* 获取全部数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<T> query();
|
||||
|
||||
/**
|
||||
* @param cnd 查询条件
|
||||
* @param linkName 关联字段,支持正则 ^(a|b)$
|
||||
* @return
|
||||
*/
|
||||
List<T> query(Condition cnd, String linkName);
|
||||
|
||||
/**
|
||||
* 获取表及关联表全部数据(支持子查询)
|
||||
*
|
||||
* @param cnd 查询条件
|
||||
* @param linkName 关联字段,支持正则 ^(a|b)$
|
||||
* @param linkCnd 关联条件
|
||||
* @return
|
||||
*/
|
||||
List<T> query(Condition cnd, String linkName, Condition linkCnd);
|
||||
|
||||
/**
|
||||
* 获取表及关联表全部数据
|
||||
*
|
||||
* @param linkName 关联字段,支持正则 ^(a|b)$
|
||||
* @return
|
||||
*/
|
||||
List<T> query(String linkName);
|
||||
|
||||
/**
|
||||
* 分页关联字段查询
|
||||
*
|
||||
* @param cnd 查询条件
|
||||
* @param linkName 关联字段,支持正则 ^(a|b)$
|
||||
* @param pager 分页对象
|
||||
* @return
|
||||
*/
|
||||
List<T> query(Condition cnd, String linkName, Pager pager);
|
||||
|
||||
/**
|
||||
* 分页关联字段查询(支持关联条件)
|
||||
*
|
||||
* @param cnd 查询条件
|
||||
* @param linkName 关联字段,支持正则 ^(a|b)$
|
||||
* @param linkCnd 关联条件
|
||||
* @param pager 分页对象
|
||||
* @return
|
||||
*/
|
||||
List<T> query(Condition cnd, String linkName, Condition linkCnd, Pager pager);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param cnd 查询条件
|
||||
* @param pager 分页对象
|
||||
* @return
|
||||
*/
|
||||
List<T> query(Condition cnd, Pager pager);
|
||||
|
||||
/**
|
||||
* 查询获取NutMap对象
|
||||
*
|
||||
* @param keyColumnName 作为key的字段名
|
||||
* @param valueColumnName 作为value的字段名
|
||||
* @param cnd 查询条件
|
||||
* @return
|
||||
*/
|
||||
NutMap query(String keyColumnName, String valueColumnName, Condition cnd);
|
||||
|
||||
/**
|
||||
* 查询获取NutMap对象
|
||||
*
|
||||
* @param tableName 表名
|
||||
* @param keyColumnName 作为key的字段名
|
||||
* @param valueColumnName 作为value的字段名
|
||||
* @param cnd 查询条件
|
||||
* @return
|
||||
*/
|
||||
NutMap query(String tableName, String keyColumnName, String valueColumnName, Condition cnd);
|
||||
|
||||
/**
|
||||
* 计算子节点TREEID
|
||||
*
|
||||
* @param tableName
|
||||
* @param colName
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
String getSubPath(String tableName, String colName, String value);
|
||||
|
||||
/**
|
||||
* 获取TREEID父级
|
||||
*
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
String getParentPath(String path);
|
||||
|
||||
|
||||
/**
|
||||
* 执行一条自定义SQL
|
||||
*
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
Sql execute(Sql sql);
|
||||
|
||||
/**
|
||||
* 自定义SQL返回Record记录集,Record是个MAP但不区分大小写
|
||||
* 别返回Map对象,因为MySql和Oracle中字段名有大小写之分
|
||||
*
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
List<Record> list(Sql sql);
|
||||
|
||||
/**
|
||||
* 自定义SQL返回NutMap记录集,区分大小写
|
||||
*
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> listMap(Sql sql);
|
||||
|
||||
/**
|
||||
* 自定义查询,并返回当前实体类对象
|
||||
*
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
List<T> listEntity(Sql sql);
|
||||
|
||||
/**
|
||||
* 自定义sql获取map key-value
|
||||
*
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
Map getMap(Sql sql);
|
||||
|
||||
/**
|
||||
* 自定义sql获取NutMap key-value
|
||||
*
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
NutMap getNutMap(Sql sql);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination listPage(Integer pageNumber, Condition cnd);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
Pagination listPage(Integer pageNumber, Sql sql);
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询(sql)
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
Pagination listPage(Integer pageNumber, int pageSize, Sql sql);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param sql 查询语句
|
||||
* @param countSql 统计语句
|
||||
* @return
|
||||
*/
|
||||
Pagination listPage(Integer pageNumber, Sql sql, Sql countSql);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param sql 查询语句
|
||||
* @param countSql 统计语句
|
||||
* @return
|
||||
*/
|
||||
Pagination listPage(Integer pageNumber, int pageSize, Sql sql, Sql countSql);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
Pagination listPageMap(Integer pageNumber, Sql sql);
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询(sql)
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
Pagination listPageMap(Integer pageNumber, int pageSize, Sql sql);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param sql 查询语句
|
||||
* @param countSql 统计语句
|
||||
* @return
|
||||
*/
|
||||
Pagination listPageMap(Integer pageNumber, Sql sql, Sql countSql);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param sql 查询语句
|
||||
* @param countSql 统计语句
|
||||
* @return
|
||||
*/
|
||||
Pagination listPageMap(Integer pageNumber, int pageSize, Sql sql, Sql countSql);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param tableName
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination listPage(Integer pageNumber, String tableName, Condition cnd);
|
||||
|
||||
/**
|
||||
* 分页查询(cnd)
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination listPage(Integer pageNumber, int pageSize, Condition cnd);
|
||||
|
||||
/**
|
||||
* 分页查询,获取部分字段(cnd)
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param cnd
|
||||
* @param fieldName 支持通配符 ^(a|b)$
|
||||
* @return
|
||||
*/
|
||||
Pagination listPage(Integer pageNumber, int pageSize, Condition cnd, String fieldName);
|
||||
|
||||
/**
|
||||
* 关联查询
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param cnd
|
||||
* @param linkName 支持通配符 ^(a|b)$
|
||||
* @return
|
||||
*/
|
||||
Pagination listPageLinks(Integer pageNumber, int pageSize, Condition cnd, String linkName);
|
||||
|
||||
/**
|
||||
* 关联查询,带子查询条件
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param cnd
|
||||
* @param linkName 支持通配符 ^(a|b)$
|
||||
* @param subCnd 子查询条件
|
||||
* @return
|
||||
*/
|
||||
Pagination listPageLinks(Integer pageNumber, int pageSize, Condition cnd, String linkName, Condition subCnd);
|
||||
|
||||
/**
|
||||
* 分页查询(tabelName)
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param tableName
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination listPage(Integer pageNumber, int pageSize, String tableName, Condition cnd);
|
||||
|
||||
/**
|
||||
* 分页查询并返回包含实体类内容的NutMap对象
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination listPageMap(Integer pageNumber, Condition cnd);
|
||||
|
||||
/**
|
||||
* 分页查询并返回包含实体类内容的NutMap对象
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination listPageMap(Integer pageNumber, int pageSize, Condition cnd);
|
||||
|
||||
|
||||
/**
|
||||
* DataTable Page
|
||||
*
|
||||
* @param length 页大小
|
||||
* @param start start
|
||||
* @param draw draw
|
||||
* @param orders 排序
|
||||
* @param columns 字段
|
||||
* @param cnd 查询条件
|
||||
* @param linkName 关联查询 支持通配符 ^(a|b)$
|
||||
* @return
|
||||
*/
|
||||
NutMap data(int length, int start, int draw, List<DataTableOrder> orders, List<DataTableColumn> columns, Cnd cnd, String linkName);
|
||||
|
||||
/**
|
||||
* DataTable Page
|
||||
*
|
||||
* @param length 页大小
|
||||
* @param start start
|
||||
* @param draw draw
|
||||
* @param orders 排序
|
||||
* @param columns 字段
|
||||
* @param cnd 查询条件
|
||||
* @param linkName 关联查询 支持通配符 ^(a|b)$
|
||||
* @param subCnd 关联查询条件
|
||||
* @return
|
||||
*/
|
||||
NutMap data(int length, int start, int draw, List<DataTableOrder> orders, List<DataTableColumn> columns, Cnd cnd, String linkName, Cnd subCnd);
|
||||
|
||||
/**
|
||||
* DataTable Page 自定义SQL
|
||||
*
|
||||
* @param length 页大小
|
||||
* @param start start
|
||||
* @param draw draw
|
||||
* @param countSql 统计查询语句
|
||||
* @param orderSql 结果查询语句
|
||||
* @return
|
||||
*/
|
||||
NutMap data(int length, int start, int draw, Sql countSql, Sql orderSql);
|
||||
|
||||
/**
|
||||
* DataTable Page 自定义SQL
|
||||
*
|
||||
* @param length 页大小
|
||||
* @param start start
|
||||
* @param draw draw
|
||||
* @param countSql 统计查询语句
|
||||
* @param orderSql 结果查询语句
|
||||
* @param countOnly 统计查询语句是否只有count()
|
||||
* @return
|
||||
*/
|
||||
NutMap data(int length, int start, int draw, Sql countSql, Sql orderSql, boolean countOnly);
|
||||
|
||||
/**
|
||||
* DataTable Page
|
||||
*
|
||||
* @param length 页大小
|
||||
* @param start start
|
||||
* @param draw draw
|
||||
* @param cnd 查询条件
|
||||
* @param linkName 关联查询 支持通配符 ^(a|b)$
|
||||
* @return
|
||||
*/
|
||||
NutMap data(int length, int start, int draw, Cnd cnd, String linkName);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.v.nutz.base.service;
|
||||
|
||||
import io.v.nutz.service.ViService;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年01月04日 13:55:00
|
||||
*/
|
||||
public interface SimpleService extends ViService {
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
package io.v.nutz.base.service.impl;
|
||||
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年01月04日 13:55:00
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SimpleServiceImpl extends ViServiceImpl implements SimpleService {
|
||||
public SimpleServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package io.v.nutz.base.utils;
|
||||
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.nutz.lang.Times;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/24.
|
||||
*/
|
||||
public class DateUtil {
|
||||
private static final Locale DEFAULT_LOCALE = Locale.CHINA;
|
||||
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
public static Integer getYear() {
|
||||
return Calendar.getInstance().get(Calendar.YEAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间(HH:mm:ss)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getDate() {
|
||||
return DateFormatUtils.format(new Date(), "yyyy-MM-dd", DEFAULT_LOCALE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间(HH:mm:ss)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getTime() {
|
||||
return DateFormatUtils.format(new Date(), "HH:mm:ss", DEFAULT_LOCALE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间(yyyy-MM-dd HH:mm:ss)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getDateTime() {
|
||||
return DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss", DEFAULT_LOCALE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换日期格式(yyyy-MM-dd HH:mm:ss)
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String formatDateTime(Date date) {
|
||||
if (date == null) return "";
|
||||
return DateFormatUtils.format(date, "yyyy-MM-dd HH:mm:ss", DEFAULT_LOCALE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换日期格式(yyyy-MM-dd HH:mm:ss)
|
||||
*
|
||||
* @param date
|
||||
* @param f
|
||||
* @return
|
||||
*/
|
||||
public static String format(Date date, String f) {
|
||||
if (date == null) return "";
|
||||
return DateFormatUtils.format(date, f, DEFAULT_LOCALE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间戳日期
|
||||
*
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
public static String getDate(long time) {
|
||||
return DateFormatUtils.format(new Date(time * 1000), "yyyy-MM-dd HH:mm:ss", DEFAULT_LOCALE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间戳日期
|
||||
*
|
||||
* @param time
|
||||
* @param f
|
||||
* @return
|
||||
*/
|
||||
public static String getDate(long time, String f) {
|
||||
return DateFormatUtils.format(new Date(time * 1000), f, DEFAULT_LOCALE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过字符串时间获取时间戳 nutzwk5.0改为long
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static long getTime(String date) {
|
||||
try {
|
||||
return Times.parse(sdf, date).getTime() / 1000;
|
||||
} catch (ParseException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过字符串时间获取时间戳 nutzwk5.0改为long
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static long getTime(SimpleDateFormat sdf, String date) {
|
||||
try {
|
||||
return Times.parse(sdf, date).getTime() / 1000;
|
||||
} catch (ParseException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过字符串时间转时间戳
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static long formatDate(String data) {
|
||||
try {
|
||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(data).getTime();
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package io.v.nutz.base.utils;
|
||||
|
||||
import com.artofsolving.jodconverter.DocumentConverter;
|
||||
import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection;
|
||||
import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection;
|
||||
import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* 文档转换util
|
||||
*/
|
||||
public class DocConverter {
|
||||
private static final int environment = 1;// 环境1:windows,2:linux(涉及pdf2swf路径问题)
|
||||
private String fileString;
|
||||
private String outputPath = "";// 输入路径,如果不设置就输出在默认位置
|
||||
private String fileName;
|
||||
private File pdfFile;
|
||||
private File swfFile;
|
||||
private File docFile;
|
||||
|
||||
public DocConverter(String fileString) {
|
||||
ini(fileString);
|
||||
}
|
||||
|
||||
/*
|
||||
* 重新设置 file @param fileString
|
||||
*/
|
||||
public void setFile(String fileString) {
|
||||
ini(fileString);
|
||||
}
|
||||
|
||||
/*
|
||||
* 初始化 @param fileString
|
||||
*/
|
||||
private void ini(String fileString) {
|
||||
this.fileString = fileString;
|
||||
fileName = fileString.substring(0, fileString.lastIndexOf("."));
|
||||
docFile = new File(fileString);
|
||||
pdfFile = new File(fileName + ".pdf");
|
||||
swfFile = new File(fileName + ".swf");
|
||||
}
|
||||
|
||||
/*
|
||||
* 转为PDF @param file
|
||||
*/
|
||||
private void doc2pdf() throws Exception {
|
||||
if (docFile.exists()) {
|
||||
if (!pdfFile.exists()) {
|
||||
OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
|
||||
try {
|
||||
connection.connect();
|
||||
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
|
||||
converter.convert(docFile, pdfFile);
|
||||
// close the connection
|
||||
connection.disconnect();
|
||||
System.out.println("****pdf转换成功,PDF输出:" + pdfFile.getPath() + "****");
|
||||
} catch (java.net.ConnectException e) {
|
||||
// ToDo Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
System.out.println("****swf转换异常,openoffice服务未启动!****");
|
||||
throw e;
|
||||
} catch (com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("****swf转换器异常,读取转换文件失败****");
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
} else {
|
||||
System.out.println("****已经转换为pdf,不需要再进行转化****");
|
||||
}
|
||||
} else {
|
||||
System.out.println("****swf转换器异常,需要转换的文档不存在,无法转换****");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 转换成swf
|
||||
*/
|
||||
private void pdf2swf() throws Exception {
|
||||
Runtime r = Runtime.getRuntime();
|
||||
if (!swfFile.exists()) {
|
||||
if (pdfFile.exists()) {
|
||||
if (environment == 1)// windows环境处理
|
||||
{
|
||||
try {
|
||||
// 这里根据SWFTools安装路径需要进行相应更改
|
||||
Process p = r.exec("D:\\ewm\\hj\\pdf2swf\\pdf2swf.exe " + pdfFile.getPath() + " -o " + swfFile.getPath() + " -T 9");
|
||||
System.out.print(loadStream(p.getInputStream()));
|
||||
System.err.print(loadStream(p.getErrorStream()));
|
||||
System.out.print(loadStream(p.getInputStream()));
|
||||
System.err.println("****swf转换成功,文件输出:" + swfFile.getPath() + "****");
|
||||
// if (pdfFile.exists()) {
|
||||
// pdfFile.delete();
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
} else if (environment == 2)// linux环境处理
|
||||
{
|
||||
try {
|
||||
Process p = r.exec("pdf2swf " + pdfFile.getPath() + " -o " + swfFile.getPath() + " -T 9");
|
||||
System.out.print(loadStream(p.getInputStream()));
|
||||
System.err.print(loadStream(p.getErrorStream()));
|
||||
System.err.println("****swf转换成功,文件输出:" + swfFile.getPath() + "****");
|
||||
if (pdfFile.exists()) {
|
||||
pdfFile.delete();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("****pdf不存在,无法转换****");
|
||||
}
|
||||
} else {
|
||||
System.out.println("****swf已存在不需要转换****");
|
||||
}
|
||||
}
|
||||
|
||||
static String loadStream(InputStream in) throws IOException {
|
||||
int ptr = 0;
|
||||
//把InputStream字节流 替换为BufferedReader字符流 2013-07-17修改
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
while ((ptr = reader.read()) != -1) {
|
||||
buffer.append((char) ptr);
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/*
|
||||
* 转换主方法
|
||||
*/
|
||||
public boolean conver() {
|
||||
if (swfFile.exists()) {
|
||||
System.out.println("****swf转换器开始工作,该文件已经转换为swf****");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (environment == 1) {
|
||||
System.out.println("****swf转换器开始工作,当前设置运行环境windows****");
|
||||
} else {
|
||||
System.out.println("****swf转换器开始工作,当前设置运行环境linux****");
|
||||
}
|
||||
|
||||
try {
|
||||
doc2pdf();
|
||||
pdf2swf();
|
||||
} catch (Exception e) {
|
||||
// TODO: Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (swfFile.exists()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 返回文件路径 @param s
|
||||
*/
|
||||
public String getswfPath() {
|
||||
if (swfFile.exists()) {
|
||||
String tempString = swfFile.getPath();
|
||||
tempString = tempString.replaceAll("\\\\", "/");
|
||||
return tempString;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 设置输出路径
|
||||
*/
|
||||
public void setOutputPath(String outputPath) {
|
||||
this.outputPath = outputPath;
|
||||
if (!outputPath.equals("")) {
|
||||
String realName = fileName.substring(fileName.lastIndexOf("/"), fileName.lastIndexOf("."));
|
||||
if (outputPath.charAt(outputPath.length()) == '/') {
|
||||
swfFile = new File(outputPath + realName + ".swf");
|
||||
} else {
|
||||
swfFile = new File(outputPath + realName + ".swf");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String s[]) {
|
||||
DocConverter d = new DocConverter("C:\\Users\\mayn\\Desktop\\安全管理系统.docx");
|
||||
d.conver();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package io.v.nutz.base.utils;
|
||||
|
||||
import cn.hutool.extra.mail.MailAccount;
|
||||
import cn.hutool.extra.mail.MailUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/7/20 13:42
|
||||
*/
|
||||
@IocBean
|
||||
@Slf4j
|
||||
public class EmailUtil {
|
||||
|
||||
public void send(@Param("email") String email, String content, boolean isHtml, File... files) {
|
||||
try {
|
||||
MailAccount account = new MailAccount();
|
||||
account.setHost("smtp.163.com");
|
||||
account.setPort(25);
|
||||
account.setSslEnable(false);
|
||||
account.setStarttlsEnable(false);
|
||||
account.setAuth(true);
|
||||
account.setFrom("87785588@163.com");
|
||||
account.setUser("87785588@163");
|
||||
account.setPass("NMRRJRHMTCOOLPQV");
|
||||
String msgId = MailUtil.send(account, email, "智慧工会", content, isHtml,files);
|
||||
log.debug("邮件发送状态:{},id:{}", "发送成功", msgId);
|
||||
} catch (Exception e) {
|
||||
log.debug("邮件发送异常信息:{}", e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
package io.v.nutz.base.utils;
|
||||
|
||||
|
||||
|
||||
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
public class ExcelUtil {
|
||||
/**
|
||||
* 导出Excel
|
||||
* @param sheetName sheet名称
|
||||
* @param title 标题
|
||||
* @param values 内容
|
||||
* @param wb HSSFWorkbook对象
|
||||
* @return
|
||||
*/
|
||||
public static HSSFWorkbook getHSSFWorkbook(String sheetName, String []title, String [][]values, HSSFWorkbook wb){
|
||||
|
||||
// 第一步,创建一个HSSFWorkbook,对应一个Excel文件
|
||||
if(wb == null){
|
||||
wb = new HSSFWorkbook();
|
||||
}
|
||||
|
||||
// 第二步,在workbook中添加一个sheet,对应Excel文件中的sheet
|
||||
HSSFSheet sheet = wb.createSheet(sheetName);
|
||||
// sheet.setColumnWidth(0, 3766);
|
||||
|
||||
// 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
|
||||
HSSFRow row = sheet.createRow(0);
|
||||
|
||||
// 第四步,创建单元格,并设置值表头 设置表头居中
|
||||
HSSFCellStyle style = wb.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
/*style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
|
||||
style.setBorderTop(HSSFCellStyle.BORDER_THIN); //上边框
|
||||
style.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框
|
||||
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);//左边框
|
||||
style.setBorderRight(HSSFCellStyle.BORDER_THIN);//右边框*/
|
||||
|
||||
HSSFFont font = wb.createFont();
|
||||
font.setFontName("黑体");
|
||||
font.setFontHeightInPoints((short) 12);//设置字体大小
|
||||
|
||||
style.setFont(font);
|
||||
|
||||
//声明列对象
|
||||
HSSFCell cell = null;
|
||||
|
||||
//创建标题
|
||||
for(int i=0;i<title.length;i++){
|
||||
cell = row.createCell(i);
|
||||
cell.setCellValue(title[i]);
|
||||
cell.setCellStyle(style);
|
||||
sheet.autoSizeColumn(i);
|
||||
sheet.setColumnWidth(i, sheet.getColumnWidth(i) * 35 / 10);
|
||||
}
|
||||
|
||||
HSSFCellStyle style1 = wb.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
//style1.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
||||
//创建内容
|
||||
for(int i=0;i<values.length;i++){
|
||||
row = sheet.createRow(i + 1);
|
||||
for(int j=0;j<values[i].length;j++){
|
||||
HSSFCell cellx = row.createCell(j);
|
||||
//将内容按顺序赋给对应的列对象
|
||||
cellx.setCellValue(values[i][j]);
|
||||
//样式
|
||||
cellx.setCellStyle(style1);
|
||||
}
|
||||
}
|
||||
return wb;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出Excel
|
||||
* @param sheetName sheet名称
|
||||
* @param title 标题
|
||||
* @param values 内容
|
||||
* @param wb HSSFWorkbook对象
|
||||
* @return
|
||||
*/
|
||||
public static HSSFWorkbook getHSSFWorkbook2(String sheetName,String bigTitle,int bigTitleHbColumn, String []title, String [][]values, HSSFWorkbook wb){
|
||||
|
||||
|
||||
if(wb == null){
|
||||
wb = new HSSFWorkbook();
|
||||
}
|
||||
|
||||
HSSFSheet sheet = wb.createSheet(sheetName);
|
||||
|
||||
HSSFRow row0 = sheet.createRow(0);
|
||||
HSSFCellStyle style0 = wb.createCellStyle();
|
||||
style0.setAlignment(HorizontalAlignment.CENTER);
|
||||
/*style0.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
|
||||
style0.setBorderTop(HSSFCellStyle.BORDER_THIN); //上边框
|
||||
style0.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框
|
||||
style0.setBorderLeft(HSSFCellStyle.BORDER_THIN);//左边框
|
||||
style0.setBorderRight(HSSFCellStyle.BORDER_THIN);//右边框*/
|
||||
HSSFFont font0 = wb.createFont();
|
||||
font0.setFontName("黑体");
|
||||
font0.setFontHeightInPoints((short) 20);//设置字体大小
|
||||
style0.setFont(font0);
|
||||
HSSFCell cell0 = row0.createCell(0);
|
||||
cell0.setCellStyle(style0);
|
||||
cell0.setCellValue(bigTitle);
|
||||
|
||||
|
||||
HSSFRow row1 = sheet.createRow(1);
|
||||
HSSFCellStyle style1 = wb.createCellStyle();
|
||||
style1.setAlignment(HorizontalAlignment.CENTER);
|
||||
/*style1.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
|
||||
style1.setBorderTop(HSSFCellStyle.BORDER_THIN); //上边框
|
||||
style1.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框
|
||||
style1.setBorderLeft(HSSFCellStyle.BORDER_THIN);//左边框
|
||||
style1.setBorderRight(HSSFCellStyle.BORDER_THIN);//右边框*/
|
||||
HSSFFont font1 = wb.createFont();
|
||||
font1.setFontName("黑体");
|
||||
font1.setFontHeightInPoints((short) 12);//设置字体大小
|
||||
style1.setFont(font1);
|
||||
|
||||
|
||||
//声明列对象
|
||||
HSSFCell cell = null;
|
||||
|
||||
//创建标题
|
||||
for(int i=0;i<title.length;i++){
|
||||
cell = row1.createCell(i);
|
||||
cell.setCellValue(title[i]);
|
||||
cell.setCellStyle(style1);
|
||||
/* sheet.autoSizeColumn(i);*/
|
||||
sheet.setColumnWidth(i, sheet.getColumnWidth(i) * 35 / 10);
|
||||
}
|
||||
//setSizeColumn(sheet,title.length);
|
||||
|
||||
|
||||
HSSFCellStyle style2 = wb.createCellStyle();
|
||||
/* style2.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式*/
|
||||
style2.setAlignment(HorizontalAlignment.CENTER);
|
||||
HSSFFont font2 = wb.createFont();
|
||||
font2.setFontName("宋体");
|
||||
font2.setFontHeightInPoints((short) 12);//设置字体大小
|
||||
style2.setFont(font2);
|
||||
|
||||
//创建内容
|
||||
for(int i=0;i<values.length;i++){
|
||||
row1 = sheet.createRow(i + 2);
|
||||
for(int j=0;j<values[i].length;j++){
|
||||
HSSFCell cellx = row1.createCell(j);
|
||||
//将内容按顺序赋给对应的列对象
|
||||
cellx.setCellValue(values[i][j]);
|
||||
//样式
|
||||
cellx.setCellStyle(style2);
|
||||
}
|
||||
}
|
||||
|
||||
CellRangeAddress region = new CellRangeAddress(0, 0, 0, bigTitleHbColumn);
|
||||
sheet.addMergedRegion(region);
|
||||
return wb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 自适应宽度(中文支持)
|
||||
private static void setSizeColumn(HSSFSheet sheet, int size) {
|
||||
for (int columnNum = 0; columnNum < size; columnNum++) {
|
||||
int columnWidth = sheet.getColumnWidth(columnNum) / 256;
|
||||
for (int rowNum = 0; rowNum < sheet.getLastRowNum(); rowNum++) {
|
||||
HSSFRow currentRow;
|
||||
//当前行未被使用过
|
||||
if (sheet.getRow(rowNum) == null) {
|
||||
currentRow = sheet.createRow(rowNum);
|
||||
} else {
|
||||
currentRow = sheet.getRow(rowNum);
|
||||
}
|
||||
|
||||
if (currentRow.getCell(columnNum) != null) {
|
||||
HSSFCell currentCell = currentRow.getCell(columnNum);
|
||||
if (currentCell.getCellType() == CellType.STRING) {
|
||||
int length = currentCell.getStringCellValue().getBytes().length;
|
||||
if (columnWidth < length) {
|
||||
columnWidth = length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sheet.setColumnWidth(columnNum, columnWidth * 256);
|
||||
}
|
||||
}
|
||||
|
||||
public void readExcelFile(InputStream inputStream, String fileName) {
|
||||
|
||||
/**
|
||||
* 这个inputStream文件可以来源于本地文件的流,
|
||||
* 也可以来源与上传上来的文件的流,也就是MultipartFile的流,
|
||||
* 使用getInputStream()方法进行获取。
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 然后再读取文件的时候,应该excel文件的后缀名在不同的版本中对应的解析类不一样
|
||||
* 要对fileName进行后缀的解析
|
||||
*/
|
||||
Workbook workbook = null;
|
||||
try {
|
||||
//判断什么类型文件
|
||||
if (fileName.endsWith(".xls")) {
|
||||
workbook = new HSSFWorkbook(inputStream);
|
||||
} else if (fileName.endsWith(".xlsx")) {
|
||||
workbook = new XSSFWorkbook(inputStream);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (workbook == null) {
|
||||
return;
|
||||
} else {
|
||||
//获取所有的工作表的的数量
|
||||
int numOfSheet = workbook.getNumberOfSheets();
|
||||
System.out.println(numOfSheet + "--->numOfSheet");
|
||||
//遍历表
|
||||
for (int i = 0; i < numOfSheet; i++) {
|
||||
//获取一个sheet也就是一个工作本。
|
||||
Sheet sheet = workbook.getSheetAt(i);
|
||||
if (sheet == null) {
|
||||
continue;
|
||||
}
|
||||
//获取一个sheet有多少Row
|
||||
int lastRowNum = sheet.getLastRowNum();
|
||||
if (lastRowNum == 0) {
|
||||
continue;
|
||||
}
|
||||
Row row;
|
||||
for (int j = 1; j <= lastRowNum; j++) {
|
||||
row = sheet.getRow(j);
|
||||
if (row == null) {
|
||||
continue;
|
||||
}
|
||||
//获取一个Row有多少Cell
|
||||
short lastCellNum = row.getLastCellNum();
|
||||
for (int k = 0; k <= lastCellNum; k++) {
|
||||
if (row.getCell(k) == null) {
|
||||
continue;
|
||||
}
|
||||
row.getCell(k).setCellType(CellType.STRING);
|
||||
String res = row.getCell(k).getStringCellValue().trim();
|
||||
//打印出cell(单元格的内容)
|
||||
System.out.println(res);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package io.v.nutz.base.utils;
|
||||
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 导出excel Utils
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public class ExcelUtils {
|
||||
private static Configuration configuration = null;
|
||||
private static Map<String, Template> allTemplates = null;
|
||||
private static String realPath = "src/main/resources/ftl";
|
||||
|
||||
public ExcelUtils() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建excel
|
||||
*
|
||||
* @param dataMap
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public static File createExcel(Map<?, ?> dataMap, String type, String valueName) {
|
||||
try {
|
||||
configuration = new Configuration();
|
||||
configuration.setDefaultEncoding("UTF-8");
|
||||
configuration.setDirectoryForTemplateLoading(new File(realPath));
|
||||
allTemplates = new HashMap<String, Template>();
|
||||
allTemplates.put(type, configuration.getTemplate(valueName));
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
String name = "temp" + (int) (Math.random() * 100000) + ".xls";
|
||||
File file = new File(name);
|
||||
Template template = allTemplates.get(type);
|
||||
try {
|
||||
Writer w = new OutputStreamWriter(new FileOutputStream(file), "utf-8");
|
||||
template.process(dataMap, w);
|
||||
w.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package io.v.nutz.base.utils;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author 赵欣雨
|
||||
* @date 2020/8/18 11:35
|
||||
*/
|
||||
@IocBean
|
||||
public class FileService {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private FtpService ftpService;
|
||||
|
||||
/**
|
||||
* @param file 文件
|
||||
* @param id 关联表id
|
||||
* @param filePath 文件主路径
|
||||
*/
|
||||
public void upload(TempFile file, String id, String filePath) {
|
||||
try {
|
||||
String submittedFileName = file.getSubmittedFileName();
|
||||
String fileType = submittedFileName.substring(submittedFileName.lastIndexOf(".")).toLowerCase();
|
||||
String fileName = System.currentTimeMillis() + fileType;
|
||||
ftpService.upload(filePath, fileName, file.getInputStream());
|
||||
Chain fileChain = Chain.make("id", R.UU32()).add("reid", id).add("filename", submittedFileName).add("filepath", filePath + fileName);
|
||||
baseService.insert("sys_file", fileChain);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fileid
|
||||
* @param filePath
|
||||
*/
|
||||
public void delete(String fileid, String filePath) {
|
||||
try {
|
||||
|
||||
Record filedata = baseService.dao().fetch("sys_file", Cnd.where("id", "=", fileid).or("filepath", "=", filePath));
|
||||
|
||||
// baseService.clear("sys_file",Cnd.where("id", "=", filedata.getString("id")));
|
||||
|
||||
if (null == fileid) {
|
||||
baseService.clear("sys_file", Cnd.where("filepath", "=", filedata.getString("filepath")));
|
||||
} else {
|
||||
baseService.clear("sys_file", Cnd.where("id", "=", filedata.getString("id")));
|
||||
}
|
||||
|
||||
// ftpService.delete(filedata.getString("filepath"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package io.v.nutz.base.utils;
|
||||
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author wizzer@qq.com
|
||||
*/
|
||||
public class FileUtil {
|
||||
|
||||
/**
|
||||
* 分页获取文件列表
|
||||
*
|
||||
* @param basePath 目录
|
||||
* @param pageNumber 页码
|
||||
* @param pageSize 页大小
|
||||
* @param sort 按文件名排序
|
||||
* @return 列表
|
||||
* @throws Exception
|
||||
*/
|
||||
public static NutMap readListPage(String basePath, Integer pageNumber, Integer pageSize, String sort)
|
||||
throws Exception {
|
||||
int offset = (pageNumber - 1) * pageSize;
|
||||
int limit = pageNumber * pageSize;
|
||||
long total = 0;
|
||||
List<NutMap> list = new ArrayList<>();
|
||||
Comparator<Path> comparator = Comparator.naturalOrder();
|
||||
if ("desc".equals(sort)) {
|
||||
comparator = Comparator.reverseOrder();
|
||||
}
|
||||
try (Stream<Path> fileList = Files.list(Paths.get(basePath))) {
|
||||
total = fileList.count();
|
||||
}
|
||||
try (Stream<Path> fileList = Files.list(Paths.get(basePath)).sorted(comparator).skip(offset)
|
||||
.limit(limit)) {
|
||||
fileList.forEach(file -> {
|
||||
NutMap nutMap = NutMap.NEW();
|
||||
String fileName = file.getFileName().toString();
|
||||
nutMap.addv("fileName", fileName);
|
||||
if (Files.isDirectory(file.toAbsolutePath())) {
|
||||
nutMap.addv("folder", true);
|
||||
nutMap.addv("suffix", "folder");
|
||||
} else {
|
||||
String suffix = fileName.substring(fileName.indexOf(".") + 1).toLowerCase();
|
||||
nutMap.addv("folder", false);
|
||||
nutMap.addv("suffix", suffix);
|
||||
}
|
||||
list.add(nutMap);
|
||||
});
|
||||
return NutMap.NEW().addv("total", total).addv("list", list);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package io.v.nutz.base.utils;
|
||||
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.safety.Whitelist;
|
||||
|
||||
import javax.swing.text.html.HTMLEditorKit;
|
||||
import javax.swing.text.html.parser.ParserDelegator;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-10-12 21:13
|
||||
* @description:
|
||||
**/
|
||||
public class Html2Text extends HTMLEditorKit.ParserCallback {
|
||||
private static Html2Text html2Text = new Html2Text();
|
||||
|
||||
StringBuffer s;
|
||||
|
||||
public Html2Text() {
|
||||
}
|
||||
|
||||
public void parse(String str) throws IOException {
|
||||
|
||||
InputStream iin = new ByteArrayInputStream(str.getBytes());
|
||||
Reader in = new InputStreamReader(iin);
|
||||
s = new StringBuffer();
|
||||
ParserDelegator delegator = new ParserDelegator();
|
||||
delegator.parse(in, this, Boolean.TRUE);
|
||||
iin.close();
|
||||
in.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleText(char[] text, int pos) {
|
||||
s.append(text);
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
public static String getContent(String str) {
|
||||
try {
|
||||
html2Text.parse(str);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return html2Text.getText();
|
||||
}
|
||||
|
||||
public static String toPlainText(String html) {
|
||||
if (StringUtils.isEmpty(html)) {
|
||||
return "";
|
||||
}
|
||||
Document document = Jsoup.parse(html);
|
||||
Document.OutputSettings outputSettings = new Document.OutputSettings().prettyPrint(false);
|
||||
document.outputSettings(outputSettings);
|
||||
document.select("br").append("\\n");
|
||||
document.select("p").prepend("\\n");
|
||||
document.select("p").append("\\n");
|
||||
String newHtml = document.html().replaceAll("\\\\n", "\n");
|
||||
String plainText = Jsoup.clean(newHtml, "", Whitelist.none(), outputSettings);
|
||||
String result = StringEscapeUtils.unescapeHtml(plainText.trim());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package io.v.nutz.base.utils;
|
||||
|
||||
import io.v.nutz.sys.models.Sys_log;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.shiro.token.PlatformCaptchaToken;
|
||||
import io.v.nutz.web.commons.slog.SLogService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.apache.shiro.util.ThreadContext;
|
||||
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.lang.Lang;
|
||||
import org.nutz.lang.Times;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
* @author jug
|
||||
* @date 2023/07/06
|
||||
*/
|
||||
@IocBean
|
||||
public class LoginUtil {
|
||||
|
||||
public enum LoginOrigin {
|
||||
APP, WEB, WEB_H5, CAS, QI_YE_WEI_XIN, WEI_XIN;
|
||||
}
|
||||
|
||||
@Inject
|
||||
private SLogService sLogService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 密码登录
|
||||
*
|
||||
* @param token 令牌
|
||||
* @param request 请求
|
||||
* @param session 会话
|
||||
* @param loginOrigin 登录起源
|
||||
*/
|
||||
public void doLogin(AuthenticationToken token, HttpServletRequest request, HttpSession session, LoginOrigin loginOrigin) {
|
||||
|
||||
//设置登录源
|
||||
PlatformCaptchaToken platformCaptchaToken = (PlatformCaptchaToken) token;
|
||||
platformCaptchaToken.setLoginOrigin(loginOrigin);
|
||||
|
||||
//session失效咯
|
||||
if (token == null) {
|
||||
throw new RuntimeException("login.error.system");
|
||||
}
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
ThreadContext.bind(subject);
|
||||
subject.login(token);
|
||||
Sys_user user = (Sys_user) subject.getPrincipal();
|
||||
int count = user.getLoginCount() == null ? 0 : user.getLoginCount();
|
||||
org.nutz.dao.Chain userUpdateChain = Chain.make("loginIp", user.getLoginIp()).add("loginAt", Times.getTS()).add("loginCount", count + 1).add("userOnline", true).add("loginSessionId", session.getId());
|
||||
sysUserService.update(userUpdateChain, Cnd.where("id", "=", user.getId()));
|
||||
Sys_log sysLog = new Sys_log();
|
||||
sysLog.setType("info");
|
||||
sysLog.setTag("用户登陆:" + loginOrigin);
|
||||
sysLog.setSrc(this.getClass().getName() + "#doLogin");
|
||||
sysLog.setMsg("成功登录系统!");
|
||||
sysLog.setIp(Lang.getIP(request));
|
||||
sysLog.setCreatedBy(user.getId());
|
||||
sysLog.setUsername(user.getUsername());
|
||||
sysLog.setLoginname(user.getLoginname());
|
||||
sLogService.async(sysLog);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户名登录
|
||||
*
|
||||
* @param loginName 登录名
|
||||
* @param request 请求
|
||||
* @param session 会话
|
||||
* @param loginOrigin 登录起源
|
||||
*/
|
||||
public void doLogin(String loginName, HttpServletRequest request, HttpSession session, LoginOrigin loginOrigin) {
|
||||
PlatformCaptchaToken token = new PlatformCaptchaToken(loginName, loginOrigin);
|
||||
token.setLoginOrigin(loginOrigin);
|
||||
doLogin(token, request, session, loginOrigin);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user