Commit 97759818 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.5.8' into MVP1.5.8

parents 745dd6e0 47fc091e
package com.yifu.cloud.plus.v1.yifu.common.dapr.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* @Author hgw
* @Date 2023-9-5 09:42:31
* @Description EKP数据权限
* @Version 1.0
*/
@Data
@Component
@PropertySource("classpath:daprConfig.properties")
@ConfigurationProperties(value = "dapr.permission", ignoreInvalidFields = false)
public class DaprEkpPermissionProperties {
/*
* @author fxj
* @date 14:34
* @Description dapr sidercar url 如:http://localhost:3005/v1.0/invoke/
**/
String appUrl;
/*
* @author fxj
* @date 14:35
* @decription app_id 如:"yifu_upms_sider"
**/
String appId;
String appPort;
String httpPort;
String grpcPort;
String metricsPort;
}
package com.yifu.cloud.plus.v1.job.compont;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprEkpPermissionProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Author hgw
* @Description EKP权限定时任务
* @Date 2023-9-5 09:40:09
**/
@Component(value = "ekpPermissionTask")
@Slf4j
@EnableConfigurationProperties(DaprEkpPermissionProperties.class)
public class EkpPermissionTask {
@Autowired
private DaprEkpPermissionProperties daprEkpPermissionProperties;
/**
* @return
* @Author hgw
* @Description 刷新EKP权限里的账号信息
* @Date 2023-9-5 09:45:22
* @Param
**/
public void doRefreshEkpUser() throws Exception {
log.info("-------------刷新EKP权限里的账号信息-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprEkpPermissionProperties.getAppUrl(), daprEkpPermissionProperties.getAppId(),
"/sysuserinfo/inner/doRefreshEkpUser", "", Object.class,
SecurityConstants.FROM_IN);
log.info("-------------刷新EKP权限里的账号信息-定时任务结束------------");
}
}
\ No newline at end of file
...@@ -20,10 +20,8 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -20,10 +20,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
...@@ -36,9 +34,8 @@ import javax.validation.constraints.NotBlank; ...@@ -36,9 +34,8 @@ import javax.validation.constraints.NotBlank;
*/ */
@Data @Data
@TableName("sys_role_menu_res") @TableName("sys_role_menu_res")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "新权限-角色-菜单-关联表") @Schema(description = "新权限-角色-菜单-关联表")
public class SysRoleMenuRes extends BaseEntity { public class SysRoleMenuRes {
/** /**
* 主键 * 主键
......
...@@ -20,10 +20,8 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -20,10 +20,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
...@@ -36,9 +34,8 @@ import javax.validation.constraints.NotBlank; ...@@ -36,9 +34,8 @@ import javax.validation.constraints.NotBlank;
*/ */
@Data @Data
@TableName("sys_user_role_res") @TableName("sys_user_role_res")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "新权限-账号-角色关联表") @Schema(description = "新权限-账号-角色关联表")
public class SysUserRoleRes extends BaseEntity { public class SysUserRoleRes {
/** /**
* 主键 * 主键
......
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* 新权限-字段vo
*
* @author huyc
* @date 2023-09-04 14:49:40
*/
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@Data
public class SysDictVo implements Serializable {
/**
* 名称
*/
@Schema(description = "名称")
private String id;
/**
* 编码
*/
@Schema(description = "编码")
private String name;
}
\ No newline at end of file
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* 新权限-账号管理表
*
* @author huyc
* @date 2023-09-04 14:49:40
*/
@Data
public class SysUserDeptVo implements Serializable {
/**
* 名称
*/
@Schema(description = "名称")
private String name;
/**
* 编码
*/
@Schema(description = "编码")
private String code;
/**
* 类型
*/
@Schema(description = "类型")
private String type;
/**
* 登录名
*/
@Schema(description = "登录名")
private String loginName;
}
\ No newline at end of file
...@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema; ...@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* 新权限-用户权限表 * 新权限-用户权限表
...@@ -18,8 +19,8 @@ public class SysUserPermissionSearchVo extends SysUserPermission { ...@@ -18,8 +19,8 @@ public class SysUserPermissionSearchVo extends SysUserPermission {
/** /**
* 多选导出或删除等操作 * 多选导出或删除等操作
*/ */
@Schema(description = "选中ID,多个逗号分割") @Schema(description = "选中ID,数组")
private String ids; private List<String> idList;
/** /**
* 创建时间区间 [开始时间,结束时间] * 创建时间区间 [开始时间,结束时间]
......
package com.yifu.cloud.plus.v1.yifu.permission.vo; package com.yifu.cloud.plus.v1.yifu.permission.vo;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex; import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
...@@ -21,16 +19,6 @@ import java.io.Serializable; ...@@ -21,16 +19,6 @@ import java.io.Serializable;
@Data @Data
public class SysUserPermissionVo extends RowIndex implements Serializable { public class SysUserPermissionVo extends RowIndex implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "id 不能为空")
@Length(max = 36, message = "id 不能超过36 个字符")
@ExcelAttribute(name = "id", isNotEmpty = true, errorInfo = "id 不能为空", maxLength = 36)
@Schema(description = "id")
@ExcelProperty("id")
private String id;
/** /**
* 员工姓名 * 员工姓名
*/ */
...@@ -83,26 +71,18 @@ public class SysUserPermissionVo extends RowIndex implements Serializable { ...@@ -83,26 +71,18 @@ public class SysUserPermissionVo extends RowIndex implements Serializable {
/** /**
* 是否包含(0 是 1否) * 是否包含(0 是 1否)
*/ */
@Length(max = 1, message = "是否包含(0 是 1否) 不能超过1 个字符") @Length(max = 1, message = "是否含下级部门 不能超过1 个字符")
@ExcelAttribute(name = "是否包含(0 是 1否)", maxLength = 1) @ExcelAttribute(name = "是否含下级部门", maxLength = 1)
@Schema(description = "是否包含(0 是 1否)") @Schema(description = "是否含下级部门")
@ExcelProperty("是否包含(0 是 1否)") @ExcelProperty("是否含下级部门")
private String isContains; private String isContains;
/** /**
* 授权状态(0启用、1禁用) * 授权状态(0启用、1禁用)
*/ */
@Length(max = 1, message = "授权状态(0启用、1禁用) 不能超过1 个字符") @Length(max = 1, message = "授权状态 不能超过1 个字符")
@ExcelAttribute(name = "授权状态(0启用、1禁用)", maxLength = 1) @ExcelAttribute(name = "授权状态", maxLength = 1)
@Schema(description = "授权状态(0启用、1禁用)") @Schema(description = "授权状态")
@ExcelProperty("授权状态(0启用、1禁用)") @ExcelProperty("授权状态")
private String permissionStatus; private String permissionStatus;
/**
* 删除状态(0是、1否)
*/
@Length(max = 1, message = "删除状态(0是、1否) 不能超过1 个字符")
@ExcelAttribute(name = "删除状态(0是、1否)", maxLength = 1)
@Schema(description = "删除状态(0是、1否)")
@ExcelProperty("删除状态(0是、1否)")
private String deleteFlag;
} }
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.permission.service.SysUserInfoService; import com.yifu.cloud.plus.v1.permission.service.SysUserInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo; import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSearchVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSearchVo;
...@@ -113,4 +114,32 @@ public class SysUserInfoController { ...@@ -113,4 +114,32 @@ public class SysUserInfoController {
return R.ok(sysUserInfoService.removeById(fdId)); return R.ok(sysUserInfoService.removeById(fdId));
} }
/**
* @Description: 手动同步并更新账号信息
* @Author: hgw
* @Date: 2023/9/5 16:14
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "手动同步并更新账号信息", description = "手动同步并更新账号信息")
@SysLog("手动同步并更新账号信息")
@PostMapping("/startRefreshEkpUser")
public R<String> startRefreshEkpUser() {
sysUserInfoService.doRefreshEkpUser();
return R.ok();
}
/**
* @param
* @Description: 定时任务-自动同步并更新账号信息
* @Author: hgw
* @Date: 2023/9/4 16:07
* @return: void
**/
@Inner
@Operation(description = "定时任务-自动同步并更新账号信息")
@PostMapping("/inner/doRefreshEkpUser")
public void doRefreshEkpUser() {
sysUserInfoService.doRefreshEkpUser();
}
} }
...@@ -7,6 +7,8 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; ...@@ -7,6 +7,8 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission; import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
...@@ -33,7 +35,6 @@ public class SysUserPermissionController { ...@@ -33,7 +35,6 @@ public class SysUserPermissionController {
private final SysUserPermissionService sysUserPermissionService; private final SysUserPermissionService sysUserPermissionService;
/** /**
* 简单分页查询 * 简单分页查询
* *
...@@ -47,18 +48,6 @@ public class SysUserPermissionController { ...@@ -47,18 +48,6 @@ public class SysUserPermissionController {
return new R<>(sysUserPermissionService.getSysUserPermissionPage(page, sysUserPermission)); return new R<>(sysUserPermissionService.getSysUserPermissionPage(page, sysUserPermission));
} }
/**
* 不分页查询
*
* @param sysUserPermission 新权限-用户权限表
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage")
public R<List<SysUserPermission>> getSysUserPermissionNoPage(@RequestBody SysUserPermissionSearchVo sysUserPermission) {
return R.ok(sysUserPermissionService.noPageDiy(sysUserPermission));
}
/** /**
* 通过id查询新权限-用户权限表 * 通过id查询新权限-用户权限表
* *
...@@ -102,15 +91,15 @@ public class SysUserPermissionController { ...@@ -102,15 +91,15 @@ public class SysUserPermissionController {
/** /**
* 通过id删除新权限-用户权限表 * 通过id删除新权限-用户权限表
* *
* @param id id * @param idList
* @return R * @return R
*/ */
@Operation(description = "通过id删除新权限-用户权限表:hasPermission('permission_sysuserpermission_del')") @Operation(description = "通过id删除新权限-用户权限表:hasPermission('permission_sysuserpermission_del')")
@SysLog("通过id删除新权限-用户权限表") @SysLog("通过id删除新权限-用户权限表")
@DeleteMapping("/{id}") @PostMapping("/deleteByIds")
@PreAuthorize("@pms.hasPermission('permission_sysuserpermission_del')") @PreAuthorize("@pms.hasPermission('permission_sysuserpermission_del')")
public R<Boolean> removeById(@PathVariable String id) { public R<Boolean> removeById(@RequestBody List<String> idList) {
return R.ok(sysUserPermissionService.removeById(id)); return R.ok(sysUserPermissionService.removeBatchByIds(idList));
} }
/** /**
...@@ -139,4 +128,29 @@ public class SysUserPermissionController { ...@@ -139,4 +128,29 @@ public class SysUserPermissionController {
public void export(HttpServletResponse response, @RequestBody SysUserPermissionSearchVo searchVo) { public void export(HttpServletResponse response, @RequestBody SysUserPermissionSearchVo searchVo) {
sysUserPermissionService.listExport(response, searchVo); sysUserPermissionService.listExport(response, searchVo);
} }
/**
* 名称,编码模糊搜索
*
* @param page 分页对象
* @param searchVo 新权限-用户权限表
* @return
*/
@Operation(description = "根据名称,编码模糊搜索")
@GetMapping("/customerPage")
public R<IPage<SysUserDeptVo>> getNameCodePage(Page<SysUserDeptVo> page, SysUserDeptVo searchVo) {
return new R<>(sysUserPermissionService.getNameCodePage(page,searchVo));
}
/**
* 根据类型查询字典值
*
* @param type 字典类型
* @return
*/
@Operation(description = "根据类型查询字典值")
@PostMapping("/selectDictByType")
public R<List<SysDictVo>> selectDictByType(@RequestParam String type) {
return new R<>(sysUserPermissionService.selectDictByType(type));
}
} }
...@@ -22,6 +22,8 @@ import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo; ...@@ -22,6 +22,8 @@ import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 新权限-账号管理表 * 新权限-账号管理表
* *
...@@ -37,4 +39,14 @@ public interface SysUserInfoMapper extends BaseMapper<SysUserInfo> { ...@@ -37,4 +39,14 @@ public interface SysUserInfoMapper extends BaseMapper<SysUserInfo> {
* @return * @return
*/ */
IPage<SysUserInfo> getSysUserInfoPage(Page<SysUserInfo> page, @Param("sysUserInfo") SysUserInfo sysUserInfo); IPage<SysUserInfo> getSysUserInfoPage(Page<SysUserInfo> page, @Param("sysUserInfo") SysUserInfo sysUserInfo);
/**
* @param
* @Description: 获取EKP全部账号
* @Author: hgw
* @Date: 2023/9/4 11:32
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo>
**/
List<SysUserInfo> getEkpUser();
} }
...@@ -4,9 +4,15 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,9 +4,15 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission; import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 新权限-用户权限表 * 新权限-用户权限表
* *
...@@ -15,10 +21,86 @@ import org.apache.ibatis.annotations.Param; ...@@ -15,10 +21,86 @@ import org.apache.ibatis.annotations.Param;
*/ */
@Mapper @Mapper
public interface SysUserPermissionMapper extends BaseMapper<SysUserPermission> { public interface SysUserPermissionMapper extends BaseMapper<SysUserPermission> {
/** /**
* 新权限-用户权限表简单分页查询 * 新权限-用户权限表简单分页查询
* @param sysUserPermission 新权限-用户权限表 *
* @return * @param sysUserPermission 新权限-用户权限表
*/ * @return
IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, @Param("sysUserPermission") SysUserPermission sysUserPermission); */
IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, @Param("sysUserPermission") SysUserPermissionSearchVo sysUserPermission);
/**
* 导出查询数量
*
* @param sysUserPermission 新权限-用户权限表
* @return
*/
long userSelectCount(@Param("sysUserPermission") SysUserPermissionSearchVo sysUserPermission);
/**
* 查询导出数据
*
* @param sysUserPermission 新权限-用户权限表
* @return
*/
List<SysUserPermissionVo> userSelectList(@Param("sysUserPermission") SysUserPermissionSearchVo sysUserPermission);
/**
* 根据名称或者编码查询数据
* 单位权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectUnitVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名称或者编码查询数据
* 合同权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectContractVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名称或者编码查询数据
* 合同权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectContractSimpleVO(Page<SysUserDeptVo> page, @Param("loginName") String loginName, @Param("name") String name, @Param("type") String type);
/**
* 根据名称或者编码查询数据
* 项目权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectSettleVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名称或者编码查询数据
* 商机权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectBusinessVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名称或者编码查询数据
* 报价单权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectQuotationVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名称或者编码查询数据
* 部门&&收入归属权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectDeptVO(Page<SysUserDeptVo> page, @Param("name") String name);
List<SysDictVo> selectDictByType(@Param("type") String type);
} }
...@@ -60,4 +60,13 @@ public interface SysUserInfoService extends IService<SysUserInfo> { ...@@ -60,4 +60,13 @@ public interface SysUserInfoService extends IService<SysUserInfo> {
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/ **/
R<String> saveOrUpdateUserInfo(SysUserInfoSaveVo vo); R<String> saveOrUpdateUserInfo(SysUserInfoSaveVo vo);
/**
* @param
* @Description: 同步并更新账号信息
* @Author: hgw
* @Date: 2023/9/4 11:30
* @return: void
**/
void doRefreshEkpUser();
} }
...@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission; import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -30,5 +32,12 @@ public interface SysUserPermissionService extends IService<SysUserPermission> { ...@@ -30,5 +32,12 @@ public interface SysUserPermissionService extends IService<SysUserPermission> {
void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo); void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo);
List<SysUserPermission> noPageDiy(SysUserPermissionSearchVo searchVo); /**
* 新权限-用户权限表简单分页查询
* @param searchVo
* @return
*/
IPage<SysUserDeptVo> getNameCodePage(Page<SysUserDeptVo> page, SysUserDeptVo searchVo);
List<SysDictVo> selectDictByType(String type);
} }
...@@ -79,15 +79,15 @@ public class SysRoleInfoServiceImpl extends ServiceImpl<SysRoleInfoMapper, SysRo ...@@ -79,15 +79,15 @@ public class SysRoleInfoServiceImpl extends ServiceImpl<SysRoleInfoMapper, SysRo
SysRoleMenuResSearchVo sysRoleMenuRes = new SysRoleMenuResSearchVo(); SysRoleMenuResSearchVo sysRoleMenuRes = new SysRoleMenuResSearchVo();
sysRoleMenuRes.setRoleId(role.getFdId()); sysRoleMenuRes.setRoleId(role.getFdId());
List<SysRoleMenuRes> resList = sysRoleMenuResService.noPageDiy(sysRoleMenuRes); List<SysRoleMenuRes> resList = sysRoleMenuResService.noPageDiy(sysRoleMenuRes);
List<TreeNode<String>> collect = sysMenuMapper
.selectList(Wrappers.<SysMenu>lambdaQuery()
.orderByAsc(SysMenu::getCreateTime)).stream()
.map(getNodeFunction()).collect(Collectors.toList());
List<Tree<String>> tree = TreeUtil.build(collect, CommonConstants.ZERO_STRING);
vo.setRole(role); vo.setRole(role);
vo.setResList(resList); vo.setResList(resList);
vo.setTree(tree);
} }
List<TreeNode<String>> collect = sysMenuMapper
.selectList(Wrappers.<SysMenu>lambdaQuery()
.orderByAsc(SysMenu::getCreateTime)).stream()
.map(getNodeFunction()).collect(Collectors.toList());
List<Tree<String>> tree = TreeUtil.build(collect, CommonConstants.ZERO_STRING);
vo.setTree(tree);
return R.ok(vo); return R.ok(vo);
} }
...@@ -111,6 +111,9 @@ public class SysRoleInfoServiceImpl extends ServiceImpl<SysRoleInfoMapper, SysRo ...@@ -111,6 +111,9 @@ public class SysRoleInfoServiceImpl extends ServiceImpl<SysRoleInfoMapper, SysRo
return R.failed("名称已存在"); return R.failed("名称已存在");
} }
this.saveOrUpdate(role); this.saveOrUpdate(role);
for (SysRoleMenuRes res : resList) {
res.setRoleId(role.getFdId());
}
sysRoleMenuResService.saveBatch(resList); sysRoleMenuResService.saveBatch(resList);
return R.ok("保存成功"); return R.ok("保存成功");
} }
......
...@@ -15,7 +15,6 @@ package com.yifu.cloud.plus.v1.permission.service.impl;/* ...@@ -15,7 +15,6 @@ package com.yifu.cloud.plus.v1.permission.service.impl;/*
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
...@@ -24,7 +23,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -24,7 +23,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.permission.mapper.SysRoleMenuResMapper; import com.yifu.cloud.plus.v1.permission.mapper.SysRoleMenuResMapper;
import com.yifu.cloud.plus.v1.permission.service.SysRoleMenuResService; import com.yifu.cloud.plus.v1.permission.service.SysRoleMenuResService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleMenuRes; import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleMenuRes;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleMenuResSearchVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleMenuResSearchVo;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
...@@ -62,7 +60,6 @@ public class SysRoleMenuResServiceImpl extends ServiceImpl<SysRoleMenuResMapper, ...@@ -62,7 +60,6 @@ public class SysRoleMenuResServiceImpl extends ServiceImpl<SysRoleMenuResMapper,
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) { if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) {
wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd()); wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd());
} }
wrapper.orderByDesc(BaseEntity::getCreateTime);
return baseMapper.selectList(wrapper); return baseMapper.selectList(wrapper);
} }
...@@ -80,14 +77,6 @@ public class SysRoleMenuResServiceImpl extends ServiceImpl<SysRoleMenuResMapper, ...@@ -80,14 +77,6 @@ public class SysRoleMenuResServiceImpl extends ServiceImpl<SysRoleMenuResMapper,
private LambdaQueryWrapper buildQueryWrapper(SysRoleMenuResSearchVo entity) { private LambdaQueryWrapper buildQueryWrapper(SysRoleMenuResSearchVo entity) {
LambdaQueryWrapper<SysRoleMenuRes> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<SysRoleMenuRes> wrapper = Wrappers.lambdaQuery();
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) {
wrapper.ge(SysRoleMenuRes::getCreateTime, entity.getCreateTimes()[0])
.le(SysRoleMenuRes::getCreateTime,
entity.getCreateTimes()[1]);
}
if (Common.isNotNull(entity.getCreateName())) {
wrapper.eq(SysRoleMenuRes::getCreateName, entity.getCreateName());
}
return wrapper; return wrapper;
} }
......
...@@ -28,6 +28,7 @@ import com.yifu.cloud.plus.v1.permission.service.SysUserRoleResService; ...@@ -28,6 +28,7 @@ import com.yifu.cloud.plus.v1.permission.service.SysUserRoleResService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleMenuRes;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo; import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes; import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo;
...@@ -148,10 +149,26 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs ...@@ -148,10 +149,26 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
sysUserRoleResService.deleteByUserId(user.getFdId()); sysUserRoleResService.deleteByUserId(user.getFdId());
} }
this.saveOrUpdate(user); this.saveOrUpdate(user);
for (SysUserRoleRes res : resList) {
res.setUserId(user.getFdId());
}
sysUserRoleResService.saveBatch(resList); sysUserRoleResService.saveBatch(resList);
return R.ok("保存成功"); return R.ok("保存成功");
} }
return R.failed("请检查信息"); return R.failed("请检查信息");
} }
/**
* @param
* @Description: 同步并更新账号信息
* @Author: hgw
* @Date: 2023/9/4 11:31
* @return: java.lang.String
**/
@Override
public void doRefreshEkpUser() {
List<SysUserInfo> ekpUser = baseMapper.getEkpUser();
this.saveOrUpdateBatch(ekpUser);
}
} }
package com.yifu.cloud.plus.v1.permission.service.impl; package com.yifu.cloud.plus.v1.permission.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.context.AnalysisContext;
...@@ -9,17 +8,18 @@ import com.alibaba.excel.read.listener.ReadListener; ...@@ -9,17 +8,18 @@ import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder; import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils; import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.permission.mapper.SysUserPermissionMapper; import com.yifu.cloud.plus.v1.permission.mapper.SysUserPermissionMapper;
import com.yifu.cloud.plus.v1.permission.service.SysUserPermissionService; import com.yifu.cloud.plus.v1.permission.service.SysUserPermissionService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission; import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionVo;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
...@@ -35,177 +35,181 @@ import java.util.List; ...@@ -35,177 +35,181 @@ import java.util.List;
@Log4j2 @Log4j2
@Service @Service
public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionMapper, SysUserPermission> implements SysUserPermissionService { public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionMapper, SysUserPermission> implements SysUserPermissionService {
/**
* 新权限-用户权限表简单分页查询
* @param sysUserPermission 新权限-用户权限表
* @return
*/
@Override
public IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, SysUserPermissionSearchVo sysUserPermission){
return baseMapper.getSysUserPermissionPage(page,sysUserPermission);
}
/** /**
* 新权限-用户权限表批量导出 * 新权限-用户权限表简单分页查询
* @param searchVo 新权限-用户权限表 *
* @return * @param sysUserPermission 新权限-用户权限表
*/ * @return
@Override */
public void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo){ @Override
String fileName = "用户权限表批量导出" + DateUtil.getThisTime() + ".xlsx"; public IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, SysUserPermissionSearchVo sysUserPermission) {
//获取要导出的列表 return baseMapper.getSysUserPermissionPage(page, sysUserPermission);
List<SysUserPermission> list = new ArrayList<>(); }
long count = noPageCountDiy(searchVo);
try (ServletOutputStream out = response.getOutputStream()){
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, SysUserPermission.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT){
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = noPageDiy(searchVo);
if (Common.isNotNull(list)){
ExcelUtil<SysUserPermission> util = new ExcelUtil<>(SysUserPermission.class);
for (SysUserPermission vo:list){
util.convertEntity(vo,null,null,null);
}
}
if (Common.isNotNull(list)){
WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表"+index).build();
excelWriter.write(list,writeSheet);
index++;
}
if (Common.isNotNull(list)){
list.clear();
}
}
}else {
WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表"+index).build();
excelWriter.write(list,writeSheet);
}
if (Common.isNotNull(list)){
list.clear();
}
excelWriter.finish();
}catch (Exception e){
log.error("执行异常" ,e);
}
}
@Override /**
public List<SysUserPermission> noPageDiy(SysUserPermissionSearchVo searchVo) { * 新权限-用户权限表批量导出
LambdaQueryWrapper<SysUserPermission> wrapper = buildQueryWrapper(searchVo); *
List<String> idList = Common.getList(searchVo.getIds()); * @param searchVo 新权限-用户权限表
if (Common.isNotNull(idList)){ * @return
wrapper.in(SysUserPermission::getId,idList); */
} @Override
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0){ public void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo) {
wrapper.last(" limit "+ searchVo.getLimitStart() +","+ searchVo.getLimitEnd()); String fileName = "用户权限表批量导出" + DateUtil.getThisTime() + ".xlsx";
} //获取要导出的列表
wrapper.orderByDesc(BaseEntity::getCreateTime); List<SysUserPermissionVo> list = new ArrayList<>();
return baseMapper.selectList(wrapper); long count = baseMapper.userSelectCount(searchVo);
} try (ServletOutputStream out = response.getOutputStream()) {
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, SysUserPermissionVo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.userSelectList(searchVo);
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
if (Common.isNotNull(list)) {
list.clear();
}
}
} else {
WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
list.clear();
}
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
}
}
private Long noPageCountDiy(SysUserPermissionSearchVo searchVo) { @Override
LambdaQueryWrapper<SysUserPermission> wrapper = buildQueryWrapper(searchVo); public IPage<SysUserDeptVo> getNameCodePage(Page<SysUserDeptVo> page, SysUserDeptVo searchVo) {
List<String> idList = Common.getList(searchVo.getIds()); if (Common.isNotNull(searchVo) && Common.isNotNull(searchVo.getType())) {
if (Common.isNotNull(idList)){ YifuUser user = SecurityUtils.getUser();
wrapper.in(SysUserPermission::getId,idList); IPage<SysUserDeptVo> iPage;
} //客户权限
return baseMapper.selectCount(wrapper); if (CommonConstants.ONE_STRING.equals(searchVo.getType())) {
} iPage = baseMapper.selectUnitVO(page,searchVo.getName());
} else if (CommonConstants.TWO_STRING.equals(searchVo.getType())) {
//商机权限
iPage = baseMapper.selectBusinessVO(page, searchVo.getName());
} else if (CommonConstants.THREE_STRING.equals(searchVo.getType())) {
//报价单权限
iPage = baseMapper.selectQuotationVO(page, searchVo.getName());
} else if (CommonConstants.FOUR_STRING.equals(searchVo.getType())) {
//合同权限
if (CommonConstants.ONE_STRING.equals(user.getId())) {
iPage = baseMapper.selectContractVO(page, searchVo.getName());
} else {
iPage = baseMapper.selectContractSimpleVO(page, searchVo.getName(),searchVo.getName(),searchVo.getType());
}
} else if (CommonConstants.EIGHT_STRING.equals(searchVo.getType()) || CommonConstants.NINE_STRING.equals(searchVo.getType())) {
//部门&&收入归属权限
iPage = baseMapper.selectDeptVO(page, searchVo.getName());
} else {
//项目权限
if (CommonConstants.ONE_STRING.equals(user.getId())) {
iPage = baseMapper.selectSettleVO(page, searchVo.getName());
} else {
iPage = baseMapper.selectContractSimpleVO(page, searchVo.getName(),searchVo.getName(),searchVo.getType());
}
}
return iPage;
}
return null;
}
private LambdaQueryWrapper buildQueryWrapper(SysUserPermissionSearchVo entity){ @Override
LambdaQueryWrapper<SysUserPermission> wrapper = Wrappers.lambdaQuery(); public List<SysDictVo> selectDictByType(String type) {
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) { return baseMapper.selectDictByType(type);
wrapper.ge(SysUserPermission::getCreateTime, entity.getCreateTimes()[0]) }
.le(SysUserPermission::getCreateTime,
entity.getCreateTimes()[1]);
}
if (Common.isNotNull(entity.getCreateName())){
wrapper.eq(SysUserPermission::getCreateName,entity.getCreateName());
}
return wrapper;
}
@Override @Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) { public R<List<ErrorMessage>> importDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<SysUserPermissionVo> util1 = new ExcelUtil<>(SysUserPermissionVo.class);; ExcelUtil<SysUserPermissionVo> util1 = new ExcelUtil<>(SysUserPermissionVo.class);
// 写法2: // 写法2:
// 匿名内部类 不用额外写一个DemoDataListener // 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭 // 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try { try {
EasyExcel.read(inputStream, SysUserPermissionVo.class, new ReadListener<SysUserPermissionVo>() { EasyExcel.read(inputStream, SysUserPermissionVo.class, new ReadListener<SysUserPermissionVo>() {
/** /**
* 单次缓存的数据量 * 单次缓存的数据量
*/ */
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT; public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/** /**
*临时存储 *临时存储
*/ */
private List<SysUserPermissionVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); private List<SysUserPermissionVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override @Override
public void invoke(SysUserPermissionVo data, AnalysisContext context) { public void invoke(SysUserPermissionVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder(); ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex(); Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1); data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex()); ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){ if (Common.isNotNull(errorMessage)) {
errorMessageList.add(errorMessage); errorMessageList.add(errorMessage);
}else { } else {
cachedDataList.add(data); cachedDataList.add(data);
} }
if (cachedDataList.size() >= BATCH_COUNT) { if (cachedDataList.size() >= BATCH_COUNT) {
saveData(); saveData();
// 存储完成清理 list // 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
} }
} }
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/** @Override
* 加上存储数据库 public void doAfterAllAnalysed(AnalysisContext context) {
*/ saveData();
private void saveData() { }
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importSysUserPermission(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
private void importSysUserPermission(List<SysUserPermissionVo> excelVOList, List<ErrorMessage> errorMessageList) {
// 个性化校验逻辑
ErrorMessage errorMsg;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
SysUserPermissionVo excel = excelVOList.get(i);
// 插入 /**
insertExcel(excel); * 加上存储数据库
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),CommonConstants.SAVE_SUCCESS)); */
} private void saveData() {
} log.info("{}条数据,开始存储数据库!", cachedDataList.size());
/** importSysUserPermission(cachedDataList, errorMessageList);
* 插入excel bad record log.info("存储数据库成功!");
*/ }
private void insertExcel(SysUserPermissionVo excel) { }).sheet().doRead();
SysUserPermission insert = new SysUserPermission(); } catch (Exception e) {
BeanUtil.copyProperties(excel, insert); log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
this.save(insert); return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
} }
return R.ok(errorMessageList);
}
private void importSysUserPermission(List<SysUserPermissionVo> excelVOList, List<ErrorMessage> errorMessageList) {
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
SysUserPermissionVo excel = excelVOList.get(i);
// 插入
insertExcel(excel);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_SUCCESS));
}
}
/**
* 插入excel bad record
*/
private void insertExcel(SysUserPermissionVo excel) {
SysUserPermission insert = new SysUserPermission();
BeanUtil.copyProperties(excel, insert);
this.save(insert);
}
} }
...@@ -15,7 +15,6 @@ package com.yifu.cloud.plus.v1.permission.service.impl;/* ...@@ -15,7 +15,6 @@ package com.yifu.cloud.plus.v1.permission.service.impl;/*
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
...@@ -24,7 +23,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -24,7 +23,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.permission.mapper.SysUserRoleResMapper; import com.yifu.cloud.plus.v1.permission.mapper.SysUserRoleResMapper;
import com.yifu.cloud.plus.v1.permission.service.SysUserRoleResService; import com.yifu.cloud.plus.v1.permission.service.SysUserRoleResService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes; import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserRoleResSearchVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserRoleResSearchVo;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
...@@ -62,7 +60,6 @@ public class SysUserRoleResServiceImpl extends ServiceImpl<SysUserRoleResMapper, ...@@ -62,7 +60,6 @@ public class SysUserRoleResServiceImpl extends ServiceImpl<SysUserRoleResMapper,
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) { if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) {
wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd()); wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd());
} }
wrapper.orderByDesc(BaseEntity::getCreateTime);
return baseMapper.selectList(wrapper); return baseMapper.selectList(wrapper);
} }
...@@ -78,14 +75,6 @@ public class SysUserRoleResServiceImpl extends ServiceImpl<SysUserRoleResMapper, ...@@ -78,14 +75,6 @@ public class SysUserRoleResServiceImpl extends ServiceImpl<SysUserRoleResMapper,
private LambdaQueryWrapper buildQueryWrapper(SysUserRoleResSearchVo entity) { private LambdaQueryWrapper buildQueryWrapper(SysUserRoleResSearchVo entity) {
LambdaQueryWrapper<SysUserRoleRes> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<SysUserRoleRes> wrapper = Wrappers.lambdaQuery();
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) {
wrapper.ge(SysUserRoleRes::getCreateTime, entity.getCreateTimes()[0])
.le(SysUserRoleRes::getCreateTime,
entity.getCreateTimes()[1]);
}
if (Common.isNotNull(entity.getCreateName())) {
wrapper.eq(SysUserRoleRes::getCreateName, entity.getCreateName());
}
return wrapper; return wrapper;
} }
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM sys_menu a FROM sys_menu a
<where> <where>
1=1 AND a.DELETE_STATUS = '1' a.DELETE_STATUS = '1'
<include refid="sysMenu_where"/> <include refid="sysMenu_where"/>
</where> </where>
order by a.CREATE_TIME desc order by a.CREATE_TIME desc
......
...@@ -116,4 +116,14 @@ ...@@ -116,4 +116,14 @@
order by a.CREATE_TIME desc order by a.CREATE_TIME desc
</select> </select>
<!--list-->
<select id="getEkpUser" resultMap="sysUserInfoMap">
select e.fd_id,e.fd_name,p.fd_login_name,e.fd_ldap_dn
,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) AS fd_dept_name
,p.fd_mobile_no,p.fd_email
from sys_org_element e JOIN sys_org_person p on e.fd_id=p.fd_id
where e.fd_is_available = '1'
</select>
</mapper> </mapper>
...@@ -20,11 +20,33 @@ ...@@ -20,11 +20,33 @@
<result property="createTime" column="CREATE_TIME"/> <result property="createTime" column="CREATE_TIME"/>
<result property="updateTime" column="UPDATE_TIME"/> <result property="updateTime" column="UPDATE_TIME"/>
</resultMap> </resultMap>
<resultMap id="sysUserPermissionExportMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionVo">
<result property="empName" column="EMP_NAME"/>
<result property="empLoginName" column="EMP_LOGIN_NAME"/>
<result property="empDept" column="EMP_DEPT"/>
<result property="permissionType" column="PERMISSION_TYPE"/>
<result property="name" column="NAME"/>
<result property="code" column="CODE"/>
<result property="isContains" column="IS_CONTAINS"/>
<result property="permissionStatus" column="PERMISSION_STATUS"/>
</resultMap>
<resultMap id="nameAndCodeMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo">
<result property="name" column="name"/>
<result property="code" column="code"/>
</resultMap>
<resultMap id="dictMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo">
<result property="id" column="id"/>
<result property="name" column="name"/>
</resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.ID, a.ID,
a.EMP_NAME, a.EMP_NAME,
a.EMP_LOGIN_NAME, a.EMP_LOGIN_NAME,
a.EMP_DEPT, b.fd_dept_name,
a.PERMISSION_TYPE, a.PERMISSION_TYPE,
a.NAME, a.NAME,
a.CODE, a.CODE,
...@@ -35,6 +57,13 @@ ...@@ -35,6 +57,13 @@
</sql> </sql>
<sql id="sysUserPermission_where"> <sql id="sysUserPermission_where">
<if test="sysUserPermission != null"> <if test="sysUserPermission != null">
<if test="sysUserPermission.idList != null">
AND a.id in
<foreach item="idStr" index="index" collection="sysUserPermission.idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
<if test="sysUserPermission.idList == null">
<if test="sysUserPermission.empName != null and sysUserPermission.empName.trim() != ''"> <if test="sysUserPermission.empName != null and sysUserPermission.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{sysUserPermission.empName},'%') AND a.EMP_NAME like concat('%',#{sysUserPermission.empName},'%')
</if> </if>
...@@ -42,7 +71,7 @@ ...@@ -42,7 +71,7 @@
AND a.EMP_LOGIN_NAME = #{sysUserPermission.empLoginName} AND a.EMP_LOGIN_NAME = #{sysUserPermission.empLoginName}
</if> </if>
<if test="sysUserPermission.empDept != null and sysUserPermission.empDept.trim() != ''"> <if test="sysUserPermission.empDept != null and sysUserPermission.empDept.trim() != ''">
AND a.EMP_DEPT like concat('%',#{sysUserPermission.empDept},'%') AND b.EMP_DEPT like concat('%',#{sysUserPermission.empDept},'%')
</if> </if>
<if test="sysUserPermission.permissionType != null and sysUserPermission.permissionType.trim() != ''"> <if test="sysUserPermission.permissionType != null and sysUserPermission.permissionType.trim() != ''">
AND a.PERMISSION_TYPE = #{sysUserPermission.permissionType} AND a.PERMISSION_TYPE = #{sysUserPermission.permissionType}
...@@ -56,17 +85,131 @@ ...@@ -56,17 +85,131 @@
<if test="sysUserPermission.permissionStatus != null and sysUserPermission.permissionStatus.trim() != ''"> <if test="sysUserPermission.permissionStatus != null and sysUserPermission.permissionStatus.trim() != ''">
AND a.PERMISSION_STATUS = #{sysUserPermission.permissionStatus} AND a.PERMISSION_STATUS = #{sysUserPermission.permissionStatus}
</if> </if>
</if>
</if> </if>
</sql> </sql>
<!--sysUserPermission简单分页查询--> <!--sysUserPermission简单分页查询-->
<select id="getSysUserPermissionPage" resultMap="sysUserPermissionMap"> <select id="getSysUserPermissionPage" resultMap="sysUserPermissionMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM sys_user_permission a FROM sys_user_permission a left join sys_user_info b on a.EMP_LOGIN_NAME = b.fd_login_name
<where> <where>
1=1 AND a.DELETE_FLAG = '1' a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/> <include refid="sysUserPermission_where"/>
</where> </where>
order by a.CREATE_TIME desc order by a.CREATE_TIME desc
</select> </select>
<select id="userSelectCount" resultType="java.lang.Long">
SELECT
count(1)
FROM sys_user_permission a left join sys_user_info b on a.EMP_LOGIN_NAME = b.fd_login_name
<where>
a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/>
</where>
</select>
<select id="userSelectList" resultMap="sysUserPermissionExportMap">
SELECT
a.EMP_NAME,
a.EMP_LOGIN_NAME,
b.fd_dept_name,
b.name AS PERMISSION_TYPE,
a.NAME,
a.CODE,
CASE WHEN a.IS_CONTAINS=0 THEN "是"
WHEN a.IS_CONTAINS =1 THEN "否"
ELSE a.IS_CONTAINS END as IS_CONTAINS,
CASE WHEN a.PERMISSION_STATUS=0 THEN "启用"
WHEN a.PERMISSION_STATUS =1 THEN "禁用"
ELSE a.PERMISSION_STATUS END as PERMISSION_STATUS
FROM sys_user_permission a
LEFT JOIN permission_type b on a.PERMISSION_TYPE = b.id
LEFT JOIN sys_user_info b on a.EMP_LOGIN_NAME = b.fd_login_name
<where>
a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/>
</where>
limit #{sysUserPermission.limitStart},#{sysUserPermission.limitEnd}
</select>
<select id="selectUnitVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3a9d1d4d438bfc code,a.fd_3a9d1d4caeeeb8 name
from ekp_05b7485fd444f95a6177 a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3a9d1d4d438bfc like concat('%',#{name},'%') or a.fd_3a9d1d4caeeeb8 like concat('%',#{name},'%'))
</if>
</select>
<select id="selectContractVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3ade33763baa0e code,a.fd_3ade334bac0016 name
from ekp_0103c453b2848c3bb31c a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3ade33763baa0e like concat('%',#{name},'%') or a.fd_3ade334bac0016 like concat('%',#{name},'%'))
</if>
</select>
<select id="selectSettleVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3a37fe508071fe code,a.fd_3a2b38c61ef9aa name
from ekp_24a8e6a7fc143bb8c48a a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3a37fe508071fe like concat('%',#{name},'%') or a.fd_3a2b38c61ef9aa like concat('%',#{name},'%'))
</if>
</select>
<select id="selectContractSimpleVO" resultMap="nameAndCodeMap">
SELECT
a.NAME,
a.CODE
from sys_user_permission a
where a.EMP_LOGIN_NAME = #{loginName} and a.PERMISSION_TYPE = #{type}
<if test="name != null and name.trim() != ''">
AND (a.NAME like concat('%',#{name},'%') or a.CODE like concat('%',#{name},'%'))
</if>
</select>
<select id="selectBusinessVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3b107f1084fd96 code,a.fd_3b04b95268f19c name
from ekp_2f8e08660c542d8a169f a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3b107f1084fd96 like concat('%',#{name},'%') or a.fd_3b04b95268f19c like concat('%',#{name},'%'))
</if>
</select>
<select id="selectQuotationVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3b04b9dc64a9f4 code,a.fd_3b04b9daa0c25e name
from ekp_2f8e08660c542d8a169f a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3b04b9dc64a9f4 like concat('%',#{name},'%') or a.fd_3b04b9daa0c25e like concat('%',#{name},'%'))
</if>
</select>
<select id="selectDeptVO" resultMap="nameAndCodeMap">
SELECT
a.fd_no code,a.fd_name name
from sys_org_element a
where a.fd_is_available = '1' and fd_org_type = 2
<if test="name != null and name.trim() != ''">
AND (a.fd_no like concat('%',#{name},'%') or a.fd_name like concat('%',#{name},'%'))
</if>
</select>
<select id="selectDictByType" resultMap="dictMap">
SELECT
a.dict_id as id,a.name
from permission_type a
where a.dict_type = #{type}
</select>
</mapper> </mapper>
...@@ -299,6 +299,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -299,6 +299,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
*/ */
@Override @Override
public void sumSearchExport(HttpServletResponse response, TPaymentInfoSearchVo searchVo) { public void sumSearchExport(HttpServletResponse response, TPaymentInfoSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
String fileName = PaymentConstants.PAYMENT_SEARCH_EXPORT + DateUtil.getThisTime() + CommonConstants.XLSX; String fileName = PaymentConstants.PAYMENT_SEARCH_EXPORT + DateUtil.getThisTime() + CommonConstants.XLSX;
//获取要导出的列表 //获取要导出的列表
List<TPaymentInfoNewExportVo> list = new ArrayList<>(); List<TPaymentInfoNewExportVo> list = new ArrayList<>();
...@@ -309,6 +310,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -309,6 +310,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
response.setContentType(CommonConstants.MULTIPART_FORM_DATA); response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, "UTF-8")); response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, "UTF-8"));
if (count > 150000 && !CommonConstants.ONE_STRING.equals(user.getId())) {
out.write("导出量过大,请选择更多查询条件!如果确定要导出这些数据请联系管理员操作".getBytes("GBK"));
out.close();
return;
}
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TPaymentInfoNewExportVo.class).includeColumnFieldNames(searchVo.getExportFields()).build(); ExcelWriter excelWriter = EasyExcel.write(out, TPaymentInfoNewExportVo.class).includeColumnFieldNames(searchVo.getExportFields()).build();
int index = 0; int index = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment