【fix sonar】返回对象与属性重名修改
This commit is contained in:
+16
-16
@@ -15,7 +15,7 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="接口返回对象", description="接口返回对象")
|
||||
public class Result<T> implements Serializable {
|
||||
public class Results<T> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -49,36 +49,36 @@ public class Result<T> implements Serializable {
|
||||
@ApiModelProperty(value = "时间戳")
|
||||
private long timestamp = System.currentTimeMillis();
|
||||
|
||||
public Result() {
|
||||
public Results() {
|
||||
// do other
|
||||
}
|
||||
|
||||
public static<T> Result<T> OK() {
|
||||
Result<T> r = new Result<>();
|
||||
public static<T> Results<T> OK() {
|
||||
Results<T> r = new Results<>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setMessage("成功");
|
||||
return r;
|
||||
}
|
||||
|
||||
public static<T> Result<T> OK(String message) {
|
||||
Result<T> r = new Result<>();
|
||||
public static<T> Results<T> OK(String message) {
|
||||
Results<T> r = new Results<>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setMessage(message);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static<T> Result<T> OK(T data) {
|
||||
Result<T> r = new Result<>();
|
||||
public static<T> Results<T> OK(T data) {
|
||||
Results<T> r = new Results<>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setResult(data);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static<T> Result<T> OK(String msg, T data) {
|
||||
Result<T> r = new Result<>();
|
||||
public static<T> Results<T> OK(String msg, T data) {
|
||||
Results<T> r = new Results<>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setMessage(msg);
|
||||
@@ -86,8 +86,8 @@ public class Result<T> implements Serializable {
|
||||
return r;
|
||||
}
|
||||
|
||||
public static<T> Result<T> error(String msg, T data) {
|
||||
Result<T> r = new Result<>();
|
||||
public static<T> Results<T> error(String msg, T data) {
|
||||
Results<T> r = new Results<>();
|
||||
r.setSuccess(false);
|
||||
r.setCode(CommonConstant.SC_INTERNAL_SERVER_ERROR_500);
|
||||
r.setMessage(msg);
|
||||
@@ -95,12 +95,12 @@ public class Result<T> implements Serializable {
|
||||
return r;
|
||||
}
|
||||
|
||||
public static<T> Result<T> error(String msg) {
|
||||
public static<T> Results<T> error(String msg) {
|
||||
return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
|
||||
}
|
||||
|
||||
public static<T> Result<T> error(int code, String msg) {
|
||||
Result<T> r = new Result<>();
|
||||
public static<T> Results<T> error(int code, String msg) {
|
||||
Results<T> r = new Results<>();
|
||||
r.setCode(code);
|
||||
r.setMessage(msg);
|
||||
r.setSuccess(false);
|
||||
@@ -110,7 +110,7 @@ public class Result<T> implements Serializable {
|
||||
/**
|
||||
* 无权限访问返回结果
|
||||
*/
|
||||
public static Result<Object> noauth(String msg) {
|
||||
public static Results<Object> noauth(String msg) {
|
||||
return error(CommonConstant.SC_JERO_NO_AUTHZ, msg);
|
||||
}
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@ package com.jero.common.aspect;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.PropertyFilter;
|
||||
import com.jero.common.api.dto.LogDTO;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.constant.enums.ModuleType;
|
||||
@@ -198,8 +198,8 @@ public class AutoLogAspect {
|
||||
* @return
|
||||
*/
|
||||
private String getOnlineLogContent(Object obj, String content){
|
||||
if (obj instanceof Result){
|
||||
Result<T> res = (Result)obj;
|
||||
if (obj instanceof Results){
|
||||
Results<T> res = (Results)obj;
|
||||
String msg = res.getMessage();
|
||||
String tableName = res.getOnlTable();
|
||||
if(oConvertUtils.isNotEmpty(tableName)){
|
||||
|
||||
+5
-5
@@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.jero.common.api.CommonAPI;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.vo.DictModel;
|
||||
@@ -89,7 +89,7 @@ public class DictAspect {
|
||||
* @param result
|
||||
*/
|
||||
private void parseDictText(Object result) {
|
||||
if (result instanceof Result && ((Result) result).getResult() instanceof IPage) {
|
||||
if (result instanceof Results && ((Results) result).getResult() instanceof IPage) {
|
||||
List<JSONObject> items = new ArrayList<>();
|
||||
|
||||
//step.1 筛选出加了 Dict 注解的字段列表
|
||||
@@ -97,7 +97,7 @@ public class DictAspect {
|
||||
// 字典数据列表, key = 字典code,value=数据列表
|
||||
Map<String, List<String>> dataListMap = new HashMap<>();
|
||||
|
||||
addItems((Result) result, items, dictFieldList, dataListMap);
|
||||
addItems((Results) result, items, dictFieldList, dataListMap);
|
||||
|
||||
//step.2 调用翻译方法,一次性翻译
|
||||
Map<String, List<DictModel>> translText = this.translateAllDict(dataListMap);
|
||||
@@ -105,7 +105,7 @@ public class DictAspect {
|
||||
//step.3 将翻译结果填充到返回结果里
|
||||
putItems(items, dictFieldList, translText);
|
||||
|
||||
((IPage) ((Result) result).getResult()).setRecords(items);
|
||||
((IPage) ((Results) result).getResult()).setRecords(items);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public class DictAspect {
|
||||
}
|
||||
}
|
||||
|
||||
private void addItems(Result<IPage<T>> result, List<JSONObject> items, List<Field> dictFieldList, Map<String, List<String>> dataListMap) {
|
||||
private void addItems(Results<IPage<T>> result, List<JSONObject> items, List<Field> dictFieldList, Map<String, List<String>> dataListMap) {
|
||||
for (Object obj : result.getResult().getRecords()) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String json="{}";
|
||||
|
||||
+19
-19
@@ -1,6 +1,6 @@
|
||||
package com.jero.common.exception;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.shiro.authz.AuthorizationException;
|
||||
@@ -28,33 +28,33 @@ public class JeroBootExceptionHandler {
|
||||
* 处理自定义异常
|
||||
*/
|
||||
@ExceptionHandler(JeroBootException.class)
|
||||
public Result<T> handleJeroBootException(JeroBootException e){
|
||||
public Results<T> handleJeroBootException(JeroBootException e){
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
return Results.error(e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(NoHandlerFoundException.class)
|
||||
public Result<T> handlerNoFoundException(Exception e) {
|
||||
public Results<T> handlerNoFoundException(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(404, "路径不存在,请检查路径是否正确");
|
||||
return Results.error(404, "路径不存在,请检查路径是否正确");
|
||||
}
|
||||
|
||||
@ExceptionHandler(DuplicateKeyException.class)
|
||||
public Result<T> handleDuplicateKeyException(DuplicateKeyException e){
|
||||
public Results<T> handleDuplicateKeyException(DuplicateKeyException e){
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("数据库中已存在该记录");
|
||||
return Results.error("数据库中已存在该记录");
|
||||
}
|
||||
|
||||
@ExceptionHandler({UnauthorizedException.class, AuthorizationException.class})
|
||||
public Result<Object> handleAuthorizationException(AuthorizationException e){
|
||||
public Results<Object> handleAuthorizationException(AuthorizationException e){
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.noauth("没有权限,请联系管理员授权");
|
||||
return Results.noauth("没有权限,请联系管理员授权");
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public Result<T> handleException(Exception e){
|
||||
public Results<T> handleException(Exception e){
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败,"+e.getMessage());
|
||||
return Results.error("操作失败,"+e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ public class JeroBootExceptionHandler {
|
||||
* @return
|
||||
*/
|
||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||
public Result<T> httpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e){
|
||||
public Results<T> httpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("不支持");
|
||||
sb.append(e.getMethod());
|
||||
@@ -77,28 +77,28 @@ public class JeroBootExceptionHandler {
|
||||
}
|
||||
}
|
||||
log.error(sb.toString(), e);
|
||||
return Result.error(405,sb.toString());
|
||||
return Results.error(405,sb.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* spring默认上传大小100MB 超出大小捕获异常MaxUploadSizeExceededException
|
||||
*/
|
||||
@ExceptionHandler(MaxUploadSizeExceededException.class)
|
||||
public Result<T> handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e) {
|
||||
public Results<T> handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("文件大小超出10MB限制, 请压缩或降低文件质量! ");
|
||||
return Results.error("文件大小超出10MB限制, 请压缩或降低文件质量! ");
|
||||
}
|
||||
|
||||
@ExceptionHandler(DataIntegrityViolationException.class)
|
||||
public Result<T> handleDataIntegrityViolationException(DataIntegrityViolationException e) {
|
||||
public Results<T> handleDataIntegrityViolationException(DataIntegrityViolationException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("字段太长,超出数据库字段的长度");
|
||||
return Results.error("字段太长,超出数据库字段的长度");
|
||||
}
|
||||
|
||||
@ExceptionHandler(PoolException.class)
|
||||
public Result<T> handlePoolException(PoolException e) {
|
||||
public Results<T> handlePoolException(PoolException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("Redis 连接异常!");
|
||||
return Results.error("Redis 连接异常!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-5
@@ -4,7 +4,7 @@ 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.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
@@ -162,7 +162,7 @@ public class JeroController<T, S extends IService<T>> {
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
protected Result<T> importExcel(HttpServletRequest request,HttpServletResponse response, Class<T> clazz) {
|
||||
protected Results<T> importExcel(HttpServletRequest request, HttpServletResponse response, Class<T> clazz) {
|
||||
if(Objects.isNull(response)){
|
||||
log.info("打印未使用参数");
|
||||
}
|
||||
@@ -184,10 +184,10 @@ public class JeroController<T, S extends IService<T>> {
|
||||
//1200条 saveBatch消耗时间3687毫秒 循环插入消耗时间5212毫秒
|
||||
log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒");
|
||||
//update-end-author:taoyan date:20190528 for:批量插入数据
|
||||
return Result.OK("文件导入成功!数据行数:" + list.size());
|
||||
return Results.OK("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
return Results.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
@@ -196,6 +196,6 @@ public class JeroController<T, S extends IService<T>> {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
return Results.error("文件导入失败!");
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@ package com.jero.common.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -19,9 +19,9 @@ public class ImportExcelUtil {
|
||||
|
||||
}
|
||||
|
||||
public static Result<JSONObject> imporReturnRes(int errorLines, int successLines, List<String> errorMessage){
|
||||
public static Results<JSONObject> imporReturnRes(int errorLines, int successLines, List<String> errorMessage){
|
||||
if (errorLines == 0) {
|
||||
return Result.OK("共" + successLines + "行数据全部导入成功!");
|
||||
return Results.OK("共" + successLines + "行数据全部导入成功!");
|
||||
} else {
|
||||
JSONObject result = new JSONObject(5);
|
||||
int totalCount = successLines + errorLines;
|
||||
@@ -34,7 +34,7 @@ public class ImportExcelUtil {
|
||||
String fileName = fileUrl.substring(lastIndex + 1);
|
||||
result.put("fileUrl", "/sys/common/static/" + fileUrl);
|
||||
result.put("fileName", fileName);
|
||||
Result<JSONObject> res = Result.OK(result);
|
||||
Results<JSONObject> res = Results.OK(result);
|
||||
res.setCode(201);
|
||||
res.setMessage("文件导入成功,但有错误。");
|
||||
return res;
|
||||
|
||||
+9
-9
@@ -1,7 +1,7 @@
|
||||
package com.jero.common.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
@@ -37,7 +37,7 @@ public class RestDesformUtil {
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public static Result<T> queryOne(String desformCode, String dataId, String token) {
|
||||
public static Results<T> queryOne(String desformCode, String dataId, String token) {
|
||||
String url = getBaseUrl(desformCode, dataId).toString();
|
||||
HttpHeaders headers = getHeaders(token);
|
||||
ResponseEntity<JSONObject> result = RestUtil.request(url, HttpMethod.GET, headers, null, null, JSONObject.class);
|
||||
@@ -52,7 +52,7 @@ public class RestDesformUtil {
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public static Result<T> addOne(String desformCode, JSONObject formData, String token) {
|
||||
public static Results<T> addOne(String desformCode, JSONObject formData, String token) {
|
||||
return addOrEditOne(desformCode, formData, token, HttpMethod.POST);
|
||||
}
|
||||
|
||||
@@ -64,11 +64,11 @@ public class RestDesformUtil {
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public static Result<T> editOne(String desformCode, JSONObject formData, String token) {
|
||||
public static Results<T> editOne(String desformCode, JSONObject formData, String token) {
|
||||
return addOrEditOne(desformCode, formData, token, HttpMethod.PUT);
|
||||
}
|
||||
|
||||
private static Result<T> addOrEditOne(String desformCode, JSONObject formData, String token, HttpMethod method) {
|
||||
private static Results<T> addOrEditOne(String desformCode, JSONObject formData, String token, HttpMethod method) {
|
||||
String url = getBaseUrl(desformCode).toString();
|
||||
HttpHeaders headers = getHeaders(token);
|
||||
ResponseEntity<JSONObject> result = RestUtil.request(url, method, headers, null, formData, JSONObject.class);
|
||||
@@ -83,19 +83,19 @@ public class RestDesformUtil {
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public static Result<T> removeOne(String desformCode, String dataId, String token) {
|
||||
public static Results<T> removeOne(String desformCode, String dataId, String token) {
|
||||
String url = getBaseUrl(desformCode, dataId).toString();
|
||||
HttpHeaders headers = getHeaders(token);
|
||||
ResponseEntity<JSONObject> result = RestUtil.request(url, HttpMethod.DELETE, headers, null, null, JSONObject.class);
|
||||
return packageReturn(result);
|
||||
}
|
||||
|
||||
private static Result<T> packageReturn(ResponseEntity<JSONObject> result) {
|
||||
private static Results<T> packageReturn(ResponseEntity<JSONObject> result) {
|
||||
JSONObject json = result.getBody();
|
||||
if (!Objects.isNull(json)) {
|
||||
return json.toJavaObject(Result.class);
|
||||
return json.toJavaObject(Results.class);
|
||||
}
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
|
||||
private static StringBuilder getBaseUrl() {
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package com.jero.config;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -66,7 +66,7 @@ public class CsrfFilter implements Filter {
|
||||
log = "跨站请求---->>>" + ip + "||" + date + "||" + referurl + "||" + url;
|
||||
LOGGER.warn(log);
|
||||
//发送错误信息
|
||||
JSONObject json = JSONUtil.parseObj(Result.error("监测到跨站请求,请求失败"), false);
|
||||
JSONObject json = JSONUtil.parseObj(Results.error("监测到跨站请求,请求失败"), false);
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
res.setContentType("application/json; charset=utf-8");
|
||||
PrintWriter out = res.getWriter();
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import java.util.SortedMap;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.util.DateUtils;
|
||||
import com.jero.config.sign.util.BodyReaderHttpServletRequestWrapper;
|
||||
@@ -64,7 +64,7 @@ public class SignAuthInterceptor implements HandlerInterceptor {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/json; charset=utf-8");
|
||||
PrintWriter out = response.getWriter();
|
||||
Result<?> result = Result.error("Sign签名校验失败!");
|
||||
Results<?> result = Results.error("Sign签名校验失败!");
|
||||
out.print(JSON.toJSON(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package com.jero.generater.interceptor;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.jero.common.api.dto.OnlineAuthDTO;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.aspect.annotation.OnlineAuth;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.system.util.JwtUtil;
|
||||
@@ -111,7 +111,7 @@ public class OnlineInterceptor implements HandlerInterceptor {
|
||||
if ("exportXls".equals(paramString)) {
|
||||
printWriter.print("");
|
||||
} else {
|
||||
Result<T> result = Result.error("无权限访问(操作)");
|
||||
Results<T> result = Results.error("无权限访问(操作)");
|
||||
printWriter.print(JSON.toJSON(result));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
+43
-43
@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.generater.modules.online.auth.entity.OnlAuthData;
|
||||
import com.jero.generater.modules.online.auth.entity.OnlAuthPage;
|
||||
@@ -58,8 +58,8 @@ public class OnlCgformAuthController {
|
||||
|
||||
|
||||
@GetMapping({"/authData/{cgformId}"})
|
||||
public Result<List<OnlAuthData>> a(@PathVariable("cgformId") String paramString) {
|
||||
Result<List<OnlAuthData>> result = new Result<>();
|
||||
public Results<List<OnlAuthData>> a(@PathVariable("cgformId") String paramString) {
|
||||
Results<List<OnlAuthData>> result = new Results<>();
|
||||
LambdaQueryWrapper<OnlAuthData> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(OnlAuthData::getCgformId, paramString);
|
||||
List<OnlAuthData> list = this.onlAuthDataService.list(lambdaQueryWrapper);
|
||||
@@ -70,35 +70,35 @@ public class OnlCgformAuthController {
|
||||
|
||||
|
||||
@PostMapping({"/authData"})
|
||||
public Result<Object> addAuthData(@RequestBody OnlAuthData paramOnlAuthData) {
|
||||
public Results<Object> addAuthData(@RequestBody OnlAuthData paramOnlAuthData) {
|
||||
try {
|
||||
this.onlAuthDataService.save(paramOnlAuthData);
|
||||
return Result.OK(OP_CONSTANT);
|
||||
return Results.OK(OP_CONSTANT);
|
||||
} catch (Exception exception) {
|
||||
log.error(exception.getMessage(), exception);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping({"/editAuthData"})
|
||||
public Result<OnlAuthData> editAuthData(@RequestBody OnlAuthData paramOnlAuthData) {
|
||||
Result<OnlAuthData> result = new Result<>();
|
||||
public Results<OnlAuthData> editAuthData(@RequestBody OnlAuthData paramOnlAuthData) {
|
||||
Results<OnlAuthData> result = new Results<>();
|
||||
this.onlAuthDataService.updateById(paramOnlAuthData);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping({"/authData/{id}"})
|
||||
public Result<T> getAuthDataById(@PathVariable("id") String paramString) {
|
||||
public Results<T> getAuthDataById(@PathVariable("id") String paramString) {
|
||||
this.onlAuthDataService.deleteOne(paramString);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping({"/authButton/{cgformId}"})
|
||||
public Result<Map<String, Object>> getAuthButton(@PathVariable("cgformId") String paramString) {
|
||||
Result<Map<String, Object>> result = new Result<>();
|
||||
public Results<Map<String, Object>> getAuthButton(@PathVariable("cgformId") String paramString) {
|
||||
Results<Map<String, Object>> result = new Results<>();
|
||||
|
||||
LambdaQueryWrapper<OnlCgformButton> buttonLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
buttonLambdaQueryWrapper.eq(OnlCgformButton::getCgformHeadId, paramString)
|
||||
@@ -121,7 +121,7 @@ public class OnlCgformAuthController {
|
||||
|
||||
|
||||
@PostMapping({"/authButton"})
|
||||
public Result<OnlAuthPage> addAuthButton(@RequestBody OnlAuthPage paramOnlAuthPage) {
|
||||
public Results<OnlAuthPage> addAuthButton(@RequestBody OnlAuthPage paramOnlAuthPage) {
|
||||
try {
|
||||
String str = paramOnlAuthPage.getId();
|
||||
boolean bool = false;
|
||||
@@ -137,33 +137,33 @@ public class OnlCgformAuthController {
|
||||
paramOnlAuthPage.setStatus(1);
|
||||
this.onlAuthPageService.save(paramOnlAuthPage);
|
||||
}
|
||||
return Result.OK(OP_CONSTANT, paramOnlAuthPage);
|
||||
return Results.OK(OP_CONSTANT, paramOnlAuthPage);
|
||||
} catch (Exception exception) {
|
||||
log.error(exception.getMessage(), exception);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping({"/authButton/{id}"})
|
||||
public Result<String> d(@PathVariable("id") String paramString) {
|
||||
public Results<String> d(@PathVariable("id") String paramString) {
|
||||
LambdaUpdateWrapper<OnlAuthPage> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(OnlAuthPage::getId, paramString).set(OnlAuthPage::getStatus, 0);
|
||||
|
||||
this.onlAuthPageService.update(lambdaUpdateWrapper);
|
||||
return Result.OK(OP_CONSTANT);
|
||||
return Results.OK(OP_CONSTANT);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping({"/authColumn/{cgformId}"})
|
||||
public Result<List<AuthColumnVO>> e(@PathVariable("cgformId") String paramString) {
|
||||
Result<List<AuthColumnVO>> result = new Result<>();
|
||||
public Results<List<AuthColumnVO>> e(@PathVariable("cgformId") String paramString) {
|
||||
Results<List<AuthColumnVO>> result = new Results<>();
|
||||
LambdaQueryWrapper<OnlCgformField> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(OnlCgformField::getCgformHeadId, paramString);
|
||||
lambdaQueryWrapper.orderByAsc(OnlCgformField::getOrderNum);
|
||||
List<OnlCgformField> list = this.onlCgformFieldService.list(lambdaQueryWrapper);
|
||||
if (list == null || list.isEmpty()) {
|
||||
return Result.error(NOT_INFO_CONSTANT);
|
||||
return Results.error(NOT_INFO_CONSTANT);
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<OnlAuthPage> pageLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
@@ -176,7 +176,7 @@ public class OnlCgformAuthController {
|
||||
arrayList.add(authColumnVO);
|
||||
}
|
||||
result.setResult(arrayList);
|
||||
Result.OK("加载字段权限数据完成");
|
||||
Results.OK("加载字段权限数据完成");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -216,36 +216,36 @@ public class OnlCgformAuthController {
|
||||
|
||||
|
||||
@PostMapping({"/editAuthColumn"})
|
||||
public Result<T> editAuthColumn(@RequestBody AuthColumnVO paramAuthColumnVO) {
|
||||
public Results<T> editAuthColumn(@RequestBody AuthColumnVO paramAuthColumnVO) {
|
||||
try {
|
||||
if (paramAuthColumnVO.getStatus() == 1) {
|
||||
this.onlAuthPageService.enableAuthColumn(paramAuthColumnVO);
|
||||
} else {
|
||||
this.onlAuthPageService.disableAuthColumn(paramAuthColumnVO);
|
||||
}
|
||||
return Result.OK(OP_CONSTANT);
|
||||
return Results.OK(OP_CONSTANT);
|
||||
} catch (Exception exception) {
|
||||
log.error(exception.getMessage(), exception);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping({"/authColumn"})
|
||||
public Result<T> addAuthColumn(@RequestBody AuthColumnVO paramAuthColumnVO) {
|
||||
public Results<T> addAuthColumn(@RequestBody AuthColumnVO paramAuthColumnVO) {
|
||||
try {
|
||||
this.onlAuthPageService.switchAuthColumn(paramAuthColumnVO);
|
||||
return Result.OK(OP_CONSTANT);
|
||||
return Results.OK(OP_CONSTANT);
|
||||
} catch (Exception exception) {
|
||||
log.error(exception.getMessage(), exception);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping({"/authPage/{cgformId}/{type}"})
|
||||
public Result<List<AuthPageVO>> getAuthPage(@PathVariable("cgformId") String paramString, @PathVariable("type") Integer paramInteger) {
|
||||
Result<List<AuthPageVO>> result = new Result<>();
|
||||
public Results<List<AuthPageVO>> getAuthPage(@PathVariable("cgformId") String paramString, @PathVariable("type") Integer paramInteger) {
|
||||
Results<List<AuthPageVO>> result = new Results<>();
|
||||
List<AuthPageVO> list = this.onlAuthPageService.queryAuthByFormId(paramString, paramInteger);
|
||||
result.setResult(list);
|
||||
result.setSuccess(true);
|
||||
@@ -254,8 +254,8 @@ public class OnlCgformAuthController {
|
||||
|
||||
|
||||
@GetMapping({"/validAuthData/{cgformId}"})
|
||||
public Result<List<OnlAuthData>> validAuthData(@PathVariable("cgformId") String paramString) {
|
||||
Result<List<OnlAuthData>> result = new Result<>();
|
||||
public Results<List<OnlAuthData>> validAuthData(@PathVariable("cgformId") String paramString) {
|
||||
Results<List<OnlAuthData>> result = new Results<>();
|
||||
|
||||
LambdaQueryWrapper<OnlAuthData> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(OnlAuthData::getCgformId, paramString)
|
||||
@@ -270,8 +270,8 @@ public class OnlCgformAuthController {
|
||||
|
||||
|
||||
@GetMapping({"/roleAuth"})
|
||||
public Result<List<OnlAuthRelation>> getRoleAuth(@RequestParam("roleId") String paramString1, @RequestParam("cgformId") String paramString2, @RequestParam("type") Integer paramInteger) {
|
||||
Result<List<OnlAuthRelation>> result = new Result<>();
|
||||
public Results<List<OnlAuthRelation>> getRoleAuth(@RequestParam("roleId") String paramString1, @RequestParam("cgformId") String paramString2, @RequestParam("type") Integer paramInteger) {
|
||||
Results<List<OnlAuthRelation>> result = new Results<>();
|
||||
|
||||
LambdaQueryWrapper<OnlAuthRelation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(OnlAuthRelation::getRoleId, paramString1)
|
||||
@@ -287,42 +287,42 @@ public class OnlCgformAuthController {
|
||||
|
||||
|
||||
@PostMapping({"/roleColumnAuth/{roleId}/{cgformId}"})
|
||||
public Result<T> addRoleColumnAuth(@PathVariable("roleId") String paramString1, @PathVariable("cgformId") String paramString2, @RequestBody JSONObject paramJSONObject) {
|
||||
public Results<T> addRoleColumnAuth(@PathVariable("roleId") String paramString1, @PathVariable("cgformId") String paramString2, @RequestBody JSONObject paramJSONObject) {
|
||||
JSONArray json = paramJSONObject.getJSONArray(AUTH_ID_CONSTANT);
|
||||
List<String> list = json.toJavaList(String.class);
|
||||
this.onlAuthRelationService.saveRoleAuth(paramString1, paramString2, 1, list);
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping({"/roleButtonAuth/{roleId}/{cgformId}"})
|
||||
public Result<T> addrRleButtonAuth(@PathVariable("roleId") String paramString1, @PathVariable("cgformId") String paramString2, @RequestBody JSONObject paramJSONObject) {
|
||||
public Results<T> addrRleButtonAuth(@PathVariable("roleId") String paramString1, @PathVariable("cgformId") String paramString2, @RequestBody JSONObject paramJSONObject) {
|
||||
JSONArray json = paramJSONObject.getJSONArray(AUTH_ID_CONSTANT);
|
||||
List<String> list = json.toJavaList(String.class);
|
||||
this.onlAuthRelationService.saveRoleAuth(paramString1, paramString2, 2, list);
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping({"/roleDataAuth/{roleId}/{cgformId}"})
|
||||
public Result<T> addRoleDataAuth(@PathVariable("roleId") String paramString1, @PathVariable("cgformId") String paramString2, @RequestBody JSONObject paramJSONObject) {
|
||||
public Results<T> addRoleDataAuth(@PathVariable("roleId") String paramString1, @PathVariable("cgformId") String paramString2, @RequestBody JSONObject paramJSONObject) {
|
||||
JSONArray json = paramJSONObject.getJSONArray(AUTH_ID_CONSTANT);
|
||||
List<String> list = json.toJavaList(String.class);
|
||||
this.onlAuthRelationService.saveRoleAuth(paramString1, paramString2, 3, list);
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping({"/getAuthColumn/{desformCode}"})
|
||||
public Result<List<AuthColumnVO>> getAuthColumn(@PathVariable("desformCode") String paramString) {
|
||||
public Results<List<AuthColumnVO>> getAuthColumn(@PathVariable("desformCode") String paramString) {
|
||||
LambdaQueryWrapper<OnlCgformHead> cgformHeadLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
cgformHeadLambdaQueryWrapper.eq(OnlCgformHead::getTableName, paramString);
|
||||
OnlCgformHead onlCgformHead = this.onlCgformHeadService.getOne(cgformHeadLambdaQueryWrapper);
|
||||
if (onlCgformHead == null) {
|
||||
Result.error(NOT_INFO_CONSTANT);
|
||||
Results.error(NOT_INFO_CONSTANT);
|
||||
}
|
||||
|
||||
Result<List<AuthColumnVO>> result = new Result<>();
|
||||
Results<List<AuthColumnVO>> result = new Results<>();
|
||||
LambdaQueryWrapper<OnlCgformField> cgformFieldLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if (!Objects.isNull(onlCgformHead)) {
|
||||
cgformFieldLambdaQueryWrapper.eq(OnlCgformField::getCgformHeadId, onlCgformHead.getId());
|
||||
@@ -330,7 +330,7 @@ public class OnlCgformAuthController {
|
||||
cgformFieldLambdaQueryWrapper.orderByAsc(OnlCgformField::getOrderNum);
|
||||
List<OnlCgformField> list = this.onlCgformFieldService.list(cgformFieldLambdaQueryWrapper);
|
||||
if (list == null || list.isEmpty()) {
|
||||
Result.error(NOT_INFO_CONSTANT);
|
||||
Results.error(NOT_INFO_CONSTANT);
|
||||
}
|
||||
ArrayList<AuthColumnVO> arrayList = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : list) {
|
||||
|
||||
+84
-84
@@ -6,7 +6,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.aspect.annotation.OnlineAuth;
|
||||
import com.jero.common.aspect.annotation.PermissionData;
|
||||
@@ -99,23 +99,23 @@ public class OnlCgformApiController {
|
||||
private static final String CHECK_ERROR = "查询失败,";
|
||||
|
||||
@PostMapping({"/addAll"})
|
||||
public Result<T> a(@RequestBody OnlCgformModel var1) {
|
||||
public Results<T> a(@RequestBody OnlCgformModel var1) {
|
||||
try {
|
||||
String var2 = var1.getHead().getTableName();
|
||||
return Boolean.TRUE.equals(DbTableUtil.a(var2)) ? Result.error("数据库表[" + var2 + "]已存在,请从数据库导入表单") : this.onlCgformHeadService.addAll(var1);
|
||||
return Boolean.TRUE.equals(DbTableUtil.a(var2)) ? Results.error("数据库表[" + var2 + "]已存在,请从数据库导入表单") : this.onlCgformHeadService.addAll(var1);
|
||||
} catch (Exception var3) {
|
||||
log.error("OnlCgformApiController.addAll()发生异常:" + var3.getMessage(), var3);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/editAll"})
|
||||
public Result<T> b(@RequestBody OnlCgformModel var1) {
|
||||
public Results<T> b(@RequestBody OnlCgformModel var1) {
|
||||
try {
|
||||
return this.onlCgformHeadService.editAll(var1);
|
||||
} catch (Exception var3) {
|
||||
log.error("OnlCgformApiController.editAll()发生异常:" + var3.getMessage(), var3);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,11 +126,11 @@ public class OnlCgformApiController {
|
||||
)
|
||||
@OnlineAuth("getColumns")
|
||||
@GetMapping({"/getColumns/{code}"})
|
||||
public Result<OnlComplexModel> a(@PathVariable("code") String var1) {
|
||||
Result<OnlComplexModel> var2 = new Result<>();
|
||||
public Results<OnlComplexModel> a(@PathVariable("code") String var1) {
|
||||
Results<OnlComplexModel> var2 = new Results<>();
|
||||
OnlCgformHead var3 = this.onlCgformHeadService.getById(var1);
|
||||
if (var3 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
OnlComplexModel var4 = this.onlineService.queryOnlineConfig(var3);
|
||||
var4.setIsDesForm(var3.getIsDesForm());
|
||||
@@ -149,11 +149,11 @@ public class OnlCgformApiController {
|
||||
@PermissionData
|
||||
@OnlineAuth("getData")
|
||||
@GetMapping({"/getData/{code}"})
|
||||
public Result<Map<String, Object>> a(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
Result<Map<String, Object>> var3 = new Result<>();
|
||||
public Results<Map<String, Object>> a(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
Results<Map<String, Object>> var3 = new Results<>();
|
||||
OnlCgformHead var4 = this.onlCgformHeadService.getById(var1);
|
||||
if (var4 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
try {
|
||||
String var5 = var4.getTableName();
|
||||
@@ -163,7 +163,7 @@ public class OnlCgformApiController {
|
||||
var3.setResult(var7);
|
||||
} catch (Exception var8) {
|
||||
log.error(var8.getMessage(), var8);
|
||||
return Result.error("数据库查询失败," + var8.getMessage());
|
||||
return Results.error("数据库查询失败," + var8.getMessage());
|
||||
}
|
||||
|
||||
var3.setOnlTable(var4.getTableName());
|
||||
@@ -178,13 +178,13 @@ public class OnlCgformApiController {
|
||||
)
|
||||
@OnlineAuth("getFormItem")
|
||||
@GetMapping({"/getFormItem/{code}"})
|
||||
public Result<JSONObject> b(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
public Results<JSONObject> b(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
OnlCgformHead var3 = this.onlCgformHeadService.getById(var1);
|
||||
if (var3 == null) {
|
||||
Result.error("表不存在");
|
||||
Results.error("表不存在");
|
||||
}
|
||||
|
||||
Result<JSONObject> var4 = new Result<>();
|
||||
Results<JSONObject> var4 = new Results<>();
|
||||
OnlCgformEnhanceJs var5 = this.onlCgformHeadService.queryEnhanceJs(var1, "form");
|
||||
JSONObject var6 = this.onlineService.queryOnlineFormObj(var3, var5);
|
||||
if (!Objects.isNull(var3)) {
|
||||
@@ -272,13 +272,13 @@ public class OnlCgformApiController {
|
||||
module = ModuleType.ONLINE
|
||||
)
|
||||
@GetMapping({"/getFormItemBytbname/{table}"})
|
||||
public Result<JSONObject> a(@PathVariable("table") String var1, @RequestParam(name = "taskId", required = false) String var2) {
|
||||
Result<JSONObject> var3 = new Result<>();
|
||||
public Results<JSONObject> a(@PathVariable("table") String var1, @RequestParam(name = "taskId", required = false) String var2) {
|
||||
Results<JSONObject> var3 = new Results<>();
|
||||
LambdaQueryWrapper<OnlCgformHead> var4 = new LambdaQueryWrapper<>();
|
||||
var4.eq(OnlCgformHead::getTableName, var1);
|
||||
OnlCgformHead var5 = this.onlCgformHeadService.getOne(var4);
|
||||
if (var5 == null) {
|
||||
Result.error("表不存在");
|
||||
Results.error("表不存在");
|
||||
}
|
||||
|
||||
JSONObject var6 = new JSONObject();
|
||||
@@ -294,14 +294,14 @@ public class OnlCgformApiController {
|
||||
|
||||
@OnlineAuth("getEnhanceJs")
|
||||
@GetMapping({"/getEnhanceJs/{code}"})
|
||||
public Result<T> c(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
public Results<T> c(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
String var3 = "";
|
||||
OnlCgformEnhanceJs var4 = this.onlCgformHeadService.queryEnhanceJs(var1, "form");
|
||||
if (var4 != null && oConvertUtils.isNotEmpty(var4.getCgJs())) {
|
||||
var3 = EnhanceJsUtil.b(var4.getCgJs(), (List) null);
|
||||
}
|
||||
|
||||
return Result.OK(var3);
|
||||
return Results.OK(var3);
|
||||
}
|
||||
|
||||
@AutoLog(
|
||||
@@ -309,34 +309,34 @@ public class OnlCgformApiController {
|
||||
value = "online表单数据查询"
|
||||
)
|
||||
@GetMapping({"/form/{code}/{id}"})
|
||||
public Result<Map<String, Object>> b(@PathVariable("code") String var1, @PathVariable("id") String var2) {
|
||||
public Results<Map<String, Object>> b(@PathVariable("code") String var1, @PathVariable("id") String var2) {
|
||||
try {
|
||||
Map<String, Object> var3 = this.onlCgformHeadService.queryManyFormData(var1, var2);
|
||||
return Result.OK(CgformUtil.b(var3));
|
||||
return Results.OK(CgformUtil.b(var3));
|
||||
} catch (Exception var4) {
|
||||
log.error(ONLINE_CHECK_EX + var4.getMessage(), var4);
|
||||
return Result.error(CHECK_ERROR + var4.getMessage());
|
||||
return Results.error(CHECK_ERROR + var4.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/subform/{table}/{mainId}"})
|
||||
public Result<Map<String, Object>> c(@PathVariable("table") String var1, @PathVariable("mainId") String var2) {
|
||||
public Results<Map<String, Object>> c(@PathVariable("table") String var1, @PathVariable("mainId") String var2) {
|
||||
try {
|
||||
Map<String, Object> var3 = this.onlCgformHeadService.querySubFormData(var1, var2);
|
||||
return Result.OK(CgformUtil.b(var3));
|
||||
return Results.OK(CgformUtil.b(var3));
|
||||
} catch (Exception var4) {
|
||||
log.error(ONLINE_CHECK_EX + var4.getMessage(), var4);
|
||||
return Result.error(CHECK_ERROR + var4.getMessage());
|
||||
return Results.error(CHECK_ERROR + var4.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/subform/list/{table}/{mainId}"})
|
||||
public Result<List<Map<String, Object>>> d(@PathVariable("table") String var1, @PathVariable("mainId") String var2) {
|
||||
public Results<List<Map<String, Object>>> d(@PathVariable("table") String var1, @PathVariable("mainId") String var2) {
|
||||
try {
|
||||
return Result.OK(this.onlCgformHeadService.queryManySubFormData(var1, var2));
|
||||
return Results.OK(this.onlCgformHeadService.queryManySubFormData(var1, var2));
|
||||
} catch (Exception var4) {
|
||||
log.error(ONLINE_CHECK_EX + var4.getMessage(), var4);
|
||||
return Result.error(CHECK_ERROR + var4.getMessage());
|
||||
return Results.error(CHECK_ERROR + var4.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ public class OnlCgformApiController {
|
||||
module = ModuleType.ONLINE
|
||||
)
|
||||
@GetMapping({"/form/table_name/{tableName}/{dataId}"})
|
||||
public Result<Map<String, Object>> e(@PathVariable("tableName") String var1, @PathVariable("dataId") String var2) {
|
||||
public Results<Map<String, Object>> e(@PathVariable("tableName") String var1, @PathVariable("dataId") String var2) {
|
||||
try {
|
||||
LambdaQueryWrapper<OnlCgformHead> var3 = new LambdaQueryWrapper<>();
|
||||
var3.eq(OnlCgformHead::getTableName, var1);
|
||||
@@ -354,13 +354,13 @@ public class OnlCgformApiController {
|
||||
if (var4 == null) {
|
||||
throw new JeroBootException("OnlCgform tableName: " + var1 + " 不存在!");
|
||||
} else {
|
||||
Result<Map<String, Object>> var5 = this.b(var4.getId(), var2);
|
||||
Results<Map<String, Object>> var5 = this.b(var4.getId(), var2);
|
||||
var5.setOnlTable(var1);
|
||||
return var5;
|
||||
}
|
||||
} catch (Exception var6) {
|
||||
log.error("Online表单查询异常," + var6.getMessage(), var6);
|
||||
return Result.error(CHECK_ERROR + var6.getMessage());
|
||||
return Results.error(CHECK_ERROR + var6.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,8 +371,8 @@ public class OnlCgformApiController {
|
||||
)
|
||||
@OnlineAuth("form")
|
||||
@PostMapping({"/form/{code}"})
|
||||
public Result<String> a(@PathVariable("code") String var1, @RequestBody JSONObject var2, HttpServletRequest var3) {
|
||||
Result<String> var4 = new Result<>();
|
||||
public Results<String> a(@PathVariable("code") String var1, @RequestBody JSONObject var2, HttpServletRequest var3) {
|
||||
Results<String> var4 = new Results<>();
|
||||
|
||||
try {
|
||||
String var5 = CgformUtil.a();
|
||||
@@ -398,15 +398,15 @@ public class OnlCgformApiController {
|
||||
)
|
||||
@OnlineAuth("form")
|
||||
@PostMapping({"/form/update/{code}"})
|
||||
public Result<String> a(@PathVariable("code") String var1, @RequestBody JSONObject var2) {
|
||||
public Results<String> a(@PathVariable("code") String var1, @RequestBody JSONObject var2) {
|
||||
try {
|
||||
String var3 = this.onlCgformHeadService.editManyFormData(var1, var2);
|
||||
Result<String> var4 = Result.OK("操作成功!");
|
||||
Results<String> var4 = Results.OK("操作成功!");
|
||||
var4.setOnlTable(var3);
|
||||
return var4;
|
||||
} catch (Exception var5) {
|
||||
log.error(ON_LCG_FORM_API_CONTROLLER_CHECK_EX + var5.getMessage(), var5);
|
||||
return Result.error("修改失败," + CgformUtil.a(var5));
|
||||
return Results.error("修改失败," + CgformUtil.a(var5));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,19 +417,19 @@ public class OnlCgformApiController {
|
||||
)
|
||||
@OnlineAuth("form")
|
||||
@PostMapping({"/form/{code}/{id}"})
|
||||
public Result<String> f(@PathVariable("code") String var1, @PathVariable("id") String var2) {
|
||||
public Results<String> f(@PathVariable("code") String var1, @PathVariable("id") String var2) {
|
||||
OnlCgformHead var3 = this.onlCgformHeadService.getById(var1);
|
||||
if (var3 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
try {
|
||||
getVar4(var1, var2, var3);
|
||||
} catch (Exception var12) {
|
||||
log.error(ON_LCG_FORM_API_CONTROLLER_CHECK_EX + var12.getMessage(), var12);
|
||||
return Result.error("删除失败");
|
||||
return Results.error("删除失败");
|
||||
}
|
||||
|
||||
Result<String> var13 = Result.OK("删除成功!");
|
||||
Results<String> var13 = Results.OK("删除成功!");
|
||||
var13.setOnlTable(var3.getTableName());
|
||||
return var13;
|
||||
}
|
||||
@@ -478,10 +478,10 @@ public class OnlCgformApiController {
|
||||
module = ModuleType.ONLINE
|
||||
)
|
||||
@PostMapping({"/formByCode/{code}/{id}"})
|
||||
public Result<String> g(@PathVariable("code") String var1, @PathVariable("id") String var2) {
|
||||
public Results<String> g(@PathVariable("code") String var1, @PathVariable("id") String var2) {
|
||||
OnlCgformHead var3 = this.onlCgformHeadService.getOne(new LambdaQueryWrapper<OnlCgformHead>().eq(OnlCgformHead::getTableName, var1));
|
||||
if (var3 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
try {
|
||||
if (var2.contains(",")) {
|
||||
@@ -492,10 +492,10 @@ public class OnlCgformApiController {
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
log.error(ON_LCG_FORM_API_CONTROLLER_CHECK_EX + var5.getMessage(), var5);
|
||||
return Result.error("删除失败");
|
||||
return Results.error("删除失败");
|
||||
}
|
||||
|
||||
Result<String> var6 = Result.OK("删除成功!");
|
||||
Results<String> var6 = Results.OK("删除成功!");
|
||||
var6.setOnlTable(var3.getTableName());
|
||||
return var6;
|
||||
}
|
||||
@@ -503,28 +503,28 @@ public class OnlCgformApiController {
|
||||
|
||||
@OnlineAuth("getQueryInfo")
|
||||
@GetMapping({"/getQueryInfo/{code}"})
|
||||
public Result<List<Map<String, String>>> b(@PathVariable("code") String var1) {
|
||||
public Results<List<Map<String, String>>> b(@PathVariable("code") String var1) {
|
||||
try {
|
||||
List<Map<String, String>> var2 = this.onlCgformFieldService.getAutoListQueryInfo(var1);
|
||||
return Result.OK(var2);
|
||||
return Results.OK(var2);
|
||||
} catch (Exception var3) {
|
||||
log.error("OnlCgformApiController.getQueryInfo()发生异常:" + var3.getMessage(), var3);
|
||||
return Result.error("查询失败");
|
||||
return Results.error("查询失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/doDbSynch/{code}/{synMethod}"})
|
||||
public Result<T> h(@PathVariable("code") String var1, @PathVariable("synMethod") String var2) {
|
||||
public Results<T> h(@PathVariable("code") String var1, @PathVariable("synMethod") String var2) {
|
||||
try {
|
||||
long var3 = System.currentTimeMillis();
|
||||
this.onlCgformHeadService.doDbSynch(var1, var2);
|
||||
log.info("==同步数据库消耗时间" + (System.currentTimeMillis() - var3) + "毫秒");
|
||||
} catch (Exception var5) {
|
||||
log.error(var5.getMessage(), var5);
|
||||
return Result.error("同步数据库失败," + CgformUtil.a(var5));
|
||||
return Results.error("同步数据库失败," + CgformUtil.a(var5));
|
||||
}
|
||||
|
||||
return Result.OK("同步数据库成功!");
|
||||
return Results.OK("同步数据库成功!");
|
||||
}
|
||||
|
||||
@OnlineAuth("exportXls")
|
||||
@@ -625,15 +625,15 @@ public class OnlCgformApiController {
|
||||
|
||||
@OnlineAuth("importXls")
|
||||
@PostMapping({"/importXls/{code}"})
|
||||
public Result<T> b(@PathVariable("code") String var1, HttpServletRequest var2, HttpServletResponse var3) {
|
||||
public Results<T> b(@PathVariable("code") String var1, HttpServletRequest var2, HttpServletResponse var3) {
|
||||
long var4 = System.currentTimeMillis();
|
||||
Result<T> var6 = new Result<>();
|
||||
Results<T> var6 = new Results<>();
|
||||
String var7 = "";
|
||||
|
||||
try {
|
||||
OnlCgformHead var8 = this.onlCgformHeadService.getById(var1);
|
||||
if (var8 == null) {
|
||||
return Result.error("数据库不存在该表记录");
|
||||
return Results.error("数据库不存在该表记录");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<OnlCgformField> var9 = new LambdaQueryWrapper<>();
|
||||
@@ -824,7 +824,7 @@ public class OnlCgformApiController {
|
||||
}
|
||||
|
||||
@PostMapping({"/doButton"})
|
||||
public Result<T> a(@RequestBody JSONObject var1) {
|
||||
public Results<T> a(@RequestBody JSONObject var1) {
|
||||
String var2 = var1.getString("formId");
|
||||
String var3 = var1.getString("dataId");
|
||||
String var4 = var1.getString("buttonCode");
|
||||
@@ -833,10 +833,10 @@ public class OnlCgformApiController {
|
||||
this.onlCgformHeadService.executeCustomerButton(var4, var2, var3);
|
||||
} catch (Exception var7) {
|
||||
log.error(var7.getMessage(), var7);
|
||||
return Result.error("执行失败!");
|
||||
return Results.error("执行失败!");
|
||||
}
|
||||
|
||||
return Result.OK("执行成功!");
|
||||
return Results.OK("执行成功!");
|
||||
}
|
||||
|
||||
public Object a(OnlCgformHead var1, DataSource var2, String var3) {
|
||||
@@ -952,25 +952,25 @@ public class OnlCgformApiController {
|
||||
}
|
||||
|
||||
@GetMapping({"/checkOnlyTable"})
|
||||
public Result<Integer> i(@RequestParam("tbname") String var1, @RequestParam("id") String var2) {
|
||||
public Results<Integer> i(@RequestParam("tbname") String var1, @RequestParam("id") String var2) {
|
||||
OnlCgformHead var3;
|
||||
if (oConvertUtils.isEmpty(var2)) {
|
||||
if (Boolean.TRUE.equals(DbTableUtil.a(var1))) {
|
||||
return Result.OK(-1);
|
||||
return Results.OK(-1);
|
||||
}
|
||||
|
||||
var3 = this.onlCgformHeadService.getOne(new LambdaQueryWrapper<OnlCgformHead>().eq(OnlCgformHead::getTableName, var1));
|
||||
if (oConvertUtils.isNotEmpty(var3)) {
|
||||
return Result.OK(-1);
|
||||
return Results.OK(-1);
|
||||
}
|
||||
} else {
|
||||
var3 = this.onlCgformHeadService.getById(var2);
|
||||
if (!var1.equals(var3.getTableName()) && Boolean.TRUE.equals(DbTableUtil.a(var1))) {
|
||||
return Result.OK(-1);
|
||||
return Results.OK(-1);
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK(1);
|
||||
return Results.OK(1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -981,7 +981,7 @@ public class OnlCgformApiController {
|
||||
* @date 2021/4/6 11:41
|
||||
*/
|
||||
@PostMapping({"/codeGenerate"})
|
||||
public Result<List<String>> codeGenerate(@RequestBody JSONObject jsonObject) {
|
||||
public Results<List<String>> codeGenerate(@RequestBody JSONObject jsonObject) {
|
||||
OnlGenerateModel onlGenerateModel = JSON.parseObject(jsonObject.toJSONString(), OnlGenerateModel.class);
|
||||
List<String> list;
|
||||
|
||||
@@ -992,10 +992,10 @@ public class OnlCgformApiController {
|
||||
list = this.onlCgformHeadService.generateOneToMany(onlGenerateModel);
|
||||
}
|
||||
|
||||
return Result.OK(list);
|
||||
return Results.OK(list);
|
||||
} catch (Exception var5) {
|
||||
var5.printStackTrace();
|
||||
return Result.error(var5.getMessage());
|
||||
return Results.error(var5.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1054,11 +1054,11 @@ public class OnlCgformApiController {
|
||||
)
|
||||
@GetMapping({"/getTreeData/{code}"})
|
||||
@PermissionData
|
||||
public Result<Map<String, Object>> d(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
Result<Map<String, Object>> var3 = new Result<>();
|
||||
public Results<Map<String, Object>> d(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
Results<Map<String, Object>> var3 = new Results<>();
|
||||
OnlCgformHead var4 = this.onlCgformHeadService.getById(var1);
|
||||
if (var4 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
try {
|
||||
String var5 = var4.getTableName();
|
||||
@@ -1079,7 +1079,7 @@ public class OnlCgformApiController {
|
||||
var3.setResult(var11);
|
||||
} catch (Exception var12) {
|
||||
log.error(var12.getMessage(), var12);
|
||||
return Result.error("数据库查询失败" + var12.getMessage());
|
||||
return Results.error("数据库查询失败" + var12.getMessage());
|
||||
}
|
||||
|
||||
var3.setOnlTable(var4.getTableName());
|
||||
@@ -1093,8 +1093,8 @@ public class OnlCgformApiController {
|
||||
}
|
||||
|
||||
@PostMapping({"/crazyForm/{name}"})
|
||||
public Result<String> b(@PathVariable("name") String var1, @RequestBody JSONObject var2) {
|
||||
Result<String> var3 = new Result<>();
|
||||
public Results<String> b(@PathVariable("name") String var1, @RequestBody JSONObject var2) {
|
||||
Results<String> var3 = new Results<>();
|
||||
try {
|
||||
String var4 = CgformUtil.a();
|
||||
var2.put("id", var4);
|
||||
@@ -1104,12 +1104,12 @@ public class OnlCgformApiController {
|
||||
return var3;
|
||||
} catch (Exception var5) {
|
||||
log.error("OnlCgformApiController.formAddForDesigner()发生异常:" + var5.getMessage(), var5);
|
||||
return Result.error("保存失败");
|
||||
return Results.error("保存失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/crazyForm/update/{name}"})
|
||||
public Result<T> c(@PathVariable("name") String var1, @RequestBody JSONObject var2) {
|
||||
public Results<T> c(@PathVariable("name") String var1, @RequestBody JSONObject var2) {
|
||||
try {
|
||||
var2.remove("create_by");
|
||||
var2.remove("create_time");
|
||||
@@ -1118,10 +1118,10 @@ public class OnlCgformApiController {
|
||||
this.onlCgformHeadService.editCrazyFormData(var1, var2);
|
||||
} catch (Exception var4) {
|
||||
log.error("OnlCgformApiController.formEditForDesigner()发生异常:" + var4.getMessage(), var4);
|
||||
return Result.error("保存失败");
|
||||
return Results.error("保存失败");
|
||||
}
|
||||
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
@AutoLog(
|
||||
@@ -1130,11 +1130,11 @@ public class OnlCgformApiController {
|
||||
module = ModuleType.ONLINE
|
||||
)
|
||||
@GetMapping({"/getErpColumns/{code}"})
|
||||
public Result<Map<String, Object>> c(@PathVariable("code") String var1) {
|
||||
Result<Map<String, Object>> var2 = new Result<>();
|
||||
public Results<Map<String, Object>> c(@PathVariable("code") String var1) {
|
||||
Results<Map<String, Object>> var2 = new Results<>();
|
||||
OnlCgformHead var3 = this.onlCgformHeadService.getById(var1);
|
||||
if (var3 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
HashMap<String, Object> var4 = new HashMap<>();
|
||||
OnlComplexModel var5 = this.onlineService.queryOnlineConfig(var3);
|
||||
@@ -1177,13 +1177,13 @@ public class OnlCgformApiController {
|
||||
module = ModuleType.ONLINE
|
||||
)
|
||||
@GetMapping({"/getErpFormItem/{code}"})
|
||||
public Result<JSONObject> e(@PathVariable("code") String var1) {
|
||||
public Results<JSONObject> e(@PathVariable("code") String var1) {
|
||||
OnlCgformHead var3 = this.onlCgformHeadService.getById(var1);
|
||||
if (var3 == null) {
|
||||
return Result.error("表不存在");
|
||||
return Results.error("表不存在");
|
||||
}
|
||||
|
||||
Result<JSONObject> var4 = new Result<>();
|
||||
Results<JSONObject> var4 = new Results<>();
|
||||
JSONObject var5 = this.onlineService.queryOnlineFormObj(var3);
|
||||
var4.setResult(var5);
|
||||
var4.setOnlTable(var3.getTableName());
|
||||
@@ -1191,8 +1191,8 @@ public class OnlCgformApiController {
|
||||
}
|
||||
|
||||
@GetMapping({"/querySelectOptions"})
|
||||
public Result<List<TreeModel>> a(@ModelAttribute LinkDown var1) {
|
||||
Result<List<TreeModel>> var2 = new Result<>();
|
||||
public Results<List<TreeModel>> a(@ModelAttribute LinkDown var1) {
|
||||
Results<List<TreeModel>> var2 = new Results<>();
|
||||
List<TreeModel> var3 = this.onlCgformFieldService.queryDataListByLinkDown(var1);
|
||||
var2.setResult(var3);
|
||||
var2.setSuccess(true);
|
||||
|
||||
+24
-24
@@ -7,7 +7,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformButton;
|
||||
import com.jero.generater.modules.online.cgform.service.IOnlCgformButtonService;
|
||||
@@ -33,8 +33,8 @@ public class OnlCgformButtonController {
|
||||
|
||||
|
||||
@GetMapping({"/list/{code}"})
|
||||
public Result<IPage<OnlCgformButton>> list(OnlCgformButton var1, @RequestParam(name = "pageNo",defaultValue = "1") Integer var2, @RequestParam(name = "pageSize",defaultValue = "10") Integer var3, HttpServletRequest var4, @PathVariable("code") String var5) {
|
||||
Result<IPage<OnlCgformButton>> var6 = new Result<>();
|
||||
public Results<IPage<OnlCgformButton>> list(OnlCgformButton var1, @RequestParam(name = "pageNo",defaultValue = "1") Integer var2, @RequestParam(name = "pageSize",defaultValue = "10") Integer var3, HttpServletRequest var4, @PathVariable("code") String var5) {
|
||||
Results<IPage<OnlCgformButton>> var6 = new Results<>();
|
||||
var1.setCgformHeadId(var5);
|
||||
QueryWrapper<OnlCgformButton> var7 = QueryGenerator.initQueryWrapper(var1, var4.getParameterMap());
|
||||
Page<OnlCgformButton> var8 = new Page<>(var2, var3);
|
||||
@@ -45,83 +45,83 @@ public class OnlCgformButtonController {
|
||||
}
|
||||
|
||||
@PostMapping({"/add"})
|
||||
public Result<Object> add(@RequestBody OnlCgformButton cgformButton) {
|
||||
public Results<Object> add(@RequestBody OnlCgformButton cgformButton) {
|
||||
try {
|
||||
this.onlCgformButtonService.save(cgformButton);
|
||||
return Result.OK(OP_SUCCESS);
|
||||
return Results.OK(OP_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/aitest"})
|
||||
public Result<Object> aitest(@RequestBody JSONArray jsonArray) {
|
||||
public Results<Object> aitest(@RequestBody JSONArray jsonArray) {
|
||||
try {
|
||||
for(int i = 0; i < jsonArray.size(); ++i) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
OnlCgformButton cgformButton = JSON.parseObject(jsonObject.toJSONString(), OnlCgformButton.class);
|
||||
this.onlCgformButtonService.saveButton(cgformButton);
|
||||
}
|
||||
return Result.OK(OP_SUCCESS);
|
||||
return Results.OK(OP_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/edit"})
|
||||
public Result<Object> edit(@RequestBody OnlCgformButton cgformButton) {
|
||||
public Results<Object> edit(@RequestBody OnlCgformButton cgformButton) {
|
||||
OnlCgformButton existCgformButton = this.onlCgformButtonService.getById(cgformButton.getId());
|
||||
if (existCgformButton == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
boolean flag = this.onlCgformButtonService.updateById(cgformButton);
|
||||
if (flag) {
|
||||
return Result.OK(OP_SUCCESS);
|
||||
return Results.OK(OP_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
@PostMapping({"/delete"})
|
||||
public Result<Object> delete(@RequestBody Map<String,String> map) {
|
||||
public Results<Object> delete(@RequestBody Map<String,String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isEmpty(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
OnlCgformButton cgformButton = this.onlCgformButtonService.getById(id);
|
||||
if (cgformButton == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
boolean flag = this.onlCgformButtonService.removeById(id);
|
||||
if (flag) {
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
@PostMapping({"/deleteBatch"})
|
||||
public Result<Object> deleteBatch(@RequestBody Map<String,String> map) {
|
||||
public Results<Object> deleteBatch(@RequestBody Map<String,String> map) {
|
||||
String ids = map.get("ids");
|
||||
if (ids != null && !"".equals(ids.trim())) {
|
||||
this.onlCgformButtonService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
} else {
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/queryById"})
|
||||
public Result<OnlCgformButton> queryById(@RequestParam(name = "id",required = true) String id) {
|
||||
public Results<OnlCgformButton> queryById(@RequestParam(name = "id",required = true) String id) {
|
||||
OnlCgformButton cgformButton = this.onlCgformButtonService.getById(id);
|
||||
if (cgformButton == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
return Result.OK(cgformButton);
|
||||
return Results.OK(cgformButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-24
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformHead;
|
||||
@@ -32,25 +32,25 @@ public class OnlCgformFieldController {
|
||||
private static final String EN_IS_NULL = "未找到对应实体";
|
||||
|
||||
@GetMapping({"/listByHeadCode"})
|
||||
public Result<List<OnlCgformField>> a(@RequestParam("headCode") String var1) {
|
||||
public Results<List<OnlCgformField>> a(@RequestParam("headCode") String var1) {
|
||||
LambdaQueryWrapper<OnlCgformHead> var2 = new LambdaQueryWrapper<>();
|
||||
var2.eq(OnlCgformHead::getTableName, var1);
|
||||
OnlCgformHead var3 = this.onlCgformHeadService.getOne(var2);
|
||||
return var3 == null ? Result.error("不存在的code") : this.b(var3.getId());
|
||||
return var3 == null ? Results.error("不存在的code") : this.b(var3.getId());
|
||||
}
|
||||
|
||||
@GetMapping({"/listByHeadId"})
|
||||
public Result<List<OnlCgformField>> b(@RequestParam("headId") String var1) {
|
||||
public Results<List<OnlCgformField>> b(@RequestParam("headId") String var1) {
|
||||
QueryWrapper<OnlCgformField> var2 = new QueryWrapper<>();
|
||||
var2.eq("cgform_head_id", var1);
|
||||
var2.orderByAsc("order_num");
|
||||
List<OnlCgformField> var3 = this.onlCgformFieldService.list(var2);
|
||||
return Result.OK(var3);
|
||||
return Results.OK(var3);
|
||||
}
|
||||
|
||||
@GetMapping({"/list"})
|
||||
public Result<IPage<OnlCgformField>> a(OnlCgformField var1, @RequestParam(name = "pageNo",defaultValue = "1") Integer var2, @RequestParam(name = "pageSize",defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
||||
Result<IPage<OnlCgformField>> var5 = new Result<>();
|
||||
public Results<IPage<OnlCgformField>> a(OnlCgformField var1, @RequestParam(name = "pageNo",defaultValue = "1") Integer var2, @RequestParam(name = "pageSize",defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
||||
Results<IPage<OnlCgformField>> var5 = new Results<>();
|
||||
QueryWrapper<OnlCgformField> var6 = QueryGenerator.initQueryWrapper(var1, var4.getParameterMap());
|
||||
Page<OnlCgformField> var7 = new Page<>(var2, var3);
|
||||
IPage<OnlCgformField> var8 = this.onlCgformFieldService.page(var7, var6);
|
||||
@@ -60,64 +60,64 @@ public class OnlCgformFieldController {
|
||||
}
|
||||
|
||||
@PostMapping({"/add"})
|
||||
public Result<Object> add(@RequestBody OnlCgformField var1) {
|
||||
public Results<Object> add(@RequestBody OnlCgformField var1) {
|
||||
try {
|
||||
this.onlCgformFieldService.save(var1);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
} catch (Exception var4) {
|
||||
log.error(var4.getMessage(), var4);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/edit"})
|
||||
public Result<Object> edit(@RequestBody OnlCgformField var1) {
|
||||
public Results<Object> edit(@RequestBody OnlCgformField var1) {
|
||||
OnlCgformField var3 = this.onlCgformFieldService.getById(var1.getId());
|
||||
if (var3 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
boolean var4 = this.onlCgformFieldService.updateById(var1);
|
||||
if (var4) {
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
@PostMapping({"/delete"})
|
||||
public Result<Object> delete(@RequestBody Map<String,String> map) {
|
||||
public Results<Object> delete(@RequestBody Map<String,String> map) {
|
||||
String var1 = map.get("id");
|
||||
OnlCgformField var3 = this.onlCgformFieldService.getById(var1);
|
||||
if (var3 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
boolean var4 = this.onlCgformFieldService.removeById(var1);
|
||||
if (var4) {
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
@PostMapping({"/deleteBatch"})
|
||||
public Result<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String var1 = map.get("ids");
|
||||
if (var1 != null && !"".equals(var1.trim())) {
|
||||
this.onlCgformFieldService.removeByIds(Arrays.asList(var1.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
} else {
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/queryById"})
|
||||
public Result<Object> queryById(@RequestParam(name = "id",required = true) String var1) {
|
||||
public Results<Object> queryById(@RequestParam(name = "id",required = true) String var1) {
|
||||
OnlCgformField var3 = this.onlCgformFieldService.getById(var1);
|
||||
if (var3 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
return Result.OK(var3);
|
||||
return Results.OK(var3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+96
-96
@@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.codegenerate.database.DbReadTableUtil;
|
||||
import com.jero.codegenerate.properties.CodeConfigProperties;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.enums.CgformEnum;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.util.JwtUtil;
|
||||
@@ -61,8 +61,8 @@ public class OnlCgformHeadController {
|
||||
|
||||
|
||||
@GetMapping({"/list"})
|
||||
public Result<IPage<OnlCgformHead>> a(OnlCgformHead var1, @RequestParam(name = "pageNo", defaultValue = "1") Integer var2, @RequestParam(name = "pageSize", defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
||||
Result<IPage<OnlCgformHead>> var5 = new Result<>();
|
||||
public Results<IPage<OnlCgformHead>> a(OnlCgformHead var1, @RequestParam(name = "pageNo", defaultValue = "1") Integer var2, @RequestParam(name = "pageSize", defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
||||
Results<IPage<OnlCgformHead>> var5 = new Results<>();
|
||||
QueryWrapper<OnlCgformHead> var6 = QueryGenerator.initQueryWrapper(var1, var4.getParameterMap());
|
||||
Page<OnlCgformHead> var7 = new Page<>(var2, var3);
|
||||
IPage<OnlCgformHead> var8 = this.onlCgformHeadService.page(var7, var6);
|
||||
@@ -76,295 +76,295 @@ public class OnlCgformHeadController {
|
||||
}
|
||||
|
||||
@PostMapping({"/add"})
|
||||
public Result<Object> add(@RequestBody OnlCgformHead var1) {
|
||||
public Results<Object> add(@RequestBody OnlCgformHead var1) {
|
||||
try {
|
||||
this.onlCgformHeadService.save(var1);
|
||||
return Result.OK(OP_SUCCESS);
|
||||
return Results.OK(OP_SUCCESS);
|
||||
} catch (Exception var4) {
|
||||
log.error(var4.getMessage(), var4);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/edit"})
|
||||
public Result<Object> edit(@RequestBody OnlCgformHead var1) {
|
||||
public Results<Object> edit(@RequestBody OnlCgformHead var1) {
|
||||
OnlCgformHead var3 = this.onlCgformHeadService.getById(var1.getId());
|
||||
if (var3 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
boolean var4 = this.onlCgformHeadService.updateById(var1);
|
||||
if (var4) {
|
||||
return Result.OK(OP_SUCCESS);
|
||||
return Results.OK(OP_SUCCESS);
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
@PostMapping({"/delete"})
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if (id == null || "".equals(id.trim())) {
|
||||
return Result.error(PARAM_ERROR);
|
||||
return Results.error(PARAM_ERROR);
|
||||
}
|
||||
try {
|
||||
this.onlCgformHeadService.deleteRecordAndTable(id);
|
||||
} catch (DBException | SQLException e) {
|
||||
return Result.error("删除失败" + e.getMessage());
|
||||
return Results.error("删除失败" + e.getMessage());
|
||||
}
|
||||
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
|
||||
@PostMapping({"/removeRecord"})
|
||||
public Result<T> removeRecord(@RequestBody Map<String, String> map) {
|
||||
public Results<T> removeRecord(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if (id == null || "".equals(id.trim())) {
|
||||
return Result.error(PARAM_ERROR);
|
||||
return Results.error(PARAM_ERROR);
|
||||
}
|
||||
try {
|
||||
this.onlCgformHeadService.deleteRecord(id);
|
||||
} catch (DBException | SQLException e) {
|
||||
return Result.error("移除失败" + e.getMessage());
|
||||
return Results.error("移除失败" + e.getMessage());
|
||||
}
|
||||
|
||||
return Result.OK("移除成功!");
|
||||
return Results.OK("移除成功!");
|
||||
}
|
||||
|
||||
@PostMapping({"/deleteBatch"})
|
||||
public Result<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String var1 = map.get("ids");
|
||||
String var2 = map.get("flag");
|
||||
if (var2 == null || "".equals(var2.trim())) {
|
||||
return Result.error(PARAM_ERROR);
|
||||
return Results.error(PARAM_ERROR);
|
||||
}
|
||||
if (var1 != null && !"".equals(var1.trim())) {
|
||||
this.onlCgformHeadService.deleteBatch(var1, var2);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
} else {
|
||||
return Result.error(PARAM_ERROR);
|
||||
return Results.error(PARAM_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/queryById"})
|
||||
public Result<OnlCgformHead> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
public Results<OnlCgformHead> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
OnlCgformHead cgformHead = this.onlCgformHeadService.getById(id);
|
||||
if (cgformHead == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
return Result.OK(cgformHead);
|
||||
return Results.OK(cgformHead);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GetMapping({"/queryByTableNames"})
|
||||
public Result<List<OnlCgformHead>> queryByTableNames(@RequestParam(name = "tableNames", required = true) String var1) {
|
||||
public Results<List<OnlCgformHead>> queryByTableNames(@RequestParam(name = "tableNames", required = true) String var1) {
|
||||
LambdaQueryWrapper<OnlCgformHead> var2 = new LambdaQueryWrapper<>();
|
||||
String[] var3 = var1.split(",");
|
||||
var2.in(OnlCgformHead::getTableName, Arrays.asList(var3));
|
||||
List<OnlCgformHead> var4 = this.onlCgformHeadService.list(var2);
|
||||
return var4 == null ? Result.error(EN_IS_NULL) : Result.OK(var4);
|
||||
return var4 == null ? Results.error(EN_IS_NULL) : Results.OK(var4);
|
||||
}
|
||||
|
||||
@PostMapping({"/addEnhanceJs/{code}"})
|
||||
public Result<T> addEnhanceJs(@PathVariable("code") String var1, @RequestBody OnlCgformEnhanceJs var2) {
|
||||
public Results<T> addEnhanceJs(@PathVariable("code") String var1, @RequestBody OnlCgformEnhanceJs var2) {
|
||||
try {
|
||||
var2.setCgformHeadId(var1);
|
||||
this.onlCgformHeadService.saveEnhance(var2);
|
||||
return Result.OK(OP_SUCCESS);
|
||||
return Results.OK(OP_SUCCESS);
|
||||
} catch (Exception var4) {
|
||||
log.error(var4.getMessage(), var4);
|
||||
return Result.error(SAVE_ERROR);
|
||||
return Results.error(SAVE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/enhanceJs/{code}"})
|
||||
public Result<OnlCgformEnhanceJs> getEnhanceJs(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
public Results<OnlCgformEnhanceJs> getEnhanceJs(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
try {
|
||||
String var3 = var2.getParameter("type");
|
||||
OnlCgformEnhanceJs var4 = this.onlCgformHeadService.queryEnhance(var1, var3);
|
||||
return var4 == null ? Result.error("查询为空") : Result.OK(var4);
|
||||
return var4 == null ? Results.error("查询为空") : Results.OK(var4);
|
||||
} catch (Exception var5) {
|
||||
log.error(var5.getMessage(), var5);
|
||||
return Result.error("查询失败!");
|
||||
return Results.error("查询失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/enhanceJs/{code}"})
|
||||
public Result<T> editEnhanceJs(@PathVariable("code") String var1, @RequestBody OnlCgformEnhanceJs var2) {
|
||||
public Results<T> editEnhanceJs(@PathVariable("code") String var1, @RequestBody OnlCgformEnhanceJs var2) {
|
||||
try {
|
||||
var2.setCgformHeadId(var1);
|
||||
this.onlCgformHeadService.editEnhance(var2);
|
||||
return Result.OK(OP_SUCCESS);
|
||||
return Results.OK(OP_SUCCESS);
|
||||
} catch (Exception var4) {
|
||||
log.error(var4.getMessage(), var4);
|
||||
return Result.error(SAVE_ERROR);
|
||||
return Results.error(SAVE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/enhanceButton/{formId}"})
|
||||
public Result<List<OnlCgformButton>> getEnhanceButton(@PathVariable("formId") String var1, HttpServletRequest var2) {
|
||||
public Results<List<OnlCgformButton>> getEnhanceButton(@PathVariable("formId") String var1, HttpServletRequest var2) {
|
||||
try {
|
||||
List<OnlCgformButton> var3 = this.onlCgformHeadService.queryButtonList(var1);
|
||||
return var3 != null && !var3.isEmpty() ? Result.OK(var3) : Result.error("查询为空");
|
||||
return var3 != null && !var3.isEmpty() ? Results.OK(var3) : Results.error("查询为空");
|
||||
} catch (Exception var4) {
|
||||
log.error(var4.getMessage(), var4);
|
||||
return Result.error("查询失败!");
|
||||
return Results.error("查询失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/enhanceSql/{formId}"})
|
||||
public Result<List<OnlCgformEnhanceSql>> getEnhanceSql(@PathVariable("formId") String var1, HttpServletRequest var2) {
|
||||
public Results<List<OnlCgformEnhanceSql>> getEnhanceSql(@PathVariable("formId") String var1, HttpServletRequest var2) {
|
||||
List<OnlCgformEnhanceSql> var3 = this.onlCgformEnhanceService.queryEnhanceSqlList(var1);
|
||||
return Result.OK(var3);
|
||||
return Results.OK(var3);
|
||||
}
|
||||
|
||||
@RequiresRoles({"admin"})
|
||||
@PostMapping({"/addEnhanceSql/{formId}"})
|
||||
public Result<T> addEnhanceSql(@PathVariable("formId") String var1, @RequestBody OnlCgformEnhanceSql var2) {
|
||||
public Results<T> addEnhanceSql(@PathVariable("formId") String var1, @RequestBody OnlCgformEnhanceSql var2) {
|
||||
try {
|
||||
var2.setCgformHeadId(var1);
|
||||
if (this.onlCgformEnhanceService.checkOnlyEnhance(var2)) {
|
||||
this.onlCgformEnhanceService.saveEnhanceSql(var2);
|
||||
return Result.OK(OP_SUCCESS);
|
||||
return Results.OK(OP_SUCCESS);
|
||||
} else {
|
||||
return Result.error("保存失败,该按钮已存在增强配置!");
|
||||
return Results.error("保存失败,该按钮已存在增强配置!");
|
||||
}
|
||||
} catch (Exception var4) {
|
||||
log.error(var4.getMessage(), var4);
|
||||
return Result.error(SAVE_ERROR);
|
||||
return Results.error(SAVE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresRoles({"admin"})
|
||||
@PostMapping({"/enhanceSql/{formId}"})
|
||||
public Result<T> editEnhanceSql(@PathVariable("formId") String var1, @RequestBody OnlCgformEnhanceSql var2) {
|
||||
public Results<T> editEnhanceSql(@PathVariable("formId") String var1, @RequestBody OnlCgformEnhanceSql var2) {
|
||||
try {
|
||||
var2.setCgformHeadId(var1);
|
||||
if (this.onlCgformEnhanceService.checkOnlyEnhance(var2)) {
|
||||
this.onlCgformEnhanceService.updateEnhanceSql(var2);
|
||||
return Result.OK(OP_SUCCESS);
|
||||
return Results.OK(OP_SUCCESS);
|
||||
} else {
|
||||
return Result.error("保存失败,该按钮已存在增强配置!");
|
||||
return Results.error("保存失败,该按钮已存在增强配置!");
|
||||
}
|
||||
} catch (Exception var4) {
|
||||
log.error(var4.getMessage(), var4);
|
||||
return Result.error(SAVE_ERROR);
|
||||
return Results.error(SAVE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/enhanceSql"})
|
||||
public Result<T> deletenhanceSql(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deletenhanceSql(@RequestBody Map<String, String> map) {
|
||||
String var1 = map.get("id");
|
||||
if (StringUtils.isBlank(var1)) {
|
||||
return Result.error(PARAM_ERROR);
|
||||
return Results.error(PARAM_ERROR);
|
||||
}
|
||||
try {
|
||||
this.onlCgformEnhanceService.deleteEnhanceSql(var1);
|
||||
return Result.OK("删除成功");
|
||||
return Results.OK("删除成功");
|
||||
} catch (Exception var3) {
|
||||
log.error(var3.getMessage(), var3);
|
||||
return Result.error(DEL_ERROR);
|
||||
return Results.error(DEL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/deletebatchEnhanceSql"})
|
||||
public Result<T> deletebatchEnhanceSql(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deletebatchEnhanceSql(@RequestBody Map<String, String> map) {
|
||||
String var1 = map.get("ids");
|
||||
if (StringUtils.isBlank(var1)) {
|
||||
return Result.error(PARAM_ERROR);
|
||||
return Results.error(PARAM_ERROR);
|
||||
}
|
||||
try {
|
||||
List<String> var2 = Arrays.asList(var1.split(","));
|
||||
this.onlCgformEnhanceService.deleteBatchEnhanceSql(var2);
|
||||
return Result.OK("删除成功");
|
||||
return Results.OK("删除成功");
|
||||
} catch (Exception var3) {
|
||||
log.error(var3.getMessage(), var3);
|
||||
return Result.error(DEL_ERROR);
|
||||
return Results.error(DEL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/enhanceJava/{formId}"})
|
||||
public Result<List<OnlCgformEnhanceJava>> getEnhanceJava(@PathVariable("formId") String formId, OnlCgformEnhanceJava var2) {
|
||||
public Results<List<OnlCgformEnhanceJava>> getEnhanceJava(@PathVariable("formId") String formId, OnlCgformEnhanceJava var2) {
|
||||
List<OnlCgformEnhanceJava> var3 = this.onlCgformEnhanceService.queryEnhanceJavaList(formId);
|
||||
return Result.OK(var3);
|
||||
return Results.OK(var3);
|
||||
}
|
||||
|
||||
@PostMapping({"/addEnhanceJava/{formId}"})
|
||||
public Result<T> addEnhanceJava(@PathVariable("formId") String formId, @RequestBody OnlCgformEnhanceJava var2) {
|
||||
public Results<T> addEnhanceJava(@PathVariable("formId") String formId, @RequestBody OnlCgformEnhanceJava var2) {
|
||||
try {
|
||||
if (!CgformUtil.a(var2)) {
|
||||
return Result.error("类实例化失败,请检查!");
|
||||
return Results.error("类实例化失败,请检查!");
|
||||
} else {
|
||||
var2.setCgformHeadId(formId);
|
||||
if (this.onlCgformEnhanceService.checkOnlyEnhance(var2)) {
|
||||
this.onlCgformEnhanceService.saveEnhanceJava(var2);
|
||||
return Result.OK(OP_SUCCESS);
|
||||
return Results.OK(OP_SUCCESS);
|
||||
} else {
|
||||
return Result.error("保存失败,配置重复了!");
|
||||
return Results.error("保存失败,配置重复了!");
|
||||
}
|
||||
}
|
||||
} catch (Exception var4) {
|
||||
log.error(var4.getMessage(), var4);
|
||||
return Result.error(SAVE_ERROR);
|
||||
return Results.error(SAVE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/enhanceJava/{formId}"})
|
||||
public Result<T> c(@PathVariable("formId") String var1, @RequestBody OnlCgformEnhanceJava var2) {
|
||||
public Results<T> c(@PathVariable("formId") String var1, @RequestBody OnlCgformEnhanceJava var2) {
|
||||
try {
|
||||
if (!CgformUtil.a(var2)) {
|
||||
return Result.error("类实例化失败,请检查!");
|
||||
return Results.error("类实例化失败,请检查!");
|
||||
} else {
|
||||
var2.setCgformHeadId(var1);
|
||||
if (this.onlCgformEnhanceService.checkOnlyEnhance(var2)) {
|
||||
this.onlCgformEnhanceService.updateEnhanceJava(var2);
|
||||
return Result.OK(OP_SUCCESS);
|
||||
return Results.OK(OP_SUCCESS);
|
||||
} else {
|
||||
return Result.error("保存失败,配置重复了!");
|
||||
return Results.error("保存失败,配置重复了!");
|
||||
}
|
||||
}
|
||||
} catch (Exception var4) {
|
||||
log.error(var4.getMessage(), var4);
|
||||
return Result.error(SAVE_ERROR);
|
||||
return Results.error(SAVE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/enhanceJava"})
|
||||
public Result<T> g(@RequestBody Map<String, String> map) {
|
||||
public Results<T> g(@RequestBody Map<String, String> map) {
|
||||
String var1 = map.get("id");
|
||||
if (StringUtils.isBlank(var1)) {
|
||||
return Result.error(PARAM_ERROR);
|
||||
return Results.error(PARAM_ERROR);
|
||||
}
|
||||
try {
|
||||
this.onlCgformEnhanceService.deleteEnhanceJava(var1);
|
||||
return Result.OK("删除成功");
|
||||
return Results.OK("删除成功");
|
||||
} catch (Exception var3) {
|
||||
log.error(var3.getMessage(), var3);
|
||||
return Result.error(DEL_ERROR);
|
||||
return Results.error(DEL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/deleteBatchEnhanceJava"})
|
||||
public Result<T> h(@RequestBody Map<String, String> map) {
|
||||
public Results<T> h(@RequestBody Map<String, String> map) {
|
||||
String var1 = map.get("ids");
|
||||
if (StringUtils.isBlank(var1)) {
|
||||
return Result.error(PARAM_ERROR);
|
||||
return Results.error(PARAM_ERROR);
|
||||
}
|
||||
try {
|
||||
List<String> var2 = Arrays.asList(var1.split(","));
|
||||
this.onlCgformEnhanceService.deleteBatchEnhanceJava(var2);
|
||||
return Result.OK("删除成功");
|
||||
return Results.OK("删除成功");
|
||||
} catch (Exception var3) {
|
||||
log.error(var3.getMessage(), var3);
|
||||
return Result.error(DEL_ERROR);
|
||||
return Results.error(DEL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/queryTables"})
|
||||
public Result<ArrayList<HashMap<String,String>>> a(@RequestParam(name = "tableName", required = false) String var1, @RequestParam(name = "pageNo", defaultValue = "1") Integer var2, @RequestParam(name = "pageSize", defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
||||
public Results<ArrayList<HashMap<String,String>>> a(@RequestParam(name = "tableName", required = false) String var1, @RequestParam(name = "pageNo", defaultValue = "1") Integer var2, @RequestParam(name = "pageSize", defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
||||
String var5 = JwtUtil.getUserNameByToken(var4);
|
||||
if (!"admin".equals(var5)) {
|
||||
return Result.error("noadminauth");
|
||||
return Results.error("noadminauth");
|
||||
} else {
|
||||
new ArrayList<>();
|
||||
|
||||
@@ -373,7 +373,7 @@ public class OnlCgformHeadController {
|
||||
var6 = DbReadTableUtil.listTableName();
|
||||
} catch (SQLException var12) {
|
||||
log.error(var12.getMessage(), var12);
|
||||
return Result.error("同步失败,未获取数据库表信息");
|
||||
return Results.error("同步失败,未获取数据库表信息");
|
||||
}
|
||||
|
||||
CgformUtil.b(var6);
|
||||
@@ -391,20 +391,20 @@ public class OnlCgformHeadController {
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK(var8);
|
||||
return Results.OK(var8);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/transTables/{tbnames}"})
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<T> d(@PathVariable("tbnames") String var1, HttpServletRequest var2) {
|
||||
public Results<T> d(@PathVariable("tbnames") String var1, HttpServletRequest var2) {
|
||||
String var3 = JwtUtil.getUserNameByToken(var2);
|
||||
if (!"admin".equals(var3)) {
|
||||
return Result.error("noadminauth");
|
||||
return Results.error("noadminauth");
|
||||
} else if (oConvertUtils.isEmpty(var1)) {
|
||||
return Result.error("未识别的表名信息");
|
||||
return Results.error("未识别的表名信息");
|
||||
} else if (c != null && c.equals(var1)) {
|
||||
return Result.error("不允许重复生成!");
|
||||
return Results.error("不允许重复生成!");
|
||||
} else {
|
||||
c = var1;
|
||||
String[] var4 = var1.split(",");
|
||||
@@ -420,7 +420,7 @@ public class OnlCgformHeadController {
|
||||
}
|
||||
|
||||
c = null;
|
||||
return Result.OK("同步完成!");
|
||||
return Results.OK("同步完成!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ public class OnlCgformHeadController {
|
||||
* @date 2021/4/6 11:20
|
||||
*/
|
||||
@GetMapping({"/rootFile"})
|
||||
public Result<JSONArray> rootFile() {
|
||||
public Results<JSONArray> rootFile() {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
File[] files = File.listRoots();
|
||||
int var4 = files.length;
|
||||
@@ -453,7 +453,7 @@ public class OnlCgformHeadController {
|
||||
jsonArray.add(jsonObject);
|
||||
}
|
||||
|
||||
return Result.OK(jsonArray);
|
||||
return Results.OK(jsonArray);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -464,7 +464,7 @@ public class OnlCgformHeadController {
|
||||
* @date 2021/4/6 11:20
|
||||
*/
|
||||
@GetMapping({"/fileTree"})
|
||||
public Result<JSONArray> fileTree(@RequestParam(name = "parentPath", required = true) String parentPath) {
|
||||
public Results<JSONArray> fileTree(@RequestParam(name = "parentPath", required = true) String parentPath) {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
File file = new File(parentPath);
|
||||
File[] files = file.listFiles();
|
||||
@@ -486,14 +486,14 @@ public class OnlCgformHeadController {
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK(jsonArray);
|
||||
return Results.OK(jsonArray);
|
||||
}
|
||||
|
||||
@GetMapping({"/tableInfo"})
|
||||
public Result<HashMap<String, Object>> tableInfo(@RequestParam(name = "code", required = true) String code) {
|
||||
public Results<HashMap<String, Object>> tableInfo(@RequestParam(name = "code", required = true) String code) {
|
||||
OnlCgformHead onlCgformHead = this.onlCgformHeadService.getById(code);
|
||||
if (onlCgformHead == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("main", onlCgformHead);
|
||||
@@ -507,7 +507,7 @@ public class OnlCgformHeadController {
|
||||
List<Map<String, Object>> jspModelList = CgformEnum.getJspModelList(tableType);
|
||||
map.put("jspModeList", jspModelList);
|
||||
map.put("projectPath", CodeConfigProperties.getProjectPath());
|
||||
return Result.OK(map);
|
||||
return Results.OK(map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -546,11 +546,11 @@ public class OnlCgformHeadController {
|
||||
}
|
||||
|
||||
@PostMapping({"/copyOnline"})
|
||||
public Result<T> k(@RequestParam(name = "code", required = true) String var1) {
|
||||
public Results<T> k(@RequestParam(name = "code", required = true) String var1) {
|
||||
try {
|
||||
OnlCgformHead var2 = this.onlCgformHeadService.getById(var1);
|
||||
if (var2 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
}
|
||||
|
||||
this.onlCgformHeadService.copyOnlineTableConfig(var2);
|
||||
@@ -558,7 +558,7 @@ public class OnlCgformHeadController {
|
||||
var3.printStackTrace();
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
private boolean l(String var1) {
|
||||
|
||||
+26
-26
@@ -3,7 +3,7 @@ package com.jero.generater.modules.online.cgform.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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformIndex;
|
||||
@@ -29,89 +29,89 @@ public class OnlCgformIndexController {
|
||||
private static final String EN_IS_NULL = "未找到对应实体";
|
||||
|
||||
@GetMapping({"/listByHeadId"})
|
||||
public Result<List<OnlCgformIndex>> listByHeadId(@RequestParam("headId") String headId) {
|
||||
public Results<List<OnlCgformIndex>> listByHeadId(@RequestParam("headId") String headId) {
|
||||
QueryWrapper<OnlCgformIndex> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("cgform_head_id", headId);
|
||||
queryWrapper.eq("del_flag", CommonConstant.DEL_FLAG_0);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
List<OnlCgformIndex> cgformIndexList = this.onlCgformIndexService.list(queryWrapper);
|
||||
return Result.OK(cgformIndexList);
|
||||
return Results.OK(cgformIndexList);
|
||||
}
|
||||
|
||||
@GetMapping({"/list"})
|
||||
public Result<IPage<OnlCgformIndex>> list(OnlCgformIndex cgformIndex,
|
||||
@RequestParam(name = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
public Results<IPage<OnlCgformIndex>> list(OnlCgformIndex cgformIndex,
|
||||
@RequestParam(name = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
QueryWrapper<OnlCgformIndex> queryWrapper = QueryGenerator.initQueryWrapper(cgformIndex, request.getParameterMap());
|
||||
Page<OnlCgformIndex> page = new Page<>(pageNo, pageSize);
|
||||
IPage<OnlCgformIndex> cgformIndexPage = this.onlCgformIndexService.page(page, queryWrapper);
|
||||
return Result.OK(cgformIndexPage);
|
||||
return Results.OK(cgformIndexPage);
|
||||
}
|
||||
|
||||
@PostMapping({"/add"})
|
||||
public Result<Object> add(@RequestBody OnlCgformIndex cgformIndex) {
|
||||
public Results<Object> add(@RequestBody OnlCgformIndex cgformIndex) {
|
||||
try {
|
||||
this.onlCgformIndexService.save(cgformIndex);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/edit"})
|
||||
public Result<Object> edit(@RequestBody OnlCgformIndex cgformIndex) {
|
||||
public Results<Object> edit(@RequestBody OnlCgformIndex cgformIndex) {
|
||||
OnlCgformIndex existCgformIndex = this.onlCgformIndexService.getById(cgformIndex.getId());
|
||||
if (existCgformIndex == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
boolean flag = this.onlCgformIndexService.updateById(cgformIndex);
|
||||
if (flag) {
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
@PostMapping({"/delete"})
|
||||
public Result<Object> delete(@RequestBody Map<String,String> map) {
|
||||
public Results<Object> delete(@RequestBody Map<String,String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
OnlCgformIndex cgformIndex = this.onlCgformIndexService.getById(id);
|
||||
if (cgformIndex == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
boolean flag = this.onlCgformIndexService.removeById(id);
|
||||
if (flag) {
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
@PostMapping({"/deleteBatch"})
|
||||
public Result<Object> deleteBatch(@RequestBody Map<String,String> map) {
|
||||
public Results<Object> deleteBatch(@RequestBody Map<String,String> map) {
|
||||
String ids = map.get("ids");
|
||||
if (ids != null && !"".equals(ids.trim())) {
|
||||
this.onlCgformIndexService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
} else {
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/queryById"})
|
||||
public Result<OnlCgformIndex> queryById(@RequestParam(name = "id",required = true) String var1) {
|
||||
public Results<OnlCgformIndex> queryById(@RequestParam(name = "id",required = true) String var1) {
|
||||
OnlCgformIndex cgformIndex = this.onlCgformIndexService.getById(var1);
|
||||
if (cgformIndex == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
return Result.OK(cgformIndex);
|
||||
return Results.OK(cgformIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@ package com.jero.generater.modules.online.cgform.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.generater.modules.online.cgform.entity.*;
|
||||
import com.jero.generater.modules.online.cgform.model.OnlCgformModel;
|
||||
@@ -21,9 +21,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IOnlCgformHeadService extends IService<OnlCgformHead> {
|
||||
Result<T> addAll(OnlCgformModel var1);
|
||||
Results<T> addAll(OnlCgformModel var1);
|
||||
|
||||
Result<T> editAll(OnlCgformModel var1);
|
||||
Results<T> editAll(OnlCgformModel var1);
|
||||
|
||||
void doDbSynch(String var1, String var2) throws HibernateException, IOException, TemplateException, SQLException, DBException;
|
||||
|
||||
|
||||
+6
-6
@@ -13,7 +13,7 @@ import com.jero.codegenerate.generate.pojo.ColumnVo;
|
||||
import com.jero.codegenerate.generate.pojo.TableVo;
|
||||
import com.jero.codegenerate.generate.pojo.onetomany.MainTableVo;
|
||||
import com.jero.codegenerate.generate.pojo.onetomany.SubTableVo;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.constant.enums.CgformEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
@@ -93,7 +93,7 @@ public class OnlCgformHeadServiceImpl extends ServiceImpl<OnlCgformHeadMapper, O
|
||||
@Transactional(
|
||||
rollbackFor = {Exception.class}
|
||||
)
|
||||
public Result<T> addAll(OnlCgformModel model) {
|
||||
public Results<T> addAll(OnlCgformModel model) {
|
||||
String var2 = UUID.randomUUID().toString().replace("-", "");
|
||||
OnlCgformHead var3 = model.getHead();
|
||||
List<OnlCgformField> var4 = model.getFields();
|
||||
@@ -128,21 +128,21 @@ public class OnlCgformHeadServiceImpl extends ServiceImpl<OnlCgformHeadMapper, O
|
||||
this.fieldService.saveBatch(var4);
|
||||
this.indexService.saveBatch(var5);
|
||||
this.a(var3, var4);
|
||||
return Result.OK("添加成功");
|
||||
return Results.OK("添加成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(
|
||||
rollbackFor = {Exception.class}
|
||||
)
|
||||
public Result<T> editAll(OnlCgformModel model) {
|
||||
public Results<T> editAll(OnlCgformModel model) {
|
||||
OnlCgformHead var2 = model.getHead();
|
||||
OnlCgformHead var3 = super.getById(var2.getId());
|
||||
if (var3 == null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
} else {
|
||||
getIsDbSynch(model, var2, var3);
|
||||
return Result.OK("全部修改成功");
|
||||
return Results.OK("全部修改成功");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+30
-30
@@ -6,7 +6,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.aspect.annotation.PermissionData;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
@@ -75,18 +75,18 @@ public class OnlCgreportAPI {
|
||||
|
||||
@GetMapping({"/getColumnsAndData/{code}"})
|
||||
@PermissionData
|
||||
public Result<Map<String, Object>> a(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
public Results<Map<String, Object>> a(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
OnlCgreportHead var3 = this.onlCgreportHeadService.getById(var1);
|
||||
if (var3 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
return getMapResult(var1, var2, var3);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Result<Map<String, Object>> getMapResult(@PathVariable("code") String var1, HttpServletRequest var2, OnlCgreportHead var3) {
|
||||
Result<Map<String, Object>> var4 = this.b(var1, var2);
|
||||
private Results<Map<String, Object>> getMapResult(@PathVariable("code") String var1, HttpServletRequest var2, OnlCgreportHead var3) {
|
||||
Results<Map<String, Object>> var4 = this.b(var1, var2);
|
||||
if (var4.getCode().equals(200)) {
|
||||
JSONObject var5 = JSON.parseObject(JSON.toJSONString(var4.getResult()));
|
||||
JSONArray var6 = var5.getJSONArray("records");
|
||||
@@ -138,7 +138,7 @@ public class OnlCgreportAPI {
|
||||
var19.put("fieldHrefSlots", var10);
|
||||
var19.put("cgreportHeadName", var3.getName());
|
||||
var19.put("isGroupTitle", var12);
|
||||
return Result.OK(var19);
|
||||
return Results.OK(var19);
|
||||
} else {
|
||||
return var4;
|
||||
}
|
||||
@@ -197,10 +197,10 @@ public class OnlCgreportAPI {
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
@GetMapping({"/getColumns/{code}"})
|
||||
public Result<Map<String,Object>> a(@PathVariable("code") String var1) {
|
||||
public Results<Map<String,Object>> a(@PathVariable("code") String var1) {
|
||||
OnlCgreportHead var2 = this.onlCgreportHeadService.getById(var1);
|
||||
if (var2 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
QueryWrapper<OnlCgreportItem> var3 = new QueryWrapper<>();
|
||||
var3.eq(CGR_HEAD_ID, var1);
|
||||
@@ -232,7 +232,7 @@ public class OnlCgreportAPI {
|
||||
var14.put(COLUMNS, var5);
|
||||
var14.put(DICT_OPTIONS, var6);
|
||||
var14.put("cgreportHeadName", var2.getName());
|
||||
return Result.OK(var14);
|
||||
return Results.OK(var14);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,10 +253,10 @@ public class OnlCgreportAPI {
|
||||
|
||||
@GetMapping({"/getData/{code}"})
|
||||
@PermissionData
|
||||
public Result<Map<String, Object>> b(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
public Results<Map<String, Object>> b(@PathVariable("code") String var1, HttpServletRequest var2) {
|
||||
OnlCgreportHead var3 = this.onlCgreportHeadService.getById(var1);
|
||||
if (var3 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
String var4 = var3.getCgrSql().trim();
|
||||
String var5 = var3.getDbSource();
|
||||
@@ -273,35 +273,35 @@ public class OnlCgreportAPI {
|
||||
var7 = this.onlCgreportHeadService.executeSelectSql(var4, var3.getId(), var6);
|
||||
}
|
||||
|
||||
return Result.OK(var7);
|
||||
return Results.OK(var7);
|
||||
} catch (Exception var8) {
|
||||
log.error(var8.getMessage(), var8);
|
||||
return Result.error("SQL执行失败:" + var8.getMessage());
|
||||
return Results.error("SQL执行失败:" + var8.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/getQueryInfo/{code}"})
|
||||
public Result<List<Map<String, String>>> b(@PathVariable("code") String var1) {
|
||||
public Results<List<Map<String, String>>> b(@PathVariable("code") String var1) {
|
||||
try {
|
||||
List<Map<String, String>> var2 = this.onlCgreportItemService.getAutoListQueryInfo(var1);
|
||||
return Result.OK(var2);
|
||||
return Results.OK(var2);
|
||||
} catch (Exception var3) {
|
||||
log.info(var3.getMessage(), var3);
|
||||
return Result.error("查询失败");
|
||||
return Results.error("查询失败");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/getParamsInfo/{code}"})
|
||||
public Result<List<OnlCgreportParam>> c(@PathVariable("code") String var1) {
|
||||
public Results<List<OnlCgreportParam>> c(@PathVariable("code") String var1) {
|
||||
try {
|
||||
LambdaQueryWrapper<OnlCgreportParam> var2 = new LambdaQueryWrapper<>();
|
||||
var2.eq(OnlCgreportParam::getCgrheadId, var1);
|
||||
List<OnlCgreportParam> var3 = this.onlCgreportParamService.list(var2);
|
||||
return Result.OK(var3);
|
||||
return Results.OK(var3);
|
||||
} catch (Exception var4) {
|
||||
log.info(var4.getMessage(), var4);
|
||||
return Result.error("查询失败");
|
||||
return Results.error("查询失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ public class OnlCgreportAPI {
|
||||
|
||||
List<Map<String, Object>> var7 = (List)var6.get("items");
|
||||
var2.setAttribute(GET_ALL, true);
|
||||
Result<Map<String, Object>> var8 = this.b(var1, var2);
|
||||
Results<Map<String, Object>> var8 = this.b(var1, var2);
|
||||
List<Map<String, Object>> var9 = null;
|
||||
if (var8.getCode().equals(200)) {
|
||||
Map<String, Object> var10 = var8.getResult();
|
||||
@@ -481,12 +481,12 @@ public class OnlCgreportAPI {
|
||||
}
|
||||
|
||||
@GetMapping({"/getRpColumns/{code}"})
|
||||
public Result<Map<String,Object>> d(@PathVariable("code") String var1) {
|
||||
public Results<Map<String,Object>> d(@PathVariable("code") String var1) {
|
||||
LambdaQueryWrapper<OnlCgreportHead> var2 = new LambdaQueryWrapper<>();
|
||||
var2.eq(OnlCgreportHead::getCode, var1);
|
||||
OnlCgreportHead var3 = this.onlCgreportHeadService.getOne(var2);
|
||||
if (var3 == null) {
|
||||
return Result.error(EN_IS_NULL);
|
||||
return Results.error(EN_IS_NULL);
|
||||
} else {
|
||||
QueryWrapper<OnlCgreportItem> var4 = new QueryWrapper<>();
|
||||
var4.eq(CGR_HEAD_ID, var3.getId());
|
||||
@@ -521,29 +521,29 @@ public class OnlCgreportAPI {
|
||||
var14.put(DICT_OPTIONS, var7);
|
||||
var14.put("cgRpConfigId", var3.getId());
|
||||
var14.put("cgRpConfigName", var3.getName());
|
||||
return Result.OK(var14);
|
||||
return Results.OK(var14);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/testConnection"})
|
||||
public Result<String> a(@RequestBody DynamicDataSourceModel var1) {
|
||||
Result<String> var4;
|
||||
public Results<String> a(@RequestBody DynamicDataSourceModel var1) {
|
||||
Results<String> var4;
|
||||
try (Connection var2 = DriverManager.getConnection(var1.getDbUrl(), var1.getDbUsername(), var1.getDbPassword())){
|
||||
Class.forName(var1.getDbDriver());
|
||||
Result<String> var3;
|
||||
Results<String> var3;
|
||||
if (var2 == null) {
|
||||
var3 = Result.OK("数据库连接失败:错误未知");
|
||||
var3 = Results.OK("数据库连接失败:错误未知");
|
||||
return var3;
|
||||
}
|
||||
|
||||
var3 = Result.OK("数据库连接成功");
|
||||
var3 = Results.OK("数据库连接成功");
|
||||
return var3;
|
||||
} catch (ClassNotFoundException var17) {
|
||||
log.error(var17.toString());
|
||||
var4 = Result.error("数据库连接失败:驱动类不存在");
|
||||
var4 = Results.error("数据库连接失败:驱动类不存在");
|
||||
} catch (Exception var18) {
|
||||
log.error(var18.toString());
|
||||
var4 = Result.error("数据库连接失败:" + var18.getMessage());
|
||||
var4 = Results.error("数据库连接失败:" + var18.getMessage());
|
||||
return var4;
|
||||
}
|
||||
return var4;
|
||||
|
||||
+18
-18
@@ -4,7 +4,7 @@ package com.jero.generater.modules.online.cgreport.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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.vo.DynamicDataSourceModel;
|
||||
@@ -43,11 +43,11 @@ public class OnlCgreportHeadController {
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
@GetMapping({"/parseSql"})
|
||||
public Result<Map<String, Object>> a(@RequestParam(name = "sql") String var1, @RequestParam(name = "dbKey",required = false) String var2) {
|
||||
public Results<Map<String, Object>> a(@RequestParam(name = "sql") String var1, @RequestParam(name = "dbKey",required = false) String var2) {
|
||||
if (StringUtils.isNotBlank(var2)) {
|
||||
DynamicDataSourceModel var3 = this.sysBaseAPI.getDynamicDbSourceByCode(var2);
|
||||
if (var3 == null) {
|
||||
return Result.error("数据源不存在");
|
||||
return Results.error("数据源不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class OnlCgreportHeadController {
|
||||
|
||||
var13.put("fields", var4);
|
||||
var13.put("params", var5);
|
||||
return Result.OK(var13);
|
||||
return Results.OK(var13);
|
||||
} catch (Exception var12) {
|
||||
log.error(var12.getMessage(), var12);
|
||||
String var9 = "解析失败,";
|
||||
@@ -108,13 +108,13 @@ public class OnlCgreportHeadController {
|
||||
var9 = var9 + "SQL语法错误.";
|
||||
}
|
||||
|
||||
return Result.error(var9);
|
||||
return Results.error(var9);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/list"})
|
||||
public Result<IPage<OnlCgreportHead>> a(OnlCgreportHead var1, @RequestParam(name = "pageNo",defaultValue = "1") Integer var2, @RequestParam(name = "pageSize",defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
||||
Result<IPage<OnlCgreportHead>> var5 = new Result<>();
|
||||
public Results<IPage<OnlCgreportHead>> a(OnlCgreportHead var1, @RequestParam(name = "pageNo",defaultValue = "1") Integer var2, @RequestParam(name = "pageSize",defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
||||
Results<IPage<OnlCgreportHead>> var5 = new Results<>();
|
||||
QueryWrapper<OnlCgreportHead> var6 = QueryGenerator.initQueryWrapper(var1, var4.getParameterMap());
|
||||
Page<OnlCgreportHead> var7 = new Page<>(var2, var3);
|
||||
IPage<OnlCgreportHead> var8 = this.onlCgreportHeadService.page(var7, var6);
|
||||
@@ -124,7 +124,7 @@ public class OnlCgreportHeadController {
|
||||
}
|
||||
|
||||
@PostMapping({"/add"})
|
||||
public Result<String> add(@RequestBody OnlCgreportModel var1) {
|
||||
public Results<String> add(@RequestBody OnlCgreportModel var1) {
|
||||
try {
|
||||
String var3 = CgformUtil.a();
|
||||
OnlCgreportHead var4 = var1.getHead();
|
||||
@@ -150,44 +150,44 @@ public class OnlCgreportHeadController {
|
||||
this.onlCgreportHeadService.save(var4);
|
||||
this.onlCgreportParamService.saveBatch(var5);
|
||||
this.onlCgreportItemService.saveBatch(var6);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
} catch (Exception var9) {
|
||||
log.error(var9.getMessage(), var9);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/editAll"})
|
||||
public Result<String> editAll(@RequestBody OnlCgreportModel cgreportModel) {
|
||||
public Results<String> editAll(@RequestBody OnlCgreportModel cgreportModel) {
|
||||
try {
|
||||
return this.onlCgreportHeadService.editAll(cgreportModel);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/delete"})
|
||||
public Result<String> delete(@RequestBody Map<String,String> map) {
|
||||
public Results<String> delete(@RequestBody Map<String,String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
return this.onlCgreportHeadService.delete(id);
|
||||
}
|
||||
|
||||
@PostMapping({"/deleteBatch"})
|
||||
public Result<String> deleteBatch(@RequestBody Map<String,String> map) {
|
||||
public Results<String> deleteBatch(@RequestBody Map<String,String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
return this.onlCgreportHeadService.bathDelete(ids.split(","));
|
||||
}
|
||||
|
||||
@GetMapping({"/queryById"})
|
||||
public Result<OnlCgreportHead> queryById(@RequestParam(name = "id",required = true) String id) {
|
||||
Result<OnlCgreportHead> result = new Result<>();
|
||||
public Results<OnlCgreportHead> queryById(@RequestParam(name = "id",required = true) String id) {
|
||||
Results<OnlCgreportHead> result = new Results<>();
|
||||
OnlCgreportHead cgreportHead = this.onlCgreportHeadService.getById(id);
|
||||
result.setResult(cgreportHead);
|
||||
return result;
|
||||
|
||||
+17
-17
@@ -4,7 +4,7 @@ package com.jero.generater.modules.online.cgreport.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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportItem;
|
||||
import com.jero.generater.modules.online.cgreport.service.IOnlCgreportItemService;
|
||||
@@ -27,20 +27,20 @@ public class OnlCgreportItemController {
|
||||
private IOnlCgreportItemService onlCgreportItemService;
|
||||
|
||||
@GetMapping({"/listByHeadId"})
|
||||
public Result<List<OnlCgreportItem>> a(@RequestParam("headId") String var1) {
|
||||
public Results<List<OnlCgreportItem>> a(@RequestParam("headId") String var1) {
|
||||
QueryWrapper<OnlCgreportItem> var2 = new QueryWrapper<>();
|
||||
var2.eq("cgrhead_id", var1);
|
||||
var2.orderByAsc("order_num");
|
||||
List<OnlCgreportItem> var3 = this.onlCgreportItemService.list(var2);
|
||||
Result<List<OnlCgreportItem>> var4 = new Result<>();
|
||||
Results<List<OnlCgreportItem>> var4 = new Results<>();
|
||||
var4.setSuccess(true);
|
||||
var4.setResult(var3);
|
||||
return var4;
|
||||
}
|
||||
|
||||
@GetMapping({"/list"})
|
||||
public Result<IPage<OnlCgreportItem>> a(OnlCgreportItem var1, @RequestParam(name = "pageNo",defaultValue = "1") Integer var2, @RequestParam(name = "pageSize",defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
||||
Result<IPage<OnlCgreportItem>> var5 = new Result<>();
|
||||
public Results<IPage<OnlCgreportItem>> a(OnlCgreportItem var1, @RequestParam(name = "pageNo",defaultValue = "1") Integer var2, @RequestParam(name = "pageSize",defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
||||
Results<IPage<OnlCgreportItem>> var5 = new Results<>();
|
||||
QueryWrapper<OnlCgreportItem> var6 = QueryGenerator.initQueryWrapper(var1, var4.getParameterMap());
|
||||
Page<OnlCgreportItem> var7 = new Page<>(var2, var3);
|
||||
IPage<OnlCgreportItem> var8 = this.onlCgreportItemService.page(var7, var6);
|
||||
@@ -50,40 +50,40 @@ public class OnlCgreportItemController {
|
||||
}
|
||||
|
||||
@PostMapping({"/add"})
|
||||
public Result<String> a(@RequestBody OnlCgreportItem var1) {
|
||||
public Results<String> a(@RequestBody OnlCgreportItem var1) {
|
||||
this.onlCgreportItemService.save(var1);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
@PostMapping({"/edit"})
|
||||
public Result<String> b(@RequestBody OnlCgreportItem var1) {
|
||||
public Results<String> b(@RequestBody OnlCgreportItem var1) {
|
||||
this.onlCgreportItemService.updateById(var1);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
@PostMapping({"/delete"})
|
||||
public Result<String> b(@RequestBody Map<String,String> map) {
|
||||
public Results<String> b(@RequestBody Map<String,String> map) {
|
||||
String var1 = map.get("id");
|
||||
if(StringUtils.isEmpty(var1)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.onlCgreportItemService.removeById(var1);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
|
||||
@PostMapping({"/deleteBatch"})
|
||||
public Result<String> c(@RequestBody Map<String,String> map) {
|
||||
public Results<String> c(@RequestBody Map<String,String> map) {
|
||||
String var1 = map.get("ids");
|
||||
if(StringUtils.isBlank(var1)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.onlCgreportItemService.removeByIds(Arrays.asList(var1.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
return Results.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@GetMapping({"/queryById"})
|
||||
public Result<OnlCgreportItem> d(@RequestParam(name = "id",required = true) String var1) {
|
||||
Result<OnlCgreportItem> var2 = new Result<>();
|
||||
public Results<OnlCgreportItem> d(@RequestParam(name = "id",required = true) String var1) {
|
||||
Results<OnlCgreportItem> var2 = new Results<>();
|
||||
OnlCgreportItem var3 = this.onlCgreportItemService.getById(var1);
|
||||
var2.setResult(var3);
|
||||
var2.setSuccess(true);
|
||||
|
||||
+17
-17
@@ -4,7 +4,7 @@ package com.jero.generater.modules.online.cgreport.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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportParam;
|
||||
import com.jero.generater.modules.online.cgreport.service.IOnlCgreportParamService;
|
||||
@@ -28,20 +28,20 @@ public class OnlCgreportParamController {
|
||||
|
||||
|
||||
@GetMapping({"/listByHeadId"})
|
||||
public Result<List<OnlCgreportParam>> a(@RequestParam("headId") String var1) {
|
||||
public Results<List<OnlCgreportParam>> a(@RequestParam("headId") String var1) {
|
||||
QueryWrapper<OnlCgreportParam> var2 = new QueryWrapper<>();
|
||||
var2.eq("cgrhead_id", var1);
|
||||
var2.orderByAsc("order_num");
|
||||
List<OnlCgreportParam> var3 = this.onlCgreportParamService.list(var2);
|
||||
Result<List<OnlCgreportParam>> var4 = new Result<>();
|
||||
Results<List<OnlCgreportParam>> var4 = new Results<>();
|
||||
var4.setSuccess(true);
|
||||
var4.setResult(var3);
|
||||
return var4;
|
||||
}
|
||||
|
||||
@GetMapping({"/list"})
|
||||
public Result<IPage<OnlCgreportParam>> a(OnlCgreportParam var1, @RequestParam(name = "pageNo", defaultValue = "1") Integer var2, @RequestParam(name = "pageSize", defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
||||
Result<IPage<OnlCgreportParam>> var5 = new Result<>();
|
||||
public Results<IPage<OnlCgreportParam>> a(OnlCgreportParam var1, @RequestParam(name = "pageNo", defaultValue = "1") Integer var2, @RequestParam(name = "pageSize", defaultValue = "10") Integer var3, HttpServletRequest var4) {
|
||||
Results<IPage<OnlCgreportParam>> var5 = new Results<>();
|
||||
QueryWrapper<OnlCgreportParam> var6 = QueryGenerator.initQueryWrapper(var1, var4.getParameterMap());
|
||||
Page<OnlCgreportParam> var7 = new Page<>(var2, var3);
|
||||
IPage<OnlCgreportParam> var8 = this.onlCgreportParamService.page(var7, var6);
|
||||
@@ -51,40 +51,40 @@ public class OnlCgreportParamController {
|
||||
}
|
||||
|
||||
@PostMapping({"/add"})
|
||||
public Result<String> a(@RequestBody OnlCgreportParam var1) {
|
||||
public Results<String> a(@RequestBody OnlCgreportParam var1) {
|
||||
this.onlCgreportParamService.save(var1);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
@PostMapping({"/edit"})
|
||||
public Result<String> b(@RequestBody OnlCgreportParam var1) {
|
||||
public Results<String> b(@RequestBody OnlCgreportParam var1) {
|
||||
this.onlCgreportParamService.updateById(var1);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
@PostMapping({"/delete"})
|
||||
public Result<Object> b(@RequestBody Map<String, String> map) {
|
||||
public Results<Object> b(@RequestBody Map<String, String> map) {
|
||||
String var1 = map.get("id");
|
||||
if(StringUtils.isBlank(var1)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.onlCgreportParamService.removeById(var1);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
|
||||
@PostMapping({"/deleteBatch"})
|
||||
public Result<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String var1 = map.get("ids");
|
||||
if(StringUtils.isBlank(var1)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.onlCgreportParamService.removeByIds(Arrays.asList(var1.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
return Results.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@GetMapping({"/queryById"})
|
||||
public Result<OnlCgreportParam> d(@RequestParam(name = "id", required = true) String var1) {
|
||||
Result<OnlCgreportParam> var2 = new Result<>();
|
||||
public Results<OnlCgreportParam> d(@RequestParam(name = "id", required = true) String var1) {
|
||||
Results<OnlCgreportParam> var2 = new Results<>();
|
||||
OnlCgreportParam var3 = this.onlCgreportParamService.getById(var1);
|
||||
var2.setResult(var3);
|
||||
return var2;
|
||||
|
||||
+4
-4
@@ -5,16 +5,16 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportHead;
|
||||
import com.jero.generater.modules.online.cgreport.model.OnlCgreportModel;
|
||||
|
||||
public interface IOnlCgreportHeadService extends IService<OnlCgreportHead> {
|
||||
Result<String> editAll(OnlCgreportModel var1);
|
||||
Results<String> editAll(OnlCgreportModel var1);
|
||||
|
||||
Result<String> delete(String var1);
|
||||
Results<String> delete(String var1);
|
||||
|
||||
Result<String> bathDelete(String[] var1);
|
||||
Results<String> bathDelete(String[] var1);
|
||||
|
||||
Map<String, Object> executeSelectSql(String var1, String var2, Map<String, Object> var3) throws SQLException;
|
||||
|
||||
|
||||
+8
-8
@@ -12,9 +12,9 @@ import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.jero.common.api.vo.Results;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
@@ -209,11 +209,11 @@ public class OnlCgreportHeadServiceImpl extends ServiceImpl<OnlCgreportHeadMappe
|
||||
@Transactional(
|
||||
rollbackFor = {Exception.class}
|
||||
)
|
||||
public Result<String> editAll(OnlCgreportModel values) {
|
||||
public Results<String> editAll(OnlCgreportModel values) {
|
||||
OnlCgreportHead var2 = values.getHead();
|
||||
OnlCgreportHead var3 = super.getById(var2.getId());
|
||||
if (var3 == null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
} else {
|
||||
super.updateById(var2);
|
||||
LambdaQueryWrapper<OnlCgreportItem> var4 = new LambdaQueryWrapper<>();
|
||||
@@ -238,7 +238,7 @@ public class OnlCgreportHeadServiceImpl extends ServiceImpl<OnlCgreportHeadMappe
|
||||
|
||||
this.onlCgreportItemService.saveBatch(values.getItems());
|
||||
this.onlCgreportParamService.saveBatch(values.getParams());
|
||||
return Result.OK("全部修改成功");
|
||||
return Results.OK("全部修改成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ public class OnlCgreportHeadServiceImpl extends ServiceImpl<OnlCgreportHeadMappe
|
||||
@Transactional(
|
||||
rollbackFor = {Exception.class}
|
||||
)
|
||||
public Result<String> delete(String id) {
|
||||
public Results<String> delete(String id) {
|
||||
boolean var2 = super.removeById(id);
|
||||
if (var2) {
|
||||
LambdaQueryWrapper<OnlCgreportItem> var3 = new LambdaQueryWrapper<>();
|
||||
@@ -257,14 +257,14 @@ public class OnlCgreportHeadServiceImpl extends ServiceImpl<OnlCgreportHeadMappe
|
||||
this.onlCgreportParamService.remove(var4);
|
||||
}
|
||||
|
||||
return Result.OK("删除成功");
|
||||
return Results.OK("删除成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(
|
||||
rollbackFor = {Exception.class}
|
||||
)
|
||||
public Result<String> bathDelete(String[] ids) {
|
||||
public Results<String> bathDelete(String[] ids) {
|
||||
String[] var2 = ids;
|
||||
int var3 = ids.length;
|
||||
|
||||
@@ -281,7 +281,7 @@ public class OnlCgreportHeadServiceImpl extends ServiceImpl<OnlCgreportHeadMappe
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK("删除成功");
|
||||
return Results.OK("删除成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.jero.modules.demo.cloud.provider;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.modules.demo.cloud.service.JcloudDemoService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -20,7 +20,7 @@ public class JcloudDemoProvider {
|
||||
private JcloudDemoService jcloudDemoService;
|
||||
|
||||
@GetMapping("/getMessage")
|
||||
public Result<String> getMessage(@RequestParam String name) {
|
||||
public Results<String> getMessage(@RequestParam String name) {
|
||||
return jcloudDemoService.getMessage(name);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.jero.modules.demo.cloud.service;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
|
||||
public interface JcloudDemoService {
|
||||
Result<String> getMessage(String name);
|
||||
Results<String> getMessage(String name);
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
package com.jero.modules.demo.cloud.service.impl;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.modules.demo.cloud.service.JcloudDemoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class JcloudDemoServiceImpl implements JcloudDemoService {
|
||||
@Override
|
||||
public Result<String> getMessage(String name) {
|
||||
return Result.OK("Hello," + name);
|
||||
public Results<String> getMessage(String name) {
|
||||
return Results.OK("Hello," + name);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
package com.jero.modules.demo.mock;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -120,8 +120,8 @@ public class MockController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryDiskInfo")
|
||||
public Result<List<Map<String,Object>>> queryDiskInfo(HttpServletRequest request, HttpServletResponse response){
|
||||
Result<List<Map<String,Object>>> res = new Result<>();
|
||||
public Results<List<Map<String,Object>>> queryDiskInfo(HttpServletRequest request, HttpServletResponse response){
|
||||
Results<List<Map<String,Object>>> res = new Results<>();
|
||||
try {
|
||||
// 当前文件系统类
|
||||
FileSystemView fsv = FileSystemView.getFileSystemView();
|
||||
@@ -145,7 +145,7 @@ public class MockController {
|
||||
res.setResult(list);
|
||||
res.setMessage("查询成功");
|
||||
} catch (Exception e) {
|
||||
return Result.error("查询失败"+e.getMessage());
|
||||
return Results.error("查询失败"+e.getMessage());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
+19
-19
@@ -6,10 +6,10 @@ import com.alibaba.fastjson.JSONObject;
|
||||
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.jero.common.api.vo.Results;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.VXESocketConst;
|
||||
import com.jero.common.system.query.MatchTypeEnum;
|
||||
import com.jero.common.system.query.QueryCondition;
|
||||
@@ -40,7 +40,7 @@ public class VxeMockController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/change1")
|
||||
public Result<T> mockChange1(@RequestParam("id") String id, @RequestParam("status") String status) {
|
||||
public Results<T> mockChange1(@RequestParam("id") String id, @RequestParam("status") String status) {
|
||||
/* id 为 行的id(rowId),只要获取到rowId,那么只需要调用 VXESocket.sendMessageToAll() 即可 */
|
||||
|
||||
// 封装行数据
|
||||
@@ -52,7 +52,7 @@ public class VxeMockController {
|
||||
// 模拟更改数据
|
||||
this.mockChange(rowData);
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ public class VxeMockController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/change2")
|
||||
public Result<T> mockChange2(@RequestParam("id") String id, @RequestParam("tug_status") String tug_status) {
|
||||
public Results<T> mockChange2(@RequestParam("id") String id, @RequestParam("tug_status") String tug_status) {
|
||||
/* id 为 行的id(rowId),只要获取到rowId,那么只需要调用 VXESocket.sendMessageToAll() 即可 */
|
||||
|
||||
// 封装行数据
|
||||
@@ -76,7 +76,7 @@ public class VxeMockController {
|
||||
// 模拟更改数据
|
||||
this.mockChange(rowData);
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ public class VxeMockController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/change3")
|
||||
public Result<T> mockChange3(@RequestParam("id") String id, @RequestParam("progress") String progress) {
|
||||
public Results<T> mockChange3(@RequestParam("id") String id, @RequestParam("progress") String progress) {
|
||||
/* id 为 行的id(rowId),只要获取到rowId,那么只需要调用 VXESocket.sendMessageToAll() 即可 */
|
||||
|
||||
// 封装行数据
|
||||
@@ -99,7 +99,7 @@ public class VxeMockController {
|
||||
// 模拟更改数据
|
||||
this.mockChange(rowData);
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
private void mockChange(JSONObject rowData) {
|
||||
@@ -123,7 +123,7 @@ public class VxeMockController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/change4")
|
||||
public Result<T> mockChange4(@RequestParam("status") String status) {
|
||||
public Results<T> mockChange4(@RequestParam("status") String status) {
|
||||
// 封装socket数据
|
||||
JSONObject socketData = new JSONObject();
|
||||
// 这里的 key 是前端注册时使用的key,必须保持一致
|
||||
@@ -136,7 +136,7 @@ public class VxeMockController {
|
||||
// 调用 sendMessageToAll 发送给所有在线的用户
|
||||
VXESocket.sendMessageToAll(message);
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,11 +145,11 @@ public class VxeMockController {
|
||||
* @param rowData 行数据,实际使用时可以替换成一个实体类
|
||||
*/
|
||||
@PostMapping ("/immediateSaveRow")
|
||||
public Result<T> mockImmediateSaveRow(@RequestBody JSONObject rowData) throws InterruptedException {
|
||||
public Results<T> mockImmediateSaveRow(@RequestBody JSONObject rowData) throws InterruptedException {
|
||||
log.info("即时保存.rowData:" + rowData.toJSONString());
|
||||
// 延时1.5秒,模拟网慢堵塞真实感
|
||||
Thread.sleep(500);
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,7 +158,7 @@ public class VxeMockController {
|
||||
* @param tableData 表格数据(实际使用时可以替换成一个List实体类)
|
||||
*/
|
||||
@PostMapping("/immediateSaveAll")
|
||||
public Result<T> mockImmediateSaveAll(@RequestBody JSONArray tableData) throws InterruptedException {
|
||||
public Results<T> mockImmediateSaveAll(@RequestBody JSONArray tableData) throws InterruptedException {
|
||||
// 【注】:
|
||||
// 1、tableData里包含该页所有的数据
|
||||
// 2、如果你实现了“即时保存”,那么除了新增的数据,其他的都是已经保存过的了,
|
||||
@@ -169,7 +169,7 @@ public class VxeMockController {
|
||||
log.info("即时保存.tableData:" + tableData.toJSONString());
|
||||
// 延时1.5秒,模拟网慢堵塞真实感
|
||||
Thread.sleep(1000);
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,7 +181,7 @@ public class VxeMockController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getData")
|
||||
public Result<IPage<JSONObject>> getMockData(
|
||||
public Results<IPage<JSONObject>> getMockData(
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
// 父级id,根据父级id查询子级,如果为空则查询顶级
|
||||
@@ -192,10 +192,10 @@ public class VxeMockController {
|
||||
// 读取JSON数据
|
||||
JSONArray dataList = readJsonData(path);
|
||||
if (dataList == null) {
|
||||
return Result.error("读取数据失败!");
|
||||
return Results.error("读取数据失败!");
|
||||
}
|
||||
IPage<JSONObject> page = this.queryDataPage(dataList, parentId, pageNo, pageSize);
|
||||
return Result.OK(page);
|
||||
return Results.OK(page);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,7 +207,7 @@ public class VxeMockController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getDdjhData")
|
||||
public Result<IPage<JSONObject>> getMockDdjhData(
|
||||
public Results<IPage<JSONObject>> getMockDdjhData(
|
||||
// SpringMVC 会自动将参数注入到实体里
|
||||
MockEntity mockEntity,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@@ -268,13 +268,13 @@ public class VxeMockController {
|
||||
// 读取JSON数据
|
||||
JSONArray dataList = readJsonData(path);
|
||||
if (dataList == null) {
|
||||
return Result.error("读取数据失败!");
|
||||
return Results.error("读取数据失败!");
|
||||
}
|
||||
|
||||
IPage<JSONObject> page = this.queryDataPage(dataList, parentId, pageNo, pageSize);
|
||||
List<JSONObject> records = getJsonObjects(dataList, page);
|
||||
page.setRecords(records);
|
||||
return Result.OK(page);
|
||||
return Results.OK(page);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+25
-25
@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.aspect.annotation.PermissionData;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
@@ -57,8 +57,8 @@ public class JeroDemoController extends JeroController<JeroDemo, IJeroDemoServic
|
||||
@ApiOperation(value = "获取Demo数据列表", notes = "获取所有Demo数据列表")
|
||||
@GetMapping(value = "/list")
|
||||
@PermissionData(pageComponent = "jero/JeroDemoList")
|
||||
public Result<IPage<JeroDemo>> list(JeroDemo jeroDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
public Results<IPage<JeroDemo>> list(JeroDemo jeroDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<JeroDemo> queryWrapper = QueryGenerator.initQueryWrapper(jeroDemo, req.getParameterMap());
|
||||
Page<JeroDemo> page = new Page<>(pageNo, pageSize);
|
||||
|
||||
@@ -67,7 +67,7 @@ public class JeroDemoController extends JeroController<JeroDemo, IJeroDemoServic
|
||||
log.info("查询当前页数量:" + pageList.getSize());
|
||||
log.info("查询结果数量:" + pageList.getRecords().size());
|
||||
log.info("数据总数:" + pageList.getTotal());
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,9 +79,9 @@ public class JeroDemoController extends JeroController<JeroDemo, IJeroDemoServic
|
||||
@PostMapping(value = "/add")
|
||||
@AutoLog(value = "添加测试DEMO")
|
||||
@ApiOperation(value = "添加DEMO", notes = "添加DEMO")
|
||||
public Result<T> add(@RequestBody JeroDemo jeroDemo) {
|
||||
public Results<T> add(@RequestBody JeroDemo jeroDemo) {
|
||||
JeroDemoService.save(jeroDemo);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,9 +93,9 @@ public class JeroDemoController extends JeroController<JeroDemo, IJeroDemoServic
|
||||
@PostMapping(value = "/edit")
|
||||
@ApiOperation(value = "编辑DEMO", notes = "编辑DEMO")
|
||||
@AutoLog(value = "编辑DEMO", operateType = CommonConstant.OPERATE_TYPE_3)
|
||||
public Result<T> edit(@RequestBody JeroDemo jeroDemo) {
|
||||
public Results<T> edit(@RequestBody JeroDemo jeroDemo) {
|
||||
JeroDemoService.updateById(jeroDemo);
|
||||
return Result.OK("更新成功!");
|
||||
return Results.OK("更新成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,13 +107,13 @@ public class JeroDemoController extends JeroController<JeroDemo, IJeroDemoServic
|
||||
@AutoLog(value = "删除测试DEMO")
|
||||
@PostMapping(value = "/delete")
|
||||
@ApiOperation(value = "通过ID删除DEMO", notes = "通过ID删除DEMO")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
JeroDemoService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,13 +124,13 @@ public class JeroDemoController extends JeroController<JeroDemo, IJeroDemoServic
|
||||
*/
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
@ApiOperation(value = "批量删除DEMO", notes = "批量删除DEMO")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.JeroDemoService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
return Results.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,9 +141,9 @@ public class JeroDemoController extends JeroController<JeroDemo, IJeroDemoServic
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
@ApiOperation(value = "通过ID查询DEMO", notes = "通过ID查询DEMO")
|
||||
public Result<JeroDemo> queryById(@ApiParam(name = "id", value = "示例id", required = true) @RequestParam(name = "id", required = true) String id) {
|
||||
public Results<JeroDemo> queryById(@ApiParam(name = "id", value = "示例id", required = true) @RequestParam(name = "id", required = true) String id) {
|
||||
JeroDemo jeroDemo = JeroDemoService.getById(id);
|
||||
return Result.OK(jeroDemo);
|
||||
return Results.OK(jeroDemo);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,7 +168,7 @@ public class JeroDemoController extends JeroController<JeroDemo, IJeroDemoServic
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<JeroDemo> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<JeroDemo> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, JeroDemo.class);
|
||||
}
|
||||
|
||||
@@ -245,9 +245,9 @@ public class JeroDemoController extends JeroController<JeroDemo, IJeroDemoServic
|
||||
|
||||
// ==========================================动态表单 JSON接收测试===========================================
|
||||
@PostMapping(value = "/testOnlineAdd")
|
||||
public Result<T> testOnlineAdd(@RequestBody JSONObject json) {
|
||||
public Results<T> testOnlineAdd(@RequestBody JSONObject json) {
|
||||
log.info(json.toJSONString());
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/*----------------------------------------外部获取权限示例------------------------------------*/
|
||||
@@ -262,14 +262,14 @@ public class JeroDemoController extends JeroController<JeroDemo, IJeroDemoServic
|
||||
*/
|
||||
@GetMapping(value = "/mpList")
|
||||
@PermissionData(pageComponent = "jero/JeroDemoList")
|
||||
public Result<IPage<JeroDemo>> loadMpPermissonList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
public Results<IPage<JeroDemo>> loadMpPermissonList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<JeroDemo> queryWrapper = new QueryWrapper<JeroDemo>();
|
||||
//编程方式,给queryWrapper装载数据权限规则
|
||||
QueryGenerator.installAuthMplus(queryWrapper, JeroDemo.class);
|
||||
Page<JeroDemo> page = new Page<JeroDemo>(pageNo, pageSize);
|
||||
IPage<JeroDemo> pageList = JeroDemoService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,9 +283,9 @@ public class JeroDemoController extends JeroController<JeroDemo, IJeroDemoServic
|
||||
*/
|
||||
@GetMapping(value = "/sqlList")
|
||||
@PermissionData(pageComponent = "jero/JeroDemoList")
|
||||
public Result<IPage<JeroDemo>> loadSqlPermissonList(JeroDemo jeroDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
public Results<IPage<JeroDemo>> loadSqlPermissonList(JeroDemo jeroDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
IPage<JeroDemo> pageList = JeroDemoService.queryListWithPermission(pageSize, pageNo);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
}
|
||||
|
||||
+23
-23
@@ -3,7 +3,7 @@ package com.jero.modules.demo.test.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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
@@ -65,11 +65,11 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<JeroOrderMain>> queryPageList(JeroOrderMain jeroOrderMain, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
public Results<IPage<JeroOrderMain>> queryPageList(JeroOrderMain jeroOrderMain, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
QueryWrapper<JeroOrderMain> queryWrapper = QueryGenerator.initQueryWrapper(jeroOrderMain, req.getParameterMap());
|
||||
Page<JeroOrderMain> page = new Page<>(pageNo, pageSize);
|
||||
IPage<JeroOrderMain> pageList = jeroOrderMainService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,11 +79,11 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@RequestBody JeroOrderMainPage jeroOrderMainPage) {
|
||||
public Results<T> add(@RequestBody JeroOrderMainPage jeroOrderMainPage) {
|
||||
JeroOrderMain jeroOrderMain = new JeroOrderMain();
|
||||
BeanUtils.copyProperties(jeroOrderMainPage, jeroOrderMain);
|
||||
jeroOrderMainService.saveMain(jeroOrderMain, jeroOrderMainPage.getJeroOrderCustomerList(), jeroOrderMainPage.getJeroOrderTicketList());
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,11 +93,11 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> eidt(@RequestBody JeroOrderMainPage jeroOrderMainPage) {
|
||||
public Results<T> eidt(@RequestBody JeroOrderMainPage jeroOrderMainPage) {
|
||||
JeroOrderMain jeroOrderMain = new JeroOrderMain();
|
||||
BeanUtils.copyProperties(jeroOrderMainPage, jeroOrderMain);
|
||||
jeroOrderMainService.updateCopyMain(jeroOrderMain, jeroOrderMainPage.getJeroOrderCustomerList(), jeroOrderMainPage.getJeroOrderTicketList());
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,13 +107,13 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
jeroOrderMainService.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,13 +123,13 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.jeroOrderMainService.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
return Results.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,9 +139,9 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<JeroOrderMain> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
public Results<JeroOrderMain> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
JeroOrderMain jeroOrderMain = jeroOrderMainService.getById(id);
|
||||
return Result.OK(jeroOrderMain);
|
||||
return Results.OK(jeroOrderMain);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,9 +151,9 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryOrderCustomerListByMainId")
|
||||
public Result<List<JeroOrderCustomer>> queryOrderCustomerListByMainId(@RequestParam(name = "id", required = true) String id) {
|
||||
public Results<List<JeroOrderCustomer>> queryOrderCustomerListByMainId(@RequestParam(name = "id", required = true) String id) {
|
||||
List<JeroOrderCustomer> jeroOrderCustomerList = jeroOrderCustomerService.selectCustomersByMainId(id);
|
||||
return Result.OK(jeroOrderCustomerList);
|
||||
return Results.OK(jeroOrderCustomerList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,9 +163,9 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryOrderTicketListByMainId")
|
||||
public Result<List<JeroOrderTicket>> queryOrderTicketListByMainId(@RequestParam(name = "id", required = true) String id) {
|
||||
public Results<List<JeroOrderTicket>> queryOrderTicketListByMainId(@RequestParam(name = "id", required = true) String id) {
|
||||
List<JeroOrderTicket> jeroOrderTicketList = jeroOrderTicketService.selectTicketsByMainId(id);
|
||||
return Result.OK(jeroOrderTicketList);
|
||||
return Results.OK(jeroOrderTicketList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,7 +217,7 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
|
||||
*/
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@PostMapping("/importExcel")
|
||||
public Result<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
@@ -233,10 +233,10 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
|
||||
BeanUtils.copyProperties(page, po);
|
||||
jeroOrderMainService.saveMain(po, page.getJeroOrderCustomerList(), page.getJeroOrderTicketList());
|
||||
}
|
||||
return Result.OK("文件导入成功!");
|
||||
return Results.OK("文件导入成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
return Results.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
@@ -245,7 +245,7 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
return Results.error("文件导入失败!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+48
-50
@@ -5,7 +5,7 @@ import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.api.vo.ResultConstant;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.demo.test.entity.JeroOrderCustomer;
|
||||
@@ -19,10 +19,8 @@ import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -62,14 +60,14 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/orderList")
|
||||
public Result<IPage<JeroOrderMain>> respondePagedData(JeroOrderMain jeroOrderMain,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
public Results<IPage<JeroOrderMain>> respondePagedData(JeroOrderMain jeroOrderMain,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<JeroOrderMain> queryWrapper = QueryGenerator.initQueryWrapper(jeroOrderMain, req.getParameterMap());
|
||||
Page<JeroOrderMain> page = new Page<>(pageNo, pageSize);
|
||||
IPage<JeroOrderMain> pageList = jeroOrderMainService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,11 +77,11 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@RequestBody JeroOrderMainPage jeroOrderMainPage) {
|
||||
public Results<T> add(@RequestBody JeroOrderMainPage jeroOrderMainPage) {
|
||||
JeroOrderMain jeroOrderMain = new JeroOrderMain();
|
||||
BeanUtils.copyProperties(jeroOrderMainPage, jeroOrderMain);
|
||||
jeroOrderMainService.save(jeroOrderMain);
|
||||
return Result.OK(ResultConstant.OP_OK);
|
||||
return Results.OK(ResultConstant.OP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,11 +91,11 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/edit")
|
||||
public Result<T> edit(@RequestBody JeroOrderMainPage jeroOrderMainPage) {
|
||||
public Results<T> edit(@RequestBody JeroOrderMainPage jeroOrderMainPage) {
|
||||
JeroOrderMain jeroOrderMain = new JeroOrderMain();
|
||||
BeanUtils.copyProperties(jeroOrderMainPage, jeroOrderMain);
|
||||
jeroOrderMainService.updateById(jeroOrderMain);
|
||||
return Result.OK(ResultConstant.OP_OK);
|
||||
return Results.OK(ResultConstant.OP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,13 +105,13 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
jeroOrderMainService.delMain(id);
|
||||
return Result.OK(ResultConstant.DEL_OK);
|
||||
return Results.OK(ResultConstant.DEL_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,13 +121,13 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.jeroOrderMainService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK(ResultConstant.BATCH_DEL_OK);
|
||||
return Results.OK(ResultConstant.BATCH_DEL_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,9 +137,9 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<JeroOrderMain> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
public Results<JeroOrderMain> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
JeroOrderMain jeroOrderMain = jeroOrderMainService.getById(id);
|
||||
return Result.OK(jeroOrderMain);
|
||||
return Results.OK(jeroOrderMain);
|
||||
}
|
||||
|
||||
|
||||
@@ -152,14 +150,14 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/listOrderCustomerByMainId")
|
||||
public Result<IPage<JeroOrderCustomer>> queryOrderCustomerListByMainId(JeroOrderCustomer jeroOrderCustomer,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
public Results<IPage<JeroOrderCustomer>> queryOrderCustomerListByMainId(JeroOrderCustomer jeroOrderCustomer,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<JeroOrderCustomer> queryWrapper = QueryGenerator.initQueryWrapper(jeroOrderCustomer, req.getParameterMap());
|
||||
Page<JeroOrderCustomer> page = new Page<>(pageNo, pageSize);
|
||||
IPage<JeroOrderCustomer> pageList = jeroOrderCustomerService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,14 +167,14 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/listOrderTicketByMainId")
|
||||
public Result<IPage<JeroOrderTicket>> queryOrderTicketListByMainId(JeroOrderTicket jeroOrderTicket,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
public Results<IPage<JeroOrderTicket>> queryOrderTicketListByMainId(JeroOrderTicket jeroOrderTicket,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<JeroOrderTicket> queryWrapper = QueryGenerator.initQueryWrapper(jeroOrderTicket, req.getParameterMap());
|
||||
Page<JeroOrderTicket> page = new Page<>(pageNo, pageSize);
|
||||
IPage<JeroOrderTicket> pageList = jeroOrderTicketService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,9 +184,9 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/addCustomer")
|
||||
public Result<T> addCustomer(@RequestBody JeroOrderCustomer jeroOrderCustomer) {
|
||||
public Results<T> addCustomer(@RequestBody JeroOrderCustomer jeroOrderCustomer) {
|
||||
jeroOrderCustomerService.save(jeroOrderCustomer);
|
||||
return Result.OK(ResultConstant.OP_OK);
|
||||
return Results.OK(ResultConstant.OP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,9 +196,9 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/editCustomer")
|
||||
public Result<T> editCustomer(@RequestBody JeroOrderCustomer jeroOrderCustomer) {
|
||||
public Results<T> editCustomer(@RequestBody JeroOrderCustomer jeroOrderCustomer) {
|
||||
jeroOrderCustomerService.updateById(jeroOrderCustomer);
|
||||
return Result.OK(ResultConstant.OP_OK);
|
||||
return Results.OK(ResultConstant.OP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,13 +208,13 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteCustomer")
|
||||
public Result<T> deleteCustomer(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteCustomer(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
jeroOrderCustomerService.removeById(id);
|
||||
return Result.OK(ResultConstant.DEL_OK);
|
||||
return Results.OK(ResultConstant.DEL_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,13 +224,13 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteBatchCustomer")
|
||||
public Result<T> deleteBatchCustomer(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatchCustomer(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.jeroOrderCustomerService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK(ResultConstant.BATCH_DEL_OK);
|
||||
return Results.OK(ResultConstant.BATCH_DEL_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -242,9 +240,9 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/addTicket")
|
||||
public Result<T> addTicket(@RequestBody JeroOrderTicket jeroOrderTicket) {
|
||||
public Results<T> addTicket(@RequestBody JeroOrderTicket jeroOrderTicket) {
|
||||
jeroOrderTicketService.save(jeroOrderTicket);
|
||||
return Result.OK(ResultConstant.OP_OK);
|
||||
return Results.OK(ResultConstant.OP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,9 +252,9 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/editTicket")
|
||||
public Result<T> editTicket(@RequestBody JeroOrderTicket jeroOrderTicket) {
|
||||
public Results<T> editTicket(@RequestBody JeroOrderTicket jeroOrderTicket) {
|
||||
jeroOrderTicketService.updateById(jeroOrderTicket);
|
||||
return Result.OK(ResultConstant.OP_OK);
|
||||
return Results.OK(ResultConstant.OP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,13 +264,13 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteTicket")
|
||||
public Result<T> deleteTicket(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteTicket(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
jeroOrderTicketService.removeById(id);
|
||||
return Result.OK(ResultConstant.DEL_OK);
|
||||
return Results.OK(ResultConstant.DEL_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,13 +280,13 @@ public class JeroOrderTabMainController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteBatchTicket")
|
||||
public Result<T> deleteBatchTicket(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatchTicket(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.jeroOrderTicketService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK(ResultConstant.BATCH_DEL_OK);
|
||||
return Results.OK(ResultConstant.BATCH_DEL_OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+28
-28
@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.api.vo.ResultConstant;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
@@ -56,11 +56,11 @@ public class JoaDemoController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<JoaDemo>> queryPageList(JoaDemo joaDemo,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<JoaDemo>> result = new Result<>();
|
||||
public Results<IPage<JoaDemo>> queryPageList(JoaDemo joaDemo,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Results<IPage<JoaDemo>> result = new Results<>();
|
||||
QueryWrapper<JoaDemo> queryWrapper = QueryGenerator.initQueryWrapper(joaDemo, req.getParameterMap());
|
||||
Page<JoaDemo> page = new Page<>(pageNo, pageSize);
|
||||
IPage<JoaDemo> pageList = joaDemoService.page(page, queryWrapper);
|
||||
@@ -75,13 +75,13 @@ public class JoaDemoController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<Object> add(@RequestBody JoaDemo joaDemo) {
|
||||
public Results<Object> add(@RequestBody JoaDemo joaDemo) {
|
||||
try {
|
||||
joaDemoService.save(joaDemo);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,18 +91,18 @@ public class JoaDemoController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<Object> edit(@RequestBody JoaDemo joaDemo) {
|
||||
public Results<Object> edit(@RequestBody JoaDemo joaDemo) {
|
||||
JoaDemo joaDemoEntity = joaDemoService.getById(joaDemo.getId());
|
||||
if(joaDemoEntity==null) {
|
||||
return Result.error(ResultConstant.EN_WAS_NOT_FOUND);
|
||||
return Results.error(ResultConstant.EN_WAS_NOT_FOUND);
|
||||
}else {
|
||||
boolean ok = joaDemoService.updateById(joaDemo);
|
||||
if(ok) {
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,21 +111,21 @@ public class JoaDemoController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<Object> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<Object> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
JoaDemo joaDemo = joaDemoService.getById(id);
|
||||
if(joaDemo==null) {
|
||||
return Result.error(ResultConstant.EN_WAS_NOT_FOUND);
|
||||
return Results.error(ResultConstant.EN_WAS_NOT_FOUND);
|
||||
}else {
|
||||
boolean ok = joaDemoService.removeById(id);
|
||||
if(ok) {
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,13 +134,13 @@ public class JoaDemoController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}else {
|
||||
this.joaDemoService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,12 +150,12 @@ public class JoaDemoController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<JoaDemo> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
public Results<JoaDemo> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
JoaDemo joaDemo = joaDemoService.getById(id);
|
||||
if(joaDemo==null) {
|
||||
return Result.error(ResultConstant.EN_WAS_NOT_FOUND);
|
||||
return Results.error(ResultConstant.EN_WAS_NOT_FOUND);
|
||||
}else {
|
||||
return Result.OK(joaDemo);
|
||||
return Results.OK(joaDemo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ public class JoaDemoController {
|
||||
*/
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@PostMapping("/importExcel")
|
||||
public Result<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
@@ -214,10 +214,10 @@ public class JoaDemoController {
|
||||
for (JoaDemo joaDemoExcel : listJoaDemos) {
|
||||
joaDemoService.save(joaDemoExcel);
|
||||
}
|
||||
return Result.OK("文件导入成功!数据行数:" + listJoaDemos.size());
|
||||
return Results.OK("文件导入成功!数据行数:" + listJoaDemos.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("文件导入失败:"+e.getMessage());
|
||||
return Results.error("文件导入失败:"+e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
@@ -226,7 +226,7 @@ public class JoaDemoController {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.OK("文件导入失败!");
|
||||
return Results.OK("文件导入失败!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+19
-19
@@ -6,10 +6,10 @@ import com.alibaba.fastjson.JSONObject;
|
||||
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.jero.common.api.vo.Results;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.MatchTypeEnum;
|
||||
import com.jero.common.system.query.QueryCondition;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
@@ -40,7 +40,7 @@ public class DlMockController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/change1")
|
||||
public Result<T> mockChange1(@RequestParam("id") String id, @RequestParam("status") String status) {
|
||||
public Results<T> mockChange1(@RequestParam("id") String id, @RequestParam("status") String status) {
|
||||
/* id 为 行的id(rowId),只要获取到rowId,那么只需要调用 VXESocket.sendMessageToAll() 即可 */
|
||||
|
||||
// 封装行数据
|
||||
@@ -52,7 +52,7 @@ public class DlMockController {
|
||||
// 模拟更改数据
|
||||
this.mockChange(rowData);
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ public class DlMockController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/change2")
|
||||
public Result<T> mockChange2(@RequestParam("id") String id, @RequestParam("tug_status") String tug_status) {
|
||||
public Results<T> mockChange2(@RequestParam("id") String id, @RequestParam("tug_status") String tug_status) {
|
||||
/* id 为 行的id(rowId),只要获取到rowId,那么只需要调用 VXESocket.sendMessageToAll() 即可 */
|
||||
|
||||
// 封装行数据
|
||||
@@ -76,7 +76,7 @@ public class DlMockController {
|
||||
// 模拟更改数据
|
||||
this.mockChange(rowData);
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ public class DlMockController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/change3")
|
||||
public Result<T> mockChange3(@RequestParam("id") String id, @RequestParam("progress") String progress) {
|
||||
public Results<T> mockChange3(@RequestParam("id") String id, @RequestParam("progress") String progress) {
|
||||
/* id 为 行的id(rowId),只要获取到rowId,那么只需要调用 VXESocket.sendMessageToAll() 即可 */
|
||||
|
||||
// 封装行数据
|
||||
@@ -99,7 +99,7 @@ public class DlMockController {
|
||||
// 模拟更改数据
|
||||
this.mockChange(rowData);
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
private void mockChange(JSONObject rowData) {
|
||||
@@ -122,7 +122,7 @@ public class DlMockController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/change4")
|
||||
public Result<T> mockChange4(@RequestParam("status") String status) {
|
||||
public Results<T> mockChange4(@RequestParam("status") String status) {
|
||||
// 封装socket数据
|
||||
JSONObject socketData = new JSONObject();
|
||||
// 这里的 key 是前端注册时使用的key,必须保持一致
|
||||
@@ -135,7 +135,7 @@ public class DlMockController {
|
||||
// 调用 sendMessageToAll 发送给所有在线的用户
|
||||
VXESocket.sendMessageToAll(message);
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,11 +144,11 @@ public class DlMockController {
|
||||
* @param rowData 行数据,实际使用时可以替换成一个实体类
|
||||
*/
|
||||
@PostMapping("/immediateSaveRow")
|
||||
public Result<T> mockImmediateSaveRow(@RequestBody JSONObject rowData) throws InterruptedException {
|
||||
public Results<T> mockImmediateSaveRow(@RequestBody JSONObject rowData) throws InterruptedException {
|
||||
log.info("即时保存.rowData:" + rowData.toJSONString());
|
||||
// 延时1.5秒,模拟网慢堵塞真实感
|
||||
Thread.sleep(500);
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,7 +157,7 @@ public class DlMockController {
|
||||
* @param tableData 表格数据(实际使用时可以替换成一个List实体类)
|
||||
*/
|
||||
@PostMapping("/immediateSaveAll")
|
||||
public Result<T> mockImmediateSaveAll(@RequestBody JSONArray tableData) throws InterruptedException {
|
||||
public Results<T> mockImmediateSaveAll(@RequestBody JSONArray tableData) throws InterruptedException {
|
||||
// 【注】:
|
||||
// 1、tableData里包含该页所有的数据
|
||||
// 2、如果你实现了“即时保存”,那么除了新增的数据,其他的都是已经保存过的了,
|
||||
@@ -168,7 +168,7 @@ public class DlMockController {
|
||||
log.info("即时保存.tableData:" + tableData.toJSONString());
|
||||
// 延时1.5秒,模拟网慢堵塞真实感
|
||||
Thread.sleep(1000);
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,7 +180,7 @@ public class DlMockController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getData")
|
||||
public Result<IPage<JSONObject>> getMockData(
|
||||
public Results<IPage<JSONObject>> getMockData(
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
// 父级id,根据父级id查询子级,如果为空则查询顶级
|
||||
@@ -191,10 +191,10 @@ public class DlMockController {
|
||||
// 读取JSON数据
|
||||
JSONArray dataList = readJsonData(path);
|
||||
if (dataList == null) {
|
||||
return Result.error("读取数据失败!");
|
||||
return Results.error("读取数据失败!");
|
||||
}
|
||||
IPage<JSONObject> page = this.queryDataPage(dataList, parentId, pageNo, pageSize);
|
||||
return Result.OK(page);
|
||||
return Results.OK(page);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,7 +206,7 @@ public class DlMockController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getDdjhData")
|
||||
public Result<IPage<JSONObject>> getMockDdjhData(
|
||||
public Results<IPage<JSONObject>> getMockDdjhData(
|
||||
// SpringMVC 会自动将参数注入到实体里
|
||||
MockEntity mockEntity,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@@ -246,14 +246,14 @@ public class DlMockController {
|
||||
// 读取JSON数据
|
||||
JSONArray dataList = readJsonData(path);
|
||||
if (dataList == null) {
|
||||
return Result.error("读取数据失败!");
|
||||
return Results.error("读取数据失败!");
|
||||
}
|
||||
|
||||
IPage<JSONObject> page = this.queryDataPage(dataList, parentId, pageNo, pageSize);
|
||||
// 逐行查询子表数据,用于计算拖轮状态
|
||||
List<JSONObject> records = getJsonObjects(dataList, page);
|
||||
page.setRecords(records);
|
||||
return Result.OK(page);
|
||||
return Results.OK(page);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.jero.modules.cas.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.util.JwtUtil;
|
||||
@@ -56,7 +56,7 @@ public class CasClientController {
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
String multiDepart = "multi_depart";
|
||||
Result<JSONObject> result = new Result<>();
|
||||
Results<JSONObject> result = new Results<>();
|
||||
log.info("Rest api login.");
|
||||
try {
|
||||
String validateUrl = prefixUrl+"/p3/serviceValidate";
|
||||
|
||||
+17
-17
@@ -3,7 +3,7 @@ package com.jero.modules.message.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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.message.entity.SysMessage;
|
||||
@@ -43,12 +43,12 @@ public class SysMessageController extends JeroController<SysMessage, ISysMessage
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<SysMessage>> queryPageList(SysMessage sysMessage, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
public Results<IPage<SysMessage>> queryPageList(SysMessage sysMessage, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
QueryWrapper<SysMessage> queryWrapper = QueryGenerator.initQueryWrapper(sysMessage, req.getParameterMap());
|
||||
Page<SysMessage> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysMessage> pageList = sysMessageService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,9 +58,9 @@ public class SysMessageController extends JeroController<SysMessage, ISysMessage
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@RequestBody SysMessage sysMessage) {
|
||||
public Results<T> add(@RequestBody SysMessage sysMessage) {
|
||||
sysMessageService.save(sysMessage);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,9 +70,9 @@ public class SysMessageController extends JeroController<SysMessage, ISysMessage
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@RequestBody SysMessage sysMessage) {
|
||||
public Results<T> edit(@RequestBody SysMessage sysMessage) {
|
||||
sysMessageService.updateById(sysMessage);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
|
||||
}
|
||||
|
||||
@@ -83,13 +83,13 @@ public class SysMessageController extends JeroController<SysMessage, ISysMessage
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
sysMessageService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,13 +99,13 @@ public class SysMessageController extends JeroController<SysMessage, ISysMessage
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.sysMessageService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
return Results.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,9 +115,9 @@ public class SysMessageController extends JeroController<SysMessage, ISysMessage
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysMessage> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
public Results<SysMessage> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysMessage sysMessage = sysMessageService.getById(id);
|
||||
return Result.OK(sysMessage);
|
||||
return Results.OK(sysMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,7 +138,7 @@ public class SysMessageController extends JeroController<SysMessage, ISysMessage
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/importExcel")
|
||||
public Result<SysMessage> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<SysMessage> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysMessage.class);
|
||||
}
|
||||
|
||||
|
||||
+21
-21
@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.message.entity.MsgParams;
|
||||
@@ -48,12 +48,12 @@ public class SysMessageTemplateController extends JeroController<SysMessageTempl
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<SysMessageTemplate>> queryPageList(SysMessageTemplate sysMessageTemplate, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
public Results<IPage<SysMessageTemplate>> queryPageList(SysMessageTemplate sysMessageTemplate, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
QueryWrapper<SysMessageTemplate> queryWrapper = QueryGenerator.initQueryWrapper(sysMessageTemplate, req.getParameterMap());
|
||||
Page<SysMessageTemplate> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysMessageTemplate> pageList = sysMessageTemplateService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,9 +63,9 @@ public class SysMessageTemplateController extends JeroController<SysMessageTempl
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@RequestBody SysMessageTemplate sysMessageTemplate) {
|
||||
public Results<T> add(@RequestBody SysMessageTemplate sysMessageTemplate) {
|
||||
sysMessageTemplateService.save(sysMessageTemplate);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,9 +75,9 @@ public class SysMessageTemplateController extends JeroController<SysMessageTempl
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@RequestBody SysMessageTemplate sysMessageTemplate) {
|
||||
public Results<T> edit(@RequestBody SysMessageTemplate sysMessageTemplate) {
|
||||
sysMessageTemplateService.updateById(sysMessageTemplate);
|
||||
return Result.OK("更新成功!");
|
||||
return Results.OK("更新成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,13 +87,13 @@ public class SysMessageTemplateController extends JeroController<SysMessageTempl
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
sysMessageTemplateService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,13 +103,13 @@ public class SysMessageTemplateController extends JeroController<SysMessageTempl
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.sysMessageTemplateService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
return Results.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,9 +119,9 @@ public class SysMessageTemplateController extends JeroController<SysMessageTempl
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysMessageTemplate> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
public Results<SysMessageTemplate> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysMessageTemplate sysMessageTemplate = sysMessageTemplateService.getById(id);
|
||||
return Result.OK(sysMessageTemplate);
|
||||
return Results.OK(sysMessageTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,7 +142,7 @@ public class SysMessageTemplateController extends JeroController<SysMessageTempl
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/importExcel")
|
||||
public Result<SysMessageTemplate> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<SysMessageTemplate> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysMessageTemplate.class);
|
||||
}
|
||||
|
||||
@@ -150,18 +150,18 @@ public class SysMessageTemplateController extends JeroController<SysMessageTempl
|
||||
* 发送消息
|
||||
*/
|
||||
@PostMapping(value = "/sendMsg")
|
||||
public Result<Object> sendMessage(@RequestBody MsgParams msgParams) {
|
||||
public Results<Object> sendMessage(@RequestBody MsgParams msgParams) {
|
||||
Map<String, String> map = null;
|
||||
try {
|
||||
map = (Map<String, String>) JSON.parse(msgParams.getTestData());
|
||||
} catch (Exception e) {
|
||||
return Result.error("解析Json出错!");
|
||||
return Results.error("解析Json出错!");
|
||||
}
|
||||
boolean isSendSuccess = pushMsgUtil.sendMessage(msgParams.getMsgType(), msgParams.getTemplateCode(), map, msgParams.getReceiver());
|
||||
if (isSendSuccess) {
|
||||
return Result.OK("发送消息任务操作成功!");
|
||||
return Results.OK("发送消息任务操作成功!");
|
||||
} else {
|
||||
return Result.error("发送消息任务添加失败!");
|
||||
return Results.error("发送消息任务添加失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
package com.jero.modules.message.websocket;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.WebsocketConst;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -18,8 +18,8 @@ public class TestSocketController {
|
||||
private WebSocket webSocket;
|
||||
|
||||
@PostMapping("/sendAll")
|
||||
public Result<String> sendAll(@RequestBody JSONObject jsonObject) {
|
||||
Result<String> result = new Result<>();
|
||||
public Results<String> sendAll(@RequestBody JSONObject jsonObject) {
|
||||
Results<String> result = new Results<>();
|
||||
String message = jsonObject.getString("message");
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
|
||||
@@ -31,8 +31,8 @@ public class TestSocketController {
|
||||
}
|
||||
|
||||
@PostMapping("/sendUser")
|
||||
public Result<String> sendUser(@RequestBody JSONObject jsonObject) {
|
||||
Result<String> result = new Result<>();
|
||||
public Results<String> sendUser(@RequestBody JSONObject jsonObject) {
|
||||
Results<String> result = new Results<>();
|
||||
String userId = jsonObject.getString("userId");
|
||||
String message = jsonObject.getString("message");
|
||||
JSONObject obj = new JSONObject();
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
package com.jero.modules.monitor.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.modules.monitor.domain.RedisInfo;
|
||||
import com.jero.modules.monitor.exception.RedisConnectException;
|
||||
import com.jero.modules.monitor.service.RedisService;
|
||||
@@ -34,10 +34,10 @@ public class ActuatorRedisController {
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping("/info")
|
||||
public Result<List<RedisInfo>> getRedisInfo() throws RedisConnectException {
|
||||
public Results<List<RedisInfo>> getRedisInfo() throws RedisConnectException {
|
||||
List<RedisInfo> infoList = this.redisService.getRedisInfo();
|
||||
log.info(infoList.toString());
|
||||
return Result.OK(infoList);
|
||||
return Results.OK(infoList);
|
||||
}
|
||||
|
||||
@GetMapping("/keysSize")
|
||||
@@ -87,8 +87,8 @@ public class ActuatorRedisController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryDiskInfo")
|
||||
public Result<List<Map<String,Object>>> queryDiskInfo(HttpServletRequest request, HttpServletResponse response){
|
||||
Result<List<Map<String,Object>>> res = new Result<>();
|
||||
public Results<List<Map<String,Object>>> queryDiskInfo(HttpServletRequest request, HttpServletResponse response){
|
||||
Results<List<Map<String,Object>>> res = new Results<>();
|
||||
try {
|
||||
// 当前文件系统类
|
||||
FileSystemView fsv = FileSystemView.getFileSystemView();
|
||||
@@ -112,7 +112,7 @@ public class ActuatorRedisController {
|
||||
res.setResult(list);
|
||||
res.setMessage("查询成功");
|
||||
} catch (Exception e) {
|
||||
return Result.error("查询失败"+e.getMessage());
|
||||
return Results.error("查询失败"+e.getMessage());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
+3
-4
@@ -2,12 +2,11 @@ package com.jero.modules.ngalain.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.jero.common.api.vo.Results;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.vo.DictModel;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.ngalain.service.NgAlainService;
|
||||
@@ -52,7 +51,7 @@ public class NgAlainController {
|
||||
@GetMapping("/getDictItems/{dictCode}")
|
||||
public Object getDictItems(@PathVariable String dictCode) {
|
||||
log.info(" dictCode : "+ dictCode);
|
||||
Result<List<DictModel>> result = new Result<>();
|
||||
Results<List<DictModel>> result = new Results<>();
|
||||
List<DictModel> ls = null;
|
||||
try {
|
||||
ls = sysDictService.queryDictItemsByCode(dictCode);
|
||||
@@ -60,7 +59,7 @@ public class NgAlainController {
|
||||
result.setResult(ls);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
List<JSONObject> dictlist=new ArrayList<>();
|
||||
for (DictModel l : ls) {
|
||||
|
||||
+16
-16
@@ -3,7 +3,7 @@ package com.jero.modules.oss.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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
@@ -28,10 +28,10 @@ public class OSSFileController {
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping("/page")
|
||||
public Result<IPage<OSSFile>> queryPageList(OSSFile file,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
Result<IPage<OSSFile>> result = new Result<>();
|
||||
public Results<IPage<OSSFile>> queryPageList(OSSFile file,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
Results<IPage<OSSFile>> result = new Results<>();
|
||||
QueryWrapper<OSSFile> queryWrapper = QueryGenerator.initQueryWrapper(file, req.getParameterMap());
|
||||
Page<OSSFile> page = new Page<>(pageNo, pageSize);
|
||||
IPage<OSSFile> pageList = ossFileService.page(page, queryWrapper);
|
||||
@@ -43,34 +43,34 @@ public class OSSFileController {
|
||||
@ResponseBody
|
||||
@PostMapping("/upload")
|
||||
//@RequiresRoles("admin")
|
||||
public Result<T> upload(@RequestParam("file") MultipartFile multipartFile) {
|
||||
public Results<T> upload(@RequestParam("file") MultipartFile multipartFile) {
|
||||
try {
|
||||
ossFileService.upload(multipartFile);
|
||||
return Result.OK("上传成功!");
|
||||
return Results.OK("上传成功!");
|
||||
}
|
||||
catch (Exception ex) {
|
||||
log.info(ex.getMessage(), ex);
|
||||
return Result.error("上传失败");
|
||||
return Results.error("上传失败");
|
||||
}
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/delete")
|
||||
public Result<T> delete(@RequestBody Map<String,String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String,String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
OSSFile file = ossFileService.getById(id);
|
||||
if (file == null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = ossFileService.delete(file);
|
||||
if (ok) {
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,11 +78,11 @@ public class OSSFileController {
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/queryById")
|
||||
public Result<OSSFile> queryById(@RequestParam(name = "id") String id) {
|
||||
Result<OSSFile> result = new Result<>();
|
||||
public Results<OSSFile> queryById(@RequestParam(name = "id") String id) {
|
||||
Results<OSSFile> result = new Results<>();
|
||||
OSSFile file = ossFileService.getById(id);
|
||||
if (file == null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
}
|
||||
else {
|
||||
result.setResult(file);
|
||||
|
||||
+30
-30
@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
@@ -63,12 +63,12 @@ public class QuartzJobController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Result<IPage<QuartzJob>> queryPageList(QuartzJob quartzJob, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
public Results<IPage<QuartzJob>> queryPageList(QuartzJob quartzJob, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
QueryWrapper<QuartzJob> queryWrapper = QueryGenerator.initQueryWrapper(quartzJob, req.getParameterMap());
|
||||
Page<QuartzJob> page = new Page<>(pageNo, pageSize);
|
||||
IPage<QuartzJob> pageList = quartzJobService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
|
||||
}
|
||||
|
||||
@@ -81,9 +81,9 @@ public class QuartzJobController {
|
||||
//@RequiresRoles("admin")
|
||||
// @RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@PostMapping("/add")
|
||||
public Result<T> add(@RequestBody QuartzJob quartzJob) {
|
||||
public Results<T> add(@RequestBody QuartzJob quartzJob) {
|
||||
quartzJobService.saveAndScheduleJob(quartzJob);
|
||||
return Result.OK("创建定时任务成功");
|
||||
return Results.OK("创建定时任务成功");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,14 +95,14 @@ public class QuartzJobController {
|
||||
//@RequiresRoles("admin")
|
||||
// @RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
@PostMapping("/edit")
|
||||
public Result<T> eidt(@RequestBody QuartzJob quartzJob) {
|
||||
public Results<T> eidt(@RequestBody QuartzJob quartzJob) {
|
||||
try {
|
||||
quartzJobService.editAndScheduleJob(quartzJob);
|
||||
} catch (SchedulerException e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("更新定时任务失败!");
|
||||
return Results.error("更新定时任务失败!");
|
||||
}
|
||||
return Result.OK("更新定时任务成功!");
|
||||
return Results.OK("更新定时任务成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,17 +113,17 @@ public class QuartzJobController {
|
||||
*/
|
||||
//@RequiresRoles("admin")
|
||||
@PostMapping("/delete")
|
||||
public Result<T> delete(@RequestBody Map<String,String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String,String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
QuartzJob quartzJob = quartzJobService.getById(id);
|
||||
if (quartzJob == null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
}
|
||||
quartzJobService.deleteAndStopJob(quartzJob);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
|
||||
}
|
||||
|
||||
@@ -136,16 +136,16 @@ public class QuartzJobController {
|
||||
//@RequiresRoles("admin")
|
||||
// @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String,String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String,String> map) {
|
||||
String ids = map.get("ids");
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
for (String id : Arrays.asList(ids.split(","))) {
|
||||
QuartzJob job = quartzJobService.getById(id);
|
||||
quartzJobService.deleteAndStopJob(job);
|
||||
}
|
||||
return Result.OK("删除定时任务成功!");
|
||||
return Results.OK("删除定时任务成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,13 +157,13 @@ public class QuartzJobController {
|
||||
//@RequiresRoles("admin")
|
||||
@GetMapping(value = "/pause")
|
||||
@ApiOperation(value = "暂停定时任务")
|
||||
public Result<Object> pauseJob(@RequestParam(name = "id") String id) {
|
||||
public Results<Object> pauseJob(@RequestParam(name = "id") String id) {
|
||||
QuartzJob job = quartzJobService.getById(id);
|
||||
if (job == null) {
|
||||
return Result.error("定时任务不存在!");
|
||||
return Results.error("定时任务不存在!");
|
||||
}
|
||||
quartzJobService.pause(job);
|
||||
return Result.OK("暂停定时任务成功");
|
||||
return Results.OK("暂停定时任务成功");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,13 +175,13 @@ public class QuartzJobController {
|
||||
//@RequiresRoles("admin")
|
||||
@GetMapping(value = "/resume")
|
||||
@ApiOperation(value = "恢复定时任务")
|
||||
public Result<Object> resumeJob(@RequestParam(name = "id") String id) {
|
||||
public Results<Object> resumeJob(@RequestParam(name = "id") String id) {
|
||||
QuartzJob job = quartzJobService.getById(id);
|
||||
if (job == null) {
|
||||
return Result.error("定时任务不存在!");
|
||||
return Results.error("定时任务不存在!");
|
||||
}
|
||||
quartzJobService.resumeJob(job);
|
||||
return Result.OK("恢复定时任务成功");
|
||||
return Results.OK("恢复定时任务成功");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,9 +192,9 @@ public class QuartzJobController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
||||
@GetMapping("/queryById")
|
||||
public Result<QuartzJob> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
public Results<QuartzJob> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
QuartzJob quartzJob = quartzJobService.getById(id);
|
||||
return Result.OK(quartzJob);
|
||||
return Results.OK(quartzJob);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,7 +227,7 @@ public class QuartzJobController {
|
||||
*/
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@PostMapping("/importExcel")
|
||||
public Result<JSONObject> importExcel(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
public Results<JSONObject> importExcel(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
// 错误信息
|
||||
@@ -247,7 +247,7 @@ public class QuartzJobController {
|
||||
successLines+=(listQuartzJobs.size()-errorLines);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("文件导入失败!");
|
||||
return Results.error("文件导入失败!");
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
@@ -266,17 +266,17 @@ public class QuartzJobController {
|
||||
*/
|
||||
//@RequiresRoles("admin")
|
||||
@GetMapping("/execute")
|
||||
public Result<T> execute(@RequestParam(name = "id", required = true) String id) {
|
||||
public Results<T> execute(@RequestParam(name = "id", required = true) String id) {
|
||||
QuartzJob quartzJob = quartzJobService.getById(id);
|
||||
if (quartzJob == null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
}
|
||||
try {
|
||||
quartzJobService.execute(quartzJob);
|
||||
} catch (Exception e) {
|
||||
log.info("定时任务 立即执行失败>>"+e.getMessage());
|
||||
return Result.error("执行失败!");
|
||||
return Results.error("执行失败!");
|
||||
}
|
||||
return Result.OK("执行成功!");
|
||||
return Results.OK("执行成功!");
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -3,7 +3,7 @@ package com.jero.modules.system.controller;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
@@ -73,8 +73,8 @@ public class CommonController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/403")
|
||||
public Result<String> noauth() {
|
||||
return Result.error("没有权限,请联系管理员授权");
|
||||
public Results<String> noauth() {
|
||||
return Results.error("没有权限,请联系管理员授权");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,8 +84,8 @@ public class CommonController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/upload")
|
||||
public Result<OSSFile> upload(HttpServletRequest request, HttpServletResponse response) {
|
||||
Result<OSSFile> result = new Result<>();
|
||||
public Results<OSSFile> upload(HttpServletRequest request, HttpServletResponse response) {
|
||||
Results<OSSFile> result = new Results<>();
|
||||
String savePath = "";
|
||||
String bizPath = request.getParameter("biz");
|
||||
|
||||
@@ -244,7 +244,7 @@ public class CommonController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/transitRESTful")
|
||||
public Result<Object> transitRESTful(@RequestParam("url") String url, HttpServletRequest request) {
|
||||
public Results<Object> transitRESTful(@RequestParam("url") String url, HttpServletRequest request) {
|
||||
try {
|
||||
ServletServerHttpRequest httpRequest = new ServletServerHttpRequest(request);
|
||||
// 中转请求method、body
|
||||
@@ -262,7 +262,7 @@ public class CommonController {
|
||||
String httpURL = URLDecoder.decode(url, UTF8);
|
||||
ResponseEntity<String> response = RestUtil.request(httpURL, method, headers , variables, params, String.class);
|
||||
// 封装返回结果
|
||||
Result<Object> result = new Result<>();
|
||||
Results<Object> result = new Results<>();
|
||||
int statusCode = response.getStatusCodeValue();
|
||||
result.setCode(statusCode);
|
||||
result.setSuccess(statusCode == 200);
|
||||
@@ -271,11 +271,11 @@ public class CommonController {
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.debug("中转HTTP请求失败", e);
|
||||
return Result.error(e.getMessage());
|
||||
return Results.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void getResult(Result<Object> result, String responseBody) {
|
||||
private void getResult(Results<Object> result, String responseBody) {
|
||||
try {
|
||||
// 尝试将返回结果转为JSON
|
||||
Object json = JSON.parse(responseBody);
|
||||
|
||||
+4
-5
@@ -2,15 +2,14 @@ package com.jero.modules.system.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.jero.common.api.vo.Results;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.util.SqlInjectionUtil;
|
||||
import com.jero.modules.system.mapper.SysDictMapper;
|
||||
import com.jero.modules.system.model.DuplicateCheckVo;
|
||||
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.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -41,7 +40,7 @@ public class DuplicateCheckController {
|
||||
// @RequestMapping(value = "/check", method = RequestMethod.GET)
|
||||
@GetMapping("/check")
|
||||
@ApiOperation("重复校验接口")
|
||||
public Result<Object> doDuplicateCheck(DuplicateCheckVo duplicateCheckVo, HttpServletRequest request) {
|
||||
public Results<Object> doDuplicateCheck(DuplicateCheckVo duplicateCheckVo, HttpServletRequest request) {
|
||||
Long num = null;
|
||||
|
||||
log.info("----duplicate check------:"+ duplicateCheckVo.toString());
|
||||
@@ -59,11 +58,11 @@ public class DuplicateCheckController {
|
||||
|
||||
if (num == null || num == 0) {
|
||||
// 该值可用
|
||||
return Result.OK("该值可用!");
|
||||
return Results.OK("该值可用!");
|
||||
} else {
|
||||
// 该值不可用
|
||||
log.info("该值不可用,系统中已存在!");
|
||||
return Result.error("该值不可用,系统中已存在!");
|
||||
return Results.error("该值不可用,系统中已存在!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -1,7 +1,7 @@
|
||||
package com.jero.modules.system.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.model.SysLoginModel;
|
||||
import com.jero.modules.system.service.ILoginService;
|
||||
@@ -32,7 +32,7 @@ public class LoginController {
|
||||
@ApiOperation("登录接口")
|
||||
// @RequestMapping(value = "/login", method = RequestMethod.POST)
|
||||
@PostMapping("/login")
|
||||
public Result<JSONObject> login(@RequestBody SysLoginModel sysLoginModel){
|
||||
public Results<JSONObject> login(@RequestBody SysLoginModel sysLoginModel){
|
||||
return loginService.login(sysLoginModel);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class LoginController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/logout")
|
||||
public Result<Object> logout(HttpServletRequest request,HttpServletResponse response) {
|
||||
public Results<Object> logout(HttpServletRequest request, HttpServletResponse response) {
|
||||
return loginService.logout(request,response);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class LoginController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("loginfo")
|
||||
public Result<JSONObject> loginfo() {
|
||||
public Results<JSONObject> loginfo() {
|
||||
return loginService.loginfo();
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class LoginController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("visitInfo")
|
||||
public Result<List<Map<String,Object>>> visitInfo() {
|
||||
public Results<List<Map<String,Object>>> visitInfo() {
|
||||
return loginService.visitInfo();
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class LoginController {
|
||||
*/
|
||||
// @RequestMapping(value = "/selectDepart", method = RequestMethod.PUT)
|
||||
@PostMapping("/selectDepart")
|
||||
public Result<JSONObject> selectDepart(@RequestBody SysUser user) {
|
||||
public Results<JSONObject> selectDepart(@RequestBody SysUser user) {
|
||||
return loginService.selectDepart(user);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class LoginController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/sms")
|
||||
public Result<String> sms(@RequestBody JSONObject jsonObject) {
|
||||
public Results<String> sms(@RequestBody JSONObject jsonObject) {
|
||||
return loginService.sms(jsonObject);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class LoginController {
|
||||
*/
|
||||
@ApiOperation("手机号登录接口")
|
||||
@PostMapping("/phoneLogin")
|
||||
public Result<JSONObject> phoneLogin(@RequestBody JSONObject jsonObject) {
|
||||
public Results<JSONObject> phoneLogin(@RequestBody JSONObject jsonObject) {
|
||||
return loginService.phoneLogin(jsonObject);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class LoginController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getEncryptedString")
|
||||
public Result<Map<String,String>> getEncryptedString(){
|
||||
public Results<Map<String,String>> getEncryptedString(){
|
||||
return loginService.getEncryptedString();
|
||||
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class LoginController {
|
||||
*/
|
||||
@ApiOperation("获取验证码")
|
||||
@GetMapping(value = "/randomImage/{key}")
|
||||
public Result<String> randomImage(HttpServletResponse response,@PathVariable String key){
|
||||
public Results<String> randomImage(HttpServletResponse response, @PathVariable String key){
|
||||
return loginService.randomImage(response,key);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class LoginController {
|
||||
*/
|
||||
// @RequestMapping(value = "/mLogin", method = RequestMethod.POST)
|
||||
@PostMapping("/mLogin")
|
||||
public Result<JSONObject> mLogin(@RequestBody SysLoginModel sysLoginModel) {
|
||||
public Results<JSONObject> mLogin(@RequestBody SysLoginModel sysLoginModel) {
|
||||
return loginService.mLogin(sysLoginModel);
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class LoginController {
|
||||
*/
|
||||
// @RequestMapping(value = "/checkCaptcha", method = RequestMethod.POST)
|
||||
@PostMapping("/checkCaptcha")
|
||||
public Result<T> checkCaptcha(@RequestBody SysLoginModel sysLoginModel){
|
||||
public Results<T> checkCaptcha(@RequestBody SysLoginModel sysLoginModel){
|
||||
return loginService.checkCaptcha(sysLoginModel);
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public class LoginController {
|
||||
*/
|
||||
@ApiOperation("获取RSA公钥")
|
||||
@GetMapping("/getRSAPublicKey")
|
||||
public Result<String> getRSAPublicKey(){
|
||||
public Results<String> getRSAPublicKey(){
|
||||
return loginService.getRSAPublicKey();
|
||||
}
|
||||
}
|
||||
|
||||
+41
-41
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.constant.CommonSendStatus;
|
||||
import com.jero.common.constant.WebsocketConst;
|
||||
@@ -85,11 +85,11 @@ public class SysAnnouncementController {
|
||||
*/
|
||||
// @RequestMapping(value = "/page", method = RequestMethod.GET)
|
||||
@GetMapping("/page")
|
||||
public Result<IPage<SysAnnouncement>> queryPageList(SysAnnouncement sysAnnouncement,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<SysAnnouncement>> result = new Result<>();
|
||||
public Results<IPage<SysAnnouncement>> queryPageList(SysAnnouncement sysAnnouncement,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Results<IPage<SysAnnouncement>> result = new Results<>();
|
||||
sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
QueryWrapper<SysAnnouncement> queryWrapper = new QueryWrapper<>(sysAnnouncement);
|
||||
Page<SysAnnouncement> page = new Page<>(pageNo,pageSize);
|
||||
@@ -116,7 +116,7 @@ public class SysAnnouncementController {
|
||||
*/
|
||||
// @RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@PostMapping("/add")
|
||||
public Result<Object> add(@RequestBody SysAnnouncement sysAnnouncement) {
|
||||
public Results<Object> add(@RequestBody SysAnnouncement sysAnnouncement) {
|
||||
try {
|
||||
// update-begin-author:liusq date:20210804 for:标题处理xss攻击的问题
|
||||
String title = XSSUtils.striptXSS(sysAnnouncement.getTitile());
|
||||
@@ -125,10 +125,10 @@ public class SysAnnouncementController {
|
||||
sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
sysAnnouncement.setSendStatus(CommonSendStatus.UNPUBLISHED_STATUS_0);//未发布
|
||||
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,10 +139,10 @@ public class SysAnnouncementController {
|
||||
*/
|
||||
// @RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
@PostMapping("/edit")
|
||||
public Result<Object> eidt(@RequestBody SysAnnouncement sysAnnouncement) {
|
||||
public Results<Object> eidt(@RequestBody SysAnnouncement sysAnnouncement) {
|
||||
SysAnnouncement sysAnnouncementEntity = sysAnnouncementService.getById(sysAnnouncement.getId());
|
||||
if(sysAnnouncementEntity==null) {
|
||||
return Result.error(ERROR_TEXT);
|
||||
return Results.error(ERROR_TEXT);
|
||||
}else {
|
||||
// update-begin-author:liusq date:20210804 for:标题处理xss攻击的问题
|
||||
String title = XSSUtils.striptXSS(sysAnnouncement.getTitile());
|
||||
@@ -150,11 +150,11 @@ public class SysAnnouncementController {
|
||||
// update-end-author:liusq date:20210804 for:标题处理xss攻击的问题
|
||||
boolean ok = sysAnnouncementService.upDateAnnouncement(sysAnnouncement);
|
||||
if(ok) {
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,23 +164,23 @@ public class SysAnnouncementController {
|
||||
*/
|
||||
// @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public Result<Object> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<Object> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(id);
|
||||
if(sysAnnouncement==null) {
|
||||
return Result.error(ERROR_TEXT);
|
||||
return Results.error(ERROR_TEXT);
|
||||
}else {
|
||||
sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_1.toString());
|
||||
boolean ok = sysAnnouncementService.updateById(sysAnnouncement);
|
||||
if(ok) {
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,10 +190,10 @@ public class SysAnnouncementController {
|
||||
*/
|
||||
// @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}else {
|
||||
String[] id = ids.split(",");
|
||||
for(int i=0;i<id.length;i++) {
|
||||
@@ -201,7 +201,7 @@ public class SysAnnouncementController {
|
||||
announcement.setDelFlag(CommonConstant.DEL_FLAG_1.toString());
|
||||
sysAnnouncementService.updateById(announcement);
|
||||
}
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,12 +212,12 @@ public class SysAnnouncementController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
||||
@GetMapping("/queryById")
|
||||
public Result<SysAnnouncement> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
public Results<SysAnnouncement> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(id);
|
||||
if(sysAnnouncement==null) {
|
||||
return Result.error(ERROR_TEXT);
|
||||
return Results.error(ERROR_TEXT);
|
||||
}else {
|
||||
return Result.OK(sysAnnouncement);
|
||||
return Results.OK(sysAnnouncement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,10 +228,10 @@ public class SysAnnouncementController {
|
||||
*/
|
||||
// @RequestMapping(value = "/doReleaseData", method = RequestMethod.GET)
|
||||
@GetMapping("/doReleaseData")
|
||||
public Result<SysAnnouncement> doReleaseData(@RequestParam(name="id",required=true) String id, HttpServletRequest request) {
|
||||
public Results<SysAnnouncement> doReleaseData(@RequestParam(name="id",required=true) String id, HttpServletRequest request) {
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(id);
|
||||
if(sysAnnouncement==null) {
|
||||
return Result.error(ERROR_TEXT);
|
||||
return Results.error(ERROR_TEXT);
|
||||
}else {
|
||||
sysAnnouncement.setSendStatus(CommonSendStatus.PUBLISHED_STATUS_1);//发布中
|
||||
sysAnnouncement.setSendTime(new Date());
|
||||
@@ -255,11 +255,11 @@ public class SysAnnouncementController {
|
||||
obj.put(WebsocketConst.MSG_TXT, sysAnnouncement.getTitile());
|
||||
webSocket.sendMessage(userIds, obj.toJSONString());
|
||||
}
|
||||
return Result.OK("该系统通知发布成功");
|
||||
return Results.OK("该系统通知发布成功");
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -269,20 +269,20 @@ public class SysAnnouncementController {
|
||||
*/
|
||||
// @RequestMapping(value = "/doReovkeData", method = RequestMethod.GET)
|
||||
@GetMapping("/doReovkeData")
|
||||
public Result<Object> doReovkeData(@RequestParam(name="id",required=true) String id, HttpServletRequest request) {
|
||||
public Results<Object> doReovkeData(@RequestParam(name="id",required=true) String id, HttpServletRequest request) {
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(id);
|
||||
if(sysAnnouncement==null) {
|
||||
return Result.error(ERROR_TEXT);
|
||||
return Results.error(ERROR_TEXT);
|
||||
}else {
|
||||
sysAnnouncement.setSendStatus(CommonSendStatus.REVOKE_STATUS_2);//撤销发布
|
||||
sysAnnouncement.setCancelTime(new Date());
|
||||
boolean ok = sysAnnouncementService.updateById(sysAnnouncement);
|
||||
if(ok) {
|
||||
return Result.OK("该系统通知撤销成功");
|
||||
return Results.OK("该系统通知撤销成功");
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,8 +291,8 @@ public class SysAnnouncementController {
|
||||
*/
|
||||
// @RequestMapping(value = "/listByUser", method = RequestMethod.GET)
|
||||
@GetMapping("/listByUser")
|
||||
public Result<Map<String,Object>> listByUser() {
|
||||
Result<Map<String,Object>> result = new Result<>();
|
||||
public Results<Map<String,Object>> listByUser() {
|
||||
Results<Map<String,Object>> result = new Results<>();
|
||||
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = sysUser.getId();
|
||||
// 1.将系统消息补充到用户通告阅读标记表中
|
||||
@@ -370,7 +370,7 @@ public class SysAnnouncementController {
|
||||
*/
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@PostMapping("/importExcel")
|
||||
public Result<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
@@ -387,10 +387,10 @@ public class SysAnnouncementController {
|
||||
}
|
||||
sysAnnouncementService.save(sysAnnouncementExcel);
|
||||
}
|
||||
return Result.OK("文件导入成功!数据行数:" + listSysAnnouncements.size());
|
||||
return Results.OK("文件导入成功!数据行数:" + listSysAnnouncements.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("文件导入失败!");
|
||||
return Results.error("文件导入失败!");
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
@@ -399,7 +399,7 @@ public class SysAnnouncementController {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
return Results.error("文件导入失败!");
|
||||
}
|
||||
/**
|
||||
*同步消息
|
||||
@@ -408,13 +408,13 @@ public class SysAnnouncementController {
|
||||
*/
|
||||
// @RequestMapping(value = "/syncNotic", method = RequestMethod.GET)
|
||||
@GetMapping("/syncNotic")
|
||||
public Result<SysAnnouncement> syncNotic(@RequestParam(name="anntId",required=false) String anntId, HttpServletRequest request) {
|
||||
Result<SysAnnouncement> result = new Result<>();
|
||||
public Results<SysAnnouncement> syncNotic(@RequestParam(name="anntId",required=false) String anntId, HttpServletRequest request) {
|
||||
Results<SysAnnouncement> result = new Results<>();
|
||||
JSONObject obj = new JSONObject();
|
||||
if(StringUtils.isNotBlank(anntId)){
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(anntId);
|
||||
if(sysAnnouncement==null) {
|
||||
return Result.error(ERROR_TEXT);
|
||||
return Results.error(ERROR_TEXT);
|
||||
}else {
|
||||
if(sysAnnouncement.getMsgType().equals(CommonConstant.MSG_TYPE_ALL)) {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
|
||||
|
||||
+32
-33
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
@@ -14,7 +14,6 @@ import com.jero.modules.system.model.AnnouncementSendModel;
|
||||
import com.jero.modules.system.service.ISysAnnouncementSendService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -48,11 +47,11 @@ public class SysAnnouncementSendController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<SysAnnouncementSend>> queryPageList(SysAnnouncementSend sysAnnouncementSend,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<SysAnnouncementSend>> result = new Result<>();
|
||||
public Results<IPage<SysAnnouncementSend>> queryPageList(SysAnnouncementSend sysAnnouncementSend,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Results<IPage<SysAnnouncementSend>> result = new Results<>();
|
||||
QueryWrapper<SysAnnouncementSend> queryWrapper = new QueryWrapper<>(sysAnnouncementSend);
|
||||
Page<SysAnnouncementSend> page = new Page<>(pageNo,pageSize);
|
||||
//排序逻辑 处理
|
||||
@@ -77,13 +76,13 @@ public class SysAnnouncementSendController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<Object> add(@RequestBody SysAnnouncementSend sysAnnouncementSend) {
|
||||
public Results<Object> add(@RequestBody SysAnnouncementSend sysAnnouncementSend) {
|
||||
try {
|
||||
sysAnnouncementSendService.save(sysAnnouncementSend);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,18 +92,18 @@ public class SysAnnouncementSendController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<Object> edit(@RequestBody SysAnnouncementSend sysAnnouncementSend) {
|
||||
public Results<Object> edit(@RequestBody SysAnnouncementSend sysAnnouncementSend) {
|
||||
SysAnnouncementSend sysAnnouncementSendEntity = sysAnnouncementSendService.getById(sysAnnouncementSend.getId());
|
||||
if(sysAnnouncementSendEntity==null) {
|
||||
return Result.error(ERROE_MSG);
|
||||
return Results.error(ERROE_MSG);
|
||||
}else {
|
||||
boolean ok = sysAnnouncementSendService.updateById(sysAnnouncementSend);
|
||||
if(ok) {
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,22 +112,22 @@ public class SysAnnouncementSendController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<Object> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<Object> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
SysAnnouncementSend sysAnnouncementSend = sysAnnouncementSendService.getById(id);
|
||||
if(sysAnnouncementSend==null) {
|
||||
return Result.error(ERROE_MSG);
|
||||
return Results.error(ERROE_MSG);
|
||||
}else {
|
||||
boolean ok = sysAnnouncementSendService.removeById(id);
|
||||
if(ok) {
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,13 +136,13 @@ public class SysAnnouncementSendController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(ids == null || "".equals(ids.trim())) {
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}else {
|
||||
this.sysAnnouncementSendService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,12 +152,12 @@ public class SysAnnouncementSendController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysAnnouncementSend> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
public Results<SysAnnouncementSend> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysAnnouncementSend sysAnnouncementSend = sysAnnouncementSendService.getById(id);
|
||||
if(sysAnnouncementSend==null) {
|
||||
return Result.error(ERROE_MSG);
|
||||
return Results.error(ERROE_MSG);
|
||||
}else {
|
||||
return Result.OK(sysAnnouncementSend);
|
||||
return Results.OK(sysAnnouncementSend);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,8 +167,8 @@ public class SysAnnouncementSendController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/editByAnntIdAndUserId")
|
||||
public Result<SysAnnouncementSend> editById(@RequestBody JSONObject json) {
|
||||
Result<SysAnnouncementSend> result = new Result<>();
|
||||
public Results<SysAnnouncementSend> editById(@RequestBody JSONObject json) {
|
||||
Results<SysAnnouncementSend> result = new Results<>();
|
||||
String anntId = json.getString("anntId");
|
||||
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = sysUser.getId();
|
||||
@@ -188,10 +187,10 @@ public class SysAnnouncementSendController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getMyAnnouncementSend")
|
||||
public Result<IPage<AnnouncementSendModel>> getMyAnnouncementSend(AnnouncementSendModel announcementSendModel,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
Result<IPage<AnnouncementSendModel>> result = new Result<>();
|
||||
public Results<IPage<AnnouncementSendModel>> getMyAnnouncementSend(AnnouncementSendModel announcementSendModel,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
Results<IPage<AnnouncementSendModel>> result = new Results<>();
|
||||
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = sysUser.getId();
|
||||
announcementSendModel.setUserId(userId);
|
||||
@@ -209,7 +208,7 @@ public class SysAnnouncementSendController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/readAll")
|
||||
public Result<SysAnnouncementSend> readAll() {
|
||||
public Results<SysAnnouncementSend> readAll() {
|
||||
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = sysUser.getId();
|
||||
LambdaUpdateWrapper<SysAnnouncementSend> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
@@ -218,6 +217,6 @@ public class SysAnnouncementSendController {
|
||||
updateWrapper.last("where user_id ='"+userId+"'");
|
||||
SysAnnouncementSend announcementSend = new SysAnnouncementSend();
|
||||
sysAnnouncementSendService.update(announcementSend, updateWrapper);
|
||||
return Result.OK("全部已读");
|
||||
return Results.OK("全部已读");
|
||||
}
|
||||
}
|
||||
|
||||
+51
-51
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.vo.DictModel;
|
||||
@@ -59,14 +59,14 @@ public class SysCategoryController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/rootList")
|
||||
public Result<IPage<SysCategory>> queryPageList(SysCategory sysCategory,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
public Results<IPage<SysCategory>> queryPageList(SysCategory sysCategory,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
if(oConvertUtils.isEmpty(sysCategory.getPid())){
|
||||
sysCategory.setPid("0");
|
||||
}
|
||||
Result<IPage<SysCategory>> result = new Result<>();
|
||||
Results<IPage<SysCategory>> result = new Results<>();
|
||||
|
||||
//--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------start
|
||||
QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<>();
|
||||
@@ -81,8 +81,8 @@ public class SysCategoryController {
|
||||
}
|
||||
|
||||
@GetMapping(value = "/childList")
|
||||
public Result<List<SysCategory>> queryPageList(SysCategory sysCategory,HttpServletRequest req) {
|
||||
Result<List<SysCategory>> result = new Result<>();
|
||||
public Results<List<SysCategory>> queryPageList(SysCategory sysCategory, HttpServletRequest req) {
|
||||
Results<List<SysCategory>> result = new Results<>();
|
||||
QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, req.getParameterMap());
|
||||
List<SysCategory> list = sysCategoryService.list(queryWrapper);
|
||||
result.setSuccess(true);
|
||||
@@ -98,13 +98,13 @@ public class SysCategoryController {
|
||||
*/
|
||||
@RequiresPermissions("sys:category:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<Object> add(@RequestBody SysCategory sysCategory) {
|
||||
public Results<Object> add(@RequestBody SysCategory sysCategory) {
|
||||
try {
|
||||
sysCategoryService.addSysCategory(sysCategory);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,13 +115,13 @@ public class SysCategoryController {
|
||||
*/
|
||||
@RequiresPermissions("sys:category:edit")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<Object> edit(@RequestBody SysCategory sysCategory) {
|
||||
public Results<Object> edit(@RequestBody SysCategory sysCategory) {
|
||||
SysCategory sysCategoryEntity = sysCategoryService.getById(sysCategory.getId());
|
||||
if(sysCategoryEntity==null) {
|
||||
return Result.error(ERROE_MSG);
|
||||
return Results.error(ERROE_MSG);
|
||||
}else {
|
||||
sysCategoryService.updateSysCategory(sysCategory);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,17 +132,17 @@ public class SysCategoryController {
|
||||
*/
|
||||
@RequiresPermissions("sys:category:del")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<Object> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<Object> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
SysCategory sysCategory = sysCategoryService.getById(id);
|
||||
if(sysCategory==null) {
|
||||
return Result.error(ERROE_MSG);
|
||||
return Results.error(ERROE_MSG);
|
||||
}else {
|
||||
this.sysCategoryService.deleteSysCategory(id);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,13 +153,13 @@ public class SysCategoryController {
|
||||
*/
|
||||
@RequiresPermissions("sys:category:del")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}else {
|
||||
this.sysCategoryService.deleteSysCategory(ids);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,12 +170,12 @@ public class SysCategoryController {
|
||||
*/
|
||||
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysCategory> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
public Results<SysCategory> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysCategory sysCategory = sysCategoryService.getById(id);
|
||||
if(sysCategory==null) {
|
||||
return Result.error(ERROE_MSG);
|
||||
return Results.error(ERROE_MSG);
|
||||
}else {
|
||||
return Result.OK(sysCategory);
|
||||
return Results.OK(sysCategory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ public class SysCategoryController {
|
||||
@RequiresPermissions("sys:category:import")
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@PostMapping("/importExcel")
|
||||
public Result<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
@@ -248,10 +248,10 @@ public class SysCategoryController {
|
||||
}
|
||||
sysCategoryService.save(sysCategoryExcel);
|
||||
}
|
||||
return Result.OK("文件导入成功!数据行数:" + listSysCategorys.size());
|
||||
return Results.OK("文件导入成功!数据行数:" + listSysCategorys.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("文件导入失败:"+e.getMessage());
|
||||
return Results.error("文件导入失败:"+e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
@@ -260,7 +260,7 @@ public class SysCategoryController {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
return Results.error("文件导入失败!");
|
||||
}
|
||||
|
||||
|
||||
@@ -270,22 +270,22 @@ public class SysCategoryController {
|
||||
*/
|
||||
// @RequestMapping(value = "/loadOne", method = RequestMethod.GET)
|
||||
@GetMapping("/loadOne")
|
||||
public Result<SysCategory> loadOne(@RequestParam(name="field") String field,@RequestParam(name="val") String val) {
|
||||
public Results<SysCategory> loadOne(@RequestParam(name="field") String field, @RequestParam(name="val") String val) {
|
||||
try {
|
||||
|
||||
QueryWrapper<SysCategory> query = new QueryWrapper<>();
|
||||
query.eq(field, val);
|
||||
List<SysCategory> ls = this.sysCategoryService.list(query);
|
||||
if(ls==null || ls.isEmpty()) {
|
||||
return Result.error("查询无果");
|
||||
return Results.error("查询无果");
|
||||
}else if(ls.size()>1) {
|
||||
return Result.error("查询数据异常,["+field+"]存在多个值:"+val);
|
||||
return Results.error("查询数据异常,["+field+"]存在多个值:"+val);
|
||||
}else {
|
||||
return Result.OK(ls.get(0));
|
||||
return Results.OK(ls.get(0));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error(e.getMessage());
|
||||
return Results.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,8 +293,8 @@ public class SysCategoryController {
|
||||
* 加载节点的子数据
|
||||
*/
|
||||
@GetMapping("/loadTreeChildren")
|
||||
public Result<List<TreeSelectModel>> loadTreeChildren(@RequestParam(name="pid") String pid) {
|
||||
Result<List<TreeSelectModel>> result = new Result<>();
|
||||
public Results<List<TreeSelectModel>> loadTreeChildren(@RequestParam(name="pid") String pid) {
|
||||
Results<List<TreeSelectModel>> result = new Results<>();
|
||||
try {
|
||||
List<TreeSelectModel> ls = this.sysCategoryService.queryListByPid(pid);
|
||||
result.setResult(ls);
|
||||
@@ -312,8 +312,8 @@ public class SysCategoryController {
|
||||
*/
|
||||
// @RequestMapping(value = "/loadTreeRoot", method = RequestMethod.GET)
|
||||
@GetMapping("/loadTreeRoot")
|
||||
public Result<List<TreeSelectModel>> loadTreeRoot(@RequestParam(name="async") Boolean async,@RequestParam(name="pcode") String pcode) {
|
||||
Result<List<TreeSelectModel>> result = new Result<>();
|
||||
public Results<List<TreeSelectModel>> loadTreeRoot(@RequestParam(name="async") Boolean async, @RequestParam(name="pcode") String pcode) {
|
||||
Results<List<TreeSelectModel>> result = new Results<>();
|
||||
try {
|
||||
List<TreeSelectModel> ls = this.sysCategoryService.queryListByCode(pcode);
|
||||
if(Boolean.FALSE.equals(async)) {
|
||||
@@ -347,18 +347,18 @@ public class SysCategoryController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/checkCode")
|
||||
public Result<T> checkCode(@RequestParam(name="pid",required = false) String pid,@RequestParam(name="code",required = false) String code) {
|
||||
public Results<T> checkCode(@RequestParam(name="pid",required = false) String pid, @RequestParam(name="code",required = false) String code) {
|
||||
if(oConvertUtils.isEmpty(code)){
|
||||
return Result.error("错误,类型编码为空!");
|
||||
return Results.error("错误,类型编码为空!");
|
||||
}
|
||||
if(oConvertUtils.isEmpty(pid)){
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
SysCategory parent = this.sysCategoryService.getById(pid);
|
||||
if(code.startsWith(parent.getCode())){
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}else{
|
||||
return Result.error("编码不符合规范,须以\""+parent.getCode()+"\"开头!");
|
||||
return Results.error("编码不符合规范,须以\""+parent.getCode()+"\"开头!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -373,8 +373,8 @@ public class SysCategoryController {
|
||||
*/
|
||||
// @RequestMapping(value = "/loadTreeData", method = RequestMethod.GET)
|
||||
@GetMapping("/loadTreeData")
|
||||
public Result<List<TreeSelectModel>> loadDict(@RequestParam(name="pid",required = false) String pid,@RequestParam(name="pcode",required = false) String pcode, @RequestParam(name="condition",required = false) String condition) {
|
||||
Result<List<TreeSelectModel>> result = new Result<>();
|
||||
public Results<List<TreeSelectModel>> loadDict(@RequestParam(name="pid",required = false) String pid, @RequestParam(name="pcode",required = false) String pcode, @RequestParam(name="condition",required = false) String condition) {
|
||||
Results<List<TreeSelectModel>> result = new Results<>();
|
||||
//pid如果传值了 就忽略pcode的作用
|
||||
if(oConvertUtils.isEmpty(pid)){
|
||||
if(oConvertUtils.isEmpty(pcode)){
|
||||
@@ -413,8 +413,8 @@ public class SysCategoryController {
|
||||
*/
|
||||
// @RequestMapping(value = "/loadDictItem", method = RequestMethod.GET)
|
||||
@GetMapping("/loadDictItem")
|
||||
public Result<List<String>> loadDictItem(@RequestParam(name = "ids") String ids, @RequestParam(name = "delNotExist", required = false, defaultValue = "true") boolean delNotExist) {
|
||||
Result<List<String>> result = new Result<>();
|
||||
public Results<List<String>> loadDictItem(@RequestParam(name = "ids") String ids, @RequestParam(name = "delNotExist", required = false, defaultValue = "true") boolean delNotExist) {
|
||||
Results<List<String>> result = new Results<>();
|
||||
// 非空判断
|
||||
if (StringUtils.isBlank(ids)) {
|
||||
result.setSuccess(false);
|
||||
@@ -435,8 +435,8 @@ public class SysCategoryController {
|
||||
*/
|
||||
// @RequestMapping(value = "/loadAllData", method = RequestMethod.GET)
|
||||
@GetMapping("/loadAllData")
|
||||
public Result<List<DictModel>> loadAllData(@RequestParam(name="code",required = true) String code) {
|
||||
Result<List<DictModel>> result = new Result<>();
|
||||
public Results<List<DictModel>> loadAllData(@RequestParam(name="code",required = true) String code) {
|
||||
Results<List<DictModel>> result = new Results<>();
|
||||
LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<>();
|
||||
if(oConvertUtils.isNotEmpty(code) && !"0".equals(code)){
|
||||
query.likeRight(SysCategory::getCode,code);
|
||||
@@ -462,7 +462,7 @@ public class SysCategoryController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getChildListBatch")
|
||||
public Result<IPage<SysCategory>> getChildListBatch(@RequestParam("parentIds") String parentIds) {
|
||||
public Results<IPage<SysCategory>> getChildListBatch(@RequestParam("parentIds") String parentIds) {
|
||||
try {
|
||||
QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<>();
|
||||
List<String> parentIdList = Arrays.asList(parentIds.split(","));
|
||||
@@ -470,10 +470,10 @@ public class SysCategoryController {
|
||||
List<SysCategory> list = sysCategoryService.list(queryWrapper);
|
||||
IPage<SysCategory> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("批量查询子节点失败:" + e.getMessage());
|
||||
return Results.error("批量查询子节点失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+20
-20
@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
@@ -53,7 +53,7 @@ public class SysCheckRuleController extends JeroController<SysCheckRule, ISysChe
|
||||
@AutoLog(value = "编码校验规则-分页列表查询")
|
||||
@ApiOperation(value = "编码校验规则-分页列表查询", notes = "编码校验规则-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<SysCheckRule>> queryPageList(
|
||||
public Results<IPage<SysCheckRule>> queryPageList(
|
||||
SysCheckRule sysCheckRule,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@@ -62,7 +62,7 @@ public class SysCheckRuleController extends JeroController<SysCheckRule, ISysChe
|
||||
QueryWrapper<SysCheckRule> queryWrapper = QueryGenerator.initQueryWrapper(sysCheckRule, request.getParameterMap());
|
||||
Page<SysCheckRule> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysCheckRule> pageList = sysCheckRuleService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,19 +75,19 @@ public class SysCheckRuleController extends JeroController<SysCheckRule, ISysChe
|
||||
@AutoLog(value = "编码校验规则-通过Code校验传入的值")
|
||||
@ApiOperation(value = "编码校验规则-通过Code校验传入的值", notes = "编码校验规则-通过Code校验传入的值")
|
||||
@GetMapping(value = "/checkByCode")
|
||||
public Result<Object> checkByCode(
|
||||
public Results<Object> checkByCode(
|
||||
@RequestParam(name = "ruleCode") String ruleCode,
|
||||
@RequestParam(name = "value") String value
|
||||
) throws UnsupportedEncodingException {
|
||||
SysCheckRule sysCheckRule = sysCheckRuleService.getByCode(ruleCode);
|
||||
if (sysCheckRule == null) {
|
||||
return Result.error("该编码不存在");
|
||||
return Results.error("该编码不存在");
|
||||
}
|
||||
JSONObject errorResult = sysCheckRuleService.checkValue(sysCheckRule, URLDecoder.decode(value, "UTF-8"));
|
||||
if (errorResult == null) {
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
} else {
|
||||
Result<Object> r = Result.error(errorResult.getString("message"));
|
||||
Results<Object> r = Results.error(errorResult.getString("message"));
|
||||
r.setResult(errorResult);
|
||||
return r;
|
||||
}
|
||||
@@ -102,9 +102,9 @@ public class SysCheckRuleController extends JeroController<SysCheckRule, ISysChe
|
||||
@AutoLog(value = "编码校验规则-添加")
|
||||
@ApiOperation(value = "编码校验规则-添加", notes = "编码校验规则-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@RequestBody SysCheckRule sysCheckRule) {
|
||||
public Results<T> add(@RequestBody SysCheckRule sysCheckRule) {
|
||||
sysCheckRuleService.save(sysCheckRule);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,9 +116,9 @@ public class SysCheckRuleController extends JeroController<SysCheckRule, ISysChe
|
||||
@AutoLog(value = "编码校验规则-编辑")
|
||||
@ApiOperation(value = "编码校验规则-编辑", notes = "编码校验规则-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@RequestBody SysCheckRule sysCheckRule) {
|
||||
public Results<T> edit(@RequestBody SysCheckRule sysCheckRule) {
|
||||
sysCheckRuleService.updateById(sysCheckRule);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,13 +130,13 @@ public class SysCheckRuleController extends JeroController<SysCheckRule, ISysChe
|
||||
@AutoLog(value = "编码校验规则-通过id删除")
|
||||
@ApiOperation(value = "编码校验规则-通过id删除", notes = "编码校验规则-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
sysCheckRuleService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,13 +148,13 @@ public class SysCheckRuleController extends JeroController<SysCheckRule, ISysChe
|
||||
@AutoLog(value = "编码校验规则-批量删除")
|
||||
@ApiOperation(value = "编码校验规则-批量删除", notes = "编码校验规则-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.sysCheckRuleService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
return Results.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,9 +166,9 @@ public class SysCheckRuleController extends JeroController<SysCheckRule, ISysChe
|
||||
@AutoLog(value = "编码校验规则-通过id查询")
|
||||
@ApiOperation(value = "编码校验规则-通过id查询", notes = "编码校验规则-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysCheckRule> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
public Results<SysCheckRule> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysCheckRule sysCheckRule = sysCheckRuleService.getById(id);
|
||||
return Result.OK(sysCheckRule);
|
||||
return Results.OK(sysCheckRule);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,7 +191,7 @@ public class SysCheckRuleController extends JeroController<SysCheckRule, ISysChe
|
||||
*/
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@PostMapping("/importExcel")
|
||||
public Result<SysCheckRule> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<SysCheckRule> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysCheckRule.class);
|
||||
}
|
||||
|
||||
|
||||
+9
-10
@@ -5,9 +5,8 @@ import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.system.entity.SysDataLog;
|
||||
import com.jero.modules.system.service.ISysDataLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -28,9 +27,9 @@ public class SysDataLogController {
|
||||
|
||||
// @RequestMapping(value = "/page", method = RequestMethod.GET)
|
||||
@GetMapping("/page")
|
||||
public Result<IPage<SysDataLog>> queryPageList(SysDataLog dataLog,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysDataLog>> result = new Result<>();
|
||||
public Results<IPage<SysDataLog>> queryPageList(SysDataLog dataLog, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Results<IPage<SysDataLog>> result = new Results<>();
|
||||
QueryWrapper<SysDataLog> queryWrapper = QueryGenerator.initQueryWrapper(dataLog, req.getParameterMap());
|
||||
Page<SysDataLog> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysDataLog> pageList = service.page(page, queryWrapper);
|
||||
@@ -50,8 +49,8 @@ public class SysDataLogController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryCompareList", method = RequestMethod.GET)
|
||||
@GetMapping("/queryCompareList")
|
||||
public Result<List<SysDataLog>> queryCompareList(HttpServletRequest req) {
|
||||
Result<List<SysDataLog>> result = new Result<>();
|
||||
public Results<List<SysDataLog>> queryCompareList(HttpServletRequest req) {
|
||||
Results<List<SysDataLog>> result = new Results<>();
|
||||
String dataId1 = req.getParameter("dataId1");
|
||||
String dataId2 = req.getParameter("dataId2");
|
||||
List<String> idList = new ArrayList<>();
|
||||
@@ -74,8 +73,8 @@ public class SysDataLogController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryDataVerList", method = RequestMethod.GET)
|
||||
@GetMapping("/queryDataVerList")
|
||||
public Result<List<SysDataLog>> queryDataVerList(HttpServletRequest req) {
|
||||
Result<List<SysDataLog>> result = new Result<>();
|
||||
public Results<List<SysDataLog>> queryDataVerList(HttpServletRequest req) {
|
||||
Results<List<SysDataLog>> result = new Results<>();
|
||||
String dataTable = req.getParameter("dataTable");
|
||||
String dataId = req.getParameter("dataId");
|
||||
QueryWrapper<SysDataLog> queryWrapper = new QueryWrapper<>();
|
||||
@@ -83,7 +82,7 @@ public class SysDataLogController {
|
||||
queryWrapper.eq("data_id", dataId);
|
||||
List<SysDataLog> list = service.list(queryWrapper);
|
||||
if(list==null||list.isEmpty()) {
|
||||
return Result.error("未找到版本信息");
|
||||
return Results.error("未找到版本信息");
|
||||
}else {
|
||||
result.setResult(list);
|
||||
result.setSuccess(true);
|
||||
|
||||
+19
-19
@@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
@@ -55,7 +55,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
||||
@AutoLog(value = "多数据源管理-分页列表查询")
|
||||
@ApiOperation(value = "多数据源管理-分页列表查询", notes = "多数据源管理-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<SysDataSource>> queryPageList(
|
||||
public Results<IPage<SysDataSource>> queryPageList(
|
||||
SysDataSource sysDataSource,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@@ -75,13 +75,13 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error(e.getMessage());
|
||||
return Results.error(e.getMessage());
|
||||
}
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/options")
|
||||
public Result<JSONArray> queryOptions(SysDataSource sysDataSource, HttpServletRequest req) {
|
||||
public Results<JSONArray> queryOptions(SysDataSource sysDataSource, HttpServletRequest req) {
|
||||
QueryWrapper<SysDataSource> queryWrapper = QueryGenerator.initQueryWrapper(sysDataSource, req.getParameterMap());
|
||||
List<SysDataSource> pageList = sysDataSourceService.list(queryWrapper);
|
||||
JSONArray array = new JSONArray(pageList.size());
|
||||
@@ -92,7 +92,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
||||
option.put("text", item.getName());
|
||||
array.add(option);
|
||||
}
|
||||
return Result.OK(array);
|
||||
return Results.OK(array);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
||||
@AutoLog(value = "多数据源管理-添加")
|
||||
@ApiOperation(value = "多数据源管理-添加", notes = "多数据源管理-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@RequestBody SysDataSource sysDataSource) {
|
||||
public Results<T> add(@RequestBody SysDataSource sysDataSource) {
|
||||
try {
|
||||
String dbPassword = sysDataSource.getDbPassword();
|
||||
if(StringUtils.isNotBlank(dbPassword)){
|
||||
@@ -115,7 +115,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +127,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
||||
@AutoLog(value = "多数据源管理-编辑")
|
||||
@ApiOperation(value = "多数据源管理-编辑", notes = "多数据源管理-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@RequestBody SysDataSource sysDataSource) {
|
||||
public Results<T> edit(@RequestBody SysDataSource sysDataSource) {
|
||||
try {
|
||||
SysDataSource d = sysDataSourceService.getById(sysDataSource.getId());
|
||||
DataSourceCachePool.removeCache(d.getCode());
|
||||
@@ -140,7 +140,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,15 +152,15 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
||||
@AutoLog(value = "多数据源管理-通过id删除")
|
||||
@ApiOperation(value = "多数据源管理-通过id删除", notes = "多数据源管理-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
SysDataSource sysDataSource = sysDataSourceService.getById(id);
|
||||
DataSourceCachePool.removeCache(sysDataSource.getCode());
|
||||
sysDataSourceService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,10 +172,10 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
||||
@AutoLog(value = "多数据源管理-批量删除")
|
||||
@ApiOperation(value = "多数据源管理-批量删除", notes = "多数据源管理-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
List<String> idList = Arrays.asList(ids.split(","));
|
||||
idList.forEach(item->{
|
||||
@@ -183,7 +183,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
||||
DataSourceCachePool.removeCache(sysDataSource.getCode());
|
||||
});
|
||||
this.sysDataSourceService.removeByIds(idList);
|
||||
return Result.OK("批量删除成功!");
|
||||
return Results.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,9 +195,9 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
||||
@AutoLog(value = "多数据源管理-通过id查询")
|
||||
@ApiOperation(value = "多数据源管理-通过id查询", notes = "多数据源管理-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysDataSource> queryById(@RequestParam(name = "id") String id) {
|
||||
public Results<SysDataSource> queryById(@RequestParam(name = "id") String id) {
|
||||
SysDataSource sysDataSource = sysDataSourceService.getById(id);
|
||||
return Result.OK(sysDataSource);
|
||||
return Results.OK(sysDataSource);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,7 +220,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
||||
*/
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@PostMapping("/importExcel")
|
||||
public Result<SysDataSource> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<SysDataSource> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysDataSource.class);
|
||||
}
|
||||
|
||||
|
||||
+43
-43
@@ -3,7 +3,7 @@ package com.jero.modules.system.controller;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CacheConstant;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
@@ -69,8 +69,8 @@ public class SysDepartController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryMyDeptTreeList", method = RequestMethod.GET)
|
||||
@GetMapping("/queryMyDeptTreeList")
|
||||
public Result<List<SysDepartTreeModel>> queryMyDeptTreeList() {
|
||||
Result<List<SysDepartTreeModel>> result = new Result<>();
|
||||
public Results<List<SysDepartTreeModel>> queryMyDeptTreeList() {
|
||||
Results<List<SysDepartTreeModel>> result = new Results<>();
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
try {
|
||||
if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals( CommonConstant.USER_IDENTITY_2 )){
|
||||
@@ -100,8 +100,8 @@ public class SysDepartController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryTreeList", method = RequestMethod.GET)
|
||||
@GetMapping("/queryTreeList")
|
||||
public Result<List<SysDepartTreeModel>> queryTreeList() {
|
||||
Result<List<SysDepartTreeModel>> result = new Result<>();
|
||||
public Results<List<SysDepartTreeModel>> queryTreeList() {
|
||||
Results<List<SysDepartTreeModel>> result = new Results<>();
|
||||
try {
|
||||
// 从内存中读取
|
||||
// List<SysDepartTreeModel> list =FindsDepartsChildrenUtil.getSysDepartTreeList();
|
||||
@@ -124,8 +124,8 @@ public class SysDepartController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryDepartTreeSync", method = RequestMethod.GET)
|
||||
@GetMapping("/queryDepartTreeSync")
|
||||
public Result<List<SysDepartTreeModel>> queryDepartTreeSync(@RequestParam(name = "pid", required = false) String parentId) {
|
||||
Result<List<SysDepartTreeModel>> result = new Result<>();
|
||||
public Results<List<SysDepartTreeModel>> queryDepartTreeSync(@RequestParam(name = "pid", required = false) String parentId) {
|
||||
Results<List<SysDepartTreeModel>> result = new Results<>();
|
||||
try {
|
||||
List<SysDepartTreeModel> list = sysDepartService.queryTreeListByPid(parentId);
|
||||
result.setResult(list);
|
||||
@@ -143,7 +143,7 @@ public class SysDepartController {
|
||||
* @param orgCode 根据orgCode查,departId和orgCode必须有一个不为空
|
||||
*/
|
||||
@GetMapping("/queryAllParentId")
|
||||
public Result<JSONObject> queryParentIds(
|
||||
public Results<JSONObject> queryParentIds(
|
||||
@RequestParam(name = "departId", required = false) String departId,
|
||||
@RequestParam(name = "orgCode", required = false) String orgCode
|
||||
) {
|
||||
@@ -154,12 +154,12 @@ public class SysDepartController {
|
||||
} else if (oConvertUtils.isNotEmpty(orgCode)) {
|
||||
data = sysDepartService.queryAllParentIdByOrgCode(orgCode);
|
||||
} else {
|
||||
return Result.error("departId 和 orgCode 不能都为空!");
|
||||
return Results.error("departId 和 orgCode 不能都为空!");
|
||||
}
|
||||
return Result.OK(data);
|
||||
return Results.OK(data);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
return Results.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,15 +174,15 @@ public class SysDepartController {
|
||||
// @RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@PostMapping("/add")
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<Object> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
||||
public Results<Object> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
try {
|
||||
sysDepart.setCreateBy(username);
|
||||
sysDepartService.saveDepartData(sysDepart, username);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,19 +197,19 @@ public class SysDepartController {
|
||||
// @RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
@PostMapping("/edit")
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<Object> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
||||
public Results<Object> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
sysDepart.setUpdateBy(username);
|
||||
SysDepart sysDepartEntity = sysDepartService.getById(sysDepart.getId());
|
||||
if (sysDepartEntity == null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = sysDepartService.updateDepartDataById(sysDepart, username);
|
||||
if (ok) {
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,21 +222,21 @@ public class SysDepartController {
|
||||
// @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<Object> delete(@RequestBody Map<String,String> map) {
|
||||
public Results<Object> delete(@RequestBody Map<String,String> map) {
|
||||
String id = map.get("id");
|
||||
if(org.apache.commons.lang.StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
SysDepart sysDepart = sysDepartService.getById(id);
|
||||
if(sysDepart==null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysDepartService.delete(id);
|
||||
if(ok) {
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
|
||||
@@ -250,13 +250,13 @@ public class SysDepartController {
|
||||
@RequiresPermissions("sys:depart:del")
|
||||
@PostMapping("/deleteBatch")
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<Object> deleteBatch(@RequestBody Map<String,String> map) {
|
||||
public Results<Object> deleteBatch(@RequestBody Map<String,String> map) {
|
||||
String ids = map.get("ids");
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
} else {
|
||||
this.sysDepartService.deleteBatchWithChildren(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,13 +267,13 @@ public class SysDepartController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryIdTree", method = RequestMethod.GET)
|
||||
@GetMapping("/queryIdTree")
|
||||
public Result<List<DepartIdModel>> queryIdTree() {
|
||||
public Results<List<DepartIdModel>> queryIdTree() {
|
||||
try {
|
||||
List<DepartIdModel> list = sysDepartService.queryDepartIdTreeList();
|
||||
return Result.OK(list);
|
||||
return Results.OK(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("查询失败");
|
||||
return Results.error("查询失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ public class SysDepartController {
|
||||
*/
|
||||
// @RequestMapping(value = "/searchBy", method = RequestMethod.GET)
|
||||
@GetMapping("/searchBy")
|
||||
public Result<List<SysDepartTreeModel>> searchBy(@RequestParam(name = "keyWord", required = true) String keyWord,@RequestParam(name = "myDeptSearch", required = false) String myDeptSearch) {
|
||||
public Results<List<SysDepartTreeModel>> searchBy(@RequestParam(name = "keyWord", required = true) String keyWord, @RequestParam(name = "myDeptSearch", required = false) String myDeptSearch) {
|
||||
//部门查询,myDeptSearch为1时为我的部门查询,登录用户为上级时查只查负责部门下数据
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String departIds = null;
|
||||
@@ -296,9 +296,9 @@ public class SysDepartController {
|
||||
}
|
||||
List<SysDepartTreeModel> treeList = this.sysDepartService.searhBy(keyWord,myDeptSearch,departIds);
|
||||
if (treeList == null || treeList.isEmpty()) {
|
||||
return Result.error("未查询匹配数据!");
|
||||
return Results.error("未查询匹配数据!");
|
||||
}
|
||||
return Result.OK(treeList);
|
||||
return Results.OK(treeList);
|
||||
}
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ public class SysDepartController {
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@PostMapping("/importExcel")
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<JSONObject> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<JSONObject> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
List<String> errorMessageList = new ArrayList<>();
|
||||
List<SysDepart> listSysDeparts = null;
|
||||
@@ -392,7 +392,7 @@ public class SysDepartController {
|
||||
return ImportExcelUtil.imporReturnRes(errorMessageList.size(), listSysDeparts.size() - errorMessageList.size(), errorMessageList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("文件导入失败:"+e.getMessage());
|
||||
return Results.error("文件导入失败:"+e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
@@ -401,7 +401,7 @@ public class SysDepartController {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
return Results.error("文件导入失败!");
|
||||
}
|
||||
|
||||
private void setParentId(SysDepart sysDepart, QueryWrapper<SysDepart> queryWrapper) {
|
||||
@@ -423,7 +423,7 @@ public class SysDepartController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("listAll")
|
||||
public Result<List<SysDepart>> listAll(@RequestParam(name = "id", required = false) String id) {
|
||||
public Results<List<SysDepart>> listAll(@RequestParam(name = "id", required = false) String id) {
|
||||
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<>();
|
||||
query.orderByAsc(SysDepart::getOrgCode);
|
||||
if(oConvertUtils.isNotEmpty(id)){
|
||||
@@ -431,7 +431,7 @@ public class SysDepartController {
|
||||
query.in(SysDepart::getId,Arrays.asList(arr));
|
||||
}
|
||||
List<SysDepart> ls = this.sysDepartService.list(query);
|
||||
return Result.OK(ls);
|
||||
return Results.OK(ls);
|
||||
}
|
||||
/**
|
||||
* 查询数据 查出所有部门,并以树结构数据格式响应给前端
|
||||
@@ -440,8 +440,8 @@ public class SysDepartController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryTreeByKeyWord", method = RequestMethod.GET)
|
||||
@GetMapping("/queryTreeByKeyWord")
|
||||
public Result<Map<String,Object>> queryTreeByKeyWord(@RequestParam(name = "keyWord", required = false) String keyWord) {
|
||||
Result<Map<String,Object>> result = new Result<>();
|
||||
public Results<Map<String,Object>> queryTreeByKeyWord(@RequestParam(name = "keyWord", required = false) String keyWord) {
|
||||
Results<Map<String,Object>> result = new Results<>();
|
||||
try {
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
List<SysDepartTreeModel> list = sysDepartService.queryTreeByKeyWord(keyWord);
|
||||
@@ -467,8 +467,8 @@ public class SysDepartController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getDepartName")
|
||||
public Result<SysDepart> getDepartName(@RequestParam(name = "orgCode") String orgCode) {
|
||||
Result<SysDepart> result = new Result<>();
|
||||
public Results<SysDepart> getDepartName(@RequestParam(name = "orgCode") String orgCode) {
|
||||
Results<SysDepart> result = new Results<>();
|
||||
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysDepart::getOrgCode, orgCode);
|
||||
SysDepart sysDepart = sysDepartService.getOne(query);
|
||||
@@ -484,8 +484,8 @@ public class SysDepartController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getUsersByDepartId")
|
||||
public Result<List<SysUser>> getUsersByDepartId(@RequestParam(name = "id") String id) {
|
||||
Result<List<SysUser>> result = new Result<>();
|
||||
public Results<List<SysUser>> getUsersByDepartId(@RequestParam(name = "id") String id) {
|
||||
Results<List<SysUser>> result = new Results<>();
|
||||
List<SysUser> sysUsers = sysUserDepartService.queryUserByDepId(id);
|
||||
result.setSuccess(true);
|
||||
result.setResult(sysUsers);
|
||||
|
||||
+24
-26
@@ -1,13 +1,11 @@
|
||||
package com.jero.modules.system.controller;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
@@ -63,14 +61,14 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
|
||||
*/
|
||||
@ApiOperation(value="部门权限表-分页列表查询", notes="部门权限表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<SysDepartPermission>> queryPageList(SysDepartPermission sysDepartPermission,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
public Results<IPage<SysDepartPermission>> queryPageList(SysDepartPermission sysDepartPermission,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SysDepartPermission> queryWrapper = QueryGenerator.initQueryWrapper(sysDepartPermission, req.getParameterMap());
|
||||
Page<SysDepartPermission> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysDepartPermission> pageList = sysDepartPermissionService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,9 +79,9 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
|
||||
*/
|
||||
@ApiOperation(value="部门权限表-添加", notes="部门权限表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@RequestBody SysDepartPermission sysDepartPermission) {
|
||||
public Results<T> add(@RequestBody SysDepartPermission sysDepartPermission) {
|
||||
sysDepartPermissionService.save(sysDepartPermission);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,9 +92,9 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
|
||||
*/
|
||||
@ApiOperation(value="部门权限表-编辑", notes="部门权限表-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@RequestBody SysDepartPermission sysDepartPermission) {
|
||||
public Results<T> edit(@RequestBody SysDepartPermission sysDepartPermission) {
|
||||
sysDepartPermissionService.updateById(sysDepartPermission);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,13 +105,13 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
|
||||
*/
|
||||
@ApiOperation(value="部门权限表-通过id删除", notes="部门权限表-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
sysDepartPermissionService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,13 +122,13 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
|
||||
*/
|
||||
@ApiOperation(value="部门权限表-批量删除", notes="部门权限表-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.sysDepartPermissionService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
return Results.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,9 +139,9 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
|
||||
*/
|
||||
@ApiOperation(value="部门权限表-通过id查询", notes="部门权限表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysDepartPermission> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
public Results<SysDepartPermission> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysDepartPermission sysDepartPermission = sysDepartPermissionService.getById(id);
|
||||
return Result.OK(sysDepartPermission);
|
||||
return Results.OK(sysDepartPermission);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,7 +164,7 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
|
||||
*/
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@PostMapping("/importExcel")
|
||||
public Result<SysDepartPermission> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<SysDepartPermission> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysDepartPermission.class);
|
||||
}
|
||||
|
||||
@@ -174,10 +172,10 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
|
||||
* 部门管理授权查询数据规则数据
|
||||
*/
|
||||
@GetMapping(value = "/datarule/{permissionId}/{departId}")
|
||||
public Result<Map<String, Object>> loadDatarule(@PathVariable("permissionId") String permissionId,@PathVariable("departId") String departId) {
|
||||
public Results<Map<String, Object>> loadDatarule(@PathVariable("permissionId") String permissionId, @PathVariable("departId") String departId) {
|
||||
List<SysPermissionDataRule> list = sysPermissionDataRuleService.getPermRuleListByPermId(permissionId);
|
||||
if(list==null || list.isEmpty()) {
|
||||
return Result.error("未找到权限配置信息");
|
||||
return Results.error("未找到权限配置信息");
|
||||
}else {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("datarule", list);
|
||||
@@ -191,7 +189,7 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
|
||||
map.put("drChecked", drChecked.endsWith(",")?drChecked.substring(0, drChecked.length()-1):drChecked);
|
||||
}
|
||||
}
|
||||
return Result.OK(map);
|
||||
return Results.OK(map);
|
||||
// TODO 以后按钮权限的查询也走这个请求 无非在map中多加两个key
|
||||
}
|
||||
}
|
||||
@@ -203,8 +201,8 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
|
||||
*/
|
||||
// @RequestMapping(value = "/queryTreeListForDeptRole", method = RequestMethod.GET)
|
||||
@GetMapping("/queryTreeListForDeptRole")
|
||||
public Result<Map<String,Object>> queryTreeListForDeptRole(@RequestParam(name="departId",required=true) String departId,HttpServletRequest request) {
|
||||
Result<Map<String,Object>> result = new Result<>();
|
||||
public Results<Map<String,Object>> queryTreeListForDeptRole(@RequestParam(name="departId",required=true) String departId, HttpServletRequest request) {
|
||||
Results<Map<String,Object>> result = new Results<>();
|
||||
//全部权限ids
|
||||
List<String> ids = new ArrayList<>();
|
||||
try {
|
||||
|
||||
+71
-71
@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CacheConstant;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
@@ -77,9 +77,9 @@ public class SysDictController {
|
||||
// @RequestMapping(value = "/page", method = RequestMethod.GET)
|
||||
@GetMapping("/page")
|
||||
@ApiOperation(value = "字典控制器-分页列表查询", notes = "字典控制器-分页列表查询")
|
||||
public Result<IPage<SysDict>> queryPageList(SysDict sysDict, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Result<IPage<SysDict>> result = new Result<>();
|
||||
public Results<IPage<SysDict>> queryPageList(SysDict sysDict, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Results<IPage<SysDict>> result = new Results<>();
|
||||
QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, req.getParameterMap());
|
||||
Page<SysDict> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysDict> pageList = sysDictService.page(page, queryWrapper);
|
||||
@@ -103,9 +103,9 @@ public class SysDictController {
|
||||
@ApiOperation(value = "字典控制器-树形字典数据", notes = "字典控制器-树形字典数据")
|
||||
// @RequestMapping(value = "/treeList", method = RequestMethod.GET)
|
||||
@GetMapping("/treeList")
|
||||
public Result<List<SysDictTree>> treeList(SysDict sysDict, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Result<List<SysDictTree>> result = new Result<>();
|
||||
public Results<List<SysDictTree>> treeList(SysDict sysDict, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Results<List<SysDictTree>> result = new Results<>();
|
||||
LambdaQueryWrapper<SysDict> query = new LambdaQueryWrapper<>();
|
||||
// 构造查询条件
|
||||
String dictName = sysDict.getDictName();
|
||||
@@ -131,10 +131,10 @@ public class SysDictController {
|
||||
@ApiOperation(value = "字典控制器-获取全部字典数据", notes = "字典控制器-获取全部字典数据")
|
||||
// @RequestMapping(value = "/queryAllDictItems", method = RequestMethod.GET)
|
||||
@GetMapping("/queryAllDictItems")
|
||||
public Result<Map<String, List<DictModel>>> queryAllDictItems(HttpServletRequest request) {
|
||||
public Results<Map<String, List<DictModel>>> queryAllDictItems(HttpServletRequest request) {
|
||||
Map<String, List<DictModel>> res ;
|
||||
res = sysDictService.queryAllDictItems();
|
||||
return Result.OK(res);
|
||||
return Results.OK(res);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,9 +145,9 @@ public class SysDictController {
|
||||
@ApiOperation(value = "字典控制器-通过字典code和字典值key获取字典数据", notes = "字典控制器-通过字典code和字典值key获取字典数据")
|
||||
// @RequestMapping(value = "/getDictText/{dictCode}/{key}", method = RequestMethod.GET)
|
||||
@GetMapping("/getDictText/{dictCode}/{key}")
|
||||
public Result<String> getDictText(@PathVariable("dictCode") String dictCode, @PathVariable("key") String key) {
|
||||
public Results<String> getDictText(@PathVariable("dictCode") String dictCode, @PathVariable("key") String key) {
|
||||
log.info(" dictCode : "+ dictCode);
|
||||
Result<String> result = new Result<>();
|
||||
Results<String> result = new Results<>();
|
||||
String text = null;
|
||||
try {
|
||||
text = sysDictService.queryDictTextByKey(dictCode, key);
|
||||
@@ -155,7 +155,7 @@ public class SysDictController {
|
||||
result.setResult(text);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -168,20 +168,20 @@ public class SysDictController {
|
||||
*/
|
||||
// @RequestMapping(value = "/getDictItems/{dictCode}", method = RequestMethod.GET)
|
||||
@GetMapping("/getDictItems/{dictCode}")
|
||||
public Result<List<DictModel>> getDictItems(@PathVariable String dictCode, @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request) {
|
||||
public Results<List<DictModel>> getDictItems(@PathVariable String dictCode, @RequestParam(value = "sign",required = false) String sign, HttpServletRequest request) {
|
||||
log.info(" dictCode : "+ dictCode);
|
||||
Result<List<DictModel>> result = new Result<>();
|
||||
Results<List<DictModel>> result = new Results<>();
|
||||
try {
|
||||
List<DictModel> ls = sysDictService.getDictItems(dictCode);
|
||||
if (ls == null) {
|
||||
return Result.error(DICT_CODE_ERROE);
|
||||
return Results.error(DICT_CODE_ERROE);
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
log.debug(result.toString());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -195,16 +195,16 @@ public class SysDictController {
|
||||
*/
|
||||
// @RequestMapping(value = "/loadDict/{dictCode}", method = RequestMethod.GET)
|
||||
@GetMapping("/loadDict/{dictCode}")
|
||||
public Result<List<DictModel>> loadDict(@PathVariable String dictCode,
|
||||
@RequestParam(name="keyword") String keyword,
|
||||
@RequestParam(value = "sign",required = false) String sign,
|
||||
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
||||
public Results<List<DictModel>> loadDict(@PathVariable String dictCode,
|
||||
@RequestParam(name="keyword") String keyword,
|
||||
@RequestParam(value = "sign",required = false) String sign,
|
||||
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
||||
log.info(" 加载字典表数据,加载关键字: "+ keyword);
|
||||
Result<List<DictModel>> result = new Result<>();
|
||||
Results<List<DictModel>> result = new Results<>();
|
||||
try {
|
||||
List<DictModel> ls = sysDictService.loadDict(dictCode, keyword, pageSize);
|
||||
if (ls == null) {
|
||||
return Result.error(DICT_CODE_ERROE);
|
||||
return Results.error(DICT_CODE_ERROE);
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
@@ -212,7 +212,7 @@ public class SysDictController {
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,18 +226,18 @@ public class SysDictController {
|
||||
*/
|
||||
// @RequestMapping(value = "/loadDictOrderByValue/{dictCode}", method = RequestMethod.GET)
|
||||
@GetMapping("/loadDictOrderByValue/{dictCode}")
|
||||
public Result<List<DictModel>> loadDictOrderByValue(
|
||||
public Results<List<DictModel>> loadDictOrderByValue(
|
||||
@PathVariable String dictCode,
|
||||
@RequestParam(name = "keyword") String keyword,
|
||||
@RequestParam(value = "sign", required = false) String sign,
|
||||
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
||||
// 首次查询查出来用户选中的值,并且不分页
|
||||
Result<List<DictModel>> firstRes = this.loadDict(dictCode, keyword, sign, null);
|
||||
Results<List<DictModel>> firstRes = this.loadDict(dictCode, keyword, sign, null);
|
||||
if (!firstRes.isSuccess()) {
|
||||
return firstRes;
|
||||
}
|
||||
// 然后再查询出第一页的数据
|
||||
Result<List<DictModel>> result = this.loadDict(dictCode, "", sign, pageSize);
|
||||
Results<List<DictModel>> result = this.loadDict(dictCode, "", sign, pageSize);
|
||||
if (!result.isSuccess()) {
|
||||
return result;
|
||||
}
|
||||
@@ -269,13 +269,13 @@ public class SysDictController {
|
||||
*/
|
||||
// @RequestMapping(value = "/loadDictItem/{dictCode}", method = RequestMethod.GET)
|
||||
@GetMapping("/loadDictItem/{dictCode}")
|
||||
public Result<List<String>> loadDictItem(@PathVariable String dictCode,@RequestParam(name="key") String keys, @RequestParam(value = "sign",required = false) String sign,@RequestParam(value = "delNotExist",required = false,defaultValue = "true") boolean delNotExist,HttpServletRequest request) {
|
||||
Result<List<String>> result = new Result<>();
|
||||
public Results<List<String>> loadDictItem(@PathVariable String dictCode, @RequestParam(name="key") String keys, @RequestParam(value = "sign",required = false) String sign, @RequestParam(value = "delNotExist",required = false,defaultValue = "true") boolean delNotExist, HttpServletRequest request) {
|
||||
Results<List<String>> result = new Results<>();
|
||||
try {
|
||||
if(dictCode.indexOf(",")!=-1) {
|
||||
String[] params = dictCode.split(",");
|
||||
if(params.length!=3) {
|
||||
return Result.error(DICT_CODE_ERROE);
|
||||
return Results.error(DICT_CODE_ERROE);
|
||||
}
|
||||
List<String> texts = sysDictService.queryTableDictByKeys(params[0], params[1], params[2], keys, delNotExist);
|
||||
|
||||
@@ -283,11 +283,11 @@ public class SysDictController {
|
||||
result.setResult(texts);
|
||||
log.info(result.toString());
|
||||
}else {
|
||||
return Result.error(DICT_CODE_ERROE);
|
||||
return Results.error(DICT_CODE_ERROE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -300,13 +300,13 @@ public class SysDictController {
|
||||
@ApiOperation(value = "字典控制器-根据表名—显示字段-存储字段 pid 加载树形数据", notes = "字典控制器-根据表名—显示字段-存储字段 pid 加载树形数据")
|
||||
// @RequestMapping(value = "/loadTreeData", method = RequestMethod.GET)
|
||||
@GetMapping("/loadTreeData")
|
||||
public Result<List<TreeSelectModel>> loadTreeData(@RequestParam(name="pid") String pid, @RequestParam(name="pidField") String pidField,
|
||||
@RequestParam(name="tableName") String tbname,
|
||||
@RequestParam(name="text") String text,
|
||||
@RequestParam(name="code") String code,
|
||||
@RequestParam(name="hasChildField", required = false) String hasChildField,
|
||||
@RequestParam(value = "sign", required = false) String sign, HttpServletRequest request) {
|
||||
Result<List<TreeSelectModel>> result = new Result<>();
|
||||
public Results<List<TreeSelectModel>> loadTreeData(@RequestParam(name="pid") String pid, @RequestParam(name="pidField") String pidField,
|
||||
@RequestParam(name="tableName") String tbname,
|
||||
@RequestParam(name="text") String text,
|
||||
@RequestParam(name="code") String code,
|
||||
@RequestParam(name="hasChildField", required = false) String hasChildField,
|
||||
@RequestParam(value = "sign", required = false) String sign, HttpServletRequest request) {
|
||||
Results<List<TreeSelectModel>> result = new Results<>();
|
||||
|
||||
// SQL注入漏洞 sign签名校验(表名,label字段,val字段,条件)
|
||||
String dictCode = tbname +","+ text +","+ code;
|
||||
@@ -323,12 +323,12 @@ public class SysDictController {
|
||||
@ApiOperation(value = "字典控制器-根据表名—显示字段-存储字段 加载树形数据", notes = "字典控制器-根据表名—显示字段-存储字段 加载树形数据")
|
||||
// @RequestMapping(value = "/queryAllTreeData", method = RequestMethod.GET)
|
||||
@GetMapping("/queryAllTreeData")
|
||||
public Result<List<TreeSelectModel>> queryAllTreeData(@RequestParam(name="pidField") String pidField,
|
||||
@RequestParam(name="tableName") String tbname,
|
||||
@RequestParam(name="text") String text,
|
||||
@RequestParam(name="code") String code,
|
||||
HttpServletRequest request) {
|
||||
Result<List<TreeSelectModel>> result = new Result<>();
|
||||
public Results<List<TreeSelectModel>> queryAllTreeData(@RequestParam(name="pidField") String pidField,
|
||||
@RequestParam(name="tableName") String tbname,
|
||||
@RequestParam(name="text") String text,
|
||||
@RequestParam(name="code") String code,
|
||||
HttpServletRequest request) {
|
||||
Results<List<TreeSelectModel>> result = new Results<>();
|
||||
|
||||
// SQL注入漏洞 sign签名校验(表名,label字段,val字段,条件)
|
||||
String dictCode = tbname +","+ text +","+ code;
|
||||
@@ -347,17 +347,17 @@ public class SysDictController {
|
||||
@ApiOperation(value = "字典控制器-新增字典", notes = "字典控制器-新增字典")
|
||||
// @RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@PostMapping("/add")
|
||||
public Result<Object> add(@RequestBody SysDict sysDict) {
|
||||
public Results<Object> add(@RequestBody SysDict sysDict) {
|
||||
try {
|
||||
sysDict.setCreateTime(new Date());
|
||||
sysDict.setDelFlag(CommonConstant.DEL_FLAG_0);
|
||||
sysDictService.save(sysDict);
|
||||
//添加成功后需要刷新缓存
|
||||
sysDictService.refreshCache();
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,20 +369,20 @@ public class SysDictController {
|
||||
@ApiOperation(value = "字典控制器-编辑字典", notes = "字典控制器-编辑字典")
|
||||
// @RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
@PostMapping("/edit")
|
||||
public Result<Object> edit(@RequestBody SysDict sysDict) {
|
||||
public Results<Object> edit(@RequestBody SysDict sysDict) {
|
||||
SysDict sysdict = sysDictService.getById(sysDict.getId());
|
||||
if(sysdict==null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
}else {
|
||||
sysDict.setUpdateTime(new Date());
|
||||
boolean ok = sysDictService.updateById(sysDict);
|
||||
if(ok) {
|
||||
//编辑成功后需要刷新缓存
|
||||
sysDictService.refreshCache();
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -393,16 +393,16 @@ public class SysDictController {
|
||||
@ApiOperation(value = "字典控制器-删除字典", notes = "字典控制器-删除字典")
|
||||
@PostMapping(value = "/delete")
|
||||
@CacheEvict(value={CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<Object> delete(@RequestBody Map<String,String> map) {
|
||||
public Results<Object> delete(@RequestBody Map<String,String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
boolean ok = sysDictService.removeById(id);
|
||||
if(ok) {
|
||||
return Result.OK(DEL_SUCCESS);
|
||||
return Results.OK(DEL_SUCCESS);
|
||||
}else{
|
||||
return Result.error("删除失败!");
|
||||
return Results.error("删除失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,12 +414,12 @@ public class SysDictController {
|
||||
@ApiOperation(value = "字典控制器-批量字典", notes = "字典控制器-批量字典")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
@CacheEvict(value= {CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<Object> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
public Results<Object> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
if(oConvertUtils.isEmpty(ids)) {
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}else {
|
||||
sysDictService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK(DEL_SUCCESS);
|
||||
return Results.OK(DEL_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,8 +429,8 @@ public class SysDictController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/refleshCache")
|
||||
public Result<SysDict> refleshCache() {
|
||||
Result<SysDict> result = new Result<>();
|
||||
public Results<SysDict> refleshCache() {
|
||||
Results<SysDict> result = new Results<>();
|
||||
sysDictService.refreshCache();
|
||||
return result;
|
||||
}
|
||||
@@ -472,7 +472,7 @@ public class SysDictController {
|
||||
|
||||
|
||||
@PostMapping(value = "/importExcel")
|
||||
public Result<JSONObject> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<JSONObject> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
@@ -514,12 +514,12 @@ public class SysDictController {
|
||||
return ImportExcelUtil.imporReturnRes(errorLines,successLines,errorMessage);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("文件导入失败:"+e.getMessage());
|
||||
return Results.error("文件导入失败:"+e.getMessage());
|
||||
} finally {
|
||||
fileClose(file);
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
return Results.error("文件导入失败!");
|
||||
}
|
||||
|
||||
private void fileClose(MultipartFile file) {
|
||||
@@ -536,9 +536,9 @@ public class SysDictController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/deleteList")
|
||||
public Result<List<SysDict>> deleteList() {
|
||||
public Results<List<SysDict>> deleteList() {
|
||||
List<SysDict> list = this.sysDictService.queryDeleteList();
|
||||
return Result.OK(list);
|
||||
return Results.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -547,13 +547,13 @@ public class SysDictController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deletePhysic/{id}")
|
||||
public Result<T> deletePhysic(@PathVariable String id) {
|
||||
public Results<T> deletePhysic(@PathVariable String id) {
|
||||
try {
|
||||
sysDictService.deleteOneDictPhysically(id);
|
||||
return Result.OK(DEL_SUCCESS);
|
||||
return Results.OK(DEL_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("删除失败!");
|
||||
return Results.error("删除失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,13 +563,13 @@ public class SysDictController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/back/{id}")
|
||||
public Result<T> back(@PathVariable String id) {
|
||||
public Results<T> back(@PathVariable String id) {
|
||||
try {
|
||||
sysDictService.updateDictDelFlag(0,id);
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("操作失败!");
|
||||
return Results.error("操作失败!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+22
-24
@@ -8,15 +8,13 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.CacheConstant;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.system.entity.SysDictItem;
|
||||
import com.jero.modules.system.service.ISysDictItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -56,9 +54,9 @@ public class SysDictItemController {
|
||||
@RequiresPermissions("sys:dict:list")
|
||||
// @RequestMapping(value = "/page", method = RequestMethod.GET)
|
||||
@GetMapping("/page")
|
||||
public Result<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysDictItem>> result = new Result<>();
|
||||
public Results<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Results<IPage<SysDictItem>> result = new Results<>();
|
||||
QueryWrapper<SysDictItem> queryWrapper = QueryGenerator.initQueryWrapper(sysDictItem, req.getParameterMap());
|
||||
queryWrapper.orderByAsc("sort_order");
|
||||
Page<SysDictItem> page = new Page<>(pageNo, pageSize);
|
||||
@@ -77,14 +75,14 @@ public class SysDictItemController {
|
||||
// @RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@PostMapping("/add")
|
||||
@CacheEvict(value= {CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<Object> add(@RequestBody SysDictItem sysDictItem) {
|
||||
public Results<Object> add(@RequestBody SysDictItem sysDictItem) {
|
||||
try {
|
||||
sysDictItem.setCreateTime(new Date());
|
||||
sysDictItemService.save(sysDictItem);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,18 +96,18 @@ public class SysDictItemController {
|
||||
// @RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
@PostMapping("/edit")
|
||||
@CacheEvict(value={CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<Object> edit(@RequestBody SysDictItem sysDictItem) {
|
||||
public Results<Object> edit(@RequestBody SysDictItem sysDictItem) {
|
||||
SysDictItem sysdict = sysDictItemService.getById(sysDictItem.getId());
|
||||
if(sysdict==null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
}else {
|
||||
sysDictItem.setUpdateTime(new Date());
|
||||
boolean ok = sysDictItemService.updateById(sysDictItem);
|
||||
if(ok) {
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,21 +120,21 @@ public class SysDictItemController {
|
||||
// @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@CacheEvict(value={CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
SysDictItem joinSystem = sysDictItemService.getById(id);
|
||||
if(joinSystem==null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysDictItemService.removeById(id);
|
||||
if(ok) {
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,13 +147,13 @@ public class SysDictItemController {
|
||||
// @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deleteBatch")
|
||||
@CacheEvict(value={CacheConstant.SYS_DICT_CACHE, CacheConstant.SYS_ENABLE_DICT_CACHE}, allEntries=true)
|
||||
public Result<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<Object> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}else {
|
||||
this.sysDictItemService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +167,7 @@ public class SysDictItemController {
|
||||
// @RequestMapping(value = "/dictItemCheck", method = RequestMethod.GET)
|
||||
@GetMapping("/dictItemCheck")
|
||||
@ApiOperation("字典重复校验接口")
|
||||
public Result<Object> doDictItemCheck(SysDictItem sysDictItem, HttpServletRequest request) {
|
||||
public Results<Object> doDictItemCheck(SysDictItem sysDictItem, HttpServletRequest request) {
|
||||
int num = 0;
|
||||
LambdaQueryWrapper<SysDictItem> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysDictItem::getItemValue,sysDictItem.getItemValue());
|
||||
@@ -181,11 +179,11 @@ public class SysDictItemController {
|
||||
num = sysDictItemService.count(queryWrapper);
|
||||
if (num == 0) {
|
||||
// 该值可用
|
||||
return Result.OK("该值可用!");
|
||||
return Results.OK("该值可用!");
|
||||
} else {
|
||||
// 该值不可用
|
||||
log.info("该值不可用,系统中已存在!");
|
||||
return Result.error("该值不可用,系统中已存在!");
|
||||
return Results.error("该值不可用,系统中已存在!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+25
-25
@@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
@@ -52,14 +52,14 @@ public class SysFillRuleController extends JeroController<SysFillRule, ISysFillR
|
||||
@AutoLog(value = "填值规则-分页列表查询")
|
||||
@ApiOperation(value = "填值规则-分页列表查询", notes = "填值规则-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<SysFillRule>> queryPageList(SysFillRule sysFillRule,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
public Results<IPage<SysFillRule>> queryPageList(SysFillRule sysFillRule,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SysFillRule> queryWrapper = QueryGenerator.initQueryWrapper(sysFillRule, req.getParameterMap());
|
||||
Page<SysFillRule> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysFillRule> pageList = sysFillRuleService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,9 +69,9 @@ public class SysFillRuleController extends JeroController<SysFillRule, ISysFillR
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/testFillRule")
|
||||
public Result<Object> testFillRule(@RequestParam("ruleCode") String ruleCode) {
|
||||
public Results<Object> testFillRule(@RequestParam("ruleCode") String ruleCode) {
|
||||
Object result = FillRuleUtil.executeRule(ruleCode, new JSONObject());
|
||||
return Result.OK(result);
|
||||
return Results.OK(result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,9 +83,9 @@ public class SysFillRuleController extends JeroController<SysFillRule, ISysFillR
|
||||
@AutoLog(value = "填值规则-添加")
|
||||
@ApiOperation(value = "填值规则-添加", notes = "填值规则-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@RequestBody SysFillRule sysFillRule) {
|
||||
public Results<T> add(@RequestBody SysFillRule sysFillRule) {
|
||||
sysFillRuleService.save(sysFillRule);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,9 +97,9 @@ public class SysFillRuleController extends JeroController<SysFillRule, ISysFillR
|
||||
@AutoLog(value = "填值规则-编辑")
|
||||
@ApiOperation(value = "填值规则-编辑", notes = "填值规则-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@RequestBody SysFillRule sysFillRule) {
|
||||
public Results<T> edit(@RequestBody SysFillRule sysFillRule) {
|
||||
sysFillRuleService.updateById(sysFillRule);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,13 +111,13 @@ public class SysFillRuleController extends JeroController<SysFillRule, ISysFillR
|
||||
@AutoLog(value = "填值规则-通过id删除")
|
||||
@ApiOperation(value = "填值规则-通过id删除", notes = "填值规则-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
sysFillRuleService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,13 +129,13 @@ public class SysFillRuleController extends JeroController<SysFillRule, ISysFillR
|
||||
@AutoLog(value = "填值规则-批量删除")
|
||||
@ApiOperation(value = "填值规则-批量删除", notes = "填值规则-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
this.sysFillRuleService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
return Results.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,9 +147,9 @@ public class SysFillRuleController extends JeroController<SysFillRule, ISysFillR
|
||||
@AutoLog(value = "填值规则-通过id查询")
|
||||
@ApiOperation(value = "填值规则-通过id查询", notes = "填值规则-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysFillRule> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
public Results<SysFillRule> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysFillRule sysFillRule = sysFillRuleService.getById(id);
|
||||
return Result.OK(sysFillRule);
|
||||
return Results.OK(sysFillRule);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,7 +172,7 @@ public class SysFillRuleController extends JeroController<SysFillRule, ISysFillR
|
||||
*/
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@PostMapping("/importExcel")
|
||||
public Result<SysFillRule> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<SysFillRule> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysFillRule.class);
|
||||
}
|
||||
|
||||
@@ -184,9 +184,9 @@ public class SysFillRuleController extends JeroController<SysFillRule, ISysFillR
|
||||
* @return 运行后的结果
|
||||
*/
|
||||
@PostMapping("/executeRuleByCode/{ruleCode}")
|
||||
public Result<Object> executeByRuleCode(@PathVariable("ruleCode") String ruleCode, @RequestBody JSONObject formData) {
|
||||
public Results<Object> executeByRuleCode(@PathVariable("ruleCode") String ruleCode, @RequestBody JSONObject formData) {
|
||||
Object result = FillRuleUtil.executeRule(ruleCode, formData);
|
||||
return Result.OK(result);
|
||||
return Results.OK(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ public class SysFillRuleController extends JeroController<SysFillRule, ISysFillR
|
||||
*
|
||||
*/
|
||||
@PostMapping("/executeRuleByCodeBatch")
|
||||
public Result<JSONArray> executeByRuleCodeBatch(@RequestBody JSONObject ruleData) {
|
||||
public Results<JSONArray> executeByRuleCodeBatch(@RequestBody JSONObject ruleData) {
|
||||
JSONObject commonFormData = ruleData.getJSONObject("commonFormData");
|
||||
JSONArray rules = ruleData.getJSONArray("rules");
|
||||
// 遍历 rules ,批量执行规则
|
||||
@@ -219,7 +219,7 @@ public class SysFillRuleController extends JeroController<SysFillRule, ISysFillR
|
||||
obj.put("result", result);
|
||||
results.add(obj);
|
||||
}
|
||||
return Result.OK(results);
|
||||
return Results.OK(results);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
-10
@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.system.entity.SysGatewayRoute;
|
||||
@@ -35,13 +35,13 @@ public class SysGatewayRouteController extends JeroController<SysGatewayRoute, I
|
||||
private ISysGatewayRouteService sysGatewayRouteService;
|
||||
|
||||
@PostMapping(value = "/updateAll")
|
||||
public Result<T> updateAll(@RequestBody JSONObject json) {
|
||||
public Results<T> updateAll(@RequestBody JSONObject json) {
|
||||
sysGatewayRouteService.updateAll(json);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
public Result<JSONArray> queryPageList(SysGatewayRoute sysGatewayRoute) {
|
||||
public Results<JSONArray> queryPageList(SysGatewayRoute sysGatewayRoute) {
|
||||
LambdaQueryWrapper<SysGatewayRoute> query = new LambdaQueryWrapper<>();
|
||||
List<SysGatewayRoute> ls = sysGatewayRouteService.list(query);
|
||||
JSONArray array = new JSONArray();
|
||||
@@ -55,13 +55,13 @@ public class SysGatewayRouteController extends JeroController<SysGatewayRoute, I
|
||||
}
|
||||
array.add(obj);
|
||||
}
|
||||
return Result.OK(array);
|
||||
return Results.OK(array);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/clearRedis")
|
||||
public Result<T> clearRedis() {
|
||||
public Results<T> clearRedis() {
|
||||
sysGatewayRouteService.clearRedis();
|
||||
return Result.OK("清除成功!");
|
||||
return Results.OK("清除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,13 +73,13 @@ public class SysGatewayRouteController extends JeroController<SysGatewayRoute, I
|
||||
//@RequiresRoles({"admin"})
|
||||
// @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
sysGatewayRouteService.deleteById(id);
|
||||
return Result.OK("删除路由成功");
|
||||
return Results.OK("删除路由成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+13
-13
@@ -4,7 +4,7 @@ package com.jero.modules.system.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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.system.entity.SysLog;
|
||||
@@ -45,9 +45,9 @@ public class SysLogController {
|
||||
*/
|
||||
// @RequestMapping(value = "/page", method = RequestMethod.GET)
|
||||
@GetMapping("/page")
|
||||
public Result<IPage<SysLog>> queryPageList(SysLog syslog,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysLog>> result = new Result<>();
|
||||
public Results<IPage<SysLog>> queryPageList(SysLog syslog, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Results<IPage<SysLog>> result = new Results<>();
|
||||
QueryWrapper<SysLog> queryWrapper = QueryGenerator.initQueryWrapper(syslog, req.getParameterMap());
|
||||
Page<SysLog> page = new Page<>(pageNo, pageSize);
|
||||
//日志关键词
|
||||
@@ -73,21 +73,21 @@ public class SysLogController {
|
||||
*/
|
||||
// @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
SysLog sysLog = sysLogService.getById(id);
|
||||
if(sysLog==null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysLogService.removeById(id);
|
||||
if(ok) {
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,17 +97,17 @@ public class SysLogController {
|
||||
*/
|
||||
// @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}else {
|
||||
if("allclear".equals(ids)) {
|
||||
this.sysLogService.removeAll();
|
||||
return Result.OK("清除成功!");
|
||||
return Results.OK("清除成功!");
|
||||
}
|
||||
this.sysLogService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+58
-58
@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.MD5Util;
|
||||
@@ -68,9 +68,9 @@ public class SysPermissionController {
|
||||
*/
|
||||
// @RequestMapping(value = "/page", method = RequestMethod.GET)
|
||||
@GetMapping("/page")
|
||||
public Result<List<SysPermissionTree>> list() {
|
||||
public Results<List<SysPermissionTree>> list() {
|
||||
long start = System.currentTimeMillis();
|
||||
Result<List<SysPermissionTree>> result = new Result<>();
|
||||
Results<List<SysPermissionTree>> result = new Results<>();
|
||||
try {
|
||||
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0);
|
||||
@@ -95,9 +95,9 @@ public class SysPermissionController {
|
||||
*/
|
||||
// @RequestMapping(value = "/getSystemMenuList", method = RequestMethod.GET)
|
||||
@GetMapping("/getSystemMenuList")
|
||||
public Result<List<SysPermissionTree>> getSystemMenuList() {
|
||||
public Results<List<SysPermissionTree>> getSystemMenuList() {
|
||||
long start = System.currentTimeMillis();
|
||||
Result<List<SysPermissionTree>> result = new Result<>();
|
||||
Results<List<SysPermissionTree>> result = new Results<>();
|
||||
try {
|
||||
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysPermission::getMenuType,CommonConstant.MENU_TYPE_0);
|
||||
@@ -125,8 +125,8 @@ public class SysPermissionController {
|
||||
*/
|
||||
// @RequestMapping(value = "/getSystemSubmenu", method = RequestMethod.GET)
|
||||
@GetMapping("/getSystemSubmenu")
|
||||
public Result<List<SysPermissionTree>> getSystemSubmenu(@RequestParam("parentId") String parentId){
|
||||
Result<List<SysPermissionTree>> result = new Result<>();
|
||||
public Results<List<SysPermissionTree>> getSystemSubmenu(@RequestParam("parentId") String parentId){
|
||||
Results<List<SysPermissionTree>> result = new Results<>();
|
||||
try{
|
||||
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysPermission::getParentId,parentId);
|
||||
@@ -155,7 +155,7 @@ public class SysPermissionController {
|
||||
* @return 返回 key-value 的 Map
|
||||
*/
|
||||
@GetMapping("/getSystemSubmenuBatch")
|
||||
public Result<Map<String, List<SysPermissionTree>>> getSystemSubmenuBatch(@RequestParam("parentIds") String parentIds) {
|
||||
public Results<Map<String, List<SysPermissionTree>>> getSystemSubmenuBatch(@RequestParam("parentIds") String parentIds) {
|
||||
try {
|
||||
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
|
||||
List<String> parentIdList = Arrays.asList(parentIds.split(","));
|
||||
@@ -175,10 +175,10 @@ public class SysPermissionController {
|
||||
listMap.put(pid, mapList);
|
||||
}
|
||||
}
|
||||
return Result.OK(listMap);
|
||||
return Results.OK(listMap);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("批量查询子菜单失败:" + e.getMessage());
|
||||
return Results.error("批量查询子菜单失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,13 +189,13 @@ public class SysPermissionController {
|
||||
*/
|
||||
// @RequestMapping(value = "/getUserPermissionByToken", method = RequestMethod.GET)
|
||||
@GetMapping("/getUserPermissionByToken")
|
||||
public Result<JSONObject> getUserPermissionByToken() {
|
||||
Result<JSONObject> result = new Result<>();
|
||||
public Results<JSONObject> getUserPermissionByToken() {
|
||||
Results<JSONObject> result = new Results<>();
|
||||
try {
|
||||
//直接获取当前用户不适用前端token
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (oConvertUtils.isEmpty(loginUser)) {
|
||||
return Result.error("请登录系统!");
|
||||
return Results.error("请登录系统!");
|
||||
}
|
||||
List<SysPermission> metaList = sysPermissionService.queryByUser(loginUser.getUsername());
|
||||
|
||||
@@ -221,7 +221,7 @@ public class SysPermissionController {
|
||||
result.setMessage("查询成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("查询失败:" + e.getMessage());
|
||||
return Results.error("查询失败:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -234,14 +234,14 @@ public class SysPermissionController {
|
||||
//@RequiresRoles({ "admin" })
|
||||
// @RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@PostMapping("/add")
|
||||
public Result<Object> add(@RequestBody SysPermission permission) {
|
||||
public Results<Object> add(@RequestBody SysPermission permission) {
|
||||
try {
|
||||
permission = PermissionDataUtil.intelligentProcessData(permission);
|
||||
sysPermissionService.addPermission(permission);
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,14 +253,14 @@ public class SysPermissionController {
|
||||
//@RequiresRoles({ "admin" })
|
||||
// @RequestMapping(value = "/edit", method = { RequestMethod.PUT, RequestMethod.POST })
|
||||
@PostMapping("/edit")
|
||||
public Result<Object> edit(@RequestBody SysPermission permission) {
|
||||
public Results<Object> edit(@RequestBody SysPermission permission) {
|
||||
try {
|
||||
permission = PermissionDataUtil.intelligentProcessData(permission);
|
||||
sysPermissionService.editPermission(permission);
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,17 +272,17 @@ public class SysPermissionController {
|
||||
//@RequiresRoles({ "admin" })
|
||||
// @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
try {
|
||||
sysPermissionService.deletePermission(id);
|
||||
return Result.OK(DEL_SUCCESS);
|
||||
return Results.OK(DEL_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
return Results.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,10 +294,10 @@ public class SysPermissionController {
|
||||
//@RequiresRoles({ "admin" })
|
||||
// @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
try {
|
||||
String[] arr = ids.split(",");
|
||||
@@ -306,10 +306,10 @@ public class SysPermissionController {
|
||||
sysPermissionService.deletePermission(id);
|
||||
}
|
||||
}
|
||||
return Result.OK(DEL_SUCCESS);
|
||||
return Results.OK(DEL_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(DEL_SUCCESS);
|
||||
return Results.error(DEL_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,8 +320,8 @@ public class SysPermissionController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryTreeList", method = RequestMethod.GET)
|
||||
@GetMapping("/queryTreeList")
|
||||
public Result<Map<String, Object>> queryTreeList() {
|
||||
Result<Map<String, Object>> result = new Result<>();
|
||||
public Results<Map<String, Object>> queryTreeList() {
|
||||
Results<Map<String, Object>> result = new Results<>();
|
||||
// 全部权限ids
|
||||
List<String> ids = new ArrayList<>();
|
||||
try {
|
||||
@@ -353,12 +353,12 @@ public class SysPermissionController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryListAsync", method = RequestMethod.GET)
|
||||
@GetMapping("/queryListAsync")
|
||||
public Result<List<TreeModel>> queryAsync(@RequestParam(name = "pid", required = false) String parentId) {
|
||||
Result<List<TreeModel>> result = new Result<>();
|
||||
public Results<List<TreeModel>> queryAsync(@RequestParam(name = "pid", required = false) String parentId) {
|
||||
Results<List<TreeModel>> result = new Results<>();
|
||||
try {
|
||||
List<TreeModel> list = sysPermissionService.queryListByParentId(parentId);
|
||||
if (list == null || list.isEmpty()) {
|
||||
return Result.error("未找到角色信息");
|
||||
return Results.error("未找到角色信息");
|
||||
} else {
|
||||
result.setResult(list);
|
||||
result.setSuccess(true);
|
||||
@@ -377,8 +377,8 @@ public class SysPermissionController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryRolePermission", method = RequestMethod.GET)
|
||||
@GetMapping("/queryRolePermission")
|
||||
public Result<List<String>> queryRolePermission(@RequestParam(name = "roleId", required = true) String roleId) {
|
||||
Result<List<String>> result = new Result<>();
|
||||
public Results<List<String>> queryRolePermission(@RequestParam(name = "roleId", required = true) String roleId) {
|
||||
Results<List<String>> result = new Results<>();
|
||||
try {
|
||||
List<SysRolePermission> list = sysRolePermissionService.list(new QueryWrapper<SysRolePermission>().lambda().eq(SysRolePermission::getRoleId, roleId));
|
||||
result.setResult(list.stream().map(sysRolePermission -> String.valueOf(sysRolePermission.getPermissionId())).collect(Collectors.toList()));
|
||||
@@ -397,7 +397,7 @@ public class SysPermissionController {
|
||||
// @RequestMapping(value = "/saveRolePermission", method = RequestMethod.POST)
|
||||
@PostMapping("/saveRolePermission")
|
||||
//@RequiresRoles({ "admin" })
|
||||
public Result<String> saveRolePermission(@RequestBody JSONObject json) {
|
||||
public Results<String> saveRolePermission(@RequestBody JSONObject json) {
|
||||
long start = System.currentTimeMillis();
|
||||
try {
|
||||
String roleId = json.getString("roleId");
|
||||
@@ -405,10 +405,10 @@ public class SysPermissionController {
|
||||
String lastPermissionIds = json.getString("lastpermissionIds");
|
||||
this.sysRolePermissionService.saveRolePermission(roleId, permissionIds, lastPermissionIds);
|
||||
log.info("======角色授权成功=====耗时:" + (System.currentTimeMillis() - start) + "毫秒");
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("授权失败!");
|
||||
return Results.error("授权失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -667,9 +667,9 @@ public class SysPermissionController {
|
||||
*/
|
||||
// @RequestMapping(value = "/getPermRuleListByPermId", method = RequestMethod.GET)
|
||||
@GetMapping("/getPermRuleListByPermId")
|
||||
public Result<List<SysPermissionDataRule>> getPermRuleListByPermId(SysPermissionDataRule sysPermissionDataRule) {
|
||||
public Results<List<SysPermissionDataRule>> getPermRuleListByPermId(SysPermissionDataRule sysPermissionDataRule) {
|
||||
List<SysPermissionDataRule> permRuleList = sysPermissionDataRuleService.getPermRuleListByPermId(sysPermissionDataRule.getPermissionId());
|
||||
Result<List<SysPermissionDataRule>> result = new Result<>();
|
||||
Results<List<SysPermissionDataRule>> result = new Results<>();
|
||||
result.setSuccess(true);
|
||||
result.setResult(permRuleList);
|
||||
return result;
|
||||
@@ -684,27 +684,27 @@ public class SysPermissionController {
|
||||
//@RequiresRoles({ "admin" })
|
||||
// @RequestMapping(value = "/addPermissionRule", method = RequestMethod.POST)
|
||||
@PostMapping("/addPermissionRule")
|
||||
public Result<Object> addPermissionRule(@RequestBody SysPermissionDataRule sysPermissionDataRule) {
|
||||
public Results<Object> addPermissionRule(@RequestBody SysPermissionDataRule sysPermissionDataRule) {
|
||||
try {
|
||||
sysPermissionDataRule.setCreateTime(new Date());
|
||||
sysPermissionDataRuleService.savePermissionDataRule(sysPermissionDataRule);
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
//@RequiresRoles({ "admin" })
|
||||
// @RequestMapping(value = "/editPermissionRule", method = { RequestMethod.PUT, RequestMethod.POST })
|
||||
@PostMapping("/editPermissionRule")
|
||||
public Result<Object> editPermissionRule(@RequestBody SysPermissionDataRule sysPermissionDataRule) {
|
||||
public Results<Object> editPermissionRule(@RequestBody SysPermissionDataRule sysPermissionDataRule) {
|
||||
try {
|
||||
sysPermissionDataRuleService.saveOrUpdate(sysPermissionDataRule);
|
||||
return Result.OK("更新成功!");
|
||||
return Results.OK("更新成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -717,17 +717,17 @@ public class SysPermissionController {
|
||||
//@RequiresRoles({ "admin" })
|
||||
// @RequestMapping(value = "/deletePermissionRule", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deletePermissionRule")
|
||||
public Result<Object> deletePermissionRule(@RequestBody Map<String,String> map) {
|
||||
public Results<Object> deletePermissionRule(@RequestBody Map<String,String> map) {
|
||||
try {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
sysPermissionDataRuleService.deletePermissionDataRule(id);
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -739,13 +739,13 @@ public class SysPermissionController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryPermissionRule", method = RequestMethod.GET)
|
||||
@GetMapping("/queryPermissionRule")
|
||||
public Result<List<SysPermissionDataRule>> queryPermissionRule(SysPermissionDataRule sysPermissionDataRule) {
|
||||
public Results<List<SysPermissionDataRule>> queryPermissionRule(SysPermissionDataRule sysPermissionDataRule) {
|
||||
try {
|
||||
List<SysPermissionDataRule> permRuleList = sysPermissionDataRuleService.queryPermissionRule(sysPermissionDataRule);
|
||||
return Result.OK("查询成功", permRuleList);
|
||||
return Results.OK("查询成功", permRuleList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,8 +756,8 @@ public class SysPermissionController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryDepartPermission", method = RequestMethod.GET)
|
||||
@GetMapping("/queryDepartPermission")
|
||||
public Result<List<String>> queryDepartPermission(@RequestParam(name = "departId", required = true) String departId) {
|
||||
Result<List<String>> result = new Result<>();
|
||||
public Results<List<String>> queryDepartPermission(@RequestParam(name = "departId", required = true) String departId) {
|
||||
Results<List<String>> result = new Results<>();
|
||||
try {
|
||||
List<SysDepartPermission> list = sysDepartPermissionService.list(new QueryWrapper<SysDepartPermission>().lambda().eq(SysDepartPermission::getDepartId, departId));
|
||||
result.setResult(list.stream().map(sysDepartPermission -> String.valueOf(sysDepartPermission.getPermissionId())).collect(Collectors.toList()));
|
||||
@@ -776,7 +776,7 @@ public class SysPermissionController {
|
||||
// @RequestMapping(value = "/saveDepartPermission", method = RequestMethod.POST)
|
||||
@PostMapping("/saveDepartPermission")
|
||||
//@RequiresRoles({ "admin" })
|
||||
public Result<String> saveDepartPermission(@RequestBody JSONObject json) {
|
||||
public Results<String> saveDepartPermission(@RequestBody JSONObject json) {
|
||||
long start = System.currentTimeMillis();
|
||||
try {
|
||||
String departId = json.getString("departId");
|
||||
@@ -784,10 +784,10 @@ public class SysPermissionController {
|
||||
String lastPermissionIds = json.getString("lastpermissionIds");
|
||||
this.sysDepartPermissionService.saveDepartPermission(departId, permissionIds, lastPermissionIds);
|
||||
log.info("======部门授权成功=====耗时:" + (System.currentTimeMillis() - start) + "毫秒");
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("授权失败!");
|
||||
return Results.error("授权失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+40
-47
@@ -1,10 +1,8 @@
|
||||
package com.jero.modules.system.controller;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -13,16 +11,13 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.CacheConstant;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.PmsUtil;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.system.entity.SysPermission;
|
||||
import com.jero.modules.system.entity.SysPermissionDataRule;
|
||||
@@ -33,13 +28,11 @@ import com.jero.modules.system.service.ISysPermissionDataRuleService;
|
||||
import com.jero.modules.system.service.ISysPermissionService;
|
||||
import com.jero.modules.system.service.ISysRolePermissionService;
|
||||
import com.jero.modules.system.service.ISysRoleService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
@@ -91,11 +84,11 @@ public class SysRoleController {
|
||||
//@RequiresPermissions("sys:role:list")
|
||||
// @RequestMapping(value = "/page", method = RequestMethod.GET)
|
||||
@GetMapping("/page")
|
||||
public Result<IPage<SysRole>> queryPageList(SysRole role,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<SysRole>> result = new Result<>();
|
||||
public Results<IPage<SysRole>> queryPageList(SysRole role,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Results<IPage<SysRole>> result = new Results<>();
|
||||
QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(role, req.getParameterMap());
|
||||
Page<SysRole> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysRole> pageList = sysRoleService.page(page, queryWrapper);
|
||||
@@ -113,14 +106,14 @@ public class SysRoleController {
|
||||
// @RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@PostMapping("/add")
|
||||
//@RequiresRoles({"admin"})
|
||||
public Result<Object> add(@RequestBody SysRole role) {
|
||||
public Results<Object> add(@RequestBody SysRole role) {
|
||||
try {
|
||||
role.setCreateTime(new Date());
|
||||
sysRoleService.save(role);
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,19 +126,19 @@ public class SysRoleController {
|
||||
@RequiresPermissions("sys:role:edit")
|
||||
// @RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
@PostMapping("/edit")
|
||||
public Result<Object> edit(@RequestBody SysRole role) {
|
||||
public Results<Object> edit(@RequestBody SysRole role) {
|
||||
SysRole sysrole = sysRoleService.getById(role.getId());
|
||||
if(sysrole==null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
}else {
|
||||
role.setUpdateTime(new Date());
|
||||
boolean ok = sysRoleService.updateById(role);
|
||||
if(ok) {
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,13 +150,13 @@ public class SysRoleController {
|
||||
@RequiresPermissions("sys:role:del")
|
||||
// @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
sysRoleService.deleteRole(id);
|
||||
return Result.OK("删除角色成功");
|
||||
return Results.OK("删除角色成功");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,16 +168,16 @@ public class SysRoleController {
|
||||
@RequiresPermissions("sys:role:del")
|
||||
// @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
if(oConvertUtils.isEmpty(ids)) {
|
||||
return Result.error("未选中角色!");
|
||||
return Results.error("未选中角色!");
|
||||
}else {
|
||||
sysRoleService.deleteBatchRole(ids.split(","));
|
||||
return Result.OK("删除角色成功!");
|
||||
return Results.OK("删除角色成功!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,23 +189,23 @@ public class SysRoleController {
|
||||
//@RequiresPermissions("sys:role:list")
|
||||
// @RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
||||
@GetMapping("/queryById")
|
||||
public Result<SysRole> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
public Results<SysRole> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysRole sysRole = sysRoleService.getById(id);
|
||||
if(sysRole==null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
}else {
|
||||
return Result.OK(sysRole);
|
||||
return Results.OK(sysRole);
|
||||
}
|
||||
}
|
||||
//@RequiresPermissions("sys:role:list")
|
||||
// @RequestMapping(value = "/queryall", method = RequestMethod.GET)
|
||||
@GetMapping("/queryall")
|
||||
public Result<List<SysRole>> queryall() {
|
||||
public Results<List<SysRole>> queryall() {
|
||||
List<SysRole> list = sysRoleService.list();
|
||||
if(list==null||list.isEmpty()) {
|
||||
return Result.error("未找到角色信息");
|
||||
return Results.error("未找到角色信息");
|
||||
}else {
|
||||
return Result.OK(list);
|
||||
return Results.OK(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,8 +215,8 @@ public class SysRoleController {
|
||||
//@RequiresPermissions("sys:role:list")
|
||||
// @RequestMapping(value = "/checkRoleCode", method = RequestMethod.GET)
|
||||
@GetMapping("/checkRoleCode")
|
||||
public Result<Boolean> checkUsername(String id,String roleCode) {
|
||||
Result<Boolean> result = new Result<>();
|
||||
public Results<Boolean> checkUsername(String id, String roleCode) {
|
||||
Results<Boolean> result = new Results<>();
|
||||
result.setResult(true);//如果此参数为false则程序发生异常
|
||||
log.info("--验证角色编码是否唯一---id:"+id+"--roleCode:"+roleCode);
|
||||
try {
|
||||
@@ -280,7 +273,7 @@ public class SysRoleController {
|
||||
@RequiresPermissions("sys:role:import")
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@PostMapping("/importExcel")
|
||||
public Result<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
@@ -293,7 +286,7 @@ public class SysRoleController {
|
||||
return sysRoleService.importExcelCheckRoleCode(file, params);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
return Results.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
@@ -302,7 +295,7 @@ public class SysRoleController {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
return Results.error("文件导入失败!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -310,10 +303,10 @@ public class SysRoleController {
|
||||
*/
|
||||
//@RequiresPermissions("sys:role:list")
|
||||
@GetMapping(value = "/datarule/{permissionId}/{roleId}")
|
||||
public Result<Map<String, Object>> loadDatarule(@PathVariable("permissionId") String permissionId,@PathVariable("roleId") String roleId) {
|
||||
public Results<Map<String, Object>> loadDatarule(@PathVariable("permissionId") String permissionId, @PathVariable("roleId") String roleId) {
|
||||
List<SysPermissionDataRule> list = sysPermissionDataRuleService.getPermRuleListByPermId(permissionId);
|
||||
if(list==null || list.isEmpty()) {
|
||||
return Result.error("未找到权限配置信息");
|
||||
return Results.error("未找到权限配置信息");
|
||||
}else {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("datarule", list);
|
||||
@@ -328,7 +321,7 @@ public class SysRoleController {
|
||||
map.put("drChecked", drChecked.endsWith(",")?drChecked.substring(0, drChecked.length()-1):drChecked);
|
||||
}
|
||||
}
|
||||
return Result.OK(map);
|
||||
return Results.OK(map);
|
||||
//TODO 以后按钮权限的查询也走这个请求 无非在map中多加两个key
|
||||
}
|
||||
}
|
||||
@@ -338,7 +331,7 @@ public class SysRoleController {
|
||||
*/
|
||||
//@RequiresPermissions("sys:role:list")
|
||||
@PostMapping(value = "/datarule")
|
||||
public Result<T> saveDatarule(@RequestBody JSONObject jsonObject) {
|
||||
public Results<T> saveDatarule(@RequestBody JSONObject jsonObject) {
|
||||
try {
|
||||
String permissionId = jsonObject.getString("permissionId");
|
||||
String roleId = jsonObject.getString("roleId");
|
||||
@@ -349,16 +342,16 @@ public class SysRoleController {
|
||||
.eq(SysRolePermission::getRoleId,roleId);
|
||||
SysRolePermission sysRolePermission = sysRolePermissionService.getOne(query);
|
||||
if(sysRolePermission==null) {
|
||||
return Result.error("请先保存角色菜单权限!");
|
||||
return Results.error("请先保存角色菜单权限!");
|
||||
}else {
|
||||
sysRolePermission.setDataRuleIds(dataRuleIds);
|
||||
this.sysRolePermissionService.updateById(sysRolePermission);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("SysRoleController.saveDatarule()发生异常:" + e.getMessage(),e);
|
||||
return Result.error("保存失败");
|
||||
return Results.error("保存失败");
|
||||
}
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -370,8 +363,8 @@ public class SysRoleController {
|
||||
//@RequiresPermissions("sys:role:list")
|
||||
// @RequestMapping(value = "/queryTreeList", method = RequestMethod.GET)
|
||||
@GetMapping("/queryTreeList")
|
||||
public Result<Map<String,Object>> queryTreeList(HttpServletRequest request) {
|
||||
Result<Map<String,Object>> result = new Result<>();
|
||||
public Results<Map<String,Object>> queryTreeList(HttpServletRequest request) {
|
||||
Results<Map<String,Object>> result = new Results<>();
|
||||
//全部权限ids
|
||||
List<String> ids = new ArrayList<>();
|
||||
try {
|
||||
|
||||
+25
-25
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.aspect.annotation.PermissionData;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
@@ -44,9 +44,9 @@ public class SysTenantController {
|
||||
@PermissionData(pageComponent = "system/TenantList")
|
||||
// @RequestMapping(value = "/page", method = RequestMethod.GET)
|
||||
@GetMapping("/page")
|
||||
public Result<IPage<SysTenant>> queryPageList(SysTenant sysTenant,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysTenant>> result = new Result<>();
|
||||
public Results<IPage<SysTenant>> queryPageList(SysTenant sysTenant, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Results<IPage<SysTenant>> result = new Results<>();
|
||||
QueryWrapper<SysTenant> queryWrapper = QueryGenerator.initQueryWrapper(sysTenant, req.getParameterMap());
|
||||
Page<SysTenant> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysTenant> pageList = sysTenantService.page(page, queryWrapper);
|
||||
@@ -62,17 +62,17 @@ public class SysTenantController {
|
||||
*/
|
||||
// @RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@PostMapping("/add")
|
||||
public Result<Object> add(@RequestBody SysTenant sysTenant) {
|
||||
public Results<Object> add(@RequestBody SysTenant sysTenant) {
|
||||
if(sysTenantService.getById(sysTenant.getId())!=null){
|
||||
return Result.error("该编号已存在!");
|
||||
return Results.error("该编号已存在!");
|
||||
}
|
||||
|
||||
try {
|
||||
sysTenantService.save(sysTenant);
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,17 +83,17 @@ public class SysTenantController {
|
||||
*/
|
||||
// @RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
@PostMapping("/edit")
|
||||
public Result<Object> edit(@RequestBody SysTenant tenant) {
|
||||
public Results<Object> edit(@RequestBody SysTenant tenant) {
|
||||
SysTenant sysTenant = sysTenantService.getById(tenant.getId());
|
||||
if(sysTenant==null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysTenantService.updateById(tenant);
|
||||
if(ok) {
|
||||
return Result.OK("操作成功!");
|
||||
return Results.OK("操作成功!");
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,13 +103,13 @@ public class SysTenantController {
|
||||
*/
|
||||
// @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public Result<T> delete(@RequestBody Map<String,String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String,String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
sysTenantService.removeTenantById(id);
|
||||
return Result.OK("删除成功");
|
||||
return Results.OK("删除成功");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,10 +119,10 @@ public class SysTenantController {
|
||||
*/
|
||||
// @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(oConvertUtils.isEmpty(ids)) {
|
||||
return Result.error("未选中租户!");
|
||||
return Results.error("未选中租户!");
|
||||
}else {
|
||||
String[] ls = ids.split(",");
|
||||
// 过滤掉已被引用的租户
|
||||
@@ -137,12 +137,12 @@ public class SysTenantController {
|
||||
if (!idList.isEmpty()) {
|
||||
sysTenantService.removeByIds(idList);
|
||||
if (ls.length == idList.size()) {
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
} else {
|
||||
return Result.OK("部分删除成功!(被引用的租户无法删除)");
|
||||
return Results.OK("部分删除成功!(被引用的租户无法删除)");
|
||||
}
|
||||
}else {
|
||||
return Result.error("选择的租户都已被引用,无法删除!");
|
||||
return Results.error("选择的租户都已被引用,无法删除!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,12 +154,12 @@ public class SysTenantController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
||||
@GetMapping("/queryById")
|
||||
public Result<SysTenant> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
public Results<SysTenant> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysTenant sysTenant = sysTenantService.getById(id);
|
||||
if(sysTenant==null) {
|
||||
return Result.error("未找到对应实体");
|
||||
return Results.error("未找到对应实体");
|
||||
}else {
|
||||
return Result.OK(sysTenant);
|
||||
return Results.OK(sysTenant);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ public class SysTenantController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryList", method = RequestMethod.GET)
|
||||
@GetMapping("/queryList")
|
||||
public Result<List<SysTenant>> queryList(@RequestParam(name="ids",required=false) String ids) {
|
||||
public Results<List<SysTenant>> queryList(@RequestParam(name="ids",required=false) String ids) {
|
||||
LambdaQueryWrapper<SysTenant> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysTenant::getStatus, 1);
|
||||
if(oConvertUtils.isNotEmpty(ids)){
|
||||
@@ -178,6 +178,6 @@ public class SysTenantController {
|
||||
}
|
||||
//此处查询忽略时间条件
|
||||
List<SysTenant> ls = sysTenantService.list(query);
|
||||
return Result.OK(ls);
|
||||
return Results.OK(ls);
|
||||
}
|
||||
}
|
||||
|
||||
+30
-30
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
@@ -59,11 +59,11 @@ public class SysUserAgentController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<SysUserAgent>> queryPageList(SysUserAgent sysUserAgent,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<SysUserAgent>> result = new Result<>();
|
||||
public Results<IPage<SysUserAgent>> queryPageList(SysUserAgent sysUserAgent,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Results<IPage<SysUserAgent>> result = new Results<>();
|
||||
QueryWrapper<SysUserAgent> queryWrapper = QueryGenerator.initQueryWrapper(sysUserAgent, req.getParameterMap());
|
||||
Page<SysUserAgent> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysUserAgent> pageList = sysUserAgentService.page(page, queryWrapper);
|
||||
@@ -78,13 +78,13 @@ public class SysUserAgentController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<Object> add(@RequestBody SysUserAgent sysUserAgent) {
|
||||
public Results<Object> add(@RequestBody SysUserAgent sysUserAgent) {
|
||||
try {
|
||||
sysUserAgentService.save(sysUserAgent);
|
||||
return Result.OK("代理人设置成功!");
|
||||
return Results.OK("代理人设置成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,18 +94,18 @@ public class SysUserAgentController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<Object> edit(@RequestBody SysUserAgent sysUserAgent) {
|
||||
public Results<Object> edit(@RequestBody SysUserAgent sysUserAgent) {
|
||||
SysUserAgent sysUserAgentEntity = sysUserAgentService.getById(sysUserAgent.getId());
|
||||
if(sysUserAgentEntity==null) {
|
||||
return Result.error(ERROE_MSG);
|
||||
return Results.error(ERROE_MSG);
|
||||
}else {
|
||||
boolean ok = sysUserAgentService.updateById(sysUserAgent);
|
||||
if(ok) {
|
||||
return Result.OK("代理人设置成功!");
|
||||
return Results.OK("代理人设置成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,17 +114,17 @@ public class SysUserAgentController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
|
||||
public Results<Object> delete(@RequestParam(name="id",required=true) String id) {
|
||||
SysUserAgent sysUserAgent = sysUserAgentService.getById(id);
|
||||
if(sysUserAgent==null) {
|
||||
return Result.error(ERROE_MSG);
|
||||
return Results.error(ERROE_MSG);
|
||||
}else {
|
||||
boolean ok = sysUserAgentService.removeById(id);
|
||||
if(ok) {
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,13 +133,13 @@ public class SysUserAgentController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}else {
|
||||
this.sysUserAgentService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("删除成功!");
|
||||
return Results.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,12 +149,12 @@ public class SysUserAgentController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/queryById")
|
||||
public Result<SysUserAgent> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
public Results<SysUserAgent> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysUserAgent sysUserAgent = sysUserAgentService.getById(id);
|
||||
if(sysUserAgent==null) {
|
||||
return Result.error(ERROE_MSG);
|
||||
return Results.error(ERROE_MSG);
|
||||
}else {
|
||||
return Result.OK(sysUserAgent);
|
||||
return Results.OK(sysUserAgent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,14 +164,14 @@ public class SysUserAgentController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/queryByUserName")
|
||||
public Result<SysUserAgent> queryByUserName(@RequestParam(name="userName",required=true) String userName) {
|
||||
public Results<SysUserAgent> queryByUserName(@RequestParam(name="userName",required=true) String userName) {
|
||||
LambdaQueryWrapper<SysUserAgent> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysUserAgent::getUserName, userName);
|
||||
SysUserAgent sysUserAgent = sysUserAgentService.getOne(queryWrapper);
|
||||
if(sysUserAgent==null) {
|
||||
return Result.error(ERROE_MSG);
|
||||
return Results.error(ERROE_MSG);
|
||||
}else {
|
||||
return Result.OK(sysUserAgent);
|
||||
return Results.OK(sysUserAgent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ public class SysUserAgentController {
|
||||
*/
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@PostMapping("/importExcel")
|
||||
public Result<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
@@ -222,10 +222,10 @@ public class SysUserAgentController {
|
||||
for (SysUserAgent sysUserAgentExcel : listSysUserAgents) {
|
||||
sysUserAgentService.save(sysUserAgentExcel);
|
||||
}
|
||||
return Result.OK("文件导入成功!数据行数:" + listSysUserAgents.size());
|
||||
return Results.OK("文件导入成功!数据行数:" + listSysUserAgents.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("文件导入失败!");
|
||||
return Results.error("文件导入失败!");
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
@@ -234,7 +234,7 @@ public class SysUserAgentController {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
return Results.error("文件导入失败!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+126
-126
@@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.aspect.annotation.PermissionData;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
@@ -122,12 +122,12 @@ public class SysUserController {
|
||||
@PermissionData(pageComponent = "system/UserList")
|
||||
// @RequestMapping(value = "/page", method = RequestMethod.GET)
|
||||
@GetMapping("/page")
|
||||
public Result<IPage<SysUser>> queryPageList(SysUser user,
|
||||
@RequestParam(name="departId", required = false) String departId,
|
||||
@RequestParam(name="roleId", required = false) String roleId,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysUser>> result = new Result<>();
|
||||
public Results<IPage<SysUser>> queryPageList(SysUser user,
|
||||
@RequestParam(name="departId", required = false) String departId,
|
||||
@RequestParam(name="roleId", required = false) String roleId,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Results<IPage<SysUser>> result = new Results<>();
|
||||
|
||||
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
|
||||
|
||||
@@ -164,7 +164,7 @@ public class SysUserController {
|
||||
@RequiresPermissions("user:add")
|
||||
// @RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@PostMapping("/add")
|
||||
public Result<Object> add(@RequestBody JSONObject jsonObject) {
|
||||
public Results<Object> add(@RequestBody JSONObject jsonObject) {
|
||||
try {
|
||||
String selectedRoles = jsonObject.getString(SELECTED_ROLES);
|
||||
String selectedDeparts = jsonObject.getString("selecteddeparts");
|
||||
@@ -176,10 +176,10 @@ public class SysUserController {
|
||||
|
||||
// 保存用户走一个service 保证事务
|
||||
sysUserService.saveUser(user, selectedRoles, selectedDeparts);
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
SysUserController.log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ public class SysUserController {
|
||||
@RequiresPermissions("user:edit")
|
||||
// @RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
@PostMapping("/edit")
|
||||
public Result<SysUser> edit(@RequestBody JSONObject jsonObject) {
|
||||
public Results<SysUser> edit(@RequestBody JSONObject jsonObject) {
|
||||
String rsaPublicKey = jsonObject.getString(RSA_PUBLIC_KEY);
|
||||
String roles = jsonObject.getString(SELECTED_ROLES);
|
||||
String departs = jsonObject.getString("selecteddeparts");
|
||||
@@ -221,16 +221,16 @@ public class SysUserController {
|
||||
SysUser sysUser = sysUserService.getById(jsonObject.getString("id"));
|
||||
baseCommonService.addLog("编辑用户,id: " +jsonObject.getString("id") ,CommonConstant.LOG_TYPE_2, 2);
|
||||
if(sysUser==null) {
|
||||
return Result.error(INEXISTENCE);
|
||||
return Results.error(INEXISTENCE);
|
||||
}else {
|
||||
SysUser user = getSysUser(jsonObject, rsaPrivateKey, sysUser);
|
||||
// 修改用户走一个service 保证事务
|
||||
sysUserService.editUser(user, roles, departs);
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SysUserController.log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,33 +261,33 @@ public class SysUserController {
|
||||
|
||||
// @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public Result<T> delete(@RequestBody Map<String,String> map) {
|
||||
public Results<T> delete(@RequestBody Map<String,String> map) {
|
||||
String id = map.get("id");
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
baseCommonService.addLog("删除用户,id: " +id ,CommonConstant.LOG_TYPE_2, 3);
|
||||
this.sysUserService.deleteUser(id);
|
||||
return Result.OK("删除用户成功");
|
||||
return Results.OK("删除用户成功");
|
||||
}
|
||||
|
||||
// @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("参数不识别!");
|
||||
return Results.error("参数不识别!");
|
||||
}
|
||||
baseCommonService.addLog("批量删除用户, ids: " +ids ,CommonConstant.LOG_TYPE_2, 3);
|
||||
this.sysUserService.deleteBatchUsers(ids);
|
||||
return Result.OK("批量删除用户成功");
|
||||
return Results.OK("批量删除用户成功");
|
||||
}
|
||||
|
||||
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
// @RequestMapping(value = "/frozenBatch", method = RequestMethod.PUT)
|
||||
@PostMapping("/frozenBatch")
|
||||
public Result<Object> frozenBatch(@RequestBody JSONObject jsonObject) {
|
||||
public Results<Object> frozenBatch(@RequestBody JSONObject jsonObject) {
|
||||
try {
|
||||
String ids = jsonObject.getString("ids");
|
||||
String status = jsonObject.getString("status");
|
||||
@@ -300,36 +300,36 @@ public class SysUserController {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SysUserController.log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败"+e.getMessage());
|
||||
return Results.error("操作失败"+e.getMessage());
|
||||
}
|
||||
return Result.OK(OPTION_SUCCESS);
|
||||
return Results.OK(OPTION_SUCCESS);
|
||||
|
||||
}
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
// @RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
||||
@GetMapping("/queryById")
|
||||
public Result<SysUser> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
public Results<SysUser> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysUser sysUser = sysUserService.getById(id);
|
||||
if (sysUser == null) {
|
||||
return Result.error(INEXISTENCE);
|
||||
return Results.error(INEXISTENCE);
|
||||
} else {
|
||||
return Result.OK(sysUser);
|
||||
return Results.OK(sysUser);
|
||||
}
|
||||
}
|
||||
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
// @RequestMapping(value = "/queryUserRole", method = RequestMethod.GET)
|
||||
@GetMapping("/queryUserRole")
|
||||
public Result<List<String>> queryUserRole(@RequestParam(name = "userid", required = true) String userid) {
|
||||
public Results<List<String>> queryUserRole(@RequestParam(name = "userid", required = true) String userid) {
|
||||
List<String> list = new ArrayList<>();
|
||||
List<SysUserRole> userRole = sysUserRoleService.list(new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getUserId, userid));
|
||||
if (userRole == null || userRole.isEmpty()) {
|
||||
return Result.error("未找到用户相关角色信息");
|
||||
return Results.error("未找到用户相关角色信息");
|
||||
} else {
|
||||
for (SysUserRole sysUserRole : userRole) {
|
||||
list.add(sysUserRole.getRoleId());
|
||||
}
|
||||
return Result.OK(list);
|
||||
return Results.OK(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,8 +344,8 @@ public class SysUserController {
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
// @RequestMapping(value = "/checkOnlyUser", method = RequestMethod.GET)
|
||||
@GetMapping("/checkOnlyUser")
|
||||
public Result<Boolean> checkOnlyUser(SysUser sysUser) {
|
||||
Result<Boolean> result = new Result<>();
|
||||
public Results<Boolean> checkOnlyUser(SysUser sysUser) {
|
||||
Results<Boolean> result = new Results<>();
|
||||
//如果此参数为false则程序发生异常
|
||||
result.setResult(true);
|
||||
try {
|
||||
@@ -372,10 +372,10 @@ public class SysUserController {
|
||||
*/
|
||||
// @RequestMapping(value = "/changePassword", method = RequestMethod.PUT)
|
||||
@PostMapping("/changePassword")
|
||||
public Result<T> changePassword(@RequestBody SysUser sysUser) {
|
||||
public Results<T> changePassword(@RequestBody SysUser sysUser) {
|
||||
SysUser u = this.sysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, sysUser.getUsername()));
|
||||
if (u == null) {
|
||||
return Result.error(USER_ERROR_MSG);
|
||||
return Results.error(USER_ERROR_MSG);
|
||||
}
|
||||
sysUser.setId(u.getId());
|
||||
return sysUserService.changePassword(sysUser);
|
||||
@@ -390,8 +390,8 @@ public class SysUserController {
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
// @RequestMapping(value = "/userDepartList", method = RequestMethod.GET)
|
||||
@GetMapping("/userDepartList")
|
||||
public Result<List<DepartIdModel>> getUserDepartsList(@RequestParam(name = "userId", required = true) String userId) {
|
||||
Result<List<DepartIdModel>> result = new Result<>();
|
||||
public Results<List<DepartIdModel>> getUserDepartsList(@RequestParam(name = "userId", required = true) String userId) {
|
||||
Results<List<DepartIdModel>> result = new Results<>();
|
||||
try {
|
||||
List<DepartIdModel> depIdModelList = this.sysUserDepartService.queryDepartIdsOfUser(userId);
|
||||
if (depIdModelList != null && !depIdModelList.isEmpty()) {
|
||||
@@ -420,8 +420,8 @@ public class SysUserController {
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
// @RequestMapping(value = "/generateUserId", method = RequestMethod.GET)
|
||||
@GetMapping("/generateUserId")
|
||||
public Result<String> generateUserId() {
|
||||
Result<String> result = new Result<>();
|
||||
public Results<String> generateUserId() {
|
||||
Results<String> result = new Results<>();
|
||||
log.info("我执行了,生成用户ID==============================");
|
||||
String userId = UUID.randomUUID().toString().replace("-", "");
|
||||
result.setSuccess(true);
|
||||
@@ -438,8 +438,8 @@ public class SysUserController {
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
// @RequestMapping(value = "/queryUserByDepId", method = RequestMethod.GET)
|
||||
@GetMapping("/queryUserByDepId")
|
||||
public Result<List<SysUser>> queryUserByDepId(@RequestParam(name = "id", required = true) String id,@RequestParam(name="realname",required=false) String realname ,@RequestParam(name="username",required=false) String username) {
|
||||
Result<List<SysUser>> result = new Result<>();
|
||||
public Results<List<SysUser>> queryUserByDepId(@RequestParam(name = "id", required = true) String id, @RequestParam(name="realname",required=false) String realname , @RequestParam(name="username",required=false) String username) {
|
||||
Results<List<SysUser>> result = new Results<>();
|
||||
SysDepart sysDepart = sysDepartService.getById(id);
|
||||
//去除前端传回参数两边的*
|
||||
if(StringUtils.isNotBlank(realname)){
|
||||
@@ -480,14 +480,14 @@ public class SysUserController {
|
||||
*/
|
||||
// @RequestMapping(value = "/queryUserComponentData", method = RequestMethod.GET)
|
||||
@GetMapping("/queryUserComponentData")
|
||||
public Result<IPage<SysUser>> queryUserComponentData(
|
||||
public Results<IPage<SysUser>> queryUserComponentData(
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name = "departId", required = false) String departId,
|
||||
@RequestParam(name="realname",required=false) String realname,
|
||||
@RequestParam(name=USER_NAME,required=false) String username) {
|
||||
IPage<SysUser> pageList = sysUserDepartService.queryDepartUserPageList(departId, username, realname, pageSize, pageNo);
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -532,7 +532,7 @@ public class SysUserController {
|
||||
@RequiresPermissions("sys:user:import")
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@PostMapping("/importExcel")
|
||||
public Result<JSONObject> importExcel(HttpServletRequest request, HttpServletResponse response)throws IOException {
|
||||
public Results<JSONObject> importExcel(HttpServletRequest request, HttpServletResponse response)throws IOException {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
// 错误信息
|
||||
@@ -623,8 +623,8 @@ public class SysUserController {
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
// @RequestMapping(value = "/queryByIds", method = RequestMethod.GET)
|
||||
@GetMapping("/queryByIds")
|
||||
public Result<Collection<SysUser>> queryByIds(@RequestParam String userIds) {
|
||||
Result<Collection<SysUser>> result = new Result<>();
|
||||
public Results<Collection<SysUser>> queryByIds(@RequestParam String userIds) {
|
||||
Results<Collection<SysUser>> result = new Results<>();
|
||||
String[] userId = userIds.split(",");
|
||||
Collection<String> idList = Arrays.asList(userId);
|
||||
Collection<SysUser> userRole = sysUserService.listByIds(idList);
|
||||
@@ -638,7 +638,7 @@ public class SysUserController {
|
||||
*/
|
||||
// @RequestMapping(value = "/updatePassword", method = RequestMethod.PUT)
|
||||
@PostMapping("/updatePassword")
|
||||
public Result<T> updatePassword(@RequestBody JSONObject json) {
|
||||
public Results<T> updatePassword(@RequestBody JSONObject json) {
|
||||
String username = json.getString(USER_NAME);
|
||||
String oldpassword = json.getString("oldpassword");
|
||||
String password = json.getString("password");
|
||||
@@ -647,7 +647,7 @@ public class SysUserController {
|
||||
|
||||
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
||||
if(!sysUser.getUsername().equals(username)){
|
||||
return Result.error("只允许修改自己的密码!");
|
||||
return Results.error("只允许修改自己的密码!");
|
||||
}
|
||||
|
||||
String RSAPrivateKey = String.valueOf(redisUtil.get(RSAPublicKey));
|
||||
@@ -662,16 +662,16 @@ public class SysUserController {
|
||||
|
||||
SysUser user = this.sysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, username));
|
||||
if(user==null) {
|
||||
return Result.error(USER_ERROR_MSG);
|
||||
return Results.error(USER_ERROR_MSG);
|
||||
}
|
||||
return sysUserService.resetPassword(username,oldpassword,password,confirmpassword);
|
||||
}
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
// @RequestMapping(value = "/userRoleList", method = RequestMethod.GET)
|
||||
@GetMapping("/userRoleList")
|
||||
public Result<IPage<SysUser>> userRoleList(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Result<IPage<SysUser>> result = new Result<>();
|
||||
public Results<IPage<SysUser>> userRoleList(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Results<IPage<SysUser>> result = new Results<>();
|
||||
Page<SysUser> page = new Page<>(pageNo, pageSize);
|
||||
String roleId = req.getParameter("roleId");
|
||||
String username = req.getParameter(USER_NAME);
|
||||
@@ -690,8 +690,8 @@ public class SysUserController {
|
||||
@RequiresPermissions("user:add")
|
||||
// @RequestMapping(value = "/addSysUserRole", method = RequestMethod.POST)
|
||||
@PostMapping("/addSysUserRole")
|
||||
public Result<String> addSysUserRole(@RequestBody SysUserRoleVO sysUserRoleVO) {
|
||||
Result<String> result = new Result<>();
|
||||
public Results<String> addSysUserRole(@RequestBody SysUserRoleVO sysUserRoleVO) {
|
||||
Results<String> result = new Results<>();
|
||||
try {
|
||||
String sysRoleId = sysUserRoleVO.getRoleId();
|
||||
for(String sysUserId:sysUserRoleVO.getUserIdList()) {
|
||||
@@ -721,16 +721,16 @@ public class SysUserController {
|
||||
*/
|
||||
// @RequestMapping(value = "/deleteUserRole", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deleteUserRole")
|
||||
public Result<Object> deleteUserRole(@RequestParam(name="roleId") String roleId,
|
||||
@RequestParam(name="userId",required=true) String userId) {
|
||||
public Results<Object> deleteUserRole(@RequestParam(name="roleId") String roleId,
|
||||
@RequestParam(name="userId",required=true) String userId) {
|
||||
try {
|
||||
QueryWrapper<SysUserRole> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(ROLE_ID, roleId).eq(USER_ID,userId);
|
||||
sysUserRoleService.remove(queryWrapper);
|
||||
return Result.OK(DEL_SUCCESS);
|
||||
return Results.OK(DEL_SUCCESS);
|
||||
}catch(Exception e) {
|
||||
SysUserController.log.error(e.getMessage(), e);
|
||||
return Result.error(DEL_FAILE);
|
||||
return Results.error(DEL_FAILE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -742,17 +742,17 @@ public class SysUserController {
|
||||
*/
|
||||
// @RequestMapping(value = "/deleteUserRoleBatch", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deleteUserRoleBatch")
|
||||
public Result<SysUserRole> deleteUserRoleBatch(
|
||||
public Results<SysUserRole> deleteUserRoleBatch(
|
||||
@RequestParam(name="roleId") String roleId,
|
||||
@RequestParam(name="userIds",required=true) String userIds) {
|
||||
try {
|
||||
QueryWrapper<SysUserRole> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(ROLE_ID, roleId).in(USER_ID,Arrays.asList(userIds.split(",")));
|
||||
sysUserRoleService.remove(queryWrapper);
|
||||
return Result.OK(DEL_SUCCESS);
|
||||
return Results.OK(DEL_SUCCESS);
|
||||
}catch(Exception e) {
|
||||
SysUserController.log.error(e.getMessage(), e);
|
||||
return Result.error(DEL_FAILE);
|
||||
return Results.error(DEL_FAILE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -762,9 +762,9 @@ public class SysUserController {
|
||||
// @RequestMapping(value = "/departUserList", method = RequestMethod.GET)
|
||||
@GetMapping("/departUserList")
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
public Result<IPage<SysUser>> departUserList(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Result<IPage<SysUser>> result = new Result<>();
|
||||
public Results<IPage<SysUser>> departUserList(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Results<IPage<SysUser>> result = new Results<>();
|
||||
Page<SysUser> page = new Page<>(pageNo, pageSize);
|
||||
String depId = req.getParameter("depId");
|
||||
String username = req.getParameter(USER_NAME);
|
||||
@@ -809,14 +809,14 @@ public class SysUserController {
|
||||
*/
|
||||
@GetMapping("/queryByOrgCode")
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
public Result<IPage<SysUserSysDepartModel>> queryByDepartId(
|
||||
public Results<IPage<SysUserSysDepartModel>> queryByDepartId(
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "orgCode") String orgCode,
|
||||
SysUser userParams
|
||||
) {
|
||||
IPage<SysUserSysDepartModel> pageList = sysUserService.queryUserByOrgCode(orgCode, userParams, new Page<SysUserSysDepartModel>(pageNo, pageSize));
|
||||
return Result.OK(pageList);
|
||||
return Results.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -825,8 +825,8 @@ public class SysUserController {
|
||||
@RequiresPermissions("user:add")
|
||||
// @RequestMapping(value = "/editSysDepartWithUser", method = RequestMethod.POST)
|
||||
@PostMapping("/editSysDepartWithUser")
|
||||
public Result<String> editSysDepartWithUser(@RequestBody SysDepartUsersVO sysDepartUsersVO) {
|
||||
Result<String> result = new Result<>();
|
||||
public Results<String> editSysDepartWithUser(@RequestBody SysDepartUsersVO sysDepartUsersVO) {
|
||||
Results<String> result = new Results<>();
|
||||
try {
|
||||
String sysDepId = sysDepartUsersVO.getDepId();
|
||||
for(String sysUserId:sysDepartUsersVO.getUserIdList()) {
|
||||
@@ -854,17 +854,17 @@ public class SysUserController {
|
||||
*/
|
||||
// @RequestMapping(value = "/deleteUserInDepart", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deleteUserInDepart")
|
||||
public Result<Object> deleteUserInDepart(@RequestParam(name="depId") String depId,
|
||||
@RequestParam(name="userId",required=true) String userId) {
|
||||
public Results<Object> deleteUserInDepart(@RequestParam(name="depId") String depId,
|
||||
@RequestParam(name="userId",required=true) String userId) {
|
||||
try {
|
||||
QueryWrapper<SysUserDepart> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(DEP_ID, depId).eq(USER_ID,userId);
|
||||
sysUserDepartService.remove(queryWrapper);
|
||||
sysDepartService.deleteHeadDeptAndUserRelatedByUser(depId, userId);
|
||||
return Result.OK(DEL_SUCCESS);
|
||||
return Results.OK(DEL_SUCCESS);
|
||||
}catch(Exception e) {
|
||||
SysUserController.log.error(e.getMessage(), e);
|
||||
return Result.error(DEL_FAILE);
|
||||
return Results.error(DEL_FAILE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -874,7 +874,7 @@ public class SysUserController {
|
||||
// @RequestMapping(value = "/deleteUserInDepartBatch", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deleteUserInDepartBatch")
|
||||
@Transactional
|
||||
public Result<Object> deleteUserInDepartBatch(
|
||||
public Results<Object> deleteUserInDepartBatch(
|
||||
@RequestParam(name="depId") String depId,
|
||||
@RequestParam(name="userIds",required=true) String userIds) {
|
||||
try {
|
||||
@@ -886,10 +886,10 @@ public class SysUserController {
|
||||
for (String userId : userIdList){
|
||||
sysDepartService.deleteHeadDeptAndUserRelatedByUser(depId, userId);
|
||||
}
|
||||
return Result.OK(DEL_SUCCESS);
|
||||
return Results.OK(DEL_SUCCESS);
|
||||
}catch(Exception e) {
|
||||
SysUserController.log.error(e.getMessage(), e);
|
||||
return Result.error(DEL_FAILE);
|
||||
return Results.error(DEL_FAILE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -900,17 +900,17 @@ public class SysUserController {
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
// @RequestMapping(value = "/getCurrentUserDeparts", method = RequestMethod.GET)
|
||||
@GetMapping("/getCurrentUserDeparts")
|
||||
public Result<Map<String,Object>> getCurrentUserDeparts() {
|
||||
public Results<Map<String,Object>> getCurrentUserDeparts() {
|
||||
try {
|
||||
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
||||
List<SysDepart> list = this.sysDepartService.queryUserDeparts(sysUser.getId());
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("list", list);
|
||||
map.put("orgCode", sysUser.getOrgCode());
|
||||
return Result.OK(map);
|
||||
return Results.OK(map);
|
||||
}catch(Exception e) {
|
||||
SysUserController.log.error(e.getMessage(), e);
|
||||
return Result.error("查询失败!");
|
||||
return Results.error("查询失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -925,8 +925,8 @@ public class SysUserController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/register")
|
||||
public Result<JSONObject> userRegister(@RequestBody JSONObject jsonObject, SysUser user) {
|
||||
Result<JSONObject> result = new Result<>();
|
||||
public Results<JSONObject> userRegister(@RequestBody JSONObject jsonObject, SysUser user) {
|
||||
Results<JSONObject> result = new Results<>();
|
||||
String phone = jsonObject.getString(PHONE);
|
||||
String smscode = jsonObject.getString(SMSCODE);
|
||||
Object code = redisUtil.get(phone);
|
||||
@@ -989,7 +989,7 @@ public class SysUserController {
|
||||
sysUserService.addUserWithRole(user,"ee8626f80f7c2619917b6236f3a7f02b");//默认临时角色 test
|
||||
result.setMessage("注册成功");
|
||||
} catch (Exception e) {
|
||||
return Result.error("注册失败");
|
||||
return Results.error("注册失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -998,8 +998,8 @@ public class SysUserController {
|
||||
* 用户手机号验证
|
||||
*/
|
||||
@PostMapping("/phoneVerification")
|
||||
public Result<Map<String,String>> phoneVerification(@RequestBody JSONObject jsonObject) {
|
||||
Result<Map<String,String>> result = new Result<>();
|
||||
public Results<Map<String,String>> phoneVerification(@RequestBody JSONObject jsonObject) {
|
||||
Results<Map<String,String>> result = new Results<>();
|
||||
String phone = jsonObject.getString(PHONE);
|
||||
String smscode = jsonObject.getString(SMSCODE);
|
||||
Object code = redisUtil.get(phone);
|
||||
@@ -1026,11 +1026,11 @@ public class SysUserController {
|
||||
* 用户更改密码
|
||||
*/
|
||||
@GetMapping("/passwordChange")
|
||||
public Result<SysUser> passwordChange(@RequestParam(name=USER_NAME)String username,
|
||||
@RequestParam(name="password")String password,
|
||||
@RequestParam(name="smscode")String smscode,
|
||||
@RequestParam(name="phone") String phone) {
|
||||
Result<SysUser> result = new Result<>();
|
||||
public Results<SysUser> passwordChange(@RequestParam(name=USER_NAME)String username,
|
||||
@RequestParam(name="password")String password,
|
||||
@RequestParam(name="smscode")String smscode,
|
||||
@RequestParam(name="phone") String phone) {
|
||||
Results<SysUser> result = new Results<>();
|
||||
if(oConvertUtils.isEmpty(username) || oConvertUtils.isEmpty(password) || oConvertUtils.isEmpty(smscode) || oConvertUtils.isEmpty(phone) ) {
|
||||
result.setMessage("重置密码失败!");
|
||||
result.setSuccess(false);
|
||||
@@ -1074,7 +1074,7 @@ public class SysUserController {
|
||||
*/
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
@GetMapping("/getUserSectionInfoByToken")
|
||||
public Result<Map<String, Object>> getUserSectionInfoByToken(HttpServletRequest request, @RequestParam(name = "token", required = false) String token) {
|
||||
public Results<Map<String, Object>> getUserSectionInfoByToken(HttpServletRequest request, @RequestParam(name = "token", required = false) String token) {
|
||||
try {
|
||||
String username = null;
|
||||
// 如果没有传递token,就从header中获取token并获取用户信息
|
||||
@@ -1096,10 +1096,10 @@ public class SysUserController {
|
||||
|
||||
SysUserController.log.debug(" ------ 通过令牌获取部分用户信息,已获取的用户信息: " + map);
|
||||
|
||||
return Result.OK(map);
|
||||
return Results.OK(map);
|
||||
} catch (Exception e) {
|
||||
SysUserController.log.error(e.getMessage(), e);
|
||||
return Result.error(500, "查询失败:" + e.getMessage());
|
||||
return Results.error(500, "查询失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1112,11 +1112,11 @@ public class SysUserController {
|
||||
*/
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
@GetMapping("/appUserList")
|
||||
public Result<IPage<SysUser>> appUserList(@RequestParam(name = "keyword", required = false) String keyword,
|
||||
@RequestParam(name = USER_NAME, required = false) String username,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name = "syncFlow", required = false) String syncFlow) {
|
||||
public Results<IPage<SysUser>> appUserList(@RequestParam(name = "keyword", required = false) String keyword,
|
||||
@RequestParam(name = USER_NAME, required = false) String username,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name = "syncFlow", required = false) String syncFlow) {
|
||||
try {
|
||||
LambdaQueryWrapper<SysUser> query = new LambdaQueryWrapper<>();
|
||||
if(oConvertUtils.isNotEmpty(syncFlow)){
|
||||
@@ -1134,10 +1134,10 @@ public class SysUserController {
|
||||
}
|
||||
Page<SysUser> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysUser> res = this.sysUserService.page(page, query);
|
||||
return Result.OK(res);
|
||||
return Results.OK(res);
|
||||
} catch (Exception e) {
|
||||
SysUserController.log.error(e.getMessage(), e);
|
||||
return Result.error(500, "查询失败:" + e.getMessage());
|
||||
return Results.error(500, "查询失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1149,7 +1149,7 @@ public class SysUserController {
|
||||
*/
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
@GetMapping("/recycleBin")
|
||||
public Result<List<SysUser>> getRecycleBin() {
|
||||
public Results<List<SysUser>> getRecycleBin() {
|
||||
List<SysUser> logicDeletedUserList = sysUserService.queryLogicDeleted();
|
||||
if (!logicDeletedUserList.isEmpty()) {
|
||||
// 批量查询用户的所属部门
|
||||
@@ -1159,7 +1159,7 @@ public class SysUserController {
|
||||
Map<String, String> useDepNames = sysUserService.getDepNamesByUserIds(userIds);
|
||||
logicDeletedUserList.forEach(item -> item.setOrgCode(useDepNames.get(item.getId())));
|
||||
}
|
||||
return Result.OK(logicDeletedUserList);
|
||||
return Results.OK(logicDeletedUserList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1171,7 +1171,7 @@ public class SysUserController {
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
// @RequestMapping(value = "/putRecycleBin", method = RequestMethod.PUT)
|
||||
@PostMapping("/putRecycleBin")
|
||||
public Result<T> putRecycleBin(@RequestBody JSONObject jsonObject, HttpServletRequest request) {
|
||||
public Results<T> putRecycleBin(@RequestBody JSONObject jsonObject, HttpServletRequest request) {
|
||||
String userIds = jsonObject.getString("userIds");
|
||||
if (StringUtils.isNotBlank(userIds)) {
|
||||
SysUser updateUser = new SysUser();
|
||||
@@ -1179,7 +1179,7 @@ public class SysUserController {
|
||||
updateUser.setUpdateTime(new Date());
|
||||
sysUserService.revertLogicDeleted(Arrays.asList(userIds.split(",")), updateUser);
|
||||
}
|
||||
return Result.OK("还原成功");
|
||||
return Results.OK("还原成功");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1190,11 +1190,11 @@ public class SysUserController {
|
||||
*/
|
||||
// @RequestMapping(value = "/deleteRecycleBin", method = RequestMethod.DELETE)
|
||||
@PostMapping("/deleteRecycleBin")
|
||||
public Result<T> deleteRecycleBin(@RequestParam("userIds") String userIds) {
|
||||
public Results<T> deleteRecycleBin(@RequestParam("userIds") String userIds) {
|
||||
if (StringUtils.isNotBlank(userIds)) {
|
||||
sysUserService.removeLogicDeleted(Arrays.asList(userIds.split(",")));
|
||||
}
|
||||
return Result.OK("删除成功");
|
||||
return Results.OK("删除成功");
|
||||
}
|
||||
|
||||
|
||||
@@ -1206,8 +1206,8 @@ public class SysUserController {
|
||||
@RequiresPermissions("user:edit")
|
||||
// @RequestMapping(value = "/appEdit", method = RequestMethod.PUT)
|
||||
@PostMapping("/appEdit")
|
||||
public Result<SysUser> appEdit(HttpServletRequest request,@RequestBody JSONObject jsonObject) {
|
||||
Result<SysUser> result = new Result<>();
|
||||
public Results<SysUser> appEdit(HttpServletRequest request, @RequestBody JSONObject jsonObject) {
|
||||
Results<SysUser> result = new Results<>();
|
||||
try {
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
SysUser sysUser = sysUserService.getUserByName(username);
|
||||
@@ -1220,12 +1220,12 @@ public class SysUserController {
|
||||
Date birthday=jsonObject.getDate("birthday");
|
||||
SysUser userPhone = sysUserService.getUserByPhone(phone);
|
||||
if(sysUser==null) {
|
||||
return Result.error("未找到对应用户!");
|
||||
return Results.error("未找到对应用户!");
|
||||
}else {
|
||||
if(userPhone!=null){
|
||||
String userPhonename = userPhone.getUsername();
|
||||
if(!userPhonename.equals(username)){
|
||||
return Result.error("手机号已存在!");
|
||||
return Results.error("手机号已存在!");
|
||||
}
|
||||
}
|
||||
setUser(sysUser, realname, avatar, sex, phone, email, birthday);
|
||||
@@ -1233,7 +1233,7 @@ public class SysUserController {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SysUserController.log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败!");
|
||||
return Results.error("操作失败!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1267,20 +1267,20 @@ public class SysUserController {
|
||||
*/
|
||||
// @RequestMapping(value = "/saveClientId", method = RequestMethod.GET)
|
||||
@PostMapping("/saveClientId")
|
||||
public Result<SysUser> saveClientId(HttpServletRequest request,@RequestParam("clientId")String clientId) {
|
||||
Result<SysUser> result = new Result<>();
|
||||
public Results<SysUser> saveClientId(HttpServletRequest request, @RequestParam("clientId")String clientId) {
|
||||
Results<SysUser> result = new Results<>();
|
||||
try {
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
SysUser sysUser = sysUserService.getUserByName(username);
|
||||
if(sysUser==null) {
|
||||
return Result.error("未找到对应用户!");
|
||||
return Results.error("未找到对应用户!");
|
||||
}else {
|
||||
sysUser.setClientId(clientId);
|
||||
sysUserService.updateById(sysUser);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SysUserController.log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败!");
|
||||
return Results.error("操作失败!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1292,7 +1292,7 @@ public class SysUserController {
|
||||
*/
|
||||
//@RequiresPermissions("sys:user:list")
|
||||
@GetMapping("/queryChildrenByUsername")
|
||||
public Result<Map<String, Object>> queryChildrenByUsername(@RequestParam("userId") String userId) {
|
||||
public Results<Map<String, Object>> queryChildrenByUsername(@RequestParam("userId") String userId) {
|
||||
//获取用户信息
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
SysUser sysUser = sysUserService.getById(userId);
|
||||
@@ -1308,7 +1308,7 @@ public class SysUserController {
|
||||
map.put("children",childrenUser);
|
||||
}
|
||||
}
|
||||
return Result.OK(map);
|
||||
return Results.OK(map);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1317,8 +1317,8 @@ public class SysUserController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/appQueryByDepartId")
|
||||
public Result<List<SysUser>> appQueryByDepartId(@RequestParam(name="departId", required = false) String departId) {
|
||||
Result<List<SysUser>> result = new Result<>();
|
||||
public Results<List<SysUser>> appQueryByDepartId(@RequestParam(name="departId", required = false) String departId) {
|
||||
Results<List<SysUser>> result = new Results<>();
|
||||
List<String> list=new ArrayList<> ();
|
||||
list.add(departId);
|
||||
List<SysUser> childrenUser = sysUserService.queryByDepIds(list,null);
|
||||
@@ -1331,8 +1331,8 @@ public class SysUserController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/appQueryUser")
|
||||
public Result<List<SysUser>> appQueryUser(@RequestParam(name = "keyword", required = false) String keyword) {
|
||||
Result<List<SysUser>> result = new Result<>();
|
||||
public Results<List<SysUser>> appQueryUser(@RequestParam(name = "keyword", required = false) String keyword) {
|
||||
Results<List<SysUser>> result = new Results<>();
|
||||
LambdaQueryWrapper<SysUser> queryWrapper =new LambdaQueryWrapper<>();
|
||||
//TODO 外部模拟登陆临时账号,列表不显示
|
||||
queryWrapper.ne(SysUser::getUsername,"_reserve_user_external");
|
||||
@@ -1359,10 +1359,10 @@ public class SysUserController {
|
||||
*/
|
||||
// @RequestMapping(value = "/updateMobile", method = RequestMethod.PUT)
|
||||
@PostMapping("/updateMobile")
|
||||
public Result<SysUser> changMobile(@RequestBody JSONObject json,HttpServletRequest request) {
|
||||
public Results<SysUser> changMobile(@RequestBody JSONObject json, HttpServletRequest request) {
|
||||
String smscode = json.getString(SMSCODE);
|
||||
String phone = json.getString(PHONE);
|
||||
Result<SysUser> result = new Result<>();
|
||||
Results<SysUser> result = new Results<>();
|
||||
//获取登录用户名
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
if(oConvertUtils.isEmpty(username) || oConvertUtils.isEmpty(smscode) || oConvertUtils.isEmpty(phone)) {
|
||||
@@ -1383,11 +1383,11 @@ public class SysUserController {
|
||||
}
|
||||
SysUser user = sysUserService.getUserByName(username);
|
||||
if(user==null) {
|
||||
return Result.error(USER_ERROR_MSG);
|
||||
return Results.error(USER_ERROR_MSG);
|
||||
}
|
||||
user.setPhone(phone);
|
||||
sysUserService.updateById(user);
|
||||
return Result.OK("手机号设置成功!");
|
||||
return Results.OK("手机号设置成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1408,7 +1408,7 @@ public class SysUserController {
|
||||
|
||||
@ApiOperation(value = "用户管理-角色配置")
|
||||
@PostMapping(value = "/setRole")
|
||||
public Result<SysUser> setRole(@RequestBody JSONObject jsonObject) {
|
||||
public Results<SysUser> setRole(@RequestBody JSONObject jsonObject) {
|
||||
try {
|
||||
String ids = jsonObject.getString("ids");
|
||||
List<String> idList = Arrays.asList(ids.split(","));
|
||||
@@ -1416,7 +1416,7 @@ public class SysUserController {
|
||||
SysUser sysUser = sysUserService.getById(id);
|
||||
baseCommonService.addLog("编辑用户角色,id: " + id, CommonConstant.LOG_TYPE_2, 2);
|
||||
if (sysUser == null) {
|
||||
return Result.error(INEXISTENCE);
|
||||
return Results.error(INEXISTENCE);
|
||||
} else {
|
||||
SysUser user = new SysUser();
|
||||
user.setId(id);
|
||||
@@ -1424,15 +1424,15 @@ public class SysUserController {
|
||||
|
||||
String roles = jsonObject.getString(SELECTED_ROLES);
|
||||
sysUserService.addRoleToUser(user, roles);
|
||||
return Result.OK("修改成功!");
|
||||
return Results.OK("修改成功!");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
SysUserController.log.error(e.getMessage(), e);
|
||||
return Result.error("操作失败");
|
||||
return Results.error("操作失败");
|
||||
}
|
||||
return Result.OK("修改成功!");
|
||||
return Results.OK("修改成功!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,7 +1,7 @@
|
||||
package com.jero.modules.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CacheConstant;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
@@ -54,8 +54,8 @@ public class SysUserOnlineController {
|
||||
|
||||
// @RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@GetMapping("/list")
|
||||
public Result<Page<SysUserOnlineVO>> list(@RequestParam(name="username", required=false) String username, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
public Results<Page<SysUserOnlineVO>> list(@RequestParam(name="username", required=false) String username, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
Collection<String> keys = redisTemplate.keys(CommonConstant.PREFIX_USER_TOKEN + "*");
|
||||
SysUserOnlineVO online;
|
||||
List<SysUserOnlineVO> onlineList = new ArrayList<>();
|
||||
@@ -93,7 +93,7 @@ public class SysUserOnlineController {
|
||||
|
||||
Collections.reverse(onlineList);
|
||||
onlineList.removeAll(Collections.singleton(null));
|
||||
Result<Page<SysUserOnlineVO>> result = new Result<>();
|
||||
Results<Page<SysUserOnlineVO>> result = new Results<>();
|
||||
result.setSuccess(true);
|
||||
result.setResult(page);
|
||||
return result;
|
||||
@@ -104,10 +104,10 @@ public class SysUserOnlineController {
|
||||
*/
|
||||
// @RequestMapping(value = "/forceLogout",method = RequestMethod.POST)
|
||||
@PostMapping("/forceLogout")
|
||||
public Result<Object> forceLogout(@RequestBody SysUserOnlineVO online) {
|
||||
public Results<Object> forceLogout(@RequestBody SysUserOnlineVO online) {
|
||||
//用户退出逻辑
|
||||
if(oConvertUtils.isEmpty(online.getToken())) {
|
||||
return Result.error("退出登录失败!");
|
||||
return Results.error("退出登录失败!");
|
||||
}
|
||||
String username = JwtUtil.getUsername(online.getToken());
|
||||
LoginUser sysUser = sysBaseAPI.getUserByName(username);
|
||||
@@ -122,9 +122,9 @@ public class SysUserOnlineController {
|
||||
redisUtil.del(String.format("%s::%s", CacheConstant.SYS_USERS_CACHE, sysUser.getUsername()));
|
||||
//调用shiro的logout
|
||||
SecurityUtils.getSubject().logout();
|
||||
return Result.OK("退出登录成功!");
|
||||
return Results.OK("退出登录成功!");
|
||||
}else {
|
||||
return Result.error("Token无效!");
|
||||
return Results.error("Token无效!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -3,7 +3,7 @@ package com.jero.modules.system.controller;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.util.JwtUtil;
|
||||
import com.jero.common.util.PasswordUtil;
|
||||
@@ -68,7 +68,7 @@ public class ThirdLoginController {
|
||||
AuthRequest authRequest = factory.get(source);
|
||||
AuthResponse response = authRequest.login(callback);
|
||||
log.info(JSON.toJSONString(response));
|
||||
Result<JSONObject> result = new Result<>();
|
||||
Results<JSONObject> result = new Results<>();
|
||||
if(response.getCode()==2000) {
|
||||
|
||||
JSONObject data = JSON.parseObject(JSON.toJSONString(response.getData()));
|
||||
@@ -119,9 +119,9 @@ public class ThirdLoginController {
|
||||
*/
|
||||
@PostMapping("/user/create")
|
||||
@ResponseBody
|
||||
public Result<String> thirdUserCreate(@RequestBody ThirdLoginModel model) {
|
||||
public Results<String> thirdUserCreate(@RequestBody ThirdLoginModel model) {
|
||||
log.info("第三方登录创建新账号:" );
|
||||
Result<String> res = new Result<>();
|
||||
Results<String> res = new Results<>();
|
||||
Object operateCode = redisUtil.get(CommonConstant.THIRD_LOGIN_CODE);
|
||||
if(operateCode==null || !operateCode.toString().equals(model.getOperateCode())){
|
||||
res.setSuccess(false);
|
||||
@@ -150,8 +150,8 @@ public class ThirdLoginController {
|
||||
*/
|
||||
@PostMapping("/user/checkPassword")
|
||||
@ResponseBody
|
||||
public Result<String> checkPassword(@RequestBody JSONObject json) {
|
||||
Result<String> result = new Result<>();
|
||||
public Results<String> checkPassword(@RequestBody JSONObject json) {
|
||||
Results<String> result = new Results<>();
|
||||
Object operateCode = redisUtil.get(CommonConstant.THIRD_LOGIN_CODE);
|
||||
if(operateCode==null || !operateCode.toString().equals(json.getString("operateCode"))){
|
||||
result.setSuccess(false);
|
||||
@@ -211,8 +211,8 @@ public class ThirdLoginController {
|
||||
// @RequestMapping(value = "/getLoginUser/{token}/{thirdType}", method = RequestMethod.GET)
|
||||
@GetMapping("/getLoginUser/{token}/{thirdType}")
|
||||
@ResponseBody
|
||||
public Result<JSONObject> getThirdLoginUser(@PathVariable("token") String token,@PathVariable("thirdType") String thirdType) {
|
||||
Result<JSONObject> result ;
|
||||
public Results<JSONObject> getThirdLoginUser(@PathVariable("token") String token, @PathVariable("thirdType") String thirdType) {
|
||||
Results<JSONObject> result ;
|
||||
String username = JwtUtil.getUsername(token);
|
||||
|
||||
//1. 校验用户是否有效
|
||||
@@ -253,8 +253,8 @@ public class ThirdLoginController {
|
||||
@ApiOperation("手机号登录接口")
|
||||
@PostMapping("/bindingThirdPhone")
|
||||
@ResponseBody
|
||||
public Result<String> bindingThirdPhone(@RequestBody JSONObject jsonObject) {
|
||||
Result<String> result = new Result<>();
|
||||
public Results<String> bindingThirdPhone(@RequestBody JSONObject jsonObject) {
|
||||
Results<String> result = new Results<>();
|
||||
String phone = jsonObject.getString("mobile");
|
||||
String thirdUserUuid = jsonObject.getString("thirdUserUuid");
|
||||
//校验用户有效性
|
||||
|
||||
+13
-13
@@ -1,7 +1,7 @@
|
||||
package com.jero.modules.system.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.model.SysLoginModel;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
@@ -25,33 +25,33 @@ public interface ILoginService{
|
||||
* @param sysLoginModel
|
||||
* @return Result
|
||||
*/
|
||||
public Result<JSONObject> login(SysLoginModel sysLoginModel);
|
||||
public Results<JSONObject> login(SysLoginModel sysLoginModel);
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
* @param request response
|
||||
* @return Result
|
||||
*/
|
||||
public Result<Object> logout(HttpServletRequest request, HttpServletResponse response);
|
||||
public Results<Object> logout(HttpServletRequest request, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 获取访问量
|
||||
* @return Result
|
||||
*/
|
||||
public Result<JSONObject> loginfo();
|
||||
public Results<JSONObject> loginfo();
|
||||
|
||||
/**
|
||||
* 获取访问量
|
||||
* @return Result
|
||||
*/
|
||||
public Result<List<Map<String,Object>>> visitInfo();
|
||||
public Results<List<Map<String,Object>>> visitInfo();
|
||||
|
||||
/**
|
||||
* 登陆成功选择用户当前部门
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public Result<JSONObject> selectDepart(SysUser user);
|
||||
public Results<JSONObject> selectDepart(SysUser user);
|
||||
|
||||
/**
|
||||
* 短信登录接口
|
||||
@@ -59,7 +59,7 @@ public interface ILoginService{
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
public Result<String> sms(JSONObject jsonObject);
|
||||
public Results<String> sms(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* 手机号登录接口
|
||||
@@ -67,20 +67,20 @@ public interface ILoginService{
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
public Result<JSONObject> phoneLogin(JSONObject jsonObject);
|
||||
public Results<JSONObject> phoneLogin(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* 获取加密字符串
|
||||
* @return
|
||||
*/
|
||||
public Result<Map<String,String>> getEncryptedString();
|
||||
public Results<Map<String,String>> getEncryptedString();
|
||||
|
||||
/**
|
||||
* 后台生成图形验证码 :有效
|
||||
* @param response
|
||||
* @param key
|
||||
*/
|
||||
public Result<String> randomImage(HttpServletResponse response,String key);
|
||||
public Results<String> randomImage(HttpServletResponse response, String key);
|
||||
|
||||
/**
|
||||
* app登录
|
||||
@@ -88,14 +88,14 @@ public interface ILoginService{
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Result<JSONObject> mLogin(SysLoginModel sysLoginModel);
|
||||
public Results<JSONObject> mLogin(SysLoginModel sysLoginModel);
|
||||
|
||||
/**
|
||||
* 图形验证码
|
||||
* @param sysLoginModel
|
||||
* @return
|
||||
*/
|
||||
public Result<T> checkCaptcha(@RequestBody SysLoginModel sysLoginModel);
|
||||
public Results<T> checkCaptcha(@RequestBody SysLoginModel sysLoginModel);
|
||||
|
||||
/**
|
||||
* 返回一个RSA公钥
|
||||
@@ -104,5 +104,5 @@ public interface ILoginService{
|
||||
* @param
|
||||
* @return com.jero.common.api.vo.Result<java.lang.String>
|
||||
*/
|
||||
public Result<String> getRSAPublicKey();
|
||||
public Results<String> getRSAPublicKey();
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.jero.modules.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.modules.system.entity.SysRole;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
@@ -25,7 +25,7 @@ public interface ISysRoleService extends IService<SysRole> {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
Result<T> importExcelCheckRoleCode(MultipartFile file, ImportParams params) throws Exception;
|
||||
Results<T> importExcelCheckRoleCode(MultipartFile file, ImportParams params) throws Exception;
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
|
||||
+4
-4
@@ -10,7 +10,7 @@ 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.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.vo.SysUserCacheInfo;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
|
||||
@@ -46,7 +46,7 @@ public interface ISysUserService extends IService<SysUser> {
|
||||
* @param confirmpassword
|
||||
* @return
|
||||
*/
|
||||
public Result<T> resetPassword(String username, String oldpassword, String newpassword, String confirmpassword);
|
||||
public Results<T> resetPassword(String username, String oldpassword, String newpassword, String confirmpassword);
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
@@ -54,7 +54,7 @@ public interface ISysUserService extends IService<SysUser> {
|
||||
* @param sysUser
|
||||
* @return
|
||||
*/
|
||||
public Result<T> changePassword(SysUser sysUser);
|
||||
public Results<T> changePassword(SysUser sysUser);
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
@@ -217,7 +217,7 @@ public interface ISysUserService extends IService<SysUser> {
|
||||
* @param sysUser
|
||||
* @return
|
||||
*/
|
||||
Result checkUserIsEffective(SysUser sysUser);
|
||||
Results checkUserIsEffective(SysUser sysUser);
|
||||
|
||||
/**
|
||||
* 查询被逻辑删除的用户
|
||||
|
||||
+42
-42
@@ -6,7 +6,7 @@ import cn.hutool.crypto.asymmetric.RSA;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyuncs.exceptions.ClientException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CacheConstant;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
@@ -68,15 +68,15 @@ public class LoginServiceImpl implements ILoginService {
|
||||
private static final String USER_INFO = "userInfo";
|
||||
|
||||
@Override
|
||||
public Result<JSONObject> login(SysLoginModel sysLoginModel) {
|
||||
Result<JSONObject> result ;
|
||||
public Results<JSONObject> login(SysLoginModel sysLoginModel) {
|
||||
Results<JSONObject> result ;
|
||||
String username = sysLoginModel.getUsername();
|
||||
String password = sysLoginModel.getPassword();
|
||||
String rsaPublicKey = sysLoginModel.getRsaPublicKey();
|
||||
String rsaPrivateKey = redisUtil.get(rsaPublicKey) != null ? String.valueOf(redisUtil.get(rsaPublicKey)) : null;
|
||||
|
||||
if(StrUtil.isEmpty(rsaPrivateKey)){
|
||||
return Result.error("页面过期,请刷新页面");
|
||||
return Results.error("页面过期,请刷新页面");
|
||||
}
|
||||
|
||||
//update-begin--Author:scott Date:20190805 for:暂时注释掉密码加密逻辑,有点问题
|
||||
@@ -86,14 +86,14 @@ public class LoginServiceImpl implements ILoginService {
|
||||
//update-begin-author:taoyan date:20190828 for:校验验证码
|
||||
String captcha = sysLoginModel.getCaptcha();
|
||||
if(captcha==null){
|
||||
return Result.error("验证码无效");
|
||||
return Results.error("验证码无效");
|
||||
}
|
||||
String lowerCaseCaptcha = captcha.toLowerCase();
|
||||
String realKey = MD5Util.MD5Encode(lowerCaseCaptcha+sysLoginModel.getCheckKey(), UTF_8);
|
||||
Object checkCode = redisUtil.get(realKey);
|
||||
//当进入登录页时,有一定几率出现验证码错误 #1714
|
||||
if(checkCode==null || !checkCode.toString().equals(lowerCaseCaptcha)) {
|
||||
return Result.error("验证码错误");
|
||||
return Results.error("验证码错误");
|
||||
}
|
||||
try {
|
||||
//解密获取密码和用户名
|
||||
@@ -119,7 +119,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
retryCount = (int) redisUtil.get(RETRY_LOGIN_PREFIX + username);
|
||||
}
|
||||
if (retryCount >= RETRY_LOGIN_MAX_COUNT){
|
||||
return Result.error("密码错误次数过多,请15分钟后重试");
|
||||
return Results.error("密码错误次数过多,请15分钟后重试");
|
||||
}
|
||||
//2. 校验用户名或密码是否正确
|
||||
String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
|
||||
@@ -133,7 +133,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
redisUtil.set(RETRY_LOGIN_PREFIX + username,retryCount,redisUtil.getExpire(RETRY_LOGIN_PREFIX + username));
|
||||
}
|
||||
String msg = retryCount == RETRY_LOGIN_MAX_COUNT ? "密码错误次数过多,请稍后重试":"用户名或密码错误,剩余可登录次数:"+(RETRY_LOGIN_MAX_COUNT - retryCount);
|
||||
return Result.error(msg);
|
||||
return Results.error(msg);
|
||||
}
|
||||
//登录成功,清除错误登录次数
|
||||
redisUtil.del(RETRY_LOGIN_PREFIX + username);
|
||||
@@ -153,11 +153,11 @@ public class LoginServiceImpl implements ILoginService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Object> logout(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Results<Object> logout(HttpServletRequest request, HttpServletResponse response) {
|
||||
//用户退出逻辑
|
||||
String token = request.getHeader(CommonConstant.X_ACCESS_TOKEN);
|
||||
if(oConvertUtils.isEmpty(token)) {
|
||||
return Result.error("退出登录失败!");
|
||||
return Results.error("退出登录失败!");
|
||||
}
|
||||
String username = JwtUtil.getUsername(token);
|
||||
LoginUser sysUser = sysBaseAPI.getUserByName(username);
|
||||
@@ -174,15 +174,15 @@ public class LoginServiceImpl implements ILoginService {
|
||||
redisUtil.del(String.format("%s::%s", CacheConstant.SYS_USERS_CACHE, sysUser.getUsername()));
|
||||
//调用shiro的logout
|
||||
SecurityUtils.getSubject().logout();
|
||||
return Result.OK("退出登录成功!");
|
||||
return Results.OK("退出登录成功!");
|
||||
}else {
|
||||
return Result.error("Token无效!");
|
||||
return Results.error("Token无效!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<JSONObject> loginfo() {
|
||||
Result<JSONObject> result = new Result<>();
|
||||
public Results<JSONObject> loginfo() {
|
||||
Results<JSONObject> result = new Results<>();
|
||||
JSONObject obj = new JSONObject();
|
||||
//update-begin--Author:zhangweijian Date:20190428 for:传入开始时间,结束时间参数
|
||||
// 获取一天的开始和结束时间
|
||||
@@ -208,8 +208,8 @@ public class LoginServiceImpl implements ILoginService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<Map<String, Object>>> visitInfo() {
|
||||
Result<List<Map<String,Object>>> result = new Result<>();
|
||||
public Results<List<Map<String, Object>>> visitInfo() {
|
||||
Results<List<Map<String,Object>>> result = new Results<>();
|
||||
Calendar calendar = new GregorianCalendar();
|
||||
calendar.set(Calendar.HOUR_OF_DAY,0);
|
||||
calendar.set(Calendar.MINUTE,0);
|
||||
@@ -225,8 +225,8 @@ public class LoginServiceImpl implements ILoginService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<JSONObject> selectDepart(SysUser user) {
|
||||
Result<JSONObject> result = new Result<>();
|
||||
public Results<JSONObject> selectDepart(SysUser user) {
|
||||
Results<JSONObject> result = new Results<>();
|
||||
String username = user.getUsername();
|
||||
if(oConvertUtils.isEmpty(username)) {
|
||||
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
||||
@@ -242,8 +242,8 @@ public class LoginServiceImpl implements ILoginService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> sms(JSONObject jsonObject) {
|
||||
Result<String> result = new Result<>();
|
||||
public Results<String> sms(JSONObject jsonObject) {
|
||||
Results<String> result = new Results<>();
|
||||
String mobile = jsonObject.get("mobile").toString();
|
||||
//手机号模式 登录模式: "2" 注册模式: "1"
|
||||
String smsmode=jsonObject.get("smsmode").toString();
|
||||
@@ -271,7 +271,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
SysUser sysUser = sysUserService.getUserByPhone(mobile);
|
||||
if(sysUser!=null) {
|
||||
baseCommonService.addLog("手机号已经注册,请直接登录!", CommonConstant.LOG_TYPE_1, null);
|
||||
return Result.error(" 手机号已经注册,请直接登录!");
|
||||
return Results.error(" 手机号已经注册,请直接登录!");
|
||||
}
|
||||
b = DySmsHelper.sendSms(mobile, obj, DySmsEnum.REGISTER_TEMPLATE_CODE);
|
||||
}else {
|
||||
@@ -281,7 +281,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
if(!result.isSuccess()) {
|
||||
String message = result.getMessage();
|
||||
if("该用户不存在,请注册".equals(message)){
|
||||
return Result.error("该用户不存在或未绑定手机号");
|
||||
return Results.error("该用户不存在或未绑定手机号");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
|
||||
} catch (ClientException e) {
|
||||
e.printStackTrace();
|
||||
return Result.error(" 短信接口未配置,请联系管理员!");
|
||||
return Results.error(" 短信接口未配置,请联系管理员!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -323,8 +323,8 @@ public class LoginServiceImpl implements ILoginService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<JSONObject> phoneLogin(JSONObject jsonObject) {
|
||||
Result<JSONObject> result ;
|
||||
public Results<JSONObject> phoneLogin(JSONObject jsonObject) {
|
||||
Results<JSONObject> result ;
|
||||
String phone = jsonObject.getString("mobile");
|
||||
|
||||
//校验用户有效性
|
||||
@@ -349,8 +349,8 @@ public class LoginServiceImpl implements ILoginService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Map<String, String>> getEncryptedString() {
|
||||
Result<Map<String,String>> result = new Result<>();
|
||||
public Results<Map<String, String>> getEncryptedString() {
|
||||
Results<Map<String,String>> result = new Results<>();
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("key", EncryptedString.ENCRYPTED_KEY);
|
||||
map.put("iv",EncryptedString.ENCRYPTED_IV);
|
||||
@@ -359,8 +359,8 @@ public class LoginServiceImpl implements ILoginService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> randomImage(HttpServletResponse response, String key) {
|
||||
Result<String> res = new Result<>();
|
||||
public Results<String> randomImage(HttpServletResponse response, String key) {
|
||||
Results<String> res = new Results<>();
|
||||
try {
|
||||
String code = RandomUtil.randomString(BASE_CHECK_CODES,4);
|
||||
String lowerCaseCode = code.toLowerCase();
|
||||
@@ -371,14 +371,14 @@ public class LoginServiceImpl implements ILoginService {
|
||||
res.setResult(base64);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("获取验证码出错"+e.getMessage());
|
||||
return Results.error("获取验证码出错"+e.getMessage());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<JSONObject> mLogin(SysLoginModel sysLoginModel) {
|
||||
Result<JSONObject> result ;
|
||||
public Results<JSONObject> mLogin(SysLoginModel sysLoginModel) {
|
||||
Results<JSONObject> result ;
|
||||
String username = sysLoginModel.getUsername();
|
||||
String password = sysLoginModel.getPassword();
|
||||
|
||||
@@ -393,7 +393,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
|
||||
String syspassword = sysUser.getPassword();
|
||||
if (!syspassword.equals(userpassword)) {
|
||||
return Result.error("用户名或密码错误");
|
||||
return Results.error("用户名或密码错误");
|
||||
}
|
||||
|
||||
String orgCode = sysUser.getOrgCode();
|
||||
@@ -401,7 +401,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
//如果当前用户无选择部门 查看部门关联信息
|
||||
List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
|
||||
if (departs == null || departs.isEmpty()) {
|
||||
return Result.error("用户暂未归属部门,不可登录!");
|
||||
return Results.error("用户暂未归属部门,不可登录!");
|
||||
}
|
||||
orgCode = departs.get(0).getOrgCode();
|
||||
sysUser.setOrgCode(orgCode);
|
||||
@@ -427,29 +427,29 @@ public class LoginServiceImpl implements ILoginService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<T> checkCaptcha(SysLoginModel sysLoginModel) {
|
||||
public Results<T> checkCaptcha(SysLoginModel sysLoginModel) {
|
||||
String captcha = sysLoginModel.getCaptcha();
|
||||
String checkKey = sysLoginModel.getCheckKey();
|
||||
if(captcha==null){
|
||||
return Result.error("验证码无效");
|
||||
return Results.error("验证码无效");
|
||||
}
|
||||
String lowerCaseCaptcha = captcha.toLowerCase();
|
||||
String realKey = MD5Util.MD5Encode(lowerCaseCaptcha+checkKey, UTF_8);
|
||||
Object checkCode = redisUtil.get(realKey);
|
||||
if(checkCode==null || !checkCode.equals(lowerCaseCaptcha)) {
|
||||
return Result.error("验证码错误");
|
||||
return Results.error("验证码错误");
|
||||
}
|
||||
return Result.OK();
|
||||
return Results.OK();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> getRSAPublicKey() {
|
||||
public Results<String> getRSAPublicKey() {
|
||||
RSA rsa = new RSA();
|
||||
String privateKeyBase64 = rsa.getPrivateKeyBase64();
|
||||
String publicKeyBase64 = rsa.getPublicKeyBase64();
|
||||
//存到redis key为公钥 value为私钥
|
||||
redisUtil.set(publicKeyBase64, privateKeyBase64, 180L);
|
||||
Result<String> result = new Result<>();
|
||||
Results<String> result = new Results<>();
|
||||
result.setResult(publicKeyBase64);
|
||||
return result;
|
||||
}
|
||||
@@ -461,7 +461,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
* @param result
|
||||
* @return
|
||||
*/
|
||||
private Result<JSONObject> userInfo(SysUser sysUser, Result<JSONObject> result) {
|
||||
private Results<JSONObject> userInfo(SysUser sysUser, Results<JSONObject> result) {
|
||||
String multiDepart ="multi_depart";
|
||||
String syspassword = sysUser.getPassword();
|
||||
String username = sysUser.getUsername();
|
||||
@@ -493,7 +493,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
// 该方法仅查询有效的租户,如果返回0个就说明所有的租户均无效。
|
||||
List<SysTenant> tenantList = sysTenantService.queryEffectiveTenant(tenantIdList);
|
||||
if (tenantList.isEmpty()) {
|
||||
return Result.error("与该用户关联的租户均已被冻结,无法登录!");
|
||||
return Results.error("与该用户关联的租户均已被冻结,无法登录!");
|
||||
} else {
|
||||
obj.put("tenantList", tenantList);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.jero.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.util.ImportExcelUtil;
|
||||
import com.jero.modules.system.entity.SysRole;
|
||||
@@ -35,7 +35,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
SysUserMapper sysUserMapper;
|
||||
|
||||
@Override
|
||||
public Result importExcelCheckRoleCode(MultipartFile file, ImportParams params) throws Exception {
|
||||
public Results importExcelCheckRoleCode(MultipartFile file, ImportParams params) throws Exception {
|
||||
List<Object> listSysRoles = ExcelImportUtil.importExcel(file.getInputStream(), SysRole.class, params);
|
||||
List<String> errorStrs = new ArrayList<>();
|
||||
|
||||
|
||||
+13
-13
@@ -5,9 +5,9 @@ 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.modules.system.vo.SysUserRoleNameVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.CacheConstant;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
@@ -68,33 +68,33 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true)
|
||||
public Result<T> resetPassword(String username, String oldpassword, String newpassword, String confirmpassword) {
|
||||
public Results<T> resetPassword(String username, String oldpassword, String newpassword, String confirmpassword) {
|
||||
SysUser user = userMapper.getUserByName(username);
|
||||
String passwordEncode = PasswordUtil.encrypt(username, oldpassword, user.getSalt());
|
||||
if (!user.getPassword().equals(passwordEncode)) {
|
||||
return Result.error("旧密码输入错误!");
|
||||
return Results.error("旧密码输入错误!");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(newpassword)) {
|
||||
return Result.error("新密码不允许为空!");
|
||||
return Results.error("新密码不允许为空!");
|
||||
}
|
||||
if (!newpassword.equals(confirmpassword)) {
|
||||
return Result.error("两次输入密码不一致!");
|
||||
return Results.error("两次输入密码不一致!");
|
||||
}
|
||||
String password = PasswordUtil.encrypt(username, newpassword, user.getSalt());
|
||||
this.userMapper.update(new SysUser().setPassword(password), new LambdaQueryWrapper<SysUser>().eq(SysUser::getId, user.getId()));
|
||||
return Result.OK("密码重置成功!");
|
||||
return Results.OK("密码重置成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true)
|
||||
public Result<T> changePassword(SysUser sysUser) {
|
||||
public Results<T> changePassword(SysUser sysUser) {
|
||||
String salt = oConvertUtils.randomGen(8);
|
||||
sysUser.setSalt(salt);
|
||||
String password = sysUser.getPassword();
|
||||
String passwordEncode = PasswordUtil.encrypt(sysUser.getUsername(), password, salt);
|
||||
sysUser.setPassword(passwordEncode);
|
||||
this.userMapper.updateById(sysUser);
|
||||
return Result.OK("密码操作成功!");
|
||||
return Results.OK("密码操作成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -370,24 +370,24 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result<T> checkUserIsEffective(SysUser sysUser) {
|
||||
Result<T> result = new Result<>();
|
||||
public Results<T> checkUserIsEffective(SysUser sysUser) {
|
||||
Results<T> result = new Results<>();
|
||||
//情况1:根据用户信息查询,该用户不存在
|
||||
if (sysUser == null) {
|
||||
baseCommonService.addLog("用户登录失败,用户不存在!", CommonConstant.LOG_TYPE_1, null);
|
||||
return Result.error("该用户不存在,请注册");
|
||||
return Results.error("该用户不存在,请注册");
|
||||
}
|
||||
//情况2:根据用户信息查询,该用户已注销
|
||||
//update-begin---author:王帅 Date:20200601 for:if条件永远为falsebug------------
|
||||
if (CommonConstant.DEL_FLAG_1.equals(sysUser.getDelFlag())) {
|
||||
//update-end---author:王帅 Date:20200601 for:if条件永远为falsebug------------
|
||||
baseCommonService.addLog("用户登录失败,用户名:" + sysUser.getUsername() + "已注销!", CommonConstant.LOG_TYPE_1, null);
|
||||
return Result.error("该用户已注销");
|
||||
return Results.error("该用户已注销");
|
||||
}
|
||||
//情况3:根据用户信息查询,该用户已冻结
|
||||
if (CommonConstant.USER_FREEZE.equals(sysUser.getStatus())) {
|
||||
baseCommonService.addLog("用户登录失败,用户名:" + sysUser.getUsername() + "已冻结!", CommonConstant.LOG_TYPE_1, null);
|
||||
return Result.error("该用户已冻结");
|
||||
return Results.error("该用户已冻结");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
+8
-8
@@ -19,7 +19,7 @@ import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
<#list subTables as sub>
|
||||
@@ -69,7 +69,7 @@ public class ${entityName}Controller {
|
||||
@Autowired
|
||||
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service;
|
||||
</#list>
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -91,7 +91,7 @@ public class ${entityName}Controller {
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
@@ -110,7 +110,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.saveMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
@@ -130,7 +130,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.updateMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
@@ -144,7 +144,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
@@ -158,7 +158,7 @@ public class ${entityName}Controller {
|
||||
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
@@ -176,7 +176,7 @@ public class ${entityName}Controller {
|
||||
return Result.OK(${entityName?uncap_first});
|
||||
|
||||
}
|
||||
|
||||
|
||||
<#list subTables as sub>
|
||||
/**
|
||||
* 通过id查询
|
||||
|
||||
+7
-7
@@ -9,7 +9,7 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
@@ -55,7 +55,7 @@ import com.jero.common.aspect.annotation.AutoLog;
|
||||
public class ${entityName}Controller extends JeroController<${entityName}, I${entityName}Service>{
|
||||
@Autowired
|
||||
private I${entityName}Service ${entityName?uncap_first}Service;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -135,7 +135,7 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
||||
return Result.error("批量查询子节点失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
@@ -149,7 +149,7 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
||||
${entityName?uncap_first}Service.add${entityName}(${entityName?uncap_first});
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
@@ -163,7 +163,7 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
||||
${entityName?uncap_first}Service.update${entityName}(${entityName?uncap_first});
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
@@ -177,7 +177,7 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
||||
${entityName?uncap_first}Service.delete${entityName}(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
@@ -191,7 +191,7 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
||||
this.${entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeecgController;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -153,7 +153,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
|
||||
return super.importExcel(request, response, ${entityName}.class);
|
||||
}
|
||||
/*---------------------------------主表处理-end-------------------------------------*/
|
||||
|
||||
|
||||
<#list subTables as sub>
|
||||
|
||||
/*--------------------------------子表处理-${sub.ftlDescription}-begin----------------------------------------------*/
|
||||
|
||||
+8
-8
@@ -19,7 +19,7 @@ import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
<#list subTables as sub>
|
||||
@@ -63,7 +63,7 @@ public class ${entityName}Controller {
|
||||
@Autowired
|
||||
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service;
|
||||
</#list>
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -85,7 +85,7 @@ public class ${entityName}Controller {
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
@@ -101,7 +101,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.saveMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
@@ -121,7 +121,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.updateMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
@@ -135,7 +135,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
@@ -149,7 +149,7 @@ public class ${entityName}Controller {
|
||||
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
@@ -167,7 +167,7 @@ public class ${entityName}Controller {
|
||||
return Result.OK(${entityName?uncap_first});
|
||||
|
||||
}
|
||||
|
||||
|
||||
<#list subTables as sub>
|
||||
/**
|
||||
* 通过id查询
|
||||
|
||||
+8
-8
@@ -19,7 +19,7 @@ import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
<#list subTables as sub>
|
||||
@@ -69,7 +69,7 @@ public class ${entityName}Controller {
|
||||
@Autowired
|
||||
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service;
|
||||
</#list>
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -91,7 +91,7 @@ public class ${entityName}Controller {
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
@@ -110,7 +110,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.saveMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
@@ -130,7 +130,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.updateMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
@@ -144,7 +144,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
@@ -158,7 +158,7 @@ public class ${entityName}Controller {
|
||||
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
@@ -176,7 +176,7 @@ public class ${entityName}Controller {
|
||||
return Result.OK(${entityName?uncap_first});
|
||||
|
||||
}
|
||||
|
||||
|
||||
<#list subTables as sub>
|
||||
/**
|
||||
* 通过id查询
|
||||
|
||||
+8
-8
@@ -19,7 +19,7 @@ import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
<#list subTables as sub>
|
||||
@@ -63,7 +63,7 @@ public class ${entityName}Controller {
|
||||
@Autowired
|
||||
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service;
|
||||
</#list>
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -85,7 +85,7 @@ public class ${entityName}Controller {
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
@@ -101,7 +101,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.saveMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
@@ -121,7 +121,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.updateMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
@@ -135,7 +135,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
@@ -149,7 +149,7 @@ public class ${entityName}Controller {
|
||||
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
@@ -167,7 +167,7 @@ public class ${entityName}Controller {
|
||||
return Result.OK(${entityName?uncap_first});
|
||||
|
||||
}
|
||||
|
||||
|
||||
<#list subTables as sub>
|
||||
/**
|
||||
* 通过id查询
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
|
||||
+7
-7
@@ -10,7 +10,7 @@ import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import ${bussiPackage}.entity.${entityPackage}.${entityName};
|
||||
@@ -52,7 +52,7 @@ import com.jero.common.aspect.annotation.AutoLog;
|
||||
public class ${entityName}Controller extends JeroController<${entityName}, I${entityName}Service> {
|
||||
@Autowired
|
||||
private I${entityName}Service ${entityName?uncap_first}Service;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -75,7 +75,7 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
||||
return Result.OK(pageList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param ${entityName?uncap_first}
|
||||
@@ -88,7 +88,7 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
||||
${entityName?uncap_first}Service.save(${entityName?uncap_first});
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
@@ -102,7 +102,7 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
||||
${entityName?uncap_first}Service.updateById(${entityName?uncap_first});
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
@@ -115,7 +115,7 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
||||
${entityName?uncap_first}Service.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
@@ -129,7 +129,7 @@ public class ${entityName}Controller extends JeroController<${entityName}, I${en
|
||||
this.${entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
|
||||
+8
-8
@@ -18,7 +18,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
<#list subTables as sub>
|
||||
@@ -62,7 +62,7 @@ public class ${entityName}Controller {
|
||||
@Autowired
|
||||
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service;
|
||||
</#list>
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -84,7 +84,7 @@ public class ${entityName}Controller {
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
@@ -100,7 +100,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.saveMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
@@ -116,7 +116,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.updateMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
@@ -130,7 +130,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
@@ -144,7 +144,7 @@ public class ${entityName}Controller {
|
||||
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
@@ -158,7 +158,7 @@ public class ${entityName}Controller {
|
||||
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
|
||||
return Result.OK(${entityName?uncap_first});
|
||||
}
|
||||
|
||||
|
||||
<#list subTables as sub>
|
||||
/**
|
||||
* 通过id查询
|
||||
|
||||
+15
-15
@@ -17,7 +17,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
<#list subTables as sub>
|
||||
@@ -61,7 +61,7 @@ public class ${entityName}Controller {
|
||||
@Autowired
|
||||
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service;
|
||||
</#list>
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -83,7 +83,7 @@ public class ${entityName}Controller {
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
@@ -99,7 +99,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.save(${entityName?uncap_first});
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
@@ -115,7 +115,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.updateById(${entityName?uncap_first});
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
@@ -129,7 +129,7 @@ public class ${entityName}Controller {
|
||||
${entityName?uncap_first}Service.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
@@ -143,7 +143,7 @@ public class ${entityName}Controller {
|
||||
this.${entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
@@ -157,9 +157,9 @@ public class ${entityName}Controller {
|
||||
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
|
||||
return Result.OK(${entityName?uncap_first});
|
||||
}
|
||||
|
||||
|
||||
//===========================以下是子表信息操作相关API====================================
|
||||
|
||||
|
||||
<#list subTables as sub>
|
||||
/**
|
||||
* 通过主表id查询${sub.ftlDescription}
|
||||
@@ -200,7 +200,7 @@ ${sub.entityName?uncap_first}.get${key}()!=null<#rt/>
|
||||
}
|
||||
}
|
||||
<#-- update-end--Author:kangxiaolin Date:20190905 for:[442]主子表分开维护,生成的代码子表的分页改为真实的分页-------------------- -->
|
||||
|
||||
|
||||
/**
|
||||
* 添加${sub.ftlDescription}
|
||||
*
|
||||
@@ -214,7 +214,7 @@ ${sub.entityName?uncap_first}.get${key}()!=null<#rt/>
|
||||
${sub.entityName?uncap_first}Service.save(${sub.entityName?uncap_first});
|
||||
return Result.OK("添加${sub.ftlDescription}成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑${sub.ftlDescription}
|
||||
*
|
||||
@@ -228,7 +228,7 @@ ${sub.entityName?uncap_first}.get${key}()!=null<#rt/>
|
||||
${sub.entityName?uncap_first}Service.updateById(${sub.entityName?uncap_first});
|
||||
return Result.OK("编辑${sub.ftlDescription}成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除${sub.ftlDescription}
|
||||
*
|
||||
@@ -242,7 +242,7 @@ ${sub.entityName?uncap_first}.get${key}()!=null<#rt/>
|
||||
${sub.entityName?uncap_first}Service.removeById(id);
|
||||
return Result.OK("删除${sub.ftlDescription}成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除${sub.ftlDescription}
|
||||
*
|
||||
@@ -255,12 +255,12 @@ ${sub.entityName?uncap_first}.get${key}()!=null<#rt/>
|
||||
public Result<?> deleteBatch${sub.entityName}(@RequestParam(name = "ids", required = true) String ids) {
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
return Result.error("参数不识别!");
|
||||
}
|
||||
}
|
||||
this.${sub.entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
</#list>
|
||||
|
||||
/**
|
||||
|
||||
+5
-5
@@ -2,11 +2,11 @@ package com.jero.modules.cloud.feign.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.starter.cloud.feign.impl.JeroFeignService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.boot.starter.rabbitmq.client.RabbitMqClient;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.base.BaseMap;
|
||||
import com.jero.modules.cloud.constant.CloudConstant;
|
||||
import com.jero.modules.cloud.feign.feign.JeroTestClient;
|
||||
@@ -33,20 +33,20 @@ public class JeroTestFeignController {
|
||||
|
||||
@GetMapping("getMessage")
|
||||
@ApiOperation(value = "测试feign", notes = "测试feign")
|
||||
public Result<String> getMessage() {
|
||||
public Results<String> getMessage() {
|
||||
return jeroTestClient.getMessage("jero-boot");
|
||||
}
|
||||
|
||||
@GetMapping("getMessage2")
|
||||
@ApiOperation(value = "测试动态feign", notes = "测试动态feign")
|
||||
public Result<String> getMessage2() {
|
||||
public Results<String> getMessage2() {
|
||||
JeroTestClientDyn myClientDyn = jeroFeignService.newInstance(JeroTestClientDyn.class, CloudConstant.SERVER_NAME_JERO_DEMO);
|
||||
return myClientDyn.getMessage("动态fegin——jero-boot2");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/rabbitmq")
|
||||
@ApiOperation(value = "测试rabbitmq", notes = "测试rabbitmq")
|
||||
public Result<T> rabbitMqClientTest(HttpServletRequest req) {
|
||||
public Results<T> rabbitMqClientTest(HttpServletRequest req) {
|
||||
//rabbitmq消息队列测试
|
||||
BaseMap map = new BaseMap();
|
||||
map.put("orderId", RandomUtil.randomNumbers(10));
|
||||
@@ -57,6 +57,6 @@ public class JeroTestFeignController {
|
||||
BaseMap params = new BaseMap();
|
||||
params.put("orderId", "123456");
|
||||
rabbitMqClient.publishEvent(CloudConstant.MQ_DEMO_BUS_EVENT, params);
|
||||
return Result.OK("MQ发送消息成功");
|
||||
return Results.OK("MQ发送消息成功");
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.jero.modules.cloud.feign.feign;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import com.jero.modules.cloud.constant.CloudConstant;
|
||||
import com.jero.modules.cloud.feign.feign.fallback.JeroTestClientFallback;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
@@ -16,5 +16,5 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
public interface JeroTestClient {
|
||||
|
||||
@GetMapping(value = "/test/getMessage")
|
||||
Result<String> getMessage(@RequestParam("name") String name);
|
||||
Results<String> getMessage(@RequestParam("name") String name);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.jero.modules.cloud.feign.feign;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.Results;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@@ -10,5 +10,5 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
public interface JeroTestClientDyn {
|
||||
|
||||
@GetMapping(value = "/test/getMessage")
|
||||
Result<String> getMessage(@RequestParam("name") String name);
|
||||
Results<String> getMessage(@RequestParam("name") String name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user