提交 daf1ee60 authored 作者: gongwenjie's avatar gongwenjie

war

上级 7c3c36d8
......@@ -5,6 +5,7 @@ import com.zjty.tynotes.attendance.entity.WorkoverAppro;
import com.zjty.tynotes.attendance.entity.vo.request.PageRequestAtten;
import com.zjty.tynotes.attendance.service.ApprovalInformationService;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.pas.base.advise.Content;
import com.zjty.tynotes.pas.entity.Department;
import com.zjty.tynotes.pas.entity.User;
import com.zjty.tynotes.pas.entity.vo.PageResponse;
......@@ -37,6 +38,7 @@ public class ApprovalController {
@Autowired
private ApprovalInformationService approvalInformationService;
@Content(value = "提交审批")
@ApiOperation(value = "提交审批", response = ApprovalInformation.class)
@PostMapping("/submit")
public ResponseEntity submit(@RequestBody ApprovalInformation approvalInformation) {
......@@ -47,6 +49,7 @@ public class ApprovalController {
return ok("提交审批失败,是否是调休,并且是否有加班时长");
}
@Content(value = "删除请假审批")
@ApiOperation(value = "删除请假审批")
@DeleteMapping("/delete/{id}")
public ResponseEntity delete(@PathVariable("id") String id) {
......@@ -68,6 +71,7 @@ public class ApprovalController {
* @param approvalStatus
* @return
*/
@Content(value = "审核审批")
@ApiOperation(value = "审核审批")
@PostMapping("/audit/{userId}/{approvalStatus}")
public ResponseEntity audit(@PathVariable String userId,@PathVariable String approvalStatus,
......@@ -81,7 +85,6 @@ public class ApprovalController {
return ok("审核审批失败");
}
@ApiOperation(value = "查找所有我提交的审批")
@PostMapping("findAllSubmitApproval")
public ResponseEntity findAllSubmitApproval(@RequestBody PageRequestAtten pageRequest) {
......@@ -106,6 +109,7 @@ public class ApprovalController {
return ok("查找所有我审核的审批失败");
}
@Content(value = "提交加班申请")
@ApiOperation(value = "提交加班申请", response = WorkoverAppro.class)
@PostMapping("/submitWorkover")
public ResponseEntity submitWorkover(@RequestBody WorkoverAppro workoverAppro) {
......@@ -116,6 +120,7 @@ public class ApprovalController {
return ok("提交审批失败,是否可有加班时长");
}
@Content(value = "审批加班申请")
@ApiOperation(value = "审批加班申请", response = ApprovalInformation.class)
@PostMapping("/approWorkover/{userId}/{status}")
public ResponseEntity approWorkover(@RequestBody WorkoverAppro workoverAppro,
......@@ -163,6 +168,7 @@ public class ApprovalController {
return ok("查找可选择部门失败");
}
@Content(value = "删除加班审批")
@ApiOperation(value = "删除加班审批")
@DeleteMapping("/deleteWorkover/{id}")
public ResponseEntity deleteWorkover(@PathVariable("id") String id) {
......
......@@ -26,6 +26,7 @@ public class AttendanceController {
@Autowired
private AttendanceDetailsService attendanceDetailsService;
@ApiOperation(value = "查询个人考勤信息", response = ApprovalInformation.class)
@PostMapping("/personnel")
public ResponseEntity personnel(@RequestBody AttenRequest request){
......
......@@ -14,6 +14,7 @@ import com.zjty.tynotes.attendance.entity.CardResult;
import com.zjty.tynotes.attendance.task.CardTask;
import com.zjty.tynotes.attendance.task.MyInit;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.pas.base.advise.Content;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -37,6 +38,7 @@ public class DingTestController {
@Autowired
private CardTask cardTask;
@GetMapping("/token")
public Object token(){
List<String> responses = new ArrayList<>();
......
......@@ -8,6 +8,7 @@ package com.zjty.tynotes.attendance.controller;
import com.zjty.tynotes.attendance.service.DingUserService;
import com.zjty.tynotes.attendance.task.MyInit;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.pas.base.advise.Content;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
......@@ -36,6 +37,7 @@ public class DingUserController {
@Autowired
private MyInit init;
@Content(value = "手动获取钉钉token的接口")
@GetMapping("/getToken")
@ApiOperation(value = "手动获取钉钉token的接口")
public ResponseEntity getToken(){
......@@ -48,6 +50,7 @@ public class DingUserController {
return ok("重新获取token失败");
}
@Content(value = "手动获取钉钉的用户与本地用户进行绑定")
@GetMapping("/getDingUser")
@ApiOperation(value = "手动获取钉钉的用户与本地用户进行绑定")
public ResponseEntity getDingUser(){
......
......@@ -9,6 +9,7 @@ import com.zjty.tynotes.attendance.entity.vo.request.AttenRequest;
import com.zjty.tynotes.attendance.service.AttendanceDetailsService;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.misc.utils.ExcelUtil;
import com.zjty.tynotes.pas.base.advise.Content;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
......@@ -34,6 +35,7 @@ public class ExlController {
@Autowired
private AttendanceDetailsService attendanceDetailsService;
@Content(value = "导出元数据excel表格")
@PostMapping("/excel")
@ApiOperation(value = "导出元数据excel表格")
public void exportCurrentPage(HttpServletRequest request, HttpServletResponse response,@RequestBody AttenRequest attenRequest) {
......
......@@ -67,6 +67,17 @@
</exclusions>
</dependency>
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-log</artifactId>
<exclusions>
<exclusion>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-job</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
......
......@@ -18,7 +18,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
"com.zjty.tynotes.search",
"com.zjty.tynotes.redis",
"com.zjty.tynotes.sms"
,"com.zjty.tynotes.log"
})
@EnableCaching
@EnableScheduling
......
......@@ -6,6 +6,8 @@ import com.zjty.tynotes.job.basic.entity.response.JobResponse;
import com.zjty.tynotes.job.basic.service.ScoreCoefficientService;
import com.zjty.tynotes.job.common.Action;
import com.zjty.tynotes.job.status.service.BusinessTreeManagement;
import com.zjty.tynotes.log.entity.Log;
import com.zjty.tynotes.log.server.LogService;
import com.zjty.tynotes.misc.config.AutoDocument;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -28,6 +30,9 @@ import static org.springframework.http.ResponseEntity.ok;
@RequestMapping("/job/sc")
public class ScController {
@Autowired
private LogService logService;
private final
ScoreCoefficientService scoreCoefficientService;
......@@ -40,12 +45,12 @@ public class ScController {
@PostMapping("/save")
@ApiOperation(value = "新增考评信息.", notes = "新增不可在数据中附带id.成功时返回新增数据保存的id.")
public ResponseEntity<JobResponse> add(@RequestBody ScRo scRo
) {
public ResponseEntity<JobResponse> add(@RequestBody ScRo scRo) {
ScoreCoefficient scoreCoefficient= scRo.toDb();
scoreCoefficient.setTime(new Date());
String saveId = scoreCoefficientService.add(scoreCoefficient);
businessTreeManagement.saveAction(scRo.getUserId(),scRo.getWorkId(),Action.APPRAISAL_WORD,new Date(),"自我评价");
logService.saveLog(new Log(null,"考评任务",new Date(),scRo.getUserId(),null));
return ok(new JobResponse(saveId));
}
......@@ -67,6 +72,7 @@ public class ScController {
}
String saveId = scoreCoefficientService.modify(scoreCoefficient);
businessTreeManagement.saveAction(userId,scoreCoefficient.getWordId(),Action.APPRAISAL_WORD,new Date(),msg);
logService.saveLog(new Log(null,"修改考评",new Date(),userId,null));
return ok(new JobResponse(saveId));
}
......
......@@ -12,7 +12,10 @@ import com.zjty.tynotes.job.basic.service.WorkTimeService;
import com.zjty.tynotes.job.common.Action;
import com.zjty.tynotes.job.common.constant.WorkStatus;
import com.zjty.tynotes.job.status.service.BusinessTreeManagement;
import com.zjty.tynotes.log.entity.Log;
import com.zjty.tynotes.log.server.LogService;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.pas.base.advise.Content;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -35,6 +38,8 @@ import static org.springframework.http.ResponseEntity.ok;
@RequestMapping("/job/work")
@Slf4j
public class WorkController {
@Autowired
private LogService logService;
@Autowired
WorkService workService;
......@@ -52,16 +57,12 @@ public class WorkController {
private BusinessTreeManagement businessTreeManagement;
@GetMapping(value = "/{workId}")
@ApiOperation(value = "根据id查询工作.", notes = "在路径中指定要查询的工作id.")
public ResponseEntity<WorkVo> findById(@PathVariable String workId) {
return ok(conversionService.workToVo(workService.findById(workId)));
}
@PostMapping(value = "/save")
@ApiOperation(value = "新增工作.", notes = "新增不可在数据中附带id.成功时返回新增数据保存的id.")
public ResponseEntity<JobResponse> add(@RequestBody WorkRo workRo) {
......@@ -74,6 +75,7 @@ public class WorkController {
}else {
businessTreeManagement.saveAction(userId,workId,Action.SAVE_WORK,new Date(),remarks);
}
logService.saveLog(new Log(null,"新增工作"+workRo.getWork().getTitle(),new Date(),userId,null));
return ok(new JobResponse(workId));
}
......@@ -86,11 +88,11 @@ public class WorkController {
Work oldWork = workService.findById(newWork.getId());
String workId = workService.modify(newWork);
businessTreeManagement.saveAction(userId,workId,Action.SAVE_PUBLISH_WORK,new Date(),remarks);
logService.saveLog(new Log(null,"发布任务"+workRo.getWork().getTitle(),new Date(),userId,null));
return ok(new JobResponse(workId));
}
@PutMapping(value = "/delete")
@ApiOperation(value = "根据id删除工作.", notes = "本次删除选择是否要把个人工作量以及任务工作量纳入统计中.")
@ApiImplicitParams({
......@@ -108,6 +110,7 @@ public class WorkController {
workService.deleteWork(workId,personalWorkload,workloadCount);
businessTreeManagement.saveAction(userId,workId,Action.DELETE_WORK,new Date(),msg);
logService.saveLog(new Log(null,"删除任务",new Date(),userId,null));
return ok(new JobResponse(workId));
}
......@@ -117,6 +120,7 @@ public class WorkController {
workService.updateWorkCrew(updateCrew.getWorkId(),updateCrew.getUsers(),updateCrew.getWorkload());
businessTreeManagement.saveAction(updateCrew.getUserid(),updateCrew.getWorkId(),Action.UPDATE_WORK_CREW,new Date(),updateCrew.getMsg());
logService.saveLog(new Log(null,"修改任务的组员",new Date(),updateCrew.getUserid(),null));
return ok(new JobResponse(updateCrew.getWorkId()));
}
......@@ -126,11 +130,10 @@ public class WorkController {
workService.updateWorkload(updateWorkload.getWorkId(),updateWorkload.getWorkload(),updateWorkload.getWorkCoefficient());
businessTreeManagement.saveAction(updateWorkload.getUserId(),updateWorkload.getWorkId(),Action.UPDATE_WORKLOAD,new Date(),updateWorkload.getMsg());
logService.saveLog(new Log(null,"修改任务的工作量",new Date(),updateWorkload.getUserId(),null));
return ok(new JobResponse(updateWorkload.getWorkId()));
}
@PutMapping(value = "/status")
@ApiOperation(value = "修改工作状态")
@ApiImplicitParams({
......@@ -154,25 +157,30 @@ public class WorkController {
//撤回
workService.alterTaskStatus1(workId,status,userId);
businessTreeManagement.saveAction(userId,workId,Action.COMMIT_BACK_WORK,new Date(),msg);
logService.saveLog(new Log(null,"撤回任务",new Date(),userId,null));
}else{
workService.alterTaskStatus(workId,status,userId);
businessTreeManagement.saveAction(userId,workId,Action.BACK_WORK,new Date(),msg);
//审核不通过
logService.saveLog(new Log(null,"审核任务",new Date(),userId,null));
}
break;
case "audit":
//执行者提交
workService.alterTaskStatus(workId, status,userId);
businessTreeManagement.saveAction(userId, workId, Action.COMMIT_WORK, new Date(), msg);
logService.saveLog(new Log(null,"提交任务",new Date(),userId,null));
break;
case "review":
//审核通过
workService.alterTaskStatus(workId, status,userId);
businessTreeManagement.saveAction(userId, workId, Action.FINISH_WORK, new Date(), msg);
logService.saveLog(new Log(null,"审核任务",new Date(),userId,null));
break;
case WorkStatus.FINISHED:
workService.alterTaskStatus(workId, status,userId);
businessTreeManagement.saveAction(userId, workId, Action.FINISHED_WORK, new Date(), msg);
logService.saveLog(new Log(null,"完结任务",new Date(),userId,null));
break;
default:
log.warn("[job] 修改任务状态传入的参数有误,传入值为:{}", status);
......
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if (mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if (mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if (!outputFile.getParentFile().exists()) {
if (!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
差异被折叠。
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>tynotes</artifactId>
<groupId>com.zjty.tynotes</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>notes-log</artifactId>
<dependencies>
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-redis</artifactId>
</dependency>
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-misc</artifactId>
</dependency>
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-search</artifactId>
</dependency>
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-sms</artifactId>
<exclusions>
<exclusion>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-log</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-pas</artifactId>
<exclusions>
<exclusion>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-log</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--<dependency>-->
<!--<groupId>com.zjty.tynotes</groupId>-->
<!--<artifactId>notes-weekly</artifactId>-->
<!--<exclusions>-->
<!--<exclusion>-->
<!--<groupId>com.zjty.tynotes</groupId>-->
<!--<artifactId>notes-log</artifactId>-->
<!--</exclusion>-->
<!--</exclusions>-->
<!--</dependency>-->
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-attendance</artifactId>
<exclusions>
<exclusion>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-log</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<!-- 关于aop的依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.zjty.tynotes.log;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan(basePackages = {
"com.zjty.tynotes.misc",
"com.zjty.tynotes.pas",
"com.zjty.tynotes.log",
"com.zjty.tynotes.search",
"com.zjty.tynotes.redis",
"com.zjty.tynotes.sms"
// "com.zjty.tynotes.weekly"
// ,"com.zjty.tynotes.attendance"
})
public class NotesLogApplication {
public static void main(String[] args) {
SpringApplication.run(NotesLogApplication.class, args);
}
}
package com.zjty.tynotes.log.base.aspect;
import com.zjty.tynotes.log.dao.LogDao;
import com.zjty.tynotes.log.entity.Log;
import com.zjty.tynotes.pas.base.advise.Content;
import com.zjty.tynotes.pas.base.advise.ContentParse;
import com.zjty.tynotes.pas.dao.PasUserDao;
import com.zjty.tynotes.pas.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.Date;
/**
* @Author gwj
* @create 2020/4/23 8:57
*/
@Aspect
@Component
@Slf4j
public class ControllerAspect {
@Autowired
private PasUserDao pasUserDao;
@Autowired
private LogDao logDao;
private final static Logger logger = LoggerFactory.getLogger(ControllerAspect.class);
/**
* 定义切点
*/
@Pointcut("execution(public * com.zjty.tynotes.pas.controller.*.*(..))")
public void privilege1(){}
// @Pointcut("execution(public * com.zjty.tynotes.job.basic.controller.*.*(..))")
// public void privilege2(){}
@Pointcut("execution(public * com.zjty.tynotes.attendance.controller.*.*(..))")
public void privilege3(){}
// @Pointcut("execution(public * com.zjty.tynotes.weekly.subject.controller.*.*(..))")
// public void privilege4(){}
/**
* 日志记录的环绕通知
* @param joinPoint
* @throws Throwable
*/
@Around("privilege1() || privilege3()")
public Object isLogMethod(ProceedingJoinPoint joinPoint) throws Throwable {
try {
// 接收到请求,记录请求内容
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
String loginSession = request.getHeader("session");
logger.info("loginSession:{}",loginSession);
//获取访问目标方法
MethodSignature methodSignature = (MethodSignature)joinPoint.getSignature();
Method targetMethod = methodSignature.getMethod();
//得到方法的功能描述,生成日志信息
final Content content = ContentParse.privilegeParse(targetMethod);
//得到方法的访问权限
// final String[] methodAccess = AccessAnnotationParse.privilegeParse(targetMethod);
if(content!=null){
String contentValue = content.value();
User user = null;
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null) {
if (authentication instanceof AnonymousAuthenticationToken) {
return null;
}
if (authentication instanceof UsernamePasswordAuthenticationToken) {
user = (User) authentication.getPrincipal();
}
}
if(authentication!=null){
String username = user.getUsername();
String description = username + "执行" + contentValue;
logger.info(description);
Log log = new Log(null,description,new Date(),null,username);
User byUsername = pasUserDao.findByUsername(username);
if(byUsername!=null){
log.setUserId(byUsername.getId());
}
logDao.save(log);
Object proceed = joinPoint.proceed();
return proceed;
}
}
}catch (Exception e){
e.printStackTrace();
logger.error("aop日志记录出现异常:{}",e.getMessage());
}
return null;
}
}
package com.zjty.tynotes.log.controller;
import com.zjty.tynotes.log.entity.Log;
import com.zjty.tynotes.log.entity.vo.LogPageRequest;
import com.zjty.tynotes.log.server.LogService;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.pas.entity.Authority;
import com.zjty.tynotes.pas.entity.vo.PageRequest;
import com.zjty.tynotes.pas.entity.vo.PageResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import static org.springframework.http.ResponseEntity.ok;
/**
* @Author gwj
* @create 2020/4/23 15:43
*/
@Api(tags = "日志管理模块",protocols = "http")
@RestController
@RequestMapping("/pas/log")
@AutoDocument
public class LogController {
@Autowired
private LogService logService;
@ApiOperation("查询日志")
@PostMapping("/findAllLogs")
public ResponseEntity findAllLogs(@RequestBody LogPageRequest pageRequest){
PageResponse<Log> logPageResponse = logService.findLogs(pageRequest);
return ok(logPageResponse);
}
}
package com.zjty.tynotes.log.dao;
import com.zjty.tynotes.log.entity.Log;
import org.springframework.data.mongodb.repository.MongoRepository;
import java.util.Date;
import java.util.List;
/**
* @Author gwj
* @create 2020/4/23 9:55
*/
public interface LogDao extends MongoRepository<Log,String> {
/**
* 根据日志生成时间查询日志
* @param date
* @return
*/
List<Log> findAllByLogTime(Date date);
/**
* 根据日志生成时间的区间段查询日志
* @param start
* @param end
* @return
*/
List<Log> findAllByLogTimeBetween(Date start,Date end);
}
package com.zjty.tynotes.log.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;
/**
* @Author gwj
* @create 2020/4/23 9:25
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "日志", description = "日志说明")
@Document(collection = "pas_log")
public class Log {
@Id
@ApiModelProperty(value = "id",example = "1")
private String id;
@ApiModelProperty(value = "日志描述",example = "进行登录")
private String description;
@ApiModelProperty(value = "生成日志时间",example = "2020-03-21 09:00:00")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date logTime;
@ApiModelProperty(value = "用户id",example = "123")
private String userId;
@ApiModelProperty(value = "用户名",example = "gwj")
private String userName;
}
package com.zjty.tynotes.log.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @Author gwj
* @create 2020/4/23 15:56
*/
@ApiModel(value = "日志请求分页类", description = "日志请求分页类")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LogPageRequest {
/**
* 每页显示个数
*/
@ApiModelProperty(value = "每页数据数量",example = "10")
private int pageSize;
/**
* 当前页数
*/
@ApiModelProperty(value = "当前页",example = "1")
private int currentPage;
/**
* 总记录数
*/
@ApiModelProperty(value = "总记录数",example = "10")
private int totalCount;
/**
* 起始时间
*/
@ApiModelProperty(value = "起始时间",example = "2020-04-01 09:00:00")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
/**
* 结束时间
*/
@ApiModelProperty(value = "结束时间",example = "2020-04-01 09:00:00")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
}
package com.zjty.tynotes.log.server;
import com.zjty.tynotes.log.entity.Log;
import com.zjty.tynotes.log.entity.vo.LogPageRequest;
import com.zjty.tynotes.pas.entity.vo.PageResponse;
/**
* @Author gwj
* @create 2020/4/23 15:00
*/
public interface LogService {
Log saveLog(Log log);
PageResponse<Log> findLogs(LogPageRequest pageRequest);
}
package com.zjty.tynotes.log.server.impl;
import com.zjty.tynotes.log.dao.LogDao;
import com.zjty.tynotes.log.entity.Log;
import com.zjty.tynotes.log.entity.vo.LogPageRequest;
import com.zjty.tynotes.log.server.LogService;
import com.zjty.tynotes.pas.dao.PasUserDao;
import com.zjty.tynotes.pas.entity.User;
import com.zjty.tynotes.pas.entity.vo.PageResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
* @Author gwj
* @create 2020/4/23 15:01
*/
@Service
public class LogServiceImpl implements LogService {
private final static Logger logger = LoggerFactory.getLogger(LogServiceImpl.class);
@Autowired
private LogDao logDao;
@Autowired
private PasUserDao pasUserDao;
@Override
public Log saveLog(Log log) {
if(log.getUserId()!=null){
String userId = log.getUserId();
Optional<User> op = pasUserDao.findById(userId);
if(op.isPresent()){
User user = op.get();
String username = user.getUsername();
log.setUserName(username);
log.setDescription(username+"执行"+log.getDescription());
Log save = logDao.save(log);
return save;
}
}
logger.error("保存进入log日志失败");
return null;
}
/**
* 分页查找日志
* @param pageRequest
* @return
*/
@Override
public PageResponse<Log> findLogs(LogPageRequest pageRequest) {
PageResponse<Log> pageResponse = new PageResponse();
List<Log> logList = new ArrayList<>();
List<Log> logs = new ArrayList<>();
if(pageRequest.getStartTime()!=null && pageRequest.getEndTime()!=null){
List<Log> logs1 = logDao.findAllByLogTime(pageRequest.getStartTime());
List<Log> logs2 = logDao.findAllByLogTimeBetween(pageRequest.getStartTime(), pageRequest.getEndTime());
List<Log> logs3 = logDao.findAllByLogTime(pageRequest.getEndTime());
if(logs1!=null){
logs.addAll(logs1);
}
if(logs2!=null){
logs.addAll(logs2);
}
if(logs3!=null){
logs.addAll(logs3);
}
}else{
List<Log> all = logDao.findAll();
if(all!=null){
logs = all;
}
}
pageResponse.setPageSize(pageRequest.getPageSize());
pageResponse.setCurrentPage(pageRequest.getCurrentPage());
int currentPage = pageRequest.getCurrentPage();
int pageSize = pageRequest.getPageSize();
int start = (currentPage-1)*pageSize;
int end = start+pageSize;
int totalPage = 0;
if((logs.size()/pageSize)==0){
totalPage = (logs.size())/pageSize;
}else{
totalPage = (logs.size())/pageSize + 1;
}
if(currentPage>=totalPage){
logList = logs.subList(start, logs.size());
pageResponse.setRows(logList);
pageResponse.setTotalCount(logs.size());
}else{
logList = logs.subList(start, end);
pageResponse.setRows(logList);
pageResponse.setTotalCount(logs.size());
}
return pageResponse;
}
}
package com.zjty.tynotes.log;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class NotesLogApplicationTests {
void contextLoads() {
}
}
......@@ -52,6 +52,12 @@
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!--springboot aop 依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>com.dingtalk</groupId>-->
<!--<artifactId>2</artifactId>-->
......
package com.zjty.tynotes.pas.base.advise;
import java.lang.annotation.*;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Content {
//访问的方法描述
String value()default "";
// 0:不记录;1:记录
String flag() default "0";
// 0:操作员;1:管理员;2:安全员;3:审计员
String[] part() default {"0"};
// 是否需要用户登录才能请求该方法,0:不需要登录;1:需要登陆
String access() default "0";
}
package com.zjty.tynotes.pas.base.advise;
import java.lang.reflect.Method;
public class ContentParse {
/***
* 解析权限注解
* @return 返回注解的authorities值
* @throws Exception
*/
public static Content privilegeParse(Method method) throws Exception {
//获取该方法
if(method.isAnnotationPresent(Content.class)){
return method.getAnnotation(Content.class);
}
return null;
}
}
......@@ -69,7 +69,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/pas/user/**",
"/pas/authority/findAuthority",
"/pas/role/**","/pas/department").hasAuthority("用户管理")
.antMatchers("/pas/authority").hasAnyAuthority("权限管理")
.antMatchers("/pas/authority","/pas/log/findAllLogs").hasAnyAuthority("权限管理")
.antMatchers("/pas/config").hasAnyAuthority("考勤管理")
.antMatchers("/pas/role").hasAnyAuthority("角色管理")
.antMatchers("/pas/department").hasAnyAuthority("部门管理")
......
package com.zjty.tynotes.pas.controller;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.pas.base.advise.Content;
import com.zjty.tynotes.pas.entity.Authority;
import com.zjty.tynotes.pas.service.IAuthorityService;
import io.swagger.annotations.Api;
......@@ -26,12 +27,14 @@ public class AuthorityController {
@Autowired
private IAuthorityService iAuthorityService;
@Content(value = "新增权限")
@ApiOperation("新增权限")
@PostMapping("/addAuthority")
public ResponseEntity addAuthority(@RequestBody Authority authority){
return ok(iAuthorityService.addAuthority(authority));
}
@Content(value = "删除权限")
@ApiOperation("删除权限")
@DeleteMapping("/deleteAuthority/{id}")
public String deleteAuthority(@PathVariable("id") String id){
......@@ -46,6 +49,7 @@ public class AuthorityController {
return "删除失败";
}
@Content(value = "修改权限")
@ApiOperation("修改权限")
@PutMapping("/updateAuthority")
public String updateAuthority(@RequestBody Authority authority){
......@@ -60,6 +64,7 @@ public class AuthorityController {
return "修改权限失败";
}
@Content(value = "查询所有权限")
@ApiOperation("查询所有权限")
@GetMapping("/findAuthority")
public ResponseEntity findAuthority(){
......
package com.zjty.tynotes.pas.controller;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.pas.base.advise.Content;
import com.zjty.tynotes.pas.entity.Authority;
import com.zjty.tynotes.pas.entity.Config;
import com.zjty.tynotes.pas.entity.Day;
......@@ -30,6 +31,7 @@ public class ConfigController {
@Autowired
private ConfigService configService;
@Content(value = "保存基础参数配置")
@ApiOperation("保存基础参数配置")
@PostMapping("/addConfig")
public ResponseEntity addConfig(@RequestBody Config config){
......@@ -49,6 +51,7 @@ public class ConfigController {
return ok(configService.findHolidays(holidayRequest));
}
@Content(value = "批量设置工作日,节假日")
@ApiOperation("批量设置工作日,节假日")
@PutMapping("/setHolidays")
public ResponseEntity setHolidays(@RequestBody List<Day> days){
......@@ -67,6 +70,7 @@ public class ConfigController {
return ok(configService.findHolidaysByMonth(date));
}
@Content(value = "清除所有节假日数据")
@ApiOperation("清除所有节假日数据")
@DeleteMapping("/deleteAll")
public ResponseEntity deleteAll(){return ok(configService.deleteAll());}
......
package com.zjty.tynotes.pas.controller;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.pas.base.advise.Content;
import com.zjty.tynotes.pas.entity.Authority;
import com.zjty.tynotes.pas.entity.Department;
import com.zjty.tynotes.pas.service.IDepartmentService;
......@@ -28,12 +29,14 @@ public class DepartController {
@Autowired
private IDepartmentService departmentService;
@ApiOperation(value = "获得所有部门",response = Department.class)
@GetMapping
public ResponseEntity departments(){
return ok(departmentService.findAll());
}
@Content(value = "添加部门")
@ApiOperation(value = "添加部门",response = Department.class)
@PostMapping
public ResponseEntity addDepartments(@RequestBody @Valid Department department){
......@@ -41,6 +44,7 @@ public class DepartController {
return ok(departmentService.addDepartments(department));
}
@Content(value = "修改部门")
@ApiOperation(value = "修改部门",response = Department.class)
@PutMapping
public ResponseEntity updateDepartments(@RequestBody @Valid Department department){
......@@ -64,6 +68,7 @@ public class DepartController {
return ok(departmentService.findList());
}
@Content(value = "删除部门")
@ApiOperation(value = "删除部门")
@DeleteMapping("/deleteDepartment/{id}")
public ResponseEntity deleteDepartment(@PathVariable("id") String id){
......
package com.zjty.tynotes.pas.controller;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.pas.base.advise.Content;
import com.zjty.tynotes.pas.entity.Authority;
import com.zjty.tynotes.pas.entity.Role;
import com.zjty.tynotes.pas.service.IRoleService;
......@@ -32,6 +33,7 @@ public class RoleController {
return ResponseEntity.ok(iRoleService.findAll());
}
@Content(value = "新增角色")
@ApiOperation(value = "新增角色",response = Role.class)
@PostMapping
public ResponseEntity addRole(@RequestBody @Valid Role role){
......@@ -45,6 +47,7 @@ public class RoleController {
// return ResponseEntity.ok(iRoleService.addRole(role));
// }
@Content(value = "删除角色")
@ApiOperation(value = "删除角色",response = Role.class)
@DeleteMapping("/deleteRole/{id}")
public String deleteRole(@PathVariable("id") String id){
......@@ -59,6 +62,7 @@ public class RoleController {
return "删除失败";
}
@Content(value = "修改角色")
@ApiOperation(value = "修改角色",response = Role.class)
@PutMapping("/updateRole")
public String updateRole(@RequestBody Role role){
......
package com.zjty.tynotes.pas.controller;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.pas.base.advise.Content;
import com.zjty.tynotes.pas.entity.User;
import com.zjty.tynotes.pas.entity.vo.PageRequest;
import com.zjty.tynotes.pas.service.IUserService;
......@@ -37,6 +38,7 @@ public class UserController {
@Autowired
IUserService iUserService;
@ApiOperation(value = "查询所有用户", response = User.class)
@GetMapping
public ResponseEntity user() {
......@@ -52,12 +54,14 @@ public class UserController {
}
@Content(value = "用户登出")
@ApiOperation(value = "用户登出")
@GetMapping("/userLogout")
public void logout() {
logoutUtil.logout();
}
@Content(value = "删除用户")
@ApiOperation(value = "删除用户")
@DeleteMapping("/delete/{id}")
public ResponseEntity delete(@PathVariable @NotNull String id) {
......@@ -65,6 +69,7 @@ public class UserController {
return ok().build();
}
@Content(value = "更新任意用户信息")
@ApiOperation(value = "更新任意用户信息")
@PutMapping
public ResponseEntity update(@RequestBody @NotNull User user) {
......@@ -94,6 +99,7 @@ public class UserController {
// return ok(iUserService.updateUser(userByUsername));
// }
@Content(value = "新增用户")
@ApiOperation(value = "新增用户", response = User.class)
@PostMapping
public ResponseEntity addUser(@RequestBody @Valid User user) {
......
......@@ -10,8 +10,8 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>notes-union</artifactId>
<packaging>jar</packaging>
<!--<packaging>jar</packaging>-->
<packaging>war</packaging>
<profiles>
<!--模拟环境-->
<profile>
......@@ -33,6 +33,29 @@
<dependencies>
<!-- 排除内置的tomcat -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 使用自带的tomcat -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!--打包的时候可以不用包进去,别的设施会提供。事实上该依赖理论上可以参与编译,测试,运行等周期。
相当于compile,但是打包阶段做了exclude操作-->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-weekly</artifactId>
......@@ -78,6 +101,11 @@
<artifactId>notes-attendance</artifactId>
</dependency>
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-log</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......
package com.zjty.tynotes.union;
import javafx.application.Application;
import org.apache.catalina.connector.Connector;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
......@@ -23,12 +26,19 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
"com.zjty.tynotes.redis",
"com.zjty.tynotes.weekly",
"com.zjty.tynotes.misc",
"com.zjty.tynotes.union"
"com.zjty.tynotes.union",
"com.zjty.tynotes.log"
// , "com.zjty.tynotes.attendance"
})
@EnableCaching
@EnableScheduling
public class UnionApplication {
public class UnionApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(UnionApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(UnionApplication.class, args);
}
......
......@@ -12,15 +12,15 @@ server.ssl.keyStoreType=PKCS12
server.ssl.keyAlias= alias
#mongodb configuration
spring.data.mongodb.uri=mongodb://192.168.1.246:27017/notes5
spring.data.mongodb.uri=mongodb://localhost:27017/notes5
# servlet configuration
spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=1000MB
spring.redis.host=192.168.1.246
spring.redis.host=localhost
spring.redis.port=6379
spring.redis.timeout=5000ms
# es configuraiton
es.ip=192.168.1.246
es.ip=localhost
logging.file=./log/note.log
package com.zjty.tynotes.weekly.subject.controller;
import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.pas.base.advise.Content;
import com.zjty.tynotes.pas.entity.User;
import com.zjty.tynotes.pas.entity.vo.PageRequest;
import com.zjty.tynotes.pas.entity.vo.PageResponse;
......@@ -73,6 +74,7 @@ public class UserManageController {
// return ok(userManageService.findUserWork(id,status));
// }
@Content(value = "更新当前用户自身信息")
@ApiOperation(value = "更新当前用户自身信息")
@PutMapping("/updateSelf")
public ResponseEntity updateSelf(@RequestBody @NotNull User user){
......@@ -86,6 +88,7 @@ public class UserManageController {
return ok("更改当前用户信息失败");
}
@Content(value = "更新当前用户密码")
@ApiOperation(value = "更新当前用户密码")
@PutMapping("/password")
public ResponseEntity updatePassword(@RequestBody @NotNull User user){
......
......@@ -38,6 +38,7 @@
<module>notes-redis</module>
<module>notes-weekly</module>
<module>notes-attendance</module>
<module>notes-log</module>
</modules>
<dependencyManagement>
......@@ -97,6 +98,12 @@
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-log</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论