This commit is contained in:
周源 2021-07-05 16:26:11 +08:00
commit cd11e20b1c
425 changed files with 32609 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

28
.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
*.iml
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea
target/
upload

29
bin/run-web.sh Normal file
View File

@ -0,0 +1,29 @@
#!/bin/sh
cd $PWD
pid=$(ps -ef | grep rddb.jar | grep -v grep | awk '{print $2}')
if [ -n "$pid" ]; then
kill -9 $pid
fi
# 优化JVM参数
JAVA_OPTS="$MAVEN_OPTS -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m"
# 方式一、配置外部自定义的属性文件(建议)
# JAVA_OPTS="$JAVA_OPTS -Dspring.config.location=$PWD\application.properties"
# 方式二、配置环境名称,加载不同的属性文件
# JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=prod"
if [ -z "$JAVA_HOME" ]; then
RUN_JAVA=java
else
RUN_JAVA="$JAVA_HOME"/bin/java
fi
# 根据情况修改 web.war 为您的 war 包名称
nohup $RUN_JAVA $JAVA_OPTS -jar rddb.jar > system.log 2>&1 &
sleep 1
pid=$(ps -ef | grep rddb.jar | grep -v grep | awk '{print $2}')
echo $pid

8
bin/update.sh Normal file
View File

@ -0,0 +1,8 @@
_pwd=/mnt/rd.ydool.org
_ip=122.112.240.73
cd ../
mvn clean package
scp target/build/*.jar root@${_ip}:${_pwd}
#scp target/build/lib/*.* root@${_ip}:${_pwd}/lib
ssh root@${_ip} "cd ${_pwd}; sh ./start.sh"

268
pom.xml Normal file
View File

@ -0,0 +1,268 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ydool.boot.modules.rddb</groupId>
<artifactId>ydool-rddb</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>com.ydool.boot</groupId>
<artifactId>ydool-boot</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<properties>
<app.build.name>${project.artifactId}-${project.version}</app.build.name>
<app.build.prod>target/build</app.build.prod>
</properties>
<dependencies>
<dependency>
<groupId>com.ydool.boot</groupId>
<artifactId>ydool-boot-module</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.58</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-extra</artifactId>
<version>${hutool.version}</version>
</dependency>
<!--swagger-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.5</version>
</dependency>
<!--jwt-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<!--阿里云短信-->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.0.6</version> <!-- 注:如提示报错,先升级基础包版,无法解决可联系技术支持 -->
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>1.1.0</version>
</dependency>
<!--redis-->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.2</version>
</dependency>
<dependency>
<groupId>com.alibaba.platform.shared</groupId>
<artifactId>xxpt.gateway.shared.client</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- 打JAR包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!-- MANIFEST.MF 中 Class-Path 加入前缀 -->
<classpathPrefix>lib/</classpathPrefix>
<!-- jar包不包含唯一版本标识 -->
<useUniqueVersions>false</useUniqueVersions>
<!--指定入口类 需要改名 -->
<mainClass>com.ydool.boot.Application</mainClass>
</manifest>
<manifestEntries>
<!--MANIFEST.MF 中 Class-Path 加入资源文件目录 -->
<Class-Path>./resources/</Class-Path>
</manifestEntries>
</archive>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</plugin>
<!-- 该插件的作用是用于复制依赖的jar包到指定的文件夹里 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- 该插件的作用是用于复制指定的文件 -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<!-- 复制配置文件 -->
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*.properties</include>
<include>*.xml</include>
<include>*.yml</include>
</includes>
<excludes>
<exclude>*.jar</exclude>
</excludes>
</resource>
</resources>
<outputDirectory>${project.build.directory}/resources</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.7.RELEASE</version>
<configuration>
<!--重写包含依赖包含不存在的依赖jar里没有pom里的依赖 -->
<includes>
<include>
<groupId>null</groupId>
<artifactId>null</artifactId>
</include>
</includes>
<layout>ZIP</layout>
<!--使用外部配置文件jar包里没有资源文件 -->
<addResources>true</addResources>
<outputDirectory>${project.build.directory}/resources</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<!--配置jar包特殊标识 配置后,保留原文件,生成新文件 *-run.jar -->
<!--配置jar包特殊标识 不配置,原文件命名为 *.jar.original生成新文件 *.jar -->
<!--<classifier>run</classifier> -->
</configuration>
</execution>
</executions>
</plugin>
<!-- 对打包后的文件重新进行组装 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy file="${project.basedir}/target/${app.build.name}.jar" tofile="${app.build.prod}/rddb.jar" />
<copy file="${project.basedir}/bin/run-web.sh" tofile="${app.build.prod}/start.sh" />
<!-- 复制资源文件 -->
<copy todir="${app.build.prod}">
<fileset dir="target/resources">
<include name="**/*.properties" />
<include name="**/*.xml" />
<include name="**/*.yml" />
</fileset>
</copy>
<!-- 复制包文件 -->
<copy todir="${app.build.prod}/lib">
<fileset dir="target/lib" />
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>aliyun-repos</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>ydool-repos</id>
<url>https://devrepo.devcloud.cn-east-3.huaweicloud.com/04/nexus/content/repositories/9c507cc7f48c41b886f10a07a3b5fe45_1_0/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>aliyun-repos</id>
<url>https://maven.aliyun.com/repository/public</url>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -0,0 +1,13 @@
package com.ydool.boot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

View File

@ -0,0 +1,63 @@
package com.ydool.boot.api.config;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import com.google.common.collect.Lists;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.*;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.List;
@Configuration
@EnableSwagger2
@EnableKnife4j
public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.ydool.boot.api"))
.paths(PathSelectors.any())
.build().securityContexts(Lists.newArrayList(securityContext())).securitySchemes(Lists.<SecurityScheme>newArrayList(apiKey()));
}
/**
* 添加摘要信息
*/
private ApiInfo apiInfo() {
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
// 设置标题
.title("api")
.build();
}
private ApiKey apiKey() {
return new ApiKey("XToken", "x-token", "header");
}
private SecurityContext securityContext() {
return SecurityContext.builder()
.securityReferences(defaultAuth())
.forPaths(PathSelectors.regex("/.*"))
.build();
}
List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
return Lists.newArrayList(new SecurityReference("BearerToken", authorizationScopes));
}
}

View File

@ -0,0 +1,15 @@
package com.ydool.boot.api.config;
import com.ydool.boot.api.filter.ReferInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new ReferInterceptor()).addPathPatterns("/api/**");
}
}

View File

@ -0,0 +1,626 @@
package com.ydool.boot.api.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.core.mybatis.Condition;
import com.ydool.boot.modules.rddb.entity.*;
import com.ydool.boot.modules.rddb.service.*;
import com.ydool.boot.modules.rddb.vo.ActivityCommentVO;
import com.ydool.boot.modules.rddb.vo.ActivityUserVO;
import com.ydool.boot.modules.rddb.vo.ActivityVO;
import com.ydool.boot.modules.rddb.wrapper.ActivityAuditUserWrapper;
import com.ydool.boot.modules.rddb.wrapper.ActivityCommentWrapper;
import com.ydool.boot.modules.rddb.wrapper.ActivityUserWrapper;
import com.ydool.boot.modules.rddb.wrapper.ActivityWrapper;
import com.ydool.boot.modules.sys.entity.User;
import com.ydool.boot.modules.sys.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 活动
*
* @author chenchen
* @date 2020/10/12
*/
@Controller
@RequestMapping("/api/activity")
@Api(value = "活动", tags = "活动")
public class ApiActivityController extends ApiBaseController {
@Autowired
private ActivityService activityService;
@Autowired
private ActivityCommentService activityCommentService;
@Resource
private ActivityUserService activityUserService;
@Resource
private ActivityAuditUserService activityAuditUserService;
@Resource
private UserService userService;
@Resource
private MessageService messageService;
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "activityName", value = "活动名称"),
@ApiImplicitParam(name = "status", value = "审核状态0待审核、1审核通过、2审核拒绝;不传查所有"),
@ApiImplicitParam(name = "end", value = "活动结束标记 0未结束 1结束;不传查所有"),
@ApiImplicitParam(name = "category", value = "活动类别 字典 activity_category中的数字值"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = ActivityVO.class)
})
@ApiOperation("所有活动")
@GetMapping("/list")
public void activityList(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
String activityName, String status, Integer end,String category) {
QueryWrapper<Activity> qw = getQueryWrapper(activityName, status, end,category);
IPage<Activity> paged = activityService.page(new Page<>(pageNo, pageSize), qw);
render(Ret.ok().paged(ActivityWrapper.build().pageVO(paged)));
}
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "activityName", value = "活动名称")
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = ActivityVO.class)
})
@ApiOperation("我发布的")
@GetMapping("/list/my")
public void activityListMy(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
String activityName) {
QueryWrapper<Activity> qw = new QueryWrapper<>();
Condition.appendIfNotEmpty(activityName, "activity_name#like", qw);
qw.eq("created_id", getApiUserId());
qw.orderByDesc("activity_date");
IPage<Activity> paged = activityService.page(new Page<>(pageNo, pageSize), qw);
render(Ret.ok().paged(ActivityWrapper.build().pageVO(paged)));
}
@ApiOperationSupport(
responses = @DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = ActivityVO.class)
})
)
@ApiOperation("活动详情")
@ApiImplicitParam(name = "id", value = "id", paramType = "path", required = true)
@GetMapping("/{id}")
public void activity(@PathVariable("id") String id) {
Activity bean = activityService.getById(id);
if (bean == null) {
render(Ret.fail("未找到该活动"));
return;
}
ActivityVO vo = ActivityWrapper.build().entityVO(bean);
ActivityUser auditUser = activityUserService.getOne(new QueryWrapper<ActivityUser>().eq("activity_id", id).eq("user_id", getApiUserId()));
if (auditUser != null) {
vo.setIsApply(auditUser.getIsApply());
vo.setApplyTime(auditUser.getApplyTime());
vo.setIsLeave(auditUser.getIsLeave());
vo.setLeaveTime(auditUser.getLeaveTime());
vo.setIsSign(auditUser.getIsSign());
vo.setSignTime(auditUser.getSignTime());
}
//报名人数
int applyCount = activityUserService.count(new QueryWrapper<ActivityUser>().eq("activity_id", id).eq("is_apply", 1));
vo.setApplyCount(applyCount);
render(Ret.ok().data(vo));
}
@ApiImplicitParams({
@ApiImplicitParam(name = "activityName", value = "活动名称", required = true),
@ApiImplicitParam(name = "activityDate", value = "活动时间", required = true),
@ApiImplicitParam(name = "activityAddress", value = "活动地点", required = true),
@ApiImplicitParam(name = "activityContent", value = "活动内容", required = true),
@ApiImplicitParam(name = "activityArea", value = "活动接取区域"),
@ApiImplicitParam(name = "uploadPersonnel", value = "上传人员"),
@ApiImplicitParam(name = "photo", value = "图片"),
@ApiImplicitParam(name = "userIds", value = "审核人员,多个以英文逗号间隔"),
@ApiImplicitParam(name = "attachment", value = "附件")
})
@ApiOperation("发布")
@PostMapping("/save")
public void save(String activityName, String activityDate, String activityAddress, String activityContent,
String activityArea, String uploadPersonnel, String photo,
@RequestParam(name = "userIds", defaultValue = "") String userIds,String attachment) {
Activity bean = new Activity();
bean.setActivityName(activityName);
bean.setActivityDate(activityDate);
bean.setActivityAddress(activityAddress);
bean.setActivityContent(activityContent);
bean.setActivityArea(activityArea);
bean.setUploadPersonnel(uploadPersonnel);
bean.setPhoto(photo);
bean.setEnd(0);
bean.setCreatedId(getApiUserId());
bean.setCreatedType(getApiUser().getAccountType());
bean.setAttachment(attachment);
boolean flag;
if ("admin".equals(getApiUser().getAccountType())) {
bean.setStatus("1");
flag = activityService.saveOrUpdate(bean);
} else {
bean.setStatus("0");
flag = activityService.saveOrUpdate(bean);
if (flag) {
//保存审核人员
if (StrUtil.isNotBlank(userIds)) {
//之前指定的全删掉
activityAuditUserService.remove(new QueryWrapper<ActivityAuditUser>().eq("activity_id", bean.getId()));
String[] uIds = userIds.split(",");
int count = 1;
for (String uId : uIds) {
ActivityAuditUser activityAuditUser = new ActivityAuditUser();
User user = userService.getById(uId);
if (user == null) {
continue;
}
activityAuditUser.setActivityId(bean.getId());
activityAuditUser.setActivityName(bean.getActivityName());
activityAuditUser.setUserId(user.getId());
activityAuditUser.setUserName(user.getUserName());
activityAuditUser.setStatus(0);
activityAuditUser.setSortNo(count++);
activityAuditUser.setCreatedId(getApiUserId());
boolean flaA = activityAuditUserService.saveOrUpdate(activityAuditUser);
//添加消息
if (flaA) {
Message message = new Message();
message.setActionId(bean.getId());
message.setTitle("您有一个活动审批,请前往查看!");
message.setContent(activityName);
message.setType(Message.TYPE_ACTIVITY);
message.setCreatedId(getApiUserId());
message.setStatus(Message.STATUS_UNREAD);
message.setUserId(uId);
messageService.save(message);
}
}
}
}
}
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "activityId", value = "活动id", required = true)
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", dataTypeClass = ActivityCommentVO.class)
})
@ApiOperation("活动评论列表")
@GetMapping("/comment/list")
public void commentA(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
String activityId) {
QueryWrapper<ActivityComment> wrapper = new QueryWrapper<>();
wrapper.eq("activity_id", activityId);
// wrapper.eq("status", "1");
wrapper.orderByDesc("created_at");
IPage<ActivityComment> paged = activityCommentService.page(new Page<>(pageNo, pageSize), wrapper);
render(Ret.ok().paged(ActivityCommentWrapper.build().pageVO(paged)));
}
@ApiOperation("评论活动")
@PostMapping("/comment/save")
@ApiImplicitParams({
@ApiImplicitParam(name = "activityId", value = "活动id", required = true),
@ApiImplicitParam(name = "content", value = "评论内容", required = true)
})
public void commentA(String activityId, String content) {
ActivityComment bean = new ActivityComment();
bean.setContent(content);
bean.setActivityId(activityId);
bean.setCreatedId(getApiUserId());
bean.setName(getApiUser().getUserName());
bean.setStatus(1);
boolean flag = activityCommentService.saveOrUpdate(bean);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiImplicitParams({
@ApiImplicitParam(name = "activityId", value = "活动id", required = true)
})
@ApiOperation("报名")
@PostMapping("/apply")
public void apply(String activityId) {
ActivityUser bean = activityUserService.getOne(new QueryWrapper<ActivityUser>().
eq("activity_id", activityId).eq("user_id", getApiUserId()));
if (bean != null) {
render(Ret.fail("已报名,无需重复报名"));
return;
}
Activity activity = activityService.getById(activityId);
bean = new ActivityUser();
bean.setActivityId(activityId);
bean.setActivityName(activity.getActivityName());
bean.setActivityDate(activity.getActivityDate());
bean.setUserId(getApiUserId());
bean.setIsApply(1);
bean.setIsSign(0);
bean.setIsLeave(0);
bean.setIsPublishPerform(0);
bean.setCreatedId(getApiUserId());
bean.setApplyTime(LocalDateTime.now());
bean.setEnd(0);
boolean flag = activityUserService.saveOrUpdate(bean);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiImplicitParams({
@ApiImplicitParam(name = "activityId", value = "活动id", required = true)
})
@ApiOperation("签到")
@PostMapping("/sign")
public void sign(String activityId) {
ActivityUser bean = activityUserService.getOne(new QueryWrapper<ActivityUser>().
eq("activity_id", activityId).eq("user_id", getApiUserId()));
if (bean == null) {
render(Ret.fail("未报名该活动,或该活动不存在"));
return;
}
if (bean.getIsSign().equals(1)) {
render(Ret.fail("已签到,无需重复签到"));
return;
}
bean.setIsSign(1);
bean.setUpdatedId(getApiUserId());
bean.setSignTime(LocalDateTime.now());
boolean flag = activityUserService.saveOrUpdate(bean);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiImplicitParams({
@ApiImplicitParam(name = "activityId", value = "活动id", required = true)
})
@ApiOperation("请假")
@PostMapping("/leave")
public void leave(String activityId) {
ActivityUser bean = activityUserService.getOne(new QueryWrapper<ActivityUser>().
eq("activity_id", activityId).eq("user_id", getApiUserId()));
if (bean == null) {
render(Ret.fail("未请假该活动,或该活动不存在"));
return;
}
if (bean.getIsLeave().equals(1)) {
render(Ret.fail("已请假,无需重复请假"));
return;
}
bean.setIsLeave(1);
bean.setUpdatedId(getApiUserId());
bean.setLeaveTime(LocalDateTime.now());
boolean flag = activityUserService.saveOrUpdate(bean);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "activityName", value = "活动名称"),
@ApiImplicitParam(name = "createdType", value = "发布者账号类型 不传查全部 admin县级人大工作人员 street乡镇负责人 contact联络站负责人" +
"多个用 , 号分开admin,street")
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", dataTypeClass = ActivityUserVO.class)
})
@ApiOperation("已报名")
@GetMapping("/have_apply")
public void haveApply(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
String activityName, String createdType) {
QueryWrapper<ActivityUser> wrapper = new QueryWrapper<>();
wrapper.eq("user_id", getApiUserId());
wrapper.eq("end", 0);
Condition.appendIfNotEmpty(activityName, "activity_name#like", wrapper);
wrapper.orderByDesc("activity_date");
IPage<ActivityUser> paged = activityUserService.page(new Page<>(pageNo, pageSize), wrapper);
if (CollUtil.isNotEmpty(paged.getRecords())) {
for (ActivityUser item : paged.getRecords()) {
QueryWrapper<Activity> qw = new QueryWrapper<Activity>().eq("id", item.getActivityId());
if (StrUtil.isNotBlank(createdType)) {
String[] split = createdType.split(",");
qw.in("created_type", Arrays.asList(split));
}
Activity activity = activityService.getOne(qw);
// if (activity != null) {
// DateTime activityDate = DateUtil.parse(activity.getActivityDate(), "yyyy-MM-dd");
// int compare = DateUtil.compare(activityDate, DateTime.now());
// if (compare < 0) {
// compare = 1;
// } else {
// compare = 0;
// }
// item.setIsFinish(compare + "");
// }
item.setActivity(activity);
}
}
render(Ret.ok().paged(ActivityUserWrapper.build().pageVO(paged)));
}
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "activityName", value = "活动名称"),
@ApiImplicitParam(name = "createdType", value = "发布者账号类型 不传查全部 admin县级人大工作人员 street乡镇负责人 contact联络站负责人" +
"多个用 , 号分开admin,street")
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", dataTypeClass = ActivityUserVO.class)
})
@ApiOperation("已结束")
@GetMapping("/finish")
public void finish(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
String activityName, String createdType) {
QueryWrapper<ActivityUser> wrapper = new QueryWrapper<>();
wrapper.eq("user_id", getApiUserId());
wrapper.eq("end", 1);
Condition.appendIfNotEmpty(activityName, "activity_name#like", wrapper);
wrapper.orderByDesc("activity_date");
IPage<ActivityUser> activityUserPage = activityUserService.page(new Page<>(pageNo, pageSize), wrapper);
if (CollUtil.isNotEmpty(activityUserPage.getRecords())) {
for (ActivityUser item : activityUserPage.getRecords()) {
QueryWrapper<Activity> qw = new QueryWrapper<Activity>().eq("id", item.getActivityId());
if (StrUtil.isNotBlank(createdType)) {
String[] split = createdType.split(",");
qw.in("created_type", Arrays.asList(split));
}
Activity activity = activityService.getOne(qw);
item.setActivity(activity);
}
}
render(Ret.ok().paged(ActivityUserWrapper.build().pageVO(activityUserPage)));
}
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "activityName", value = "活动名称"),
@ApiImplicitParam(name = "createdType", value = "发布者账号类型 不传查全部 admin县级人大工作人员 street乡镇负责人 contact联络站负责人" +
"多个用 , 号分开admin,street"),
@ApiImplicitParam(name = "category", value = "栏目类型 activity_category字典中的数字值 ")
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", dataTypeClass = ActivityVO.class)
})
@ApiOperation("最新活动")
@GetMapping("/newest")
public void newest(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
String activityName, String createdType,String category) {
//已报名的活动
QueryWrapper<ActivityUser> wrapper = new QueryWrapper<>();
wrapper.eq("user_id", getApiUserId());
List<ActivityUser> activityUsers = activityUserService.list(wrapper);
List<String> activityIds = new ArrayList<>();
for (ActivityUser item : activityUsers) {
activityIds.add(item.getActivityId());
}
//未结束已审核的活动
QueryWrapper<Activity> qw = new QueryWrapper<>();
qw.eq("end", 0);
qw.eq("status", "1");
if(StrUtil.isNotBlank(category)) qw.eq("category",category);
Condition.appendIfNotEmpty(activityName, "activity_name#like", qw);
if (CollUtil.isNotEmpty(activityIds)) {
qw.notIn("id", activityIds);
}
if (StrUtil.isNotBlank(createdType)) {
String[] split = createdType.split(",");
qw.in("created_type", Arrays.asList(split));
}
qw.orderByDesc("activity_date");
IPage<Activity> paged = activityService.page(new Page<>(pageNo, pageSize), qw);
render(Ret.ok().paged(ActivityWrapper.build().pageVO(paged)));
}
@ApiOperation("审批列表")
@GetMapping("/audit")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "type", value = "wait待审批 end已审批"),
@ApiImplicitParam(name = "title", value = "活动名称")
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "活动审批", dataTypeClass = ActivityAuditUser.class)
})
public void audit(String type, String title) {
QueryWrapper<ActivityAuditUser> wrapper = new QueryWrapper<>();
wrapper.orderByAsc("sort_no");
Page<ActivityAuditUser> paged = new Page<>();
if (StringUtils.isNotBlank(title)) {
title = "%" + title + "%";
wrapper.like("activity_name", title);
}
//不是按审批总状态筛选而是按照我对该审批做出的操作状态筛选
//待审批就是轮到我审批的已审批就是我审批过的
if ("wait".equals(type)) {
//我待审批 t_activity_audit_user的status=待审批,userId=自己 t_activity总状态是待审批的(说明前面未被拒绝) t_activity_audit_user的sort_no是最小的(说明正轮到自己)
paged = activityAuditUserService.getMyWaitList(new Page<>(getPageNum(), getPageSize()), getApiUserId(), title);
}
if ("end".equals(type)) {
//我已审批
wrapper.eq("user_id", getApiUserId()).and(consumer -> {
//通过的或拒绝的
consumer.or().eq("status", 1);
consumer.or().eq("status", 2);
});
paged = activityAuditUserService.page(new Page<>(getPageNum(), getPageSize()), wrapper);
}
paged.getRecords().forEach(item -> {
item.setActivity(activityService.getById(item.getActivityId()));
toStr(item);
});
render(Ret.ok().paged(ActivityAuditUserWrapper.build().pageVO(paged)));
}
@ApiOperation("活动审批人员列表")
@GetMapping("/audit_users")
@ResponseBody
@ApiImplicitParam(name = "id", value = "活动id")
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "活动审批", dataTypeClass = ActivityAuditUser.class)
})
public void auditUserList(String id) {
QueryWrapper<ActivityAuditUser> wrapper = new QueryWrapper<>();
wrapper.eq("activity_id", id);
wrapper.orderByAsc("sort_no");
List<ActivityAuditUser> list = activityAuditUserService.list(wrapper);
list.forEach(this::toStr);
render(Ret.ok().data(list));
}
//通过 拒绝 需要同步总审批的状态和原因
@PostMapping(value = "/refuse")
@ApiOperation("拒绝")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "活动id", required = true),
@ApiImplicitParam(name = "comment", value = "拒绝原因")
})
public void refuseA(String id, String comment) {
ActivityAuditUser bean = activityAuditUserService.getOne(new QueryWrapper<ActivityAuditUser>()
.eq("activity_id", id).eq("user_id", getApiUserId()));
if (bean == null) {
render(Ret.fail("未找到该活动,或你不是审核人员"));
return;
}
bean.setStatus(2);
bean.setReason(comment);
boolean flag = activityAuditUserService.saveOrUpdate(bean);
if (flag) {
Activity activity = activityService.getById(bean.getActivityId());
activity.setStatus("2");
activity.setReason(comment);
activityService.saveOrUpdate(activity);
//添加消息
Message message = new Message();
message.setActionId(activity.getId());
message.setTitle("您有一个活动被拒绝,请前往查看!");
message.setContent(activity.getActivityName());
message.setType(Message.TYPE_ACTIVITY_REFUSE);
message.setCreatedId(getApiUserId());
message.setStatus(Message.STATUS_UNREAD);
message.setUserId(activity.getCreatedId());
messageService.save(message);
}
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiOperation("通过")
@PostMapping("/pass")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "活动id", required = true)
})
public void passA(String id) {
ActivityAuditUser bean = activityAuditUserService.getOne(new QueryWrapper<ActivityAuditUser>()
.eq("activity_id", id).eq("user_id", getApiUserId()));
if (bean == null) {
render(Ret.fail("未找到该活动,或你不是审核人员"));
return;
}
bean.setStatus(1);
boolean flag = activityAuditUserService.saveOrUpdate(bean);
if (flag) {
//判断是否是该审批最后一道审批
QueryWrapper<ActivityAuditUser> countWrapper = new QueryWrapper<ActivityAuditUser>().eq("activity_id", id).eq("status", "0");
int count = activityAuditUserService.count(countWrapper);
if (count == 0) {
Activity activity = activityService.getById(bean.getActivityId());
activity.setStatus("1");
activityService.saveOrUpdate(activity);
//添加消息
Message message = new Message();
message.setActionId(activity.getId());
message.setTitle("您有一个活动已通过,请前往查看!");
message.setContent(activity.getActivityName());
message.setType(Message.TYPE_ACTIVITY_PASS);
message.setCreatedId(getApiUserId());
message.setStatus(Message.STATUS_UNREAD);
message.setUserId(activity.getCreatedId());
messageService.save(message);
}
}
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
//活动接取区域使用FIND_IN_SET OR查ApiVoterSuggestController
public void one() {
String streetId = getApiUser().getStreetId();
QueryWrapper<Activity> wrapper = new QueryWrapper<>();
wrapper.apply("FIND_IN_SET ('" + streetId + "',activity_area)").or().isNull("activity_area");
}
private void toStr(ActivityAuditUser item) {
User user = userService.getById(item.getUserId());
if (user != null) {
item.setUserName(user.getUserName());
}
Activity activity = activityService.getById(item.getActivityId());
if (activity != null) {
item.setActivityName(activity.getActivityName());
}
}
private QueryWrapper<Activity> getQueryWrapper(String title, String status, Integer end,String category) {
QueryWrapper<Activity> qw = new QueryWrapper<>();
Condition.appendIfNotEmpty(title, "activity_name#like", qw);
Condition.appendIfNotEmpty(status, "status", qw);
Condition.appendIfNotEmpty(end, "end", qw);
Condition.appendIfNotEmpty(category, "category", qw);
qw.orderByDesc("activity_date");
return qw;
}
}

View File

