fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DepotConfService.java
@@ -2,11 +2,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.fzzy.igds.constant.Constant; import com.fzzy.igds.constant.RedisConst; import com.fzzy.igds.domain.Depot; import com.fzzy.igds.domain.DepotConf; import com.fzzy.igds.mapper.DepotConfMapper; import com.fzzy.igds.utils.ContextUtil; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.StringUtils; import lombok.extern.slf4j.Slf4j; @@ -53,6 +55,35 @@ queryWrapper.eq("dept_id", deptId); } return depotConfMapper.selectList(queryWrapper); } /** * 根据用户类型查询配置信息 * @return */ public List<DepotConf> getConfListByUserType() { //获取当前登录人 SysUser user = ContextUtil.getLoginUser(); QueryWrapper<DepotConf> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("company_id", user.getCompanyId()); //监管用户-默认查看所有信息不增加条件 if (Constant.USER_TYPE_10.equals(user.getUserType())) { //不增加条件 } //银行用户,根据合同查询银行下所有库区 if (Constant.USER_TYPE_20.equals(user.getUserType())) { return this.getDeptByContract(user.getUserData()); } return null; } /** @@ -236,4 +267,6 @@ updateWrapper.eq("dept_id", ContextUtil.subDeptId(null)).set("pos_x", freq); depotConfMapper.update(null, updateWrapper); } } fzzy-igdss-view/src/main/java/com/fzzy/igds/DepotConfPR.java
@@ -32,7 +32,7 @@ */ @DataProvider public List<DepotConf> getConfList() { return depotConfService.getConfList(null, ContextUtil.subDeptId(null)); return depotConfService.getConfListByUserType(); } /** fzzy-igdss-view/src/main/java/com/fzzy/igds/DeptPR.java
@@ -23,13 +23,15 @@ private CoreDeptService coreDeptService; /** * * ${dorado.getDataProvider("deptPR#getDeptByUserType").getResult()} * 根据用户类型获取对应库区列表信息 * deptPR#getDeptByUserType * * @return */ @DataProvider public List<Dept> getDeptByUserType(String parentId) { return coreDeptService.getDeptByUserType(parentId); } fzzy-igdss-view/src/main/java/com/fzzy/work/WorkOrder.view.xml
@@ -72,6 +72,11 @@ <PropertyDef name="deptId"> <Property></Property> <Property name="label">所属库区</Property> <Property name="mapping"> <Property name="mapValues">${dorado.getDataProvider("deptPR#getDeptByUserType").getResult()}</Property> <Property name="keyProperty">id</Property> <Property name="valueProperty">kqmc</Property> </Property> </PropertyDef> </DataType> <DataType name="dtParam"> @@ -82,6 +87,11 @@ <PropertyDef name="deptId"> <Property></Property> <Property name="label">所属库区</Property> <Property name="mapping"> <Property name="mapValues">${dorado.getDataProvider("deptPR#getDeptByUserType").getResult()}</Property> <Property name="keyProperty">id</Property> <Property name="valueProperty">kqmc</Property> </Property> </PropertyDef> <PropertyDef name="name"> <Property></Property> @@ -103,13 +113,13 @@ <DataType name="dtWordProcess"> <Property name="creationType">com.fzzy.work.domain.WorkOrderProcess</Property> <PropertyDef name="orderId"> <Property/> <Property></Property> </PropertyDef> <PropertyDef name="action"> <Property/> <Property></Property> </PropertyDef> <PropertyDef name="remark"> <Property/> <Property></Property> </PropertyDef> </DataType> </Model> @@ -346,6 +356,7 @@ <AutoFormElement> <Property name="name">deptId</Property> <Property name="property">deptId</Property> <Property name="trigger">autoMappingDropDown2</Property> <Editor/> </AutoFormElement> <AutoFormElement> fzzy-igdss-web/src/main/java/com/fzzy/sys/controller/SysLoginController.java
@@ -1,5 +1,6 @@ package com.fzzy.sys.controller; import com.fzzy.sys.LoginCheckManager; import com.fzzy.sys.service.LoginService; import com.ruoyi.common.config.FrameworkConfig; import com.ruoyi.common.core.controller.BaseController; @@ -12,6 +13,7 @@ import com.ruoyi.framework.shiro.token.PhoneToken; import com.ruoyi.framework.web.service.ConfigService; import com.ruoyi.system.service.ISysUserService; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.UsernamePasswordToken; @@ -33,6 +35,7 @@ * * @author ruoyi */ @Slf4j @Controller public class SysLoginController extends BaseController { /** @@ -49,6 +52,9 @@ @Resource private RedisCache redisCache; @Resource private LoginCheckManager loginCheckManager; @GetMapping("/login") public String login(HttpServletRequest request, HttpServletResponse response, ModelMap mmap) { // 如果是Ajax请求,返回Json字符串。 @@ -64,19 +70,60 @@ return "login"; } /** * 登录方法 ---系统自带 * * @param username 用户名 * @param password 密码 * @param rememberMe 记住我 * @return 结果 @PostMapping("/login") @ResponseBody public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe) { UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe); Subject subject = SecurityUtils.getSubject(); try { subject.login(token); return success(); } catch (AuthenticationException e) { String msg = "账号、密码或验证码错误,请重新输入"; // if (StringUtils.isNotEmpty(e.getMessage())) { // msg = e.getMessage(); // } log.error("登录异常", e); String msg = "用户名或者密码错误,请核对"; return error(msg); } } */ /** * 登录方法 ---自定义调整 * * @param username 用户名 * @param password 密码 * @param rememberMe 记住我 * @return 结果 */ @PostMapping("/login") @ResponseBody public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe) { UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe); Subject subject = SecurityUtils.getSubject(); try { subject.login(token); //清除错误信息 loginCheckManager.clearCheckError(username); return success(); } catch (AuthenticationException e) { //根据自定义换缓存判断信息 String errorMsg = loginCheckManager.getCheckError(username); if(StringUtils.isNotBlank(errorMsg)){ //loginCheckManager.clearCheckError(username); return error(errorMsg); } log.error("用户[" + username + "]登录异常,{}", e.getMessage()); String msg = "登录异常,信息:"+e.getMessage(); return error(msg); } }