Browse Source

需求优化8点

wucl 2 năm trước cách đây
mục cha
commit
6254bea51d
27 tập tin đã thay đổi với 301 bổ sung28 xóa
  1. 16 2
      biz-base/src/main/java/com/dayou/controller/DepartmentController.java
  2. 1 1
      biz-base/src/main/java/com/dayou/controller/ItemController.java
  3. 4 2
      biz-base/src/main/java/com/dayou/controller/ItemStageController.java
  4. 7 0
      dao/src/main/java/com/dayou/mapper/ItemMapper.java
  5. 2 1
      dao/src/main/java/com/dayou/mapper/UserPostMapper.java
  6. 7 1
      dao/src/main/resources/mapper/DepartmentMapper.xml
  7. 93 0
      dao/src/main/resources/mapper/ItemMapper.xml
  8. 2 2
      dao/src/main/resources/mapper/UserPostMapper.xml
  9. 2 1
      domain/src/main/java/com/dayou/bo/LoginCacheUserBO.java
  10. 22 0
      domain/src/main/java/com/dayou/dto/SimpleDepartmentModel.java
  11. 19 0
      domain/src/main/java/com/dayou/dto/SimplePostModel.java
  12. 2 1
      domain/src/main/java/com/dayou/dto/UserBaseDetailDTO.java
  13. 4 0
      domain/src/main/java/com/dayou/entity/Item.java
  14. 29 0
      domain/src/main/java/com/dayou/enums/UnitEnum.java
  15. 7 0
      domain/src/main/java/com/dayou/vo/ItemStageVO.java
  16. 23 5
      service/src/main/java/com/dayou/aspect/DataPermissionAop.java
  17. 2 1
      service/src/main/java/com/dayou/service/IDepartmentService.java
  18. 2 0
      service/src/main/java/com/dayou/service/IItemService.java
  19. 1 1
      service/src/main/java/com/dayou/service/IItemStageService.java
  20. 4 0
      service/src/main/java/com/dayou/service/IPostService.java
  21. 2 1
      service/src/main/java/com/dayou/service/IUserPostService.java
  22. 2 1
      service/src/main/java/com/dayou/service/impl/DepartmentServiceImpl.java
  23. 26 0
      service/src/main/java/com/dayou/service/impl/ItemServiceImpl.java
  24. 4 4
      service/src/main/java/com/dayou/service/impl/ItemStageServiceImpl.java
  25. 11 0
      service/src/main/java/com/dayou/service/impl/PostServiceImpl.java
  26. 3 2
      service/src/main/java/com/dayou/service/impl/UserPostServiceImpl.java
  27. 4 2
      service/src/main/java/com/dayou/service/impl/UserServiceImpl.java

+ 16 - 2
biz-base/src/main/java/com/dayou/controller/DepartmentController.java

@@ -1,7 +1,9 @@
 package com.dayou.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.dayou.annotation.DataPermission;
 import com.dayou.annotation.OperLog;