@ -0,0 +1,178 @@
package com.ydool.boot.api.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.modules.rddb.entity.Audit;
import com.ydool.boot.modules.rddb.entity.AuditUser;
import com.ydool.boot.modules.rddb.service.AuditService;
import com.ydool.boot.modules.rddb.service.AuditUserService;
import com.ydool.boot.modules.sys.entity.User;
import com.ydool.boot.modules.sys.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author: zhouyuan
* @date: 2020/10/15
*/
@Controller
@RequestMapping("/api/audit")
@Api(value = "文件审批", tags = "文件审批")
public class ApiAuditController extends ApiBaseController {
@Autowired
private AuditService auditService;
@Autowired
private AuditUserService auditUserService;
@Autowired
private UserService userService;
@ApiOperation("审批列表")
@GetMapping("")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "type", value = "wait待审批 end已审批"),
@ApiImplicitParam(name = "title", value = "标题"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "文件审批", dataTypeClass = AuditUser.class)
})
public void auditList(String type, String title) {
QueryWrapper<AuditUser> wrapper = new QueryWrapper<>();
wrapper.orderByDesc("updated_at");
Page page = null;
//不是按审批总状态筛选而是按照我对该审批做出的操作状态筛选
//待审批就是轮到我审批的已审批就是我审批过的
if ("wait".equals(type)) {
//我待审批 t_audit_user的status=待审批,userId=自己 t_audit总状态是待审批的(说明前面未被拒绝) t_audit_user的sort_no是最小的(说明正轮到自己)
if (StringUtils.isNotBlank(title)) title = "%" + title + "%";
page = auditUserService.getMyWaitList(new Page(getPageNum(), getPageSize()), getApiUserId(), title);
}
if ("end".equals(type)) {
//我已审批
if (StrUtil.isNotBlank(title)) wrapper.like("title", title);
wrapper.eq("user_id", getApiUserId()).and(consumer -> {
//通过的或拒绝的
consumer.or().eq("status", 1);
consumer.or().eq("status", 2);
});
page = auditUserService.page(new Page(getPageNum(), getPageSize()), wrapper);
}
page.getRecords().forEach(item -> {
AuditUser auditUser = (AuditUser) item;
Audit audit = auditService.getById(auditUser.getAuditId());
//审批对象的创建人姓名
User user = userService.getById(audit.getCreatedId());
audit.setUserName(user != null ? user.getUserName() : "");
auditUser.setAudit(audit);
});
render(Ret.ok().paged(page));
}
@ApiOperation("我的上报列表")
@GetMapping("mine")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "title", value = "标题"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "审批", dataTypeClass = Audit.class)
})
public void auditMineList(String title) {
QueryWrapper<Audit> wrapper = new QueryWrapper<>();
wrapper.orderByDesc("created_at");
wrapper.eq("created_id", getApiUserId());
if (StrUtil.isNotBlank(title)) wrapper.like("title", title);
Page page = auditService.page(new Page(getPageNum(), getPageSize()), wrapper);
render(Ret.ok().paged(page));
}
@ApiOperation("审批详情")
@GetMapping("detail")
@ResponseBody
@ApiImplicitParam(name = "id", value = "审批id")
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "审批", dataTypeClass = Audit.class)
})
public void auditDetail(String id) {
Audit audit = auditService.getById(id);
render(Ret.ok().data(audit));
}
@ApiOperation("该审批的审批人列表")
@GetMapping("audit_users")
@ResponseBody
@ApiImplicitParam(name = "id", value = "审批id")
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "审批", dataTypeClass = AuditUser.class)
})
public void auditUsers(String id) {
QueryWrapper<AuditUser> wrapper = new QueryWrapper<>();
wrapper.eq("audit_id", id);
wrapper.orderByAsc("sort_no");
List<AuditUser> list = auditUserService.list(wrapper);
render(Ret.ok().data(list));
}
@ApiOperation("添加审批")
@PostMapping("save")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "conference", value = "会议对象"),
@ApiImplicitParam(name = "userIds", value = "选择的用户id多个以英文逗号间隔")
})
public void auditSave(@Validated Audit audit, @RequestParam(name = "userIds", defaultValue = "") String userIds) {
render(auditService.insertOrUpdate(audit, getApiUser(), userIds));
}
//通过 拒绝 需要同步总审批的状态和原因
@PostMapping(value = "refuse")
@ApiOperation("拒绝")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "审批id"),
@ApiImplicitParam(name = "comment", value = "拒绝原因"),
@ApiImplicitParam(name = "signature", value = "签名")
})
public void auditRefuse(String id, String comment, String signature) {
AuditUser auditUser = auditUserService.getOne(new QueryWrapper<AuditUser>().eq("audit_id", id).eq("user_id", getApiUserId()));
if (auditUser == null) render(Ret.fail("未找到该审批"));
auditUser.setReason(comment);
auditUser.setSignature(signature);
render(auditUserService.refuse(auditUser));
}
@ApiOperation("通过")
@PostMapping("pass")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "审批id"),
@ApiImplicitParam(name = "signature", value = "签名"),
})
public void auditPass(String id, String signature) {
AuditUser auditUser = auditUserService.getOne(new QueryWrapper<AuditUser>().eq("audit_id", id).eq("user_id", getApiUserId()));
if (auditUser == null) render(Ret.fail("未找到该审批"));
auditUser.setSignature(signature);
render(auditUserService.pass(auditUser));
}
}

View File

@ -0,0 +1,364 @@
package com.ydool.boot.api.controller;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient;
import com.alibaba.xxpt.gateway.shared.client.http.GetClient;
import com.alibaba.xxpt.gateway.shared.client.http.PostClient;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.api.util.Kv;
import com.ydool.boot.api.util.SmsUtil;
import com.ydool.boot.api.util.TokenUtil;
import com.ydool.boot.common.Ydool;
import com.ydool.boot.common.cache.ConfigUtils;
import com.ydool.boot.common.cache.DictUtils;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.common.utils.WebUtils;
import com.ydool.boot.core.validator.NumberLetter;
import com.ydool.boot.core.validator.Password;
import com.ydool.boot.modules.rddb.entity.Db;
import com.ydool.boot.modules.rddb.entity.Office;
import com.ydool.boot.modules.rddb.service.DbService;
import com.ydool.boot.modules.rddb.service.OfficeService;
import com.ydool.boot.modules.sys.entity.Role;
import com.ydool.boot.modules.sys.entity.User;
import com.ydool.boot.modules.sys.entity.UserRole;
import com.ydool.boot.modules.sys.service.RoleService;
import com.ydool.boot.modules.sys.service.UserRoleService;
import com.ydool.boot.modules.sys.service.UserService;
import io.jsonwebtoken.Claims;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* @author: zhouyuan
* @date: 2020/10/10
*/
@Slf4j
@RestController
@RequestMapping(value = "/api/auth")
@Api(value = "授权接口", tags = "授权接口")
public class ApiAuthController extends ApiBaseController {
@Autowired
private UserService userService;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private UserRoleService userRoleService;
@Autowired
private RoleService roleService;
@Autowired
private DbService dbService;
@Autowired
private OfficeService officeService;
@Value("${sys.dingding.appId}")
private String appId;
@Value("${sys.dingding.appSecret}")
private String appSecret;
// public static void main(String[] args) {
// String result = Base64.decodeStr("MTM2MDY3ODc2OTk=");
// //13606787699
// System.out.println(result);
// }
// public static void main(String[] args) {
// String token="eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiZmYxYzI3MGFjMzQxOTY5MzA2ZDRkNzM5YjI4ZTE0MzMiLCJleHAiOjE2MzMyMjM4MTMsIm5iZiI6MTYyNTQ0NzgxM30.y2xmIsDO5hn5xO2z4Apo3K2kPqvsKRVwRZQ3a-0fpXw";
// Claims claims = TokenUtil.parseJWT(token);
// Date date = claims.getExpiration();
// System.out.println(date);
// }
@GetMapping("reg_login")
@ApiOperation(value = "有该手机号和身份的账号则直接登录,否则创建一个账号并登录")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "phone", value = "手机号", required = true),
@ApiImplicitParam(name = "type", required = true, value = "身份类型 admin县级人大工作人员 street乡镇负责人 contact联络站负责人 rddb各级人大代表 voter选民用户 "),
})
public void regLogin(String phone, String type) {
if (StrUtil.isBlank(phone)) fail("手机号不能为空");
phone = Base64.decodeStr(phone);
if (StrUtil.isBlank(type)) fail("身份类型不能为空");
if ((!"admin".equals(type)) && (!"admin".equals(type)) && (!"street".equals(type)) && (!"contact".equals(type)) && (!"rddb".equals(type)) && (!"voter".equals(type)))
fail("请检查身份类型");
User user = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, phone).eq(User::getAccountType, type));
if (user != null) {
//直接登录
login(user);
} else {
user = new User();
user.setLoginName(phone);
user.setSalt(RandomUtil.randomString(6));
user.setPassword(Ydool.password(user.getSalt(), ConfigUtils.getStr("sys.user.initPassword", "888888")));
user.setInitPwd(false);
user.setAccountType(type);
userService.save(user);
//分配用户默认角色
Role role = roleService.getOne(new QueryWrapper<Role>().eq("code", "default"));
if (role != null) userRoleService.save(new UserRole(user.getId(), role.getId()));
//选民则只有基础信息
//县级人大工作人员乡镇管理员联络站管理员 需创建机关人员信息
if ("admin".equals(type) || "street".equals(type) || "contact".equals(type)) {
Office office = new Office();
office.setUserId(user.getId());
office.setPhone(user.getPhone());
office.setDuty(DictUtils.getDictValue(type, "office_duty"));
officeService.save(office);
}
//人大代表 需创建代表信息
if ("rddb".equals(type)) {
Db db = new Db();
db.setUserId(user.getId());
db.setPhone(user.getPhone());
dbService.save(db);
}
login(user);
}
Kv authInfo = TokenUtil.createAuthInfo(user);
//跳转
String url = "/front/#/authorize";
String param = "?type=" + type + "&access_token=" + authInfo.getString("access_token");
WebUtils.redirect(url + param, true);
}
private void login(User user) {
user.setLoginDate(LocalDateTime.now());
user.setLoginIp(WebUtils.getRemoteAddress());
boolean flag = userService.updateById(user);
if (flag) {
WebUtils.getSession().setAttribute(Ydool.LOGIN_NAME, user.getId());
WebUtils.getSession().setAttribute(Ydool.LOGIN_DATA_SCOPE, userService.getUserMaxRoleDataScope(user.getId()));
}
}
@GetMapping("")
@ResponseBody
@ApiOperation(value = "获取认证token")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "login", value = "用户名"),
@ApiImplicitParam(name = "pwd", value = "密码"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "type", value = "身份 admin县级人大工作人员 street乡镇负责人 contact联络站负责人 rddb各级人大代表 voter选民用户")
})
public void auth(String login, String pwd) {
Ret ret = userService.login(login, pwd);
if (ret.isFail()) {
render(Ret.fail(ret.get("msg").toString()));
}
User user = userService.getOne((Wrapper) (new QueryWrapper()).eq("login_name", login));
Kv authInfo = TokenUtil.createAuthInfo(user);
//身份 admin县级人大工作人员 street乡镇负责人 contact联络站负责人 rddb各级人大代表 voter选民用户
authInfo.set("type", user.getAccountType());
render(Ret.ok().data(authInfo));
}
@PostMapping("sendCode")
@ResponseBody
@ApiOperation(value = "发送验证码")
@ApiImplicitParam(name = "phone", value = "手机号", required = true)
public void sendCode(String phone) {
//一分钟可重发
if (redisTemplate.hasKey(phone) && redisTemplate.getExpire(phone) > (9 * 60)) {
render(Ret.fail("发送验证码过于频繁,请稍后重试"));
}
//作为loginName的手机号不能重复
User repeatUser = checkPhoneRepeat(phone);
if (repeatUser != null) render(Ret.fail("该手机号已被占用"));
//存储验证码
String code = RandomUtil.randomNumbers(6);
redisTemplate.opsForValue().set(phone, code, 10 * 60, TimeUnit.SECONDS);
SmsUtil.sendMsg(phone, code);
render(Ret.ok());
}
@PostMapping("register")
@ResponseBody
@ApiOperation(value = "注册")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "phone", value = "手机号", required = true),
@ApiImplicitParam(name = "code", value = "验证码", required = true),
@ApiImplicitParam(name = "password", value = "密码", required = true),
@ApiImplicitParam(name = "type", value = "注册类型 admin县级人大工作人员 street乡镇负责人 contact联络站负责人 rddb各级人大代表 voter选民用户", required = true),
})
public void register(String phone, String code, @NumberLetter(message = "密码需带有英文,数字") String password, String type) {
if (StringUtils.isNotBlank(phone) && StringUtils.isNotBlank(code) && StringUtils.isNotBlank(password)) {
//作为loginName的手机号不能重复
User repeatUser = checkPhoneRepeat(phone);
if (repeatUser != null) render(Ret.fail("该手机号已被占用"));
if (redisTemplate.hasKey(phone)) {
String redisCode = (String) redisTemplate.opsForValue().get(phone);
if (code.equals(redisCode)) {
User user = new User();
user.setLoginName(phone);
user.setSalt(RandomUtil.randomString(6));
user.setPassword(Ydool.password(user.getSalt(), password));
user.setInitPwd(false);
user.setAccountType(type);
userService.save(user);
//分配用户默认角色
Role role = roleService.getOne(new QueryWrapper<Role>().eq("code", "default"));
if (role != null) {
userRoleService.save(new UserRole(user.getId(), role.getId()));
}
//县级人大工作人员乡镇管理员联络站管理员 需创建机关人员信息
if ("admin".equals(type) || "street".equals(type) || "contact".equals(type)) {
Office office = new Office();
office.setUserId(user.getId());
office.setPhone(user.getPhone());
office.setDuty(DictUtils.getDictValue(type, "office_duty"));
officeService.save(office);
}
//人大代表 需创建代表信息
if ("rddb".equals(type)) {
Db db = new Db();
db.setUserId(user.getId());
db.setPhone(user.getPhone());
dbService.save(db);
}
//选民只有基础信息
render(Ret.ok());
}
render(Ret.fail("验证码错误"));
}
render(Ret.fail("验证码超时,请重新获取"));
}
render(Ret.fail("参数不完整"));
}
@PostMapping("/check_ding_binding")
@ApiOperation(value = "用户是否绑定钉钉接口")
@ApiImplicitParam(name = "authCode", value = "免登码")
public Ret checkBinding(String authCode) {
System.out.println("authCode:"+authCode);
String accessToken = getAccessToken();
String dingOpenid = getDingOpenid(accessToken, authCode);
if (accessToken != null && dingOpenid == null) return Ret.fail("免登授权码错误");
User user = userService.getUserByOpenId(dingOpenid);
if (user != null) {
login(user);
Kv authInfo = TokenUtil.createAuthInfo(user);
authInfo.set("type", user.getAccountType());
return Ret.ok().data(authInfo);
} else {
return Ret.fail("请绑定账号").data(dingOpenid);
}
}
@PostMapping("/ding_binding")
@ApiOperation(value = "绑定钉钉接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "login", value = "账号"),
@ApiImplicitParam(name = "password", value = "密码"),
@ApiImplicitParam(name = "dingOpenid", value = "dingOpenid")
})
public Ret binding(String login, String password, String dingOpenid) {
System.out.println("login:"+login);
System.out.println("password:"+password);
System.out.println("dingOpenid:"+dingOpenid);
User user = userService.getOne(new QueryWrapper<User>().eq("login_name", login));
if (user!=null) {
user.setOpenId(dingOpenid);
userService.updateById(user);
login(user);
Kv authInfo = TokenUtil.createAuthInfo(user);
authInfo.set("type", user.getAccountType());
return Ret.ok().data(authInfo);
} else {
return Ret.fail("绑定失败");
}
}
private String getAccessToken() {
String accessKey = appId;
String secretKey = appSecret;
ExecutableClient executableClient = ExecutableClient.getInstance();
executableClient.setAccessKey(accessKey);
executableClient.setSecretKey(secretKey);
executableClient.setDomainName("openplatform.dg-work.cn");
executableClient.setProtocal("https");
executableClient.init();
//executableClient要单例并且使用前要初始化只需要初始化一次
String api = "/gettoken.json";
GetClient getClient = executableClient.newGetClient(api);
//设置参数
getClient.addParameter("appkey", accessKey);
getClient.addParameter("appsecret", secretKey);
//调用API
String apiResult = getClient.get();
executableClient.destroy();
try {
JSONObject jsonObject = JSON.parseObject(apiResult);
JSONObject content = jsonObject.getJSONObject("content");
if (content.getBoolean("success")) {
return content.getJSONObject("data").getString("accessToken");
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return null;
}
private String getDingOpenid(String accessToken, String authCode) {
ExecutableClient executableClient = ExecutableClient.getInstance();
executableClient.setDomainName("openplatform.dg-work.cn");
executableClient.setProtocal("https");
executableClient.init();
//executableClient要单例并且使用前要初始化只需要初始化一次
String api = "/rpc/oauth2/dingtalk_app_user.json";
PostClient postClient = executableClient.newPostClient(api);
//设置参数
postClient.addParameter("access_token", accessToken);
postClient.addParameter("auth_code", authCode);
//调用API
String apiResult = postClient.post();
executableClient.destroy();
try {
JSONObject jsonObject = JSON.parseObject(apiResult);
JSONObject content = jsonObject.getJSONObject("content");
if (content.getBoolean("success")) {
return content.getJSONObject("data").getString("openid");
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return null;
}
}

View File

@ -0,0 +1,74 @@
package com.ydool.boot.api.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ydool.boot.api.util.TokenUtil;
import com.ydool.boot.api.util.UserInfo;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.core.exception.ResultException;
import com.ydool.boot.core.web.BaseController;
import com.ydool.boot.modules.sys.entity.User;
import com.ydool.boot.modules.sys.service.RoleService;
import com.ydool.boot.modules.sys.service.UserRoleService;
import com.ydool.boot.modules.sys.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @author: zhouyuan
* @date: 2020/10/10
*/
public class ApiBaseController extends BaseController {
@Autowired
private UserService userService;
/**
* 获取当前登录用户id
*
* @return
*/
public static String getApiUserId() {
UserInfo userInfo = TokenUtil.getUserInfo();
if (userInfo == null) {
throw new ResultException(Ret.fail("请登录后再操作"));
}
return userInfo.getId();
}
/**
* 获取当前登录用户id
*
* @return
*/
public User getApiUser() {
UserInfo userInfo = TokenUtil.getUserInfo();
if (userInfo == null) {
throw new ResultException(Ret.fail("请登录后再操作"));
}
return userService.getById(userInfo.getId());
}
public boolean isStreet() {
return "street".equals(getApiUser().getAccountType());
}
public boolean isContact() {
return "contact".equals(getApiUser().getAccountType());
}
public boolean isAdmin() {
return "admin".equals(getApiUser().getAccountType());
}
public boolean isRddb() {
return "rddb".equals(getApiUser().getAccountType());
}
public boolean isVoter() {
return "office".equals(getApiUser().getAccountType());
}
public User checkPhoneRepeat(String phone) {
return userService.getOne(new QueryWrapper<User>().eq("login_name", phone));
}
}

View File

@ -0,0 +1,133 @@
package com.ydool.boot.api.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ydool.boot.api.util.Kv;
import com.ydool.boot.common.cache.DictUtils;
import com.ydool.boot.common.cache.StreetUtils;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.modules.rddb.entity.*;
import com.ydool.boot.modules.rddb.service.*;
import com.ydool.boot.modules.sys.entity.DictData;
import com.ydool.boot.modules.sys.entity.Street;
import com.ydool.boot.modules.sys.service.StreetService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* @author: zhouyuan
* @date: 2020/10/10
*/
@RestController
@RequestMapping(value = "/api/user")
@Api(value = "基础数据接口", tags = "基础数据接口")
public class ApiBaseDataController extends ApiBaseController {
@Autowired
private DataBankService dataBankService;
@Autowired
private ConferenceAttachmentService conferenceAttachmentService;
@Autowired
private NoticeService noticeService;
@Autowired
private ConferenceService conferenceService;
@Autowired
private AuditService auditService;
@Autowired
private ActivityService activityService;
@Autowired
private VoterSuggestService voterSuggestService;
@Autowired
private SuperviseThingService superviseThingService;
@Autowired
private StreetService streetService;
@Autowired
private OfficeService officeService;
@GetMapping("street")
@ResponseBody
@ApiOperation(value = "获取街道列表")
public void street() {
List<Street> streetList = StreetUtils.getStreetList();
render(Ret.ok().data(streetList));
}
@GetMapping("street_detail")
@ResponseBody
@ApiOperation(value = "获取街道详情")
@ApiImplicitParam(name = "id", value = "街道id")
public void getStreetDetail(String id) {
render(Ret.ok().data(streetService.getById(id)));
}
@GetMapping("street_contacts")
@ResponseBody
@ApiOperation(value = "该街道下的联络站列表 无分页")
@ApiImplicitParam(name = "id", value = "街道id")
public void street(String id) {
List<Office> list = officeService.list(new QueryWrapper<Office>().eq("street", id).eq("duty", "contact"));
render(Ret.ok().data(list));
}
@GetMapping("contact_detail")
@ResponseBody
@ApiOperation(value = "联络站详情")
@ApiImplicitParam(name = "id", value = "联络站id")
public void contactDetail(String id) {
Office office = officeService.getById(id);
if (office != null) office.fullInfo();
render(Ret.ok().data(office));
}
@GetMapping("dict")
@ResponseBody
@ApiOperation(value = "根据字典类型拿字典列表")
@ApiImplicitParam(name = "type", value = "字典类型 例如:sys_yes_no")
public void dict(String type) {
List<DictData> dictList = DictUtils.getDictList(type, null);
render(Ret.ok().data(dictList));
}
@GetMapping("now")
@ResponseBody
@ApiOperation(value = "获取当前时间")
public void now() {
render(Ret.ok().data(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))));
}
@GetMapping("statistics")
@ResponseBody
@ApiOperation(value = "统计数量 自己创建的")
public void statistics() {
//上传资料库文件数
int dataBankFileCount = dataBankService.count(new QueryWrapper<DataBank>());
//上传会议文件数
int conferenceFileCount = conferenceAttachmentService.count(new QueryWrapper<ConferenceAttachment>());
// 文件审批数
int auditCount = auditService.count(new QueryWrapper<Audit>());
// 发布活动数
int activityCount = activityService.count(new QueryWrapper<Activity>());
//发布公告数
int noticeCount = noticeService.count(new QueryWrapper<Notice>());
// 选民反馈数量
int voterSuggestCount = voterSuggestService.count(new QueryWrapper<VoterSuggest>());
//发布会议数
int conferenceCount = conferenceService.count(new QueryWrapper<Conference>());
//督事数
int superviseThingCount = superviseThingService.count(new QueryWrapper<SuperviseThing>().eq("created_id", getApiUserId()));
Kv kv = Kv.create().set("dataBankFileCount", dataBankFileCount).set("conferenceFileCount", conferenceFileCount).set("auditCount", auditCount)
.set("activityCount", activityCount).set("noticeCount", noticeCount).set("voterSuggestCount", voterSuggestCount).set("conferenceCount", conferenceCount)
.set("superviseThingCount", superviseThingCount);
render(Ret.ok().data(kv));
}
}

View File

@ -0,0 +1,93 @@
package com.ydool.boot.api.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.modules.rddb.entity.BasicDynamic;
import com.ydool.boot.modules.rddb.service.BasicDynamicService;
import com.ydool.boot.modules.rddb.vo.BasicDynamicVO;
import com.ydool.boot.modules.rddb.wrapper.BasicDynamicWrapper;
import com.ydool.boot.modules.sys.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* 动态信息
*
* @author zhouyuan
* @date 2021年3月15日13:09:49
*/
@Controller
@RequestMapping("/api/basic_dynamic")
@Api(value = "动态信息", tags = "动态信息")
public class ApiBasicDynamicController extends ApiBaseController {
@Autowired
private BasicDynamicService basicDynamicService;
@ApiOperation("列表")
@GetMapping("list")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "动态信息对象", dataTypeClass = BasicDynamicVO.class)
})
public void basicDynamicList() {
LambdaQueryWrapper<BasicDynamic> wrapper = new LambdaQueryWrapper<>();
// 0待审核 1已通过 2拒绝
wrapper.eq(BasicDynamic::getStatus,"1");
wrapper.orderByDesc(BasicDynamic::getCreatedAt);
Page page = basicDynamicService.page(new Page(getPageNum(), getPageSize()), wrapper);
List list = BasicDynamicWrapper.build().listVO(page.getRecords());
page.setRecords(list);
render(Ret.ok().paged(page));
}
@ApiOperation("新增 (街道管理员或联络站管理员)")
@PostMapping("save")
@ResponseBody
@ApiImplicitParam(name = "basicDynamic", value = "动态信息对象", dataTypeClass = BasicDynamic.class)
public void basicDynamicSave(@Validated BasicDynamic basicDynamic) {
//街道管理员或联络站管理员
if (isStreet() || isContact()) {
User user = getApiUser();
basicDynamic.setStreetId(user.getStreetId());
}
//0待审核 1已通过 2拒绝
basicDynamic.setStatus("0");
boolean flag = basicDynamicService.saveOrUpdate(basicDynamic);
renderJson(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiOperation("督事详情")
@GetMapping("detail")
@ResponseBody
@ApiImplicitParam(name = "id", value = "id")
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "动态信息对象", dataTypeClass = BasicDynamicVO.class)
})
public void basicDynamicDetail(String id) {
BasicDynamic basicDynamic = basicDynamicService.getById(id);
if (basicDynamic == null) fail("未找到该对象");
BasicDynamicVO basicDynamicVO = BasicDynamicWrapper.build().entityVO(basicDynamic);
render(Ret.ok().data(basicDynamicVO));
}
}

View File

