feat(util): 添加参数验证工具类并重构系统服务
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -22,6 +23,7 @@ import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.Validation;
|
||||
import jakarta.validation.Validator;
|
||||
import jakarta.validation.ValidatorFactory;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.groups.Default;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@@ -61,4 +63,22 @@ public final class KitValidUtil {
|
||||
throw new BadRequestException("参数非必填");
|
||||
}
|
||||
}
|
||||
|
||||
public static void notNull(Object value, @NotNull String name, @NotNull String code) {
|
||||
if (value != null) {
|
||||
throw new BadRequestException(String.format("参数 %s(%s) 必填", name, code));
|
||||
}
|
||||
}
|
||||
|
||||
public static void isBlank(CharSequence value, @NotNull String name, @NotNull String code) {
|
||||
if (StrUtil.isNotBlank(value)) {
|
||||
throw new BadRequestException(String.format("参数 %s(%s) 非必填", name, code));
|
||||
}
|
||||
}
|
||||
|
||||
public static void notBlank(CharSequence value, @NotNull String name, @NotNull String code) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
throw new BadRequestException(String.format("参数 %s(%s) 必填", name, code));
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-5
@@ -24,13 +24,9 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SystemCaptchaBizEnum {
|
||||
/* 通过手机号码重置邮箱 */
|
||||
PHONE_RESET_EMAIL_CODE("10000", "phone_reset_email_code_", "SystemEmailCaptchaTemplate.ftl",
|
||||
"通过手机号码重置邮箱"), /* 通过旧邮箱重置邮箱 */
|
||||
PHONE_RESET_EMAIL_CODE("10000", "phone_reset_email_code_", "SystemEmailCaptchaTemplate.ftl", "通过手机号码重置邮箱"),
|
||||
EMAIL_RESET_EMAIL_CODE("10001", "email_reset_email_code_", "SystemEmailCaptchaTemplate.ftl", "通过旧邮箱重置邮箱"),
|
||||
/* 通过手机号码重置密码 */
|
||||
PHONE_RESET_PWD_CODE("10002", "phone_reset_pwd_code_", "SystemEmailCaptchaTemplate.ftl", "通过手机号码重置密码"),
|
||||
/* 通过邮箱重置密码 */
|
||||
EMAIL_RESET_PWD_CODE("10003", "email_reset_pwd_code_", "SystemEmailCaptchaTemplate.ftl", "通过邮箱重置密码");
|
||||
/**
|
||||
* 业务编码
|
||||
|
||||
+2
-3
@@ -24,9 +24,8 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SystemDataScopeEnum {
|
||||
/* 全部的数据权限 */
|
||||
ALL("全部", "全部的数据权限"), /* 自己部门的数据权限 */
|
||||
THIS_LEVEL("本级", "自己部门的数据权限"), /* 自定义的数据权限 */
|
||||
ALL("全部", "全部的数据权限"),
|
||||
THIS_LEVEL("本级", "自己部门的数据权限"),
|
||||
CUSTOMIZE("自定义", "自定义的数据权限");
|
||||
private final String value;
|
||||
private final String description;
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.framework.bizlock;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
|
||||
-7
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.framework.bizlock;
|
||||
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
@@ -63,14 +62,11 @@ public class BizLockAspect {
|
||||
return String.format("%s:%s", bizLock.bizName(),
|
||||
((MethodSignature) joinPoint.getSignature()).getMethod().getName());
|
||||
}
|
||||
|
||||
// 解析SpEL表达式
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
|
||||
// 创建SpEL上下文
|
||||
StandardEvaluationContext context = new StandardEvaluationContext();
|
||||
|
||||
// 设置方法参数
|
||||
String[] parameterNames = signature.getParameterNames();
|
||||
Object[] args = joinPoint.getArgs();
|
||||
@@ -79,15 +75,12 @@ public class BizLockAspect {
|
||||
// 支持#p0,#p1格式
|
||||
context.setVariable("p" + i, args[i]);
|
||||
}
|
||||
|
||||
// 设置方法相关信息
|
||||
context.setVariable("methodName", method.getName());
|
||||
context.setVariable("targetClass", joinPoint.getTarget().getClass().getName());
|
||||
|
||||
// 解析表达式
|
||||
Expression expression = parser.parseExpression(bizLock.key());
|
||||
String value = expression.getValue(context, String.class);
|
||||
|
||||
// 组合最终的key: bizName:解析后的key
|
||||
return String.format("%s:%s", bizLock.bizName(), value);
|
||||
}
|
||||
|
||||
+1
-1
@@ -26,8 +26,8 @@ import cn.odboy.framework.quartz.core.QuartzRunnable;
|
||||
import cn.odboy.framework.redis.KitRedisHelper;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzLogTb;
|
||||
import cn.odboy.system.dal.model.response.SystemQuartzJobVo;
|
||||
import cn.odboy.system.dal.model.request.SystemSendEmailArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemQuartzJobVo;
|
||||
import cn.odboy.system.dal.mysql.SystemQuartzLogMapper;
|
||||
import cn.odboy.system.service.SystemEmailService;
|
||||
import cn.odboy.system.service.SystemQuartzJobService;
|
||||
|
||||
+14
-10
@@ -3,17 +3,17 @@ package cn.odboy.system.service;
|
||||
import cn.odboy.constant.SystemConst;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.redis.KitRedisHelper;
|
||||
import cn.odboy.system.dal.model.request.SystemUserLoginArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemAuthVo;
|
||||
import cn.odboy.system.dal.model.response.SystemUserInfoVo;
|
||||
import cn.odboy.system.dal.model.response.SystemUserJwtVo;
|
||||
import cn.odboy.system.dal.model.request.SystemUserLoginArgs;
|
||||
import cn.odboy.system.dal.redis.SystemUserOnlineInfoDAO;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.system.framework.permission.core.handler.TokenProvider;
|
||||
import cn.odboy.system.framework.permission.core.handler.UserDetailsHandler;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import cn.odboy.util.KitRsaEncryptUtil;
|
||||
import cn.odboy.util.KitValidUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
@@ -25,8 +25,6 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class SystemAuthService {
|
||||
|
||||
@Autowired
|
||||
private KitRedisHelper redisHelper;
|
||||
@Autowired
|
||||
private AppProperties properties;
|
||||
@Autowired
|
||||
@@ -40,29 +38,35 @@ public class SystemAuthService {
|
||||
@Autowired
|
||||
private SystemCaptchaService systemCaptchaService;
|
||||
|
||||
public SystemAuthVo doLogin(SystemUserLoginArgs loginRequest, HttpServletRequest request) throws Exception {
|
||||
public SystemAuthVo doLogin(SystemUserLoginArgs loginArgs, HttpServletRequest request) throws Exception {
|
||||
KitValidUtil.notNull(loginArgs);
|
||||
|
||||
// 密码解密
|
||||
String password = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), loginRequest.getPassword());
|
||||
String password = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), loginArgs.getPassword());
|
||||
// 校验验证码
|
||||
systemCaptchaService.validate(loginRequest.getUuid(), loginRequest.getCode());
|
||||
systemCaptchaService.validate(loginArgs.getUuid(), loginArgs.getCode());
|
||||
// 获取用户信息
|
||||
SystemUserJwtVo jwtUser = userDetailsService.loadUserByUsername(loginRequest.getUsername());
|
||||
SystemUserJwtVo jwtUser = userDetailsService.loadUserByUsername(loginArgs.getUsername());
|
||||
// 验证用户密码
|
||||
if (!passwordEncoder.matches(password, jwtUser.getPassword())) {
|
||||
throw new BadRequestException("登录密码错误");
|
||||
}
|
||||
|
||||
// 登录验证
|
||||
Authentication authentication = new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities());
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
|
||||
// 生成令牌
|
||||
String token = tokenProvider.createToken(jwtUser);
|
||||
// 返回 token 与 用户信息
|
||||
SystemAuthVo authInfo = new SystemAuthVo();
|
||||
authInfo.setToken(String.format("%s %s", SystemConst.TOKEN_PREFIX, token));
|
||||
// 这里是为了清空密码
|
||||
/// 这里是为了清空密码
|
||||
authInfo.setUser(KitBeanUtil.copyToClass(jwtUser, SystemUserInfoVo.class));
|
||||
|
||||
if (properties.getLogin().isSingle()) {
|
||||
// 踢掉之前已经登录的token
|
||||
systemUserOnlineInfoDAO.kickOutByUsername(loginRequest.getUsername());
|
||||
systemUserOnlineInfoDAO.kickOutByUsername(loginArgs.getUsername());
|
||||
}
|
||||
// 保存在线信息
|
||||
systemUserOnlineInfoDAO.saveUserJwtModelByToken(jwtUser, token, request);
|
||||
|
||||
+8
-15
@@ -24,12 +24,12 @@ import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.constant.SystemDataScopeEnum;
|
||||
import cn.odboy.system.constant.SystemZhConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.model.request.SystemCreateDeptArgs;
|
||||
import cn.odboy.system.dal.model.export.SystemDeptExportRowVo;
|
||||
import cn.odboy.system.dal.model.request.SystemCreateDeptArgs;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryDeptArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemDeptVo;
|
||||
import cn.odboy.system.dal.model.response.SystemProductLineTreeVo;
|
||||
import cn.odboy.system.dal.model.response.SystemProductLineVo;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryDeptArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemDeptMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
@@ -70,8 +70,8 @@ public class SystemDeptService {
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveDept(SystemCreateDeptArgs args) {
|
||||
SystemDeptTb deptTb = KitBeanUtil.copyToClass(args, SystemDeptTb.class);
|
||||
systemDeptMapper.insert(deptTb);
|
||||
KitValidUtil.notNull(args);
|
||||
systemDeptMapper.insert(KitBeanUtil.copyToClass(args, SystemDeptTb.class));
|
||||
this.updateDeptSubCnt(args.getPid());
|
||||
}
|
||||
|
||||
@@ -82,8 +82,10 @@ public class SystemDeptService {
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateDeptById(SystemDeptTb args) {
|
||||
// 旧的部门
|
||||
KitValidUtil.notNull(args);
|
||||
// 旧的父部门
|
||||
Long oldPid = this.getDeptVoById(args.getId()).getPid();
|
||||
// 新的父部门
|
||||
Long newPid = args.getPid();
|
||||
if (args.getPid() != null && args.getId().equals(args.getPid())) {
|
||||
throw new BadRequestException("上级不能为自己");
|
||||
@@ -220,9 +222,8 @@ public class SystemDeptService {
|
||||
*
|
||||
* @param deptTbList /
|
||||
* @param depts /
|
||||
* @return /
|
||||
*/
|
||||
private Set<SystemDeptVo> queryRelationDeptByArgs(List<SystemDeptVo> deptTbList, Set<SystemDeptVo> depts) {
|
||||
private void queryRelationDeptByArgs(List<SystemDeptVo> deptTbList, Set<SystemDeptVo> depts) {
|
||||
for (SystemDeptVo dept : deptTbList) {
|
||||
depts.add(dept);
|
||||
List<SystemDeptVo> deptList = this.listDeptByPid(dept.getId());
|
||||
@@ -230,7 +231,6 @@ public class SystemDeptService {
|
||||
queryRelationDeptByArgs(deptList, depts);
|
||||
}
|
||||
}
|
||||
return depts;
|
||||
}
|
||||
|
||||
public List<Long> queryChildDeptIdByDeptIds(List<SystemDeptVo> deptList) {
|
||||
@@ -473,13 +473,6 @@ public class SystemDeptService {
|
||||
|
||||
public void exportDeptXlsx(HttpServletResponse response, SystemQueryDeptArgs args) throws Exception {
|
||||
List<SystemDeptTb> systemDeptTbs = this.queryAllDeptByArgs(args, false);
|
||||
// KitXlsxExportUtil.exportFile(response, "部门数据", systemDeptTbs, SystemDeptExportRowVo.class, (dataObject) -> {
|
||||
// SystemDeptExportRowVo rowVo = new SystemDeptExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setEnabled(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemDeptExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemDeptTb dataObject : systemDeptTbs) {
|
||||
SystemDeptExportRowVo rowVo = new SystemDeptExportRowVo();
|
||||
|
||||
+1
-1
@@ -21,8 +21,8 @@ import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictDetailTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||
import cn.odboy.system.dal.model.request.SystemCreateDictDetailArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemDictDetailVo;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryDictDetailArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemDictDetailVo;
|
||||
import cn.odboy.system.dal.mysql.SystemDictDetailMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemDictMapper;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
|
||||
+2
-25
@@ -19,10 +19,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||
import cn.odboy.system.dal.model.request.SystemCreateDictArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemDictDetailVo;
|
||||
import cn.odboy.system.dal.model.export.SystemDictExportRowVo;
|
||||
import cn.odboy.system.dal.model.request.SystemCreateDictArgs;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryDictArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemDictDetailVo;
|
||||
import cn.odboy.system.dal.mysql.SystemDictMapper;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
@@ -111,29 +111,6 @@ public class SystemDictService {
|
||||
|
||||
public void exportDictXlsx(HttpServletResponse response, SystemQueryDictArgs args) {
|
||||
List<SystemDictTb> systemDictTbs = this.queryDictByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "字典数据", systemDictTbs, SystemDictExportRowVo.class, (dataObject) -> {
|
||||
// List<SystemDictDetailVo> dictDetails = systemDictDetailService.listDictDetailByName(dataObject.getName());
|
||||
// if (CollUtil.isEmpty(dictDetails)) {
|
||||
// SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// rowVo.setLabel("");
|
||||
// rowVo.setValue("");
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// }
|
||||
// List<SystemDictExportRowVo> rowVos = new ArrayList<>();
|
||||
// for (SystemDictDetailVo dictDetail : dictDetails) {
|
||||
// SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// rowVo.setLabel(dictDetail.getLabel());
|
||||
// rowVo.setValue(dictDetail.getValue());
|
||||
// rowVos.add(rowVo);
|
||||
// }
|
||||
// return rowVos;
|
||||
// });
|
||||
List<SystemDictExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemDictTb dataObject : systemDictTbs) {
|
||||
List<SystemDictDetailVo> dictDetails = systemDictDetailService.listDictDetailByName(dataObject.getName());
|
||||
|
||||
+1
-8
@@ -20,8 +20,8 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.model.request.SystemCreateJobArgs;
|
||||
import cn.odboy.system.dal.model.export.SystemJobExportRowVo;
|
||||
import cn.odboy.system.dal.model.request.SystemCreateJobArgs;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryJobArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemJobMapper;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
@@ -141,13 +141,6 @@ public class SystemJobService {
|
||||
|
||||
public void exportJobXlsx(HttpServletResponse response, SystemQueryJobArgs args) {
|
||||
List<SystemJobTb> systemJobTbs = this.queryJobByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "岗位数据", systemJobTbs, SystemJobExportRowVo.class, (dataObject) -> {
|
||||
// SystemJobExportRowVo rowVo = new SystemJobExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setEnabled(dataObject.getEnabled() ? "启用" : "停用");
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemJobExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemJobTb dataObject : systemJobTbs) {
|
||||
SystemJobExportRowVo rowVo = new SystemJobExportRowVo();
|
||||
|
||||
+2
-2
@@ -20,14 +20,14 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.constant.SystemYesOrNoChConst;
|
||||
import cn.odboy.system.constant.SystemTransferProtocolConst;
|
||||
import cn.odboy.system.constant.SystemYesOrNoChConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.model.export.SystemMenuExportRowVo;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryMenuArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemMenuMetaVo;
|
||||
import cn.odboy.system.dal.model.response.SystemMenuRouterVo;
|
||||
import cn.odboy.system.dal.model.response.SystemMenuVo;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryMenuArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleVo;
|
||||
import cn.odboy.system.dal.mysql.SystemMenuMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
|
||||
+1
-1
@@ -17,8 +17,8 @@ package cn.odboy.system.service;
|
||||
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemOssStorageTb;
|
||||
import cn.odboy.system.dal.model.response.SystemOssStorageVo;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemOssStorageVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
+1
-15
@@ -25,10 +25,10 @@ import cn.odboy.framework.redis.KitRedisHelper;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzLogTb;
|
||||
import cn.odboy.system.dal.model.export.SystemQuartzJobExportRowVo;
|
||||
import cn.odboy.system.dal.model.response.SystemQuartzJobVo;
|
||||
import cn.odboy.system.dal.model.export.SystemQuartzLogExportRowVo;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryQuartzJobArgs;
|
||||
import cn.odboy.system.dal.model.request.SystemUpdateQuartzJobArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemQuartzJobVo;
|
||||
import cn.odboy.system.dal.mysql.SystemQuartzJobMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemQuartzLogMapper;
|
||||
import cn.odboy.system.framework.quartz.QuartzManage;
|
||||
@@ -296,20 +296,6 @@ public class SystemQuartzJobService {
|
||||
|
||||
public void exportQuartzLogXlsx(HttpServletResponse response, SystemQueryQuartzJobArgs args) {
|
||||
List<SystemQuartzLogTb> systemQuartzLogTbs = this.queryQuartzLogByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "定时任务日志数据", systemQuartzLogTbs, SystemQuartzLogExportRowVo.class,
|
||||
// (dataObject) -> {
|
||||
// SystemQuartzLogExportRowVo rowVo = new SystemQuartzLogExportRowVo();
|
||||
// rowVo.setJobName(dataObject.getJobName());
|
||||
// rowVo.setBeanName(dataObject.getBeanName());
|
||||
// rowVo.setMethodName(dataObject.getMethodName());
|
||||
// rowVo.setParams(dataObject.getParams());
|
||||
// rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
// rowVo.setExceptionDetail(dataObject.getExceptionDetail());
|
||||
// rowVo.setTime(dataObject.getTime());
|
||||
// rowVo.setStatus(dataObject.getIsSuccess() ? "成功" : "失败");
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemQuartzLogExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemQuartzLogTb dataObject : systemQuartzLogTbs) {
|
||||
SystemQuartzLogExportRowVo rowVo = new SystemQuartzLogExportRowVo();
|
||||
|
||||
+4
-12
@@ -23,11 +23,11 @@ import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.request.SystemCreateRoleArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemMenuVo;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryRoleArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleCodeVo;
|
||||
import cn.odboy.system.dal.model.export.SystemRoleExportRowVo;
|
||||
import cn.odboy.system.dal.model.request.SystemCreateRoleArgs;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryRoleArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemMenuVo;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleCodeVo;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleVo;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
@@ -281,14 +281,6 @@ public class SystemRoleService {
|
||||
|
||||
public void exportRoleXlsx(HttpServletResponse response, SystemQueryRoleArgs args) {
|
||||
List<SystemRoleVo> systemRoleVos = this.queryRoleByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "角色数据", systemRoleVos, SystemRoleExportRowVo.class, (dataObject) -> {
|
||||
// SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setLevel(dataObject.getLevel());
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemRoleExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemRoleVo dataObject : systemRoleVos) {
|
||||
SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo();
|
||||
|
||||
+4
-33
@@ -31,11 +31,11 @@ import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.response.SystemDeptVo;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryUserArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleVo;
|
||||
import cn.odboy.system.dal.model.request.SystemUpdateUserPasswordArgs;
|
||||
import cn.odboy.system.dal.model.export.SystemUserExportRowVo;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryUserArgs;
|
||||
import cn.odboy.system.dal.model.request.SystemUpdateUserPasswordArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemDeptVo;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleVo;
|
||||
import cn.odboy.system.dal.model.response.SystemUserVo;
|
||||
import cn.odboy.system.dal.mysql.SystemUserMapper;
|
||||
import cn.odboy.system.dal.redis.SystemUserInfoDAO;
|
||||
@@ -510,35 +510,6 @@ public class SystemUserService {
|
||||
}
|
||||
|
||||
public void exportUserXlsx(HttpServletResponse response, SystemQueryUserArgs args) {
|
||||
// List<SystemUserVo> systemUserVos = systemUserService.queryUserVoByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "用户数据", systemUserVos, SystemUserExportRowVo.class, (dataObject) -> {
|
||||
// SystemUserExportRowVo rowVo = new SystemUserExportRowVo();
|
||||
// rowVo.setUsername(dataObject.getUsername());
|
||||
// rowVo.setRoles(dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setDept(dataObject.getDept().getName());
|
||||
// rowVo.setJobs(dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setEmail(dataObject.getEmail());
|
||||
// rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
// rowVo.setMobile(dataObject.getPhone());
|
||||
// rowVo.setUpdatePwdTime(dataObject.getPwdResetTime());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
// List<SystemUserExportRowVo> rowVos = new ArrayList<>();
|
||||
// for (SystemUserVo dataObject : systemUserVos) {
|
||||
// SystemUserExportRowVo rowVo = new SystemUserExportRowVo();
|
||||
// rowVo.setUsername(dataObject.getUsername());
|
||||
// rowVo.setRoles(dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setDept(dataObject.getDept().getName());
|
||||
// rowVo.setJobs(dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setEmail(dataObject.getEmail());
|
||||
// rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
// rowVo.setMobile(dataObject.getPhone());
|
||||
// rowVo.setUpdatePwdTime(dataObject.getPwdResetTime());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// rowVos.add(rowVo);
|
||||
// }
|
||||
// KitExcelExporter.exportSimple(response, "用户数据", SystemUserExportRowVo.class, rowVos);
|
||||
long totalCount = this.countUserByArgs(args);
|
||||
KitExcelExporter.exportByPage(response, "用户数据", SystemUserExportRowVo.class, totalCount, (long pageNum, long pageSize) -> {
|
||||
KitPageResult<SystemUserVo> pageResult = this.searchUserByArgs(args, new Page<>(pageNum, pageSize));
|
||||
|
||||
+1
-1
@@ -24,8 +24,8 @@ import cn.odboy.framework.properties.model.StorageOSSModel;
|
||||
import cn.odboy.framework.server.core.KitFileLocalUploadHelper;
|
||||
import cn.odboy.system.dal.dataobject.SystemOssStorageTb;
|
||||
import cn.odboy.system.dal.model.export.SystemOssStorageExportRowVo;
|
||||
import cn.odboy.system.dal.model.response.SystemOssStorageVo;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemOssStorageVo;
|
||||
import cn.odboy.system.dal.mysql.SystemOssStorageMapper;
|
||||
import cn.odboy.system.framework.storage.minio.MinioRepository;
|
||||
import cn.odboy.system.service.SystemOssStorageService;
|
||||
|
||||
Reference in New Issue
Block a user