Sfoglia il codice sorgente

租户删除校验

dongxin 1 anno fa
parent
commit
addee99954

+ 10 - 0
commons/src/main/java/com/jzg/commons/entity/po/SysSystem.java

@@ -3,6 +3,8 @@ package com.jzg.commons.entity.po;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.jzg.commons.core.base.BaseModel;
 import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
 import lombok.Data;
 
 /**
@@ -98,4 +100,12 @@ public class SysSystem extends BaseModel {
     @TableField(exist = false)
     private String sysIconUrl;
 
+    /** 系统用户名 */
+    @TableField(exist = false)
+    private String userName;
+
+    /** 系统账号 */
+    @TableField(exist = false)
+    private String userAccount;
+
 }

+ 201 - 0
commons/src/main/java/com/jzg/commons/entity/po/SysUserJzgInfo.java

@@ -0,0 +1,201 @@
+package com.jzg.commons.entity.po;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Date;
+
+import com.jzg.commons.core.base.BaseModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 用户信息表实体 sys_user
+ *
+ * @author dongxin
+ */
+@Schema(description = "用户信息表实体")
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class SysUserJzgInfo extends BaseModel {
+
+    /** 工号 */
+    @Schema(description = "工号")
+    private String id;
+
+    /** 用户id */
+    @Schema(description = "用户id")
+    private String userId;
+
+    /** 系统code */
+    @Schema(description = "系统code")
+    private String systemCode;
+
+    /** 状态  1:正常   0:删除 2:审批中  3:审批不通过 */
+    @Schema(description = "状态  1:正常   0:删除 2:审批中  3:审批不通过")
+    private Integer status;
+
+    /** 机构ID */
+    @Schema(description = "机构ID")
+    private String deptId;
+
+    /** 微信id */
+    @Schema(description = "微信id")
+    private String openId;
+
+    /** 支付宝id */
+    @Schema(description = "支付宝id")
+    private String alipay;
+
+    /** 审批意见 */
+    @Schema(description = "审批意见")
+    private String approvalOpinion;
+
+    /** 身份证号 */
+    @Schema(description = "身份证号")
+    private String identity;
+
+    /** 身份证有效期起期 */
+    @Schema(description = "身份证有效期起期")
+    private String identityTimeStart;
+
+    /** 身份证有效期止期 */
+    @Schema(description = "身份证有效期止期")
+    private String identityTimeEnd;
+
+    /** 离司时间 */
+    @Schema(description = "离司时间")
+    private LocalDate logoutTime;
+
+    /** 头像 */
+    @Schema(description = "头像")
+    private String headSculpture;
+
+    /** 0 未验证 1 已验证 */
+    @Schema(description = "0 未验证 1 已验证")
+    private Integer factorVerify;
+
+    /** 居住地址 */
+    @Schema(description = "居住地址")
+    private String address;
+
+    /** 民族 */
+    @Schema(description = "民族")
+    private String nations;
+
+    /** 开户行 */
+    @Schema(description = "开户行")
+    private String bankName;
+
+    /** 开户账号 */
+    @Schema(description = "开户账号")
+    private String bankCardId;
+
+    /** 户籍 */
+    @Schema(description = "户籍")
+    private String koseki;
+
+    /** 出生日期 */
+    @Schema(description = "出生日期")
+    private LocalDate birthday;
+
+    /** 婚姻状况 */
+    @Schema(description = "婚姻状况")
+    private String maritalStatus;
+
+    /** 政治面貌 */
+    @Schema(description = "政治面貌")
+    private String politicsStatus;
+
+    /** 健康状况 */
+    @Schema(description = "健康状况")
+    private String health;
+
+    /** 邮政编码 */
+    @Schema(description = "邮政编码")
+    private String postalCode;
+
+    /** 血型 */
+    @Schema(description = "血型")
+    private String bloodType;
+
+    /** 学历 */
+    @Schema(description = "学历")
+    private String education;
+
+    /** 毕业院校 */
+    @Schema(description = "毕业院校")
+    private String school;
+
+    /** 毕业时间 */
+    @Schema(description = "毕业时间")
+    private LocalDate graduationTime;
+
+    /** 是否是计算机专业 */
+    @Schema(description = "是否是计算机专业")
+    private Integer isComputer;
+
+    /** 原工作单位 */
+    @Schema(description = "原工作单位")
+    private String formerEmployer;
+
+    /** 入司时间 */
+    @Schema(description = "入司时间")
+    private LocalDate entryTime;
+
+    /** 代理人资格证号 */
+    @Schema(description = "代理人资格证号")
+    private String agentQualificationCode;
+
+    /** 紧急联系人电话 */
+    @Schema(description = "紧急联系人电话")
+    private String emergencyContactTel;
+
+    /** 紧急联系人姓名 */
+    @Schema(description = "紧急联系人姓名")
+    private String emergencyContactName;
+
+    /** 备注 */
+    @Schema(description = "备注")
+    private String remark;
+
+    /** 邮箱 */
+    @Schema(description = "邮箱")
+    private String email;
+
+    /** 性别 */
+    @Schema(description = "性别")
+    private String sex;
+
+    /** 专业 */
+    @Schema(description = "专业")
+    private String speciality;
+
+    /** 薪资 */
+    @Schema(description = "薪资")
+    private BigDecimal salary;
+
+    /** 薪资等级 */
+    @Schema(description = "薪资等级")
+    private String salaryLevel;
+
+    /** 居住地址 */
+    @Schema(description = "居住地址")
+    private String liveAddress;
+
+    /** 省 */
+    @Schema(description = "省")
+    private String province;
+
+    /** 市 */
+    @Schema(description = "市")
+    private String city;
+
+    /** 区/县 */
+    @Schema(description = "区/县")
+    private String district;
+
+}

