diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/controller/ExpertController.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/controller/ExpertController.java index b20de69..4e48d96 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/controller/ExpertController.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/controller/ExpertController.java @@ -29,6 +29,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.demo.expproject.entity.Expandpro; +import org.jeecg.modules.demo.expproject.entity.ExpproVo; +import org.jeecg.modules.demo.expproject.entity.Expproject; +import org.jeecg.modules.demo.expproject.service.IExpandproService; +import org.jeecg.modules.demo.expproject.service.IExpprojectService; import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.service.ISysDepartService; @@ -69,6 +74,12 @@ public class ExpertController extends JeecgController { private ISysDepartService sysDepartService; @Autowired private IDisciplineFieidService disciplineFieidService; + @Autowired + private IExpprojectService expprojectService; + + @Autowired + private IExpandproService expandproService; + /** * 分页列表查询 @@ -88,6 +99,7 @@ public class ExpertController extends JeecgController { HttpServletRequest req) { //用于查看所有信息无论是否审核,无论哪个部门 QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(expert, req.getParameterMap()); + queryWrapper.eq("isdone","Y"); Page page = new Page(pageNo, pageSize); IPage pageList = expertService.page(page, queryWrapper); pageList.getRecords().forEach(experttemp -> { @@ -109,6 +121,38 @@ public class ExpertController extends JeecgController { return Result.OK(pageList); } + @ApiOperation(value="专家管理-分页列表查询/管理员角色", notes="专家管理-分页列表查询/管理员角色") + @GetMapping(value = "/listadminstatic") + public Result> listadminstatic(Expert expert, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + //用于查看所有信息无论是否审核,无论哪个部门 + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(expert, req.getParameterMap()); + queryWrapper.eq("isdone","Y"); + queryWrapper.eq("adminopen","2"); + queryWrapper.eq("compopen","2"); + Page page = new Page(pageNo, pageSize); + IPage pageList = expertService.page(page, queryWrapper); + pageList.getRecords().forEach(experttemp -> { + //开始用于修改数据 + SysUser sysUser = sysUserService.query().eq("username",experttemp.getSeusername()).one(); + String depid = expertService.getdeps(sysUser.getId()); + SysDepart sysDepart = sysDepartService.getById(depid); + experttemp.setRealname(sysUser.getRealname()); + experttemp.setWorkon(sysUser.getWorkNo()); + experttemp.setSex(sysUser.getSex()); + experttemp.setTopPic(sysUser.getAvatar()); + experttemp.setPhone(sysUser.getPhone()); + experttemp.setEmails(sysUser.getEmail()); + experttemp.setSsdep(sysDepart.getDepartName()); + experttemp.setPsd(sysUser.getPassword()); + experttemp.setSepsd(sysUser.getPassword()); + }); + + return Result.OK(pageList); + } + @ApiOperation(value="专家管理-分页列表查询/县区管理员角色", notes="专家管理-分页列表查询/县区管理员角色") @GetMapping(value = "/listcounty") public Result> listcounty(Expert expert, @@ -138,6 +182,7 @@ public class ExpertController extends JeecgController { //用于查看本县区下面的专家信息无论是否审核,无论哪个部门 QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(expert, req.getParameterMap()); + queryWrapper.eq("isdone","Y"); queryWrapper.in("seusername",usernames); Page page = new Page(pageNo, pageSize); IPage pageList = expertService.page(page, queryWrapper); @@ -687,6 +732,8 @@ public class ExpertController extends JeecgController { user.setDelFlag(CommonConstant.DEL_FLAG_0); sysUserService.saveUser(user, "1843478958968647681", ssdep, ""); Expert expert = new Expert(); + expert.setAdminopen("1"); + expert.setCompopen("1"); expert.setSeusername(username); expertService.save(expert); return Result.OK("注册成功"); @@ -764,6 +811,40 @@ public class ExpertController extends JeecgController { List expertList = expertService.query().eq("adminopen","2").eq("compopen","2").eq("expsture","Y").list(); return Result.OK(expertList.size()); } + @ApiOperation(value="管理员专家数据---异常专家数--请假", notes="管理员专家数据---异常专家数--请假") + @GetMapping(value = "/expdatanumberycxj") + public Result expdatanumberycxj() { + List expertList = expertService.query().eq("adminopen","2").eq("compopen","2").eq("expsture","Y").eq("errinfo","2").list(); + return Result.OK(expertList.size()); + } + + @ApiOperation(value="管理员专家数据---异常专家数--出差", notes="管理员专家数据---异常专家数--出差") + @GetMapping(value = "/expdatanumberyccc") + public Result expdatanumberyccc() { + List expertList = expertService.query().eq("adminopen","2").eq("compopen","2").eq("expsture","Y").eq("errinfo","1").list(); + return Result.OK(expertList.size()); + } + + @ApiOperation(value="管理员专家数据---异常专家数--其他", notes="管理员专家数据---异常专家数--其他") + @GetMapping(value = "/expdatanumberycqt") + public Result expdatanumberycqt() { + List expertList = expertService.query().eq("adminopen","2").eq("compopen","2").eq("expsture","Y").eq("errinfo","3").list(); + return Result.OK(expertList.size()); + } + + @ApiOperation(value="管理员专家数据---专家待提交/未审核", notes="管理员专家数据---专家待提交/未审核") + @GetMapping(value = "/expdatawtjsh") + public Result expdatawtjsh() { + List expertList = expertService.query().eq("adminopen","1").or().eq("compopen","1").or().eq("isdone","N").list(); + return Result.OK(expertList.size()); + } + + @ApiOperation(value="管理员专家数据---专家已审核", notes="管理员专家数据---专家已审核") + @GetMapping(value = "/expdatayish") + public Result expdatayish() { + List expertList = expertService.query().eq("adminopen","2").eq("compopen","2").eq("isdone","Y").list(); + return Result.OK(expertList.size()); + } @ApiOperation(value="管理员专家数据---不同的领域专家数", notes="管理员专家数据---不同的领域专家数") @GetMapping(value = "/expdatanumberdiffect") @@ -780,4 +861,38 @@ public class ExpertController extends JeecgController { return Result.OK(expdefVoList); } + //统计项目的总个数 + @ApiOperation(value="管理员专家数据---查询项目个数", notes="管理员专家数据---查询项目个数") + @GetMapping(value = "/projectnumber") + public Result projectnumber() { + List expprojectList = expprojectService.list(); + return Result.OK(expprojectList.size()); + } + + @ApiOperation(value="管理员专家数据---查询项目和项目需要的专家", notes="管理员专家数据---查询项目和项目需要的专家") + @GetMapping(value = "/findprojectandnumber") + public Result> findprojectandnumber() { + List expproVos =new ArrayList<>(); + List expprojectList = expprojectService.list(); + for (Expproject expproject : expprojectList) { + ExpproVo expproVo = new ExpproVo(); + expproVo.setCreateTime(expproject.getCreateTime()); + expproVo.setProname(expproject.getProname()); + expproVo.setNeedexp(expproject.getNeedexp()); + expproVo.setExptype(disciplineFieidService.query().eq("id",expproject.getExptype()).one().getName()); + List expandpros =expandproService.query().eq("expprojectid",expproject.getId()).list(); + if (!expandpros.isEmpty()){ + expproVo.setExperts(expandpros.stream().map(Expandpro::getExpname).collect(Collectors.toList())); + } + expproVos.add(expproVo); + } + expproVos.sort(Comparator.comparing(ExpproVo::getCreateTime).reversed()); + // 截取前 6 条数据 + if (expproVos.size() > 6) { + expproVos = expproVos.subList(0, 6); + } + return Result.OK(expproVos); + } + + } diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expproject/controller/ExpprojectController.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expproject/controller/ExpprojectController.java index 7ccdf64..b07adf5 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expproject/controller/ExpprojectController.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expproject/controller/ExpprojectController.java @@ -2,7 +2,9 @@ package org.jeecg.modules.demo.expproject.controller; import java.io.UnsupportedEncodingException; import java.io.IOException; +import java.math.BigInteger; import java.net.URLDecoder; +import java.security.SecureRandom; import java.util.*; import java.util.stream.Collectors; @@ -141,11 +143,16 @@ public class ExpprojectController { public Result add(@RequestBody ExpprojectPage expprojectPage) { Expproject expproject = new Expproject(); BeanUtils.copyProperties(expprojectPage, expproject); - if (expproject.getNeedexp()>=expprojectPage.getExpandproList().size()) { + if (!expprojectPage.getExpandproList().isEmpty()) { + if (expproject.getNeedexp() >= expprojectPage.getExpandproList().size()) { + expprojectService.saveMain(expproject, expprojectPage.getExpandproList()); + return Result.OK("添加成功!"); + } else { + return Result.error("确定项目专家数量"); + } + }else { expprojectService.saveMain(expproject, expprojectPage.getExpandproList()); return Result.OK("添加成功!"); - }else { - return Result.error("确定项目专家数量"); } } @@ -241,9 +248,10 @@ public class ExpprojectController { List usernamelist = expandproService.getusernamelist(); Collections.shuffle(usernamelist); List randomUsers = getRandomUsers(usernamelist, a); - Expandpro expandpro =new Expandpro(); + List expertList = expertService.query().in("seusername",randomUsers).list(); for (int i=0;i experts; +} diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/instrument/controller/InstrumentController.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/instrument/controller/InstrumentController.java index 7ddfd6b..142518f 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/instrument/controller/InstrumentController.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/instrument/controller/InstrumentController.java @@ -205,7 +205,7 @@ public class InstrumentController extends JeecgController pageList = instrumentService.page(page, queryWrapper); return Result.OK(pageList); } - if(loginUser.getRoleCode().indexOf("yuwukeshi_admin")!= -1){ + if(loginUser.getRoleCode().indexOf("kejiju_admin")!= -1){ //市直业务科室管理员角色 queryWrapper.in("state",2,3); queryWrapper.in("flag",0,2); diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java index 8d47b01..bdbde7a 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java @@ -4,10 +4,12 @@ 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.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.annotation.RequiresRoles; import org.jeecg.common.api.vo.Result; @@ -21,10 +23,7 @@ import org.jeecg.common.util.*; import org.jeecg.common.util.encryption.EncryptedString; import org.jeecg.config.JeecgBaseConfig; import org.jeecg.modules.base.service.BaseCommonService; -import org.jeecg.modules.system.entity.SysDepart; -import org.jeecg.modules.system.entity.SysRoleIndex; -import org.jeecg.modules.system.entity.SysTenant; -import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.entity.*; import org.jeecg.modules.system.model.SysLoginModel; import org.jeecg.modules.system.service.*; import org.jeecg.modules.system.service.impl.SysBaseApiImpl; @@ -38,7 +37,6 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.*; -import java.util.stream.Collectors; /** * @Author scott @@ -68,6 +66,12 @@ public class LoginController { @Autowired private JeecgBaseConfig jeecgBaseConfig; + @Autowired + private ISysUserRoleService sysUserRoleService; + + @Autowired + private ISysRoleService sysRoleService; + private final String BASE_CHECK_CODES = "qwertyuiplkjhgfdsazxcvbnmQWERTYUPLKJHGFDSAZXCVBNM1234567890"; @ApiOperation("登录接口") @@ -99,7 +103,7 @@ public class LoginController { result.setCode(HttpStatus.PRECONDITION_FAILED.value()); return result; } - + // step.2 校验用户是否存在且有效 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(SysUser::getUsername,username); @@ -161,11 +165,19 @@ public class LoginController { //update-begin---author:liusq ---date:2022-06-29 for:接口返回值修改,同步修改这里的判断逻辑----------- //update-end---author:scott ---date::2022-06-20 for:vue3前端,支持自定义首页-------------- log.info("2 获取用户信息耗时 (首页面配置)" + (System.currentTimeMillis() - start) + "毫秒"); - + + List userRole = sysUserRoleService.list(new QueryWrapper().lambda().eq(SysUserRole::getUserId, sysUser.getId())); + if(ObjectUtils.isNotEmpty(userRole)){ + String rollId = userRole.get(0).getRoleId(); + SysRole sysRole = sysRoleService.getById(rollId); + if(ObjectUtils.isNotEmpty(sysRole)){ + sysUser.setRoleCode(sysRole.getRoleCode()); + } + } obj.put("userInfo",sysUser); obj.put("sysAllDictItems", sysDictService.queryAllDictItems()); log.info("3 获取用户信息耗时 (字典数据)" + (System.currentTimeMillis() - start) + "毫秒"); - + result.setResult(obj); result.success(""); } @@ -173,7 +185,7 @@ public class LoginController { return result; } - + /** * 退出登录 * @param request @@ -207,7 +219,7 @@ public class LoginController { return Result.error("Token无效!"); } } - + /** * 获取访问量 * @return @@ -238,7 +250,7 @@ public class LoginController { result.success("登录成功"); return result; } - + /** * 获取访问量 * @return @@ -259,8 +271,8 @@ public class LoginController { result.setResult(oConvertUtils.toLowerCasePageList(list)); return result; } - - + + /** * 登陆成功选择用户当前部门 * @param user @@ -274,7 +286,7 @@ public class LoginController { LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal(); username = sysUser.getUsername(); } - + //获取登录部门 String orgCode= user.getOrgCode(); //获取登录租户 @@ -290,7 +302,7 @@ public class LoginController { /** * 短信登录接口 - * + * * @param jsonObject * @return */ @@ -302,18 +314,18 @@ public class LoginController { //手机号模式 登录模式: "2" 注册模式: "1" String smsmode=jsonObject.get("smsmode").toString(); log.info("-------- IP:{}, 手机号:{},获取绑定验证码", clientIp, mobile); - + if(oConvertUtils.isEmpty(mobile)){ result.setMessage("手机号不允许为空!"); result.setSuccess(false); return result; } - + //update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906 String redisKey = CommonConstant.PHONE_REDIS_KEY_PRE+mobile; Object object = redisUtil.get(redisKey); //update-end-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906 - + if (object != null) { result.setMessage("验证码10分钟内,仍然有效!"); result.setSuccess(false); @@ -358,7 +370,7 @@ public class LoginController { } return result; } - + /** * smsmode 短信模板方式 0 .登录模板、1.注册模板、2.忘记密码模板 */ @@ -376,12 +388,12 @@ public class LoginController { result.setSuccess(false); return result; } - + //update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906 //验证码10分钟内有效 redisUtil.set(redisKey, captcha, 600); //update-end-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906 - + //update-begin--Author:scott Date:20190812 for:issues#391 //result.setResult(captcha); //update-end--Author:scott Date:20190812 for:issues#391 @@ -394,11 +406,11 @@ public class LoginController { } return result; } - + /** * 手机号登录接口 - * + * * @param jsonObject * @return */ @@ -418,7 +430,7 @@ public class LoginController { if(!result.isSuccess()) { return result; } - + String smscode = jsonObject.getString("captcha"); //update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906 @@ -469,7 +481,7 @@ public class LoginController { //3.设置登录用户信息 obj.put("userInfo", sysUser); - + //4.设置登录部门 List departs = sysDepartService.queryUserDeparts(sysUser.getId()); obj.put("departs", departs); @@ -496,7 +508,7 @@ public class LoginController { obj.put("sysAllDictItems", sysDictService.queryAllDictItems()); } //end-begin---author:scott ---date:2024-01-05 for:【QQYUN-7802】前端在登录时加载了两次数据字典,建议优化下,避免数据字典太多时可能产生的性能问题 #956--- - + result.setResult(obj); result.success("登录成功"); return result; @@ -530,13 +542,13 @@ public class LoginController { String code = RandomUtil.randomString(BASE_CHECK_CODES,4); //存到redis中 String lowerCaseCode = code.toLowerCase(); - + //update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906 // 加入密钥作为混淆,避免简单的拼接,被外部利用,用户自定义该密钥即可 String origin = lowerCaseCode+key+jeecgBaseConfig.getSignatureSecret(); String realKey = Md5Util.md5Encode(origin, "utf-8"); //update-end-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906 - + redisUtil.set(realKey, lowerCaseCode, 60); log.info("获取验证码,Redis key = {},checkCode = {}", realKey, code); //返回前端 @@ -557,11 +569,11 @@ public class LoginController { @RequiresRoles({"admin"}) @GetMapping(value = "/switchVue3Menu") public Result switchVue3Menu(HttpServletResponse response) { - Result res = new Result(); + Result res = new Result(); sysPermissionService.switchVue3Menu(); return res; } - + /** * app登录 * @param sysLoginModel @@ -574,7 +586,7 @@ public class LoginController { String username = sysLoginModel.getUsername(); String password = sysLoginModel.getPassword(); JSONObject obj = new JSONObject(); - + //update-begin-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户 if(isLoginFailOvertimes(username)){ return result.error500("该用户登录失败次数过多,请于10分钟后再次登录!"); @@ -586,7 +598,7 @@ public class LoginController { if(!result.isSuccess()) { return result; } - + //2. 校验用户名或密码是否正确 String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt()); String syspassword = sysUser.getPassword(); @@ -597,17 +609,17 @@ public class LoginController { result.error500("用户名或密码错误"); return result; } - + //3.设置登录部门 String orgCode = sysUser.getOrgCode(); if(oConvertUtils.isEmpty(orgCode)) { //如果当前用户无选择部门 查看部门关联信息 - + List 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;*/ }else{ orgCode = departs.get(0).getOrgCode(); @@ -625,7 +637,7 @@ public class LoginController { //5. 设置登录用户信息 obj.put("userInfo", sysUser); - + //6. 生成token String token = JwtUtil.sign(username, syspassword); // 设置超时时间 @@ -799,7 +811,7 @@ public class LoginController { return result; } - + /** * 图形验证码 * @param sysLoginModel @@ -824,5 +836,5 @@ public class LoginController { redisUtil.removeAll(realKey); return Result.ok(); } - -} \ No newline at end of file + +} diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java index ec9539d..d90e3a4 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java @@ -1,6 +1,5 @@ package org.jeecg.modules.system.controller; -import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -17,7 +16,6 @@ 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.ImportExcelUtil; -import org.jeecg.common.util.YouBianCodeUtil; import org.jeecg.common.util.oConvertUtils; import org.jeecg.config.mybatis.MybatisPlusSaasConfig; import org.jeecg.modules.system.entity.SysDepart; @@ -59,278 +57,310 @@ import java.util.*; @Slf4j public class SysDepartController { - @Autowired - private ISysDepartService sysDepartService; - @Autowired - public RedisTemplate redisTemplate; - @Autowired - private ISysUserService sysUserService; - @Autowired - private ISysUserDepartService sysUserDepartService; - /** - * 查询数据 查出我的部门,并以树结构数据格式响应给前端 - * - * @return - */ - @RequestMapping(value = "/queryMyDeptTreeList", method = RequestMethod.GET) - public Result> queryMyDeptTreeList() { - Result> result = new Result<>(); - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - try { - if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals( CommonConstant.USER_IDENTITY_2 )){ - //update-begin--Author:liusq Date:20210624 for:部门查询ids为空后的前端显示问题 issues/I3UD06 - String departIds = user.getDepartIds(); - if(StringUtils.isNotBlank(departIds)){ - List list = sysDepartService.queryMyDeptTreeList(departIds); - result.setResult(list); - } - //update-end--Author:liusq Date:20210624 for:部门查询ids为空后的前端显示问题 issues/I3UD06 - result.setMessage(CommonConstant.USER_IDENTITY_2.toString()); - result.setSuccess(true); - }else{ - result.setMessage(CommonConstant.USER_IDENTITY_1.toString()); - result.setSuccess(true); - } - } catch (Exception e) { - log.error(e.getMessage(),e); - } - return result; - } - - /** - * 查询数据 查出所有部门,并以树结构数据格式响应给前端 - * - * @return - */ - @RequestMapping(value = "/queryTreeList", method = RequestMethod.GET) - public Result> queryTreeList(@RequestParam(name = "ids", required = false) String ids) { - Result> result = new Result<>(); - try { - // 从内存中读取 + @Autowired + private ISysDepartService sysDepartService; + @Autowired + public RedisTemplate redisTemplate; + @Autowired + private ISysUserService sysUserService; + @Autowired + private ISysUserDepartService sysUserDepartService; + + /** + * 查询数据 查出我的部门,并以树结构数据格式响应给前端 + * + * @return + */ + @RequestMapping(value = "/queryMyDeptTreeList", method = RequestMethod.GET) + public Result> queryMyDeptTreeList() { + Result> result = new Result<>(); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + try { + if (oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals(CommonConstant.USER_IDENTITY_2)) { + //update-begin--Author:liusq Date:20210624 for:部门查询ids为空后的前端显示问题 issues/I3UD06 + String departIds = user.getDepartIds(); + if (StringUtils.isNotBlank(departIds)) { + List list = sysDepartService.queryMyDeptTreeList(departIds); + result.setResult(list); + } + //update-end--Author:liusq Date:20210624 for:部门查询ids为空后的前端显示问题 issues/I3UD06 + result.setMessage(CommonConstant.USER_IDENTITY_2.toString()); + result.setSuccess(true); + } else { + result.setMessage(CommonConstant.USER_IDENTITY_1.toString()); + result.setSuccess(true); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return result; + } + + /** + * 查询数据 查出所有部门,并以树结构数据格式响应给前端 + * + * @return + */ + @RequestMapping(value = "/queryTreeList", method = RequestMethod.GET) + public Result> queryTreeList(@RequestParam(name = "ids", required = false) String ids) { + Result> result = new Result<>(); + try { + // 从内存中读取 // List list =FindsDepartsChildrenUtil.getSysDepartTreeList(); // if (CollectionUtils.isEmpty(list)) { // list = sysDepartService.queryTreeList(); // } - if(oConvertUtils.isNotEmpty(ids)){ - List departList = sysDepartService.queryTreeList(ids); - result.setResult(departList); - }else{ - List list = sysDepartService.queryTreeList(); - result.setResult(list); - } - result.setSuccess(true); - } catch (Exception e) { - log.error(e.getMessage(),e); - } - return result; - } - - /** - * 异步查询部门list - * @param parentId 父节点 异步加载时传递 - * @param ids 前端回显是传递 - * @param primaryKey 主键字段(id或者orgCode) - * @return - */ - @RequestMapping(value = "/queryDepartTreeSync", method = RequestMethod.GET) - public Result> queryDepartTreeSync(@RequestParam(name = "pid", required = false) String parentId,@RequestParam(name = "ids", required = false) String ids, @RequestParam(name = "primaryKey", required = false) String primaryKey) { - Result> result = new Result<>(); - try { - List list = sysDepartService.queryTreeListByPid(parentId,ids, primaryKey); - result.setResult(list); - result.setSuccess(true); - } catch (Exception e) { - log.error(e.getMessage(),e); - result.setSuccess(false); - result.setMessage("查询失败"); - } - return result; - } - - /** - * 获取某个部门的所有父级部门的ID - * - * @param departId 根据departId查 - * @param orgCode 根据orgCode查,departId和orgCode必须有一个不为空 - */ - @GetMapping("/queryAllParentId") - public Result queryParentIds( - @RequestParam(name = "departId", required = false) String departId, - @RequestParam(name = "orgCode", required = false) String orgCode) { - try { - JSONObject data; - if (oConvertUtils.isNotEmpty(departId)) { - data = sysDepartService.queryAllParentIdByDepartId(departId); - } else if (oConvertUtils.isNotEmpty(orgCode)) { - data = sysDepartService.queryAllParentIdByOrgCode(orgCode); - } else { - return Result.error("departId 和 orgCode 不能都为空!"); - } - return Result.OK(data); - } catch (Exception e) { - log.error(e.getMessage(), e); - return Result.error(e.getMessage()); - } - } - - /** - * @description: 县区管理员审核其下属单位 - * 根据当前用户部门查询其子部门 - * @param: [] - * @return: org.jeecg.common.api.vo.Result - * @author: z.h.c - * @date: 24/10/11 17:49 - */ - @GetMapping("/queryListByParentId") - public Result> queryListByParentId(SysDepart depart, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - //获取下级部门 + if (oConvertUtils.isNotEmpty(ids)) { + List departList = sysDepartService.queryTreeList(ids); + result.setResult(departList); + } else { + List list = sysDepartService.queryTreeList(); + result.setResult(list); + } + result.setSuccess(true); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return result; + } + + /** + * 异步查询部门list + * + * @param parentId 父节点 异步加载时传递 + * @param ids 前端回显是传递 + * @param primaryKey 主键字段(id或者orgCode) + * @return + */ + @RequestMapping(value = "/queryDepartTreeSync", method = RequestMethod.GET) + public Result> queryDepartTreeSync(@RequestParam(name = "pid", required = false) String parentId, @RequestParam(name = "ids", required = false) String ids, @RequestParam(name = "primaryKey", required = false) String primaryKey) { + Result> result = new Result<>(); + try { + List list = sysDepartService.queryTreeListByPid(parentId, ids, primaryKey); + result.setResult(list); + result.setSuccess(true); + } catch (Exception e) { + log.error(e.getMessage(), e); + result.setSuccess(false); + result.setMessage("查询失败"); + } + return result; + } + + /** + * @description: 根据当前登录角色查询 下级部门数据 + * @param: [parentId, ids, primaryKey] + * @return: org.jeecg.common.api.vo.Result> + * @author: z.h.c + * @date: 24/11/9 16:07 + */ + @RequestMapping(value = "/queryDepartTreeSync4ZhuGuanBuMen", method = RequestMethod.GET) + public Result> queryDepartTreeSync4ZhuGuanBuMen(@RequestParam(name = "parentOrgCode", required = false) String parentOrgCode, @RequestParam(name = "ids", required = false) String ids, @RequestParam(name = "primaryKey", required = false) String primaryKey) { + Result> result = new Result<>(); + SysDepart sysDepart = sysDepartService.getOne(new LambdaQueryWrapper().eq(SysDepart::getOrgCode, parentOrgCode)); + try { + List list = sysDepartService.queryTreeListByPid(sysDepart.getId(), ids, primaryKey); + result.setResult(list); + result.setSuccess(true); + } catch (Exception e) { + log.error(e.getMessage(), e); + result.setSuccess(false); + result.setMessage("查询失败"); + } + return result; + } + + /** + * 获取某个部门的所有父级部门的ID + * + * @param departId 根据departId查 + * @param orgCode 根据orgCode查,departId和orgCode必须有一个不为空 + */ + @GetMapping("/queryAllParentId") + public Result queryParentIds( + @RequestParam(name = "departId", required = false) String departId, + @RequestParam(name = "orgCode", required = false) String orgCode) { + try { + JSONObject data; + if (oConvertUtils.isNotEmpty(departId)) { + data = sysDepartService.queryAllParentIdByDepartId(departId); + } else if (oConvertUtils.isNotEmpty(orgCode)) { + data = sysDepartService.queryAllParentIdByOrgCode(orgCode); + } else { + return Result.error("departId 和 orgCode 不能都为空!"); + } + return Result.OK(data); + } catch (Exception e) { + log.error(e.getMessage(), e); + return Result.error(e.getMessage()); + } + } + + /** + * @description: 县区管理员审核其下属单位 + * 根据当前用户部门查询其子部门 + * @param: [] + * @return: org.jeecg.common.api.vo.Result + * @author: z.h.c + * @date: 24/10/11 17:49 + */ + @GetMapping("/queryListByParentId") + public Result> queryListByParentId(SysDepart depart, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + //获取下级部门 // List departList = sysDepartService.list(new LambdaQueryWrapper() - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(depart, req.getParameterMap()); - queryWrapper.eq("del_flag", 0); - queryWrapper.eq("parent_id", user.getOrgId()); - return sysDepartService.queryPageList(req, queryWrapper, pageSize, pageNo); - - } - - /** - * @description: 申报单位管理 冻结&解冻 - * @param: [jsonObject] - * @return: org.jeecg.common.api.vo.Result - * @author: z.h.c - * @date: 24/10/12 16:57 - */ - @RequestMapping(value = "/frozenBatch", method = RequestMethod.PUT) - public Result frozenBatch(@RequestBody JSONObject jsonObject) { - Result result = new Result(); - try { - String ids = jsonObject.getString("ids"); - sysUserService.checkUserAdminRejectDel(ids); - String status = jsonObject.getString("status"); - String[] arr = ids.split(","); - for (String id : arr) { - if (oConvertUtils.isNotEmpty(id)) { - sysDepartService.lambdaUpdate().eq(SysDepart::getId,id).set(SysDepart::getStatus,status).update(); - } - } - } catch (Exception e) { - log.error(e.getMessage(), e); - result.error500("操作失败" + e.getMessage()); - } - result.success("操作成功!"); - return result; - - } - - /** - * 添加新数据 添加用户新建的部门对象数据,并保存到数据库 - * - * @param sysDepart - * @return - */ - @RequiresPermissions("system:depart:add") - @RequestMapping(value = "/add", method = RequestMethod.POST) - @CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) - public Result add(@RequestBody SysDepart sysDepart, HttpServletRequest request) { - Result result = new Result(); - String username = JwtUtil.getUserNameByToken(request); - try { - sysDepart.setCreateBy(username); - sysDepartService.saveDepartData(sysDepart, username); - //清除部门树内存 - // FindsDepartsChildrenUtil.clearSysDepartTreeList(); - // FindsDepartsChildrenUtil.clearDepartIdModel(); - result.success("添加成功!"); - } catch (Exception e) { - log.error(e.getMessage(),e); - result.error500("操作失败"); - } - return result; - } - - /** - * 编辑数据 编辑部门的部分数据,并保存到数据库 - * - * @param sysDepart - * @return - */ - @RequiresPermissions("system:depart:edit") - @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) - @CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) - public Result edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) { - String username = JwtUtil.getUserNameByToken(request); - sysDepart.setUpdateBy(username); - Result result = new Result(); - SysDepart sysDepartEntity = sysDepartService.getById(sysDepart.getId()); - if (sysDepartEntity == null) { - result.error500("未找到对应实体"); - } else { - boolean ok = sysDepartService.updateDepartDataById(sysDepart, username); - // TODO 返回false说明什么? - if (ok) { - //清除部门树内存 - //FindsDepartsChildrenUtil.clearSysDepartTreeList(); - //FindsDepartsChildrenUtil.clearDepartIdModel(); - result.success("修改成功!"); - } - } - return result; - } - - /** - * 通过id删除 - * @param id - * @return - */ + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(depart, req.getParameterMap()); + queryWrapper.eq("del_flag", 0); + + //单位法人角色时,只查询自己部门 + if ("faren_admin".equals(user.getRoleCode())) { + queryWrapper.eq("id", user.getOrgId()); + } else { // 查询下级部门 + queryWrapper.eq("parent_id", user.getOrgId()); + } + return sysDepartService.queryPageList(req, queryWrapper, pageSize, pageNo); + + } + + /** + * @description: 申报单位管理 冻结&解冻 + * @param: [jsonObject] + * @return: org.jeecg.common.api.vo.Result + * @author: z.h.c + * @date: 24/10/12 16:57 + */ + @RequestMapping(value = "/frozenBatch", method = RequestMethod.PUT) + public Result frozenBatch(@RequestBody JSONObject jsonObject) { + Result result = new Result(); + try { + String ids = jsonObject.getString("ids"); + sysUserService.checkUserAdminRejectDel(ids); + String status = jsonObject.getString("status"); + String[] arr = ids.split(","); + for (String id : arr) { + if (oConvertUtils.isNotEmpty(id)) { + sysDepartService.lambdaUpdate().eq(SysDepart::getId, id).set(SysDepart::getStatus, status).update(); + } + } + } catch (Exception e) { + log.error(e.getMessage(), e); + result.error500("操作失败" + e.getMessage()); + } + result.success("操作成功!"); + return result; + + } + + /** + * 添加新数据 添加用户新建的部门对象数据,并保存到数据库 + * + * @param sysDepart + * @return + */ +// @RequiresPermissions("system:depart:add") + @RequestMapping(value = "/add", method = RequestMethod.POST) + @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true) + public Result add(@RequestBody SysDepart sysDepart, HttpServletRequest request) { + Result result = new Result(); + String username = JwtUtil.getUserNameByToken(request); + try { + sysDepart.setCreateBy(username); + sysDepartService.saveDepartData(sysDepart, username); + //清除部门树内存 + // FindsDepartsChildrenUtil.clearSysDepartTreeList(); + // FindsDepartsChildrenUtil.clearDepartIdModel(); + result.success("添加成功!"); + } catch (Exception e) { + log.error(e.getMessage(), e); + result.error500("操作失败"); + } + return result; + } + + /** + * 编辑数据 编辑部门的部分数据,并保存到数据库 + * + * @param sysDepart + * @return + */ +// @RequiresPermissions("system:depart:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true) + public Result edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) { + String username = JwtUtil.getUserNameByToken(request); + sysDepart.setUpdateBy(username); + Result result = new Result(); + SysDepart sysDepartEntity = sysDepartService.getById(sysDepart.getId()); + if (sysDepartEntity == null) { + result.error500("未找到对应实体"); + } else { + boolean ok = sysDepartService.updateDepartDataById(sysDepart, username); + // TODO 返回false说明什么? + if (ok) { + //清除部门树内存 + //FindsDepartsChildrenUtil.clearSysDepartTreeList(); + //FindsDepartsChildrenUtil.clearDepartIdModel(); + result.success("修改成功!"); + } + } + return result; + } + + /** + * 通过id删除 + * + * @param id + * @return + */ @RequiresPermissions("system:depart:delete") @RequestMapping(value = "/delete", method = RequestMethod.DELETE) - @CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) - public Result delete(@RequestParam(name="id",required=true) String id) { - - Result result = new Result(); - SysDepart sysDepart = sysDepartService.getById(id); - if(sysDepart==null) { - result.error500("未找到对应实体"); - }else { - sysDepartService.deleteDepart(id); - //清除部门树内存 - //FindsDepartsChildrenUtil.clearSysDepartTreeList(); - // FindsDepartsChildrenUtil.clearDepartIdModel(); - result.success("删除成功!"); - } - return result; - } - - - /** - * 批量删除 根据前端请求的多个ID,对数据库执行删除相关部门数据的操作 - * - * @param ids - * @return - */ + @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true) + public Result delete(@RequestParam(name = "id", required = true) String id) { + + Result result = new Result(); + SysDepart sysDepart = sysDepartService.getById(id); + if (sysDepart == null) { + result.error500("未找到对应实体"); + } else { + sysDepartService.deleteDepart(id); + //清除部门树内存 + //FindsDepartsChildrenUtil.clearSysDepartTreeList(); + // FindsDepartsChildrenUtil.clearDepartIdModel(); + result.success("删除成功!"); + } + return result; + } + + + /** + * 批量删除 根据前端请求的多个ID,对数据库执行删除相关部门数据的操作 + * + * @param ids + * @return + */ @RequiresPermissions("system:depart:deleteBatch") - @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE) - @CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) - public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { - - Result result = new Result(); - if (ids == null || "".equals(ids.trim())) { - result.error500("参数不识别!"); - } else { - this.sysDepartService.deleteBatchWithChildren(Arrays.asList(ids.split(","))); - result.success("删除成功!"); - } - return result; - } - - /** - * 查询数据 添加或编辑页面对该方法发起请求,以树结构形式加载所有部门的名称,方便用户的操作 - * - * @return - */ - @RequestMapping(value = "/queryIdTree", method = RequestMethod.GET) - public Result> queryIdTree() { + @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE) + @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true) + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + + Result result = new Result(); + if (ids == null || "".equals(ids.trim())) { + result.error500("参数不识别!"); + } else { + this.sysDepartService.deleteBatchWithChildren(Arrays.asList(ids.split(","))); + result.success("删除成功!"); + } + return result; + } + + /** + * 查询数据 添加或编辑页面对该方法发起请求,以树结构形式加载所有部门的名称,方便用户的操作 + * + * @return + */ + @RequestMapping(value = "/queryIdTree", method = RequestMethod.GET) + public Result> queryIdTree() { // Result> result = new Result>(); // List idList; // try { @@ -350,102 +380,102 @@ public class SysDepartController { // result.setSuccess(false); // return result; // } - Result> result = new Result<>(); - try { - List list = sysDepartService.queryDepartIdTreeList(); - result.setResult(list); - result.setSuccess(true); - } catch (Exception e) { - log.error(e.getMessage(),e); - } - return result; - } - - /** - *

- * 部门搜索功能方法,根据关键字模糊搜索相关部门 - *

- * - * @param keyWord - * @return - */ - @RequestMapping(value = "/searchBy", method = RequestMethod.GET) - public Result> searchBy(@RequestParam(name = "keyWord", required = true) String keyWord,@RequestParam(name = "myDeptSearch", required = false) String myDeptSearch) { - Result> result = new Result>(); - //部门查询,myDeptSearch为1时为我的部门查询,登录用户为上级时查只查负责部门下数据 - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String departIds = null; - if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals( CommonConstant.USER_IDENTITY_2 )){ - departIds = user.getDepartIds(); - } - List treeList = this.sysDepartService.searchByKeyWord(keyWord,myDeptSearch,departIds); - if (treeList == null || treeList.size() == 0) { - result.setSuccess(false); - result.setMessage("未查询匹配数据!"); - return result; - } - result.setResult(treeList); - return result; - } - - - /** + Result> result = new Result<>(); + try { + List list = sysDepartService.queryDepartIdTreeList(); + result.setResult(list); + result.setSuccess(true); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return result; + } + + /** + *

+ * 部门搜索功能方法,根据关键字模糊搜索相关部门 + *

+ * + * @param keyWord + * @return + */ + @RequestMapping(value = "/searchBy", method = RequestMethod.GET) + public Result> searchBy(@RequestParam(name = "keyWord", required = true) String keyWord, @RequestParam(name = "myDeptSearch", required = false) String myDeptSearch) { + Result> result = new Result>(); + //部门查询,myDeptSearch为1时为我的部门查询,登录用户为上级时查只查负责部门下数据 + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String departIds = null; + if (oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals(CommonConstant.USER_IDENTITY_2)) { + departIds = user.getDepartIds(); + } + List treeList = this.sysDepartService.searchByKeyWord(keyWord, myDeptSearch, departIds); + if (treeList == null || treeList.size() == 0) { + result.setSuccess(false); + result.setMessage("未查询匹配数据!"); + return result; + } + result.setResult(treeList); + return result; + } + + + /** * 导出excel * * @param request */ @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(SysDepart sysDepart,HttpServletRequest request) { - //------------------------------------------------------------------------------------------------ - //是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】 - if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){ - sysDepart.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0)); - } - //------------------------------------------------------------------------------------------------ - - //update-begin---author:wangshuai---date:2023-10-19---for:【QQYUN-5482】系统的部门导入导出也可以改成敲敲云模式的部门路径--- - //// Step.1 组装查询条件 - //QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap()); - //Step.1 AutoPoi 导出Excel - ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + public ModelAndView exportXls(SysDepart sysDepart, HttpServletRequest request) { + //------------------------------------------------------------------------------------------------ + //是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】 + if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) { + sysDepart.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0)); + } + //------------------------------------------------------------------------------------------------ + + //update-begin---author:wangshuai---date:2023-10-19---for:【QQYUN-5482】系统的部门导入导出也可以改成敲敲云模式的部门路径--- + //// Step.1 组装查询条件 + //QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap()); + //Step.1 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); //List pageList = sysDepartService.list(queryWrapper); //按字典排序 //Collections.sort(pageList, new Comparator() { - //@Override - //public int compare(SysDepart arg0, SysDepart arg1) { - //return arg0.getOrgCode().compareTo(arg1.getOrgCode()); - //} - //}); - // 过滤选中数据 - String selections = request.getParameter("selections"); - List idList = new ArrayList<>(); - if (oConvertUtils.isNotEmpty(selections)) { - idList = Arrays.asList(selections.split(",")); - } - //step.2 组装导出数据 - Integer tenantId = sysDepart == null ? null : sysDepart.getTenantId(); - //update-begin---author:wangshuai---date:2024-07-05---for:【TV360X-1671】部门管理不支持选中的记录导出--- - List sysDepartExportVos = sysDepartService.getExportDepart(tenantId,idList); - //update-end---author:wangshuai---date:2024-07-05---for:【TV360X-1671】部门管理不支持选中的记录导出--- + //@Override + //public int compare(SysDepart arg0, SysDepart arg1) { + //return arg0.getOrgCode().compareTo(arg1.getOrgCode()); + //} + //}); + // 过滤选中数据 + String selections = request.getParameter("selections"); + List idList = new ArrayList<>(); + if (oConvertUtils.isNotEmpty(selections)) { + idList = Arrays.asList(selections.split(",")); + } + //step.2 组装导出数据 + Integer tenantId = sysDepart == null ? null : sysDepart.getTenantId(); + //update-begin---author:wangshuai---date:2024-07-05---for:【TV360X-1671】部门管理不支持选中的记录导出--- + List sysDepartExportVos = sysDepartService.getExportDepart(tenantId, idList); + //update-end---author:wangshuai---date:2024-07-05---for:【TV360X-1671】部门管理不支持选中的记录导出--- //导出文件名称 mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表"); mv.addObject(NormalExcelConstants.CLASS, SysDepartExportVo.class); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("导入规则:\n" + - "1、标题为第三行,部门路径和部门名称的标题不允许修改,否则会匹配失败;第四行为数据填写范围;\n" + - "2、部门路径用英文字符/分割,部门名称为部门路径的最后一位;\n" + - "3、部门从一级名称开始创建,如果有同级就需要多添加一行,如研发部/研发一部;研发部/研发二部;\n" + - "4、自定义的部门编码需要满足规则才能导入。如一级部门编码为A01,那么子部门为A01A01,同级子部门为A01A02,编码固定为三位,首字母为A-Z,后两位为数字0-99,依次递增;", "导出人:"+user.getRealname(), "导出信息")); + "1、标题为第三行,部门路径和部门名称的标题不允许修改,否则会匹配失败;第四行为数据填写范围;\n" + + "2、部门路径用英文字符/分割,部门名称为部门路径的最后一位;\n" + + "3、部门从一级名称开始创建,如果有同级就需要多添加一行,如研发部/研发一部;研发部/研发二部;\n" + + "4、自定义的部门编码需要满足规则才能导入。如一级部门编码为A01,那么子部门为A01A01,同级子部门为A01A02,编码固定为三位,首字母为A-Z,后两位为数字0-99,依次递增;", "导出人:" + user.getRealname(), "导出信息")); mv.addObject(NormalExcelConstants.DATA_LIST, sysDepartExportVos); - //update-end---author:wangshuai---date:2023-10-19---for:【QQYUN-5482】系统的部门导入导出也可以改成敲敲云模式的部门路径--- + //update-end---author:wangshuai---date:2023-10-19---for:【QQYUN-5482】系统的部门导入导出也可以改成敲敲云模式的部门路径--- - return mv; + return mv; } /** * 通过excel导入数据 - * 部门导入方案1: 通过机构编码来计算出部门的父级ID,维护上下级关系; - * 部门导入方案2: 你也可以改造下程序,机构编码直接导入,先不设置父ID;全部导入后,写一个sql,补下父ID; + * 部门导入方案1: 通过机构编码来计算出部门的父级ID,维护上下级关系; + * 部门导入方案2: 你也可以改造下程序,机构编码直接导入,先不设置父ID;全部导入后,写一个sql,补下父ID; * * @param request * @param response @@ -453,12 +483,12 @@ public class SysDepartController { */ @RequiresPermissions("system:depart:importExcel") @RequestMapping(value = "/importExcel", method = RequestMethod.POST) - @CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) + @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true) public Result importExcel(HttpServletRequest request, HttpServletResponse response) { MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; - List errorMessageList = new ArrayList<>(); - //List listSysDeparts = null; - List listSysDeparts = null; + List errorMessageList = new ArrayList<>(); + //List listSysDeparts = null; + List listSysDeparts = null; Map fileMap = multipartRequest.getFileMap(); for (Map.Entry entity : fileMap.entrySet()) { // 获取上传文件对象 @@ -468,7 +498,7 @@ public class SysDepartController { params.setHeadRows(1); params.setNeedSave(true); try { - //update-begin---author:wangshuai---date:2023-10-20---for: 注释掉原来的导入部门的逻辑--- + //update-begin---author:wangshuai---date:2023-10-20---for: 注释掉原来的导入部门的逻辑--- // // orgCode编码长度 // int codeLength = YouBianCodeUtil.ZHANWEI_LENGTH; // listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepart.class, params); @@ -514,22 +544,22 @@ public class SysDepartController { // ImportExcelUtil.importDateSaveOne(sysDepart, ISysDepartService.class, errorMessageList, num, CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE); // num++; // } - //update-end---author:wangshuai---date:2023-10-20---for: 注释掉原来的导入部门的逻辑--- - - //update-begin---author:wangshuai---date:2023-10-19---for:【QQYUN-5482】系统的部门导入导出也可以改成敲敲云模式的部门路径--- - listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepartExportVo.class, params); - sysDepartService.importSysDepart(listSysDeparts,errorMessageList); - //update-end---author:wangshuai---date:2023-10-19---for:【QQYUN-5482】系统的部门导入导出也可以改成敲敲云模式的部门路径--- - - //清空部门缓存 - Set keys3 = redisTemplate.keys(CacheConstant.SYS_DEPARTS_CACHE + "*"); - Set keys4 = redisTemplate.keys(CacheConstant.SYS_DEPART_IDS_CACHE + "*"); - redisTemplate.delete(keys3); - redisTemplate.delete(keys4); - return ImportExcelUtil.imporReturnRes(errorMessageList.size(), listSysDeparts.size() - errorMessageList.size(), errorMessageList); + //update-end---author:wangshuai---date:2023-10-20---for: 注释掉原来的导入部门的逻辑--- + + //update-begin---author:wangshuai---date:2023-10-19---for:【QQYUN-5482】系统的部门导入导出也可以改成敲敲云模式的部门路径--- + listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepartExportVo.class, params); + sysDepartService.importSysDepart(listSysDeparts, errorMessageList); + //update-end---author:wangshuai---date:2023-10-19---for:【QQYUN-5482】系统的部门导入导出也可以改成敲敲云模式的部门路径--- + + //清空部门缓存 + Set keys3 = redisTemplate.keys(CacheConstant.SYS_DEPARTS_CACHE + "*"); + Set keys4 = redisTemplate.keys(CacheConstant.SYS_DEPART_IDS_CACHE + "*"); + redisTemplate.delete(keys3); + redisTemplate.delete(keys4); + return ImportExcelUtil.imporReturnRes(errorMessageList.size(), listSysDeparts.size() - errorMessageList.size(), errorMessageList); } catch (Exception e) { - log.error(e.getMessage(),e); - return Result.error("文件导入失败:"+e.getMessage()); + log.error(e.getMessage(), e); + return Result.error("文件导入失败:" + e.getMessage()); } finally { try { file.getInputStream().close(); @@ -542,197 +572,201 @@ public class SysDepartController { } - /** - * 查询所有部门信息 - * @return - */ - @GetMapping("listAll") - public Result> listAll(@RequestParam(name = "id", required = false) String id) { - Result> result = new Result<>(); - LambdaQueryWrapper query = new LambdaQueryWrapper(); - query.orderByAsc(SysDepart::getOrgCode); - if(oConvertUtils.isNotEmpty(id)){ - String[] arr = id.split(","); - query.in(SysDepart::getId,arr); - } - List ls = this.sysDepartService.list(query); - result.setSuccess(true); - result.setResult(ls); - return result; - } - /** - * 查询数据 查出所有部门,并以树结构数据格式响应给前端 - * - * @return - */ - @RequestMapping(value = "/queryTreeByKeyWord", method = RequestMethod.GET) - public Result> queryTreeByKeyWord(@RequestParam(name = "keyWord", required = false) String keyWord) { - Result> result = new Result<>(); - try { - Map map=new HashMap(5); - List list = sysDepartService.queryTreeByKeyWord(keyWord); - //根据keyWord获取用户信息 - LambdaQueryWrapper queryUser = new LambdaQueryWrapper(); - queryUser.eq(SysUser::getDelFlag,CommonConstant.DEL_FLAG_0); - queryUser.and(i -> i.like(SysUser::getUsername, keyWord).or().like(SysUser::getRealname, keyWord)); - List sysUsers = this.sysUserService.list(queryUser); - map.put("userList",sysUsers); - map.put("departList",list); - result.setResult(map); - result.setSuccess(true); - } catch (Exception e) { - log.error(e.getMessage(),e); - } - return result; - } - - /** - * 根据部门编码获取部门信息 - * - * @param orgCode - * @return - */ - @GetMapping("/getDepartName") - public Result getDepartName(@RequestParam(name = "orgCode") String orgCode) { - Result result = new Result<>(); - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.eq(SysDepart::getOrgCode, orgCode); - SysDepart sysDepart = sysDepartService.getOne(query); - result.setSuccess(true); - result.setResult(sysDepart); - return result; - } - - /** - * 根据部门id获取用户信息 - * - * @param id - * @return - */ - @GetMapping("/getUsersByDepartId") - public Result> getUsersByDepartId(@RequestParam(name = "id") String id) { - Result> result = new Result<>(); - List sysUsers = sysUserDepartService.queryUserByDepId(id); - result.setSuccess(true); - result.setResult(sysUsers); - return result; - } - - /** - * @功能:根据id 批量查询 - * @param deptIds - * @return - */ - @RequestMapping(value = "/queryByIds", method = RequestMethod.GET) - public Result> queryByIds(@RequestParam(name = "deptIds") String deptIds) { - Result> result = new Result<>(); - String[] ids = deptIds.split(","); - Collection idList = Arrays.asList(ids); - Collection deptList = sysDepartService.listByIds(idList); - result.setSuccess(true); - result.setResult(deptList); - return result; - } - - @GetMapping("/getMyDepartList") - public Result> getMyDepartList(){ + /** + * 查询所有部门信息 + * + * @return + */ + @GetMapping("listAll") + public Result> listAll(@RequestParam(name = "id", required = false) String id) { + Result> result = new Result<>(); + LambdaQueryWrapper query = new LambdaQueryWrapper(); + query.orderByAsc(SysDepart::getOrgCode); + if (oConvertUtils.isNotEmpty(id)) { + String[] arr = id.split(","); + query.in(SysDepart::getId, arr); + } + List ls = this.sysDepartService.list(query); + result.setSuccess(true); + result.setResult(ls); + return result; + } + + /** + * 查询数据 查出所有部门,并以树结构数据格式响应给前端 + * + * @return + */ + @RequestMapping(value = "/queryTreeByKeyWord", method = RequestMethod.GET) + public Result> queryTreeByKeyWord(@RequestParam(name = "keyWord", required = false) String keyWord) { + Result> result = new Result<>(); + try { + Map map = new HashMap(5); + List list = sysDepartService.queryTreeByKeyWord(keyWord); + //根据keyWord获取用户信息 + LambdaQueryWrapper queryUser = new LambdaQueryWrapper(); + queryUser.eq(SysUser::getDelFlag, CommonConstant.DEL_FLAG_0); + queryUser.and(i -> i.like(SysUser::getUsername, keyWord).or().like(SysUser::getRealname, keyWord)); + List sysUsers = this.sysUserService.list(queryUser); + map.put("userList", sysUsers); + map.put("departList", list); + result.setResult(map); + result.setSuccess(true); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return result; + } + + /** + * 根据部门编码获取部门信息 + * + * @param orgCode + * @return + */ + @GetMapping("/getDepartName") + public Result getDepartName(@RequestParam(name = "orgCode") String orgCode) { + Result result = new Result<>(); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(SysDepart::getOrgCode, orgCode); + SysDepart sysDepart = sysDepartService.getOne(query); + result.setSuccess(true); + result.setResult(sysDepart); + return result; + } + + /** + * 根据部门id获取用户信息 + * + * @param id + * @return + */ + @GetMapping("/getUsersByDepartId") + public Result> getUsersByDepartId(@RequestParam(name = "id") String id) { + Result> result = new Result<>(); + List sysUsers = sysUserDepartService.queryUserByDepId(id); + result.setSuccess(true); + result.setResult(sysUsers); + return result; + } + + /** + * @param deptIds + * @return + * @功能:根据id 批量查询 + */ + @RequestMapping(value = "/queryByIds", method = RequestMethod.GET) + public Result> queryByIds(@RequestParam(name = "deptIds") String deptIds) { + Result> result = new Result<>(); + String[] ids = deptIds.split(","); + Collection idList = Arrays.asList(ids); + Collection deptList = sysDepartService.listByIds(idList); + result.setSuccess(true); + result.setResult(deptList); + return result; + } + + @GetMapping("/getMyDepartList") + public Result> getMyDepartList() { List list = sysDepartService.getMyDepartList(); return Result.ok(list); } - /** - * 异步查询部门list - * @param parentId 父节点 异步加载时传递 - * @return - */ - @RequestMapping(value = "/queryBookDepTreeSync", method = RequestMethod.GET) - public Result> queryBookDepTreeSync(@RequestParam(name = "pid", required = false) String parentId, - @RequestParam(name = "tenantId") Integer tenantId, - @RequestParam(name = "departName",required = false) String departName) { - Result> result = new Result<>(); - try { - List list = sysDepartService.queryBookDepTreeSync(parentId, tenantId, departName); - result.setResult(list); - result.setSuccess(true); - } catch (Exception e) { - log.error(e.getMessage(),e); - } - return result; - } - - /** - * 通过部门id和租户id获取用户 【低代码应用: 用于选择部门负责人】 - * @param departId - * @return - */ - @GetMapping("/getUsersByDepartTenantId") - public Result> getUsersByDepartTenantId(@RequestParam("departId") String departId){ - int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0); - List sysUserList = sysUserDepartService.getUsersByDepartTenantId(departId,tenantId); - return Result.ok(sysUserList); - } - - /** - * 导出excel【低代码应用: 用于导出部门】 - * - * @param request - */ - @RequestMapping(value = "/appExportXls") - public ModelAndView appExportXls(SysDepart sysDepart,HttpServletRequest request) { - // Step.1 组装查询条件 - int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0); - ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); - List pageList = sysDepartService.getExcelDepart(tenantId); - //Step.2 AutoPoi 导出Excel - //导出文件名称 - mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表"); - mv.addObject(NormalExcelConstants.CLASS, ExportDepartVo.class); - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息")); - mv.addObject(NormalExcelConstants.DATA_LIST, pageList); - return mv; - } - - /** - * 导入excel【低代码应用: 用于导出部门】 - * - * @param request - */ - @RequestMapping(value = "/appImportExcel", method = RequestMethod.POST) - @CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) - public Result appImportExcel(HttpServletRequest request, HttpServletResponse response) { - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; - List errorMessageList = new ArrayList<>(); - List listSysDeparts = null; - Map fileMap = multipartRequest.getFileMap(); - for (Map.Entry entity : fileMap.entrySet()) { - // 获取上传文件对象 - MultipartFile file = entity.getValue(); - ImportParams params = new ImportParams(); - params.setTitleRows(2); - params.setHeadRows(1); - params.setNeedSave(true); - try { - listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), ExportDepartVo.class, params); - sysDepartService.importExcel(listSysDeparts,errorMessageList); - //清空部门缓存 - Set keys3 = redisTemplate.keys(CacheConstant.SYS_DEPARTS_CACHE + "*"); - Set keys4 = redisTemplate.keys(CacheConstant.SYS_DEPART_IDS_CACHE + "*"); - redisTemplate.delete(keys3); - redisTemplate.delete(keys4); - return ImportExcelUtil.imporReturnRes(errorMessageList.size(), listSysDeparts.size() - errorMessageList.size(), errorMessageList); - } catch (Exception e) { - log.error(e.getMessage(),e); - return Result.error("文件导入失败:"+e.getMessage()); - } finally { - try { - file.getInputStream().close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - return Result.error("文件导入失败!"); - } + /** + * 异步查询部门list + * + * @param parentId 父节点 异步加载时传递 + * @return + */ + @RequestMapping(value = "/queryBookDepTreeSync", method = RequestMethod.GET) + public Result> queryBookDepTreeSync(@RequestParam(name = "pid", required = false) String parentId, + @RequestParam(name = "tenantId") Integer tenantId, + @RequestParam(name = "departName", required = false) String departName) { + Result> result = new Result<>(); + try { + List list = sysDepartService.queryBookDepTreeSync(parentId, tenantId, departName); + result.setResult(list); + result.setSuccess(true); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return result; + } + + /** + * 通过部门id和租户id获取用户 【低代码应用: 用于选择部门负责人】 + * + * @param departId + * @return + */ + @GetMapping("/getUsersByDepartTenantId") + public Result> getUsersByDepartTenantId(@RequestParam("departId") String departId) { + int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0); + List sysUserList = sysUserDepartService.getUsersByDepartTenantId(departId, tenantId); + return Result.ok(sysUserList); + } + + /** + * 导出excel【低代码应用: 用于导出部门】 + * + * @param request + */ + @RequestMapping(value = "/appExportXls") + public ModelAndView appExportXls(SysDepart sysDepart, HttpServletRequest request) { + // Step.1 组装查询条件 + int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0); + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + List pageList = sysDepartService.getExcelDepart(tenantId); + //Step.2 AutoPoi 导出Excel + //导出文件名称 + mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表"); + mv.addObject(NormalExcelConstants.CLASS, ExportDepartVo.class); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:" + user.getRealname(), "导出信息")); + mv.addObject(NormalExcelConstants.DATA_LIST, pageList); + return mv; + } + + /** + * 导入excel【低代码应用: 用于导出部门】 + * + * @param request + */ + @RequestMapping(value = "/appImportExcel", method = RequestMethod.POST) + @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true) + public Result appImportExcel(HttpServletRequest request, HttpServletResponse response) { + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + List errorMessageList = new ArrayList<>(); + List listSysDeparts = null; + Map fileMap = multipartRequest.getFileMap(); + for (Map.Entry entity : fileMap.entrySet()) { + // 获取上传文件对象 + MultipartFile file = entity.getValue(); + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), ExportDepartVo.class, params); + sysDepartService.importExcel(listSysDeparts, errorMessageList); + //清空部门缓存 + Set keys3 = redisTemplate.keys(CacheConstant.SYS_DEPARTS_CACHE + "*"); + Set keys4 = redisTemplate.keys(CacheConstant.SYS_DEPART_IDS_CACHE + "*"); + redisTemplate.delete(keys3); + redisTemplate.delete(keys4); + return ImportExcelUtil.imporReturnRes(errorMessageList.size(), listSysDeparts.size() - errorMessageList.size(), errorMessageList); + } catch (Exception e) { + log.error(e.getMessage(), e); + return Result.error("文件导入失败:" + e.getMessage()); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return Result.error("文件导入失败!"); + } } diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/SysUser.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/SysUser.java index 819c042..7a935fb 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/SysUser.java +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/SysUser.java @@ -222,4 +222,7 @@ public class SysUser implements Serializable { */ @TableField(exist = false) private boolean izBindThird; + + @TableField(exist = false) + private String roleCode; } diff --git a/jeecgboot-vue3/src/locales/lang/zh-CN/sys.ts b/jeecgboot-vue3/src/locales/lang/zh-CN/sys.ts index c289061..4685ac2 100644 --- a/jeecgboot-vue3/src/locales/lang/zh-CN/sys.ts +++ b/jeecgboot-vue3/src/locales/lang/zh-CN/sys.ts @@ -89,13 +89,16 @@ export default { // placeholder accountPlaceholder: '请输入账号', passwordPlaceholder: '请输入密码', + passwordPlaceholderNotReg: '密码格式不对(包含字母(大小写)数字以及特殊字符,至少8位)', inputCodePlaceholder: '请输入验证码', smsPlaceholder: '请输入验证码', mobilePlaceholder: '请输入手机号码', + mobilePlaceholderNotReg: '手机号格式不对', mobileCorrectPlaceholder: '请输入正确的手机号码', policyPlaceholder: '勾选后才能注册', diffPwd: '两次输入密码不一致', selectorgPlaceholder: '请选择所属单位', + selectorgPlaceholder4Kejiju: '请选择科技主管部门', realNamePlaceholder: '请输入姓名', workNoPlaceholder: '请输入工号', diff --git a/jeecgboot-vue3/src/views/dashboard/workbench/components/DynamicInfo.vue b/jeecgboot-vue3/src/views/dashboard/workbench/components/DynamicInfo.vue index eb187f2..6e6bfdc 100644 --- a/jeecgboot-vue3/src/views/dashboard/workbench/components/DynamicInfo.vue +++ b/jeecgboot-vue3/src/views/dashboard/workbench/components/DynamicInfo.vue @@ -1,5 +1,5 @@ diff --git a/jeecgboot-vue3/src/views/dashboard/workbench/components/api.ts b/jeecgboot-vue3/src/views/dashboard/workbench/components/api.ts index 0471a18..e549753 100644 --- a/jeecgboot-vue3/src/views/dashboard/workbench/components/api.ts +++ b/jeecgboot-vue3/src/views/dashboard/workbench/components/api.ts @@ -8,6 +8,13 @@ enum Api { zclist = '/expert/expert/expdatanumberzc', lyzjlist = '/expert/expert/expdatanumberdiffect', yclist= '/expert/expert/expdatanumberyc', + pronumber= '/expert/expert/projectnumber', + findprojectandnumberapi= '/expert/expert/findprojectandnumber', + expdatanumberycxjapi= '/expert/expert/expdatanumberycxj', + expdatanumberycccapi= '/expert/expert/expdatanumberyccc', + expdatanumberycqtapi= '/expert/expert/expdatanumberycqt', + expdatawtjshapi= '/expert/expert/expdatawtjsh', + expdatayishapi= '/expert/expert/expdatayish', } export function getDataListApi() { @@ -26,3 +33,28 @@ export function getDataListApiyc() { export function expdatanumberdiffect() { return defHttp.get({ url: Api.lyzjlist }); } +export function projectnumber() { + return defHttp.get({ url: Api.pronumber }); +} + +export function findprojectandnumber() { + return defHttp.get({ url: Api.findprojectandnumberapi }); +} + +export function expdatanumberycxj() { + return defHttp.get({ url: Api.expdatanumberycxjapi }); +} + +export function expdatanumberyccc() { + return defHttp.get({ url: Api.expdatanumberycccapi }); +} + +export function expdatanumberycqt() { + return defHttp.get({ url: Api.expdatanumberycqtapi }); +} +export function expdatawtjsh() { + return defHttp.get({ url: Api.expdatawtjshapi }); +} +export function expdatayish() { + return defHttp.get({ url: Api.expdatayishapi }); +} diff --git a/jeecgboot-vue3/src/views/dashboard/workbench/components/data.ts b/jeecgboot-vue3/src/views/dashboard/workbench/components/data.ts index 50a5756..0c7ec98 100644 --- a/jeecgboot-vue3/src/views/dashboard/workbench/components/data.ts +++ b/jeecgboot-vue3/src/views/dashboard/workbench/components/data.ts @@ -51,6 +51,16 @@ export const navItems: NavItem[] = [ icon: 'ion:bar-chart-outline', color: '#00d8ff', }, + { + title: '权限管理', + icon: 'ion:key-outline', + color: '#4daf1bc9', + }, + { + title: '图表', + icon: 'ion:bar-chart-outline', + color: '#00d8ff', + }, ]; export const dynamicInfoItems: DynamicInfoItem[] = [ diff --git a/jeecgboot-vue3/src/views/declarant/user.data.ts b/jeecgboot-vue3/src/views/declarant/user.data.ts index 3a80a8b..859d818 100644 --- a/jeecgboot-vue3/src/views/declarant/user.data.ts +++ b/jeecgboot-vue3/src/views/declarant/user.data.ts @@ -175,7 +175,7 @@ export const formSchema: FormSchema[] = [ required: true, component: 'Input', }, - { + /*{ label: '工号', field: 'workNo', required: true, @@ -190,7 +190,7 @@ export const formSchema: FormSchema[] = [ componentProps: { labelKey: 'name', }, - }, + },*/ { label: '角色', field: 'selectedroles', @@ -234,7 +234,7 @@ export const formSchema: FormSchema[] = [ }; }, }, - { + /*{ label: '租户', field: 'relTenantIds', component: 'ApiSelect', @@ -263,8 +263,8 @@ export const formSchema: FormSchema[] = [ }, }; }, - }, - { + },*/ + /*{ label: '负责部门', field: 'departIds', component: 'Select', @@ -272,7 +272,7 @@ export const formSchema: FormSchema[] = [ mode: 'multiple', }, ifShow: ({ values }) => values.userIdentity == 2, - }, + },*/ { label: '头像', field: 'avatar', @@ -320,13 +320,13 @@ export const formSchema: FormSchema[] = [ ]; }, }, - { + /*{ label: '座机', field: 'telephone', component: 'Input', rules: [{ pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '请输入正确的座机号码' }], - }, - { + },*/ + /*{ label: '工作流引擎', field: 'activitiSync', defaultValue: 1, @@ -336,7 +336,7 @@ export const formSchema: FormSchema[] = [ type: 'radio', stringToNumber: true, }, - }, + },*/ ]; export const formPasswordSchema: FormSchema[] = [ diff --git a/jeecgboot-vue3/src/views/declarantUnit/declarantUnitList.vue b/jeecgboot-vue3/src/views/declarantUnit/declarantUnitList.vue index 2518599..e1098b0 100644 --- a/jeecgboot-vue3/src/views/declarantUnit/declarantUnitList.vue +++ b/jeecgboot-vue3/src/views/declarantUnit/declarantUnitList.vue @@ -58,6 +58,8 @@ import {useMessage} from "@/hooks/web/useMessage"; const queryParam = reactive({}); const checkedKeys = ref>([]); const userStore = useUserStore(); +// console.log("userStore.getUserInfo---",JSON.stringify(userStore.getUserInfo)) +// console.log("userStore.getRoleList---",userStore.getRoleList) const {createMessage, createConfirm} = useMessage(); //注册model @@ -180,7 +182,7 @@ function getTableAction(record) { // }, { label: '驳回', - ifShow: record.status == 1, + ifShow: userStore.getUserInfo.roleCode !='faren_admin' && record.status == 1, popConfirm: { title: '确定驳回吗?', confirm: handleFrozen.bind(null, record, 0), @@ -188,7 +190,7 @@ function getTableAction(record) { }, { label: '通过', - ifShow: record.status == 0, + ifShow: userStore.getUserInfo.roleCode !='faren_admin' && record.status == 0, popConfirm: { title: '确定通过吗?', confirm: handleFrozen.bind(null, record, 1), @@ -196,6 +198,7 @@ function getTableAction(record) { }, { label: '删除', + ifShow: userStore.getUserInfo.roleCode !='faren_admin', popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record), diff --git a/jeecgboot-vue3/src/views/expert/adminback/Expert.api.ts b/jeecgboot-vue3/src/views/expert/adminback/Expert.api.ts index 0fca733..deff48b 100644 --- a/jeecgboot-vue3/src/views/expert/adminback/Expert.api.ts +++ b/jeecgboot-vue3/src/views/expert/adminback/Expert.api.ts @@ -4,7 +4,7 @@ import { useMessage } from "/src/hooks/web/useMessage"; const { createConfirm } = useMessage(); enum Api { - list = '/expert/expert/listadmin', + list = '/expert/expert/listadminstatic', save='/expert/expert/add', edit='/expert/expert/edit', deleteOne = '/expert/expert/delete', diff --git a/jeecgboot-vue3/src/views/system/depart/components/DepartLeftTree.vue b/jeecgboot-vue3/src/views/system/depart/components/DepartLeftTree.vue index b2cc48c..fccda7e 100644 --- a/jeecgboot-vue3/src/views/system/depart/components/DepartLeftTree.vue +++ b/jeecgboot-vue3/src/views/system/depart/components/DepartLeftTree.vue @@ -3,9 +3,9 @@
新增 添加下级 - + 导出 @@ -92,10 +92,11 @@ import { useModal } from '/@/components/Modal'; import { useMessage } from '/@/hooks/web/useMessage'; import { useMethods } from '/@/hooks/system/useMethods'; - import { Api, deleteBatchDepart, queryDepartTreeSync } from '../depart.api'; + import { Api, deleteBatchDepart, queryDepartTreeSync4ZhuGuanBuMen } from '../depart.api'; import { searchByKeywords } from '/@/views/system/departUser/depart.user.api'; import DepartFormModal from '/@/views/system/depart/components/DepartFormModal.vue'; import { Popconfirm } from 'ant-design-vue'; + import {useUserStore} from "@/store/modules/user"; const prefixCls = inject('prefixCls'); const emit = defineEmits(['select', 'rootTreeData']); @@ -124,13 +125,16 @@ // 注册 modal const [registerModal, { openModal }] = useModal(); + const userStore = useUserStore(); // 加载顶级部门信息 async function loadRootTreeData() { try { loading.value = true; treeData.value = []; - const result = await queryDepartTreeSync(); + const result = await queryDepartTreeSync4ZhuGuanBuMen({ + parentOrgCode: userStore.getUserInfo.orgCode, + }); if (Array.isArray(result)) { treeData.value = result; } @@ -158,8 +162,9 @@ // 加载子级部门信息 async function loadChildrenTreeData(treeNode) { try { - const result = await queryDepartTreeSync({ - pid: treeNode.dataRef.id, + const result = await queryDepartTreeSync4ZhuGuanBuMen({ + // pid: treeNode.dataRef.id, + parentOrgCode: treeNode.dataRef.orgCode, }); if (result.length == 0) { treeNode.dataRef.isLeaf = true; diff --git a/jeecgboot-vue3/src/views/system/depart/depart.api.ts b/jeecgboot-vue3/src/views/system/depart/depart.api.ts index f224f49..53fcaae 100644 --- a/jeecgboot-vue3/src/views/system/depart/depart.api.ts +++ b/jeecgboot-vue3/src/views/system/depart/depart.api.ts @@ -6,6 +6,7 @@ const { createConfirm } = useMessage(); export enum Api { queryDepartTreeSync = '/sys/sysDepart/queryDepartTreeSync', + queryDepartTreeSync4ZhuGuanBuMen = '/sys/sysDepart/queryDepartTreeSync4ZhuGuanBuMen', save = '/sys/sysDepart/add', edit = '/sys/sysDepart/edit', delete = '/sys/sysDepart/delete', @@ -31,6 +32,9 @@ export enum Api { */ export const queryDepartTreeSync = (params?) => defHttp.get({ url: Api.queryDepartTreeSync, params }); +// 根据当前登录角色查询 主管部门数据 add by zhc 11.09 +export const queryDepartTreeSync4ZhuGuanBuMen = (params?) => defHttp.get({ url: Api.queryDepartTreeSync4ZhuGuanBuMen, params }); + /** * 保存或者更新部门角色 */ diff --git a/jeecgboot-vue3/src/views/system/depart/depart.data.ts b/jeecgboot-vue3/src/views/system/depart/depart.data.ts index 9e0346e..8aa40a3 100644 --- a/jeecgboot-vue3/src/views/system/depart/depart.data.ts +++ b/jeecgboot-vue3/src/views/system/depart/depart.data.ts @@ -81,10 +81,13 @@ export function useBasicFormSchema() { // 机构类型选项 export const orgCategoryOptions = { // 一级部门 - root: [{ value: '1', label: '公司' }], + // root: [{ value: '1', label: '公司' }], + root: [{ value: '1', label: '管理单位' }], // 子级部门 child: [ - { value: '2', label: '部门' }, - { value: '3', label: '岗位' }, + // { value: '2', label: '部门' }, + { value: '2', label: '直属法人单位' }, + // { value: '3', label: '岗位' }, + { value: '3', label: '县区法人单位' }, ], }; diff --git a/jeecgboot-vue3/src/views/system/departUser/depart.user.data.ts b/jeecgboot-vue3/src/views/system/departUser/depart.user.data.ts index 880fc18..b6b860e 100644 --- a/jeecgboot-vue3/src/views/system/departUser/depart.user.data.ts +++ b/jeecgboot-vue3/src/views/system/departUser/depart.user.data.ts @@ -163,11 +163,14 @@ export function useBaseInfoForm(treeData: Ref) { label: '机构类型', render(val) { if (val === '1') { - return '公司'; + // return '公司'; + return '管理单位'; } else if (val === '2') { - return '部门'; + // return '部门'; + return '直属法人单位'; } else if (val === '3') { - return '岗位'; + // return '岗位'; + return '县区法人单位'; } return val; }, diff --git a/jeecgboot-vue3/src/views/system/loginmini/MiniRegister4faren.vue b/jeecgboot-vue3/src/views/system/loginmini/MiniRegister4faren.vue index a6484e2..506adcf 100644 --- a/jeecgboot-vue3/src/views/system/loginmini/MiniRegister4faren.vue +++ b/jeecgboot-vue3/src/views/system/loginmini/MiniRegister4faren.vue @@ -3,9 +3,9 @@
-
+
@@ -41,7 +41,7 @@
- +
@@ -224,7 +224,7 @@ return; } if (!formData.department) { - createMessage.warn(t('sys.login.selectorgPlaceholder')); + createMessage.warn(t('sys.login.selectorgPlaceholder4Kejiju')); return; } if (!formData.username) { @@ -235,10 +235,21 @@ createMessage.warn(t('sys.login.mobilePlaceholder')); return; } + const phoneRegex = /^1[3-9]\d{9}$/; + if (!phoneRegex.test(formData.mobile)) { + createMessage.warn(t('sys.login.mobilePlaceholderNotReg')); + return; + } if (!formData.password) { createMessage.warn(t('sys.login.passwordPlaceholder')); return; } + //包含字母(大小写)、数字以及特殊字符,并且有一定的长度要求,至少 8 位 + const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@#$%^&+=!])(?=.{8,})$/; + if (!passwordRegex.test(formData.password)) { + createMessage.warn(t('sys.login.passwordPlaceholderNotReg')); + return; + } // if (!formData.workno) { // createMessage.warn(t('sys.login.passwordPlaceholder')); // return; diff --git a/jeecgboot-vue3/src/views/system/loginmini/MiniRegister4shenbaoren.vue b/jeecgboot-vue3/src/views/system/loginmini/MiniRegister4shenbaoren.vue index 5215e31..e3247dc 100644 --- a/jeecgboot-vue3/src/views/system/loginmini/MiniRegister4shenbaoren.vue +++ b/jeecgboot-vue3/src/views/system/loginmini/MiniRegister4shenbaoren.vue @@ -3,13 +3,13 @@
-
+
- +
{{t('sys.login.registerButton4shenbaoren')}}
@@ -42,7 +42,7 @@
- +
@@ -229,21 +229,28 @@ return; } if (!formData.department) { - createMessage.warn(t('sys.login.selectorgPlaceholder')); + createMessage.warn(t('sys.login.selectorgPlaceholder4Kejiju')); return; } if (!formData.mobile) { createMessage.warn(t('sys.login.mobilePlaceholder')); return; } + const phoneRegex = /^1[3-9]\d{9}$/; + if (!phoneRegex.test(formData.mobile)) { + createMessage.warn(t('sys.login.mobilePlaceholderNotReg')); + return; + } if (!formData.password) { createMessage.warn(t('sys.login.passwordPlaceholder')); return; } - // if (!formData.workno) { - // createMessage.warn(t('sys.login.passwordPlaceholder')); - // return; - // } + //包含字母(大小写)、数字以及特殊字符,并且有一定的长度要求,至少 8 位 + const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@#$%^&+=!])(?=.{8,})$/; + if (!passwordRegex.test(formData.password)) { + createMessage.warn(t('sys.login.passwordPlaceholderNotReg')); + return; + } if (!formData.confirmPassword) { createMessage.warn(t('sys.login.confirmPassword')); return; diff --git a/jeecgboot-vue3/types/store.d.ts b/jeecgboot-vue3/types/store.d.ts index 7b9349a..96e2661 100644 --- a/jeecgboot-vue3/types/store.d.ts +++ b/jeecgboot-vue3/types/store.d.ts @@ -40,6 +40,7 @@ export interface UserInfo { homePath?: string; tenantid?: string | number; roles: RoleInfo[]; + roleCode: string; orgCode?: string; }