mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 12:39:05 +08:00
♻️ Refactoring code. 日程管理支持按周显示,抽取部分枚举值
This commit is contained in:
1 parent
21c7d46d79
commit
3505fe276b
13 files changed
+260
-101
No files matched your search
+2
-1
@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.constant.UserStateEnum;
|
||||
import com.pig4cloud.pigx.app.api.dto.AppUserDTO;
|
||||
import com.pig4cloud.pigx.app.api.dto.AppUserInfo;
|
||||
import com.pig4cloud.pigx.app.api.entity.AppRole;
|
||||
@@ -239,7 +240,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
|
||||
AppUser app = new AppUser();
|
||||
BeanUtils.copyProperties(appUser, app);
|
||||
appUser.setUsername(app.getPhone());
|
||||
appUser.setDelFlag(CommonConstants.STATUS_NORMAL);
|
||||
appUser.setDelFlag(UserStateEnum.NORMAL.getCode());
|
||||
appUser.setPassword(ENCODER.encode(appUser.getPassword()));
|
||||
baseMapper.insert(appUser);
|
||||
return null;
|
||||
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
package com.pig4cloud.pigx.admin.api.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 用户节点类型枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum NodeUserTypeEnum {
|
||||
|
||||
USER("user", "用户"), DEPT("dept", "部门"), ROLE("role", "角色"),;
|
||||
|
||||
private String key;
|
||||
|
||||
private String name;
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.pig4cloud.pigx.admin.api.constant;
|
||||
|
||||
/**
|
||||
* 组织类型
|
||||
*
|
||||
* @author lengleng
|
||||
* @date 2023/11/15
|
||||
*/
|
||||
public enum OrgTypeEnum {
|
||||
|
||||
USER("user", "用户"), ROLE("role", "角色"), DEPT("dept", "部门");
|
||||
|
||||
private String type;
|
||||
|
||||
private String desc;
|
||||
|
||||
OrgTypeEnum(String type, String desc) {
|
||||
this.type = type;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.pig4cloud.pigx.admin.api.constant;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2023/11/14
|
||||
* <p>
|
||||
* 日程状态枚举
|
||||
*/
|
||||
public enum ScheduleStateEnum {
|
||||
|
||||
/**
|
||||
* 计划中
|
||||
*/
|
||||
SCHEDULE("0", "计划中"),
|
||||
|
||||
/**
|
||||
* 未开始
|
||||
*/
|
||||
NOT_START("1", "未开始"),
|
||||
|
||||
/**
|
||||
* 结束
|
||||
*/
|
||||
END("3", "结束");
|
||||
|
||||
@Getter
|
||||
private String code;
|
||||
|
||||
private String desc;
|
||||
|
||||
ScheduleStateEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.pig4cloud.pigx.admin.api.constant;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 租户状态
|
||||
*
|
||||
* @author lengleng
|
||||
* @date 2023/11/15
|
||||
* <p>
|
||||
* "0" 正常 "9" 冻结
|
||||
*/
|
||||
public enum TenantStateEnum {
|
||||
|
||||
/**
|
||||
* 正常
|
||||
*/
|
||||
NORMAL("0", "正常"),
|
||||
|
||||
/**
|
||||
* 冻结
|
||||
*/
|
||||
FREEZE("9", "冻结");
|
||||
|
||||
@Getter
|
||||
private final String code;
|
||||
|
||||
private final String desc;
|
||||
|
||||
TenantStateEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.pig4cloud.pigx.admin.api.constant;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*
|
||||
* @author lengleng
|
||||
* @date 2023/11/14
|
||||
*/
|
||||
public enum UserStateEnum {
|
||||
|
||||
/**
|
||||
* 正常
|
||||
*/
|
||||
NORMAL("0", "正常"),
|
||||
/**
|
||||
* 锁定
|
||||
*/
|
||||
LOCK("9", "锁定");
|
||||
|
||||
@Getter
|
||||
private final String code;
|
||||
|
||||
private final String desc;
|
||||
|
||||
UserStateEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
+4
-2
@@ -33,6 +33,7 @@ import org.springdoc.api.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -122,8 +123,9 @@ public class SysScheduleController {
|
||||
|
||||
@Operation(summary = "列表查询", description = "列表查询")
|
||||
@GetMapping("/list")
|
||||
public R list(String month) {
|
||||
List<SysScheduleEntity> list = sysScheduleService.selectListByScope(month);
|
||||
public R list(@RequestParam(required = false) LocalDate startDate,
|
||||
@RequestParam(required = false) LocalDate endDate) {
|
||||
List<SysScheduleEntity> list = sysScheduleService.selectListByScope(startDate, endDate);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
+13
-1
@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysScheduleEntity;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -32,8 +33,19 @@ import java.util.List;
|
||||
*/
|
||||
public interface SysScheduleService extends IService<SysScheduleEntity> {
|
||||
|
||||
/**
|
||||
* 根据分页信息和日程实体获取指定范围的日程列表
|
||||
* @param page 分页信息
|
||||
* @param sysSchedule 日程实体
|
||||
* @return 日程列表
|
||||
*/
|
||||
IPage<SysScheduleEntity> getScheduleByScope(Page page, SysScheduleEntity sysSchedule);
|
||||
|
||||
List<SysScheduleEntity> selectListByScope(String month);
|
||||
/**
|
||||
* 根据月份查询日程列表
|
||||
* @return 日程列表
|
||||
*/
|
||||
List<SysScheduleEntity> selectListByScope(LocalDate startDate, LocalDate endDate);
|
||||
|
||||
}
|
||||
|
||||
+12
-19
@@ -27,7 +27,7 @@ import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.constant.NodeUserTypeEnum;
|
||||
import com.pig4cloud.pigx.admin.api.constant.OrgTypeEnum;
|
||||
import com.pig4cloud.pigx.admin.api.entity.*;
|
||||
import com.pig4cloud.pigx.admin.api.utils.DataUtil;
|
||||
import com.pig4cloud.pigx.admin.api.vo.DeptExcelVO;
|
||||
@@ -70,7 +70,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
*
|
||||
* @param id 部门 ID
|
||||
* @return 成功、失败
|
||||
*/
|
||||
@@ -87,7 +86,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
|
||||
/**
|
||||
* 查询全部部门树
|
||||
*
|
||||
* @param deptName
|
||||
* @param parentId
|
||||
* @return 树 部门名称
|
||||
@@ -140,7 +138,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
|
||||
/**
|
||||
* 导出部门
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@@ -186,7 +183,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
sysDept.setParentId(one.getDeptId());
|
||||
sysDept.setSortOrder(item.getSortOrder());
|
||||
baseMapper.insert(sysDept);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// 数据不合法情况
|
||||
errorMessageList.add(new ErrorMessage(item.getLineNum(), errorMsg));
|
||||
}
|
||||
@@ -199,7 +197,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
|
||||
/**
|
||||
* 查询所有子节点 (包含当前节点)
|
||||
*
|
||||
* @param deptId 部门ID 目标部门ID
|
||||
* @return ID
|
||||
*/
|
||||
@@ -219,9 +216,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
|
||||
/**
|
||||
* 获取部门负责人
|
||||
* <p>
|
||||
* 1. 根据dept 查询用户 2. 筛选用户列表中 post
|
||||
*
|
||||
* 1. 根据dept 查询用户 2. 筛选用户列表中 post
|
||||
* @param deptId deptId
|
||||
* @return user id list
|
||||
*/
|
||||
@@ -249,16 +245,15 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
|
||||
/**
|
||||
* 根据父部门ID和类型获取组织树
|
||||
*
|
||||
* @param parentDeptId 父部门ID
|
||||
* @param type 类型
|
||||
* @param type 类型
|
||||
* @return 组织树信息
|
||||
*/
|
||||
public Map<String, Object> listOrgTree(Long parentDeptId, String type) {
|
||||
|
||||
List<OrgTreeVO> orgs = new LinkedList<>();
|
||||
|
||||
if (StrUtil.equals(type, "role")) {
|
||||
if (StrUtil.equals(type, OrgTypeEnum.ROLE.getType())) {
|
||||
// 角色
|
||||
List<SysRole> roleList = roleMapper.selectList(Wrappers.emptyWrapper());
|
||||
|
||||
@@ -266,7 +261,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
OrgTreeVO orgTreeVo = new OrgTreeVO();
|
||||
orgTreeVo.setId(role.getRoleId());
|
||||
orgTreeVo.setName(role.getRoleName());
|
||||
orgTreeVo.setType("role");
|
||||
orgTreeVo.setType(OrgTypeEnum.ROLE.getType());
|
||||
orgTreeVo.setSelected(false);
|
||||
orgs.add(orgTreeVo);
|
||||
});
|
||||
@@ -291,13 +286,13 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
OrgTreeVO orgTreeVo = new OrgTreeVO();
|
||||
orgTreeVo.setId(dept.getDeptId());
|
||||
orgTreeVo.setName(dept.getName());
|
||||
orgTreeVo.setType("dept");
|
||||
orgTreeVo.setType(OrgTypeEnum.DEPT.getType());
|
||||
orgTreeVo.setSelected(false);
|
||||
deptVoList.add(orgTreeVo);
|
||||
});
|
||||
dict.set("childDepartments", deptVoList);
|
||||
|
||||
if (!StrUtil.equals(type, "dept")) {
|
||||
if (!StrUtil.equals(type, OrgTypeEnum.DEPT.getType())) {
|
||||
|
||||
List<OrgTreeVO> userVoList = new ArrayList<>();
|
||||
|
||||
@@ -308,7 +303,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
OrgTreeVO orgTreeVo = new OrgTreeVO();
|
||||
orgTreeVo.setId(user.getUserId());
|
||||
orgTreeVo.setName(user.getUsername());
|
||||
orgTreeVo.setType("user");
|
||||
orgTreeVo.setType(OrgTypeEnum.USER.getType());
|
||||
orgTreeVo.setSelected(false);
|
||||
orgTreeVo.setAvatar(user.getAvatar());
|
||||
userVoList.add(orgTreeVo);
|
||||
@@ -327,7 +322,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
|
||||
/**
|
||||
* 模糊搜索用户
|
||||
*
|
||||
* @param username 用户名/拼音/首字母
|
||||
* @return 匹配到的用户
|
||||
*/
|
||||
@@ -338,7 +332,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
OrgTreeVO orgTreeVo = new OrgTreeVO();
|
||||
orgTreeVo.setId(user.getUserId());
|
||||
orgTreeVo.setName(user.getUsername());
|
||||
orgTreeVo.setType(NodeUserTypeEnum.USER.getKey());
|
||||
orgTreeVo.setType(OrgTypeEnum.USER.getType());
|
||||
orgTreeVo.setSelected(false);
|
||||
orgTreeVo.setAvatar(user.getAvatar());
|
||||
return orgTreeVo;
|
||||
@@ -348,9 +342,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
|
||||
/**
|
||||
* 递归查询所有子节点。
|
||||
*
|
||||
* @param allDeptList 所有部门列表
|
||||
* @param parentId 父部门ID
|
||||
* @param parentId 父部门ID
|
||||
* @param resDeptList 结果集合
|
||||
*/
|
||||
private void recursiveDept(List<SysDept> allDeptList, Long parentId, List<SysDept> resDeptList) {
|
||||
|
||||
+51
-48
@@ -33,6 +33,7 @@ import com.pig4cloud.pigx.admin.service.SysLogService;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.data.tenant.TenantBroker;
|
||||
import com.pig4cloud.pigx.common.data.tenant.TenantContextHolder;
|
||||
import com.pig4cloud.pigx.common.log.util.LogTypeEnum;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -52,58 +53,60 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {
|
||||
|
||||
/**
|
||||
* 批量插入前端错误日志
|
||||
* @param preLogVoList 日志信息
|
||||
* @return true/false
|
||||
*/
|
||||
@Override
|
||||
public Boolean saveBatchLogs(List<PreLogVO> preLogVoList) {
|
||||
List<SysLog> sysLogs = preLogVoList.stream().map(pre -> {
|
||||
SysLog log = new SysLog();
|
||||
log.setLogType(CommonConstants.STATUS_LOCK);
|
||||
log.setTitle(pre.getInfo());
|
||||
log.setException(pre.getStack());
|
||||
log.setParams(pre.getMessage());
|
||||
log.setCreateTime(LocalDateTime.now());
|
||||
log.setRequestUri(pre.getUrl());
|
||||
log.setCreateBy(pre.getUser());
|
||||
return log;
|
||||
}).collect(Collectors.toList());
|
||||
return this.saveBatch(sysLogs);
|
||||
}
|
||||
/**
|
||||
* 批量插入前端错误日志
|
||||
*
|
||||
* @param preLogVoList 日志信息
|
||||
* @return true/false
|
||||
*/
|
||||
@Override
|
||||
public Boolean saveBatchLogs(List<PreLogVO> preLogVoList) {
|
||||
List<SysLog> sysLogs = preLogVoList.stream().map(pre -> {
|
||||
SysLog log = new SysLog();
|
||||
log.setLogType(LogTypeEnum.ERROR.getType());
|
||||
log.setTitle(pre.getInfo());
|
||||
log.setException(pre.getStack());
|
||||
log.setParams(pre.getMessage());
|
||||
log.setCreateTime(LocalDateTime.now());
|
||||
log.setRequestUri(pre.getUrl());
|
||||
log.setCreateBy(pre.getUser());
|
||||
return log;
|
||||
}).collect(Collectors.toList());
|
||||
return this.saveBatch(sysLogs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page getLogByPage(Page page, SysLogDTO sysLog) {
|
||||
@Override
|
||||
public Page getLogByPage(Page page, SysLogDTO sysLog) {
|
||||
|
||||
LambdaQueryWrapper<SysLog> wrapper = Wrappers.lambdaQuery();
|
||||
if (StrUtil.isNotBlank(sysLog.getLogType())) {
|
||||
wrapper.eq(SysLog::getLogType, sysLog.getLogType());
|
||||
}
|
||||
LambdaQueryWrapper<SysLog> wrapper = Wrappers.lambdaQuery();
|
||||
if (StrUtil.isNotBlank(sysLog.getLogType())) {
|
||||
wrapper.eq(SysLog::getLogType, sysLog.getLogType());
|
||||
}
|
||||
|
||||
if (ArrayUtil.isNotEmpty(sysLog.getCreateTime())) {
|
||||
wrapper.ge(SysLog::getCreateTime, sysLog.getCreateTime()[0]).le(SysLog::getCreateTime,
|
||||
sysLog.getCreateTime()[1]);
|
||||
}
|
||||
if (ArrayUtil.isNotEmpty(sysLog.getCreateTime())) {
|
||||
wrapper.ge(SysLog::getCreateTime, sysLog.getCreateTime()[0]).le(SysLog::getCreateTime,
|
||||
sysLog.getCreateTime()[1]);
|
||||
}
|
||||
|
||||
return baseMapper.selectPage(page, wrapper);
|
||||
}
|
||||
return baseMapper.selectPage(page, wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入日志
|
||||
* @param sysLog 日志对象
|
||||
* @return true/false
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean saveLog(SysLogDTO sysLog) {
|
||||
TenantBroker.applyAs(sysLog::getTenantId, tenantId -> {
|
||||
TenantContextHolder.setTenantId(tenantId);
|
||||
SysLog log = new SysLog();
|
||||
BeanUtils.copyProperties(sysLog, log, "createTime");
|
||||
return baseMapper.insert(log);
|
||||
});
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
/**
|
||||
* 插入日志
|
||||
*
|
||||
* @param sysLog 日志对象
|
||||
* @return true/false
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean saveLog(SysLogDTO sysLog) {
|
||||
TenantBroker.applyAs(sysLog::getTenantId, tenantId -> {
|
||||
TenantContextHolder.setTenantId(tenantId);
|
||||
SysLog log = new SysLog();
|
||||
BeanUtils.copyProperties(sysLog, log, "createTime");
|
||||
return baseMapper.insert(log);
|
||||
});
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
+21
-7
@@ -16,12 +16,15 @@
|
||||
*/
|
||||
package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.constant.ScheduleStateEnum;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysScheduleEntity;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysScheduleMapper;
|
||||
import com.pig4cloud.pigx.admin.service.SysScheduleService;
|
||||
@@ -30,8 +33,6 @@ import com.pig4cloud.pigx.common.security.util.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -45,6 +46,12 @@ import java.util.Objects;
|
||||
public class SysScheduleServiceImpl extends ServiceImpl<SysScheduleMapper, SysScheduleEntity>
|
||||
implements SysScheduleService {
|
||||
|
||||
/**
|
||||
* 根据范围获取计划列表
|
||||
* @param page 分页对象
|
||||
* @param sysSchedule 计划实体对象
|
||||
* @return 分页对象
|
||||
*/
|
||||
@Override
|
||||
public IPage<SysScheduleEntity> getScheduleByScope(Page page, SysScheduleEntity sysSchedule) {
|
||||
LambdaQueryWrapper<SysScheduleEntity> wrapper = Wrappers.lambdaQuery();
|
||||
@@ -56,13 +63,20 @@ public class SysScheduleServiceImpl extends ServiceImpl<SysScheduleMapper, SysSc
|
||||
return baseMapper.selectPageByScope(page, wrapper, dataScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据月份查询日程列表
|
||||
* @param startDate 本周开始日期
|
||||
* @param endDate 本周结束日期
|
||||
* @return 日程列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysScheduleEntity> selectListByScope(String month) {
|
||||
LocalDate parse = LocalDate.parse(month, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
LocalDate firstDay = parse.with(TemporalAdjusters.firstDayOfMonth()); // 获取当前月的第一天
|
||||
LocalDate lastDay = parse.with(TemporalAdjusters.lastDayOfMonth());
|
||||
public List<SysScheduleEntity> selectListByScope(LocalDate startDate, LocalDate endDate) {
|
||||
DateTime beginOfWeek = DateUtil.beginOfWeek(DateUtil.date());
|
||||
DateTime endOfWeek = DateUtil.endOfWeek(DateUtil.date());
|
||||
LambdaQueryWrapper<SysScheduleEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.between(SysScheduleEntity::getDate, firstDay, lastDay);
|
||||
wrapper.between(SysScheduleEntity::getDate, Objects.isNull(startDate) ? beginOfWeek : startDate,
|
||||
Objects.isNull(endDate) ? endOfWeek : endDate);
|
||||
wrapper.ne(SysScheduleEntity::getState, ScheduleStateEnum.END.getCode());
|
||||
DataScope dataScope = new DataScope();
|
||||
dataScope.setUsername(SecurityUtils.getUser().getUsername());
|
||||
return baseMapper.selectListByScope(wrapper, dataScope);
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ import cn.hutool.core.util.CharUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.constant.TenantStateEnum;
|
||||
import com.pig4cloud.pigx.admin.api.entity.*;
|
||||
import com.pig4cloud.pigx.admin.config.ClientDetailsInitRunner;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysRoleMenuMapper;
|
||||
@@ -90,7 +91,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
@Cacheable(value = CacheConstants.TENANT_DETAILS)
|
||||
public List<SysTenant> getNormalTenant() {
|
||||
return baseMapper
|
||||
.selectList(Wrappers.<SysTenant>lambdaQuery().eq(SysTenant::getStatus, CommonConstants.STATUS_NORMAL));
|
||||
.selectList(Wrappers.<SysTenant>lambdaQuery().eq(SysTenant::getStatus, TenantStateEnum.NORMAL.getCode()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-3
@@ -28,6 +28,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.constant.UserStateEnum;
|
||||
import com.pig4cloud.pigx.admin.api.dto.UserDTO;
|
||||
import com.pig4cloud.pigx.admin.api.dto.UserInfo;
|
||||
import com.pig4cloud.pigx.admin.api.entity.*;
|
||||
@@ -99,8 +100,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
public Boolean saveUser(UserDTO userDto) {
|
||||
SysUser sysUser = new SysUser();
|
||||
BeanUtils.copyProperties(userDto, sysUser);
|
||||
sysUser
|
||||
.setDelFlag(StrUtil.isBlank(userDto.getLockFlag()) ? CommonConstants.STATUS_NORMAL : userDto.getDelFlag());
|
||||
sysUser.setLockFlag(
|
||||
StrUtil.isBlank(userDto.getLockFlag()) ? UserStateEnum.NORMAL.getCode() : UserStateEnum.LOCK.getCode());
|
||||
sysUser.setCreateBy(userDto.getUsername());
|
||||
sysUser.setUpdateBy(userDto.getUsername());
|
||||
sysUser.setPassword(ENCODER.encode(userDto.getPassword()));
|
||||
@@ -438,7 +439,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
SysUser sysUser = baseMapper.selectOne(Wrappers.<SysUser>lambdaQuery().eq(SysUser::getUsername, username));
|
||||
|
||||
if (Objects.nonNull(sysUser)) {
|
||||
sysUser.setLockFlag(CommonConstants.STATUS_LOCK);
|
||||
sysUser.setLockFlag(UserStateEnum.LOCK.getCode());
|
||||
baseMapper.updateById(sysUser);
|
||||
}
|
||||
return R.ok();
|
||||
|
||||
Reference in new issue
Block a user