+ 0 - 2
commons/src/main/java/com/jzg/commons/entity/vo/SysSystemVo.java

@@ -41,8 +41,6 @@ public class SysSystemVo extends PageRequest {
     private String userAccount;
 
     @Schema(description = "登录密码")
-    @Size(min=8,max=20,message = "登录密码长度不能大于20,不能小于8")
-    @NotNull(message = "登录密码不能为空")
     private String password;
 
     /** 省 */

+ 19 - 7
platform/src/main/java/com/jzg/controller/SysSystemController.java

@@ -1,9 +1,11 @@
 package com.jzg.controller;
 
+import cn.hutool.core.collection.CollUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jzg.commons.annotation.Log;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.enums.BusinessType;
+import com.jzg.commons.entity.vo.SysRoleVo;
 import com.jzg.commons.entity.vo.SysSystemPermsVo;
 import com.jzg.commons.entity.vo.SysSystemVo;
 import com.jzg.commons.entity.vo.UpAndDownVo;
@@ -78,6 +80,7 @@ public class SysSystemController {
     @Operation(summary = "租户添加")
     @PostMapping("/sysAdd")
     public HttpResult sysAdd(@Validated @RequestBody SysSystemVo sysSystemVo) {
+        AssertionUtils.isFail(StringUtils.isEmpty(sysSystemVo.getPassword()), "管理员密码不允许为空!");
         // 编码和名称不允许重复
         boolean codeExists = sysSystemService.isExistsCode(sysSystemVo.getSysCode(), null);
         boolean nameExists = sysSystemService.isExistsName(sysSystemVo.getSysName(), null);
@@ -109,14 +112,23 @@ public class SysSystemController {
     /**
      * 删除租户
      *
-     * @param ids 主键串
+     * @param sysSystemVo
      */
     @Log(title = "租户", businessType = BusinessType.DELETE)
-    @Operation(summary = "删除租户")
-    @DeleteMapping("/{ids}")
-    public HttpResult remove(@NotEmpty(message = "主键不能为空")
-                          @PathVariable Long[] ids) {
-        return HttpResult.ok(sysSystemService.deleteWithValidByIds(List.of(ids)));
+    @Operation(summary = "租户删除")
+    @PostMapping("/sysDelete")
+    public HttpResult sysDelete(@RequestBody SysSystemVo sysSystemVo){
+        return sysSystemService.sysDelete(sysSystemVo) ? HttpResult.ok("删除租户成功") : HttpResult.error("删除租户失败");
+    }
+
+    @Operation(summary = "租户删除检测")
+    @PostMapping("/sysDeleteValid")
+    public HttpResult roleDeleteValid(@RequestBody SysSystemVo sysSystemVo) {
+        List<String> deptIdList = sysSystemService.sysDeleteValidDept(sysSystemVo);
+        AssertionUtils.isFail(CollUtil.isNotEmpty(deptIdList),"当前机构还有部分子机构,请将这些子机构删除后,再进行删除!");
+        boolean userValid = sysSystemService.sysDeleteValidUser(deptIdList);
+        AssertionUtils.isFail(userValid,"当前机构还有部分员工,请将这些员工变更机构或者删除后,再进行删除!");
+        return HttpResult.ok();
     }
 
     /**
@@ -124,7 +136,7 @@ public class SysSystemController {
      * @param upAndDownVo
      * @return
      */
-    @PostMapping("/upAndDown/")
+    @PostMapping("/sysUpAndDown/")
     @Operation(summary = "启用/禁用租户")
     public HttpResult upAndDown(@RequestBody UpAndDownVo upAndDownVo) {
         sysSystemService.upAndDown(upAndDownVo);

+ 14 - 0
platform/src/main/java/com/jzg/mapper/SysDeptMapper.java

@@ -0,0 +1,14 @@
+package com.jzg.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.jzg.commons.entity.po.SysDept;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface SysDeptMapper extends BaseMapper<SysDept> {
+}

+ 18 - 0
platform/src/main/java/com/jzg/mapper/SysUserJzgInfoMapper.java

@@ -0,0 +1,18 @@
+package com.jzg.mapper;
+
+import com.jzg.commons.entity.po.SysUserJzgInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author dongxin
+* @description 针对表【sys_user_jzg_info(晋掌柜用户信息表)】的数据库操作Mapper
+* @createDate 2025-01-16 14:58:32
+* @Entity generator.domain.SysUserJzgInfo
+*/
+public interface SysUserJzgInfoMapper extends BaseMapper<SysUserJzgInfo> {
+
+}
+
+
+
+

+ 20 - 7
platform/src/main/java/com/jzg/service/SysSystemService.java

@@ -83,13 +83,6 @@ public interface SysSystemService extends IService<SysSystem> {
      */
     public void sysEdit(SysSystemVo sysSystemVo);
 
-    /**
-     * 批量删除租户信息
-     * @param ids
-     * @return
-     */
-    public boolean deleteWithValidByIds(List<Long> ids);
-
     /**
      * 启用/禁用租户
      * @param upAndDownVo
@@ -108,4 +101,24 @@ public interface SysSystemService extends IService<SysSystem> {
      */
     void reDeploy(String id);
 
+    /**
+     * 删除租户
+     * @param sysSystemVo
+     * @return
+     */
+    boolean sysDelete(SysSystemVo sysSystemVo);
+
+    /**
+     * 判断租户是否关联子机构
+     * @param sysSystemVo
+     * @return
+     */
+    List<String> sysDeleteValidDept(SysSystemVo sysSystemVo);
+
+    /**
+     * 判断租户下是否有成员信息
+     * @param ids
+     * @return
+     */
+    boolean sysDeleteValidUser(List<String> ids);
 }

+ 43 - 12
platform/src/main/java/com/jzg/service/impl/SysSystemServiceImpl.java

@@ -10,12 +10,12 @@ import com.jzg.commons.entity.po.*;
 import com.jzg.commons.entity.vo.SysSystemPermsVo;
 import com.jzg.commons.entity.vo.SysSystemVo;
 import com.jzg.commons.entity.vo.UpAndDownVo;
-import com.jzg.commons.mapper.*;
 import com.jzg.commons.util.StringUtils;
 import com.jzg.commons.util.idgen.IdGenerate;
 import com.jzg.mapper.*;
 import com.jzg.service.SysSystemService;
 import com.jzg.commons.util.PasswordUtils;
+import com.jzg.util.MinioUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -23,7 +23,9 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 租户管理表 服务层处理 sys_system
@@ -44,6 +46,14 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
     private SysRoleMapper sysRoleMapper;
     @Autowired
     private SysUserRoleMapper sysUserRoleMapper;
+    @Autowired
+    private SysDeptMapper sysDeptMapper;
+    @Autowired
+    private SysUserJzgInfoMapper sysUserJzgInfoMapper;
+    @Value("${minio.bucket-name}")
+    private String bucketName;
+    @Autowired
+    private MinioUtils minioUtils;
     @Value("${minio.download-url}")
     private String downloadUrl;
 
@@ -130,7 +140,7 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
             sysSystemList.forEach(sysSystem->{
                 SysUploadFiles files = sysUploadFilesMapper.selectById(sysSystem.getSysIcon());
                 if(StringUtils.isNotNull(files)){
-                    sysSystem.setSysIconUrl(downloadUrl + files.getFileName());
+                    sysSystem.setSysIconUrl(minioUtils.getPresignedObjectUrl(bucketName,files.getFileName()));
                 }
             });
         }
@@ -140,17 +150,16 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
     @Override
     public SysSystem queryById(String sysId) {
         SysSystem system = this.getById(sysId);
+
         if(StringUtils.isNotEmpty(system.getSysIcon())){
             SysUploadFiles files = sysUploadFilesMapper.selectById(system.getSysIcon());
             if(StringUtils.isNotNull(files)){
-                system.setSysIconUrl(downloadUrl + files.getFileName());
+                system.setSysIconUrl(minioUtils.getPresignedObjectUrl(bucketName,files.getFileName()));
             }
         }
         SysUser user = sysUserMapper.selectById(system.getUserId());
-        SysSystemVo sysSystemVo = new SysSystemVo();
-        BeanUtils.copyProperties(system, sysSystemVo);
-        sysSystemVo.setUserName(user.getUsername());
-        sysSystemVo.setUserAccount(user.getMobile());
+        system.setUserName(user.getUsername());
+        system.setUserAccount(user.getMobile());
         return system;
     }
 
@@ -197,11 +206,6 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
         sysUserMapper.updateById(user);
     }
 
-    @Override
-    public boolean deleteWithValidByIds(List<Long> ids) {
-        return baseMapper.deleteByIds(ids) > 0;
-    }
-
     @Override
     public void upAndDown(UpAndDownVo upAndDownVo) {
         if(YesNoEnum.YES.equals(upAndDownVo.getOpType())) {
@@ -231,6 +235,33 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
         baseMapper.updateById(sysSystem);
     }
 
+    @Override
+    public boolean sysDelete(SysSystemVo sysSystemVo) {
+        if(baseMapper.deleteById(sysSystemVo.getId()) > 0){
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public List<String> sysDeleteValidDept(SysSystemVo sysSystemVo) {
+        List<String> deptIdList = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
+                        .select(SysDept::getId)
+                        .eq(SysDept::getSystemCode, sysSystemVo.getSysCode())).stream()
+                .map(SysDept::getId).collect(Collectors.toList());
+        return deptIdList;
+    }
+
+    @Override
+    public boolean sysDeleteValidUser(List<String> ids) {
+        Long count = sysUserJzgInfoMapper.selectCount(new LambdaQueryWrapper<SysUserJzgInfo>()
+                .in(SysUserJzgInfo::getUserId, ids));
+        if(count <= 0){
+            return true;
+        }
+        return false;
+    }
+
 }
 
 

+ 389 - 0
platform/src/main/java/com/jzg/util/MinioUtils.java

@@ -0,0 +1,389 @@
+package com.jzg.util;
+
+import io.minio.*;
+import io.minio.http.Method;
+import io.minio.messages.Bucket;
+import io.minio.messages.DeleteObject;
+import io.minio.messages.Item;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.*;
+
+/**
+ * @program: xxkfz-minio
+ * @ClassName MinioUtils.java
+ * @author: 公众号:小小开发者
+ * @create: 2024-03-13 10:55
+ * @description: MinIO操作工具类
+ **/
+@Slf4j
+@Component
+public class MinioUtils {
+
+    @Autowired
+    private MinioClient minioClient;
+
+
+    /**
+     * 启动SpringBoot容器的时候初始化Bucket
+     * 如果没有Bucket则创建
+     *
+     * @param bucketName
+     */
+    public void createBucket(String bucketName) {
+        try {
+            if (!bucketExists(bucketName)) {
+                minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
+                log.info("创建bucketName = {}完成!", bucketName);
+                return;
+            }
+            log.info("bucketName = {}已存在!策略为:{}", bucketName, getBucketPolicy(bucketName));
+        } catch (Exception e) {
+            log.error("创建bucketName = {}异常!e = {}", bucketName, e);
+        }
+    }
+
+    /**
+     * 判断Bucket是否存在,true:存在,false:不存在
+     *
+     * @param bucketName
+     * @return
+     */
+    @SneakyThrows
+    public boolean bucketExists(String bucketName) {
+        return minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
+    }
+
+    /**
+     * 获得Bucket的策略
+     *
+     * @param bucketName
+     * @return
+     */
+    @SneakyThrows
+    public String getBucketPolicy(String bucketName) {
+        return minioClient.getBucketPolicy(GetBucketPolicyArgs.builder().bucket(bucketName).build());
+    }
+
+    /**
+     * 获得所有Bucket列表
+     *
+     * @return
+     */
+    @SneakyThrows
+    public List<Bucket> getAllBuckets() {
+        return minioClient.listBuckets();
+    }
+
+    /**
+     * 根据bucketName获取其相关信息
+     *
+     * @param bucketName
+     * @return
+     */
+    @SneakyThrows(Exception.class)
+    public Optional<Bucket> getBucket(String bucketName) {
+        return getAllBuckets().stream().filter(b -> b.name().equals(bucketName)).findFirst();
+    }
+
+    /**
+     * 根据bucketName删除Bucket,true:删除成功; false:删除失败,文件或已不存在
+     *
+     * @param bucketName
+     * @throws Exception
+     */
+    @SneakyThrows(Exception.class)
+    public void removeBucket(String bucketName) {
+        minioClient.removeBucket(RemoveBucketArgs.builder().bucket(bucketName).build());
+    }
+
+
+    /**
+     * 判断文件是否存在
+     *
+     * @param bucketName
+     * @param objectName
+     * @return
+     */
+    public boolean isObjectExist(String bucketName, String objectName) {
+        boolean exist = true;
+        try {
+            minioClient.statObject(StatObjectArgs.builder().bucket(bucketName).object(objectName).build());
+        } catch (Exception e) {
+            log.error("[Minio工具类]>>>> 判断文件是否存在, 异常:", e);
+            exist = false;
+        }
+        return exist;
+    }
+
+    /**
+     * 判断文件夹是否存在
+     *
+     * @param bucketName
+     * @param objectName
+     * @return
+     */
+    public boolean isFolderExist(String bucketName, String objectName) {
+        boolean exist = false;
+        try {
+            Iterable<Result<Item>> results = minioClient.listObjects(ListObjectsArgs.builder().bucket(bucketName).prefix(objectName).recursive(false).build());
+            for (Result<Item> result : results) {
+                Item item = result.get();
+                if (item.isDir() && objectName.equals(item.objectName())) {
+                    exist = true;
+                }
+            }
+        } catch (Exception e) {
+            log.error("[Minio工具类]>>>> 判断文件夹是否存在,异常:", e);
+            exist = false;
+        }
+        return exist;
+    }
+
+    /**
+     * 根据文件前置查询文件
+     *
+     * @param bucketName 存储桶
+     * @param prefix     前缀
+     * @param recursive  是否使用递归查询
+     * @return MinioItem 列表
+     */
+    @SneakyThrows(Exception.class)
+    public List<Item> getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive) {
+        List<Item> list = new ArrayList<>();
+        Iterable<Result<Item>> objectsIterator = minioClient.listObjects(ListObjectsArgs.builder().bucket(bucketName).prefix(prefix).recursive(recursive).build());
+        if (objectsIterator != null) {
+            for (Result<Item> o : objectsIterator) {
+                Item item = o.get();
+                list.add(item);
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 获取文件流
+     *
+     * @param bucketName 存储桶
+     * @param objectName 文件名
+     * @return 二进制流
+     */
+    @SneakyThrows(Exception.class)
+    public InputStream getObject(String bucketName, String objectName) {
+        return minioClient.getObject(GetObjectArgs.builder().bucket(bucketName).object(objectName).build());
+    }
+
+    /**
+     * 断点下载
+     *
+     * @param bucketName 存储桶
+     * @param objectName 文件名称
+     * @param offset     起始字节的位置
+     * @param length     要读取的长度
+     * @return 二进制流
+     */
+    @SneakyThrows(Exception.class)
+    public InputStream getObject(String bucketName, String objectName, long offset, long length) {
+        return minioClient.getObject(GetObjectArgs.builder().bucket(bucketName).object(objectName).offset(offset).length(length).build());
+    }
+
+    /**
+     * 获取路径下文件列表
+     *
+     * @param bucketName 存储桶
+     * @param prefix     文件名称
+     * @param recursive  是否递归查找,false:模拟文件夹结构查找
+     * @return 二进制流
+     */
+    public Iterable<Result<Item>> listObjects(String bucketName, String prefix, boolean recursive) {
+        return minioClient.listObjects(ListObjectsArgs.builder().bucket(bucketName).prefix(prefix).recursive(recursive).build());
+    }
+
+    /**
+     * 使用MultipartFile进行文件上传
+     *
+     * @param bucketName  存储桶
+     * @param file        文件名
+     * @param objectName  对象名
+     * @param contentType 类型
+     * @return
+     */
+    @SneakyThrows(Exception.class)
+    public ObjectWriteResponse uploadFile(String bucketName, MultipartFile file, String objectName, String contentType) {
+        InputStream inputStream = file.getInputStream();
+        return minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(objectName).contentType(contentType).stream(inputStream, inputStream.available(), -1).build());
+    }
+
+    /**
+     * 图片上传
+     *
+     * @param bucketName
+     * @param imageBase64
+     * @param imageName
+     * @return
+     */
+    public ObjectWriteResponse uploadImage(String bucketName, String imageBase64, String imageName) {
+        if (!StringUtils.isEmpty(imageBase64)) {
+            InputStream in = base64ToInputStream(imageBase64);
+            String newName = System.currentTimeMillis() + "_" + imageName + ".jpg";
+            String year = String.valueOf(new Date().getYear());
+            String month = String.valueOf(new Date().getMonth());
+            return uploadFile(bucketName, year + "/" + month + "/" + newName, in);
+
+        }
+        return null;
+    }
+
+    public static InputStream base64ToInputStream(String base64) {
+        ByteArrayInputStream stream = null;
+        try {
+            byte[] bytes = Base64.getEncoder().encode(base64.trim().getBytes());
+            stream = new ByteArrayInputStream(bytes);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return stream;
+    }
+
+
+    /**
+     * 上传本地文件
+     *
+     * @param bucketName 存储桶
+     * @param objectName 对象名称
+     * @param fileName   本地文件路径
+     * @return
+     */
+    @SneakyThrows(Exception.class)
+    public ObjectWriteResponse uploadFile(String bucketName, String objectName, String fileName) {
+        return minioClient.uploadObject(UploadObjectArgs.builder().bucket(bucketName).object(objectName).filename(fileName).build());
+    }
+
+    /**
+     * 通过流上传文件
+     *
+     * @param bucketName  存储桶
+     * @param objectName  文件对象
+     * @param inputStream 文件流
+     * @return
+     */
+    @SneakyThrows(Exception.class)
+    public ObjectWriteResponse uploadFile(String bucketName, String objectName, InputStream inputStream) {
+        return minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(objectName).stream(inputStream, inputStream.available(), -1).build());
+    }
+
+    /**
+     * 创建文件夹或目录
+     *
+     * @param bucketName 存储桶
+     * @param objectName 目录路径
+     * @return
+     */
+    @SneakyThrows(Exception.class)
+    public ObjectWriteResponse createDir(String bucketName, String objectName) {
+        return minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(objectName).stream(new ByteArrayInputStream(new byte[]{}), 0, -1).build());
+    }
+
+    /**
+     * 获取文件信息, 如果抛出异常则说明文件不存在
+     *
+     * @param bucketName 存储桶
+     * @param objectName 文件名称
+     * @return
+     */
+    @SneakyThrows(Exception.class)
+    public String getFileStatusInfo(String bucketName, String objectName) {
+        return minioClient.statObject(StatObjectArgs.builder().bucket(bucketName).object(objectName).build()).toString();
+    }
+
+    /**
+     * 拷贝文件
+     *
+     * @param bucketName    存储桶
+     * @param objectName    文件名
+     * @param srcBucketName 目标存储桶
+     * @param srcObjectName 目标文件名
+     */
+    @SneakyThrows(Exception.class)
+    public ObjectWriteResponse copyFile(String bucketName, String objectName, String srcBucketName, String srcObjectName) {
+        return minioClient.copyObject(CopyObjectArgs.builder().source(CopySource.builder().bucket(bucketName).object(objectName).build()).bucket(srcBucketName).object(srcObjectName).build());
+    }
+
+    /**
+     * 删除文件
+     *
+     * @param bucketName 存储桶
+     * @param objectName 文件名称
+     */
+    @SneakyThrows(Exception.class)
+    public void removeFile(String bucketName, String objectName) {
+        minioClient.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build());
+    }
+
+    /**
+     * 批量删除文件
+     *
+     * @param bucketName 存储桶
+     * @param keys       需要删除的文件列表
+     * @return
+     */
+    public void removeFiles(String bucketName, List<String> keys) {
+        List<DeleteObject> objects = new LinkedList<>();
+        keys.forEach(s -> {
+            objects.add(new DeleteObject(s));
+            try {
+                removeFile(bucketName, s);
+            } catch (Exception e) {
+                log.error("[Minio工具类]>>>> 批量删除文件,异常:", e);
+            }
+        });
+    }
+
+    /**
+     * 获取文件外链
+     *
+     * @param bucketName 存储桶
+     * @param objectName 文件名
+     * @param expires    过期时间 <=7 秒 (外链有效时间(单位:秒))
+     * @return url
+     */
+    @SneakyThrows(Exception.class)
+    public String getPresignedObjectUrl(String bucketName, String objectName, Integer expires) {
+        GetPresignedObjectUrlArgs args = GetPresignedObjectUrlArgs.builder().expiry(expires).bucket(bucketName).object(objectName).build();
+        return minioClient.getPresignedObjectUrl(args);
+    }
+
+    /**
+     * 获得文件外链
+     *
+     * @param bucketName
+     * @param objectName
+     * @return url
+     */
+    @SneakyThrows(Exception.class)
+    public String getPresignedObjectUrl(String bucketName, String objectName) {
+        GetPresignedObjectUrlArgs args = GetPresignedObjectUrlArgs.builder().bucket(bucketName).object(objectName).method(Method.GET).build();
+        return minioClient.getPresignedObjectUrl(args);
+    }
+
+    /**
+     * 将URLDecoder编码转成UTF8
+     *
+     * @param str
+     * @return
+     * @throws UnsupportedEncodingException
+     */
+    public String getUtf8ByURLDecoder(String str) throws UnsupportedEncodingException {
+        String url = str.replaceAll("%(?![0-9a-fA-F]{2})", "%25");
+        return URLDecoder.decode(url, "UTF-8");
+    }
+}

+ 5 - 0
platform/src/main/resources/mapper/SysDeptMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jzg.organization.mapper.SysDeptMapper">
+
+</mapper>

+ 76 - 0
platform/src/main/resources/mapper/SysUserJzgInfoMapper.xml

@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jzg.mapper.SysUserJzgInfoMapper">
+
+    <resultMap id="BaseResultMap" type="com.jzg.commons.entity.po.SysUserJzgInfo">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="userId" column="user_id" jdbcType="VARCHAR"/>
+            <result property="systemCode" column="system_code" jdbcType="VARCHAR"/>
+            <result property="status" column="status" jdbcType="TINYINT"/>
+            <result property="deptId" column="dept_id" jdbcType="VARCHAR"/>
+            <result property="openId" column="open_id" jdbcType="VARCHAR"/>
+            <result property="alipay" column="alipay" jdbcType="VARCHAR"/>
+            <result property="approvalOpinion" column="approval_opinion" jdbcType="VARCHAR"/>
+            <result property="identity" column="identity" jdbcType="VARCHAR"/>
+            <result property="identityTimeStart" column="identity_time_start" jdbcType="VARCHAR"/>
+            <result property="identityTimeEnd" column="identity_time_end" jdbcType="VARCHAR"/>
+            <result property="logoutTime" column="logout_time" jdbcType="DATE"/>
+            <result property="headSculpture" column="head_sculpture" jdbcType="VARCHAR"/>
+            <result property="factorVerify" column="factor_verify" jdbcType="TINYINT"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
+            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+            <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
+            <result property="address" column="address" jdbcType="VARCHAR"/>
+            <result property="nations" column="nations" jdbcType="VARCHAR"/>
+            <result property="bankName" column="bank_name" jdbcType="VARCHAR"/>
+            <result property="bankCardId" column="bank_card_id" jdbcType="VARCHAR"/>
+            <result property="koseki" column="koseki" jdbcType="VARCHAR"/>
+            <result property="birthday" column="birthday" jdbcType="DATE"/>
+            <result property="maritalStatus" column="marital_status" jdbcType="VARCHAR"/>
+            <result property="politicsStatus" column="politics_status" jdbcType="VARCHAR"/>
+            <result property="health" column="health" jdbcType="VARCHAR"/>
+            <result property="postalCode" column="postal_code" jdbcType="VARCHAR"/>
+            <result property="bloodType" column="blood_type" jdbcType="VARCHAR"/>
+            <result property="education" column="education" jdbcType="VARCHAR"/>
+            <result property="school" column="school" jdbcType="VARCHAR"/>
+            <result property="graduationTime" column="graduation_time" jdbcType="DATE"/>
+            <result property="isComputer" column="is_computer" jdbcType="TINYINT"/>
+            <result property="formerEmployer" column="former_employer" jdbcType="VARCHAR"/>
+            <result property="entryTime" column="entry_time" jdbcType="DATE"/>
+            <result property="agentQualificationCode" column="agent_qualification_code" jdbcType="VARCHAR"/>
+            <result property="emergencyContactTel" column="emergency_contact_tel" jdbcType="VARCHAR"/>
+            <result property="emergencyContactName" column="emergency_contact_name" jdbcType="VARCHAR"/>
+            <result property="remark" column="remark" jdbcType="VARCHAR"/>
+            <result property="email" column="email" jdbcType="VARCHAR"/>
+            <result property="sex" column="sex" jdbcType="VARCHAR"/>
+            <result property="speciality" column="speciality" jdbcType="VARCHAR"/>
+            <result property="salary" column="salary" jdbcType="DECIMAL"/>
+            <result property="salaryLevel" column="salary_level" jdbcType="VARCHAR"/>
+            <result property="liveAddress" column="live_address" jdbcType="VARCHAR"/>
+            <result property="province" column="province" jdbcType="VARCHAR"/>
+            <result property="city" column="city" jdbcType="VARCHAR"/>
+            <result property="district" column="district" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,user_id,system_code,
+        status,dept_id,open_id,
+        alipay,approval_opinion,identity,
+        identity_time_start,identity_time_end,logout_time,
+        head_sculpture,factor_verify,create_time,
+        create_by,update_time,update_by,
+        address,nations,bank_name,
+        bank_card_id,koseki,birthday,
+        marital_status,politics_status,health,
+        postal_code,blood_type,education,
+        school,graduation_time,is_computer,
+        former_employer,entry_time,agent_qualification_code,
+        emergency_contact_tel,emergency_contact_name,remark,
+        email,sex,speciality,
+        salary,salary_level,live_address,
+        province,city,district
+    </sql>
+</mapper>

+ 0 - 12
tenant/organization/src/main/java/com/jzg/organization/controller/DeptController.java

@@ -57,16 +57,4 @@ public class DeptController extends BaseController {
         List<SysDeptVo> deptTree = sysDeptService.getDeptTree(deptId);
         return HttpResult.ok(deptTree);
     }
-
-    /**
-     * 查询租户机构树
-     * @param systemCode
-     * @return
-     */
-//    @PostMapping("/tree")
-//    @Operation(summary = "查询租户机构树")
-//    public HttpResult<List<SysDept>> tree(String systemCode) {
-//        return HttpResult.ok(sysDeptService.tree(systemCode));
-//    }
-
 }

+ 0 - 16
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysDeptServiceImpl.java

@@ -185,20 +185,4 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
         newResultDept.add(baseDept);
         return newResultDept;
     }
-
-//    @Override
-//    public List<SysDept> tree(String systemCode) {
-//        LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(systemCode);
-//        List<SysDept> depts = sysDeptMapper.selectDeptList(lqw);
-//        List<SysDept> treeData = TreeTool.listToTree(BeanUtil.copyToList(depts, SysDept.class),0L,SysDept.class);
-//        return treeData;
-//    }
-
-    private LambdaQueryWrapper<SysDept> buildQueryWrapper(String systemCode) {
-        LambdaQueryWrapper<SysDept> lqw = Wrappers.lambdaQuery();
-        lqw.eq(SysDept::getSystemCode, systemCode);
-        lqw.orderByAsc(SysDept::getParentId);
-        lqw.orderByAsc(SysDept::getOrderNum);
-        return lqw;
-    }
 }