新增部分内容
This commit is contained in:
parent
99441e06be
commit
c4dfc7ea85
@ -29,4 +29,9 @@ public interface IApiConsts {
|
||||
*/
|
||||
String LIST_USER_BY_ID = "%s/resource/user/listuserbyids";
|
||||
|
||||
/**
|
||||
* 全部用户
|
||||
*/
|
||||
String LIST_ALL_USER = "%s/resource/user/listalluser";
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.cm.common.plugin.oauth.controller.apis.department;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.AccessTokenException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.plugin.oauth.service.department.IDepartmentService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -33,7 +34,7 @@ public class DepartmentController extends AbstractController {
|
||||
private IDepartmentService departmentService;
|
||||
|
||||
@GetMapping("listdepartments")
|
||||
public JSONArray listDepartments() throws SearchException {
|
||||
public JSONArray listDepartments() throws SearchException, AccessTokenException {
|
||||
Map<String, Object> params = requestParams();
|
||||
String parentId = "0";
|
||||
if (!StringUtils.isBlank(params.get("id") == null ? null : params.get("id").toString())) {
|
||||
|
@ -3,6 +3,7 @@ package com.cm.common.plugin.oauth.controller.apis.menu;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.AccessTokenException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.plugin.oauth.service.menu.IMenuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -27,7 +28,7 @@ public class MenuController extends AbstractController {
|
||||
private IMenuService menuService;
|
||||
|
||||
@GetMapping("listmenu")
|
||||
public JSONArray listMenu() throws SearchException {
|
||||
public JSONArray listMenu() throws AccessTokenException {
|
||||
Map<String, Object> params = requestParams();
|
||||
return menuService.listMenu(params);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.cm.common.plugin.oauth.controller.apis.user;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.AccessTokenException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.plugin.oauth.service.user.IUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -35,7 +36,7 @@ public class UserController extends AbstractController {
|
||||
* @throws SearchException
|
||||
*/
|
||||
@GetMapping("listdepartmentusers/{departmentId}")
|
||||
public JSONArray listDepartmentUsers(@PathVariable("departmentId") String departmentId) throws SearchException {
|
||||
public JSONArray listDepartmentUsers(@PathVariable("departmentId") String departmentId) throws AccessTokenException {
|
||||
Map<String, Object> params = getParams();
|
||||
params.put("departmentId", departmentId);
|
||||
return userService.listDepartmentUsers(params);
|
||||
@ -46,13 +47,24 @@ public class UserController extends AbstractController {
|
||||
*
|
||||
* @param userIds
|
||||
* @return
|
||||
* @throws SearchException
|
||||
* @throws AccessTokenException
|
||||
*/
|
||||
@GetMapping("listuserbyids/{userIds}")
|
||||
public JSONArray listUserByIds(@PathVariable("userIds") String userIds) throws SearchException {
|
||||
public JSONArray listUserByIds(@PathVariable("userIds") String userIds) throws AccessTokenException {
|
||||
Map<String, Object> params = getParams();
|
||||
params.put("userIds", userIds);
|
||||
return userService.listUserByIds(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 全部用户
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("listallusers")
|
||||
public JSONArray listAllUsers() throws AccessTokenException {
|
||||
Map<String, Object> params = getParams();
|
||||
return userService.listAllUsers(params);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.cm.common.plugin.oauth.service.department;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.cm.common.exception.AccessTokenException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
|
||||
import java.util.Map;
|
||||
@ -24,6 +25,6 @@ public interface IDepartmentService {
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
JSONArray listDepartments(Map<String, Object> params) throws SearchException;
|
||||
JSONArray listDepartments(Map<String, Object> params) throws AccessTokenException, AccessTokenException;
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.cm.common.plugin.oauth.service.department.impl;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.cm.common.base.AbstractService;
|
||||
import com.cm.common.config.properties.ApiPathProperties;
|
||||
import com.cm.common.exception.AccessTokenException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.plugin.IApiConsts;
|
||||
import com.cm.common.plugin.oauth.service.department.IDepartmentService;
|
||||
@ -32,10 +33,10 @@ public class DepartmentServiceImpl extends AbstractService implements IDepartmen
|
||||
private ApiPathProperties apiPathProperties;
|
||||
|
||||
@Override
|
||||
public JSONArray listDepartments(Map<String, Object> params) throws SearchException {
|
||||
public JSONArray listDepartments(Map<String, Object> params) throws AccessTokenException {
|
||||
String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_DEPARTMENT, apiPathProperties.getUserCenter(), params.get("parentId").toString()), params);
|
||||
if (StringUtils.isBlank(result)) {
|
||||
throw new SearchException("获取组织部门列表失败");
|
||||
throw new AccessTokenException("获取组织部门列表失败");
|
||||
}
|
||||
return JSONArray.parseArray(result);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.cm.common.plugin.oauth.service.menu;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.cm.common.exception.AccessTokenException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
|
||||
import java.util.Map;
|
||||
@ -21,6 +22,6 @@ public interface IMenuService {
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
JSONArray listMenu(Map<String, Object> params) throws SearchException;
|
||||
JSONArray listMenu(Map<String, Object> params) throws AccessTokenException, AccessTokenException;
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cm.common.base.AbstractService;
|
||||
import com.cm.common.config.properties.ApiPathProperties;
|
||||
import com.cm.common.exception.AccessTokenException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.plugin.IApiConsts;
|
||||
import com.cm.common.plugin.oauth.service.menu.IMenuService;
|
||||
@ -33,10 +34,10 @@ public class MenuServiceImpl extends AbstractService implements IMenuService {
|
||||
private ApiPathProperties apiPathProperties;
|
||||
|
||||
@Override
|
||||
public JSONArray listMenu(Map<String, Object> params) throws SearchException {
|
||||
public JSONArray listMenu(Map<String, Object> params) throws AccessTokenException {
|
||||
String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_MENU, apiPathProperties.getUserCenter(), oAuth2ClientProperties.getClientId()), params);
|
||||
if (StringUtils.isBlank(result)) {
|
||||
throw new SearchException("获取列表失败");
|
||||
throw new AccessTokenException("获取列表失败");
|
||||
}
|
||||
JSONObject resultObj = JSONObject.parseObject(result);
|
||||
return resultObj.getJSONArray("data");
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.cm.common.plugin.oauth.service.user;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.cm.common.exception.AccessTokenException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
|
||||
import java.util.Map;
|
||||
@ -23,7 +24,7 @@ public interface IUserService {
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
JSONArray listDepartmentUsers(Map<String, Object> params) throws SearchException;
|
||||
JSONArray listDepartmentUsers(Map<String, Object> params) throws AccessTokenException;
|
||||
|
||||
/**
|
||||
* 通过id列表获取用户ID
|
||||
@ -32,5 +33,14 @@ public interface IUserService {
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
JSONArray listUserByIds(Map<String, Object> params) throws SearchException;
|
||||
JSONArray listUserByIds(Map<String, Object> params) throws AccessTokenException;
|
||||
|
||||
/**
|
||||
* 全部用户
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
JSONArray listAllUsers(Map<String, Object> params) throws AccessTokenException;
|
||||
}
|
||||
|
@ -3,7 +3,9 @@ package com.cm.common.plugin.oauth.service.user.impl;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.cm.common.base.AbstractService;
|
||||
import com.cm.common.config.properties.ApiPathProperties;
|
||||
import com.cm.common.exception.AccessTokenException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.exception.TokenException;
|
||||
import com.cm.common.plugin.IApiConsts;
|
||||
import com.cm.common.plugin.oauth.service.user.IUserService;
|
||||
import com.cm.common.plugin.utils.RestTemplateUtil;
|
||||
@ -32,19 +34,28 @@ public class UserServiceImpl extends AbstractService implements IUserService {
|
||||
private ApiPathProperties apiPathProperties;
|
||||
|
||||
@Override
|
||||
public JSONArray listDepartmentUsers(Map<String, Object> params) throws SearchException {
|
||||
public JSONArray listDepartmentUsers(Map<String, Object> params) throws AccessTokenException {
|
||||
String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_DEPARTMENT_USER, apiPathProperties.getUserCenter(), params.get("departmentId").toString()), params);
|
||||
if (StringUtils.isBlank(result)) {
|
||||
throw new SearchException("获取人员列表失败");
|
||||
throw new AccessTokenException("获取人员列表失败");
|
||||
}
|
||||
return JSONArray.parseArray(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray listUserByIds(Map<String, Object> params) throws SearchException {
|
||||
public JSONArray listUserByIds(Map<String, Object> params) throws AccessTokenException {
|
||||
String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_USER_BY_ID, apiPathProperties.getUserCenter()), params);
|
||||
if (StringUtils.isBlank(result)) {
|
||||
throw new SearchException("获取人员列表失败");
|
||||
throw new AccessTokenException("获取人员列表失败");
|
||||
}
|
||||
return JSONArray.parseArray(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray listAllUsers(Map<String, Object> params) throws AccessTokenException {
|
||||
String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_ALL_USER, apiPathProperties.getUserCenter()), params);
|
||||
if (StringUtils.isBlank(result)) {
|
||||
throw new AccessTokenException("获取全部人员列表失败");
|
||||
}
|
||||
return JSONArray.parseArray(result);
|
||||
}
|
||||
|
@ -6,7 +6,9 @@ import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.enums.UploadTypeEnum;
|
||||
import com.cm.common.exception.base.SystemException;
|
||||
import com.cm.common.plugin.service.file.IFileService;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.result.SuccessResultData;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -25,6 +27,7 @@ import java.util.Map;
|
||||
* @Date: 2019/3/10 7:03 PM
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "文件管理接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/file")
|
||||
public class FileController extends AbstractController {
|
||||
@ -32,49 +35,44 @@ public class FileController extends AbstractController {
|
||||
@Autowired
|
||||
private IFileService fileService;
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "上传文件", notes = "上传文件接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "file", value = "文件name", paramType = "form")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("uploadfile")
|
||||
public SuccessResultData<String> uploadFile(@RequestParam("file") MultipartFile file) throws SystemException {
|
||||
Map<String, Object> params = requestParams();
|
||||
return uploadSingle(file, UploadTypeEnum.FILE, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传图片
|
||||
*
|
||||
* @param image
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "上传图片", notes = "上传图片接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "image", value = "文件name", paramType = "form")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("uploadimage")
|
||||
public SuccessResultData<String> uploadImage(@RequestParam("image") MultipartFile image) throws SystemException {
|
||||
Map<String, Object> params = requestParams();
|
||||
return uploadSingle(image, UploadTypeEnum.IMAGE, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传视频
|
||||
*
|
||||
* @param video
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "上传视频", notes = "上传视频接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "video", value = "文件video", paramType = "form")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("uploadvideo")
|
||||
public SuccessResultData<String> uploadVideo(@RequestParam("video") MultipartFile video) throws SystemException {
|
||||
Map<String, Object> params = requestParams();
|
||||
return uploadSingle(video, UploadTypeEnum.VIDEO, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传音频
|
||||
*
|
||||
* @param audio
|
||||
* @return
|
||||
* @throws SystemException
|
||||
*/
|
||||
@ApiOperation(value = "上传音频", notes = "上传音频接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "audio", value = "文件audio", paramType = "form")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("uploadaudio")
|
||||
public SuccessResultData<String> uploadAudio(@RequestParam("audio") MultipartFile audio) throws SystemException {
|
||||
Map<String, Object> params = requestParams();
|
||||
|
@ -5,7 +5,9 @@ import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.enums.UploadTypeEnum;
|
||||
import com.cm.common.exception.base.SystemException;
|
||||
import com.cm.common.plugin.service.file.IFileService;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.result.SuccessResultData;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@ -22,6 +24,7 @@ import java.util.Map;
|
||||
* @Date: 2019-08-02 15:38
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "文件管理接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.APP_PREFIX + "/file")
|
||||
public class FileAppController extends AbstractController {
|
||||
@ -29,49 +32,48 @@ public class FileAppController extends AbstractController {
|
||||
@Autowired
|
||||
private IFileService fileService;
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "上传文件", notes = "上传文件接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
@ApiImplicitParam(name = "file", value = "文件name", paramType = "form")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("uploadfile")
|
||||
public SuccessResultData<String> uploadFile(@RequestHeader("token") String token, @RequestParam("file") MultipartFile file) throws SystemException {
|
||||
Map<String, Object> params = requestParams();
|
||||
return uploadSingle(token, file, UploadTypeEnum.FILE, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传图片
|
||||
*
|
||||
* @param image
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "上传图片", notes = "上传图片接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
@ApiImplicitParam(name = "image", value = "文件name", paramType = "form")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("uploadimage")
|
||||
public SuccessResultData<String> uploadImage(@RequestHeader("token") String token, @RequestParam("image") MultipartFile image) throws SystemException {
|
||||
Map<String, Object> params = requestParams();
|
||||
return uploadSingle(token, image, UploadTypeEnum.IMAGE, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传视频
|
||||
*
|
||||
* @param video
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "上传视频", notes = "上传视频接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
@ApiImplicitParam(name = "video", value = "文件video", paramType = "form")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("uploadvideo")
|
||||
public SuccessResultData<String> uploadVideo(@RequestHeader("token") String token, @RequestParam("video") MultipartFile video) throws SystemException {
|
||||
Map<String, Object> params = requestParams();
|
||||
return uploadSingle(token, video, UploadTypeEnum.VIDEO, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传音频
|
||||
*
|
||||
* @param audio
|
||||
* @return
|
||||
* @throws SystemException
|
||||
*/
|
||||
@ApiOperation(value = "上传音频", notes = "上传音频接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
@ApiImplicitParam(name = "audio", value = "文件audio", paramType = "form")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("uploadaudio")
|
||||
public SuccessResultData<String> uploadAudio(@RequestHeader("token") String token, @RequestParam("audio") MultipartFile audio) throws SystemException {
|
||||
Map<String, Object> params = requestParams();
|
||||
|
@ -6,6 +6,8 @@ import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.ParamsException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.plugin.service.file.IFileService;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -24,6 +26,7 @@ import java.util.Map;
|
||||
* @Date: 2019/3/11 2:45 PM
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "文件管理接口")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/file")
|
||||
public class FileRouteController extends AbstractController {
|
||||
@ -33,12 +36,12 @@ public class FileRouteController extends AbstractController {
|
||||
@Autowired
|
||||
private FileProperties fileProperties;
|
||||
|
||||
/**
|
||||
* 打开文件上传
|
||||
*
|
||||
* @param uploadType
|
||||
* @return
|
||||
*/
|
||||
|
||||
@ApiOperation(value = "打开文件上传", notes = "打开文件上传接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "uploadType", value = "文件类型,1:文件,2:图片,3:视频,4:音频", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("uploadfile/{uploadType}")
|
||||
public ModelAndView uploadFile(@PathVariable("uploadType") String uploadType) throws ParamsException {
|
||||
ModelAndView mv = new ModelAndView("file/file-upload");
|
||||
@ -90,14 +93,12 @@ public class FileRouteController extends AbstractController {
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*
|
||||
* @param response
|
||||
* @param isOpen
|
||||
* @param fileId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "下载文件", notes = "下载文件接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "isOpen", value = "是否打开,true和false", paramType = "path"),
|
||||
@ApiImplicitParam(name = "fileId", value = "文件ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("downloadfile/{isOpen}/{fileId}")
|
||||
public void downLoadFile(HttpServletResponse response, @PathVariable("isOpen") String isOpen, @PathVariable("fileId") String fileId) throws ParamsException, SearchException {
|
||||
if (!ISystemConstant.IS_TRUE.equals(isOpen) && !ISystemConstant.IS_FALSE.equals(isOpen)) {
|
||||
|
@ -48,6 +48,8 @@ public class ResponseAdvice {
|
||||
result.setCode(ErrorResultCodeEnum.PARAMS_ERROR.getValue());
|
||||
} else if (e instanceof FileException) {
|
||||
result.setCode(ErrorResultCodeEnum.FILE_ERROR.getValue());
|
||||
} else if(e instanceof AccessTokenException) {
|
||||
response.setStatus(HttpStatus.UNAUTHORIZED.value());
|
||||
}
|
||||
// 自定义提示信息
|
||||
if (e instanceof SystemException) {
|
||||
|
@ -0,0 +1,34 @@
|
||||
package com.cm.common.exception;
|
||||
|
||||
import com.cm.common.exception.base.SystemException;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: AccessTokenException
|
||||
* @Description: accessToken异常
|
||||
* @Author: WangGeng
|
||||
* @Date: 2019-08-15 18:00
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public class AccessTokenException extends SystemException {
|
||||
public AccessTokenException() {
|
||||
}
|
||||
|
||||
public AccessTokenException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public AccessTokenException(String message, boolean withMsg) {
|
||||
super(message, withMsg);
|
||||
}
|
||||
|
||||
public AccessTokenException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public AccessTokenException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
@ -14,6 +14,8 @@ import java.util.Date;
|
||||
*/
|
||||
public class DateUtil {
|
||||
|
||||
public final static String AM = "AM";
|
||||
public final static String PM = "PM";
|
||||
private final static SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy");
|
||||
private final static SimpleDateFormat sdfMonth = new SimpleDateFormat("MM");
|
||||
private final static SimpleDateFormat sdfd = new SimpleDateFormat("dd");
|
||||
@ -353,7 +355,6 @@ public class DateUtil {
|
||||
/**
|
||||
* 获取本月结束日期
|
||||
*
|
||||
* @param pattern
|
||||
* @return
|
||||
*/
|
||||
public static Date monthEndDate() {
|
||||
@ -430,4 +431,18 @@ public class DateUtil {
|
||||
}
|
||||
return age;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得上下午标识
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getAmPm() {
|
||||
DateTime dateTime = new DateTime();
|
||||
int hour = dateTime.getHourOfDay();
|
||||
if (hour < 13) {
|
||||
return AM;
|
||||
}
|
||||
return PM;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user