+import com.dayou.dto.SimpleDepartmentModel;
 import com.dayou.vo.DepartmentStatVO;
 import com.dayou.vo.DepartmentVO;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@@ -141,18 +143,30 @@ public class DepartmentController extends BaseController {
 
 
     /**
+     * 日志总览分页
+     * @param department
+     * @param page
+     * @return
+     */
+    @DataPermission(department = true,postChild = false)
+    @GetMapping("/permission/page")
+    public RestResponse<IPage<DepartmentVO>> permissionPage(SimpleDepartmentModel department, Page page){
+        IPage<DepartmentVO> result =  departmentService.xPage(department,page);
+        return RestResponse.data(result);
+    }
+
+    /**
      * 分页
      * @param department
      * @param page
      * @return
      */
     @GetMapping("/page")
-    public RestResponse<IPage<DepartmentVO>> xPage(Department department, Page page){
+    public RestResponse<IPage<DepartmentVO>> xPage(SimpleDepartmentModel department, Page page){
         IPage<DepartmentVO> result =  departmentService.xPage(department,page);
         return RestResponse.data(result);
     }
 
-
     /**
      * 统计
      * @return

+ 1 - 1
biz-base/src/main/java/com/dayou/controller/ItemController.java

@@ -48,7 +48,7 @@ public class ItemController extends BaseController {
     @DataPermission(department = true,postChild = false)
     @GetMapping("")
     public RestResponse<Page<ItemVO>> page(ItemDTO item, Page page){
-        Page<ItemVO> pages=itemService.selectPage(page,item);
+        Page<ItemVO> pages=itemService.xSelectPage(page,item);
         return RestResponse.data(pages);
     }
 

+ 4 - 2
biz-base/src/main/java/com/dayou/controller/ItemStageController.java

@@ -1,5 +1,6 @@
 package com.dayou.controller;
 
+import com.dayou.annotation.DataPermission;
 import com.dayou.annotation.OperLog;
 import com.dayou.vo.ItemStageVO;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@@ -114,9 +115,10 @@ public class ItemStageController extends BaseController {
      * 项目首页流程数据
      * @return
      */
+    @DataPermission(department = true,postChild = false)
     @GetMapping("/list")
-    public RestResponse<List<List<ItemStageVO>>> stageList(String state){
-        List<List<ItemStageVO>> list = itemStageService.stageList(state);
+    public RestResponse<List<List<ItemStageVO>>> stageList(ItemStageVO itemStageVO){
+        List<List<ItemStageVO>> list = itemStageService.stageList(itemStageVO);
         return RestResponse.data(list);
     }
 }

+ 7 - 0
dao/src/main/java/com/dayou/mapper/ItemMapper.java

@@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.dayou.dto.ItemDTO;
 import com.dayou.entity.Item;
 import com.dayou.dao.CustomBaseMapper;
+import com.dayou.vo.ItemStageVO;
 import com.dayou.vo.ItemStatVO;
 import com.dayou.vo.ItemVO;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * <p>
  * 项目信息表 Mapper 接口
@@ -23,4 +26,8 @@ public interface ItemMapper extends CustomBaseMapper<Item> {
     ItemVO xDetail(@Param("id") Long id);
 
     Page<ItemVO> getPage(Page page, @Param("item") ItemDTO item);
+
+    Page<ItemVO> getXPage(Page page, @Param("item")ItemDTO item);
+
+    List<Item> xSelectList(@Param("item")ItemStageVO item);
 }

+ 2 - 1
dao/src/main/java/com/dayou/mapper/UserPostMapper.java

@@ -1,6 +1,7 @@
 package com.dayou.mapper;
 
 import com.dayou.common.SimpleListModel;
+import com.dayou.dto.SimplePostModel;
 import com.dayou.entity.UserPost;
 import com.dayou.dao.CustomBaseMapper;
 import org.apache.ibatis.annotations.Param;
@@ -17,7 +18,7 @@ import java.util.List;
  */
 public interface UserPostMapper extends CustomBaseMapper<UserPost> {
 
-    List<SimpleListModel> getPostList(@Param("userId") Long userId);
+    List<SimplePostModel> getPostList(@Param("userId") Long userId);
 
     void saveOrUpdateById(@Param("userPost") UserPost userPost);
 }

+ 7 - 1
dao/src/main/resources/mapper/DepartmentMapper.xml

@@ -26,9 +26,15 @@
     <select id="xPage" parameterType="com.dayou.entity.Department" resultType="com.dayou.vo.DepartmentVO">
         SELECT d.id,d.parent_id,d.name,d.leader_id,d.phone,d.deleted,d.created,d.modified,
                ( SELECT NAME FROM department WHERE id = d.parent_id ) AS parentName ,
-               (select count(distinct user_id) from user_post where post_id in ((select id from post where department_id = d.id))) as peopleNum
+               (select count(distinct user_id) from user_post where post_id in ((select id from post where department_id = d.id and user_post.deleted = 0))) as peopleNum
         FROM
             department d where d.deleted = 0
+        <if test="department!=null and department.departmentIds!=null and department.departmentIds.size!=0">
+            and d.id in
+            <foreach collection="department.departmentIds" open="(" close=")" separator="," item="departmentId">
+                #{departmentId}
+            </foreach>
+        </if>
         order by d.id DESC
     </select>
 </mapper>

+ 93 - 0
dao/src/main/resources/mapper/ItemMapper.xml

@@ -91,4 +91,97 @@
         </if>
 
     </select>
+
+    <select id="getXPage" resultType="com.dayou.vo.ItemVO">
+        SELECT
+        <include refid="Base_Column_List"/> , d.name as departmentName,
+        (select name from item_stage s where curDate() &gt;= s.start_date and curDate() &lt;= s.end_date and s.item_id = i.id) as stageName,
+        (select id from item_stage s where curDate() &gt;= s.start_date and curDate() &lt;= s.end_date and s.item_id  and s.item_id = i.id) as stageId
+        FROM
+        item i left join department d on i.department_id = d.id
+        WHERE
+        i.deleted = 0
+        <if test="item!=null and item.name!=null and item.name!='' ">
+            and i.name like concat ('%',#{item.name},'%')
+        </if>
+        <if test="item!=null and item.businessNo!=null and item.businessNo!='' ">
+            and i.business_no like concat (#{item.businessNo},'%')
+        </if>
+        <if test="item!=null and item.clientManager!=null and item.clientManager!='' ">
+            and i.client_manager like concat ('%',#{item.clientManager},'%')
+        </if>
+        <if test="item!=null and item.userIds!=null and item.userIds.size!=0 and item!=null and item.departmentIds!=null and item.departmentIds.size==0">
+            <if test="item!=null and item.userIds!=null and item.userIds.size!=0">
+                and EXISTS ( SELECT item_id FROM item_user iu WHERE iu.item_id = i.id AND iu.user_id in
+                <foreach collection="item.userIds" open="(" close=")" separator="," item="userId">
+                    #{userId}
+                </foreach>
+                )
+            </if>
+        </if>
+        <if test="item!=null and item.userIds!=null and item.userIds.size==0 and item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
+            <if test="item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
+                and i.department_id in
+                <foreach collection="item.departmentIds" open="(" close=")" separator="," item="departmentId">
+                    #{departmentId}
+                </foreach>
+            </if>
+        </if>
+        <if test="item!=null and item.userIds!=null and item.userIds.size!=0 and item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
+            and (
+            <if test="item!=null and item.userIds!=null and item.userIds.size!=0">
+                 EXISTS ( SELECT item_id FROM item_user iu WHERE iu.item_id = i.id AND iu.user_id in
+                <foreach collection="item.userIds" open="(" close=")" separator="," item="userId">
+                    #{userId}
+                </foreach>
+                )
+            </if>
+            <if test="item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
+                or i.department_id in
+                <foreach collection="item.departmentIds" open="(" close=")" separator="," item="departmentId">
+                    #{departmentId}
+                </foreach>
+            </if>
+            )
+        </if>
+    </select>
+
+    <select id="xSelectList" parameterType="com.dayou.vo.ItemStageVO" resultType="com.dayou.entity.Item">
+        select <include refid="Base_Column_List"/> from item i
+        where i.deleted = 0
+        <if test="item!=null and item.userIds!=null and item.userIds.size!=0 and item!=null and item.departmentIds!=null and item.departmentIds.size==0">
+            <if test="item!=null and item.userIds!=null and item.userIds.size!=0">
+                and EXISTS ( SELECT item_id FROM item_user iu WHERE iu.item_id = i.id AND iu.user_id in
+                <foreach collection="item.userIds" open="(" close=")" separator="," item="userId">
+                    #{userId}
+                </foreach>
+                )
+            </if>
+        </if>
+        <if test="item!=null and item.userIds!=null and item.userIds.size==0 and item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
+            <if test="item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
+                and i.department_id in
+                <foreach collection="item.departmentIds" open="(" close=")" separator="," item="departmentId">
+                    #{departmentId}
+                </foreach>
+            </if>
+        </if>
+        <if test="item!=null and item.userIds!=null and item.userIds.size!=0 and item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
+            and (
+            <if test="item!=null and item.userIds!=null and item.userIds.size!=0">
+                EXISTS ( SELECT item_id FROM item_user iu WHERE iu.item_id = i.id AND iu.user_id in
+                <foreach collection="item.userIds" open="(" close=")" separator="," item="userId">
+                    #{userId}
+                </foreach>
+                )
+            </if>
+            <if test="item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
+                or i.department_id in
+                <foreach collection="item.departmentIds" open="(" close=")" separator="," item="departmentId">
+                    #{departmentId}
+                </foreach>
+            </if>
+            )
+        </if>
+    </select>
 </mapper>

+ 2 - 2
dao/src/main/resources/mapper/UserPostMapper.xml

@@ -21,8 +21,8 @@
         user_id, post_id
     </sql>
 
-    <select id="getPostList" parameterType="java.lang.Long" resultType="com.dayou.common.SimpleListModel">
-        select p.id as id,p.name as name
+    <select id="getPostList" parameterType="java.lang.Long" resultType="com.dayou.dto.SimplePostModel">
+        select p.id as id,p.name as name,p.department_id as departmentId,p.parent_id as parentId
         from user_post t
                  join
              post p

+ 2 - 1
domain/src/main/java/com/dayou/bo/LoginCacheUserBO.java

@@ -1,6 +1,7 @@
 package com.dayou.bo;
 
 import com.dayou.common.SimpleListModel;
+import com.dayou.dto.SimplePostModel;
 import lombok.Data;
 
 import java.util.List;
@@ -17,7 +18,7 @@ public class LoginCacheUserBO {
     private String name;
 
 
-    private List<SimpleListModel> postList;
+    private List<SimplePostModel> postList;
 
     private Set<PrivilegeTreeBO> privilegeList;
 

+ 22 - 0
domain/src/main/java/com/dayou/dto/SimpleDepartmentModel.java

@@ -0,0 +1,22 @@
+package com.dayou.dto;
+
+import com.dayou.entity.Department;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 类说明:
+ *
+ * @author: wucl
+ * @since: 2023/2/27
+ * created with IntelliJ IDEA.
+ */
+@Data
+public class SimpleDepartmentModel extends Department {
+
+    private List<Long> departmentIds;
+
+    private Set<Long> userIds;
+}

+ 19 - 0
domain/src/main/java/com/dayou/dto/SimplePostModel.java

@@ -0,0 +1,19 @@
+package com.dayou.dto;
+
+import com.dayou.common.SimpleListModel;
+import lombok.Data;
+
+/**
+ * 类说明:
+ *
+ * @author: wucl
+ * @since: 2023/2/27
+ * created with IntelliJ IDEA.
+ */
+@Data
+public class SimplePostModel extends SimpleListModel {
+
+    private Long departmentId;
+
+    private Long parentId;
+}

+ 2 - 1
domain/src/main/java/com/dayou/dto/UserBaseDetailDTO.java

@@ -3,6 +3,7 @@ package com.dayou.dto;
 import com.dayou.bo.LoginCacheUserBO;
 import com.dayou.bo.SimpleParentModel;
 import com.dayou.common.SimpleListModel;
+import com.dayou.common.SimpleModel;
 import lombok.Data;
 
 import java.time.LocalDate;
@@ -65,7 +66,7 @@ public class UserBaseDetailDTO {
     /**
      * 岗位列表
      */
-    private List<SimpleListModel> postList;
+    private List<SimplePostModel> postList;
 
     /**
      * 部门列表

+ 4 - 0
domain/src/main/java/com/dayou/entity/Item.java

@@ -1,5 +1,8 @@
 package com.dayou.entity;
 import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.dayou.common.BaseEntity;
 import java.time.LocalDate;
 import lombok.Data;
@@ -118,6 +121,7 @@ public class Item extends BaseEntity {
      */
     @ImportCell
     @ExportCell(columnName = "合同金额")
+    @TableField(value = "amount", fill = FieldFill.UPDATE)
     private BigDecimal amount;
 
     /**

+ 29 - 0
domain/src/main/java/com/dayou/enums/UnitEnum.java

@@ -0,0 +1,29 @@
+package com.dayou.enums;
+
+/**
+ * 类说明:
+ *
+ * @author: wucl
+ * @since: 2023/2/27
+ * created with IntelliJ IDEA.
+ */
+public enum UnitEnum {
+
+    DY("DY"),
+    TJC("TJC")
+    ;
+
+    UnitEnum(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    private String name;
+}

+ 7 - 0
domain/src/main/java/com/dayou/vo/ItemStageVO.java

@@ -3,6 +3,9 @@ package com.dayou.vo;
 import com.dayou.entity.ItemStage;
 import lombok.Data;
 
+import java.util.List;
+import java.util.Set;
+
 /**
  * 类说明:
  *
@@ -22,4 +25,8 @@ public class ItemStageVO extends ItemStage {
 
     private String itemName;
 
+    private Set<Long> userIds;
+
+    private List<Long> departmentIds;
+
 }

+ 23 - 5
service/src/main/java/com/dayou/aspect/DataPermissionAop.java

@@ -3,6 +3,8 @@ package com.dayou.aspect;
 import com.dayou.annotation.DataPermission;
 import com.dayou.bo.SimpleParentModel;
 import com.dayou.common.SimpleListModel;
+import com.dayou.dto.SimplePostModel;
+import com.dayou.service.IPostService;
 import com.dayou.service.IUserService;
 import com.dayou.utils.LoginContext;
 import lombok.extern.slf4j.Slf4j;
@@ -14,10 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.lang.reflect.Field;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -36,6 +35,9 @@ public class DataPermissionAop {
     @Autowired
     private IUserService userService;
 
+    @Autowired
+    private IPostService postService;
+
     @Pointcut("@annotation(com.dayou.annotation.DataPermission)")
     public void dataPermissionPointcut(){
 
@@ -54,9 +56,25 @@ public class DataPermissionAop {
             if (parentIds.contains(null)){
                 return joinPoint.proceed();
             }
+            //部门内部最高岗位拥有该部门最高数据权限,否则只有登录人参与的项目的数据权限
+            List<SimplePostModel> postList = LoginContext.getLoginCacheUserBO().getPostList();
+
+            List<Long> dIds = new ArrayList<>();
+            Set<Long> users = new HashSet<>();
+            for (SimplePostModel post : postList){
+                if (postService.mostHighPost(post)){
+                    dIds.add(post.getDepartmentId());
+                }else {
+                    users.add(LoginContext.getUserId());
+                }
+            }
+
             Field departments = arg.getClass().getDeclaredField("departmentIds");
             departments.setAccessible(Boolean.TRUE);
-            departments.set(arg,ids);
+            departments.set(arg,dIds);
+            Field userIds = arg.getClass().getDeclaredField("userIds");
+            userIds.setAccessible(Boolean.TRUE);
+            userIds.set(arg,users);
         }
 
         if (dataPermission.postChild()){

+ 2 - 1
service/src/main/java/com/dayou/service/IDepartmentService.java

@@ -1,4 +1,5 @@
 package com.dayou.service;
+import com.dayou.dto.SimpleDepartmentModel;
 import com.dayou.entity.Department;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -33,7 +34,7 @@ public interface IDepartmentService extends IService<Department> {
 
         XSSFWorkbook exportExcel(Department department);
 
-    IPage<DepartmentVO> xPage(Department department, Page page);
+    IPage<DepartmentVO> xPage(SimpleDepartmentModel department, Page page);
 
         DepartmentStatVO stat();
 }

+ 2 - 0
service/src/main/java/com/dayou/service/IItemService.java

@@ -29,4 +29,6 @@ public interface IItemService extends IService<Item> {
         Boolean delete(Long id);
 
         ItemStatVO stat();
+
+        Page<ItemVO> xSelectPage(Page page, ItemDTO item);
 }

+ 1 - 1
service/src/main/java/com/dayou/service/IItemStageService.java

@@ -31,5 +31,5 @@ public interface IItemStageService extends IService<ItemStage> {
 
     List<ItemStageVO> listByItemId(Long itemId);
 
-    List<List<ItemStageVO>> stageList(String state);
+    List<List<ItemStageVO>> stageList(ItemStageVO itemStageVO);
 }

+ 4 - 0
service/src/main/java/com/dayou/service/IPostService.java

@@ -2,6 +2,7 @@ package com.dayou.service;
 import com.dayou.bo.SimpleParentModel;
 import com.dayou.common.PullDownModel;
 import com.dayou.common.SimpleListModel;
+import com.dayou.dto.SimplePostModel;
 import com.dayou.entity.Post;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -46,4 +47,7 @@ public interface IPostService extends IService<Post> {
     List<Post> getPostList(PostVO postVO);
 
     List<SimpleParentModel> getDepartmentList(Set<Long> postIds);
+
+    Boolean mostHighPost(SimplePostModel post);
+
 }

+ 2 - 1
service/src/main/java/com/dayou/service/IUserPostService.java

@@ -1,5 +1,6 @@
 package com.dayou.service;
 import com.dayou.common.SimpleListModel;
+import com.dayou.dto.SimplePostModel;
 import com.dayou.entity.UserPost;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -35,7 +36,7 @@ public interface IUserPostService extends IService<UserPost> {
 
         XSSFWorkbook exportExcel(UserPost userPost);
 
-        List<SimpleListModel> getPostList(Long userId);
+        List<SimplePostModel> getPostList(Long userId);
 
     void saveOrUpdateById(UserPost userPost);
 }

+ 2 - 1
service/src/main/java/com/dayou/service/impl/DepartmentServiceImpl.java

@@ -3,6 +3,7 @@ package com.dayou.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.dayou.common.BaseEntity;
+import com.dayou.dto.SimpleDepartmentModel;
 import com.dayou.entity.Department;
 import com.dayou.entity.Post;
 import com.dayou.entity.User;
@@ -132,7 +133,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
     }
 
     @Override
-    public Page<DepartmentVO> xPage(Department department, Page page) {
+    public Page<DepartmentVO> xPage(SimpleDepartmentModel department, Page page) {
         Page<DepartmentVO> result = departmentMapper.xPage(department,page);
         return result;
     }

+ 26 - 0
service/src/main/java/com/dayou/service/impl/ItemServiceImpl.java

@@ -5,6 +5,7 @@ import com.dayou.dto.ItemDTO;
 import com.dayou.entity.Item;
 import com.dayou.entity.ItemUser;
 import com.dayou.enums.ItemStateEnum;
+import com.dayou.enums.UnitEnum;
 import com.dayou.mapper.ItemMapper;
 import com.dayou.mapper.ItemUserMapper;
 import com.dayou.service.IItemService;
@@ -92,6 +93,9 @@ public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements II
     public Boolean add(ItemDTO itemDTO){
         itemDTO.setBusinessNo(DateUtils.dateTimeNow());
         itemDTO.setUserId(LoginContext.getUserId());
+        if (itemDTO.getBelongTo().equals(UnitEnum.TJC.name())){
+            itemDTO.setOaNo(itemDTO.getBusinessNo());
+        }
         this.save(itemDTO);
         Set<Long> userIds = itemDTO.getUserIds();
         if (CollectionUtils.isNotEmpty(userIds)){
@@ -133,6 +137,28 @@ public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements II
     }
 
     /**
+     * 非市场部项目列表
+     * @param page
+     * @param item
+     * @return
+     */
+    @Override
+    public Page<ItemVO> xSelectPage(Page page, ItemDTO item) {
+        String state = item.getState();
+        Page<ItemVO> result = itemMapper.getXPage(page, item);
+        List<ItemVO> records = result.getRecords();
+        records.stream().forEach(x->{
+            String itemState = getItemState(x.getId());
+            x.setState(itemState);
+        });
+        if (StrUtil.isNotBlank(state)){
+            records = records.stream().filter(x -> x.getState().equals(state)).collect(Collectors.toList());
+            result.setRecords(records);
+        }
+        return result;
+    }
+
+    /**
      * 获取项目状态
      * @param id 项目id
      * @return

+ 4 - 4
service/src/main/java/com/dayou/service/impl/ItemStageServiceImpl.java

@@ -156,15 +156,15 @@ public class ItemStageServiceImpl extends ServiceImpl<ItemStageMapper, ItemStage
     }
 
     @Override
-    public List<List<ItemStageVO>> stageList(String state) {
+    public List<List<ItemStageVO>> stageList(ItemStageVO stageVO) {
+        String state = stageVO.getState();
         List<List<ItemStageVO>> list = new ArrayList<>();
-        List<Item> items = itemMapper.selectList(new LambdaQueryWrapper<Item>()
-                .eq(BaseEntity::getDeleted, false));
+        List<Item> items = itemMapper.xSelectList(stageVO);
 
 
         items.stream().forEach(x->{
             List<ItemStageVO> itemStageVOS = listByItemId(x.getId());
-            if (StrUtil.equals(ItemStateEnum.UNPLAYED.getName(),state)){
+            if (StrUtil.equals(ItemStateEnum.UNPLAYED.getName(),state) && CollectionUtils.isEmpty(itemStageVOS)){
                 List<ItemStageVO> itemList= new ArrayList<>();
                 ItemStageVO itemStageVO = new ItemStageVO();
                 itemStageVO.setItemName(x.getName());

+ 11 - 0
service/src/main/java/com/dayou/service/impl/PostServiceImpl.java

@@ -5,6 +5,7 @@ import com.dayou.bo.SimpleParentModel;
 import com.dayou.common.BaseEntity;
 import com.dayou.common.PullDownModel;
 import com.dayou.common.SimpleListModel;
+import com.dayou.dto.SimplePostModel;
 import com.dayou.entity.Post;
 import com.dayou.mapper.PostMapper;
 import com.dayou.service.IPostService;
@@ -30,6 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 import org.springframework.transaction.annotation.Transactional;
 import com.dayou.enums.BatchTaskTypeEnum;
@@ -155,4 +157,13 @@ public class PostServiceImpl extends ServiceImpl<PostMapper, Post> implements IP
         return null;
     }
 
+    @Override
+    public Boolean mostHighPost(SimplePostModel post) {
+        List<Long> collect = this.list(new LambdaQueryWrapper<Post>().eq(Post::getDepartmentId, post.getDepartmentId())
+                        .eq(BaseEntity::getDeleted, Boolean.FALSE)).stream().map(BaseEntity::getId)
+                .collect(Collectors.toList());
+
+        return !collect.contains(post.getParentId());
+    }
+
 }

+ 3 - 2
service/src/main/java/com/dayou/service/impl/UserPostServiceImpl.java

@@ -2,6 +2,7 @@ package com.dayou.service.impl;
 
 import com.dayou.common.BaseEntity;
 import com.dayou.common.SimpleListModel;
+import com.dayou.dto.SimplePostModel;
 import com.dayou.entity.UserPost;
 import com.dayou.mapper.UserPostMapper;
 import com.dayou.service.IUserPostService;
@@ -117,8 +118,8 @@ public class UserPostServiceImpl extends ServiceImpl<UserPostMapper, UserPost> i
     }
 
     @Override
-    public List<SimpleListModel> getPostList(Long userId) {
-        List<SimpleListModel> list = userPostMapper.getPostList(userId);
+    public List<SimplePostModel> getPostList(Long userId) {
+        List<SimplePostModel> list = userPostMapper.getPostList(userId);
         return list;
     }
 

+ 4 - 2
service/src/main/java/com/dayou/service/impl/UserServiceImpl.java

@@ -12,9 +12,11 @@ import com.dayou.bo.SimpleParentModel;
 import com.dayou.common.BaseEntity;
 import com.dayou.common.Constants;
 import com.dayou.common.SimpleListModel;
+import com.dayou.common.SimpleModel;
 import com.dayou.condition.LoginCondition;
 import com.dayou.constants.JwtConstants;
 import com.dayou.dto.LoginDTO;
+import com.dayou.dto.SimplePostModel;
 import com.dayou.dto.UpdatePasswordDTO;
 import com.dayou.dto.UserBaseDetailDTO;
 import com.dayou.entity.Post;
@@ -218,7 +220,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             BeanUtils.copyProperties(user,userBaseDetailDTO);
         }
 
-        List<SimpleListModel> postList = userPostService.getPostList(userId);
+        List<SimplePostModel> postList = userPostService.getPostList(userId);
         userBaseDetailDTO.setPostList(postList);
 
         Set<Long> postIds = postList.stream().map(SimpleListModel::getId).collect(Collectors.toSet());
@@ -272,7 +274,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     public Set<PrivilegeTreeBO> privilegesList(String token) {
         Set<PrivilegeTreeBO> privilegesSet = Sets.newHashSet();
         UserBaseDetailDTO userBaseDetailDTO = this.baseInfo(token);
-        List<SimpleListModel> postList = userBaseDetailDTO.getPostList();
+        List<SimplePostModel> postList = userBaseDetailDTO.getPostList();
         if (CollectionUtils.isNotEmpty(postList)) {
             //用户可能有多个岗位,每个岗位都有各自的权限,需要对权限进行合并
             for (SimpleListModel simleListModel : postList) {