@ -0,0 +1,240 @@
package com.ydool.boot.api.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.modules.rddb.entity.Conference;
import com.ydool.boot.modules.rddb.entity.ConferenceAttachment;
import com.ydool.boot.modules.rddb.entity.ConferenceUser;
import com.ydool.boot.modules.rddb.service.ConferenceAttachmentService;
import com.ydool.boot.modules.rddb.service.ConferenceService;
import com.ydool.boot.modules.rddb.service.ConferenceUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author: zhouyuan
* @date: 2020/10/15
*/
@Controller
@RequestMapping("/api/conference")
@Api(value = "会议", tags = "会议")
public class ApiConferenceController extends ApiBaseController {
@Autowired
private ConferenceService conferenceService;
@Autowired
private ConferenceAttachmentService conferenceAttachmentService;
@Autowired
private ConferenceUserService conferenceUserService;
@ApiOperation("会议列表")
@GetMapping("")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "title", value = "会议名称"),
@ApiImplicitParam(name = "type", value = "mine我创建的会议 all全部会议 un_end未结束会议 end已结束会议"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "会议", dataTypeClass = Conference.class)
})
public void conferenceList(String title, String type) {
QueryWrapper<Conference> wrapper = getQueryWrapper(title);
if (StringUtils.isBlank(type) || "all".equals(type)) {
//全部的就是看全部的不是看有我参加的
// wrapper.inSql("id", "select conference_id from t_conference_user where user_id='" + getApiUserId() + "'");
}
if ("mine".equals(type)) wrapper.eq("created_id", getApiUserId());
if ("end".equals(type)) wrapper.eq("end", Conference.END_TAG);
//未结束查有我参加的未结束的
if ("un_end".equals(type)) {
wrapper.eq("end", Conference.UN_END_TAG);
wrapper.inSql("id", "select conference_id from t_conference_user where user_id='" + getApiUserId() + "'");
}
Page page = conferenceService.page(new Page(getPageNum(), getPageSize()), wrapper);
page.getRecords().forEach(item -> {
Conference conference = (Conference) item;
//会议议题列表
List<ConferenceAttachment> conferenceIssueList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>().eq("pid", "").eq("conference_id", (conference.getId())));
//议题列表里装会议附件列表
conferenceIssueList.forEach(conferenceIssue -> {
List<ConferenceAttachment> conferenceAttachmentList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>().eq("pid", conferenceIssue.getId()).eq("conference_id", (conference.getId())));
//处理文件前缀
conferenceAttachmentList.forEach(ConferenceAttachment::full);
conferenceIssue.setConferenceAttachmentList(conferenceAttachmentList);
});
conference.setConferenceIssueList(conferenceIssueList);
//当前登录用户是否已签到
ConferenceUser conferenceUser = conferenceUserService.getOne(new QueryWrapper<ConferenceUser>().eq("conference_id", conference.getId()).eq("user_id", getApiUserId()));
conference.setSign(conferenceUser != null ? conferenceUser.getStatus() : null);
conference.setSignTime(conferenceUser != null ? conferenceUser.getUpdatedAt() : null);
});
render(Ret.ok().paged(page));
}
@ApiOperation("添加会议")
@PostMapping("save")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "conference", value = "会议对象"),
@ApiImplicitParam(name = "userIds", value = "选择的用户id多个以英文逗号间隔 按顺序排")
})
public void conferenceSave(@Validated Conference conference, @RequestParam(name = "userIds", defaultValue = "") String userIds) {
//手机端不上传附件 null
render(conferenceService.insertOrUpdate(conference, getApiUser(), userIds, null));
}
@ApiOperation("会议文件列表 不显示议题")
@GetMapping("attachments")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "conferenceTitle", value = "会议名称"),
@ApiImplicitParam(name = "attachmentTitle", value = "附件名称"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "会议", dataTypeClass = ConferenceAttachment.class)
})
public void conferenceAttachments(String conferenceTitle, String attachmentTitle) {
if (StringUtils.isNotBlank(conferenceTitle)) conferenceTitle = "%" + conferenceTitle + "%";
if (StringUtils.isNotBlank(attachmentTitle)) attachmentTitle = "%" + attachmentTitle + "%";
Page page = conferenceAttachmentService.page(new Page(getPageNum(), getPageSize()), conferenceTitle, attachmentTitle);
page.getRecords().forEach(item -> {
ConferenceAttachment conferenceAttachment = (ConferenceAttachment) item;
conferenceAttachment.full();
Conference conference = conferenceService.getById(conferenceAttachment.getConferenceId());
conferenceAttachment.setConference(conference);
});
render(Ret.ok().paged(page));
}
@ApiOperation("上传了会议文件的会议列表")
@GetMapping("have_attachment")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "title", value = "会议名称"),
@ApiImplicitParam(name = "category", value = "附件分类"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "会议", dataTypeClass = Conference.class)
})
public void conferenceHaveAttachmentList(String title, String category) {
QueryWrapper<Conference> wrapper = getQueryWrapper(title);
//上传文件数>=1
wrapper.ge("attachment_num", 1);
wrapper.eq("category", category);
Page page = conferenceService.page(new Page(getPageNum(), getPageSize()), wrapper);
page.getRecords().forEach(item -> {
Conference conference = (Conference) item;
//会议议题列表
List<ConferenceAttachment> conferenceIssueList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>().orderByAsc("sort_no").eq("pid", "").eq("conference_id", (conference.getId())));
//议题列表里装会议附件列表
conferenceIssueList.forEach(conferenceIssue -> {
List<ConferenceAttachment> conferenceAttachmentList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>().orderByAsc("sort_no").eq("pid", conferenceIssue.getId()).eq("conference_id", (conference.getId())));
//处理文件前缀
conferenceAttachmentList.forEach(ConferenceAttachment::full);
conferenceIssue.setConferenceAttachmentList(conferenceAttachmentList);
});
conference.setConferenceIssueList(conferenceIssueList);
//当前登录用户是否已签到
ConferenceUser conferenceUser = conferenceUserService.getOne(new QueryWrapper<ConferenceUser>().eq("conference_id", conference.getId()).eq("user_id", getApiUserId()));
conference.setSign(conferenceUser != null ? conferenceUser.getStatus() : null);
conference.setSignTime(conferenceUser != null ? conferenceUser.getUpdatedAt() : null);
});
render(Ret.ok().paged(page));
}
@ApiOperation("获取会议详情")
@GetMapping("detail")
@ResponseBody
@ApiImplicitParam(name = "id", value = "id")
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "会议", dataTypeClass = Conference.class)
})
public void conferenceDetail(String id) {
Conference conference = conferenceService.getById(id);
if (conference != null) {
//会议议题列表
List<ConferenceAttachment> conferenceIssueList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>().orderByAsc("sort_no").eq("pid", "").eq("conference_id", (conference.getId())));
//议题列表里装会议附件列表
conferenceIssueList.forEach(conferenceIssue -> {
List<ConferenceAttachment> conferenceAttachmentList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>().orderByAsc("sort_no").eq("pid", conferenceIssue.getId()).eq("conference_id", (conference.getId())));
//处理文件前缀
conferenceAttachmentList.forEach(ConferenceAttachment::full);
conferenceIssue.setConferenceAttachmentList(conferenceAttachmentList);
});
conference.setConferenceIssueList(conferenceIssueList);
//当前登录用户是否已签到
ConferenceUser conferenceUser = conferenceUserService.getOne(new QueryWrapper<ConferenceUser>().eq("conference_id", conference.getId()).eq("user_id", getApiUserId()));
conference.setSign(conferenceUser != null ? conferenceUser.getStatus() : null);
conference.setSignTime(conferenceUser != null ? conferenceUser.getUpdatedAt() : null);
//该会议应签到人数和现签到人数
int allSignCount = conferenceUserService.count(new QueryWrapper<ConferenceUser>().eq("conference_Id", conference.getId()));
int unSignCount = conferenceUserService.count(new QueryWrapper<ConferenceUser>().eq("conference_Id", conference.getId()).eq("status", ConferenceUser.STATUS_UN_SIGN));
conference.setAllSignCount(allSignCount);
conference.setSignedCount(allSignCount - unSignCount);
render(Ret.ok().data(conference));
}
render(Ret.fail("未找到该会议"));
}
@ApiOperation("会议签到")
@GetMapping("sign_in")
@ResponseBody
@ApiImplicitParam(name = "id", value = "会议id")
public void conferenceSignIn(String id) {
Conference conference = conferenceService.getById(id);
if (conference != null) {
if (Conference.END_TAG == conference.getEnd()) render(Ret.fail("该会议已结束,不能签到"));
ConferenceUser conferenceUser = conferenceUserService.getOne(new QueryWrapper<ConferenceUser>().eq("conference_id", id).eq("user_id", getApiUserId()).eq("status", ConferenceUser.STATUS_UN_SIGN));
if (conferenceUser != null) {
conferenceUser.setStatus(ConferenceUser.STATUS_SIGN);
conferenceUserService.updateById(conferenceUser);
render(Ret.ok());
}
render(Ret.fail("签到失败"));
}
render(Ret.fail("未找到该会议,无法签到"));
}
@ApiOperation("删除会议文件")
@GetMapping("conference_file_del")
@ResponseBody
@ApiImplicitParam(name = "id", value = "会议文件id")
public void conferenceFileDel(String id) {
ConferenceAttachment conferenceAttachment = conferenceAttachmentService.getById(id);
if (conferenceAttachment != null) {
if (!conferenceAttachment.getCreatedId().equals(getApiUserId())) render(Ret.fail("您不能删除他人创建的会议的文件"));
boolean flag = conferenceAttachmentService.removeById(id);
render(flag ? Ret.ok() : Ret.fail("操作失败"));
}
render(Ret.fail("未找到该会议文件"));
}
private QueryWrapper<Conference> getQueryWrapper(String title) {
QueryWrapper<Conference> wrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(title)) wrapper.like("title", title);
wrapper.orderByDesc("created_at");
return wrapper;
}
}

View File

@ -0,0 +1,191 @@
package com.ydool.boot.api.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.api.util.SensitiveFilterService;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.core.mybatis.Condition;
import com.ydool.boot.modules.rddb.entity.ContactActivity;
import com.ydool.boot.modules.rddb.entity.ContactActivityComment;
import com.ydool.boot.modules.rddb.entity.Office;
import com.ydool.boot.modules.rddb.service.ContactActivityCommentService;
import com.ydool.boot.modules.rddb.service.ContactActivityService;
import com.ydool.boot.modules.rddb.service.OfficeService;
import com.ydool.boot.modules.rddb.vo.ContactActivityCommentVO;
import com.ydool.boot.modules.rddb.vo.ContactActivityVO;
import com.ydool.boot.modules.rddb.wrapper.ContactActivityCommentWrapper;
import com.ydool.boot.modules.rddb.wrapper.ContactActivityWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Set;
/**
* 联络站活动
*
* @author chenchen
* @date 2020/10/12
*/
@Controller
@RequestMapping("/api/contact_activity")
@Api(value = "联络站活动", tags = "联络站活动")
public class ApiContactActivityController extends ApiBaseController {
@Autowired
private ContactActivityService contactActivityService;
@Autowired
private ContactActivityCommentService contactActivityCommentService;
@Resource
private OfficeService officeService;
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "officeId", value = "联络站id")
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = ContactActivityVO.class)
})
@ApiOperation("联络站活动列表")
@GetMapping("/list")
public void contactActivityList(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
ContactActivityVO vo, String officeId) {
QueryWrapper<ContactActivity> qw = getQueryWrapper(vo.getActivityTheme());
if (StrUtil.isNotBlank(officeId)) {
Office office = officeService.getById(officeId);
if (office != null) {
qw.eq("created_id", office.getUserId());
}
}
IPage<ContactActivity> paged = contactActivityService.page(new Page<>(pageNo, pageSize), qw);
render(Ret.ok().paged(ContactActivityWrapper.build().pageVO(paged)));
}
@ApiImplicitParams({
@ApiImplicitParam(name = "activityTheme", value = "活动名称", required = true),
@ApiImplicitParam(name = "activityDate", value = "活动时间", required = true),
@ApiImplicitParam(name = "activityAddress", value = "活动地点", required = true),
@ApiImplicitParam(name = "activityContent", value = "活动内容", required = true),
@ApiImplicitParam(name = "uploadPersonnel", value = "上传人员"),
// @ApiImplicitParam(name = "photo", value = "图片")
})
@ApiOperation("发布")
@PostMapping("/save")
public void save(String activityTheme, String activityDate, String activityAddress, String activityContent,
String uploadPersonnel) {
ContactActivity bean = new ContactActivity();
bean.setActivityTheme(activityTheme);
bean.setActivityDate(activityDate);
bean.setActivityAddress(activityAddress);
bean.setActivityContent(activityContent);
bean.setActivityUpload(uploadPersonnel);
bean.setCreatedId(getApiUserId());
boolean flag = contactActivityService.saveOrUpdate(bean);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiOperationSupport(
responses = @DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = ContactActivityVO.class)
})
)
@ApiOperation("联络站活动详情")
@ApiImplicitParam(name = "id", value = "id", paramType = "path", required = true)
@GetMapping("/{id}")
public void contactActivity(@PathVariable("id") String id) {
ContactActivity bean = contactActivityService.getById(id);
if (bean == null) {
render(Ret.fail("未找到该活动"));
return;
}
ContactActivityVO vo = ContactActivityWrapper.build().entityVO(bean);
render(Ret.ok().data(vo));
}
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "contactActivityId", value = "联络站活动id", required = true)
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", dataTypeClass = ContactActivityCommentVO.class)
})
@ApiOperation("联络站活动评论列表")
@GetMapping("/comment/list")
public void comment(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
String contactActivityId) {
QueryWrapper<ContactActivityComment> wrapper = new QueryWrapper<>();
wrapper.eq("contact_activity_id", contactActivityId);
wrapper.eq("status", "1");
wrapper.orderByDesc("created_at");
IPage<ContactActivityComment> paged = contactActivityCommentService.page(new Page<>(pageNo, pageSize), wrapper);
render(Ret.ok().paged(ContactActivityCommentWrapper.build().pageVO(paged)));
}
@ApiOperation("评论联络站活动")
@PostMapping("/comment/save")
@ApiImplicitParams({
@ApiImplicitParam(name = "contactActivityId", value = "联络站活动id", required = true),
@ApiImplicitParam(name = "content", value = "评论内容", required = true)
})
public void comment(String contactActivityId, String content) {
if (StrUtil.isBlank(content)) render(Ret.fail("请输入内容"));
SensitiveFilterService instance = SensitiveFilterService.getInstance();
Set<String> sensitiveContents = instance.getSensitiveWord(content, 1);
if (sensitiveContents.size() > 0) render(Ret.fail("您输入的内容含有非法词汇"));
ContactActivityComment bean = new ContactActivityComment();
bean.setContactActivityId(contactActivityId);
bean.setContent(content);
bean.setCreatedId(getApiUserId());
bean.setName(getApiUser().getUserName());
bean.setStatus(1);
boolean flag = contactActivityCommentService.saveOrUpdate(bean);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiOperation("回复评论")
@PostMapping("/comment/reply")
@ApiImplicitParams({
@ApiImplicitParam(name = "commentId", value = "评论id", required = true),
@ApiImplicitParam(name = "replyContent", value = "回复内容", required = true)
})
public void commentReply(String commentId, String content) {
ContactActivityComment bean = contactActivityCommentService.getById(commentId);
if (bean == null) {
render(Ret.fail("未找到该评论"));
return;
}
bean.setReplyContent(content);
bean.setReplyName(getApiUser().getUserName());
bean.setReplyDate(LocalDateTime.now());
boolean flag = contactActivityCommentService.saveOrUpdate(bean);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
private QueryWrapper<ContactActivity> getQueryWrapper(String title) {
QueryWrapper<ContactActivity> qw = new QueryWrapper<>();
Condition.appendIfNotEmpty(title, "activity_theme#like", qw);
qw.orderByDesc("created_at");
return qw;
}
}

View File

@ -0,0 +1,87 @@
package com.ydool.boot.api.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.modules.rddb.entity.DataBank;
import com.ydool.boot.modules.rddb.service.DataBankService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* @author: zhouyuan
* @date: 2020/10/21
*/
@Controller
@RequestMapping("/api/data_bank")
@Api(value = "资料库", tags = "资料库")
public class ApiDataBankController extends ApiBaseController {
@Autowired
DataBankService dataBankService;
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "dataBank", value = "资料库", dataTypeClass = DataBank.class),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "资料库", name = "data", dataTypeClass = DataBank.class)
})
@ApiOperation("资料库列表")
@GetMapping("")
public void dataBankList(DataBank dataBank) {
QueryWrapper<DataBank> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(dataBank.getFileName())) queryWrapper.like("file_name", dataBank.getFileName());
if (StringUtils.isNotBlank(dataBank.getUploadUser()))
queryWrapper.like("upload_user", dataBank.getUploadUser());
if (StringUtils.isNotBlank(dataBank.getFileType())) queryWrapper.eq("file_type", dataBank.getFileType());
IPage<DataBank> paged = dataBankService.page(new Page<>(getPageNum(), getPageSize()), queryWrapper);
paged.getRecords().forEach(DataBank::full);
render(Ret.ok().paged(paged));
}
@ApiImplicitParam(name = "id", value = "id")
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "资料库", dataTypeClass = DataBank.class)
})
@ApiOperation("资料详情")
@GetMapping("detail")
//方法名跟ApiSuperviseThingController一样叫detail竟然响应说明会错乱
public void dataBankDetail(String id) {
DataBank dataBank = dataBankService.getById(id);
if (dataBank != null) {
dataBank.full();
render(Ret.ok().data(dataBank));
}
render(Ret.fail("未找到该资料"));
}
@ApiImplicitParam(name = "id", value = "id")
@ApiOperation("删除")
@DeleteMapping("del")
public void dataBankDel(String id) {
DataBank dataBank = dataBankService.getById(id);
if (dataBank != null) {
if (!dataBank.getCreatedId().equals(getApiUserId())) render(Ret.fail("您不能删除他人上传的文件"));
boolean flag = dataBankService.removeById(dataBank);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
render(Ret.fail("未找到该资料"));
}
}

View File

@ -0,0 +1,108 @@
package com.ydool.boot.api.controller;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.modules.rddb.entity.Db;
import com.ydool.boot.modules.rddb.service.DbService;
import com.ydool.boot.modules.rddb.vo.DbVO;
import com.ydool.boot.modules.rddb.wrapper.DbWrapper;
import com.ydool.boot.modules.sys.entity.Street;
import com.ydool.boot.modules.sys.service.StreetService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author chenchen
* @date 2020/10/12
*/
@Controller
@RequestMapping("/api/db")
@Api(value = "代表", tags = "代表")
public class ApiDbController extends ApiBaseController {
@Autowired
private DbService dbService;
@Autowired
private StreetService streetService;
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页"),
@ApiImplicitParam(name = "pageSize", value = "显示条数"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = DbVO.class)
})
@ApiOperation("代表列表")
@GetMapping("/list")
public void dbList( String pageNo, String pageSize, DbVO dbVO) {
LambdaQueryWrapper<Db> qw = getQueryWrapper(dbVO.getName(), dbVO.getPhone(), dbVO.getSex(),
dbVO.getPrecinctAddress(), dbVO.getDbIdentity(), dbVO.getOfficeId());
if (StrUtil.isNotBlank(pageNo) || StrUtil.isNotBlank(pageSize)) {
IPage<Db> paged = dbService.page(new Page<>(Convert.toInt(pageNo), Convert.toInt(pageSize)), qw);
render(Ret.ok().paged(DbWrapper.build().pageVO(paged)));
} else {
List<Db> list = dbService.list(qw);
render(Ret.ok().data(list));
}
}
@ApiOperationSupport(
responses = @DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = DbVO.class)
})
)
@ApiOperation("代表详情")
@ApiImplicitParam(name = "id", value = "id", paramType = "path", required = true)
@GetMapping("/{id}")
public void notice(@PathVariable("id") String id) {
Db bean = dbService.getById(id);
if (bean == null) {
render(Ret.fail("未找到该代表"));
return;
}
DbVO dbVO = DbWrapper.build().entityVO(bean);
dbVO.full();
render(Ret.ok().data(dbVO));
}
private LambdaQueryWrapper<Db> getQueryWrapper(String name, String phone, String sex, String precinctAddress, String dbIdentity, String officeId) {
LambdaQueryWrapper<Db> qw = new LambdaQueryWrapper<>();
//name可能是人名,也可能是地名
if (StrUtil.isNotBlank(name)) {
Street street = streetService.getOne(new LambdaQueryWrapper<Street>().like(Street::getName, name));
if (street != null) {
name = street.getId();
qw.eq(Db::getPrecinctAddress, name);
} else {
qw.like(StrUtil.isNotBlank(name), Db::getName, name);
}
}
qw.like(StrUtil.isNotBlank(phone), Db::getPhone, phone);
qw.eq(StrUtil.isNotBlank(sex), Db::getSex, sex);
qw.eq(StrUtil.isNotBlank(precinctAddress), Db::getPrecinctAddress, precinctAddress);
qw.eq(StrUtil.isNotBlank(dbIdentity), Db::getDbIdentity, dbIdentity);
qw.eq(StrUtil.isNotBlank(officeId), Db::getOfficeId, officeId);
qw.orderByDesc(Db::getSortNo);
return qw;
}
}

View File

@ -0,0 +1,93 @@
package com.ydool.boot.api.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.modules.rddb.entity.Message;
import com.ydool.boot.modules.rddb.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.List;
/**
* @author: zhouyuan
* @date: 2020/10/15
*/
@Controller
@RequestMapping("/api/message")
@Api(value = "消息", tags = "消息")
public class ApiMessageController extends ApiBaseController {
@Autowired
private MessageService messageService;
@ApiOperation("未读消息数")
@GetMapping("unread_count")
@ResponseBody
public void messageUnreadCount() {
QueryWrapper<Message> wrapper = new QueryWrapper<>();
wrapper.eq("status", Message.STATUS_UNREAD).eq("user_id", getApiUserId());
render(Ret.ok().data(messageService.count(wrapper)));
}
@ApiOperation("已读")
@PostMapping("read")
@ResponseBody
@ApiImplicitParam(name = "id", value = "id")
public void messageRead(String id) {
Message message = messageService.getById(id);
if (message != null) {
message.setStatus(Message.STATUS_READ);
messageService.updateById(message);
}
render(Ret.ok());
}
@ApiOperation("消息列表")
@GetMapping("")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "type", value = "消息类型 不传查全部 1通知文件轮阅 2通知会议 3通知督事 4通知文件审批 5选民建议 6联系人大 7乡镇选民建议 8活动审核 9活动拒绝 10活动通过 11所有人的通知公告;" +
"多个用 , 号分开 如 5,6"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "消息", dataTypeClass = Message.class)
})
public void messageList(String type) {
QueryWrapper<Message> wrapper = new QueryWrapper<>();
wrapper.eq("user_id", getApiUserId());
wrapper.orderByDesc("created_at");
if (StrUtil.isNotBlank(type)) {
type = type + ",11";
} else {
type = "11";
}
String[] split = type.split(",");
List<Integer> integers = new ArrayList<>();
for (String s : split) {
integers.add(Integer.parseInt(s));
}
wrapper.in("type", integers);
Page page = messageService.page(new Page(getPageNum(), getPageSize()), wrapper);
render(Ret.ok().paged(page));
}
}

View File

@ -0,0 +1,101 @@
package com.ydool.boot.api.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.core.mybatis.Condition;
import com.ydool.boot.modules.rddb.entity.Notice;
import com.ydool.boot.modules.rddb.service.NoticeService;
import com.ydool.boot.modules.rddb.vo.NoticeVO;
import com.ydool.boot.modules.rddb.wrapper.NoticeWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
/**
* @author chenchen
* @date 2020/10/12
*/
@Controller
@RequestMapping("/api/notice")
@Api(value = "通知公告", tags = "通知公告")
public class ApiNoticeController extends ApiBaseController {
@Autowired
private NoticeService noticeService;
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "title", value = "标题"),
@ApiImplicitParam(name = "top", value = "是否置顶0不置顶1置顶", dataType = "int")
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = NoticeVO.class)
})
@ApiOperation("通知公告列表")
@GetMapping("/list")
public void noticeList(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
String title, Integer top) {
QueryWrapper<Notice> qw = getQueryWrapper(title, top);
IPage<Notice> paged = noticeService.page(new Page<>(pageNo, pageSize), qw);
render(Ret.ok().paged(NoticeWrapper.build().pageVO(paged)));
}
@ApiOperationSupport(
responses = @DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = NoticeVO.class)
})
)
@ApiOperation("通知公告详情")
@ApiImplicitParam(name = "id", value = "id", paramType = "path", required = true)
@GetMapping("/{id}")
public void notice(@PathVariable("id") String id) {
Notice bean = noticeService.getById(id);
if (bean == null) {
render(Ret.fail("未找到该通知"));
return;
}
NoticeVO noticeVO = NoticeWrapper.build().entityVO(bean);
render(Ret.ok().data(noticeVO));
}
@ApiImplicitParams({
@ApiImplicitParam(name = "title", value = "标题", required = true),
@ApiImplicitParam(name = "content", value = "内容", required = true),
@ApiImplicitParam(name = "noticeDate", value = "通知日期"),
@ApiImplicitParam(name = "top", value = "是否置顶0不置顶1置顶"),
@ApiImplicitParam(name = "uploadPersonnel", value = "上传人员")
})
@ApiOperation("发布公告")
@PostMapping("/save")
public void save(String title, String content, String noticeDate, Integer top, String uploadPersonnel) {
Notice bean = new Notice();
bean.setTitle(title);
bean.setContent(content);
bean.setNoticeDate(noticeDate);
bean.setTop(top);
bean.setUploadPersonnel(uploadPersonnel);
bean.setCreatedId(getApiUserId());
boolean flag = noticeService.saveOrUpdate(bean);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
private QueryWrapper<Notice> getQueryWrapper(String title, Integer top) {
QueryWrapper<Notice> qw = new QueryWrapper<>();
Condition.appendIfNotEmpty(title, "title#like", qw);
qw.orderByDesc("top", "created_at");
return qw;
}
}

View File

@ -0,0 +1,125 @@
package com.ydool.boot.api.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.core.mybatis.Condition;
import com.ydool.boot.modules.rddb.entity.ActivityUser;
import com.ydool.boot.modules.rddb.entity.Perform;
import com.ydool.boot.modules.rddb.service.ActivityUserService;
import com.ydool.boot.modules.rddb.service.PerformService;
import com.ydool.boot.modules.rddb.vo.ActivityVO;
import com.ydool.boot.modules.rddb.vo.PerformVO;
import com.ydool.boot.modules.rddb.wrapper.PerformWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author chenchen
* @date 2020/10/21
*/
@Controller
@RequestMapping("/api/perform")
@Api(value = "履职", tags = "履职")
public class ApiPerformController extends ApiBaseController {
@Autowired
private PerformService performService;
@Resource
private ActivityUserService activityUserService;
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "activityName", value = "活动名称")
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = PerformVO.class)
})
@ApiOperation("我的履职")
@GetMapping("/list/my")
public void performListMy(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
String activityName) {
QueryWrapper<Perform> qw = new QueryWrapper<>();
Condition.appendIfNotEmpty(activityName, "activity_name#like", qw);
qw.eq("created_id", getApiUserId());
qw.orderByDesc("activity_date");
IPage<Perform> paged = performService.page(new Page<>(pageNo, pageSize), qw);
render(Ret.ok().paged(PerformWrapper.build().pageVO(paged)));
}
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = ActivityVO.class)
})
@ApiOperation("履职详情")
@ApiImplicitParam(name = "id", value = "id", paramType = "path", required = true)
@GetMapping("/{id}")
public void activity(@PathVariable("id") String id) {
Perform bean = performService.getById(id);
if (bean == null) {
render(Ret.fail("未找到该履职"));
return;
}
PerformVO vo = PerformWrapper.build().entityVO(bean);
render(Ret.ok().data(vo));
}
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "id 不是activity里面的id"),
@ApiImplicitParam(name = "activityName", value = "活动名称", required = true),
@ApiImplicitParam(name = "activityDate", value = "活动时间", required = true),
@ApiImplicitParam(name = "activityAddress", value = "活动地点", required = true),
@ApiImplicitParam(name = "activityContent", value = "活动内容", required = true),
@ApiImplicitParam(name = "uploadPersonnel", value = "上传人员"),
@ApiImplicitParam(name = "photo", value = "图片")
})
@ApiOperation("发布")
@PostMapping("/save")
public void save(String id, String activityName, String activityDate, String activityAddress, String activityContent,
String uploadPersonnel, String photo) {
Perform bean = new Perform();
bean.setActivityName(activityName);
bean.setActivityDate(activityDate);
bean.setActivityAddress(activityAddress);
bean.setActivityContent(activityContent);
bean.setUploadPersonnel(uploadPersonnel);
bean.setPhoto(photo);
bean.setStatus("0");
bean.setCreatedId(getApiUserId());
boolean flag = performService.saveOrUpdate(bean);
if (flag) {
if (StrUtil.isNotBlank(id)) {
ActivityUser activityUser = activityUserService.getById(id);
if (activityUser != null) {
activityUser.setIsPublishPerform(1);
activityUserService.saveOrUpdate(activityUser);
}
}
}
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
private QueryWrapper<Perform> getQueryWrapper(String activityName) {
QueryWrapper<Perform> qw = new QueryWrapper<>();
Condition.appendIfNotEmpty(activityName, "activity_name#like", qw);
qw.orderByDesc("created_at");
return qw;
}
}

