mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-31 17:15:29 +08:00
JeecgBoot 3.1.0 版本发布,基于代码生成器的企业级低代码平台
This commit is contained in:
@ -1,12 +1,19 @@
|
||||
package org.jeecg;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.catalina.Context;
|
||||
import org.apache.tomcat.util.scan.StandardJarScanner;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
//import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.net.InetAddress;
|
||||
@ -17,6 +24,7 @@ import java.net.UnknownHostException;
|
||||
*/
|
||||
@Slf4j
|
||||
@SpringBootApplication
|
||||
@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})
|
||||
public class JeecgSystemApplication extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package org.jeecg.config.jimureport;
|
||||
|
||||
import org.jeecg.common.constant.DataBaseConstant;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.system.vo.SysUserCacheInfo;
|
||||
@ -20,6 +20,9 @@ import java.util.Map;
|
||||
* * 1.自定义获取登录token
|
||||
* * 2.自定义获取登录用户
|
||||
*/
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class JimuReportTokenService implements JmReportTokenServiceI {
|
||||
@Autowired
|
||||
@ -45,10 +48,16 @@ public class JimuReportTokenService implements JmReportTokenServiceI {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getUserInfo(String token) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String username = JwtUtil.getUsername(token);
|
||||
//此处通过token只能拿到一个信息 用户账号 后面的就是根据账号获取其他信息 查询数据或是走redis 用户根据自身业务可自定义
|
||||
SysUserCacheInfo userInfo = sysBaseAPI.getCacheUser(username);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
SysUserCacheInfo userInfo = null;
|
||||
try {
|
||||
userInfo = sysBaseAPI.getCacheUser(username);
|
||||
} catch (Exception e) {
|
||||
log.error("获取用户信息异常:"+ e.getMessage());
|
||||
return map;
|
||||
}
|
||||
//设置账号名
|
||||
map.put(SYS_USER_CODE, userInfo.getSysUserCode());
|
||||
//设置部门编码
|
||||
|
||||
@ -1,46 +1,46 @@
|
||||
package org.jeecg.modules.ngalain.aop;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;;
|
||||
|
||||
|
||||
// 暂时注释掉,提高系统性能
|
||||
//@Aspect //定义一个切面
|
||||
//@Configuration
|
||||
public class LogRecordAspect {
|
||||
private static final Logger logger = LoggerFactory.getLogger(LogRecordAspect.class);
|
||||
|
||||
// 定义切点Pointcut
|
||||
@Pointcut("execution(public * org.jeecg.modules.*.*.*Controller.*(..))")
|
||||
public void excudeService() {
|
||||
}
|
||||
|
||||
@Around("excudeService()")
|
||||
public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
|
||||
RequestAttributes ra = RequestContextHolder.getRequestAttributes();
|
||||
ServletRequestAttributes sra = (ServletRequestAttributes) ra;
|
||||
HttpServletRequest request = sra.getRequest();
|
||||
|
||||
String url = request.getRequestURL().toString();
|
||||
String method = request.getMethod();
|
||||
String uri = request.getRequestURI();
|
||||
String queryString = request.getQueryString();
|
||||
logger.info("请求开始, 各个参数, url: {}, method: {}, uri: {}, params: {}", url, method, uri, queryString);
|
||||
|
||||
// result的值就是被拦截方法的返回值
|
||||
Object result = pjp.proceed();
|
||||
|
||||
logger.info("请求结束,controller的返回值是 " + result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
//package org.jeecg.modules.ngalain.aop;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//
|
||||
//import org.aspectj.lang.ProceedingJoinPoint;
|
||||
//import org.aspectj.lang.annotation.Around;
|
||||
//import org.aspectj.lang.annotation.Aspect;
|
||||
//import org.aspectj.lang.annotation.Pointcut;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.web.context.request.RequestAttributes;
|
||||
//import org.springframework.web.context.request.RequestContextHolder;
|
||||
//import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;;
|
||||
//
|
||||
//
|
||||
//// 暂时注释掉,提高系统性能
|
||||
////@Aspect //定义一个切面
|
||||
////@Configuration
|
||||
//public class LogRecordAspect {
|
||||
//private static final Logger logger = LoggerFactory.getLogger(LogRecordAspect.class);
|
||||
//
|
||||
// // 定义切点Pointcut
|
||||
// @Pointcut("execution(public * org.jeecg.modules.*.*.*Controller.*(..))")
|
||||
// public void excudeService() {
|
||||
// }
|
||||
//
|
||||
// @Around("excudeService()")
|
||||
// public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
|
||||
// RequestAttributes ra = RequestContextHolder.getRequestAttributes();
|
||||
// ServletRequestAttributes sra = (ServletRequestAttributes) ra;
|
||||
// HttpServletRequest request = sra.getRequest();
|
||||
//
|
||||
// String url = request.getRequestURL().toString();
|
||||
// String method = request.getMethod();
|
||||
// String uri = request.getRequestURI();
|
||||
// String queryString = request.getQueryString();
|
||||
// logger.info("请求开始, 各个参数, url: {}, method: {}, uri: {}, params: {}", url, method, uri, queryString);
|
||||
//
|
||||
// // result的值就是被拦截方法的返回值
|
||||
// Object result = pjp.proceed();
|
||||
//
|
||||
// logger.info("请求结束,controller的返回值是 " + result);
|
||||
// return result;
|
||||
// }
|
||||
//}
|
||||
@ -1,86 +1,86 @@
|
||||
package org.jeecg.modules.ngalain.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.ngalain.service.NgAlainService;
|
||||
import org.jeecg.modules.system.service.ISysDictService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/ng-alain")
|
||||
public class NgAlainController {
|
||||
@Autowired
|
||||
private NgAlainService ngAlainService;
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
@RequestMapping(value = "/getAppData")
|
||||
@ResponseBody
|
||||
public JSONObject getAppData(HttpServletRequest request) throws Exception {
|
||||
String token=request.getHeader("X-Access-Token");
|
||||
JSONObject j = new JSONObject();
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
JSONObject userObjcet = new JSONObject();
|
||||
userObjcet.put("name", user.getUsername());
|
||||
userObjcet.put("avatar", user.getAvatar());
|
||||
userObjcet.put("email", user.getEmail());
|
||||
userObjcet.put("token", token);
|
||||
j.put("user", userObjcet);
|
||||
j.put("menu",ngAlainService.getMenu(user.getUsername()));
|
||||
JSONObject app = new JSONObject();
|
||||
app.put("name", "jeecg-boot-angular");
|
||||
app.put("description", "jeecg+ng-alain整合版本");
|
||||
j.put("app", app);
|
||||
return j;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getDictItems/{dictCode}", method = RequestMethod.GET)
|
||||
public Object getDictItems(@PathVariable String dictCode) {
|
||||
log.info(" dictCode : "+ dictCode);
|
||||
Result<List<DictModel>> result = new Result<List<DictModel>>();
|
||||
List<DictModel> ls = null;
|
||||
try {
|
||||
ls = sysDictService.queryDictItemsByCode(dictCode);
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
return result;
|
||||
}
|
||||
List<JSONObject> dictlist=new ArrayList<>();
|
||||
for (DictModel l : ls) {
|
||||
JSONObject dict=new JSONObject();
|
||||
try {
|
||||
dict.put("value",Integer.parseInt(l.getValue()));
|
||||
} catch (NumberFormatException e) {
|
||||
dict.put("value",l.getValue());
|
||||
}
|
||||
dict.put("label",l.getText());
|
||||
dictlist.add(dict);
|
||||
}
|
||||
return dictlist;
|
||||
}
|
||||
@RequestMapping(value = "/getDictItemsByTable/{table}/{key}/{value}", method = RequestMethod.GET)
|
||||
public Object getDictItemsByTable(@PathVariable String table,@PathVariable String key,@PathVariable String value) {
|
||||
return this.ngAlainService.getDictByTable(table,key,value);
|
||||
}
|
||||
}
|
||||
//package org.jeecg.modules.ngalain.controller;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//
|
||||
//import org.apache.shiro.SecurityUtils;
|
||||
//import org.jeecg.common.api.vo.Result;
|
||||
//import org.jeecg.common.system.vo.DictModel;
|
||||
//import org.jeecg.common.system.vo.LoginUser;
|
||||
//import org.jeecg.modules.ngalain.service.NgAlainService;
|
||||
//import org.jeecg.modules.system.service.ISysDictService;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.web.bind.annotation.PathVariable;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMethod;
|
||||
//import org.springframework.web.bind.annotation.ResponseBody;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//import com.alibaba.fastjson.JSONObject;
|
||||
//
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//
|
||||
//@Slf4j
|
||||
//@RestController
|
||||
//@RequestMapping("/sys/ng-alain")
|
||||
//public class NgAlainController {
|
||||
// @Autowired
|
||||
// private NgAlainService ngAlainService;
|
||||
// @Autowired
|
||||
// private ISysDictService sysDictService;
|
||||
//
|
||||
// @RequestMapping(value = "/getAppData")
|
||||
// @ResponseBody
|
||||
// public JSONObject getAppData(HttpServletRequest request) throws Exception {
|
||||
// String token=request.getHeader("X-Access-Token");
|
||||
// JSONObject j = new JSONObject();
|
||||
// LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
// JSONObject userObjcet = new JSONObject();
|
||||
// userObjcet.put("name", user.getUsername());
|
||||
// userObjcet.put("avatar", user.getAvatar());
|
||||
// userObjcet.put("email", user.getEmail());
|
||||
// userObjcet.put("token", token);
|
||||
// j.put("user", userObjcet);
|
||||
// j.put("menu",ngAlainService.getMenu(user.getUsername()));
|
||||
// JSONObject app = new JSONObject();
|
||||
// app.put("name", "jeecg-boot-angular");
|
||||
// app.put("description", "jeecg+ng-alain整合版本");
|
||||
// j.put("app", app);
|
||||
// return j;
|
||||
// }
|
||||
//
|
||||
// @RequestMapping(value = "/getDictItems/{dictCode}", method = RequestMethod.GET)
|
||||
// public Object getDictItems(@PathVariable String dictCode) {
|
||||
// log.info(" dictCode : "+ dictCode);
|
||||
// Result<List<DictModel>> result = new Result<List<DictModel>>();
|
||||
// List<DictModel> ls = null;
|
||||
// try {
|
||||
// ls = sysDictService.queryDictItemsByCode(dictCode);
|
||||
// result.setSuccess(true);
|
||||
// result.setResult(ls);
|
||||
// } catch (Exception e) {
|
||||
// log.error(e.getMessage(),e);
|
||||
// result.error500("操作失败");
|
||||
// return result;
|
||||
// }
|
||||
// List<JSONObject> dictlist=new ArrayList<>();
|
||||
// for (DictModel l : ls) {
|
||||
// JSONObject dict=new JSONObject();
|
||||
// try {
|
||||
// dict.put("value",Integer.parseInt(l.getValue()));
|
||||
// } catch (NumberFormatException e) {
|
||||
// dict.put("value",l.getValue());
|
||||
// }
|
||||
// dict.put("label",l.getText());
|
||||
// dictlist.add(dict);
|
||||
// }
|
||||
// return dictlist;
|
||||
// }
|
||||
// @RequestMapping(value = "/getDictItemsByTable/{table}/{key}/{value}", method = RequestMethod.GET)
|
||||
// public Object getDictItemsByTable(@PathVariable String table,@PathVariable String key,@PathVariable String value) {
|
||||
// return this.ngAlainService.getDictByTable(table,key,value);
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -6,10 +6,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.ImportExcelUtil;
|
||||
import org.jeecg.modules.quartz.entity.QuartzJob;
|
||||
import org.jeecg.modules.quartz.service.IQuartzJobService;
|
||||
@ -145,14 +147,14 @@ public class QuartzJobController {
|
||||
*/
|
||||
//@RequiresRoles("admin")
|
||||
@GetMapping(value = "/pause")
|
||||
@ApiOperation(value = "暂停定时任务")
|
||||
@ApiOperation(value = "停止定时任务")
|
||||
public Result<Object> pauseJob(@RequestParam(name = "id") String id) {
|
||||
QuartzJob job = quartzJobService.getById(id);
|
||||
if (job == null) {
|
||||
return Result.error("定时任务不存在!");
|
||||
}
|
||||
quartzJobService.pause(job);
|
||||
return Result.ok("暂停定时任务成功");
|
||||
return Result.ok("停止定时任务成功");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,7 +165,7 @@ public class QuartzJobController {
|
||||
*/
|
||||
//@RequiresRoles("admin")
|
||||
@GetMapping(value = "/resume")
|
||||
@ApiOperation(value = "恢复定时任务")
|
||||
@ApiOperation(value = "启动定时任务")
|
||||
public Result<Object> resumeJob(@RequestParam(name = "id") String id) {
|
||||
QuartzJob job = quartzJobService.getById(id);
|
||||
if (job == null) {
|
||||
@ -171,7 +173,7 @@ public class QuartzJobController {
|
||||
}
|
||||
quartzJobService.resumeJob(job);
|
||||
//scheduler.resumeJob(JobKey.jobKey(job.getJobClassName().trim()));
|
||||
return Result.ok("恢复定时任务成功");
|
||||
return Result.ok("启动定时任务成功");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -202,8 +204,12 @@ public class QuartzJobController {
|
||||
// 导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "定时任务列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, QuartzJob.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("定时任务列表数据", "导出人:Jeecg", "导出信息"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
//获取当前登录用户
|
||||
//update-begin---author:wangshuai ---date:20211227 for:[JTC-116]导出人写死了------------
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("定时任务列表数据", "导出人:"+user.getRealname(), "导出信息"));
|
||||
//update-end---author:wangshuai ---date:20211227 for:[JTC-116]导出人写死了------------
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ public class SampleJob implements Job {
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
log.info(" Job Execution key:"+jobExecutionContext.getJobDetail().getKey());
|
||||
log.info(String.format(" Jeecg-Boot 普通定时任务 SampleJob ! 时间:" + DateUtils.getTimestamp()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,6 +47,15 @@ public class DuplicateCheckController {
|
||||
//SQL注入校验(只限制非法串改数据库)
|
||||
final String[] sqlInjCheck = {duplicateCheckVo.getTableName(),duplicateCheckVo.getFieldName()};
|
||||
SqlInjectionUtil.filterContent(sqlInjCheck);
|
||||
// update-begin-author:taoyan date:20211227 for: JTC-25 【online报表】oracle 操作问题 录入弹框啥都不填直接保存 ①编码不是应该提示必填么?②报错也应该是具体文字提示,不是后台错误日志
|
||||
if(StringUtils.isEmpty(duplicateCheckVo.getFieldVal())){
|
||||
Result rs = new Result();
|
||||
rs.setCode(500);
|
||||
rs.setSuccess(true);
|
||||
rs.setMessage("数据为空,不作处理!");
|
||||
return rs;
|
||||
}
|
||||
// update-end-author:taoyan date:20211227 for: JTC-25 【online报表】oracle 操作问题 录入弹框啥都不填直接保存 ①编码不是应该提示必填么?②报错也应该是具体文字提示,不是后台错误日志
|
||||
if (StringUtils.isNotBlank(duplicateCheckVo.getDataId())) {
|
||||
// [2].编辑页面校验
|
||||
num = sysDictMapper.duplicateCheckCountSql(duplicateCheckVo);
|
||||
|
||||
@ -4,6 +4,7 @@ import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyuncs.exceptions.ClientException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -58,8 +59,6 @@ public class LoginController {
|
||||
@Resource
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
private static final String BASE_CHECK_CODES = "qwertyuiplkjhgfdsazxcvbnmQWERTYUPLKJHGFDSAZXCVBNM1234567890";
|
||||
|
||||
@ApiOperation("登录接口")
|
||||
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
||||
public Result<JSONObject> login(@RequestBody SysLoginModel sysLoginModel){
|
||||
@ -82,6 +81,7 @@ public class LoginController {
|
||||
Object checkCode = redisUtil.get(realKey);
|
||||
//当进入登录页时,有一定几率出现验证码错误 #1714
|
||||
if(checkCode==null || !checkCode.toString().equals(lowerCaseCaptcha)) {
|
||||
log.warn("验证码错误,key= {} , Ui checkCode= {}, Redis checkCode = {}", sysLoginModel.getCheckKey(), lowerCaseCaptcha, checkCode);
|
||||
result.error500("验证码错误");
|
||||
return result;
|
||||
}
|
||||
@ -402,7 +402,10 @@ public class LoginController {
|
||||
// update-begin--Author:sunjianlei Date:20210802 for:获取用户租户信息
|
||||
String tenantIds = sysUser.getRelTenantIds();
|
||||
if (oConvertUtils.isNotEmpty(tenantIds)) {
|
||||
List<String> tenantIdList = Arrays.asList(tenantIds.split(","));
|
||||
List<Integer> tenantIdList = new ArrayList<>();
|
||||
for(String id: tenantIds.split(",")){
|
||||
tenantIdList.add(Integer.valueOf(id));
|
||||
}
|
||||
// 该方法仅查询有效的租户,如果返回0个就说明所有的租户均无效。
|
||||
List<SysTenant> tenantList = sysTenantService.queryEffectiveTenant(tenantIdList);
|
||||
if (tenantList.size() == 0) {
|
||||
@ -450,10 +453,17 @@ public class LoginController {
|
||||
public Result<String> randomImage(HttpServletResponse response,@PathVariable String key){
|
||||
Result<String> res = new Result<String>();
|
||||
try {
|
||||
//生成验证码
|
||||
final String BASE_CHECK_CODES = "qwertyuiplkjhgfdsazxcvbnmQWERTYUPLKJHGFDSAZXCVBNM1234567890";
|
||||
String code = RandomUtil.randomString(BASE_CHECK_CODES,4);
|
||||
|
||||
//存到redis中
|
||||
String lowerCaseCode = code.toLowerCase();
|
||||
String realKey = MD5Util.MD5Encode(lowerCaseCode+key, "utf-8");
|
||||
log.info("获取验证码,Redis checkCode = {},key = {}", code, key);
|
||||
redisUtil.set(realKey, lowerCaseCode, 60);
|
||||
|
||||
//返回前端
|
||||
String base64 = RandImageUtil.generate(code);
|
||||
res.setSuccess(true);
|
||||
res.setResult(base64);
|
||||
@ -495,13 +505,16 @@ public class LoginController {
|
||||
if(oConvertUtils.isEmpty(orgCode)) {
|
||||
//如果当前用户无选择部门 查看部门关联信息
|
||||
List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
|
||||
//update-begin-author:taoyan date:20220117 for: JTC-1068【app】新建用户,没有设置部门及角色,点击登录提示暂未归属部,一直在登录页面 使用手机号登录 可正常
|
||||
if (departs == null || departs.size() == 0) {
|
||||
result.error500("用户暂未归属部门,不可登录!");
|
||||
return result;
|
||||
/*result.error500("用户暂未归属部门,不可登录!");
|
||||
return result;*/
|
||||
}else{
|
||||
orgCode = departs.get(0).getOrgCode();
|
||||
sysUser.setOrgCode(orgCode);
|
||||
this.sysUserService.updateUserDepart(username, orgCode);
|
||||
}
|
||||
orgCode = departs.get(0).getOrgCode();
|
||||
sysUser.setOrgCode(orgCode);
|
||||
this.sysUserService.updateUserDepart(username, orgCode);
|
||||
//update-end-author:taoyan date:20220117 for: JTC-1068【app】新建用户,没有设置部门及角色,点击登录提示暂未归属部,一直在登录页面 使用手机号登录 可正常
|
||||
}
|
||||
JSONObject obj = new JSONObject();
|
||||
//用户登录信息
|
||||
@ -542,5 +555,58 @@ public class LoginController {
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* 登录二维码
|
||||
*/
|
||||
@ApiOperation(value = "登录二维码", notes = "登录二维码")
|
||||
@GetMapping("/getLoginQrcode")
|
||||
public Result<?> getLoginQrcode() {
|
||||
String qrcodeId = CommonConstant.LOGIN_QRCODE_PRE+IdWorker.getIdStr();
|
||||
//定义二维码参数
|
||||
Map params = new HashMap(5);
|
||||
params.put("qrcodeId", qrcodeId);
|
||||
//存放二维码唯一标识30秒有效
|
||||
redisUtil.set(CommonConstant.LOGIN_QRCODE + qrcodeId, qrcodeId, 30);
|
||||
return Result.OK(params);
|
||||
}
|
||||
/**
|
||||
* 扫码二维码
|
||||
*/
|
||||
@ApiOperation(value = "扫码登录二维码", notes = "扫码登录二维码")
|
||||
@PostMapping("/scanLoginQrcode")
|
||||
public Result<?> scanLoginQrcode(@RequestParam String qrcodeId, @RequestParam String token) {
|
||||
Object check = redisUtil.get(CommonConstant.LOGIN_QRCODE + qrcodeId);
|
||||
if (oConvertUtils.isNotEmpty(check)) {
|
||||
//存放token给前台读取
|
||||
redisUtil.set(CommonConstant.LOGIN_QRCODE_TOKEN+qrcodeId, token, 60);
|
||||
} else {
|
||||
return Result.error("二维码已过期,请刷新后重试");
|
||||
}
|
||||
return Result.OK("扫码成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户扫码后保存的token
|
||||
*/
|
||||
@ApiOperation(value = "获取用户扫码后保存的token", notes = "获取用户扫码后保存的token")
|
||||
@GetMapping("/getQrcodeToken")
|
||||
public Result getQrcodeToken(@RequestParam String qrcodeId) {
|
||||
Object token = redisUtil.get(CommonConstant.LOGIN_QRCODE_TOKEN + qrcodeId);
|
||||
Map result = new HashMap();
|
||||
Object qrcodeIdExpire = redisUtil.get(CommonConstant.LOGIN_QRCODE + qrcodeId);
|
||||
if (oConvertUtils.isEmpty(qrcodeIdExpire)) {
|
||||
//二维码过期通知前台刷新
|
||||
result.put("token", "-2");
|
||||
return Result.OK(result);
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(token)) {
|
||||
result.put("success", true);
|
||||
result.put("token", token);
|
||||
} else {
|
||||
result.put("token", "-1");
|
||||
}
|
||||
return Result.OK(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* vue3前端临时接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/")
|
||||
@Slf4j
|
||||
public class MockVue3Controller {
|
||||
|
||||
|
||||
}
|
||||
@ -14,6 +14,7 @@ import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.CommonSendStatus;
|
||||
import org.jeecg.common.constant.WebsocketConst;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
@ -93,18 +94,21 @@ public class SysAnnouncementController {
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<SysAnnouncement>> result = new Result<IPage<SysAnnouncement>>();
|
||||
sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
QueryWrapper<SysAnnouncement> queryWrapper = new QueryWrapper<SysAnnouncement>(sysAnnouncement);
|
||||
QueryWrapper<SysAnnouncement> queryWrapper = QueryGenerator.initQueryWrapper(sysAnnouncement, req.getParameterMap());
|
||||
Page<SysAnnouncement> page = new Page<SysAnnouncement>(pageNo,pageSize);
|
||||
|
||||
//update-begin-author:lvdandan date:20211229 for: sqlserver mssql-jdbc 8.2.2.jre8版本下系统公告列表查询报错 查询SQL中生成了两个create_time DESC;故注释此段代码
|
||||
//排序逻辑 处理
|
||||
String column = req.getParameter("column");
|
||||
String order = req.getParameter("order");
|
||||
if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
if("asc".equals(order)) {
|
||||
queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
}else {
|
||||
queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
}
|
||||
}
|
||||
// String column = req.getParameter("column");
|
||||
// String order = req.getParameter("order");
|
||||
// if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
// if("asc".equals(order)) {
|
||||
// queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
// }else {
|
||||
// queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
// }
|
||||
// }
|
||||
//update-end-author:lvdandan date:20211229 for: sqlserver mssql-jdbc 8.2.2.jre8版本下系统公告列表查询报错 查询SQL中生成了两个create_time DESC;故注释此段代码
|
||||
IPage<SysAnnouncement> pageList = sysAnnouncementService.page(page, queryWrapper);
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
@ -337,11 +341,13 @@ public class SysAnnouncementController {
|
||||
query.eq(SysAnnouncementSend::getUserId,userId);
|
||||
SysAnnouncementSend one = sysAnnouncementSendService.getOne(query);
|
||||
if(null==one){
|
||||
SysAnnouncementSend announcementSend = new SysAnnouncementSend();
|
||||
announcementSend.setAnntId(announcements.get(i).getId());
|
||||
announcementSend.setUserId(userId);
|
||||
announcementSend.setReadFlag(CommonConstant.NO_READ_FLAG);
|
||||
sysAnnouncementSendService.save(announcementSend);
|
||||
log.info("listByUser接口新增了SysAnnouncementSend:pageSize{}:"+pageSize);
|
||||
SysAnnouncementSend announcementSend = new SysAnnouncementSend();
|
||||
announcementSend.setAnntId(announcements.get(i).getId());
|
||||
announcementSend.setUserId(userId);
|
||||
announcementSend.setReadFlag(CommonConstant.NO_READ_FLAG);
|
||||
sysAnnouncementSendService.save(announcementSend);
|
||||
log.info("announcementSend.toString()",announcementSend.toString());
|
||||
}
|
||||
//update-end--Author:wangshuai Date:20200803 for: 通知公告消息重复LOWCOD-759------------
|
||||
}
|
||||
@ -373,7 +379,7 @@ public class SysAnnouncementController {
|
||||
LambdaQueryWrapper<SysAnnouncement> queryWrapper = new LambdaQueryWrapper<SysAnnouncement>(sysAnnouncement);
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
queryWrapper.eq(SysAnnouncement::getDelFlag,CommonConstant.DEL_FLAG_0);
|
||||
queryWrapper.eq(SysAnnouncement::getDelFlag,CommonConstant.DEL_FLAG_0.toString());
|
||||
List<SysAnnouncement> pageList = sysAnnouncementService.list(queryWrapper);
|
||||
//导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "系统通告列表");
|
||||
|
||||
@ -10,6 +10,7 @@ import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.WebsocketConst;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.SqlInjectionUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.message.websocket.WebSocket;
|
||||
import org.jeecg.modules.system.entity.SysAnnouncementSend;
|
||||
@ -69,6 +70,11 @@ public class SysAnnouncementSendController {
|
||||
//排序逻辑 处理
|
||||
String column = req.getParameter("column");
|
||||
String order = req.getParameter("order");
|
||||
|
||||
//issues/3331 SQL injection vulnerability
|
||||
SqlInjectionUtil.filterContent(column);
|
||||
SqlInjectionUtil.filterContent(order);
|
||||
|
||||
if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
if("asc".equals(order)) {
|
||||
queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
|
||||
@ -9,9 +9,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.ImportExcelUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysCategory;
|
||||
import org.jeecg.modules.system.model.TreeSelectModel;
|
||||
@ -65,10 +67,16 @@ public class SysCategoryController {
|
||||
Result<IPage<SysCategory>> result = new Result<IPage<SysCategory>>();
|
||||
|
||||
//--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------start
|
||||
//QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, req.getParameterMap());
|
||||
QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<SysCategory>();
|
||||
queryWrapper.eq("pid", sysCategory.getPid());
|
||||
//--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------end
|
||||
//--author:liusq---date:20211119 -----for: 【vue3】分类字典页面查询条件配置--------start
|
||||
QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, req.getParameterMap());
|
||||
String name = sysCategory.getName();
|
||||
String code = sysCategory.getCode();
|
||||
//QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<SysCategory>();
|
||||
if(StringUtils.isBlank(name)&&StringUtils.isBlank(code)){
|
||||
queryWrapper.eq("pid", sysCategory.getPid());
|
||||
}
|
||||
//--author:liusq---date:20211119 -----for: 分类字典页面查询条件配置--------end
|
||||
//--author:os_chengtgen---date:20190804 -----for:【vue3】 分类字典页面显示错误,issues:377--------end
|
||||
|
||||
Page<SysCategory> page = new Page<SysCategory>(pageNo, pageSize);
|
||||
IPage<SysCategory> pageList = sysCategoryService.page(page, queryWrapper);
|
||||
@ -215,10 +223,13 @@ public class SysCategoryController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) throws IOException{
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 错误信息
|
||||
List<String> errorMessage = new ArrayList<>();
|
||||
int successLines = 0, errorLines = 0;
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
MultipartFile file = entity.getValue();// 获取上传文件对象
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
@ -229,7 +240,8 @@ public class SysCategoryController {
|
||||
//按照编码长度排序
|
||||
Collections.sort(listSysCategorys);
|
||||
log.info("排序后的list====>",listSysCategorys);
|
||||
for (SysCategory sysCategoryExcel : listSysCategorys) {
|
||||
for (int i = 0; i < listSysCategorys.size(); i++) {
|
||||
SysCategory sysCategoryExcel = listSysCategorys.get(i);
|
||||
String code = sysCategoryExcel.getCode();
|
||||
if(code.length()>3){
|
||||
String pCode = sysCategoryExcel.getCode().substring(0,code.length()-3);
|
||||
@ -242,12 +254,25 @@ public class SysCategoryController {
|
||||
}else{
|
||||
sysCategoryExcel.setPid("0");
|
||||
}
|
||||
sysCategoryService.save(sysCategoryExcel);
|
||||
try {
|
||||
sysCategoryService.save(sysCategoryExcel);
|
||||
successLines++;
|
||||
} catch (Exception e) {
|
||||
errorLines++;
|
||||
String message = e.getMessage().toLowerCase();
|
||||
int lineNumber = i + 1;
|
||||
// 通过索引名判断出错信息
|
||||
if (message.contains(CommonConstant.SQL_INDEX_UNIQ_CATEGORY_CODE)) {
|
||||
errorMessage.add("第 " + lineNumber + " 行:分类编码已经存在,忽略导入。");
|
||||
} else {
|
||||
errorMessage.add("第 " + lineNumber + " 行:未知错误,忽略导入");
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.ok("文件导入成功!数据行数:" + listSysCategorys.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("文件导入失败:"+e.getMessage());
|
||||
errorMessage.add("发生异常:" + e.getMessage());
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
@ -256,7 +281,7 @@ public class SysCategoryController {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
return ImportExcelUtil.imporReturnRes(errorLines,successLines,errorMessage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ public class SysCheckRuleController extends JeecgController<SysCheckRule, ISysCh
|
||||
*/
|
||||
@AutoLog(value = "编码校验规则-编辑")
|
||||
@ApiOperation(value = "编码校验规则-编辑", notes = "编码校验规则-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result edit(@RequestBody SysCheckRule sysCheckRule) {
|
||||
sysCheckRuleService.updateById(sysCheckRule);
|
||||
return Result.ok("编辑成功!");
|
||||
|
||||
@ -14,6 +14,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
@ -57,6 +58,7 @@ public class SysDataSourceController extends JeecgController<SysDataSource, ISys
|
||||
*/
|
||||
@AutoLog(value = "多数据源管理-分页列表查询")
|
||||
@ApiOperation(value = "多数据源管理-分页列表查询", notes = "多数据源管理-分页列表查询")
|
||||
//@RequiresRoles("admin")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<?> queryPageList(
|
||||
SysDataSource sysDataSource,
|
||||
|
||||
@ -198,7 +198,7 @@ public class SysDepartController {
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<SysDepart> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
@ -322,7 +322,7 @@ public class SysDepartController {
|
||||
if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals( CommonConstant.USER_IDENTITY_2 )){
|
||||
departIds = user.getDepartIds();
|
||||
}
|
||||
List<SysDepartTreeModel> treeList = this.sysDepartService.searhBy(keyWord,myDeptSearch,departIds);
|
||||
List<SysDepartTreeModel> treeList = this.sysDepartService.searchByKeyWord(keyWord,myDeptSearch,departIds);
|
||||
if (treeList == null || treeList.size() == 0) {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("未查询匹配数据!");
|
||||
@ -363,6 +363,8 @@ public class SysDepartController {
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
* 部门导入方案1: 通过机构编码来计算出部门的父级ID,维护上下级关系;
|
||||
* 部门导入方案2: 你也可以改造下程序,机构编码直接导入,先不设置父ID;全部导入后,写一个sql,补下父ID;
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
@ -418,6 +420,11 @@ public class SysDepartController {
|
||||
sysDepart.setOrgType(sysDepart.getOrgCode().length()/codeLength+"");
|
||||
//update-end---author:liusq Date:20210223 for:批量导入部门以后,不能追加下一级部门 #2245------------
|
||||
sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
//update-begin---author:wangshuai ---date:20220105 for:[JTC-363]部门导入 机构类别没有时导入失败,赋默认值------------
|
||||
if(oConvertUtils.isEmpty(sysDepart.getOrgCategory())){
|
||||
sysDepart.setOrgCategory("1");
|
||||
}
|
||||
//update-end---author:wangshuai ---date:20220105 for:[JTC-363]部门导入 机构类别没有时导入失败,赋默认值------------
|
||||
ImportExcelUtil.importDateSaveOne(sysDepart, ISysDepartService.class, errorMessageList, num, CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE);
|
||||
num++;
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ public class SysDepartPermissionController extends JeecgController<SysDepartPerm
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="部门权限表-编辑", notes="部门权限表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<?> edit(@RequestBody SysDepartPermission sysDepartPermission) {
|
||||
sysDepartPermissionService.updateById(sysDepartPermission);
|
||||
return Result.ok("编辑成功!");
|
||||
|
||||
@ -114,7 +114,7 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@ApiOperation(value="部门角色-编辑", notes="部门角色-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<?> edit(@RequestBody SysDepartRole sysDepartRole) {
|
||||
sysDepartRoleService.updateById(sysDepartRole);
|
||||
return Result.ok("编辑成功!");
|
||||
|
||||
@ -496,7 +496,7 @@ public class SysDictController {
|
||||
try {
|
||||
//导入Excel格式校验,看匹配的字段文本概率
|
||||
Boolean t = ExcelImportCheckUtil.check(file.getInputStream(), SysDictPage.class, params);
|
||||
if(!t){
|
||||
if(t!=null && !t){
|
||||
throw new RuntimeException("导入Excel校验失败 !");
|
||||
}
|
||||
List<SysDictPage> list = ExcelImportUtil.importExcel(file.getInputStream(), SysDictPage.class, params);
|
||||
@ -511,11 +511,22 @@ public class SysDictController {
|
||||
Integer integer = sysDictService.saveMain(po, list.get(i).getSysDictItemList());
|
||||
if(integer>0){
|
||||
successLines++;
|
||||
}else{
|
||||
//update-begin---author:wangshuai ---date:20220211 for:[JTC-1168]如果字典项值为空,则字典项忽略导入------------
|
||||
}else if(integer == -1){
|
||||
errorLines++;
|
||||
errorMessage.add("字典名称:" + po.getDictName() + ",对应字典列表的字典项值不能为空,忽略导入。");
|
||||
}else{
|
||||
//update-end---author:wangshuai ---date:20220211 for:[JTC-1168]如果字典项值为空,则字典项忽略导入------------
|
||||
errorLines++;
|
||||
int lineNumber = i + 1;
|
||||
errorMessage.add("第 " + lineNumber + " 行:字典编码已经存在,忽略导入。");
|
||||
}
|
||||
//update-begin---author:wangshuai ---date:20220209 for:[JTC-1168]字典编号不能为空------------
|
||||
if(oConvertUtils.isEmpty(po.getDictCode())){
|
||||
errorMessage.add("第 " + lineNumber + " 行:字典编码不能为空,忽略导入。");
|
||||
}else{
|
||||
errorMessage.add("第 " + lineNumber + " 行:字典编码已经存在,忽略导入。");
|
||||
}
|
||||
//update-end---author:wangshuai ---date:20220209 for:[JTC-1168]字典编号不能为空------------
|
||||
}
|
||||
} catch (Exception e) {
|
||||
errorLines++;
|
||||
int lineNumber = i + 1;
|
||||
|
||||
@ -93,7 +93,7 @@ public class SysFillRuleController extends JeecgController<SysFillRule, ISysFill
|
||||
*/
|
||||
@AutoLog(value = "填值规则-编辑")
|
||||
@ApiOperation(value = "填值规则-编辑", notes = "填值规则-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<?> edit(@RequestBody SysFillRule sysFillRule) {
|
||||
sysFillRuleService.updateById(sysFillRule);
|
||||
return Result.ok("编辑成功!");
|
||||
|
||||
@ -59,7 +59,7 @@ public class SysPermissionController {
|
||||
|
||||
/**
|
||||
* 加载数据节点
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ -200,7 +200,7 @@ public class SysPermissionController {
|
||||
|
||||
/**
|
||||
* 查询用户拥有的菜单权限和按钮权限
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/getUserPermissionByToken", method = RequestMethod.GET)
|
||||
@ -261,32 +261,49 @@ public class SysPermissionController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 【vue3专用】查询用户拥有的按钮/表单访问权限
|
||||
* @return
|
||||
* 【vue3专用】获取
|
||||
* 1、查询用户拥有的按钮/表单访问权限
|
||||
* 2、所有权限 (菜单权限配置)
|
||||
* 3、系统安全模式 (开启则online报表的数据源必填)
|
||||
*/
|
||||
@RequestMapping(value = "/getPermCode", method = RequestMethod.GET)
|
||||
public Result<?> getPermCode() {
|
||||
Result<List<String>> result = new Result<List<String>>();
|
||||
try {
|
||||
//直接获取当前用户
|
||||
// 直接获取当前用户
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//获取当前用户的权限集合
|
||||
if (oConvertUtils.isEmpty(loginUser)) {
|
||||
return Result.error("请登录系统!");
|
||||
}
|
||||
// 获取当前用户的权限集合
|
||||
List<SysPermission> metaList = sysPermissionService.queryByUser(loginUser.getUsername());
|
||||
// 按钮权限(用户拥有的权限集合)
|
||||
List<String> codeList = metaList.stream()
|
||||
.filter((permission) -> CommonConstant.MENU_TYPE_2.equals(permission.getMenuType()) && CommonConstant.STATUS_1.equals(permission.getStatus()))
|
||||
.collect(ArrayList::new, (list, permission) -> list.add(permission.getPerms()), ArrayList::addAll);
|
||||
//
|
||||
JSONArray authArray = new JSONArray();
|
||||
this.getAuthJsonArray(authArray, metaList);
|
||||
// 查询所有的权限
|
||||
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0);
|
||||
query.eq(SysPermission::getMenuType, CommonConstant.MENU_TYPE_2);
|
||||
List<SysPermission> allAuthList = sysPermissionService.list(query);
|
||||
JSONArray allAuthArray = new JSONArray();
|
||||
this.getAllAuthJsonArray(allAuthArray, allAuthList);
|
||||
JSONObject result = new JSONObject();
|
||||
// 所拥有的权限编码
|
||||
result.put("codeList", codeList);
|
||||
//按钮权限(用户拥有的权限集合)
|
||||
List<String> authList = metaList.stream()
|
||||
.filter((permission) -> permission.getMenuType().equals(CommonConstant.MENU_TYPE_2)
|
||||
&& CommonConstant.STATUS_1.equals(permission.getStatus())
|
||||
)
|
||||
.collect(() -> new ArrayList<String>(),
|
||||
(list, permission) -> list.add(permission.getPerms()),
|
||||
(list1, list2) -> list1.addAll(list2)
|
||||
);
|
||||
result.setResult(authList);
|
||||
result.put("auth", authArray);
|
||||
//全部权限配置集合(按钮权限,访问权限)
|
||||
result.put("allAuth", allAuthArray);
|
||||
// 系统安全模式
|
||||
result.put("sysSafeMode", jeeccgBaseConfig.getSafeMode());
|
||||
return Result.OK(result);
|
||||
} catch (Exception e) {
|
||||
result.error500("查询失败:" + e.getMessage());
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("查询失败:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -374,7 +391,7 @@ public class SysPermissionController {
|
||||
|
||||
/**
|
||||
* 获取全部的权限树
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryTreeList", method = RequestMethod.GET)
|
||||
@ -720,7 +737,7 @@ public class SysPermissionController {
|
||||
/**
|
||||
* 判断是否外网URL 例如: http://localhost:8080/jeecg-boot/swagger-ui.html#/ 支持特殊格式: {{
|
||||
* window._CONFIG['domianURL'] }}/druid/ {{ JS代码片段 }},前台解析会自动执行JS代码片段
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isWWWHttpUrl(String url) {
|
||||
@ -733,7 +750,7 @@ public class SysPermissionController {
|
||||
/**
|
||||
* 通过URL生成路由name(去掉URL前缀斜杠,替换内容中的斜杠‘/’为-) 举例: URL = /isystem/role RouteName =
|
||||
* isystem-role
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String urlToRouteName(String url) {
|
||||
@ -753,7 +770,7 @@ public class SysPermissionController {
|
||||
|
||||
/**
|
||||
* 根据菜单id来获取其对应的权限数据
|
||||
*
|
||||
*
|
||||
* @param sysPermissionDataRule
|
||||
* @return
|
||||
*/
|
||||
@ -768,7 +785,7 @@ public class SysPermissionController {
|
||||
|
||||
/**
|
||||
* 添加菜单权限数据
|
||||
*
|
||||
*
|
||||
* @param sysPermissionDataRule
|
||||
* @return
|
||||
*/
|
||||
@ -803,7 +820,7 @@ public class SysPermissionController {
|
||||
|
||||
/**
|
||||
* 删除菜单权限数据
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ -823,7 +840,7 @@ public class SysPermissionController {
|
||||
|
||||
/**
|
||||
* 查询菜单权限数据
|
||||
*
|
||||
*
|
||||
* @param sysPermissionDataRule
|
||||
* @return
|
||||
*/
|
||||
|
||||
@ -8,10 +8,12 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.ImportExcelUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.quartz.service.IQuartzJobService;
|
||||
@ -208,10 +210,11 @@ public class SysPositionController {
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
List<SysPosition> pageList = sysPositionService.list(queryWrapper);
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "职务表列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, SysPosition.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("职务表列表数据", "导出人:Jeecg", "导出信息"));
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("职务表列表数据", "导出人:"+user.getRealname(),"导出信息"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.PermissionData;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysTenant;
|
||||
import org.jeecg.modules.system.service.ISysTenantService;
|
||||
@ -16,9 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 租户配置信息
|
||||
@ -132,11 +132,11 @@ public class SysTenantController {
|
||||
}else {
|
||||
String[] ls = ids.split(",");
|
||||
// 过滤掉已被引用的租户
|
||||
List<String> idList = new ArrayList<>();
|
||||
List<Integer> idList = new ArrayList<>();
|
||||
for (String id : ls) {
|
||||
int userCount = sysTenantService.countUserLinkTenant(id);
|
||||
if (userCount == 0) {
|
||||
idList.add(id);
|
||||
idList.add(Integer.parseInt(id));
|
||||
}
|
||||
}
|
||||
if (idList.size() > 0) {
|
||||
@ -190,4 +190,32 @@ public class SysTenantController {
|
||||
result.setResult(ls);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 查询当前用户的所有有效租户 【当前用于vue3版本】
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/getCurrentUserTenant", method = RequestMethod.GET)
|
||||
public Result<Map<String,Object>> getCurrentUserTenant() {
|
||||
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
|
||||
try {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String tenantIds = sysUser.getRelTenantIds();
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
if (oConvertUtils.isNotEmpty(tenantIds)) {
|
||||
List<Integer> tenantIdList = new ArrayList<>();
|
||||
for(String id: tenantIds.split(",")){
|
||||
tenantIdList.add(Integer.valueOf(id));
|
||||
}
|
||||
// 该方法仅查询有效的租户,如果返回0个就说明所有的租户均无效。
|
||||
List<SysTenant> tenantList = sysTenantService.queryEffectiveTenant(tenantIdList);
|
||||
map.put("list", tenantList);
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
}catch(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("查询失败!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,12 +108,38 @@ public class SysUserController {
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysUser>> result = new Result<IPage<SysUser>>();
|
||||
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
|
||||
//TODO 外部模拟登陆临时账号,列表不显示
|
||||
|
||||
//update-begin-Author:wangshuai--Date:20211119--for:【vue3】通过部门id查询用户,通过code查询id
|
||||
//部门ID
|
||||
String departId = req.getParameter("departId");
|
||||
if(oConvertUtils.isNotEmpty(departId)){
|
||||
LambdaQueryWrapper<SysUserDepart> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysUserDepart::getDepId,departId);
|
||||
List<SysUserDepart> list = sysUserDepartService.list(query);
|
||||
List<String> userIds = list.stream().map(SysUserDepart::getUserId).collect(Collectors.toList());
|
||||
queryWrapper.in("id",userIds);
|
||||
}
|
||||
//用户ID
|
||||
String code = req.getParameter("code");
|
||||
if(oConvertUtils.isNotEmpty(code)){
|
||||
queryWrapper.in("id",Arrays.asList(code.split(",")));
|
||||
pageSize = code.split(",").length;
|
||||
}
|
||||
//update-end-Author:wangshuai--Date:20211119--for:【vue3】通过部门id查询用户,通过code查询id
|
||||
|
||||
//update-begin-author:taoyan--date:20220104--for: JTC-372 【用户冻结问题】 online授权、用户组件,选择用户都能看到被冻结的用户
|
||||
String status = req.getParameter("status");
|
||||
if(oConvertUtils.isNotEmpty(status)){
|
||||
queryWrapper.eq("status", Integer.parseInt(status));
|
||||
}
|
||||
//update-end-author:taoyan--date:20220104--for: JTC-372 【用户冻结问题】 online授权、用户组件,选择用户都能看到被冻结的用户
|
||||
|
||||
//TODO 外部模拟登陆临时账号,列表不显示
|
||||
queryWrapper.ne("username","_reserve_user_external");
|
||||
Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
|
||||
IPage<SysUser> pageList = sysUserService.page(page, queryWrapper);
|
||||
|
||||
//批量查询用户的所属部门
|
||||
//批量查询用户的所属部门
|
||||
//step.1 先拿到全部的 useids
|
||||
//step.2 通过 useids,一次性查询用户的所属部门名字
|
||||
List<String> userIds = pageList.getRecords().stream().map(SysUser::getId).collect(Collectors.toList());
|
||||
@ -492,6 +518,8 @@ public class SysUserController {
|
||||
errorMessage.add("第 " + lineNumber + " 行:手机号已经存在,忽略导入。");
|
||||
} else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_USER_EMAIL)) {
|
||||
errorMessage.add("第 " + lineNumber + " 行:电子邮件已经存在,忽略导入。");
|
||||
} else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_USER)) {
|
||||
errorMessage.add("第 " + lineNumber + " 行:违反表唯一性约束。");
|
||||
} else {
|
||||
errorMessage.add("第 " + lineNumber + " 行:未知错误,忽略导入");
|
||||
log.error(e.getMessage(), e);
|
||||
@ -1187,7 +1215,7 @@ public class SysUserController {
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/appEdit", method = RequestMethod.PUT)
|
||||
@RequestMapping(value = "/appEdit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<SysUser> appEdit(HttpServletRequest request,@RequestBody JSONObject jsonObject) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
try {
|
||||
@ -1305,7 +1333,9 @@ public class SysUserController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/appQueryUser")
|
||||
public Result<List<SysUser>> appQueryUser(@RequestParam(name = "keyword", required = false) String keyword) {
|
||||
public Result<List<SysUser>> appQueryUser(@RequestParam(name = "keyword", required = false) String keyword,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
Result<List<SysUser>> result = new Result<List<SysUser>>();
|
||||
LambdaQueryWrapper<SysUser> queryWrapper =new LambdaQueryWrapper<SysUser>();
|
||||
//TODO 外部模拟登陆临时账号,列表不显示
|
||||
@ -1313,18 +1343,19 @@ public class SysUserController {
|
||||
if(StringUtils.isNotBlank(keyword)){
|
||||
queryWrapper.and(i -> i.like(SysUser::getUsername, keyword).or().like(SysUser::getRealname, keyword));
|
||||
}
|
||||
List<SysUser> list = sysUserService.list(queryWrapper);
|
||||
Page<SysUser> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysUser> pageList = this.sysUserService.page(page, queryWrapper);
|
||||
//批量查询用户的所属部门
|
||||
//step.1 先拿到全部的 useids
|
||||
//step.2 通过 useids,一次性查询用户的所属部门名字
|
||||
List<String> userIds = list.stream().map(SysUser::getId).collect(Collectors.toList());
|
||||
List<String> userIds = pageList.getRecords().stream().map(SysUser::getId).collect(Collectors.toList());
|
||||
if(userIds!=null && userIds.size()>0){
|
||||
Map<String,String> useDepNames = sysUserService.getDepNamesByUserIds(userIds);
|
||||
list.forEach(item->{
|
||||
pageList.getRecords().forEach(item->{
|
||||
item.setOrgCodeTxt(useDepNames.get(item.getId()));
|
||||
});
|
||||
}
|
||||
result.setResult(list);
|
||||
result.setResult(pageList.getRecords());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1374,6 +1405,9 @@ public class SysUserController {
|
||||
@GetMapping("/getMultiUser")
|
||||
public List<SysUser> getMultiUser(SysUser sysUser){
|
||||
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(sysUser, null);
|
||||
//update-begin---author:wangshuai ---date:20220104 for:[JTC-297]已冻结用户仍可设置为代理人------------
|
||||
queryWrapper.eq("status",Integer.parseInt(CommonConstant.STATUS_1));
|
||||
//update-end---author:wangshuai ---date:20220104 for:[JTC-297]已冻结用户仍可设置为代理人------------
|
||||
List<SysUser> ls = this.sysUserService.list(queryWrapper);
|
||||
for(SysUser user: ls){
|
||||
user.setPassword(null);
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
@ -21,9 +20,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 在线用户
|
||||
@ -63,8 +64,20 @@ public class SysUserOnlineController {
|
||||
online.setToken(token);
|
||||
//TODO 改成一次性查询
|
||||
LoginUser loginUser = sysBaseAPI.getUserByName(JwtUtil.getUsername(token));
|
||||
BeanUtils.copyProperties(loginUser, online);
|
||||
onlineList.add(online);
|
||||
if (loginUser != null) {
|
||||
//update-begin---author:wangshuai ---date:20220104 for:[JTC-382]在线用户查询无效------------
|
||||
//验证用户名是否与传过来的用户名相同
|
||||
boolean isMatchUsername=true;
|
||||
//判断用户名是否为空,并且当前循环的用户不包含传过来的用户名,那么就设成false
|
||||
if(oConvertUtils.isNotEmpty(username) && !loginUser.getUsername().contains(username)){
|
||||
isMatchUsername = false;
|
||||
}
|
||||
if(isMatchUsername){
|
||||
BeanUtils.copyProperties(loginUser, online);
|
||||
onlineList.add(online);
|
||||
}
|
||||
//update-end---author:wangshuai ---date:20220104 for:[JTC-382]在线用户查询无效------------
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.reverse(onlineList);
|
||||
|
||||
@ -91,8 +91,12 @@ public class ThirdAppController {
|
||||
@GetMapping("/sync/wechatEnterprise/depart/toApp")
|
||||
public Result syncWechatEnterpriseDepartToApp(@RequestParam(value = "ids", required = false) String ids) {
|
||||
if (thirdAppConfig.isWechatEnterpriseEnabled()) {
|
||||
boolean flag = wechatEnterpriseService.syncLocalDepartmentToThirdApp(ids);
|
||||
return flag ? Result.OK("同步成功", null) : Result.error("同步失败");
|
||||
SyncInfoVo syncInfo = wechatEnterpriseService.syncLocalDepartmentToThirdApp(ids);
|
||||
if (syncInfo.getFailInfo().size() == 0) {
|
||||
return Result.OK("同步成功", null);
|
||||
} else {
|
||||
return Result.error("同步失败", syncInfo);
|
||||
}
|
||||
}
|
||||
return Result.error("企业微信同步功能已禁用");
|
||||
}
|
||||
@ -125,8 +129,12 @@ public class ThirdAppController {
|
||||
@GetMapping("/sync/dingtalk/depart/toApp")
|
||||
public Result syncDingtalkDepartToApp(@RequestParam(value = "ids", required = false) String ids) {
|
||||
if (thirdAppConfig.isDingtalkEnabled()) {
|
||||
boolean flag = dingtalkService.syncLocalDepartmentToThirdApp(ids);
|
||||
return flag ? Result.OK("同步成功", null) : Result.error("同步失败");
|
||||
SyncInfoVo syncInfo = dingtalkService.syncLocalDepartmentToThirdApp(ids);
|
||||
if (syncInfo.getFailInfo().size() == 0) {
|
||||
return Result.OK("同步成功", null);
|
||||
} else {
|
||||
return Result.error("同步失败", syncInfo);
|
||||
}
|
||||
}
|
||||
return Result.error("钉钉同步功能已禁用");
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ public class SysDepart implements Serializable {
|
||||
/**描述*/
|
||||
@Excel(name="描述",width=15)
|
||||
private String description;
|
||||
/**机构类别 1公司,2组织机构,2岗位*/
|
||||
/**机构类别 1=公司,2=组织机构,3=岗位*/
|
||||
@Excel(name="机构类别",width=15,dicCode="org_category")
|
||||
private String orgCategory;
|
||||
/**机构类型*/
|
||||
|
||||
@ -54,7 +54,6 @@ public class SysPosition {
|
||||
/**
|
||||
* 公司id
|
||||
*/
|
||||
@Excel(name = "公司id", width = 15)
|
||||
@ApiModelProperty(value = "公司id")
|
||||
private java.lang.String companyId;
|
||||
/**
|
||||
@ -84,7 +83,6 @@ public class SysPosition {
|
||||
/**
|
||||
* 组织机构编码
|
||||
*/
|
||||
@Excel(name = "组织机构编码", width = 15)
|
||||
@ApiModelProperty(value = "组织机构编码")
|
||||
private java.lang.String sysOrgCode;
|
||||
}
|
||||
|
||||
@ -3,12 +3,14 @@ package org.jeecg.modules.system.entity;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: 第三方登录账号表
|
||||
@ -25,7 +27,7 @@ public class SysThirdAccount {
|
||||
|
||||
/**编号*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "编号")
|
||||
@ApiModelProperty(value = "编号")
|
||||
private java.lang.String id;
|
||||
/**第三方登录id*/
|
||||
@Excel(name = "第三方登录id", width = 15)
|
||||
@ -59,4 +61,20 @@ public class SysThirdAccount {
|
||||
@Excel(name = "第三方用户账号", width = 15)
|
||||
@ApiModelProperty(value = "第三方用户账号")
|
||||
private java.lang.String thirdUserId;
|
||||
/**创建人*/
|
||||
@Excel(name = "创建人", width = 15)
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/**修改人*/
|
||||
@Excel(name = "修改人", width = 15)
|
||||
private java.lang.String updateBy;
|
||||
/**修改日期*/
|
||||
@Excel(name = "修改日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
}
|
||||
|
||||
@ -193,4 +193,15 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
|
||||
*/
|
||||
@Deprecated
|
||||
List<DictModel> queryAllTableDictItems(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql);
|
||||
|
||||
/**
|
||||
* 查询字典表的数据
|
||||
* @param table 表名
|
||||
* @param text 显示字段名
|
||||
* @param code 存储字段名
|
||||
* @param filterSql 条件sql
|
||||
* @param codeValues 存储字段值 作为查询条件in
|
||||
* @return
|
||||
*/
|
||||
List<DictModel> queryTableDictByKeysAndFilterSql(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql, @Param("codeValues") List<String> codeValues);
|
||||
}
|
||||
|
||||
@ -134,19 +134,24 @@
|
||||
${pidField} as parentId
|
||||
from ${table}
|
||||
where
|
||||
<choose>
|
||||
<when test="pid != null and pid != ''">
|
||||
${pidField} = #{pid}
|
||||
</when>
|
||||
<otherwise>
|
||||
(${pidField} = '' OR ${pidField} IS NULL)
|
||||
</otherwise>
|
||||
</choose>
|
||||
<!-- udapte-begin-author:sunjianlei date:20220110 for: 【JTC-597】自定义树查询条件查不出数据 -->
|
||||
<if test="query == null">
|
||||
<choose>
|
||||
<when test="pid != null and pid != ''">
|
||||
${pidField} = #{pid}
|
||||
</when>
|
||||
<otherwise>
|
||||
(${pidField} = '' OR ${pidField} IS NULL)
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="query!= null">
|
||||
1 = 1
|
||||
<foreach collection="query.entrySet()" item="value" index="key" >
|
||||
and ${key} = #{value}
|
||||
and ${key} LIKE #{value}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- udapte-end-author:sunjianlei date:20220110 for: 【JTC-597】自定义树查询条件查不出数据 -->
|
||||
</select>
|
||||
|
||||
|
||||
@ -179,5 +184,18 @@
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 查询字典表的数据 支持设置过滤条件、设置存储值作为in查询条件 -->
|
||||
<select id="queryTableDictByKeysAndFilterSql" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel">
|
||||
select ${text} as "text", ${code} as "value" from ${table} where ${code} IN (
|
||||
<foreach item="key" collection="codeValues" separator=",">
|
||||
#{key}
|
||||
</foreach>
|
||||
)
|
||||
<if test="filterSql != null and filterSql != ''">
|
||||
and ${filterSql}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -14,7 +14,9 @@
|
||||
join sys_depart c on b.dep_id = c.id
|
||||
where a.del_flag = 0 and c.org_code like '${orgCode}%'
|
||||
<if test="realname!=null and realname!=''">
|
||||
and a.realname like '%${realname}%'
|
||||
<!-- update by sunjianlei 20220119【#3348】SQL injection exists in /sys/user/queryUserByDepId; -->
|
||||
<bind name="bindRealname" value="'%'+realname+'%'"/>
|
||||
and a.realname like #{bindRealname}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@ -23,12 +25,14 @@
|
||||
select a.*, c.depart_name as org_code_txt from sys_user a
|
||||
join sys_user_depart b on b.user_id = a.id
|
||||
join sys_depart c on b.dep_id = c.id
|
||||
where a.del_flag = 0 and c.org_code like '${orgCode}%'
|
||||
where a.del_flag = 0 and a.status = 1 and c.org_code like '${orgCode}%'
|
||||
<if test="username!=null and username!=''">
|
||||
and a.username like '%${username}%'
|
||||
<bind name="bindUsername" value="'%'+username+'%'"/>
|
||||
and a.username like #{bindUsername}
|
||||
</if>
|
||||
<if test="realname!=null and realname!=''">
|
||||
and a.realname like '%${realname}%'
|
||||
<bind name="bindRealname" value="'%'+realname+'%'"/>
|
||||
and a.realname like #{bindRealname}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@ -1,15 +1,12 @@
|
||||
package org.jeecg.modules.system.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 用户通告阅读标记表
|
||||
|
||||
@ -2,6 +2,7 @@ package org.jeecg.modules.system.rule;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.handler.IFillRuleHandler;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.YouBianCodeUtil;
|
||||
@ -16,12 +17,14 @@ import java.util.List;
|
||||
* @Date 2019/12/9 11:32
|
||||
* @Description: 分类字典编码生成规则
|
||||
*/
|
||||
@Slf4j
|
||||
public class CategoryCodeRule implements IFillRuleHandler {
|
||||
|
||||
public static final String ROOT_PID_VALUE = "0";
|
||||
|
||||
@Override
|
||||
public Object execute(JSONObject params, JSONObject formData) {
|
||||
log.info("系统自定义编码规则[category_code_rule],params:{} ,formData: {}", params, formData);
|
||||
|
||||
String categoryPid = ROOT_PID_VALUE;
|
||||
String categoryCode = null;
|
||||
|
||||
@ -67,7 +67,7 @@ public interface ISysDepartService extends IService<SysDepart>{
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
List<SysDepartTreeModel> searhBy(String keyWord,String myDeptSearch,String departIds);
|
||||
List<SysDepartTreeModel> searchByKeyWord(String keyWord,String myDeptSearch,String departIds);
|
||||
|
||||
/**
|
||||
* 根据部门id删除并删除其可能存在的子级部门
|
||||
|
||||
@ -14,7 +14,7 @@ public interface ISysTenantService extends IService<SysTenant> {
|
||||
* @param idList
|
||||
* @return
|
||||
*/
|
||||
List<SysTenant> queryEffectiveTenant(Collection<String> idList);
|
||||
List<SysTenant> queryEffectiveTenant(Collection<Integer> idList);
|
||||
|
||||
/**
|
||||
* 返回某个租户被多少个用户引用了
|
||||
|
||||
@ -21,7 +21,7 @@ public interface IThirdAppService {
|
||||
*
|
||||
* @return 成功返回true
|
||||
*/
|
||||
boolean syncLocalDepartmentToThirdApp(String ids);
|
||||
SyncInfoVo syncLocalDepartmentToThirdApp(String ids);
|
||||
|
||||
/**
|
||||
* 将第三方App部门同步到本地<br>
|
||||
|
||||
@ -146,7 +146,9 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
//通过自定义URL匹配规则 获取菜单(实现通过菜单配置数据权限规则,实际上针对获取数据接口进行数据规则控制)
|
||||
String userMatchUrl = UrlMatchEnum.getMatchResultByUrl(requestPath);
|
||||
LambdaQueryWrapper<SysPermission> queryQserMatch = new LambdaQueryWrapper<SysPermission>();
|
||||
queryQserMatch.eq(SysPermission::getMenuType, 1);
|
||||
// update-begin-author:taoyan date:20211027 for: online菜单如果配置成一级菜单 权限查询不到 取消menuType = 1
|
||||
//queryQserMatch.eq(SysPermission::getMenuType, 1);
|
||||
// update-end-author:taoyan date:20211027 for: online菜单如果配置成一级菜单 权限查询不到 取消menuType = 1
|
||||
queryQserMatch.eq(SysPermission::getDelFlag, 0);
|
||||
queryQserMatch.eq(SysPermission::getUrl, userMatchUrl);
|
||||
if(oConvertUtils.isNotEmpty(userMatchUrl)){
|
||||
|
||||
@ -69,7 +69,7 @@ public class SysDepartPermissionServiceImpl extends ServiceImpl<SysDepartPermiss
|
||||
@Override
|
||||
public List<SysPermissionDataRule> getPermRuleListByDeptIdAndPermId(String departId, String permissionId) {
|
||||
SysDepartPermission departPermission = this.getOne(new QueryWrapper<SysDepartPermission>().lambda().eq(SysDepartPermission::getDepartId, departId).eq(SysDepartPermission::getPermissionId, permissionId));
|
||||
if(departPermission != null){
|
||||
if(departPermission != null && oConvertUtils.isNotEmpty(departPermission.getDataRuleIds())){
|
||||
LambdaQueryWrapper<SysPermissionDataRule> query = new LambdaQueryWrapper<SysPermissionDataRule>();
|
||||
query.in(SysPermissionDataRule::getId, Arrays.asList(departPermission.getDataRuleIds().split(",")));
|
||||
query.orderByDesc(SysPermissionDataRule::getCreateTime);
|
||||
|
||||
@ -300,7 +300,7 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public List<SysDepartTreeModel> searhBy(String keyWord,String myDeptSearch,String departIds) {
|
||||
public List<SysDepartTreeModel> searchByKeyWord(String keyWord,String myDeptSearch,String departIds) {
|
||||
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
|
||||
List<SysDepartTreeModel> newList = new ArrayList<>();
|
||||
//myDeptSearch不为空时为我的部门搜索,只搜索所负责部门
|
||||
@ -311,9 +311,15 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
|
||||
}
|
||||
//根据部门id获取所负责部门
|
||||
String[] codeArr = this.getMyDeptParentOrgCode(departIds);
|
||||
for(int i=0;i<codeArr.length;i++){
|
||||
query.or().likeRight(SysDepart::getOrgCode,codeArr[i]);
|
||||
//update-begin-author:taoyan date:20220104 for:/issues/3311 当用户属于两个部门的时候,且这两个部门没有上下级关系,我的部门-部门名称查询条件模糊搜索失效!
|
||||
if (codeArr != null && codeArr.length > 0) {
|
||||
query.nested(i -> {
|
||||
for (String s : codeArr) {
|
||||
i.or().likeRight(SysDepart::getOrgCode, s);
|
||||
}
|
||||
});
|
||||
}
|
||||
//update-end-author:taoyan date:20220104 for:/issues/3311 当用户属于两个部门的时候,且这两个部门没有上下级关系,我的部门-部门名称查询条件模糊搜索失效!
|
||||
query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
|
||||
}
|
||||
query.like(SysDepart::getDepartName, keyWord);
|
||||
@ -499,7 +505,7 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
|
||||
}
|
||||
};
|
||||
LambdaQueryWrapper<SysDepart> lqw=new LambdaQueryWrapper();
|
||||
lqw.eq(true,SysDepart::getDelFlag,CommonConstant.DEL_FLAG_0);
|
||||
lqw.eq(true,SysDepart::getDelFlag,CommonConstant.DEL_FLAG_0.toString());
|
||||
lqw.func(square);
|
||||
lqw.orderByDesc(SysDepart::getDepartOrder);
|
||||
List<SysDepart> list = list(lqw);
|
||||
|
||||
@ -163,7 +163,15 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
|
||||
@Override
|
||||
public List<DictModel> queryTableDictTextByKeys(String table, String text, String code, List<String> keys) {
|
||||
return sysDictMapper.queryTableDictTextByKeys(table, text, code, keys);
|
||||
//update-begin-author:taoyan date:20220113 for: @dict注解支持 dicttable 设置where条件
|
||||
String filterSql = null;
|
||||
if(table.toLowerCase().indexOf("where")>0){
|
||||
String[] arr = table.split(" (?i)where ");
|
||||
table = arr[0];
|
||||
filterSql = arr[1];
|
||||
}
|
||||
return sysDictMapper.queryTableDictByKeysAndFilterSql(table, text, code, filterSql, keys);
|
||||
//update-end-author:taoyan date:20220113 for: @dict注解支持 dicttable 设置where条件
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -225,6 +233,11 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
insert = sysDictMapper.insert(sysDict);
|
||||
if (sysDictItemList != null) {
|
||||
for (SysDictItem entity : sysDictItemList) {
|
||||
//update-begin---author:wangshuai ---date:20220211 for:[JTC-1168]如果字典项值为空,则字典项忽略导入------------
|
||||
if(oConvertUtils.isEmpty(entity.getItemValue())){
|
||||
return -1;
|
||||
}
|
||||
//update-end---author:wangshuai ---date:20220211 for:[JTC-1168]如果字典项值为空,则字典项忽略导入------------
|
||||
entity.setDictId(sysDict.getId());
|
||||
entity.setStatus(1);
|
||||
sysDictItemMapper.insert(entity);
|
||||
@ -255,7 +268,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
public List<DictModel> queryLittleTableDictItems(String table, String text, String code, String condition, String keyword, int pageSize) {
|
||||
Page<DictModel> page = new Page<DictModel>(1, pageSize);
|
||||
page.setSearchCount(false);
|
||||
String filterSql = getFilterSql(text, code, condition, keyword);
|
||||
String filterSql = getFilterSql(table, text, code, condition, keyword);
|
||||
IPage<DictModel> pageList = baseMapper.queryTableDictWithFilter(page, table, text, code, filterSql);
|
||||
return pageList.getRecords();
|
||||
}
|
||||
@ -268,12 +281,19 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
private String getFilterSql(String text, String code, String condition, String keyword){
|
||||
private String getFilterSql(String table, String text, String code, String condition, String keyword){
|
||||
String keywordSql = null, filterSql = "", sql_where = " where ";
|
||||
// update-begin-author:sunjianlei date:20220112 for: 【JTC-631】判断如果 table 携带了 where 条件,那么就使用 and 查询,防止报错
|
||||
if (table.toLowerCase().contains(" where ")) {
|
||||
sql_where = " and ";
|
||||
}
|
||||
// update-end-author:sunjianlei date:20220112 for: 【JTC-631】判断如果 table 携带了 where 条件,那么就使用 and 查询,防止报错
|
||||
if(oConvertUtils.isNotEmpty(keyword)){
|
||||
// 判断是否是多选
|
||||
if (keyword.contains(",")) {
|
||||
String inKeywords = "\"" + keyword.replaceAll(",", "\",\"") + "\"";
|
||||
//update-begin--author:scott--date:20220105--for:JTC-529【表单设计器】 编辑页面报错,in参数采用双引号导致 ----
|
||||
String inKeywords = "'" + String.join("','", keyword.split(",")) + "'";
|
||||
//update-end--author:scott--date:20220105--for:JTC-529【表单设计器】 编辑页面报错,in参数采用双引号导致----
|
||||
keywordSql = "(" + text + " in (" + inKeywords + ") or " + code + " in (" + inKeywords + "))";
|
||||
} else {
|
||||
keywordSql = "("+text + " like '%"+keyword+"%' or "+ code + " like '%"+keyword+"%')";
|
||||
@ -290,14 +310,20 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
}
|
||||
@Override
|
||||
public List<DictModel> queryAllTableDictItems(String table, String text, String code, String condition, String keyword) {
|
||||
String filterSql = getFilterSql(text, code, condition, keyword);
|
||||
String filterSql = getFilterSql(table, text, code, condition, keyword);
|
||||
List<DictModel> ls = baseMapper.queryAllTableDictItems(table, text, code, filterSql);
|
||||
return ls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TreeSelectModel> queryTreeList(Map<String, String> query,String table, String text, String code, String pidField,String pid,String hasChildField) {
|
||||
return baseMapper.queryTreeList(query,table, text, code, pidField, pid,hasChildField);
|
||||
List<TreeSelectModel> result = baseMapper.queryTreeList(query, table, text, code, pidField, pid, hasChildField);
|
||||
// udapte-begin-author:sunjianlei date:20220110 for: 【JTC-597】如果 query 有值,就不允许展开子节点
|
||||
if (query != null) {
|
||||
result.forEach(r -> r.setLeaf(true));
|
||||
}
|
||||
return result;
|
||||
// udapte-end-author:sunjianlei date:20220110 for: 【JTC-597】如果 query 有值,就不允许展开子节点
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -24,10 +24,10 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
ISysUserService userService;
|
||||
|
||||
@Override
|
||||
public List<SysTenant> queryEffectiveTenant(Collection<String> idList) {
|
||||
public List<SysTenant> queryEffectiveTenant(Collection<Integer> idList) {
|
||||
LambdaQueryWrapper<SysTenant> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(SysTenant::getId, idList);
|
||||
queryWrapper.eq(SysTenant::getStatus, CommonConstant.STATUS_1);
|
||||
queryWrapper.eq(SysTenant::getStatus, Integer.valueOf(CommonConstant.STATUS_1));
|
||||
//此处查询忽略时间条件
|
||||
return super.list(queryWrapper);
|
||||
}
|
||||
@ -50,7 +50,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
if (userCount > 0) {
|
||||
throw new JeecgBootException("该租户已被引用,无法删除!");
|
||||
}
|
||||
return super.removeById(id);
|
||||
return super.removeById(Integer.parseInt(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.common.util.PasswordUtil;
|
||||
@ -30,6 +31,7 @@ import java.util.List;
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SysThirdAccountServiceImpl extends ServiceImpl<SysThirdAccountMapper, SysThirdAccount> implements ISysThirdAccountService {
|
||||
|
||||
@Autowired
|
||||
@ -116,6 +118,7 @@ public class SysThirdAccountServiceImpl extends ServiceImpl<SysThirdAccountMappe
|
||||
@Override
|
||||
public SysThirdAccount getOneBySysUserId(String sysUserId, String thirdType) {
|
||||
LambdaQueryWrapper<SysThirdAccount> queryWrapper = new LambdaQueryWrapper<>();
|
||||
log.info("getSysUserId: {} ,getThirdType: {}",sysUserId,thirdType);
|
||||
queryWrapper.eq(SysThirdAccount::getSysUserId, sysUserId);
|
||||
queryWrapper.eq(SysThirdAccount::getThirdType, thirdType);
|
||||
return super.getOne(queryWrapper);
|
||||
|
||||
@ -1,15 +1,10 @@
|
||||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
@ -22,8 +17,11 @@ import org.jeecg.modules.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <P>
|
||||
@ -128,6 +126,9 @@ public class SysUserDepartServiceImpl extends ServiceImpl<SysUserDepartMapper, S
|
||||
Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
|
||||
if(oConvertUtils.isEmpty(departId)){
|
||||
LambdaQueryWrapper<SysUser> query = new LambdaQueryWrapper<>();
|
||||
//update-begin---author:wangshuai ---date:20220104 for:[JTC-297]已冻结用户仍可设置为代理人------------
|
||||
query.eq(SysUser::getStatus,Integer.parseInt(CommonConstant.STATUS_1));
|
||||
//update-end---author:wangshuai ---date:20220104 for:[JTC-297]已冻结用户仍可设置为代理人------------
|
||||
if(oConvertUtils.isNotEmpty(username)){
|
||||
query.like(SysUser::getUsername, username);
|
||||
}
|
||||
|
||||
@ -399,6 +399,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value={CacheConstant.SYS_USERS_CACHE}, allEntries=true)
|
||||
public boolean revertLogicDeleted(List<String> userIds, SysUser updateEntity) {
|
||||
String ids = String.format("'%s'", String.join("','", userIds));
|
||||
return userMapper.revertLogicDeleted(ids, updateEntity) > 0;
|
||||
|
||||
@ -85,18 +85,31 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
||||
return null;
|
||||
}
|
||||
|
||||
// update:2022-1-21,updateBy:sunjianlei; for 【JTC-704】【钉钉】部门同步成功,实际没成,后台提示ip白名单
|
||||
@Override
|
||||
public boolean syncLocalDepartmentToThirdApp(String ids) {
|
||||
public SyncInfoVo syncLocalDepartmentToThirdApp(String ids) {
|
||||
SyncInfoVo syncInfo = new SyncInfoVo();
|
||||
String accessToken = this.getAccessToken();
|
||||
if (accessToken == null) {
|
||||
return false;
|
||||
syncInfo.addFailInfo("accessToken获取失败!");
|
||||
return syncInfo;
|
||||
}
|
||||
// 获取【钉钉】所有的部门
|
||||
List<Department> departments = JdtDepartmentAPI.listAll(accessToken);
|
||||
List<Response<Department>> departments = JdtDepartmentAPI.listAllResponse(accessToken);
|
||||
// 删除钉钉有但本地没有的部门(以本地部门数据为主)(钉钉不能创建同名部门,只能先删除)
|
||||
List<SysDepart> sysDepartList = sysDepartService.list();
|
||||
for1:
|
||||
for (Department department : departments) {
|
||||
for (Response<Department> departmentRes : departments) {
|
||||
// 判断部门是否查询成功
|
||||
if (!departmentRes.isSuccess()) {
|
||||
syncInfo.addFailInfo(departmentRes.getErrmsg());
|
||||
// 88 是 ip 不在白名单的错误码,如果遇到此错误码,后面的操作都可以不用进行了,因为肯定都是失败的
|
||||
if (new Integer(88).equals(departmentRes.getErrcode())) {
|
||||
return syncInfo;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
Department department = departmentRes.getResult();
|
||||
for (SysDepart depart : sysDepartList) {
|
||||
// id相同,代表已存在,不删除
|
||||
String sourceIdentifier = department.getSource_identifier();
|
||||
@ -124,24 +137,34 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
||||
Department parent = new Department();
|
||||
parent.setDept_id(1);
|
||||
// 递归同步部门
|
||||
departments = JdtDepartmentAPI.listAll(accessToken);
|
||||
this.syncDepartmentRecursion(sysDepartsTree, departments, parent, accessToken);
|
||||
return true;
|
||||
departments = JdtDepartmentAPI.listAllResponse(accessToken);
|
||||
this.syncDepartmentRecursion(sysDepartsTree, departments, parent, accessToken, syncInfo);
|
||||
return syncInfo;
|
||||
}
|
||||
|
||||
// 递归同步部门到本地
|
||||
public void syncDepartmentRecursion(List<SysDepartTreeModel> sysDepartsTree, List<Department> departments, Department parent, String accessToken) {
|
||||
public void syncDepartmentRecursion(List<SysDepartTreeModel> sysDepartsTree, List<Response<Department>> departments, Department parent, String accessToken, SyncInfoVo syncInfo) {
|
||||
if (sysDepartsTree != null && sysDepartsTree.size() != 0) {
|
||||
for1:
|
||||
for (SysDepartTreeModel depart : sysDepartsTree) {
|
||||
for (Department department : departments) {
|
||||
for (Response<Department> departmentRes : departments) {
|
||||
// 判断部门是否查询成功
|
||||
if (!departmentRes.isSuccess()) {
|
||||
syncInfo.addFailInfo(departmentRes.getErrmsg());
|
||||
continue;
|
||||
}
|
||||
Department department = departmentRes.getResult();
|
||||
// id相同,代表已存在,执行修改操作
|
||||
String sourceIdentifier = department.getSource_identifier();
|
||||
if (sourceIdentifier != null && sourceIdentifier.equals(depart.getId())) {
|
||||
this.sysDepartToDtDepartment(depart, department, parent.getDept_id());
|
||||
JdtDepartmentAPI.update(department, accessToken);
|
||||
// 紧接着同步子级
|
||||
this.syncDepartmentRecursion(depart.getChildren(), departments, department, accessToken);
|
||||
Response<JSONObject> response = JdtDepartmentAPI.update(department, accessToken);
|
||||
if (response.isSuccess()) {
|
||||
// 紧接着同步子级
|
||||
this.syncDepartmentRecursion(depart.getChildren(), departments, department, accessToken, syncInfo);
|
||||
}
|
||||
// 收集错误信息
|
||||
this.syncDepartCollectErrInfo(response, depart, syncInfo);
|
||||
// 跳出外部循环
|
||||
continue for1;
|
||||
}
|
||||
@ -154,10 +177,10 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
||||
Department newParent = new Department();
|
||||
newParent.setDept_id(response.getResult());
|
||||
// 紧接着同步子级
|
||||
this.syncDepartmentRecursion(depart.getChildren(), departments, newParent, accessToken);
|
||||
this.syncDepartmentRecursion(depart.getChildren(), departments, newParent, accessToken, syncInfo);
|
||||
}
|
||||
// 收集错误信息
|
||||
// this.syncUserCollectErrInfo(errCode, sysUser, errInfo);
|
||||
this.syncDepartCollectErrInfo(response, depart, syncInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -209,6 +232,11 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
||||
SysDepart newSysDepart = this.dtDepartmentToSysDepart(departmentTree, null);
|
||||
if (sysParentId != null) {
|
||||
newSysDepart.setParentId(sysParentId);
|
||||
// 2 = 组织机构
|
||||
newSysDepart.setOrgCategory("2");
|
||||
} else {
|
||||
// 1 = 公司
|
||||
newSysDepart.setOrgCategory("1");
|
||||
}
|
||||
try {
|
||||
sysDepartService.saveDepartData(newSysDepart, username);
|
||||
@ -246,6 +274,20 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 【同步部门】收集同步过程中的错误信息
|
||||
*/
|
||||
private boolean syncDepartCollectErrInfo(Response<?> response, SysDepartTreeModel depart, SyncInfoVo syncInfo) {
|
||||
if (!response.isSuccess()) {
|
||||
String str = String.format("部门 %s(%s) 同步失败!错误码:%s——%s", depart.getDepartName(), depart.getOrgCode(), response.getErrcode(), response.getErrmsg());
|
||||
syncInfo.addFailInfo(str);
|
||||
return false;
|
||||
} else {
|
||||
String str = String.format("部门户 %s(%s) 同步成功!", depart.getDepartName(), depart.getOrgCode());
|
||||
syncInfo.addSuccessInfo(str);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SyncInfoVo syncLocalUserToThirdApp(String ids) {
|
||||
@ -279,7 +321,7 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
||||
/*
|
||||
* 判断是否同步过的逻辑:
|
||||
* 1. 查询 sys_third_account(第三方账号表)是否有数据,如果有代表已同步
|
||||
* 2. 本地表里没有,就先用手机号判断,不通过再用username判断。
|
||||
* 2. 本地表里没有,就先用手机号判断,不通过再用username(用户账号)判断。
|
||||
*/
|
||||
SysThirdAccount sysThirdAccount = sysThirdAccountService.getOneBySysUserId(sysUser.getId(), THIRD_TYPE);
|
||||
if (sysThirdAccount != null && oConvertUtils.isNotEmpty(sysThirdAccount.getThirdUserId())) {
|
||||
@ -528,6 +570,12 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
||||
// update-begin--Author:liusq Date:20210713 for:钉钉同步到本地的人员没有状态,导致同步之后无法登录 #I3ZC2L
|
||||
sysUser.setStatus(1);
|
||||
// update-end--Author:liusq Date:20210713 for:钉钉同步到本地的人员没有状态,导致同步之后无法登录 #I3ZC2L
|
||||
// 设置工号,如果工号为空,则使用username
|
||||
if (oConvertUtils.isEmpty(dtUser.getJob_number())) {
|
||||
sysUser.setWorkNo(dtUser.getUserid());
|
||||
} else {
|
||||
sysUser.setWorkNo(dtUser.getJob_number());
|
||||
}
|
||||
return this.dtUserToSysUser(dtUser, sysUser);
|
||||
}
|
||||
|
||||
|
||||
@ -96,15 +96,18 @@ public class ThirdAppWechatEnterpriseServiceImpl implements IThirdAppService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean syncLocalDepartmentToThirdApp(String ids) {
|
||||
public SyncInfoVo syncLocalDepartmentToThirdApp(String ids) {
|
||||
SyncInfoVo syncInfo = new SyncInfoVo();
|
||||
String accessToken = this.getAccessToken();
|
||||
if (accessToken == null) {
|
||||
return false;
|
||||
syncInfo.addFailInfo("accessToken获取失败!");
|
||||
return syncInfo;
|
||||
}
|
||||
// 获取企业微信所有的部门
|
||||
List<Department> departments = JwDepartmentAPI.getAllDepartment(accessToken);
|
||||
if (departments == null) {
|
||||
return false;
|
||||
syncInfo.addFailInfo("获取企业微信所有部门失败!");
|
||||
return syncInfo;
|
||||
}
|
||||
// 删除企业微信有但本地没有的部门(以本地部门数据为主)(以为企业微信不能创建同名部门,所以只能先删除)
|
||||
List<JwDepartmentTreeVo> departmentTreeList = JwDepartmentTreeVo.listToTree(departments);
|
||||
@ -117,7 +120,7 @@ public class ThirdAppWechatEnterpriseServiceImpl implements IThirdAppService {
|
||||
// 递归同步部门
|
||||
departments = JwDepartmentAPI.getAllDepartment(accessToken);
|
||||
this.syncDepartmentRecursion(sysDepartsTree, departments, parent, accessToken);
|
||||
return true;
|
||||
return syncInfo;
|
||||
}
|
||||
|
||||
// 递归删除部门以及子部门,由于企业微信不允许删除带有成员和子部门的部门,所以需要递归删除下子部门,然后把部门成员移动端根部门下
|
||||
@ -250,6 +253,11 @@ public class ThirdAppWechatEnterpriseServiceImpl implements IThirdAppService {
|
||||
SysDepart newSysDepart = this.qwDepartmentToSysDepart(departmentTree, null);
|
||||
if (sysParentId != null) {
|
||||
newSysDepart.setParentId(sysParentId);
|
||||
// 2 = 组织机构
|
||||
newSysDepart.setOrgCategory("2");
|
||||
} else {
|
||||
// 1 = 公司
|
||||
newSysDepart.setOrgCategory("1");
|
||||
}
|
||||
try {
|
||||
sysDepartService.saveDepartData(newSysDepart, username);
|
||||
@ -604,6 +612,10 @@ public class ThirdAppWechatEnterpriseServiceImpl implements IThirdAppService {
|
||||
BeanUtils.copyProperties(oldSysUser, sysUser);
|
||||
sysUser.setRealname(qwUser.getName());
|
||||
sysUser.setPost(qwUser.getPosition());
|
||||
// 设置工号,由于企业微信没有工号的概念,所以只能用 userId 代替
|
||||
if (oConvertUtils.isEmpty(sysUser.getWorkNo())) {
|
||||
sysUser.setWorkNo(qwUser.getUserid());
|
||||
}
|
||||
try {
|
||||
sysUser.setSex(Integer.parseInt(qwUser.getGender()));
|
||||
} catch (NumberFormatException ignored) {
|
||||
|
||||
Reference in New Issue
Block a user