update
This commit is contained in:
parent
9834372956
commit
a4780b39b0
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ydool.common.base.BaseService;
|
import com.ydool.common.base.BaseService;
|
||||||
import com.ydool.common.cache.ConfigCache;
|
import com.ydool.common.cache.ConfigCache;
|
||||||
import com.ydool.common.data.dto.AjaxResult;
|
import com.ydool.common.data.dto.AjaxResult;
|
||||||
|
import com.ydool.grainStorage.entity.FoodReserves;
|
||||||
import com.ydool.grainStorage.entity.FoodReservesLog;
|
import com.ydool.grainStorage.entity.FoodReservesLog;
|
||||||
import com.ydool.grainStorage.mapper.FoodReservesLogMapper;
|
import com.ydool.grainStorage.mapper.FoodReservesLogMapper;
|
||||||
import com.ydool.grainStorage.wrapper.FoodReservesLogWrapper;
|
import com.ydool.grainStorage.wrapper.FoodReservesLogWrapper;
|
||||||
|
@ -64,16 +65,20 @@ public class FoodReservesLogService extends BaseService<FoodReservesLogMapper, F
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
//判断是否为领导
|
//判断是否为所有权限
|
||||||
String loginName = ConfigCache.getStr("sys.user.leadership");
|
String loginName = "all";
|
||||||
User user = userService.getOne(new QueryWrapper<User>().lambda()
|
User user = userService.getOne(new QueryWrapper<User>().lambda()
|
||||||
.eq(User::getId, StpUtil.getLoginIdAsString())
|
.eq(User::getId, StpUtil.getLoginIdAsString())
|
||||||
.last("limit 1")
|
.last("limit 1")
|
||||||
);
|
);
|
||||||
if (loginName.equals(user.getLoginName())) {
|
if (loginName.equals(user.getPermissions())) {
|
||||||
qw.lambda().eq(StrUtil.isNotBlank(deptId), FoodReservesLog::getDeptId, deptId);
|
qw.lambda().eq(StrUtil.isNotBlank(deptId), FoodReservesLog::getDeptId, deptId);
|
||||||
} else {
|
} else if ("dept".equals(user.getPermissions())) {
|
||||||
qw.lambda().eq(FoodReservesLog::getDeptId, user.getDept());
|
qw.lambda().eq(FoodReservesLog::getDeptId, user.getDept());
|
||||||
|
} else if ("my".equals(user.getPermissions())) {
|
||||||
|
qw.lambda().eq(FoodReservesLog::getCreatedId, user.getId());
|
||||||
|
} else {
|
||||||
|
return AjaxResult.fail("无权限");
|
||||||
}
|
}
|
||||||
|
|
||||||
qw.lambda().eq(StrUtil.isNotBlank(type),FoodReservesLog::getType,type)
|
qw.lambda().eq(StrUtil.isNotBlank(type),FoodReservesLog::getType,type)
|
||||||
|
|
|
@ -7,7 +7,6 @@ import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ydool.common.base.BaseService;
|
import com.ydool.common.base.BaseService;
|
||||||
import com.ydool.common.cache.ConfigCache;
|
|
||||||
import com.ydool.common.data.dto.AjaxResult;
|
import com.ydool.common.data.dto.AjaxResult;
|
||||||
import com.ydool.grainStorage.entity.FoodReserves;
|
import com.ydool.grainStorage.entity.FoodReserves;
|
||||||
import com.ydool.grainStorage.entity.FoodReservesLog;
|
import com.ydool.grainStorage.entity.FoodReservesLog;
|
||||||
|
@ -55,14 +54,14 @@ public class FoodReservesService extends BaseService<FoodReservesMapper, FoodRes
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult operationFoodReserves(FoodReservesVo vo) {
|
public AjaxResult operationFoodReserves(FoodReservesVo vo) {
|
||||||
//判断是否为领导
|
//判断是否为所有权限
|
||||||
String loginName = ConfigCache.getStr("sys.user.leadership");
|
String loginName = "all";
|
||||||
User user = userService.getOne(new QueryWrapper<User>().lambda()
|
User user = userService.getOne(new QueryWrapper<User>().lambda()
|
||||||
.eq(User::getId, StpUtil.getLoginIdAsString())
|
.eq(User::getId, StpUtil.getLoginIdAsString())
|
||||||
.last("limit 1")
|
.last("limit 1")
|
||||||
);
|
);
|
||||||
//不是领导 自动导入所属粮仓
|
//不是所有权限 自动导入所属粮仓
|
||||||
if (!loginName.equals(user.getLoginName())) {
|
if (!loginName.equals(user.getPermissions())) {
|
||||||
vo.setDeptId(user.getDept());
|
vo.setDeptId(user.getDept());
|
||||||
}
|
}
|
||||||
if (StrUtil.isBlank(vo.getDeptId())) {
|
if (StrUtil.isBlank(vo.getDeptId())) {
|
||||||
|
@ -199,16 +198,20 @@ public class FoodReservesService extends BaseService<FoodReservesMapper, FoodRes
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
//判断是否为领导
|
//判断是否为所有权限
|
||||||
String loginName = ConfigCache.getStr("sys.user.leadership","");
|
String loginName = "all";
|
||||||
User user = userService.getOne(new QueryWrapper<User>().lambda()
|
User user = userService.getOne(new QueryWrapper<User>().lambda()
|
||||||
.eq(User::getId, StpUtil.getLoginIdAsString())
|
.eq(User::getId, StpUtil.getLoginIdAsString())
|
||||||
.last("limit 1")
|
.last("limit 1")
|
||||||
);
|
);
|
||||||
if (loginName.equals(user.getLoginName())) {
|
if (loginName.equals(user.getPermissions())) {
|
||||||
qw.lambda().eq(StrUtil.isNotBlank(deptId), FoodReserves::getDeptId, deptId);
|
qw.lambda().eq(StrUtil.isNotBlank(deptId), FoodReserves::getDeptId, deptId);
|
||||||
} else {
|
} else if ("dept".equals(user.getPermissions())) {
|
||||||
qw.lambda().eq(FoodReserves::getDeptId, user.getDept());
|
qw.lambda().eq(FoodReserves::getDeptId, user.getDept());
|
||||||
|
} else if ("my".equals(user.getPermissions())) {
|
||||||
|
qw.lambda().eq(FoodReserves::getCreatedId, user.getId());
|
||||||
|
} else {
|
||||||
|
return AjaxResult.fail("无权限");
|
||||||
}
|
}
|
||||||
|
|
||||||
qw.lambda().inSql(FoodReserves::getFoodTypeId, "select id from t_grain_storage_food_type");
|
qw.lambda().inSql(FoodReserves::getFoodTypeId, "select id from t_grain_storage_food_type");
|
||||||
|
|
|
@ -220,14 +220,18 @@ public class AuthServiceImpl extends BaseService<UserMapper, User> implements IA
|
||||||
Dept dept = deptService.getById(loginUser.getDept());
|
Dept dept = deptService.getById(loginUser.getDept());
|
||||||
if (ObjectUtil.isNotNull(dept)) {
|
if (ObjectUtil.isNotNull(dept)) {
|
||||||
deptName = dept.getName();
|
deptName = dept.getName();
|
||||||
|
result.set("deptId", dept.getId());
|
||||||
}
|
}
|
||||||
result.set("deptName", deptName);
|
result.set("deptName", deptName);
|
||||||
|
|
||||||
//是否需要强制修改密码
|
//是否需要强制修改密码
|
||||||
result.set("need_init_password", password.equals(ConfigCache.getStr(ConfigCache.USER_INIT_PASSWORD,
|
result.set("need_init_password", password.equals(ConfigCache.getStr(ConfigCache.USER_INIT_PASSWORD,
|
||||||
"Siwhnd!@Lc2349#!Rdisabled")) ? true : false);
|
"Siwhnd!@Lc2349#!Rdisabled")) ? true : false);
|
||||||
|
//权限
|
||||||
|
result.set("permissions", loginUser.getPermissions());
|
||||||
//电子签名
|
//电子签名
|
||||||
result.set("electronicSignature", loginUser.getElectronicSignature());
|
result.set("electronicSignature", loginUser.getElectronicSignature());
|
||||||
|
|
||||||
return AjaxResult.ok().data(result);
|
return AjaxResult.ok().data(result);
|
||||||
} else {
|
} else {
|
||||||
StpUtil.logout();
|
StpUtil.logout();
|
||||||
|
|
Loading…
Reference in New Issue