View File

@ -0,0 +1,165 @@
package com.ydool.boot.api.controller;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.modules.rddb.entity.ReadFile;
import com.ydool.boot.modules.rddb.entity.ReadFileUser;
import com.ydool.boot.modules.rddb.service.ReadFileService;
import com.ydool.boot.modules.rddb.service.ReadFileUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* <p>
* 文件 前端控制器
* </p>
*
* @author zhouyuan
* @since 2020-09-30
*/
@Controller
@RequestMapping("/api/readfile")
@Api(value = "文件轮阅", tags = "文件轮阅")
public class ApiReadFileController extends ApiBaseController {
@Autowired
private ReadFileService readFileService;
@Autowired
private ReadFileUserService readFileUserService;
@ApiOperation("轮阅文件列表")
@GetMapping("")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "fileName", value = "文件名称"),
@ApiImplicitParam(name = "type", value = "all所有 read已读 unread未读"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "轮阅", dataTypeClass = ReadFile.class)
})
public void readFileList(String fileName, String type) {
QueryWrapper<ReadFile> wrapper = getQueryWrapper(fileName);
if (StringUtils.isBlank(type) || "all".equals(type))
wrapper.inSql("id", "select file_id from t_read_file_user where user_id='" + getApiUserId() + "'");
if ("read".equals(type))
wrapper.inSql("id", "select file_id from t_read_file_user where status=" + ReadFileUser.STATUS_READ + " and user_id='" + getApiUserId() + "'");
if ("unread".equals(type))
wrapper.inSql("id", "select file_id from t_read_file_user where status=" + ReadFileUser.STATUS_UNREAD + " and user_id='" + getApiUserId() + "'");
Page page = readFileService.page(new Page(getPageNum(), getPageSize()), wrapper);
page.getRecords().forEach(item -> {
ReadFile readFile = (ReadFile) item;
readFile.full();
//已读未读
ReadFileUser readFileUser = readFileUserService.getOne(new QueryWrapper<ReadFileUser>().eq("file_id", readFile.getId()).eq("user_id", getApiUserId()));
if (readFileUser != null) readFile.setReadStatus(readFileUser.getStatus());
});
render(Ret.ok().paged(page));
}
@ApiOperation("我发布的列表")
@GetMapping("mine")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "fileName", value = "文件名称"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "轮阅", dataTypeClass = ReadFile.class)
})
public void readFileMineList(String fileName) {
QueryWrapper<ReadFile> wrapper = getQueryWrapper(fileName);
wrapper.eq("created_id", getApiUserId());
Page page = readFileService.page(new Page(getPageNum(), getPageSize()), wrapper);
page.getRecords().forEach(item -> {
ReadFile readFile = (ReadFile) item;
readFile.full();
//已读数未读数
readFile.setUnReadCount(readFileUserService.count(new QueryWrapper<ReadFileUser>().eq("file_id", readFile.getId()).eq("status", ReadFileUser.STATUS_UNREAD)));
readFile.setReadCount(readFileUserService.count(new QueryWrapper<ReadFileUser>().eq("file_id", readFile.getId()).eq("status", ReadFileUser.STATUS_READ)));
});
render(Ret.ok().paged(page));
}
@ApiOperation("文件详情")
@GetMapping("detail")
@ResponseBody
@ApiImplicitParam(name = "id", value = "文件id")
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", dataTypeClass = ReadFile.class)
})
public void readFileDetail(String id) {
String apiUserId = getApiUserId();
List<ReadFileUser> list = readFileUserService.list(new LambdaQueryWrapper<ReadFileUser>().eq(ReadFileUser::getUserId, apiUserId).eq(ReadFileUser::getFileId, id));
if (CollectionUtil.isNotEmpty(list)) {
ReadFile readFile = readFileService.getById(id);
readFile.full();
render(Ret.ok().data(readFile));
}
fail("您没有查看记录的权限");
}
@ApiOperation("已读")
@PostMapping("read")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "文件id"),
})
public void readFileRead(String id) {
QueryWrapper<ReadFileUser> wrapper = new QueryWrapper<ReadFileUser>();
wrapper.eq("file_id", id).eq("user_id", getApiUserId());
ReadFileUser readFileUser = readFileUserService.getOne(wrapper);
if (readFileUser != null) {
readFileUser.setStatus(ReadFileUser.STATUS_READ);
boolean flag = readFileUserService.updateById(readFileUser);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
render(Ret.fail("未找到该文件"));
}
@ApiOperation("已读人员/未读人员列表")
@GetMapping("users")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "文件id"),
@ApiImplicitParam(name = "type", value = "read已读人员 unread未读人员"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "轮阅阅读情况", dataTypeClass = ReadFileUser.class)
})
public void readFileUsers(String id, String type) {
QueryWrapper<ReadFileUser> wrapper = new QueryWrapper<ReadFileUser>();
wrapper.eq("file_id", id);
if ("read".equals(type)) wrapper.eq("status", ReadFileUser.STATUS_READ);
if ("unread".equals(type)) wrapper.eq("status", ReadFileUser.STATUS_UNREAD);
List<ReadFileUser> list = readFileUserService.list(wrapper);
render(Ret.ok().data(list));
}
private QueryWrapper<ReadFile> getQueryWrapper(String fileName) {
QueryWrapper<ReadFile> wrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(fileName)) wrapper.like("file_name", fileName);
wrapper.orderByDesc("created_at");
return wrapper;
}
}

View File

@ -0,0 +1,74 @@
package com.ydool.boot.api.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.modules.rddb.entity.ResearchArticle;
import com.ydool.boot.modules.rddb.entity.ResearchArticleAttachment;
import com.ydool.boot.modules.rddb.service.ResearchArticleAttachmentService;
import com.ydool.boot.modules.rddb.service.ResearchArticleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* @author: zhouyuan
* @date: 2021/3/6
*/
@Controller
@RequestMapping("/api/research_article")
@Api(value = "调研文章", tags = "调研文章")
public class ApiResearchArticleController extends ApiBaseController {
@Autowired
private ResearchArticleService researchArticleService;
@Autowired
private ResearchArticleAttachmentService researchArticleAttachmentService;
@ApiOperation("列表")
@GetMapping
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "title", value = "会议名称"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "对象", dataTypeClass = ResearchArticle.class)
})
public void list(String title) {
QueryWrapper<ResearchArticle> wrapper = getQueryWrapper(title);
Page page = researchArticleService.page(new Page(getPageNum(), getPageSize()), wrapper);
page.getRecords().forEach(item -> {
ResearchArticle researchArticle = (ResearchArticle) item;
//栏目列表
List<ResearchArticleAttachment> issueList = researchArticleAttachmentService.list(new QueryWrapper<ResearchArticleAttachment>().eq("pid", "").eq("research_article_id", (researchArticle.getId())));
//议栏目列表装附件列表
issueList.forEach(issue -> {
List<ResearchArticleAttachment> conferenceAttachmentList = researchArticleAttachmentService.list(new QueryWrapper<ResearchArticleAttachment>().eq("pid", issue.getId()).eq("research_article_id", (researchArticle.getId())));
issue.setAttachmentList(conferenceAttachmentList);
});
researchArticle.setIssueList(issueList);
});
render(Ret.ok().paged(page));
}
private QueryWrapper<ResearchArticle> getQueryWrapper(String title) {
QueryWrapper<ResearchArticle> wrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(title)) wrapper.like("title", title);
wrapper.orderByDesc("created_at");
return wrapper;
}
}

View File

@ -0,0 +1,33 @@
//package com.ydool.boot.api.controller;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.ydool.boot.common.result.Ret;
//import com.ydool.boot.core.web.BaseController;
//import com.ydool.boot.modules.sys.entity.Street;
//import com.ydool.boot.modules.sys.service.StreetService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//
///**
// * @author chenchen
// * @date 2020/10/12
// */
//@Controller
//@RequestMapping("/api/street")
//@Api(value = "街道", tags = "街道")
//public class ApiStreetController extends BaseController {
//
// @Autowired
// private StreetService streetService;
//
// @ApiOperation("街道列表")
// @GetMapping("")
// public void list() {
// render(Ret.ok().data(streetService.list(new QueryWrapper<Street>().orderByAsc("sort_no"))));
// }
//
//}

View File

@ -0,0 +1,407 @@
package com.ydool.boot.api.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.api.util.SensitiveFilterService;
import com.ydool.boot.common.cache.StreetUtils;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.modules.rddb.entity.*;
import com.ydool.boot.modules.rddb.service.SuperviseThingAttachmentService;
import com.ydool.boot.modules.rddb.service.SuperviseThingCommentService;
import com.ydool.boot.modules.rddb.service.SuperviseThingService;
import com.ydool.boot.modules.rddb.service.SuperviseThingUserService;
import com.ydool.boot.modules.sys.entity.Street;
import com.ydool.boot.modules.sys.entity.User;
import com.ydool.boot.modules.sys.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
/**
* @author: zhouyuan
* @date: 2020/10/15
*/
@Controller
@RequestMapping("/api/supervise_thing")
@Api(value = "督事", tags = "督事")
public class ApiSuperviseThingController extends ApiBaseController {
@Autowired
private SuperviseThingService superviseThingService;
@Autowired
private SuperviseThingCommentService superviseThingCommentService;
@Autowired
private SuperviseThingUserService superviseThingUserService;
@Autowired
private UserService userService;
@Autowired
private SuperviseThingAttachmentService superviseThingAttachmentService;
@ApiOperation("现有督事统计")
@GetMapping("statistics")
public void thingStatistics() {
List<Street> streetList = StreetUtils.getStreetList();
streetList.forEach(item -> {
Integer count = superviseThingService.count(new LambdaQueryWrapper<SuperviseThing>().eq(SuperviseThing::getStreet, item.getId()));
item.setRemarks(count.toString());
item.setContent(null);
});
render(Ret.ok().data(streetList));
}
@ApiOperation("统计的根据街道的督事列表")
@GetMapping("statistic_list/{streetId}")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "streetId", value = "街道id"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "督事", dataTypeClass = SuperviseThing.class)
})
public void thingStatisticsList(@PathVariable String streetId) {
QueryWrapper<SuperviseThing> wrapper = new QueryWrapper<>();
wrapper.eq("street",streetId).orderByDesc("start_time");
Page page = superviseThingService.page(new Page(getPageNum(), getPageSize()), wrapper);
page.getRecords().forEach(item -> {
SuperviseThing superviseThing = (SuperviseThing) item;
superviseThing.full();
});
render(Ret.ok().paged(page));
}
@ApiOperation("公开完成督事列表")
@GetMapping("list")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "督事", dataTypeClass = SuperviseThing.class)
})
public void thingPublicList() {
QueryWrapper<SuperviseThing> wrapper = new QueryWrapper<>();
wrapper.eq("status", SuperviseThing.STATUS_PING);
wrapper.eq("is_public", SuperviseThing.PUBLIC);
wrapper.orderByDesc("start_time");
Page page = superviseThingService.page(new Page(getPageNum(), getPageSize()), wrapper);
page.getRecords().forEach(item -> {
SuperviseThing superviseThing = (SuperviseThing) item;
superviseThing.full();
});
render(Ret.ok().paged(page));
}
@ApiOperation("参加的或本人创建的督事列表 ")
@GetMapping("private_list")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "type", value = "join参加 create创建"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "督事", dataTypeClass = SuperviseThing.class)
})
public void thingPrivateList(String type) {
QueryWrapper<SuperviseThing> wrapper = new QueryWrapper<>();
if ("join".equals(type))
wrapper.inSql("id", "select supervise_thing_id from t_supervise_thing_user where user_id='" + getApiUserId() + "'");
if ("create".equals(type))
wrapper.eq("created_id", getApiUserId());
wrapper.orderByDesc("start_time");
Page page = superviseThingService.page(new Page(getPageNum(), getPageSize()), wrapper);
page.getRecords().forEach(item -> {
SuperviseThing superviseThing = (SuperviseThing) item;
superviseThing.full();
if ("join".equals(type)) {
//当前登录用户是否已签到
SuperviseThingUser superviseThingUser = superviseThingUserService.getOne(new QueryWrapper<SuperviseThingUser>().eq("supervise_thing_id", ((SuperviseThing) item).getId()).eq("user_id", getApiUserId()));
superviseThing.setSign(superviseThingUser != null ? superviseThingUser.getStatus() : null);
superviseThing.setSignTime(superviseThingUser != null ? superviseThingUser.getUpdatedAt() : null);
}
});
render(Ret.ok().paged(page));
}
@ApiOperation("督事详情")
@GetMapping("detail")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "督事id"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "督事", dataTypeClass = SuperviseThing.class)
})
public void thingDetail(String id) {
SuperviseThing superviseThing = superviseThingService.getById(id);
if (superviseThing != null) {
superviseThing.full();
//当前登录用户是否已签到
SuperviseThingUser superviseThingUser = superviseThingUserService.getOne(new QueryWrapper<SuperviseThingUser>().eq("supervise_thing_id", id).eq("user_id", getApiUserId()));
superviseThing.setSign(superviseThingUser != null ? superviseThingUser.getStatus() : null);
superviseThing.setSignTime(superviseThingUser != null ? superviseThingUser.getUpdatedAt() : null);
//该会议应签到人数和现签到人数
int allSignCount = superviseThingUserService.count(new QueryWrapper<SuperviseThingUser>().eq("supervise_thing_id", id));
int unSignCount = superviseThingUserService.count(new QueryWrapper<SuperviseThingUser>().eq("supervise_thing_id", id).eq("status", ConferenceUser.STATUS_UN_SIGN));
superviseThing.setAllSignCount(allSignCount);
superviseThing.setSignedCount(allSignCount - unSignCount);
render(Ret.ok().data(superviseThing));
}
render(Ret.fail("未找到该督事"));
}
@ApiOperation("督事已签到/未签到 人员列表")
@GetMapping("sign_user")
@ResponseBody
@ApiImplicitParam(name = "id", value = "督事id")
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "督事", dataTypeClass = SuperviseThingUser.class)
})
public void thingSignUser(String id) {
List<SuperviseThingUser> superviseThingUsers = superviseThingUserService.list(new QueryWrapper<SuperviseThingUser>().eq("supervise_thing_id", id));
render(Ret.ok().data(superviseThingUsers));
}
@ApiOperation("督事评论列表")
@GetMapping("comments")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "id", value = "督事id")
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "督事评论信息", dataTypeClass = SuperviseThingComment.class)
})
public void thingComments(String id) {
QueryWrapper<SuperviseThingComment> wrapper = new QueryWrapper<>();
wrapper.eq("supervise_thing_id", id);
wrapper.eq("status", SuperviseThingComment.STATUS_PASS);
wrapper.orderByDesc("created_at");
Page page = superviseThingCommentService.page(new Page(getPageNum(), getPageSize()), wrapper);
page.getRecords().forEach(item -> {
SuperviseThingComment superviseThingComment = (SuperviseThingComment) item;
//回复人的信息
User user = userService.getById(superviseThingComment.getReplyUserId());
if (user != null) {
if (StrUtil.isNotBlank(user.getAvatar())) user.setAvatar(Const.URL_PREFIX + user.getAvatar());
superviseThingComment.setUser(user);
}
//评论人的信息
User createUser = userService.getById(superviseThingComment.getCreatedId());
if (createUser != null) {
if (StrUtil.isNotBlank(createUser.getAvatar()))
createUser.setAvatar(Const.URL_PREFIX + createUser.getAvatar());
superviseThingComment.setCreateUser(createUser);
}
});
render(Ret.ok().paged(page));
}
@ApiOperation("评论督事")
@PostMapping("comment")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "督事id"),
@ApiImplicitParam(name = "content", value = "评论")
})
public void thingComment(String id, String content) {
if (StrUtil.isBlank(content)) render(Ret.fail("请输入内容"));
SensitiveFilterService instance = SensitiveFilterService.getInstance();
Set<String> sensitiveContents = instance.getSensitiveWord(content, 1);
if (sensitiveContents.size() > 0) render(Ret.fail("您输入的内容含有非法词汇"));
SuperviseThingComment superviseThingComment = new SuperviseThingComment();
superviseThingComment.setSuperviseThingId(id);
superviseThingComment.setContent(content);
superviseThingComment.setCreatedId(getApiUserId());
superviseThingComment.setName(getApiUser().getUserName());
//改为默认通过 由后台进行删除
superviseThingComment.setStatus(SuperviseThingComment.STATUS_PASS);
boolean flag = superviseThingCommentService.saveOrUpdate(superviseThingComment);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiOperation("回复")
@PostMapping("replay_comment")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "督事评论id"),
@ApiImplicitParam(name = "content", value = "评论")
})
public void replayThingComment(String id, String content) {
if (StrUtil.isBlank(content)) render(Ret.fail("请输入内容"));
SensitiveFilterService instance = SensitiveFilterService.getInstance();
Set<String> sensitiveContents = instance.getSensitiveWord(content, 1);
if (sensitiveContents.size() > 0) render(Ret.fail("您输入的内容含有非法词汇"));
SuperviseThingComment superviseThingComment = superviseThingCommentService.getById(id);
if (superviseThingComment != null) {
superviseThingComment.setReplyUserId(getApiUserId());
superviseThingComment.setReplyContent(content);
superviseThingComment.setReplyTime(LocalDateTime.now());
superviseThingCommentService.updateById(superviseThingComment);
boolean flag = superviseThingCommentService.saveOrUpdate(superviseThingComment);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
render(Ret.fail("未找到该评论"));
}
@ApiOperation("新增督事 //督事新增后进入议状态")
@PostMapping("save")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "superviseThing", value = "督事对象", dataTypeClass = SuperviseThing.class),
@ApiImplicitParam(name = "userIds", value = "选择的用户id多个以英文逗号间隔")
})
public void thingSave(@Validated SuperviseThing superviseThing, @RequestParam(name = "userIds", defaultValue = "") String userIds) {
render(superviseThingService.insertOrUpdate(superviseThing, getApiUser(), userIds, null));
}
@ApiOperation("上传督事资料")
@PostMapping("upload_data")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "督事id"),
@ApiImplicitParam(name = "record", value = "会议纪要"),
@ApiImplicitParam(name = "deptReply", value = "会议部门回复"),
@ApiImplicitParam(name = "picture", value = "会议图片,多张逗号间隔"),
})
public void thingUploadData(String id, String record, String deptReply, String picture) {
SuperviseThing superviseThing = superviseThingService.getById(id);
superviseThing.setRecord(record);
superviseThing.setDeptReply(deptReply);
superviseThingService.uploadFile(id, picture, "", getApiUserId());
//需要至少上传过一次督事文件的才能进入评环节
int count = superviseThingAttachmentService.count(new LambdaQueryWrapper<SuperviseThingAttachment>().eq(SuperviseThingAttachment::getSuperviseThingId, id));
//默认我们给了问 四个议题
if (count > 4) {
//进入评状态
superviseThing.setStatus(SuperviseThing.STATUS_PING);
}
boolean flag = superviseThingService.updateById(superviseThing);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiOperation("上传督事文件")
@PostMapping("upload_file")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "督事id"),
@ApiImplicitParam(name = "picture", value = "会议图片,多张逗号间隔"),
@ApiImplicitParam(name = "status", value = "问/议/督/评"),
})
public void thingUploadFile(String id, String picture, String status) {
render(superviseThingService.uploadFile(id, picture, status, getApiUserId()));
}
@ApiOperation("手动进入督环节")
@PostMapping("to_do")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "督事id"),
})
public void thingToDo(String id) {
SuperviseThing superviseThing = this.superviseThingService.getById(id);
if (superviseThing != null) {
superviseThing.setStatus(SuperviseThing.STATUS_DU);
boolean flag = superviseThingService.updateById(superviseThing);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
render(Ret.fail("未找到该督事"));
}
@ApiOperation("签到/请假 //全部人员签到后由议进入督状态")
@PostMapping("sign_in")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "督事id"),
@ApiImplicitParam(name = "type", value = "sign签到 leave请假"),
})
public void thingSignIn(String id, String type) {
SuperviseThingUser superviseThingUser = superviseThingUserService.getOne(new QueryWrapper<SuperviseThingUser>().eq("supervise_thing_id", id).eq("user_id", getApiUserId()));
if (superviseThingUser != null) {
if ("sign".equals(type))
superviseThingUser.setStatus(SuperviseThingUser.STATUS_SIGN);
if ("leave".equals(type))
superviseThingUser.setStatus(SuperviseThingUser.STATUS_LEAVE);
//签到 及检查是否全部签到完成更新督事状态
render(superviseThingUserService.signIn(superviseThingUser));
}
render(Ret.fail("未找到该督事"));
}
@ApiOperation("获取签到状态")
@GetMapping("sign_status")
@ResponseBody
@ApiImplicitParam(name = "id", value = "督事id")
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "签到信息", dataTypeClass = SuperviseThingUser.class)
})
public void thingSignStatus(String id) {
SuperviseThingUser superviseThingUser = superviseThingUserService.getOne(new QueryWrapper<SuperviseThingUser>().eq("supervise_thing_id", id).eq("user_id", getApiUserId()));
render(Ret.ok().data(superviseThingUser));
}
@ApiOperation("公开/不公开")
@PostMapping("change_isPublic")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "督事id"),
@ApiImplicitParam(name = "type", value = "public公开 private不公开"),
})
public void thingChangePublic(String id, String type) {
SuperviseThing superviseThing = superviseThingService.getById(id);
if (superviseThing != null) {
if ("public".equals(type))
superviseThing.setIsPublic(SuperviseThing.PUBLIC);
if ("private".equals(type))
superviseThing.setIsPublic(SuperviseThing.NO_PUBLIC);
boolean flag = superviseThingService.updateById(superviseThing);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
render(Ret.fail("未找到该督事"));
}
@ApiOperation("删除督事")
@GetMapping("del")
@ResponseBody
@ApiImplicitParam(name = "id", value = "id")
public void thingDel(String id) {
SuperviseThing superviseThing = superviseThingService.getById(id);
if (superviseThing != null) {
if (!superviseThing.getCreatedId().equals(getApiUserId())) render(Ret.fail("您不能删除他人创建的会议的文件"));
boolean flag = superviseThingService.removeById(id);
render(flag ? Ret.ok() : Ret.fail("操作失败"));
}
render(Ret.fail("未找到该督事"));
}
}

View File

@ -0,0 +1,132 @@
package com.ydool.boot.api.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.boot.api.util.Kv;
import com.ydool.boot.common.cache.DictUtils;
import com.ydool.boot.common.cache.StreetUtils;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.modules.rddb.entity.Temporary;
import com.ydool.boot.modules.rddb.service.TemporaryService;
import com.ydool.boot.modules.sys.entity.Street;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.ArrayList;
import java.util.List;
/**
* @author: zhouyuan
* @date: 2020/10/21
*/
@Controller
@RequestMapping("/api/temporary")
@Api(value = "临时文件", tags = "临时文件")
public class ApiTemporaryController extends ApiBaseController {
@Autowired
TemporaryService temporaryService;
@ApiImplicitParams({
@ApiImplicitParam(name = "fileName", value = "名称"),
@ApiImplicitParam(name = "type", value = "1 或2 1决议决定 2议案建议"),
@ApiImplicitParam(name = "category", value = "字典temporary_category"),
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
})
@ApiOperation("临时功能 列表")
@GetMapping("")
public void temporaryList(String fileName, String type, String category) {
QueryWrapper<Temporary> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(fileName)) queryWrapper.like("file_name", fileName);
if (StringUtils.isNotBlank(type)) {
queryWrapper.eq("type", type);
if ("1".equals(type)) {
queryWrapper.orderByDesc("created_at");
} else {
queryWrapper.orderByAsc("sort_no", "created_at");
}
}
if (StringUtils.isNotBlank(category)) queryWrapper.eq("category", category);
Page page = temporaryService.page(new Page(getPageNum(), getPageSize()), queryWrapper);
page.getRecords().forEach(item -> {
Temporary temporary = (Temporary) item;
temporary.setFullRate(DictUtils.getDictLabel("temporary_full_rate", temporary.getFullRate()));
temporary.setSatisfactoryRate(DictUtils.getDictLabel("temporary_satisfactory_rate", temporary.getSatisfactoryRate()));
});
render(Ret.ok().paged(page));
}
@ApiOperation("议案建议统计")
@GetMapping("statistics")
public void statistics() {
List list = new ArrayList();
List<Street> streetList = StreetUtils.getStreetList();
streetList.forEach(item -> {
//完成度是
Integer finishCount = temporaryService.count(new LambdaQueryWrapper<Temporary>().eq(Temporary::getType, 2).eq(Temporary::getStreet,item.getId()).eq(Temporary::getFullRate, 1));
//完成度否
Integer unFinishCount = temporaryService.count(new LambdaQueryWrapper<Temporary>().eq(Temporary::getType, 2).eq(Temporary::getStreet,item.getId()).eq(Temporary::getFullRate, 2));
//满意度满意
Integer satisfactionCount = temporaryService.count(new LambdaQueryWrapper<Temporary>().eq(Temporary::getType, 2).eq(Temporary::getStreet,item.getId()).eq(Temporary::getSatisfactoryRate, 1));
//满意度不满意
Integer unSatisfaction = temporaryService.count(new LambdaQueryWrapper<Temporary>().eq(Temporary::getType, 2).eq(Temporary::getStreet,item.getId()).eq(Temporary::getSatisfactoryRate, 2));
Kv kv = Kv.create();
kv.put("streetName", item.getName());
kv.put("finishCount", finishCount);
kv.put("unFinishCount", unFinishCount);
kv.put("satisfactionCount", satisfactionCount);
kv.put("unSatisfaction", unSatisfaction);
list.add(kv);
});
//各乡镇街道完成度满意度的统计
render(Ret.ok().data(list));
}
// @ApiImplicitParams({
// @ApiImplicitParam(name = "fileName", value = "名称"),
// @ApiImplicitParam(name = "type", value = "1 或2 1决议决定 2议案建议"),
// @ApiImplicitParam(name = "file", value = "文件路径 单文件"),
// })
// @ApiOperation("添加")
// @PostMapping("save")
// public void save(String fileName, String type, String file) {
// Temporary temporary = new Temporary();
// temporary.setFileName(fileName);
// temporary.setType(type);
// temporary.setFile(file);
// temporary.setCreatedId(getApiUserId());
// temporary.setUploadUser(getApiUser().getUserName());
// boolean flag = temporaryService.saveOrUpdate(temporary);
// render(!flag ? Ret.fail("操作失败") : Ret.ok());
// }
@ApiImplicitParam(name = "id", value = "id")
@ApiOperation("删除")
@DeleteMapping("del")
public void temporaryDel(String id) {
Temporary temporary = temporaryService.getById(id);
if (temporary != null) {
if (!temporary.getCreatedId().equals(getApiUserId())) render(Ret.fail("您不能删除他人上传的文件"));
boolean flag = temporaryService.removeById(temporary);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
render(Ret.fail("未找到该资料"));
}
}

