瀏覽代碼

入职登记导出调整

sangwenwei 5 月之前
父節點
當前提交
5a729e6a9d

+ 5 - 0
jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/sys/factory/PostApiFallbackFactory.java

@@ -30,6 +30,11 @@ public class PostApiFallbackFactory implements FallbackFactory <IPostApi> {
             public String getPostDTOByNameJSON(String name) {
                 return null;
             }
+
+            @Override
+            public PostDTO getPostDTOById(String id) {
+                return null;
+            }
         };
     }
 }

+ 2 - 0
jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/sys/feign/IPostApi.java

@@ -24,4 +24,6 @@ public interface IPostApi {
      */
     @GetMapping(value = "/feign/sys/dict/getPostDTOByNameJSON")
     String getPostDTOByNameJSON(@RequestParam(value = "name") String name);
+    @GetMapping(value = "/feign/sys/dict/getPostDTOById")
+    PostDTO getPostDTOById(@RequestParam(value = "id")String id);
 }

+ 40 - 0
jeeplus-modules/jeeplus-human/src/main/java/com/jeeplus/human/enrollment/enrollmentRegistration/service/EnrollmentRegistrationService.java

@@ -27,6 +27,7 @@ import com.jeeplus.sys.feign.IPostApi;
 import com.jeeplus.sys.feign.IRoleApi;
 import com.jeeplus.sys.feign.IUserApi;
 import com.jeeplus.sys.service.dto.*;
+import javafx.geometry.Pos;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
@@ -35,6 +36,7 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @author 王强
@@ -108,6 +110,44 @@ public class EnrollmentRegistrationService extends ServiceImpl<EnrollmentRegistr
             queryWrapper.like("a.name",projectReportData.getName());
         }
         IPage<ExportDTO> list = mapper.exportList(page, queryWrapper);
+        for (ExportDTO record : list.getRecords()) {
+            //根据用户查询岗位和角色信息
+            if (ObjectUtil.isNotEmpty(record)){
+                UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getById(record.getUserId());
+                if (userDTO != null){
+                    if (CollectionUtil.isNotEmpty(userDTO.getRoleDTOList())){
+                        StringBuilder roleBuilder = new StringBuilder();
+                        for (RoleDTO roleDTO : userDTO.getRoleDTOList()) {
+                            RoleDTO dto = SpringUtil.getBean(IRoleApi.class).getRoleDTOByIdForApp(roleDTO.getId());
+                            if (ObjectUtil.isNotEmpty(dto)){
+                                roleBuilder.append(dto.getName()).append(",");
+                            }
+                        }
+
+                        // 去掉最后一个多余的逗号
+                        if (roleBuilder.length() > 0) {
+                            roleBuilder.setLength(roleBuilder.length() - 1);
+                        }
+
+                        record.setRole(roleBuilder.toString());
+                    }
+                    if (CollectionUtil.isNotEmpty(userDTO.getPostDTOList())){
+                        StringBuilder postBuilder = new StringBuilder();
+                        for (PostDTO postDTO : userDTO.getPostDTOList()) {
+                            PostDTO dto = SpringUtil.getBean(IPostApi.class).getPostDTOById(postDTO.getId());
+                            if (ObjectUtil.isNotEmpty(dto)){
+                                postBuilder.append(dto.getName()).append(",");
+                            }
+                        }
+                        // 去掉最后一个多余的逗号
+                        if (postBuilder.length() > 0) {
+                            postBuilder.setLength(postBuilder.length() - 1);
+                        }
+                        record.setPost(postBuilder.toString());
+                    }
+                }
+            }
+        }
         return list;
 
     }

+ 6 - 0
jeeplus-modules/jeeplus-human/src/main/java/com/jeeplus/human/enrollment/enrollmentRegistration/service/dto/ExportDTO.java

@@ -19,6 +19,8 @@ import java.util.List;
  */
 @Data
 public class ExportDTO extends BaseEntity {
+    private String userId;
+
     @Excel(name = "姓名",width = 25)
     private String name;                //姓名
 
@@ -37,6 +39,10 @@ public class ExportDTO extends BaseEntity {
     @TableField(exist = false)
     @Excel(name = "所属公司",width = 25)
     private String company;     //所属公司
+    @Excel(name = "角色",width = 25)
+    private String role;
+    @Excel(name = "岗位",width = 25)
+    private String post;
     @TableField(exist = false)
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")

+ 4 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/feign/PostApiImpl.java

@@ -25,6 +25,10 @@ public class PostApiImpl implements IPostApi {
     @Override
     public String getPostDTOByNameJSON(String name) {
         return JSON.toJSONString(postService.getPostDTOByName(name));
+    }
 
+    @Override
+    public PostDTO getPostDTOById(String id) {
+        return postService.getPostDTOById(id);
     }
 }

+ 2 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/PostMapper.java

@@ -33,4 +33,6 @@ public interface PostMapper extends BaseMapper <Post> {
      */
     @InterceptorIgnore(tenantLine = "true")
     List<Post> getPostByTenant(String tenantId);
+    @InterceptorIgnore(tenantLine = "true")
+    PostDTO getPostDTOById(String id);
 }

+ 23 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/xml/PostMapper.xml

@@ -25,6 +25,29 @@
         limit 1
     </select>
 
+    <select id="getPostDTOById" resultType="com.jeeplus.sys.service.dto.PostDTO">
+        SELECT
+            id,
+            NAME,
+            CODE,
+            type,
+            STATUS,
+            sort,
+            remarks,
+            create_time,
+            create_by_id,
+            update_time,
+            update_by_id,
+            del_flag,
+            tenant_id
+        FROM
+            sys_post
+        WHERE
+            del_flag = 0
+            and id = #{id}
+        limit 1
+    </select>
+
     <select id="getPostByTenant" resultType="com.jeeplus.sys.domain.Post">
         SELECT
             id,

+ 4 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/service/PostService.java

@@ -34,4 +34,8 @@ public class PostService extends ServiceImpl <PostMapper, Post> {
     public List<Post> getPostByTenant(String tenantId) {
         return mapper.getPostByTenant(tenantId);
     }
+
+    public PostDTO getPostDTOById(String id) {
+        return mapper.getPostDTOById(id);
+    }
 }