View File

@ -0,0 +1,54 @@
package com.ydool.boot.api.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.core.web.BaseController;
import com.ydool.boot.modules.sys.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
/**
* @author chenchen
* @date 2020/10/13
*/
@Controller
@RequestMapping("/api/upload")
@Api(value = "上传文件", tags = "上传文件")
public class ApiUploadController extends BaseController {
@Resource
private FileService fileService;
@ApiOperation("上传文件")
@PostMapping(value = "/upload_json")
public void uploadJson(@NotNull(message = "file is null") @RequestParam("files") MultipartFile[] files) {
List<String> pathList = new ArrayList<>();
for (MultipartFile file : files) {
String reg = ".+(.exe|.bat|.sh|.java|.php|.js|.py)$";
String suffix = FileUtil.getSuffix(file.getOriginalFilename());
if(Pattern.matches(reg,file.getOriginalFilename())){
render(Ret.fail("不能上传后缀为"+suffix+"的文件"));
}
String str = fileService.uploadFile(file);
if (StrUtil.isNotBlank(str)) {
pathList.add(str);
}
}
boolean flag = CollUtil.isNotEmpty(pathList);
render(flag ? Ret.ok().data(pathList) : Ret.fail("操作失败"));
}
}

View File

@ -0,0 +1,205 @@
package com.ydool.boot.api.controller;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.api.util.Kv;
import com.ydool.boot.common.Ydool;
import com.ydool.boot.common.cache.ConfigUtils;
import com.ydool.boot.common.config.Global;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.core.validator.NumberLetter;
import com.ydool.boot.core.validator.Password;
import com.ydool.boot.modules.rddb.entity.Const;
import com.ydool.boot.modules.rddb.entity.Db;
import com.ydool.boot.modules.rddb.entity.Office;
import com.ydool.boot.modules.rddb.entity.UserType;
import com.ydool.boot.modules.rddb.service.DbService;
import com.ydool.boot.modules.rddb.service.OfficeService;
import com.ydool.boot.modules.rddb.service.SyncNameService;
import com.ydool.boot.modules.rddb.service.UserTypeService;
import com.ydool.boot.modules.sys.entity.User;
import com.ydool.boot.modules.sys.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author: zhouyuan
* @date: 2020/10/10
*/
@RestController
@RequestMapping(value = "/api/user")
@Api(value = "用户信息接口", tags = "用户信息")
public class ApiUserController extends ApiBaseController {
@Autowired
private OfficeService officeService;
@Autowired
private DbService dbService;
@Autowired
private UserService userService;
@Autowired
private SyncNameService syncNameService;
@Autowired
private UserTypeService userTypeService;
@GetMapping("")
@ResponseBody
@ApiOperation(value = "获取当前登录用户的信息")
public void info() {
User user = getApiUser();
if (StringUtils.isNotBlank(user.getAvatar())) user.setAvatar(Const.URL_PREFIX + user.getAvatar());
Kv kv = Kv.create().set("user", user);
//机关干部
if (isAdmin() || isStreet() || isContact()) {
Office office = officeService.getOne(new QueryWrapper<Office>().eq("user_id", user.getId()));
if (office != null) {
office.fullInfo();
}
kv.set("office", office);
}
//人大代表
if (isRddb()) {
Db rddb = dbService.getOne(new QueryWrapper<Db>().eq("user_id", user.getId()));
kv.set("rddb", rddb);
}
//选民没有其他信息
render(Ret.ok().data(kv));
}
@PostMapping("")
@ResponseBody
@ApiOperation(value = "修改用户信息")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "name", value = "名字"),
@ApiImplicitParam(name = "portrait", value = "头像"),
@ApiImplicitParam(name = "street", value = "辖区")
})
public void info(@RequestParam("portrait") String portrait, @RequestParam("name") String name, @RequestParam("street") String street) {
if (StrUtil.isNotBlank(portrait) && portrait.contains(Const.URL_PREFIX))
portrait = portrait.replace(Const.URL_PREFIX, "");
User user = getApiUser();
user.setUserName(name);
user.setAvatar(portrait);
user.setStreetId(street);
//机关干部
if (isAdmin() || isStreet() || isContact()) {
Office office = officeService.getOne(new QueryWrapper<Office>().eq("user_id", user.getId()));
if (office != null) {
office.setStreet(street);
if (!office.getName().equals(name)) {
//改了用户名需要同步
office.setName(name);
syncNameService.sync(user);
}
officeService.update(user, office);
}
}
//人大代表
if (isRddb()) {
Db rddb = dbService.getOne(new QueryWrapper<Db>().eq("user_id", user.getId()));
rddb.setName(name);
rddb.setPrecinctAddress(street);
dbService.update(user, rddb);
}
//选民只有基本信息
//都需要更新user
userService.saveOrUpdate(user);
render(Ret.ok());
}
@ApiOperation("用户列表")
@GetMapping("users")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "不传为全部,传多个以英文逗号分隔 admin县级人大工作人员 street乡镇负责人 contact联络站负责人 rddb各级人大代表 voter选民用户"),
@ApiImplicitParam(name = "userName", value = "用户名")
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", dataTypeClass = User.class)
})
public void users(String type, String userName) {
QueryWrapper<User> wrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(type)) {
wrapper.and(consumer -> {
if (type.contains("admin")) consumer.or().eq("account_type", "admin");
if (type.contains("rddb")) consumer.or().eq("account_type", "rddb");
if (type.contains("voter")) consumer.or().eq("account_type", "voter");
if (type.contains("street")) consumer.or().eq("account_type", "street");
if (type.contains("contact")) consumer.or().eq("account_type", "contact");
});
}
if (StringUtils.isNotBlank(userName)) wrapper.like("user_name", userName);
Page page = userService.page(new Page(getPageNum(), getPageSize()), wrapper);
render(Ret.ok().paged(page));
}
@ApiOperation("重置密码")
@PostMapping(value = "reset_pwd")
public void resetPwd() {
User user = getApiUser();
user.setSalt(RandomUtil.randomString(6));
user.setPassword(Ydool.password(user.getSalt(), Global.getConfig(ConfigUtils.USER_INIT_PASSWORD)));
user.setInitPwd(true);
renderJson(userService.updateById(user) ? Ret.ok().msg("用户密码已被初始化,初始后的密码是:" + Global.getConfig(ConfigUtils.USER_INIT_PASSWORD)) : Ret.fail("重置用户密码失败"));
}
@ApiOperation("修改密码")
@PostMapping(value = "edit_pwd")
public void editPwd(
@NotBlank(message = "请输入旧密码") String oldPassword,
@NumberLetter(message = "密码需带有英文,数字") String newPassword,
@NotBlank(message = "请输入确认密码") String confirmNewPassword) {
User user = getApiUser();
if (!(Ydool.password(user.getSalt(), oldPassword)).equals(user.getPassword())) renderJson(Ret.fail("旧密码不正确"));
if ((Ydool.password(user.getSalt(), newPassword)).equals(user.getPassword()))
renderJson(Ret.fail("新密码不可与旧密码相同"));
if (!confirmNewPassword.equals(newPassword)) renderJson(Ret.fail("两次密码不相同"));
user.setPassword(Ydool.password(user.getSalt(), newPassword));
user.setInitPwd(false);
user.setLastUpdatePwd(LocalDateTime.now());
boolean flag = userService.saveOrUpdate(user);
renderJson(flag ? Ret.ok().msg("密码修改成功") : Ret.fail("密码修改失败"));
}
@ApiOperation("当前登录用户的身份列表")
@GetMapping("types")
@ResponseBody
public void types() {
User user = getApiUser();
List<String> typeList = userTypeService.list(new LambdaQueryWrapper<UserType>().ne(UserType::getType, user.getAccountType()).eq(UserType::getUserId, user.getId())).stream().map(UserType::getType).collect(Collectors.toList());
render(Ret.ok().data(typeList));
}
@ApiOperation("切换身份")
@PostMapping(value = "change_type")
public void changeType(String type) {
User user = getApiUser();
List<String> typeList = userTypeService.list(new LambdaQueryWrapper<UserType>().eq(UserType::getUserId, user.getId())).stream().map(UserType::getType).collect(Collectors.toList());
if (typeList.contains(type)) {
user.setAccountType(type);
boolean flag = userService.updateById(user);
renderJson(flag ? Ret.ok().msg("修改成功") : Ret.fail("修改失败"));
}
renderJson(Ret.fail("该用户没有此身份"));
}
}

View File

@ -0,0 +1,377 @@
package com.ydool.boot.api.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.core.mybatis.Condition;
import com.ydool.boot.modules.rddb.entity.Message;
import com.ydool.boot.modules.rddb.entity.Office;
import com.ydool.boot.modules.rddb.entity.VoterSuggest;
import com.ydool.boot.modules.rddb.entity.VoterSuggestSolve;
import com.ydool.boot.modules.rddb.service.MessageService;
import com.ydool.boot.modules.rddb.service.OfficeService;
import com.ydool.boot.modules.rddb.service.VoterSuggestService;
import com.ydool.boot.modules.rddb.service.VoterSuggestSolveService;
import com.ydool.boot.modules.rddb.vo.VoterSuggestSolveVO;
import com.ydool.boot.modules.rddb.vo.VoterSuggestVO;
import com.ydool.boot.modules.rddb.wrapper.VoterSuggestSolveWrapper;
import com.ydool.boot.modules.rddb.wrapper.VoterSuggestWrapper;
import com.ydool.boot.modules.sys.entity.User;
import com.ydool.boot.modules.sys.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* 选民建议
*
* @author chenchen
* @date 2020/10/12
*/
@Controller
@RequestMapping("/api/voter_suggest")
@Api(value = "选民建议", tags = "选民建议")
public class ApiVoterSuggestController extends ApiBaseController {
@Autowired
private VoterSuggestService voterSuggestService;
@Autowired
private VoterSuggestSolveService voterSuggestSolveService;
@Autowired
private MessageService messageService;
@Autowired
private UserService userService;
@Autowired
private OfficeService officeService;
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "suggestTitle", value = "建议名称")
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = VoterSuggestVO.class)
})
@ApiOperation("选民建议列表")
@GetMapping("/list/all")
public void voterSuggestListAll(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
String suggestTitle) {
QueryWrapper<VoterSuggest> qw = new QueryWrapper<>();
Condition.appendIfNotEmpty(suggestTitle, "suggest_title#like", qw);
qw.eq("street_id", getApiUser().getStreetId());
qw.orderByDesc("created_at");
IPage<VoterSuggest> paged = voterSuggestService.page(new Page<>(pageNo, pageSize), qw);
for (VoterSuggest record : paged.getRecords()) {
QueryWrapper<VoterSuggestSolve> wrapper = new QueryWrapper<>();
wrapper.eq("voter_suggest_id", record.getId());
// wrapper.eq("status", "1");
wrapper.orderByDesc("created_at");
List<VoterSuggestSolve> voterSuggestSolves = voterSuggestSolveService.list(wrapper);
List<VoterSuggestSolveVO> voterSuggestSolveVoS = new ArrayList<>();
for (VoterSuggestSolve item : voterSuggestSolves) {
VoterSuggestSolveVO solveVO = VoterSuggestSolveWrapper.build().entityVO(item);
voterSuggestSolveVoS.add(solveVO);
}
record.setVoterSuggestSolveList(voterSuggestSolveVoS);
}
render(Ret.ok().paged(VoterSuggestWrapper.build().pageVO(paged)));
}
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = VoterSuggestVO.class)
})
@ApiOperation("我的建议")
@GetMapping("/list")
public void voterSuggestList(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
QueryWrapper<VoterSuggest> qw = getQueryWrapper(getApiUserId());
IPage<VoterSuggest> paged = voterSuggestService.page(new Page<>(pageNo, pageSize), qw);
// for (VoterSuggest record : paged.getRecords()) {
// QueryWrapper<VoterSuggestSolve> wrapper = new QueryWrapper<>();
// wrapper.eq("voter_suggest_id", record.getId());
// wrapper.eq("status", "1");
// wrapper.orderByDesc("created_at");
// List<VoterSuggestSolve> voterSuggestSolves = voterSuggestSolveService.list(wrapper);
// List<VoterSuggestSolveVO> voterSuggestSolveVoS = new ArrayList<>();
// for (VoterSuggestSolve item : voterSuggestSolves) {
// VoterSuggestSolveVO solveVO = VoterSuggestSolveWrapper.build().entityVO(item);
// voterSuggestSolveVoS.add(solveVO);
// }
// record.setVoterSuggestSolveList(voterSuggestSolveVoS);
// }
render(Ret.ok().paged(VoterSuggestWrapper.build().pageVO(paged)));
}
@ApiOperationSupport(
responses = @DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = VoterSuggestVO.class)
})
)
@ApiOperation("建议详情")
@ApiImplicitParam(name = "id", value = "id", paramType = "path", required = true)
@GetMapping("/{id}")
public void voterSuggest(@PathVariable("id") String id) {
VoterSuggest bean = voterSuggestService.getById(id);
if (bean == null) {
render(Ret.fail("未找到该建议"));
return;
}
//建议回复已读状态
QueryWrapper<VoterSuggestSolve> wrapper = new QueryWrapper<>();
wrapper.eq("voter_suggest_id", id);
wrapper.eq("status", "1");
List<VoterSuggestSolve> voterSuggestSolves = voterSuggestSolveService.list(wrapper);
for (VoterSuggestSolve item : voterSuggestSolves) {
item.setIsRead(1);
voterSuggestSolveService.saveOrUpdate(item);
}
VoterSuggestVO vo = VoterSuggestWrapper.build().entityVO(bean);
render(Ret.ok().data(vo));
}
@ApiImplicitParams({
// @ApiImplicitParam(name = "voterName", value = "选民姓名", required = true),
@ApiImplicitParam(name = "suggestTitle", value = "建议标题", required = true),
@ApiImplicitParam(name = "suggestContent", value = "建议内容", required = true),
@ApiImplicitParam(name = "streetId", value = "街道"),
@ApiImplicitParam(name = "liaisonStationId", value = "联络站"),
@ApiImplicitParam(name = "photo", value = "图片")
})
@ApiOperation("提交选民建议")
@PostMapping("/save")
public void save(String suggestTitle, String suggestContent, String streetId, String liaisonStationId, String photo) {
VoterSuggest entity = new VoterSuggest();
entity.setSuggestTitle(suggestTitle);
entity.setSuggestContent(suggestContent);
entity.setStreetId(streetId);
entity.setPhoto(photo);
entity.setCreatedId(getApiUserId());
entity.setVoterName(getApiUser().getUserName());
boolean flag = voterSuggestService.saveOrUpdate(entity);
//添加消息
if (flag) {
List<User> users = userService.list(new QueryWrapper<User>().eq("street_id", streetId));
for (User user : users) {
Message message = new Message();
message.setActionId(entity.getId());
message.setTitle("收到一条选民建议,请前往查看!");
message.setContent(suggestTitle);
message.setType(Message.TYPE_VOTER_STREET);
message.setCreatedId(getApiUserId());
message.setStatus(Message.STATUS_UNREAD);
message.setUserId(user.getId());
messageService.save(message);
}
if (StrUtil.isNotBlank(liaisonStationId)) {
Office office = officeService.getById(liaisonStationId);
if (office != null) {
Message message = new Message();
message.setActionId(entity.getId());
message.setTitle("收到一条选民建议,请前往查看!");
message.setContent(suggestTitle);
message.setType(Message.TYPE_VOTER_STREET);
message.setCreatedId(getApiUserId());
message.setStatus(Message.STATUS_UNREAD);
message.setUserId(office.getUserId());
messageService.save(message);
}
}
}
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiOperation("回复选民建议")
@PostMapping("/solve/save")
@ApiImplicitParams({
@ApiImplicitParam(name = "voterSuggestId", value = "选民建议id", required = true),
@ApiImplicitParam(name = "replyContent", value = "回复内容", required = true)
})
public void solve(String voterSuggestId, String replyContent) {
VoterSuggestSolve bean = voterSuggestSolveService.getOne(new QueryWrapper<VoterSuggestSolve>()
.eq("voter_suggest_id", voterSuggestId).eq("user_id", getApiUserId()));
if (bean == null) {
//该建议未分配人员解决或你不是解决人员的时候联络站和乡镇管理员可以回复
bean = new VoterSuggestSolve();
bean.setVoterSuggestId(voterSuggestId);
bean.setUserId(getApiUserId());
bean.setCreatedId(getApiUserId());
// render(Ret.fail("该建议无法回复"));
// return;
}
bean.setReplyContent(replyContent);
bean.setUpdatedId(getApiUserId());
bean.setStatus("1");
bean.setIsRead(0);
boolean flag = voterSuggestSolveService.saveOrUpdate(bean);
//添加消息
if (flag) {
VoterSuggest voterSuggest = voterSuggestService.getById(voterSuggestId);
Message message = new Message();
message.setActionId(voterSuggestId);
message.setTitle(getApiUser().getUserName() + "回复了您的建议");
message.setContent(replyContent);
message.setType(Message.TYPE_VOTER);
message.setCreatedId(getApiUserId());
message.setStatus(Message.STATUS_UNREAD);
message.setUserId(voterSuggest.getCreatedId());
messageService.save(message);
}
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "voterSuggestId", value = "选民建议id", required = true)
})
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", dataTypeClass = VoterSuggestSolveVO.class)
})
@ApiOperation("建议 回复列表")
@GetMapping("/solve/list")
public void solve(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
String voterSuggestId) {
QueryWrapper<VoterSuggestSolve> wrapper = new QueryWrapper<>();
wrapper.eq("voter_suggest_id", voterSuggestId);
// wrapper.eq("status", "1");
wrapper.orderByDesc("created_at");
IPage<VoterSuggestSolve> paged = voterSuggestSolveService.page(new Page<>(pageNo, pageSize), wrapper);
render(Ret.ok().paged(VoterSuggestSolveWrapper.build().pageVO(paged)));
}
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "suggestTitle", value = "建议名称")
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = VoterSuggestVO.class)
})
@ApiOperation("待回复建议列表")
@GetMapping("/wait_reply")
public void waitReplyList(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
String suggestTitle) {
QueryWrapper<VoterSuggest> qw = new QueryWrapper<>();
Condition.appendIfNotEmpty(suggestTitle, "suggest_title#like", qw);
qw.apply("FIND_IN_SET ('" + getApiUserId() + "',allot_obj)");
IPage<VoterSuggest> paged = voterSuggestService.page(new Page<>(pageNo, pageSize), qw);
render(Ret.ok().paged(VoterSuggestWrapper.build().pageVO(paged)));
}
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "我的建议-未读", name = "count")
})
@ApiOperation("我的建议-未读")
@GetMapping("/unread")
public void unRead() {
int count = voterSuggestService.unRead(getApiUserId());
render(Ret.ok().set("count", count));
}
@ApiOperation("我的建议-已读")
@GetMapping("/read")
public void read() {
QueryWrapper<VoterSuggest> wrapper = new QueryWrapper<>();
wrapper.eq("created_id", getApiUserId());
List<VoterSuggest> list = voterSuggestService.list(wrapper);
list.forEach(item -> {
List<VoterSuggestSolve> list1 = voterSuggestSolveService.list(new QueryWrapper<VoterSuggestSolve>()
.eq("voter_suggest_id", item.getId()).eq("status", "1").eq("is_read", 0));
list1.forEach(item1 -> {
item1.setIsRead(1);
voterSuggestSolveService.saveOrUpdate(item1);
});
});
}
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "建议id", required = true)
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = VoterSuggestSolveVO.class)
})
@ApiOperation("已分配人员")
@GetMapping("/yet_allocation")
public void yetAllocation(String id) {
if (StrUtil.isBlank(id)) {
render(Ret.fail("id is null"));
return;
}
QueryWrapper<VoterSuggestSolve> wrapper = new QueryWrapper<>();
wrapper.eq("voter_suggest_id", id);
List<VoterSuggestSolve> voterSuggestSolves = voterSuggestSolveService.list(wrapper);
renderJson(Ret.ok().data(voterSuggestSolves));
}
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "建议id", required = true),
@ApiImplicitParam(name = "userIds", value = "用户id 用','号分开", required = true)
})
@ApiOperation("分配")
@PostMapping("/allocation")
public void allocation(String id, String userIds) {
if (StrUtil.isBlank(id) || StrUtil.isBlank(userIds)) {
render(Ret.fail("操作失败"));
return;
}
VoterSuggest voterSuggest = voterSuggestService.getById(id);
if (voterSuggest == null) {
render(Ret.fail("操作失败"));
return;
}
voterSuggest.setAllotObj(userIds);
boolean flag = voterSuggestService.saveOrUpdate(voterSuggest);
voterSuggestSolveService.remove(new QueryWrapper<VoterSuggestSolve>().eq("voter_suggest_id", id));
if (StrUtil.isNotBlank(userIds)) {
String[] split = userIds.split(",");
for (String userId : split) {
VoterSuggestSolve entity = new VoterSuggestSolve();
entity.setVoterSuggestId(id);
entity.setUserId(userId);
entity.setStatus("0");
entity.setIsRead(0);
entity.setCreatedId(getApiUserId());
voterSuggestSolveService.saveOrUpdate(entity);
}
}
renderJson(flag ? Ret.ok() : Ret.fail("操作失败"));
}
private QueryWrapper<VoterSuggest> getQueryWrapper(String createdId) {
QueryWrapper<VoterSuggest> qw = new QueryWrapper<>();
Condition.appendIfNotEmpty(createdId, "created_id", qw);
qw.orderByDesc("created_at");
return qw;
}
}

View File

@ -0,0 +1,247 @@
package com.ydool.boot.api.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.core.mybatis.Condition;
import com.ydool.boot.modules.rddb.entity.Db;
import com.ydool.boot.modules.rddb.entity.Message;
import com.ydool.boot.modules.rddb.entity.VoterSuggestDb;
import com.ydool.boot.modules.rddb.service.DbService;
import com.ydool.boot.modules.rddb.service.MessageService;
import com.ydool.boot.modules.rddb.service.VoterSuggestDbService;
import com.ydool.boot.modules.rddb.vo.VoterSuggestDbVO;
import com.ydool.boot.modules.rddb.wrapper.VoterSuggestDbWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 联系人大
*
* @author chenchen
* @date 2020/10/12
*/
@Controller
@RequestMapping("/api/voter_suggest_db")
@Api(value = "联系人大", tags = "联系人大")
public class ApiVoterSuggestDbController extends ApiBaseController {
@Autowired
private VoterSuggestDbService voterSuggestDbService;
@Resource
private DbService dbService;
@Autowired
private MessageService messageService;
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = VoterSuggestDbVO.class)
})
@ApiOperation("联系人大列表")
@GetMapping("/list/all")
public void voterSuggestDbListAll(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
QueryWrapper<VoterSuggestDb> qw = new QueryWrapper<>();
qw.orderByDesc("created_at");
IPage<VoterSuggestDb> paged = voterSuggestDbService.page(new Page<>(pageNo, pageSize), qw);
render(Ret.ok().paged(VoterSuggestDbWrapper.build().pageVO(paged)));
}
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = VoterSuggestDbVO.class)
})
@ApiOperation("我提交的")
@GetMapping("/list")
public void voterSuggestDbList(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
QueryWrapper<VoterSuggestDb> qw = getQueryWrapper(getApiUserId());
IPage<VoterSuggestDb> paged = voterSuggestDbService.page(new Page<>(pageNo, pageSize), qw);
render(Ret.ok().paged(VoterSuggestDbWrapper.build().pageVO(paged)));
}
@ApiOperationSupport(
responses = @DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = VoterSuggestDb.class)
})
)
@ApiOperation("联系人大详情")
@ApiImplicitParam(name = "id", value = "id", paramType = "path", required = true)
@GetMapping("/{id}")
public void voterSuggestDb(@PathVariable("id") String id) {
VoterSuggestDb bean = voterSuggestDbService.getById(id);
if (bean == null) {
render(Ret.fail("未找到该联系人大"));
return;
}
if (StrUtil.isNotBlank(bean.getStatus())) {
if ("1".equals(bean.getStatus()) && bean.getIsRead() == 0) {
bean.setIsRead(1);
voterSuggestDbService.saveOrUpdate(bean);
}
}
VoterSuggestDbVO vo = VoterSuggestDbWrapper.build().entityVO(bean);
render(Ret.ok().data(vo));
}
@ApiOperation("提交联系人大")
@PostMapping("/save")
public void save(@Validated VoterSuggestDb entity) {
entity.setStatus("0");
entity.setIsRead(0);
entity.setCreatedId(getApiUserId());
boolean flag = voterSuggestDbService.saveOrUpdate(entity);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiOperation("回复联系人大")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "联系人大id", required = true),
@ApiImplicitParam(name = "replyContent", value = "回复内容", required = true)
})
@PostMapping("/reply")
public void reply(String id, String replyContent) {
VoterSuggestDb bean = voterSuggestDbService.getById(id);
if (bean == null) {
render(Ret.fail("未找到该联系人大"));
return;
}
bean.setReplyContent(replyContent);
bean.setStatus("1");
bean.setIsRead(0);
bean.setUpdatedId(getApiUserId());
boolean flag = voterSuggestDbService.saveOrUpdate(bean);
//添加消息
if (flag) {
Message message = new Message();
message.setActionId(id);
message.setTitle(getApiUser().getUserName() + "回复了您");
message.setContent(replyContent);
message.setType(Message.TYPE_VOTER_DB);
message.setCreatedId(getApiUserId());
message.setStatus(Message.STATUS_UNREAD);
message.setUserId(bean.getCreatedId());
messageService.save(message);
}
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "显示条数", dataType = "int", defaultValue = "10"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "数据", name = "data", dataTypeClass = VoterSuggestDbVO.class)
})
@ApiOperation("联系我的")
@GetMapping("/list/my")
public void voterSuggestDbListMy(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
Db db = dbService.getOne(new QueryWrapper<Db>().eq("user_id", getApiUserId()));
if (db == null) {
render(Ret.fail("暂无数据"));
return;
}
QueryWrapper<VoterSuggestDb> qw = new QueryWrapper<VoterSuggestDb>().eq("db", db.getId());
qw.orderByDesc("created_at");
IPage<VoterSuggestDb> paged = voterSuggestDbService.page(new Page<>(pageNo, pageSize), qw);
render(Ret.ok().paged(VoterSuggestDbWrapper.build().pageVO(paged)));
}
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "联系我的-未读数量", name = "count")
})
@ApiOperation("联系我的-未读数量")
@GetMapping("/count/my")
public void voterSuggestDbCountMy() {
Db db = dbService.getOne(new QueryWrapper<Db>().eq("user_id", getApiUserId()));
if (db == null) {
render(Ret.fail("暂无数据"));
return;
}
QueryWrapper<VoterSuggestDb> qw = new QueryWrapper<VoterSuggestDb>().eq("db", db.getId());
qw.eq("status", 0);
qw.eq("is_read", 0);
int count = voterSuggestDbService.count(qw);
render(Ret.ok().set("count", count));
}
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "联系人大id", required = true)
})
@ApiOperation("联系我的-已读")
@PostMapping("/read/my")
public void readMy(String id) {
VoterSuggestDb bean = voterSuggestDbService.getById(id);
if (bean == null) {
render(Ret.fail("未找到该联系人大"));
return;
}
bean.setIsRead(1);
boolean flag = voterSuggestDbService.saveOrUpdate(bean);
render(!flag ? Ret.fail("操作失败") : Ret.ok());
}
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "我的消息-未读", name = "count")
})
@ApiOperation("我的消息-未读")
@GetMapping("/unread")
public void unRead() {
QueryWrapper<VoterSuggestDb> qw = getQueryWrapper(getApiUserId());
qw.eq("status", 1);
qw.eq("is_read", 0);
int count = voterSuggestDbService.count(qw);
render(Ret.ok().set("count", count));
}
@ApiOperation("我的消息-已读")
@PostMapping("/read")
public void read() {
QueryWrapper<VoterSuggestDb> qw = getQueryWrapper(getApiUserId());
qw.eq("status", 1);
qw.eq("is_read", 0);
List<VoterSuggestDb> list = voterSuggestDbService.list(qw);
list.forEach(item -> {
item.setIsRead(1);
voterSuggestDbService.saveOrUpdate(item);
});
render(Ret.ok());
}
private QueryWrapper<VoterSuggestDb> getQueryWrapper(String createdId) {
QueryWrapper<VoterSuggestDb> qw = new QueryWrapper<>();
Condition.appendIfNotEmpty(createdId, "created_id", qw);
qw.orderByDesc("created_at");
return qw;
}
}

View File

@ -0,0 +1,34 @@
package com.ydool.boot.api.filter;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 解决跨域
*
* @author zhouyuan
* @created 2021年3月16日18:08:23
*/
@Component
public class CorsFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) {
}
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "x-requested-with");
chain.doFilter(req, res);
}
@Override
public void destroy() {
}
}

View File

@ -0,0 +1,44 @@
package com.ydool.boot.api.filter;
import cn.hutool.core.util.StrUtil;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.core.exception.ResultException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Enumeration;
/**
* @author zhouyuan
* @date: 2020/6/2 21:45
*/
@Component
public class ReferInterceptor implements HandlerInterceptor {
private static String refer;
@Value("${refer}")
public void setRefer(String refer) {
ReferInterceptor.refer = refer;
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement();
System.out.println("------------------------------>name" + name + "。 value:" + request.getHeader(name));
}
String requestRefer = request.getHeader("Referer");
System.out.println("------------------------------>refer" + requestRefer);
if (requestRefer == null || (StrUtil.isNotBlank(refer) && !requestRefer.contains(refer))) {
throw new ResultException(Ret.fail("非法访问!"));
}
return true;
}
}

View File

@ -0,0 +1,61 @@
package com.ydool.boot.api.job;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ydool.boot.modules.rddb.entity.Activity;
import com.ydool.boot.modules.rddb.entity.ActivityUser;
import com.ydool.boot.modules.rddb.entity.Conference;
import com.ydool.boot.modules.rddb.service.ActivityService;
import com.ydool.boot.modules.rddb.service.ActivityUserService;
import com.ydool.boot.modules.rddb.service.ConferenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import java.util.List;
/**
* @author: zhouyuan
* @date: 2020/8/11
*/
@Configuration
@EnableScheduling
public class ConferenceJob {
@Autowired
private ConferenceService conferenceService;
@Autowired
private ActivityService activityService;
@Autowired
private ActivityUserService activityUserService;
/**
* 每一小时检查一次 间隔开始时间24小时的会议活动自动结束
*/
@Scheduled(cron = "0 0 * * * ?")
private void distributeCompany() {
System.out.println("检查开始------------------------------->");
List<Conference> conferenceList = conferenceService.getOverTimeList();
conferenceList.forEach(conference -> {
conference.setEnd(1);
conferenceService.updateById(conference);
});
List<Activity> activityList = activityService.getOverTimeList();
activityList.forEach(activity -> {
activity.setEnd(1);
activityService.updateById(activity);
//参加活动人员里面的end
List<ActivityUser> activityUsers = activityUserService.list(new QueryWrapper<ActivityUser>().eq("activity_id", activity.getId()));
activityUsers.forEach(item -> {
item.setEnd(1);
activityUserService.updateById(item);
});
});
System.out.println("检查结束------------------------------->");
}
}

View File

@ -0,0 +1,232 @@
package com.ydool.boot.api.util;
import org.apache.commons.lang3.time.DateFormatUtils;
import java.lang.management.ManagementFactory;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.ChronoField;
import java.util.Calendar;
import java.util.Date;
/**
* 时间工具类
*/
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static String YYYY = "yyyy";
public static String YYYY_MM = "yyyy-MM";
public static String YYYY_MM_DD = "yyyy-MM-dd";
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
private static final long ONE_MINUTE = 60;
private static final long ONE_HOUR = 3600;
private static final long ONE_DAY = 86400;
private static final long ONE_MONTH = 2592000;
private static final long ONE_YEAR = 31104000;
private static String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
/**
* 获取当前Date型日期
*
* @return Date() 当前日期
*/
public static Date getNowDate() {
return new Date();
}
/**
* 获取当前日期, 默认格式为yyyy-MM-dd
*
* @return String
*/
public static String getDate() {
return dateTimeNow(YYYY_MM_DD);
}
public static final String getTime() {
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
}
public static final String dateTimeNow() {
return dateTimeNow(YYYYMMDDHHMMSS);
}
public static final String dateTimeNow(final String format) {
return parseDateToStr(format, new Date());
}
public static final String dateTime(final Date date) {
return parseDateToStr(YYYY_MM_DD, date);
}
public static final String parseDateToStr(final String format, final Date date) {
return new SimpleDateFormat(format).format(date);
}
public static final Date dateTime(final String format, final String ts) {
try {
return new SimpleDateFormat(format).parse(ts);
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
/**
* 日期路径 即年// 如2018/08/08
*/
public static final String datePath() {
Date now = new Date();
return DateFormatUtils.format(now, "yyyy/MM/dd");
}
/**
* 日期路径 即年// 如20180808
*/
public static final String dateTime() {
Date now = new Date();
return DateFormatUtils.format(now, "yyyyMMdd");
}
/**
* 日期型字符串转化为日期 格式
*/
public static Date parseDate(Object str) {
if (str == null) {
return null;
}
try {
return parseDate(str.toString(), parsePatterns);
} catch (ParseException e) {
return null;
}
}
/**
* 获取服务器启动时间
*/
public static Date getServerStartDate() {
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
return new Date(time);
}
/**
* 计算两个时间差
*/
public static String getDatePoor(Date endDate, Date nowDate) {
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff % nd / nh;
// 计算差多少分钟
long min = diff % nd % nh / nm;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return day + "" + hour + "小时" + min + "分钟";
}
/**
* 格式化时间 **天前
*
* @param date
* @return
*/
public static String fromToday(Date date, Boolean hasSpace) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
String space = hasSpace ? " " : "";
long time = date.getTime() / 1000;
long now = System.currentTimeMillis() / 1000;
long ago = now - time;
if (ago <= ONE_HOUR) {
return ago / ONE_MINUTE + space + "分钟前";
} else if (ago <= ONE_DAY) {
return ago / ONE_HOUR + space + "小时前";
} else if (ago <= ONE_DAY * 2) {
return "昨天";
} else if (ago <= ONE_DAY * 3) {
return "前天";
} else if (ago <= ONE_MONTH) {
long day = ago / ONE_DAY;
return day + space + "天前";
} else if (ago <= ONE_YEAR) {
long month = ago / ONE_MONTH;
return month + space + "个月前";
} else {
long year = ago / ONE_YEAR;
return year + space + "年前";
}
}
/**
* 获取月份的开始时间
*
* @param yearMonth 月份字符串形如: yyyy-MM
* @return
*/
public static Date atStartOfYearMonth(String yearMonth) {
DateTimeFormatter fmt = new DateTimeFormatterBuilder()
.appendPattern(YYYY_MM)
.parseDefaulting(ChronoField.DAY_OF_MONTH, 1)
.toFormatter();
LocalDate date = LocalDate.parse(yearMonth, fmt);
LocalDateTime dateTime = date.atTime(LocalTime.MIN);
return Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant());
}
/**
* 获取月份的结束时间
*
* @param yearMonth 月份字符串形如: yyyy-MM
* @return
*/
public static Date atEndOfYearMonth(String yearMonth) {
DateTimeFormatter fmt = DateTimeFormatter.ofPattern(YYYY_MM);
YearMonth ym = YearMonth.parse(yearMonth, fmt);
LocalDateTime dateTime = ym.atEndOfMonth().atTime(LocalTime.MAX);
return Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant());
}
/**
* 获取日期的开始时间
*
* @param date 月份字符串形如: yyyy-MM-dd
* @return
*/
public static Date atStartOfDate(String date) {
LocalDateTime start = LocalDate.parse(date, DateTimeFormatter.ofPattern(YYYY_MM_DD)).atTime(LocalTime.MIN);
return Date.from(start.atZone(ZoneId.systemDefault()).toInstant());
}
/**
* 获取日期的结束时间
*
* @param date 月份字符串形如: yyyy-MM-dd
* @return
*/
public static Date atEndOfDate(String date) {
LocalDateTime end = LocalDate.parse(date, DateTimeFormatter.ofPattern(YYYY_MM_DD)).atTime(LocalTime.MAX);
return Date.from(end.atZone(ZoneId.systemDefault()).toInstant());
}
}

View File

@ -0,0 +1,49 @@
package com.ydool.boot.api.util;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
public class JwtUtil {
public static String BEARER = "bearer";
public static Integer AUTH_LENGTH = 7;
public static String BASE64_SECURITY = Base64.getEncoder().encodeToString(TokenConstant.SIGN_KEY.getBytes(StandardCharsets.UTF_8));
/**
* 获取token串
*
* @param auth token
* @return String
*/
public static String getToken(String auth) {
if ((auth != null) && (auth.length() > AUTH_LENGTH)) {
String headStr = auth.substring(0, 6).toLowerCase();
if (headStr.compareTo(BEARER) == 0) {
auth = auth.substring(7);
return auth;
}
}
return null;
}
/**
* 解析jsonWebToken
*
* @param jsonWebToken token串
* @return Claims
*/
public static Claims parseJWT(String jsonWebToken) {
try {
return Jwts.parser()
.setSigningKey(Base64.getDecoder().decode(JwtUtil.BASE64_SECURITY))
.parseClaimsJws(jsonWebToken).getBody();
} catch (Exception ex) {
return null;
}
}
}

View File

@ -0,0 +1,28 @@
package com.ydool.boot.api.util;
import org.springframework.util.LinkedCaseInsensitiveMap;
public class Kv extends LinkedCaseInsensitiveMap {
private Kv() {
}
public static Kv create() {
return new Kv();
}
public Kv set(String attr, Object value) {
this.put(attr, value);
return this;
}
public String getString(String attr) {
Object object = this.get(attr);
if (object == null) {
return "";
}
return object.toString();
}
}

View File

@ -0,0 +1,43 @@
package com.ydool.boot.api.util;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import java.net.UnknownHostException;
/**
* @author: zhouyuan
* @date: 2020/10/15
*/
@Configuration
public class RedisConfig {
@Bean
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) throws UnknownHostException {
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(redisConnectionFactory);
// 使用Jackson2JsonRedisSerialize 替换默认序列化(默认采用的是JDK序列化)
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL);
jackson2JsonRedisSerializer.setObjectMapper(om);
redisTemplate.setKeySerializer(jackson2JsonRedisSerializer);
redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
redisTemplate.setHashKeySerializer(jackson2JsonRedisSerializer);
redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);
return redisTemplate;
}
}

View File

@ -0,0 +1,170 @@
package com.ydool.boot.api.util;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
//敏感词过滤器利用DFA算法  进行敏感词过滤
@SuppressWarnings("rawtypes")
public class SensitiveFilterService {
private Map sensitiveWordMap = null;
// 最小匹配规则
public static int minMatchTYpe = 1;
// 最大匹配规则
public static int maxMatchType = 2;
// 单例
private static SensitiveFilterService instance = null;
// 构造函数初始化敏感词库
private SensitiveFilterService() {
sensitiveWordMap = new SensitiveWordInit().initKeyWord();
}
// 获取单例
public static SensitiveFilterService getInstance() {
if (null == instance) {
instance = new SensitiveFilterService();
}
return instance;
}
// 获取文字中的敏感词
public Set<String> getSensitiveWord(String txt, int matchType) {
Set<String> sensitiveWordList = new HashSet<String>();
for (int i = 0; i < txt.length(); i++) {
// 判断是否包含敏感字符
int length = CheckSensitiveWord(txt, i, matchType);
// 存在,加入list中
if (length > 0) {
sensitiveWordList.add(txt.substring(i, i + length));
// 减1的原因是因为for会自增
i = i + length - 1;
}
}
return sensitiveWordList;
}
// 替换敏感字字符
public String replaceSensitiveWord(String txt, int matchType,
String replaceChar) {
String resultTxt = txt;
// 获取所有的敏感词
Set<String> set = getSensitiveWord(txt, matchType);
Iterator<String> iterator = set.iterator();
String word = null;
String replaceString = null;
while (iterator.hasNext()) {
word = iterator.next();
replaceString = getReplaceChars(replaceChar, word.length());
resultTxt = resultTxt.replaceAll(word, replaceString);
}
return resultTxt;
}
/**
* 获取替换字符串
*  
*
* @param replaceChar
* @param length
* @return
*/
private String getReplaceChars(String replaceChar, int length) {
String resultReplace = replaceChar;
for (int i = 1; i < length; i++) {
resultReplace += replaceChar;
}
return resultReplace;
}
/**
* 检查文字中是否包含敏感字符检查规则如下<br>
* 如果存在则返回敏感词字符的长度不存在返回0
*  
*
* @param txt
* @param beginIndex
* @param matchType
* @return
*/
public int CheckSensitiveWord(String txt, int beginIndex, int matchType) {
// 敏感词结束标识位用于敏感词只有1位的情况
boolean flag = false;
// 匹配标识数默认为0
int matchFlag = 0;
Map nowMap = sensitiveWordMap;
for (int i = beginIndex; i < txt.length(); i++) {
char word = txt.charAt(i);
// 获取指定key
if (StopCharUtil.isStopChar(word)) continue;
nowMap = (Map) nowMap.get(word);
// 存在则判断是否为最后一个
if (nowMap != null) {
// 找到相应key匹配标识+1
matchFlag++;
// 如果为最后一个匹配规则,结束循环返回匹配标识数
if ("1".equals(nowMap.get("isEnd"))) {
// 结束标志位为true
flag = true;
// 最小规则直接返回,最大规则还需继续查找
if (SensitiveFilterService.minMatchTYpe == matchType) {
break;
}
}
}
// 不存在直接返回
else {
break;
}
}
if (matchFlag < 2 && !flag) { // 长度必须大于等于1为词
matchFlag = 0;
}
return matchFlag;
}
// public static void main(String[] args) {
// System.out.println(getInstance().getSensitiveWord("法*轮δ功",1));
// }
}

View File

@ -0,0 +1,114 @@
package com.ydool.boot.api.util;
import com.ydool.boot.common.cache.ConfigUtils;
import java.util.*;
//屏蔽敏感词初始化
@SuppressWarnings({"rawtypes", "unchecked"})
public class SensitiveWordInit {
// 字符编码
private String ENCODING = "UTF-8";
// 初始化敏感字库
public Map initKeyWord() {
// 读取敏感词库 ,存入Set中
Set<String> wordSet = readSensitiveWordFile();
// 将敏感词库加入到HashMap中//确定有穷自动机DFA
return addSensitiveWordToHashMap(wordSet);
}
/**
*      * 读取敏感词库将敏感词放入HashSet中构建一个DFA算法模型<br> 
*      * = { 
*      *      isEnd = 0 
*      *       = { 
*      *           isEnd = 1 
*      *           = {isEnd = 0 
*      *                 = {isEnd = 1} 
*      *                } 
*      *            = { 
*      *                  isEnd = 0 
*      *                   = { 
*      *                        isEnd = 1 
*      *                       } 
*      *               } 
*      *           } 
*      *      } 
*      *   = { 
*      *      isEnd = 0 
*      *       = { 
*      *          isEnd = 0 
*      *           = { 
*      *              isEnd = 0 
*      *               = { 
*      *                   isEnd = 1 
*      *                  } 
*      *              } 
*      *          } 
*      *      } 
*      * @author 孙创  
*      * @date 2017年2月15日 下午3:20:20 
*      * @param keyWordSet  敏感词库 
*      
*/
// 读取敏感词库 ,存入HashMap中
private Set<String> readSensitiveWordFile() {
Set<String> wordSet = new HashSet<>();
String content = ConfigUtils.getStr("sys.comment.sensitive_word");
String[] split = content.split(" ");
Arrays.asList(split).forEach(word -> {
wordSet.add(word);
});
return wordSet;
}
// 将HashSet中的敏感词,存入HashMap中
private Map addSensitiveWordToHashMap(Set<String> wordSet) {
// 初始化敏感词容器减少扩容操作
Map wordMap = new HashMap(wordSet.size());
for (String word : wordSet) {
Map nowMap = wordMap;
for (int i = 0; i < word.length(); i++) {
// 转换成char型
char keyChar = word.charAt(i);
// 获取
Object tempMap = nowMap.get(keyChar);
// 如果存在该key直接赋值
if (tempMap != null) {
nowMap = (Map) tempMap;
}
// 不存在则则构建一个map同时将isEnd设置为0因为他不是最后一个
else {
// 设置标志位
Map<String, String> newMap = new HashMap<String, String>();
newMap.put("isEnd", "0");
// 添加到集合
nowMap.put(keyChar, newMap);
nowMap = newMap;
}
// 最后一个
if (i == word.length() - 1) {
nowMap.put("isEnd", "1");
}
}
}
return wordMap;
}
}

View File

@ -0,0 +1,63 @@
package com.ydool.boot.api.util;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.ydool.boot.common.cache.ConfigUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
/**
* @author: zhouyuan
* @date: 2020/10/15
*/
@Slf4j
@Data
public class SmsUtil {
//初始化ascClient需要的几个参数
private static String product = "Dysmsapi";//短信API产品名称短信产品名固定无需修改
private static String domain = "dysmsapi.aliyuncs.com";//短信API产品域名接口地址固定无需修改
public static void sendMsg(String phone, String code) {
try {
// *配在后台的参数设置里
String accessKeyId = ConfigUtils.getStr("accessKey");
String accessKeySecret = ConfigUtils.getStr("secretKey");
//初始化ascClient,暂时不支持多region请勿修改
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId,
accessKeySecret);
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
IAcsClient acsClient = new DefaultAcsClient(profile);
//组装请求对象
SendSmsRequest request = new SendSmsRequest();
//使用post提交
request.setMethod(MethodType.POST);
//必填:待发送手机号支持以逗号分隔的形式进行批量调用批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式发送国际/港澳台消息时接收号码格式为国际区号+号码85200000000
request.setPhoneNumbers(phone);
//必填:短信签名-可在短信控制台中找到
request.setSignName("云朵网");
//必填:短信模板-可在短信控制台中找到发送国际/港澳台消息时请使用国际/港澳台短信模版
request.setTemplateCode("SMS_145596014");
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}",此处的值为
request.setTemplateParam("{\"code\":\"" + code + "\"}");
//请求失败这里会抛ClientException异常
SendSmsResponse sendSmsResponse = null;
sendSmsResponse = acsClient.getAcsResponse(request);
log.info("给 {} 发送短信 {} : {}", phone, sendSmsResponse.getCode(), sendSmsResponse.getMessage());
} catch (ClientException e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,24 @@
package com.ydool.boot.api.util;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
/**
* @author liuhaoze
* @date 2020/3/13 15:22
*/
public class StopCharUtil {
public static final Set<Character> STOP_WORD = new HashSet(Arrays.asList(' ', '\'', '、', '。', '·', 'ˉ', 'ˇ', '々', '—', '', '‖', '…', '', '', '“', '”', '', '', '〈', '〉', '《', '》', '「', '」', '『', '』', '〖', '〗', '【', '】', '±', '', '', '×', '÷', '∧', '', '∑', '∏', '', '∩', '∈', '√', '⊥', '⊙', '∫', '∮', '≡', '≌', '≈', '∽', '∝', '≠', '≮', '≯', '≤', '≥', '∞', '', '∵', '∴', '∷', '♂', '♀', '°', '', '〃', '℃', '', '¤', '¢', '£', '‰', '§', '☆', '★', '', '○', '●', '◎', '◇', '◆', '□', '■', '△', '▽', '⊿', '▲', '▼', '◣', '◤', '◢', '◥', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█', '▉', '▊', '▋', '▌', '▍', '▎', '▏', '▓', '※', '→', '←', '↑', '↓', '↖', '↗', '↘', '↙', '〓', '', 'ⅱ', 'ⅲ', 'ⅳ', '', 'ⅵ', 'ⅶ', 'ⅷ', 'ⅸ', '', '①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⒈', '⒉', '⒊', '⒋', '⒌', '⒍', '⒎', '⒏', '⒐', '⒑', '⒒', '⒓', '⒔', '⒕', '⒖', '⒗', '⒘', '⒙', '⒚', '⒛', '⑴', '⑵', '⑶', '⑷', '⑸', '⑹', '⑺', '⑻', '⑼', '⑽', '⑾', '⑿', '⒀', '⒁', '⒂', '⒃', '⒄', '⒅', '⒆', '⒇', '', 'Ⅱ', 'Ⅲ', 'Ⅳ', '', 'Ⅵ', 'Ⅶ', 'Ⅷ', 'Ⅸ', '', 'Ⅺ', 'Ⅻ', '', '”', '', '¥', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '_', '', '', '', '', '∏', 'Ρ', '∑', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω', 'α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ', 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω', '', '', '', '', '', '﹊', '', '╭', '╮', '╰', '╯', '\ue83a', '_', '\ue83a', '^', '', '^', '', '', '/', '\\', '"', '<', '>', '`', '·', '。', '{', '}', '~', '', '(', ')', '-', '√', '$', '@', '*', '&', '#', '卐', '㎎', '㎏', '㎜', '㎝', '㎞', '㎡', '㏄', '㏎', '㏑', '㏒', '㏕'));
public StopCharUtil() {
}
public static boolean isStopChar(char ch) {
return Character.isWhitespace(ch) || STOP_WORD.contains(ch);
}
public static boolean isNotStopChar(char ch) {
return !isStopChar(ch);
}
}

View File

@ -0,0 +1,13 @@
package com.ydool.boot.api.util;
public interface TokenConstant {
String SIGN_KEY = "safe";
String HEADER = "x-token";
String BEARER = "bearer";
String ACCESS_TOKEN = "access_token";
String REFRESH_TOKEN = "refresh_token";
String TOKEN_TYPE = "token_type";
String EXPIRES_IN = "expires_in";
String USER_ID = "user_id";
}

View File

@ -0,0 +1,18 @@
package com.ydool.boot.api.util;
import lombok.Data;
@Data
public class TokenInfo {
/**
* 令牌值
*/
private String token;
/**
* 过期秒数
*/
private Long expire;
}

View File

@ -0,0 +1,173 @@
package com.ydool.boot.api.util;
import cn.hutool.core.convert.Convert;
import com.ydool.boot.modules.sys.entity.User;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.apache.commons.lang3.StringUtils;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.security.Key;
import java.util.*;
public class TokenUtil {
private static final String SAFE_USER_REQUEST_ATTR = "SAFE_USER_REQUEST_ATTR_";
/**
* 创建认证token
*
* @param user
* @return token
*/
public static Kv createAuthInfo(User user) {
Kv authInfo = Kv.create();
//设置jwt参数,只存了id
Map<String, Object> param = Kv.create().set(TokenConstant.USER_ID, user.getId());
//拼装accessToken
try {
TokenInfo accessToken = createJWT(param, TokenConstant.ACCESS_TOKEN);
//返回accessToken
return authInfo
.set(TokenConstant.ACCESS_TOKEN, accessToken.getToken())
.set(TokenConstant.REFRESH_TOKEN, createRefreshToken(user).getToken())
.set(TokenConstant.TOKEN_TYPE, TokenConstant.BEARER)
.set(TokenConstant.EXPIRES_IN, accessToken.getExpire());
} catch (Exception ex) {
return authInfo.set("error_code", HttpServletResponse.SC_UNAUTHORIZED).set("error_description", ex.getMessage());
}
}
private static TokenInfo createRefreshToken(User user) {
Map<String, Object> param = new HashMap(16);
param.put(TokenConstant.TOKEN_TYPE, TokenConstant.REFRESH_TOKEN);
param.put(TokenConstant.USER_ID, user.getId());
return createJWT(param, "refresh_token");
}
/**
* 解析jsonWebToken
*
* @param jsonWebToken jsonWebToken
* @return Claims
*/
public static Claims parseJWT(String jsonWebToken) {
return JwtUtil.parseJWT(jsonWebToken);
}
public static TokenInfo createJWT(Map<String, Object> user, String tokenType) {
SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
long nowMillis = System.currentTimeMillis();
Date now = new Date(nowMillis);
//生成签名密钥
byte[] apiKeySecretBytes = Base64.getDecoder().decode(JwtUtil.BASE64_SECURITY);
Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName());
//添加构成JWT的类
JwtBuilder builder = Jwts.builder().signWith(signatureAlgorithm, signingKey);
//设置JWT参数
if (user != null) {
user.forEach(builder::claim);
}
//添加Token过期时间
long expireMillis;
if (tokenType.equals(TokenConstant.ACCESS_TOKEN)) {
expireMillis = 90 * 24 * 60 * 60 * 1000L;
} else if (tokenType.equals(TokenConstant.REFRESH_TOKEN)) {
expireMillis = 30 * 24 * 60 * 60 * 1000L;
} else {
expireMillis = getExpire();
}
long expMillis = nowMillis + expireMillis;
Date exp = new Date(expMillis);
builder.setExpiration(exp).setNotBefore(now);
// 组装Token信息
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setToken(builder.compact());
tokenInfo.setExpire(expireMillis / 1000);
//生成JWT
return tokenInfo;
}
/**
* 获取过期时间(一天过期)
*
* @return expire
*/
public static long getExpire() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, 1);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTimeInMillis() - System.currentTimeMillis();
}
public static UserInfo getUserInfo() {
HttpServletRequest request = WebUtils.getRequest();
if (request == null) return null;
// 优先从 request 中获取
Object userInfo = request.getAttribute(SAFE_USER_REQUEST_ATTR);
if (userInfo == null) {
userInfo = getUserInfo(request);
if (userInfo != null) {
// 设置到 request
request.setAttribute(SAFE_USER_REQUEST_ATTR, userInfo);
}
}
return (UserInfo) userInfo;
}
public static UserInfo getUserInfo(HttpServletRequest request) {
Claims claims = getClaims(request);
if (claims == null) {
return null;
}
String userId = Convert.toStr(claims.get(TokenConstant.USER_ID));
Long expiresIn = claims.getExpiration().getTime();
UserInfo userInfo = new UserInfo();
userInfo.setId(userId);
userInfo.setExpiresIn(expiresIn);
return userInfo;
}
/**
* 获取Claims
*
* @param request request
* @return Claims
*/
public static Claims getClaims(HttpServletRequest request) {
String auth = request.getHeader(TokenConstant.HEADER);
if (StringUtils.isNotBlank(auth)) {
String token = JwtUtil.getToken(auth);
if (StringUtils.isNotBlank(token)) {
return parseJWT(token);
}
} else {
String parameter = request.getParameter(TokenConstant.HEADER);
if (StringUtils.isNotBlank(parameter)) {
return parseJWT(parameter);
}
}
return null;
}
}

View File

@ -0,0 +1,22 @@
package com.ydool.boot.api.util;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class UserInfo implements Serializable {
@ApiModelProperty(value = "用户ID")
private String id;
@ApiModelProperty(value = "令牌")
private String accessToken;
@ApiModelProperty(value = "令牌类型")
private String tokenType;
@ApiModelProperty(value = "刷新令牌")
private String refreshToken;
@ApiModelProperty(value = "过期时间")
private long expiresIn;
}

View File

@ -0,0 +1,29 @@
package com.ydool.boot.api.util;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class WebUtils {
public WebUtils() {
}
public static HttpServletRequest getRequest() {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
return requestAttributes == null ? null : ((ServletRequestAttributes) requestAttributes).getRequest();
}
public static HttpServletResponse getResponse() {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
return requestAttributes == null ? null : ((ServletRequestAttributes) requestAttributes).getResponse();
}
public static boolean isAjax() {
HttpServletRequest request = getRequest();
return request.getHeader("X-Requested-With") != null && "XMLHttpRequest".equals(request.getHeader("X-Requested-With"));
}
}

View File

@ -0,0 +1,110 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 活动(Activity)实体类
*
* @author makejava
* @since 2020-10-13 13:55:40
*/
@Getter
@Setter
@TableName(value = "t_activity")
@ApiModel(value = "活动")
public class Activity extends BaseEntity implements Serializable {
private static final long serialVersionUID = 889019844199636072L;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 活动名称
*/
@NotBlank(message = "请输入活动名称")
@ApiModelProperty(value = "活动名称")
private String activityName;
/**
* 活动时间
*/
@NotBlank(message = "请输入活动时间")
@ApiModelProperty(value = "活动时间")
private String activityDate;
/**
* 活动地点
*/
@NotBlank(message = "请输入活动地点")
@ApiModelProperty(value = "活动地点")
private String activityAddress;
/**
* 活动内容
*/
@NotBlank(message = "请输入活动内容")
@ApiModelProperty(value = "活动内容")
private String activityContent;
/**
* 活动接取区域
*/
@ApiModelProperty(value = "活动接取区域")
private String activityArea;
/**
* 上传人员
*/
@ApiModelProperty(value = "上传人员")
private String uploadPersonnel;
/**
* 图片
*/
@ApiModelProperty(value = "图片")
private String photo;
/**
* 审核状态0待审核1审核通过2审核拒绝
*/
@ApiModelProperty(value = "审核状态0待审核、1审核通过、2审核拒绝")
private String status;
/**
* 拒绝理由
*/
private String reason;
/**
* 结束标记 1结束
*/
@ApiModelProperty(value = "结束标记 开始时间后的24小时自动结束")
private Integer end;
/**
* 发布者账号类型
*/
@ApiModelProperty("发布者账号类型")
private String createdType;
/**
* 活动文件路径
*/
@ApiModelProperty("活动文件路径")
private String attachment;
/**
* 活动类别
*/
@ApiModelProperty(value = "字典 activity_category")
private Integer category;
}

View File

@ -0,0 +1,84 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.Date;
/**
* 活动审批人员(ActivityAuditUser)实体类
*
* @author makejava
* @since 2020-10-28 14:50:50
*/
@Getter
@Setter
@TableName(value = "t_activity_audit_user")
@ApiModel(value = "活动审批人员")
public class ActivityAuditUser extends BaseEntity implements Serializable {
private static final long serialVersionUID = -64076310705679101L;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 活动id
*/
@ApiModelProperty(value = "活动id")
private String activityId;
/**
* 活动名称
*/
@ApiModelProperty(value = "活动名称")
private String activityName;
/**
* 人员id
*/
@ApiModelProperty(value = "人员id")
private String userId;
/**
* 人员名称
*/
@ApiModelProperty(value = "人员名称")
private String userName;
/**
* 审核状态0待审核1审核通过2审核拒绝
*/
@ApiModelProperty(value = "审核状态0待审核、1审核通过、2审核拒绝")
private Integer status;
/**
* 未通过原因
*/
@ApiModelProperty(value = "未通过原因")
private String reason;
/**
* 审批时间
*/
@ApiModelProperty(value = "审批时间")
private Date auditAt;
/**
* 审批顺序从1开始
*/
@ApiModelProperty(value = "审批顺序从1开始")
private Integer sortNo;
/**
* 活动
*/
@ApiModelProperty(value = "活动")
@TableField(exist = false)
private Activity activity;
}

View File

@ -0,0 +1,50 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 活动评论(ContactActivityComment)实体类
*
* @author makejava
* @since 2020-10-19 09:43:49
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("t_activity_comment")
@ApiModel(value = "活动评论")
public class ActivityComment extends BaseEntity {
private static final long serialVersionUID = 337483194775923489L;
private String createdId;
private String updatedId;
/**
* 联络站活动id
*/
@ApiModelProperty(value = "活动id")
private String activityId;
/**
* 评论人
*/
@ApiModelProperty(value = "评论人")
private String name;
/**
* 内容
*/
@ApiModelProperty(value = "内容")
private String content;
/**
* 0待审核 1已通过 2未通过
*/
private Integer status;
/**
* 未通过原因
*/
private String reason;
}

View File

@ -0,0 +1,126 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 参加活动人员(ActivityUser)实体类
*
* @author makejava
* @since 2020-10-21 14:11:41
*/
@Getter
@Setter
@TableName(value = "t_activity_user")
@ApiModel(value = "参加活动人员")
public class ActivityUser extends BaseEntity implements Serializable {
private static final long serialVersionUID = 731381260293845255L;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 活动id
*/
@ApiModelProperty(value = "活动id")
private String activityId;
/**
* 活动名称
*/
@ApiModelProperty(value = "活动名称")
private String activityName;
/**
* 活动时间
*/
@ApiModelProperty(value = "活动时间")
private String activityDate;
/**
* 参加活动用户id
*/
@ApiModelProperty(value = "参加用户id")
private String userId;
/**
* 1已报名 0未报名
*/
@ApiModelProperty(value = "1已报名 0未报名")
private Integer isApply;
/**
* 1已签到 0未签到
*/
@ApiModelProperty(value = "1已签到 0未签到")
private Integer isSign;
/**
* 1已请假 0未请假
*/
@ApiModelProperty(value = "1已请假 0未请假")
private Integer isLeave;
/**
* 1已发表履职 0未发表履职
*/
@ApiModelProperty(value = "1已发表履职 0未发表履职")
private Integer isPublishPerform;
/**
* 活动结束标记 1结束
*/
@ApiModelProperty(value = "活动结束标记 开始时间后的24小时自动结束")
private Integer end;
/**
* 活动
*/
@ApiModelProperty(value = "活动")
@TableField(exist = false)
private Activity activity;
/**
* 1已结束 0未结束
*/
@ApiModelProperty(value = "1已结束 0未结束")
@TableField(exist = false)
private String isFinish;
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
//报名时间
private LocalDateTime applyTime;
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
//签到时间
private LocalDateTime signTime;
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
//请假时间
private LocalDateTime leaveTime;
}

View File

@ -0,0 +1,80 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 文件审批
* </p>
*
* @author zhouyuan
* @since 2020-10-09
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_audit")
public class Audit extends BaseEntity {
private static final long serialVersionUID = 1L;
public static final Integer STATUS_WAIT = 0;
public static final Integer STATUS_PASS = 1;
public static final Integer STATUS_REFUSE = 2;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 事项名称
*/
@ApiModelProperty(value = "事项名称")
@NotBlank(message = "事项名称不能为空")
private String title;
/**
* 事项内容
*/
@ApiModelProperty(value = "事项内容")
@NotBlank(message = "内容不能为空")
private String content;
/**
* 总的状态 0待审批 1已审批通过 2已审批未通过
*/
@ApiModelProperty(value = "总的状态 0待审批 1已审批通过 2已审批未通过")
private Integer status;
/**
* 未通过原因
*/
@ApiModelProperty(value = "未通过原因")
private String reason;
@TableField(exist = false)
@ApiModelProperty(value = "非实体字段 返回创建者姓名")
private String userName;
/**
* 活动文件路径
*/
@ApiModelProperty("活动文件路径")
private String attachment;
@TableField(exist = false)
@ApiModelProperty(value = "非实体字段 多个附件")
private String[] files;
}

View File

@ -0,0 +1,107 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
* <p>
* 文件审批人员
* </p>
*
* @author zhouyuan
* @since 2020-10-09
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_audit_user")
public class AuditUser extends BaseEntity {
private static final long serialVersionUID = 1L;
public static final Integer STATUS_WAIT = 0;
public static final Integer STATUS_PASS = 1;
public static final Integer STATUS_REFUSE = 2;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 事项id
*/
@ApiModelProperty(value = "事项id")
private String auditId;
/**
* 人员id
*/
@ApiModelProperty(value = "人员id")
private String userId;
/**
* 人员名称
*/
@ApiModelProperty(value = "人员名称")
private String userName;
/**
* 单条状态 0待审批 1已审批通过 2已审批未通过
*/
@ApiModelProperty(value = "单条状态 0待审批 1已审批通过 2已审批未通过")
private Integer status;
/**
* 未通过原因
*/
@ApiModelProperty(value = "未通过原因")
private String reason;
/**
* 签名
*/
@ApiModelProperty(value = "签名")
private String signature;
/**
* 审批时间
*/
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty(value = "审批时间")
private LocalDateTime auditAt;
/**
* 审批顺序
*/
private Integer sortNo;
@TableField(exist = false)
@ApiModelProperty(value = "非实体字段 返回审批信息")
private Audit audit;
public void full() {
if (StringUtils.isNotBlank(getSignature())) {
setSignature(Const.URL_PREFIX + getSignature());
}
}
}

View File

@ -0,0 +1,80 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 动态信息
* </p>
*
* @author zhouyuan
* @since 2021-03-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_basic_dynamic")
public class BasicDynamic extends BaseEntity {
private static final long serialVersionUID = 1L;
private String createdId;
private String updatedId;
/**
* 标题
*/
@ApiModelProperty(value = "标题", required = true)
@NotBlank(message = "标题不能为空")
private String title;
/**
* 内容
*/
@ApiModelProperty(value = "内容", required = true)
@NotBlank(message = "内容不能为空")
private String content;
/**
* 类别
*/
@ApiModelProperty(value = "类别 字典basic_dynamic_category", required = true)
@NotBlank(message = "类别不能为空")
private String category;
/**
* 图片多张逗号间隔
*/
@ApiModelProperty(value = "图片多张逗号间隔存这个字段取pictureArr字段")
private String picture;
/**
* 进度 0待审核 1已通过 2拒绝
*/
@ApiModelProperty(value = "状态 不用传")
private String status;
/**
* 拒绝原因
*/
@ApiModelProperty(value = "拒绝原因 不用传")
private String reason;
/**
* 乡镇id
*/
@ApiModelProperty(value = "乡镇id 不用传")
private String streetId;
@TableField(exist = false)
@ApiModelProperty(value = "非实体字段")
private String[] files;
}

View File

@ -0,0 +1,135 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
* 会议
* </p>
*
* @author zhouyuan
* @since 2020-10-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_conference")
public class Conference extends BaseEntity {
private static final long serialVersionUID = 1L;
//结束标记
public static Integer END_TAG = 1;
public static Integer UN_END_TAG = 0;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 会议名称
*/
@ApiModelProperty(value = "会议名称")
@NotBlank(message = "会议名称不能为空")
private String title;
/**
* 会议内容
*/
@ApiModelProperty(value = "会议内容")
@NotBlank(message = "会议内容不能为空")
private String content;
/**
* 会议地址
*/
@ApiModelProperty(value = "会议地址")
@NotBlank(message = "会议地址不能为空")
private String address;
/**
* 会议开始日期 隔一天自动结束
*/
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty(value = "会议开始时间")
@NotNull(message = "会议时间不能为空")
private LocalDateTime startTime;
/**
* 创建者名称
*/
@ApiModelProperty(value = "创建者姓名")
private String createdUser;
/**
* 会议结束标记
*/
@ApiModelProperty(value = "结束标记 会议开始时间后的24小时自动结束")
private Integer end;
/**
* 本次会议上传的附件数
*/
@ApiModelProperty(value = "本次会议上传的附件数")
private Integer attachmentNum;
/**
* 会议文件类型
*/
@ApiModelProperty(value = "会议文件类型")
private String category;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,返回会议议题的集合")
private List conferenceIssueList;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,当前登录用户该会议是否已签到 0未 1已")
private Integer sign;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,当前登录用户签到时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private LocalDateTime signTime;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,关联的会议 应签到多少人")
private Integer allSignCount;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,关联的会议 已签到多少人")
private Integer signedCount;
}

View File

@ -0,0 +1,92 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import com.ydool.boot.core.entity.TreeEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
/**
* <p>
* 会议附件
* </p>
*
* @author zhouyuan
* @since 2020-10-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_conference_attachment")
public class ConferenceAttachment extends TreeEntity {
private static final long serialVersionUID = 1L;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 附件名
*/
@ApiModelProperty(value = "附件名")
private String title;
/**
* 所属会议id
*/
@ApiModelProperty(value = "所属会议id")
private String conferenceId;
/**
* 附件路径
*/
@ApiModelProperty(value = "附件路径")
private String attachment;
/**
* 文件大小
*/
@ApiModelProperty(value = "文件大小")
private String size;
/**
* pid 为0为议题否则是附件
*/
@ApiModelProperty(value = "pid 为0为议题否则是附件")
private String pid;
@TableField(exist = false)
private String sort;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,返回所属会议的信息")
private Conference conference;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,返回议题的会议附件集合")
private List conferenceAttachmentList;
public void full() {
if (StringUtils.isNotBlank(getAttachment())) {
setAttachment(Const.URL_PREFIX + attachment);
}
}
@Override
public String getName() {
return this.title;
}
}

View File

@ -0,0 +1,71 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import com.ydool.boot.modules.sys.entity.User;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 会议参会人员
* </p>
*
* @author zhouyuan
* @since 2020-10-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_conference_user")
public class ConferenceUser extends BaseEntity {
private static final long serialVersionUID = 1L;
//未签到
public static final Integer STATUS_UN_SIGN = 0;
//已签到
public static final Integer STATUS_SIGN = 1;
//请假
public static final Integer STATUS_LEAVE = 2;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 会议id
*/
private String conferenceId;
/**
* 参会人员id
*/
private String userId;
/**
* 参会人员名字
*/
private String userName;
/**
* 会议发起人给其下发的文件
*/
private String file;
/**
* 签到情况 0未签到 1已签到 2请假
*/
private Integer status;
//非实体字段
@TableField(exist = false)
private User user;
}

View File

@ -0,0 +1,37 @@
package com.ydool.boot.modules.rddb.entity;
/**
* @author: zhouyuan
* @date: 2020/10/19
*/
public class Const {
//图片前缀
public static final String URL_PREFIX = "";
//admin县级人大工作人员 street乡镇负责人 contact联络站负责人 rddb各级人大代表 voter选民用户
/**
* 县级工作人员
*/
public static final String TYPE_ADMIN = "admin";
/**
* 乡镇负责人
*/
public static final String TYPE_STREET = "street";
/**
* 联络站负责人
*/
public static final String TYPE_CONTACT = "contact";
/**
* 人大代表
*/
public static final String TYPE_RDDB = "rddb";
/**
* 选民
*/
public static final String TYPE_VOTER = "voter";
}

View File

@ -0,0 +1,62 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 联络站活动(ContactActivityMapper)实体类
*
* @author makejava
* @since 2020-10-09 16:05:50
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("t_contact_activity")
@ApiModel(value = "联络站活动")
public class ContactActivity extends BaseEntity {
private String createdId;
private String updatedId;
/**
* 活动主题
*/
@NotBlank(message = "请输入活动主题")
@ApiModelProperty(value = "活动主题")
private String activityTheme;
/**
* 活动日期
*/
@NotNull(message = "请选择活动日期")
@ApiModelProperty(value = "活动日期")
private String activityDate;
/**
* 活动地点
*/
@ApiModelProperty(value = "活动地点")
private String activityAddress;
/**
* 活动内容
*/
@NotBlank(message = "请输入活动内容")
@ApiModelProperty(value = "活动内容")
private String activityContent;
/**
* 活动上传人
*/
private String activityUpload;
/**
* 留言人
*/
private String leaveMessagePerson;
/**
* 留言内容
*/
private String leaveMessageContent;
}

View File

@ -0,0 +1,70 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 联络站活动评论(ContactActivityComment)实体类
*
* @author makejava
* @since 2020-10-19 09:43:49
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("t_contact_activity_comment")
@ApiModel(value = "联络站活动评论")
public class ContactActivityComment extends BaseEntity {
private static final long serialVersionUID = 337483194775923489L;
private String createdId;
private String updatedId;
/**
* 联络站活动id
*/
@ApiModelProperty(value = "联络站活动id")
private String contactActivityId;
/**
* 评论人
*/
@ApiModelProperty(value = "评论人")
private String name;
/**
* 内容
*/
@ApiModelProperty(value = "内容")
private String content;
/**
* 0待审核 1已通过 2未通过
*/
private Integer status;
/**
* 未通过原因
*/
private String reason;
/**
* 回复人
*/
@ApiModelProperty(value = "回复人")
private String replyName;
/**
* 回复内容
*/
@ApiModelProperty(value = "回复内容")
private String replyContent;
/**
* 回复时间
*/
@ApiModelProperty(value = "回复时间")
private LocalDateTime replyDate;
}

View File

@ -0,0 +1,71 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 资料库
* </p>
*
* @author zhouyuan
* @since 2020-10-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_data_bank")
public class DataBank extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 文件名称
*/
@ApiModelProperty(value = "文件名称")
@NotBlank(message = "文件名称不能为空")
private String fileName;
/**
* 文件类型
*/
@ApiModelProperty(value = "文件类型")
@NotBlank(message = "文件类型不能为空")
private String fileType;
/**
* 文件
*/
@ApiModelProperty(value = "文件")
@NotBlank(message = "请上传文件")
private String file;
/**
* 上传人员
*/
@ApiModelProperty(value = "上传人员")
private String uploadUser;
public void full() {
if (StringUtils.isNotBlank(getFile())) {
setFile(Const.URL_PREFIX + getFile());
}
}
}

View File

@ -0,0 +1,122 @@
package com.ydool.boot.modules.rddb.entity;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import com.ydool.boot.core.validator.Chinese;
import com.ydool.boot.core.validator.Number;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
* 代表管理(Db)实体类
*
* @author makejava
* @since 2020-09-29 13:15:34
*/
@Getter
@Setter
@TableName(value = "t_db")
@ApiModel(value = "代表")
public class Db extends BaseEntity {
private String createdId;
private String updatedId;
private String userId;
/**
* 姓名
*/
@NotBlank(message = "请输入姓名")
@Chinese(message = "姓名只能输入中文")
@Size(max = 20, message = "姓名最大长度为20")
@ApiModelProperty(value = "姓名")
private String name;
/**
* 联系方式
*/
@NotBlank(message = "请输入联系方式")
@ApiModelProperty(value = "联系方式")
private String phone;
/**
* 性别
*/
@NotBlank(message = "请选择性别")
@ApiModelProperty(value = "性别")
private String sex;
/*@NotBlank(message = "请选择出生年月")
@ApiModelProperty(value = "出生年月")
private String birthday;
@Chinese(message = "党派只能输入中文")
@ApiModelProperty(value = "党派")
private String partyCadre;*/
/*@NotBlank(message = "请选择民族")
@ApiModelProperty(value = "民族")
private String nation;*/
/**
* 籍贯
*/
@Chinese(message = "籍贯只能输入中文")
@ApiModelProperty(value = "籍贯")
private String nativePlace;
/*@NotBlank(message = "请选择学历")
@ApiModelProperty(value = "学历")
private String culture;*/
/**
* 工作单位及职务
*/
@NotBlank(message = "请输入工作单位及职务")
@Chinese(message = "工作单位及职务只能输入中文")
@ApiModelProperty(value = "工作单位及职务")
private String unit;
// /**
// * 职务
// */
// @NotBlank(message = "请输入职务")
// @Chinese(message = "职务只能输入中文")
// @ApiModelProperty(value = "职务")
// private String duty;
/**
* 选区地址
*/
@NotBlank(message = "请选择选区地址")
@ApiModelProperty(value = "选区地址")
private String precinctAddress;
/**
* 代表身份
*/
@NotBlank(message = "请选择代表身份 省级人大代表1 市级人大代表2 县级人大代表3 乡镇级人大代表4")
@ApiModelProperty(value = "代表身份")
private String dbIdentity;
/* @NotBlank(message = "请选择是否连任")
private String isReappointment;*/
/**
* 机关人员id 联络站
*/
@NotBlank(message = "请选择联络站")
@ApiModelProperty(value = "联络站")
private String officeId;
@ApiModelProperty(value = "排序")
private Integer sortNo;
@TableField(exist = false)
private String phoneNumber;
public String getPhoneNumber(){
if(StrUtil.isNotBlank(this.phone))
return this.phone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
return null;
}
}

View File

@ -0,0 +1,98 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 消息
* </p>
*
* @author zhouyuan
* @since 2020-10-09
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_message")
public class Message extends BaseEntity {
private static final long serialVersionUID = 1L;
//通知文件轮阅
public static final Integer TYPE_READ_FILE = 1;
//通知会议
public static final Integer TYPE_CONFERENCE = 2;
//通知督事
public static final Integer TYPE_SUPERVISE_THING = 3;
//通知文件审批
public static final Integer TYPE_FILE_AUDIT = 4;
//通知回复的建议
public static final Integer TYPE_VOTER = 5;
//通知回复的联系人大
public static final Integer TYPE_VOTER_DB = 6;
//通知乡镇选民建议
public static final Integer TYPE_VOTER_STREET = 7;
//通知活动审核
public static final Integer TYPE_ACTIVITY = 8;
//通知活动拒绝
public static final Integer TYPE_ACTIVITY_REFUSE = 9;
//通知活动通过
public static final Integer TYPE_ACTIVITY_PASS = 10;
//所有人的通知公告
public static final Integer TYPE_NOTICE = 11;
//未读
public static final Integer STATUS_UNREAD = 0;
//已读
public static final Integer STATUS_READ = 1;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 消息标题
*/
@ApiModelProperty(value = "消息标题")
private String title;
/**
* 消息内容
*/
@ApiModelProperty(value = "消息内容")
private String content;
/**
* 消息类型
*/
@ApiModelProperty(value = "消息类型 1通知文件轮阅 2通知会议 3通知督事 4通知文件审批 5选民建议 6联系人大 7乡镇选民建议 8活动审核 9活动拒绝 10活动通过 11所有人的通知公告")
private Integer type;
/**
* 关联资源id
*/
@ApiModelProperty(value = "关联资源id")
private String actionId;
/**
* 0未读 1已读
*/
@ApiModelProperty(value = "0未读 1已读")
private Integer status;
/**
* 指定阅读人员id
*/
@ApiModelProperty(value = "阅读人员id")
private String userId;
}

View File

@ -0,0 +1,84 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 通知
*
* @author chenchen
* @date 2020-09-30
*/
@Data
@TableName("t_notice")
@ApiModel(value = "通知公告")
public class Notice implements Serializable {
private static final long serialVersionUID = 634299265963508255L;
/**
* id
*/
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 创建者
*/
private String createdId;
/**
* 创建时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime createdAt;
/**
* 更新者
*/
private String updatedId;
/**
* 更新时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime updatedAt;
/**
* 标题
*/
@NotBlank(message = "请输入标题")
@ApiModelProperty(value = "标题")
private String title;
/**
* 内容
*/
@NotBlank(message = "请输入内容")
@ApiModelProperty(value = "内容")
private String content;
/**
* 通知日期
*/
@ApiModelProperty(value = "通知日期")
private String noticeDate;
/**
* 上传人员
*/
@ApiModelProperty(value = "上传人员")
private String uploadPersonnel;
/**
* 0不置顶1置顶
*/
@ApiModelProperty(value = "是否置顶0不置顶1置顶")
private Integer top;
@TableField(exist = false)
private boolean newRecord;
}

View File

@ -0,0 +1,121 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.common.cache.DictUtils;
import com.ydool.boot.common.cache.StreetUtils;
import com.ydool.boot.core.entity.BaseEntity;
import com.ydool.boot.core.validator.Chinese;
import com.ydool.boot.core.validator.Number;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 机关
* </p>
*
* @author zhouyuan
* @since 2020-09-29
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_office")
public class Office extends BaseEntity {
private static final long serialVersionUID = 1L;
private String userId;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空")
private String name;
/**
* 联系方式
*/
@NotBlank(message = "联系方式不能为空")
private String phone;
/**
* 性别
*/
@NotBlank(message = "性别不能为空")
private String sex;
/**
* 出生年月
*/
@NotBlank(message = "出生年月不能为空")
private String birthday;
/**
* 党派
*/
@Chinese(message = "党派只能是中文")
private String partyCadre;
/**
* 民族
*/
private String nation;
/**
* 籍贯
*/
@Chinese(message = "籍贯只能是中文")
@NotBlank(message = "籍贯不能为空")
private String nativePlace;
/**
* 学历
*/
@NotBlank(message = "学历不能为空")
private String culture;
/**
* 职务
*/
@NotBlank(message = "职务不能为空")
private String duty;
/**
* 辖区
*/
private String street;
/**
* 该联络站的简介
*/
private String remarks;
/**
* 该联络站的执勤表
*/
private String content;
/**
* 字典值转中文
*/
public void fullInfo() {
//辖区
setStreet(StreetUtils.getStreetName(street));
//职务
setDuty(DictUtils.getDictLabel("office_duty", getDuty()));
}
}

View File

@ -0,0 +1,64 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* 履职(Perform)实体类
*
* @author makejava
* @since 2020-10-21 09:17:39
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName(value = "t_perform")
public class Perform extends BaseEntity implements Serializable {
private static final long serialVersionUID = -86078285471030787L;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 活动名称
*/
private String activityName;
/**
* 活动时间
*/
private String activityDate;
/**
* 活动地点
*/
private String activityAddress;
/**
* 活动内容
*/
private String activityContent;
/**
* 上传人员
*/
private String uploadPersonnel;
/**
* 图片
*/
private String photo;
/**
* 审核状态0待审核1审核通过2审核拒绝
*/
private String status;
/**
* 拒绝理由
*/
private String reason;
}

View File

@ -0,0 +1,79 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 文件
* </p>
*
* @author zhouyuan
* @since 2020-09-30
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_read_file")
public class ReadFile extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 文件名称
*/
@NotBlank(message = "请输入文件名称")
@ApiModelProperty(value = "文件名称")
private String fileName;
/**
* 文件
*/
@NotBlank(message = "请上传文件")
@ApiModelProperty(value = "文件")
private String file;
/**
* 上传人员
*/
@ApiModelProperty(value = "上传人员")
private String uploadUser;
//已读数
@ApiModelProperty(value = "非实体字段,返回已读数")
@TableField(exist = false)
private Integer readCount;
//未读数
@ApiModelProperty(value = "非实体字段,返回未读数")
@TableField(exist = false)
private Integer unReadCount;
//已读未读
@ApiModelProperty(value = "非实体字段,返回当前用户对该文件已读否")
@TableField(exist = false)
private Integer readStatus;
public void full() {
if (StringUtils.isNotBlank(getFile())) {
setFile(Const.URL_PREFIX + getFile());
}
}
}

View File

@ -0,0 +1,71 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import com.ydool.boot.modules.sys.entity.User;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 文件阅读情况
* </p>
*
* @author zhouyuan
* @since 2020-09-30
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_read_file_user")
public class ReadFileUser extends BaseEntity {
private static final long serialVersionUID = 1L;
//未读
public static final Integer STATUS_UNREAD = 0;
//已读
public static final Integer STATUS_READ = 1;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 文件id
*/
@ApiModelProperty(value = "文件id")
private String fileId;
/**
* 人员id
*/
@ApiModelProperty(value = "人员id")
private String userId;
/**
* 人员名称
*/
@ApiModelProperty(value = "人员名称")
private String userName;
/**
* 阅读情况 0未读 1已读
*/
@ApiModelProperty(value = "阅读情况 0未读 1已读")
private Integer status;
//返回字段
@TableField(exist = false)
@ApiModelProperty(value = "非实体字段")
private User user;
}

View File

@ -0,0 +1,63 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import com.ydool.boot.core.validator.Unique;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import java.util.List;
/**
* <p>
* 调研文章
* </p>
*
* @author zhouyuan
* @since 2021-03-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_research_article")
public class ResearchArticle extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 名称
*/
@ApiModelProperty(value = "名称")
@NotBlank(message = "名称不能为空")
@Unique(message = "名称不能重复")
private String title;
/**
* 创建者名称
*/
private String createdUser;
/**
* 本次上传的附件数
*/
@ApiModelProperty(value = "本次上传的附件数")
private Integer attachmentNum;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,返回栏目的集合")
private List issueList;
}

View File

@ -0,0 +1,80 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.TreeEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* <p>
* 调研文章附件
* </p>
*
* @author zhouyuan
* @since 2021-03-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_research_article_attachment")
public class ResearchArticleAttachment extends TreeEntity {
private static final long serialVersionUID = 1L;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 附件名
*/
@ApiModelProperty(value = "附件名")
private String title;
/**
* 所属调研文章id
*/
@ApiModelProperty(value = "所属调研文章id")
private String researchArticleId;
/**
* 附件路径
*/
@ApiModelProperty(value = "附件路径")
private String attachment;
/**
* 文件大小
*/
@ApiModelProperty(value = "文件大小")
private String size;
/**
* 0为栏目否则是附件
*/
@ApiModelProperty(value = "0为栏目否则是附件")
private String pid;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,返回所属调研文章的信息")
private ResearchArticle researchArticle;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,返回议题的附件集合")
private List attachmentList;
public String getName() {
return this.title;
}
}

View File

@ -0,0 +1,181 @@
package com.ydool.boot.modules.rddb.entity;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ydool.boot.common.utils.SpringUtils;
import com.ydool.boot.core.entity.BaseEntity;
import com.ydool.boot.modules.rddb.service.SuperviseThingAttachmentService;
import com.ydool.boot.modules.sys.entity.User;
import com.ydool.boot.modules.sys.service.UserService;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
* 代表督事
* </p>
*
* @author zhouyuan
* @since 2020-10-12
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_supervise_thing")
public class SuperviseThing extends BaseEntity {
private static final long serialVersionUID = 1L;
//公开与否
public static final Integer NO_PUBLIC = 0;
public static final Integer PUBLIC = 1;
//
public static final Integer STATUS_YI = 1;
public static final Integer STATUS_DU = 2;
public static final Integer STATUS_PING = 3;
private String createdId;
private String updatedId;
/**
* 主题
*/
@ApiModelProperty(value = "主题")
@NotBlank(message = "主题不能为空")
private String title;
/**
* 地点
*/
@ApiModelProperty(value = "地点")
@NotBlank(message = "地点不能为空")
private String address;
/**
* 督事开始时间
*/
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty(value = "督事时间")
@NotNull(message = "督事时间不能为空")
private LocalDateTime startTime;
/**
* 内容详情
*/
@ApiModelProperty(value = "内容")
@NotBlank(message = "详情不能为空")
private String content;
/**
* 进度 发表是议签到后是督结束上传资料后是评 评论需审核
*/
@NotNull(message = "进度不能为空")
@ApiModelProperty(value = "进度 1议 2督 3评")
private Integer status;
/**
* 是否公开 0否 1是
*/
@NotNull(message = "是否公开不能为空")
@ApiModelProperty("是否公开 0否 1是")
private Integer isPublic;
/**
* 会议纪要
*/
@ApiModelProperty("会议纪要")
private String record;
/**
* 会议部门回复
*/
@ApiModelProperty("会议部门回复")
private String deptReply;
/**
* 所属街道
*/
@ApiModelProperty(value = "街道id")
@NotBlank(message = "所属街道不能为空")
private String street;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,返回会议图片完整过前缀的数组")
private List<SuperviseThingAttachment> pictureArr;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,返回创建人姓名")
private String userName;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,当前登录用户该是否已签到 0未 1已")
private Integer sign;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,当前登录用户签到时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private LocalDateTime signTime;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,应签到多少人")
private Integer allSignCount;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,已签到多少人")
private Integer signedCount;
@TableField(exist = false)
@ApiModelProperty(value = "非实体字段")
private String[] files;
public void full() {
SuperviseThingAttachmentService service = SpringUtils.getBean(SuperviseThingAttachmentService.class);
UserService userService = SpringUtils.getBean(UserService.class);
//议题
List<SuperviseThingAttachment> list = service.list(new LambdaQueryWrapper<SuperviseThingAttachment>()
.eq(SuperviseThingAttachment::getSuperviseThingId, getId())
.eq(SuperviseThingAttachment::getPid, "0"));
if (CollectionUtil.isNotEmpty(list)) {
list.forEach(item -> {
List<SuperviseThingAttachment> children = service.list(new LambdaQueryWrapper<SuperviseThingAttachment>()
.eq(SuperviseThingAttachment::getSuperviseThingId, getId())
.eq(SuperviseThingAttachment::getPid, item.getId()));
item.setChildren(children);
});
setPictureArr(list);
}
//创建人
User user = userService.getById(getCreatedId());
setUserName(user != null ? user.getUserName() : "");
}
}

View File

@ -0,0 +1,75 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.TreeEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* <p>
* 督事附件
* </p>
*
* @author zhouyuan
* @since 2021-03-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_supervise_thing_attachment")
public class SuperviseThingAttachment extends TreeEntity {
private static final long serialVersionUID = 1L;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 附件名
*/
private String title;
/**
* 所属督事id
*/
private String superviseThingId;
/**
* 附件路径
*/
private String attachment;
/**
* 文件大小
*/
private String size;
/**
* 0为议题否则是附件
*/
private String pid;
private String treeNames;
private String treeIds;
public String getName() {
return this.title;
}
/**
* 下级列表
*/
@TableField(exist = false)
private List<SuperviseThingAttachment> children;
}

View File

@ -0,0 +1,102 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ydool.boot.core.entity.BaseEntity;
import com.ydool.boot.modules.sys.entity.User;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
* <p>
* 代表督事评论
* </p>
*
* @author zhouyuan
* @since 2020-10-12
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_supervise_thing_comment")
public class SuperviseThingComment extends BaseEntity {
private static final long serialVersionUID = 1L;
public static final Integer STATUS_WAIT = 0;
public static final Integer STATUS_PASS = 1;
public static final Integer STATUS_REFUSE = 2;
private String createdId;
private String updatedId;
/**
* 督事id
*/
@ApiModelProperty(value = "督事id")
private String superviseThingId;
/**
* 评论人
*/
@ApiModelProperty(value = "评论人")
private String name;
/**
* 内容
*/
@ApiModelProperty(value = "内容")
private String content;
/**
* 0待审核 1已通过 2未通过
*/
@ApiModelProperty(value = "0待审核 1已通过 2未通过")
private Integer status;
/**
* 未通过原因
*/
@ApiModelProperty(value = "未通过原因")
private String reason;
/**
* 回复人id
*/
@ApiModelProperty(value = "回复人id")
private String replyUserId;
/**
* 督事id
*/
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty(value = "回复时间")
private LocalDateTime replyTime;
/**
* 回复内容
*/
@ApiModelProperty(value = "回复内容")
private String replyContent;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,回复人的信息 为null说明该督事评论没有被回复")
private User user;
//非实体字段
@TableField(exist = false)
@ApiModelProperty("非实体字段,评论人的信息 为null说明这个人被删除了")
private User createUser;
}

View File

@ -0,0 +1,64 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 督事人员
* </p>
*
* @author zhouyuan
* @since 2020-10-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_supervise_thing_user")
public class SuperviseThingUser extends BaseEntity{
private static final long serialVersionUID = 1L;
//未签到
public static final Integer STATUS_UN_SIGN = 0;
//已签到
public static final Integer STATUS_SIGN = 1;
//请假
public static final Integer STATUS_LEAVE = 2;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 督事id
*/
@ApiModelProperty(value = "督事id")
private String superviseThingId;
/**
* 督事人员id
*/
@ApiModelProperty(value = "督事人员id")
private String userId;
/**
* 督事人员名字
*/
@ApiModelProperty(value = "督事人员名字")
private String userName;
/**
* 签到情况 0未签到 1已签到 2请假
*/
@ApiModelProperty(value = "签到情况 0未签到 1已签到 2请假")
private Integer status;
}

View File

@ -0,0 +1,82 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 临时文件
* </p>
*
* @author zhouyuan
* @since 2021-03-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_temporary")
public class Temporary extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 文件名称
*/
@NotBlank(message = "请输入文件名")
private String fileName;
/**
* 1为临时文件1 2为临时文件2
*/
private String type;
/**
* 文件
*/
@NotBlank(message = "请上传文件")
private String file;
/**
* 上传人员
*/
private String uploadUser;
/**
* 乡镇街道id
*/
private String street;
/**
* 类别
*/
private String category;
/**
* 完成度
*/
private String fullRate;
/**
* 满意度
*/
private String satisfactoryRate;
/**
* 排序
*/
private Integer sortNo;
}

View File

@ -0,0 +1,32 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 账号与类型
* </p>
*
* @author zhouyuan
* @since 2021-05-12
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_user_type")
public class UserType extends BaseEntity{
private static final long serialVersionUID = 1L;
private String createdId;
private String updatedId;
private String userId;
/**
* 账号类型
*/
private String type;
}

View File

@ -0,0 +1,79 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import com.ydool.boot.modules.rddb.vo.VoterSuggestSolveVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 选民建议(VoterSuggest)实体类
*
* @author makejava
* @since 2020-10-09 11:53:56
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("t_voter_suggest")
@ApiModel(value = "选民建议")
public class VoterSuggest extends BaseEntity {
/**
* 创建者
*/
@ApiModelProperty(value = "创建者")
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 选民姓名
*/
@ApiModelProperty(value = "选民姓名")
private String voterName;
/**
* 建议标题
*/
@ApiModelProperty(value = "建议标题")
private String suggestTitle;
/**
* 建议内容
*/
@ApiModelProperty(value = "建议内容")
private String suggestContent;
/**
* 图片
*/
@ApiModelProperty(value = "图片")
private String photo;
/**
* 是否回复 1是0否
*/
private String status;
/**
* 回复内容
*/
private String replyContent;
/**
* 分配对象
*/
private String allotObj;
/**
* 街道
*/
@ApiModelProperty(value = "街道")
private String streetId;
/**
* 回复列表
*/
@ApiModelProperty(value = "回复列表")
@TableField(exist = false)
private List<VoterSuggestSolveVO> voterSuggestSolveList;
}

View File

@ -0,0 +1,72 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 选民对代表的建议联系代表(VoterSuggest)实体类
*
* @author makejava
* @since 2020-10-09 11:53:56
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("t_voter_suggest_db")
@ApiModel(value = "联系人大")
public class VoterSuggestDb extends BaseEntity {
private String createdId;
private String updatedId;
/**
* 选民姓名
*/
@NotBlank(message = "请输入选民姓名")
@ApiModelProperty(value = "选民姓名")
private String voterName;
/**
* 代表地区
*/
@NotBlank(message = "请选择代表地区")
@ApiModelProperty(value = "代表地区")
private String dbRegion;
/**
* 被提问代表
*/
@NotBlank(message = "请选择代表")
@ApiModelProperty(value = "被提问代表")
private String db;
/**
* 建议内容
*/
@NotBlank(message = "请输入建议内容")
@ApiModelProperty(value = "建议内容")
private String suggestContent;
/**
* 图片
*/
@ApiModelProperty(value = "图片")
private String photo;
/**
* 是否回复 1是0否
*/
@ApiModelProperty(value = "是否回复 1是0否")
private String status;
/**
* 回复内容
*/
@ApiModelProperty(value = "回复内容")
private String replyContent;
/**
* 1已读 0未读
*/
@ApiModelProperty(value = "1已读 0未读")
private Integer isRead;
}

View File

@ -0,0 +1,56 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
* 选民建议解决(VoterSuggestSolve)实体类
*
* @author makejava
* @since 2020-10-14 15:36:53
*/
@Getter
@Setter
@TableName(value = "t_voter_suggest_solve")
@ApiModel(value = "选民建议回复")
public class VoterSuggestSolve extends BaseEntity implements Serializable {
private static final long serialVersionUID = 773603584310248907L;
private String createdId;
private String updatedId;
/**
* 选民建议id
*/
private String voterSuggestId;
/**
* 人员id
*/
@ApiModelProperty(value = "人员id")
private String userId;
/**
* 是否回复 1是0否
*/
@ApiModelProperty(value = "是否回复 1是0否")
private String status;
/**
* 回复内容
*/
@ApiModelProperty(value = "回复内容")
private String replyContent;
/**
* 1已读 0未读
*/
@ApiModelProperty(value = "1已读 0未读")
private Integer isRead;
// @TableField(exist = false)
// private User user;
}

View File

@ -0,0 +1,36 @@
package com.ydool.boot.modules.rddb.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Getter;
import lombok.Setter;
/**
* @author chenchen
* @date 2020/09/29
*/
@Getter
@Setter
@HeadRowHeight(20)
@ColumnWidth(20)
public class BasicDynamicHead {
@ExcelProperty("标题")
private String title;
@ExcelProperty("内容")
private String content;
@ExcelProperty("类别")
private String categoryName;
@ExcelProperty("审核状态")
private String statusName;
@ExcelProperty("拒绝原因")
private String reason;
@ExcelProperty("乡镇街道")
private String streetName;
}

View File

@ -0,0 +1,48 @@
package com.ydool.boot.modules.rddb.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
/**
* @author chenchen
* @date 2020/09/29
*/
@Getter
@Setter
@HeadRowHeight(20)
@ColumnWidth(20)
public class SuperviseThingHead {
@ExcelProperty("主题")
private String title;
@ExcelProperty("地点")
private String address;
@ExcelProperty("详情")
private String content;
@ExcelProperty("督事时间")
private LocalDateTime startTime;
@ExcelProperty("进度")
private String status;
@ExcelProperty("街道")
private String street;
@ExcelProperty("会议纪要")
private String record;
@ExcelProperty("会议部门回复")
private String deptReply;
@ExcelProperty("会议人员")
private String userNames;
}

View File

@ -0,0 +1,80 @@
package com.ydool.boot.modules.rddb.excel.db;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Getter;
import lombok.Setter;
/**
* @author chenchen
* @date 2020/09/29
*/
@Getter
@Setter
@HeadRowHeight(20)
@ColumnWidth(20)
public class DbReadHead {
@ExcelProperty("姓名")
private String name;
@ExcelProperty("联系方式")
private String phone;
/**
* 性别
*/
@ExcelProperty("性别")
private String sex;
/**
* 出生年月
*/
@ExcelProperty("出生年月")
private String birthday;
/**
* 党派
*/
@ExcelProperty("党派")
private String partyCadre;
/**
* 民族
*/
@ExcelProperty("民族")
private String nation;
/**
* 籍贯
*/
@ExcelProperty("籍贯")
private String nativePlace;
/**
* 学历
*/
@ExcelProperty("学历")
private String culture;
/**
* 工作单位及职务
*/
@ExcelProperty("工作单位及职务")
private String unit;
// /**
// * 职务
// */
// @ExcelProperty("职务")
// private String duty;
/**
* 选区地址
*/
@ExcelProperty("选区地址")
private String precinctAddress;
/**
* 代表身份
*/
@ExcelProperty("代表身份")
private String dbIdentity;
/**
* 是否连任
*/
@ExcelProperty("是否连任")
private String isReappointment;
}

View File

@ -0,0 +1,83 @@
package com.ydool.boot.modules.rddb.gen;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.rules.DateType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.BeetlTemplateEngine;
/**
* @author: zhouyuan
* @date: 2020/5/28
* 填写表名表前缀生成代码已有情况不会覆盖
*/
public class MyGenerator {
public static void main(String[] args) {
//表名
String tableName = "t_user_type";
//表前缀
String tablePrefix = "t_";
/*-----------------------------------------------------------------------------*/
//代码生成器
AutoGenerator mpg = new AutoGenerator();
mpg.setTemplateEngine(new BeetlTemplateEngine());
//全局配置
GlobalConfig gc = new GlobalConfig();
String projectPath = System.getProperty("user.dir");
gc.setOutputDir(projectPath + "/src/main/java");
gc.setAuthor("zhouyuan");
gc.setOpen(false);
//是否覆盖
gc.setFileOverride(false);
gc.setDateType(DateType.ONLY_DATE);
//实现类不要Impl后缀
gc.setServiceImplName("%sService");
mpg.setGlobalConfig(gc);
//数据源
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://106.54.109.185:3306/ydool_rddb?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2B8");
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
dsc.setUsername("root");
dsc.setPassword("yuan961124");
dsc.setDbType(DbType.MYSQL);
mpg.setDataSource(dsc);
//包配置
PackageConfig pc = new PackageConfig();
pc.setParent("com.ydool.boot.modules");
pc.setModuleName("rddb");
pc.setEntity("entity");
pc.setMapper("mapper");
pc.setServiceImpl("service");
pc.setService("service.inter");
pc.setController("web");
mpg.setPackageInfo(pc);
//策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setInclude(tableName);
strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
strategy.setEntityLombokModel(true);
//公共父类
strategy.setSuperControllerClass(com.ydool.boot.core.web.BaseController.class);
strategy.setSuperEntityClass(com.ydool.boot.core.entity.BaseEntity.class);
strategy.setSuperServiceImplClass(com.ydool.boot.core.service.BaseService.class);
strategy.setRestControllerStyle(false);
strategy.setTablePrefix(tablePrefix);
strategy.setSkipView(true);
mpg.setStrategy(strategy);
mpg.execute();
}
}

View File

@ -0,0 +1,21 @@
package com.ydool.boot.modules.rddb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.boot.modules.rddb.entity.ActivityAuditUser;
import com.ydool.boot.modules.rddb.entity.AuditUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* 活动审批人员
*
* @author makejava
* @since 2020-09-29 13:15:34
*/
public interface ActivityAuditUserMapper extends BaseMapper<ActivityAuditUser> {
@Select("<script> SELECT a.* FROM t_activity_audit_user a WHERE a.STATUS=0 AND a.user_id=#{userId} AND (SELECT min(b.sort_no) FROM t_activity_audit_user b WHERE b.activity_id=a.activity_id AND b.STATUS=0)=a.sort_no AND (SELECT c.STATUS FROM t_activity c WHERE c.id=a.activity_id <if test='activityName!=null and activityName!=\"\" '> and c.activity_name like #{activityName} </if>)=0 order by a.sort_no asc </script>")
Page<ActivityAuditUser> pageMyWaitList(Page<ActivityAuditUser> page, @Param("userId") String userId, @Param("activityName") String activityName);
}

View File

@ -0,0 +1,11 @@
package com.ydool.boot.modules.rddb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ydool.boot.modules.rddb.entity.ActivityComment;
/**
* @author chenchen
* @date 2020/10/09
*/
public interface ActivityCommentMapper extends BaseMapper<ActivityComment> {
}

View File

@ -0,0 +1,20 @@
package com.ydool.boot.modules.rddb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ydool.boot.modules.rddb.entity.Activity;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* 活动
*
* @author makejava
* @since 2020-09-29 13:15:34
*/
public interface ActivityMapper extends BaseMapper<Activity> {
//end1为会议结束标记 status1审核通过
@Select("select * from t_activity a where a.end!=1 and a.status=1 and DATE_FORMAT( now(), '%Y-%m-%d %H:%i:%s' )> DATE_FORMAT( date_add( a.activity_date, INTERVAL 1 DAY ), '%Y-%m-%d %H:%i:%s' )")
List<Activity> getOverTimeList();
}

View File

@ -0,0 +1,13 @@
package com.ydool.boot.modules.rddb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ydool.boot.modules.rddb.entity.ActivityUser;
/**
* 参加活动人员
*
* @author makejava
* @since 2020-09-29 13:15:34
*/
public interface ActivityUserMapper extends BaseMapper<ActivityUser> {
}

View File

@ -0,0 +1,16 @@
package com.ydool.boot.modules.rddb.mapper;
import com.ydool.boot.modules.rddb.entity.Audit;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 文件审批 Mapper 接口
* </p>
*
* @author zhouyuan
* @since 2020-10-09
*/
public interface AuditMapper extends BaseMapper<Audit> {
}

View File

@ -0,0 +1,21 @@
package com.ydool.boot.modules.rddb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.boot.modules.rddb.entity.AuditUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* <p>
* 文件审批人员 Mapper 接口
* </p>
*
* @author zhouyuan
* @since 2020-10-09
*/
public interface AuditUserMapper extends BaseMapper<AuditUser> {
@Select("<script> SELECT a.* FROM t_audit_user a WHERE a.STATUS=0 AND a.user_id=#{userId} AND (SELECT min(b.sort_no) FROM t_audit_user b WHERE b.audit_id=a.audit_id AND b.STATUS=0)=a.sort_no AND (SELECT c.STATUS FROM t_audit c WHERE c.id=a.audit_id <if test='title!=null and title!=\"\" '> and c.title like #{title} </if> )=0 order by a.sort_no asc </script>")
Page<AuditUser > pageMyWaitList(Page page, @Param("userId") String userId,@Param("title") String title);
}

View File

@ -0,0 +1,16 @@
package com.ydool.boot.modules.rddb.mapper;
import com.ydool.boot.modules.rddb.entity.BasicDynamic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 动态信息 Mapper 接口
* </p>
*
* @author zhouyuan
* @since 2021-03-15
*/
public interface BasicDynamicMapper extends BaseMapper<BasicDynamic> {
}

View File

@ -0,0 +1,36 @@
package com.ydool.boot.modules.rddb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.boot.modules.rddb.entity.ConferenceAttachment;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestParam;
/**
* <p>
* 会议附件 Mapper 接口
* </p>
*
* @author zhouyuan
* @since 2020-10-15
*/
public interface ConferenceAttachmentMapper extends BaseMapper<ConferenceAttachment> {
@Select({" <script>",
"select a.* from t_conference_attachment a left join t_conference b on a.conference_id= b.id",
"<where>",
"a.pid!=''",
"<if test='conferenceTitle!=null '>",
"AND b.title like #{conferenceTitle} ",
"</if>",
"<if test='attachmentTitle!=null '>",
"AND a.title like #{attachmentTitle} ",
"</if>",
"</where>",
" order by a.created_at desc ",
"</script>"
})
Page<ConferenceAttachment> page(Page page,@Param("conferenceTitle") String conferenceTitle, @Param("attachmentTitle") String attachmentTitle);
}

View File

@ -0,0 +1,29 @@
package com.ydool.boot.modules.rddb.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.boot.modules.rddb.entity.Conference;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* <p>
* 会议 Mapper 接口
* </p>
*
* @author zhouyuan
* @since 2020-10-14
*/
public interface ConferenceMapper extends BaseMapper<Conference> {
//end1为会议结束标记
@Select("select * from t_conference a where a.end!=1 and DATE_FORMAT( now(), '%Y-%m-%d %H:%i:%s' )> DATE_FORMAT( date_add( a.start_time, INTERVAL 1 DAY ), '%Y-%m-%d %H:%i:%s' )")
List<Conference> getOverTimeList();
@Select("select distinct b.* from t_conference_attachment a left join t_conference b on a.conference_id = b.id ${ew.customSqlSegment} ")
Page<Conference> listPage(Page page, @Param(Constants.WRAPPER) QueryWrapper<Conference> qw);
}

View File

@ -0,0 +1,16 @@
package com.ydool.boot.modules.rddb.mapper;
import com.ydool.boot.modules.rddb.entity.ConferenceUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 会议参会人员 Mapper 接口
* </p>
*
* @author zhouyuan
* @since 2020-10-14
*/
public interface ConferenceUserMapper extends BaseMapper<ConferenceUser> {
}

View File

@ -0,0 +1,12 @@
package com.ydool.boot.modules.rddb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ydool.boot.modules.rddb.entity.ContactActivity;
import com.ydool.boot.modules.rddb.entity.ContactActivityComment;
/**
* @author chenchen
* @date 2020/10/09
*/
public interface ContactActivityCommentMapper extends BaseMapper<ContactActivityComment> {
}

View File

@ -0,0 +1,11 @@
package com.ydool.boot.modules.rddb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ydool.boot.modules.rddb.entity.ContactActivity;
/**
* @author chenchen
* @date 2020/10/09
*/
public interface ContactActivityMapper extends BaseMapper<ContactActivity> {
}

View File

@ -0,0 +1,16 @@
package com.ydool.boot.modules.rddb.mapper;
import com.ydool.boot.modules.rddb.entity.DataBank;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 资料库 Mapper 接口
* </p>
*
* @author zhouyuan
* @since 2020-10-14
*/
public interface DataBankMapper extends BaseMapper<DataBank> {
}

View File

@ -0,0 +1,13 @@
package com.ydool.boot.modules.rddb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ydool.boot.modules.rddb.entity.Db;
/**
* 代表管理(Db)表数据库访问层
*
* @author makejava
* @since 2020-09-29 13:15:34
*/
public interface DbMapper extends BaseMapper<Db> {
}

View File

@ -0,0 +1,16 @@
package com.ydool.boot.modules.rddb.mapper;
import com.ydool.boot.modules.rddb.entity.Message;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 消息 Mapper 接口
* </p>
*
* @author zhouyuan
* @since 2020-10-09
*/
public interface MessageMapper extends BaseMapper<Message> {
}

View File

@ -0,0 +1,12 @@
package com.ydool.boot.modules.rddb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ydool.boot.modules.rddb.entity.Notice;
/**
* @author chenchen
* @date 2020/07/27
*/
public interface NoticeMapper extends BaseMapper<Notice> {
}

View File

@ -0,0 +1,16 @@
package com.ydool.boot.modules.rddb.mapper;
import com.ydool.boot.modules.rddb.entity.Office;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 机关 Mapper 接口
* </p>
*
* @author zhouyuan
* @since 2020-09-29
*/
public interface OfficeMapper extends BaseMapper<Office> {
}

View File

@ -0,0 +1,11 @@
package com.ydool.boot.modules.rddb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ydool.boot.modules.rddb.entity.Perform;
/**
* @author chenchen
* @date 2020/10/21
*/
public interface PerformMapper extends BaseMapper<Perform> {
}

Some files were not shown because too many files have changed in this diff Show More