Browse Source

DeBugDeBugDeBug

buzhanyi 2 years ago
parent
commit
2607735905

+ 4 - 4
purchase-admin/src/main/java/com/ozs/web/controller/system/SysUserController.java

@@ -103,15 +103,15 @@ public class SysUserController extends BaseController {
         }
         LoginUser loginUser = SecurityUtils.getLoginUser();
         if (!String.valueOf(loginUser.getUserId()).equals("1")) {
-            List<Long> deptList = new ArrayList<>();
+            List<Integer> deptList = new ArrayList<>();
             //获取到子孙级部门id
-            Long deptId = loginUser.getDeptId();
+            Integer deptId = Math.toIntExact(loginUser.getDeptId());
             if (deptService.hasChildByDeptId(loginUser.getDeptId())) {
-                List<Long> children = deptService.getDeptChildren(deptId);
+                List<Integer> children = deptService.getDeptChildren(deptId);
                 System.err.println(children.size());
                 deptList.addAll(children);
-                deptList.add(deptId);
             }
+            deptList.add(deptId);
             lw.in(SysUser::getDeptId, deptList);
         } else if (!StringUtils.isBlank(sysUserPageRequestVo.getDeptId())) {
             lw.eq(SysUser::getDeptId, sysUserPageRequestVo.getDeptId());

+ 41 - 15
purchase-common/src/main/java/com/ozs/common/core/domain/entity/SysDept.java

@@ -86,20 +86,20 @@ public class SysDept extends BaseEntity
      */
     private String purchaseServices;
 
-    public List<Long> getDeptList() {
+    /**
+     * 查询全部or指定部门
+     */
+    @TableField(exist = false)
+    private List<Integer> deptList;
+
+    public List<Integer> getDeptList() {
         return deptList;
     }
 
-    public void setDeptList(List<Long> deptList) {
+    public void setDeptList(List<Integer> deptList) {
         this.deptList = deptList;
     }
 
-    /**
-     * 查询全部or指定部门
-     */
-    @TableField(exist = false)
-    private List<Long> deptList;
-
     public String getProjectContact() {
         return projectContact;
     }
@@ -282,15 +282,41 @@ public class SysDept extends BaseEntity
         this.purchaseServices = purchaseServices;
     }
 
+    public SysDept() {
+    }
+
+    public SysDept(Long deptId, Long parentId, String ancestors, String deptName, Integer orderNum, String leader, String phone, String email, String status, String delFlag, String parentName, List<SysDept> children, String remarks, String address, String projectContact, String bankAccountName, String bankOfDeposit, String accountNumber, String purchaseServices, List<Integer> deptList) {
+        this.deptId = deptId;
+        this.parentId = parentId;
+        this.ancestors = ancestors;
+        this.deptName = deptName;
+        this.orderNum = orderNum;
+        this.leader = leader;
+        this.phone = phone;
+        this.email = email;
+        this.status = status;
+        this.delFlag = delFlag;
+        this.parentName = parentName;
+        this.children = children;
+        this.remarks = remarks;
+        this.address = address;
+        this.projectContact = projectContact;
+        this.bankAccountName = bankAccountName;
+        this.bankOfDeposit = bankOfDeposit;
+        this.accountNumber = accountNumber;
+        this.purchaseServices = purchaseServices;
+        this.deptList = deptList;
+    }
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("deptId", getDeptId())
-            .append("parentId", getParentId())
-            .append("ancestors", getAncestors())
-            .append("deptName", getDeptName())
-            .append("orderNum", getOrderNum())
-            .append("leader", getLeader())
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("deptId", getDeptId())
+                .append("parentId", getParentId())
+                .append("ancestors", getAncestors())
+                .append("deptName", getDeptName())
+                .append("orderNum", getOrderNum())
+                .append("leader", getLeader())
             .append("phone", getPhone())
             .append("email", getEmail())
             .append("status", getStatus())

+ 1 - 1
purchase-system/src/main/java/com/ozs/plan/service/impl/ProvisionalPlanServiceImpl.java

@@ -484,7 +484,7 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
         BeanUtils.copyProperties(provisionalPlanVo, standardVo);
         //上传审核文件并赋予计划审核退回
         quarterService.upExamineFile(standardVo);
-        standardVo.setProjectStatus(ProjectStatus.PLANTOBACK.getCode());
+        provisionalPlanVo.setProjectStatus(ProjectStatus.PLANTOBACK.getCode());
         return review(provisionalPlanVo);
     }
 

+ 1 - 1
purchase-system/src/main/java/com/ozs/pm/doman/vo/requestVo/PmDemandReqVo.java

@@ -135,7 +135,7 @@ public class PmDemandReqVo extends PageVo {
     /**
      * 查询全部or指定部门
      */
-    private List<Long> deptList;
+    private List<Integer> deptList;
 
     @ApiModelProperty("回退序号")
     private Integer returnOrderNumber;

+ 7 - 7
purchase-system/src/main/java/com/ozs/pm/service/impl/PmDemandServiceImpl.java

@@ -3924,14 +3924,14 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
     }
 
     //查询本单位还是本单位及子孙级----要查询子单位的超额数据
-    public List<Long> isQueryAll(Integer queryAll) {
-        List<Long> deptList = new ArrayList<>();
-        Long deptId = SecurityUtils.getDeptId();
+    public List<Integer> isQueryAll(Integer queryAll) {
+        List<Integer> deptList = new ArrayList<>();
+        Integer deptId = Math.toIntExact(SecurityUtils.getDeptId());
         //查询全部
         if (queryAll.equals(-1)) {
             //获取到子孙级部门id
-            if (deptService.hasChildByDeptId(deptId)) {
-                List<Long> children = deptService.getDeptChildren(deptId);
+            if (deptService.hasChildByDeptId(SecurityUtils.getDeptId())) {
+                List<Integer> children = deptService.getDeptChildren(Math.toIntExact(deptId));
                 System.err.println(children.size());
                 deptList.addAll(children);
             }
@@ -3954,9 +3954,9 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         }
         if (deptService.hasChildByDeptId(Long.valueOf(queryZd))) {
             //获取子级部门d
-            List<Long> childByDeptId = deptService.getChildIdByDeptId(Long.valueOf(queryZd));
+            List<Integer> childByDeptId = deptService.getChildIdByDeptId(Long.valueOf(queryZd));
             //取出所有可以进行统计的项目id
-            for (Long cid : childByDeptId) {
+            for (Integer cid : childByDeptId) {
                 LambdaQueryWrapper<PmAuditDeptRef> ll = new LambdaQueryWrapper<>();
                 ll.eq(PmAuditDeptRef::getDeptId, cid);
                 ll.eq(PmAuditDeptRef::getRefType, "2");

+ 2 - 2
purchase-system/src/main/java/com/ozs/system/mapper/SysDeptMapper.java

@@ -17,7 +17,7 @@ public interface SysDeptMapper {
      * @param dept 部门信息
      * @return 部门信息集合
      */
-    public List<SysDept> selectDeptList(SysDept dept);
+    public List<SysDept> selectDeptList(@Param("dept") SysDept dept);
 
     /**
      * 根据角色ID查询部门树信息
@@ -66,7 +66,7 @@ public interface SysDeptMapper {
      * @param deptId 部门ID
      * @return 结果
      */
-    public List<Long> getChildIdByDeptId(Long deptId);
+    public List<Integer> getChildIdByDeptId(Long deptId);
 
     /**
      * 查询部门是否存在用户

+ 2 - 2
purchase-system/src/main/java/com/ozs/system/service/ISysDeptService.java

@@ -83,7 +83,7 @@ public interface ISysDeptService {
      * @param deptId 部门ID
      * @return 结果
      */
-    public List<Long> getChildIdByDeptId(Long deptId);
+    public List<Integer> getChildIdByDeptId(Long deptId);
 
     /**
      * 查询部门是否存在用户
@@ -140,7 +140,7 @@ public interface ISysDeptService {
      * @param deptId
      * @return
      */
-    public List<Long> getDeptChildren(Long deptId);
+    public List<Integer> getDeptChildren(Integer deptId);
 
     public SysDept selectById(Long deptId);
 

+ 25 - 17
purchase-system/src/main/java/com/ozs/system/service/impl/SysDeptServiceImpl.java

@@ -43,13 +43,12 @@ import javax.annotation.Resource;
  */
 @Service
 public class SysDeptServiceImpl implements ISysDeptService {
+
     @Autowired
     private SysDeptMapper deptMapper;
     @Autowired
     private ISysDeptService deptService;
     @Autowired
-    private IPmDemandService demandService;
-    @Autowired
     private SysRoleMapper roleMapper;
     @Resource
     private SysProcurementStandardMapper sysProcurementStandardMapper;
@@ -65,17 +64,26 @@ public class SysDeptServiceImpl implements ISysDeptService {
     public List<SysDept> selectDeptList(SysDept dept) {
         LoginUser loginUser = SecurityUtils.getLoginUser();
         if (!String.valueOf(loginUser.getUserId()).equals("1")) {
-            List<Long> deptList = new ArrayList<>();
+            List<Integer> deptList = new ArrayList<>();
             //获取到子孙级部门id
-            Long deptId = loginUser.getDeptId();
-            if (deptService.hasChildByDeptId(loginUser.getDeptId())) {
-                List<Long> children = deptService.getDeptChildren(deptId);
-                System.err.println(children.size());
-                deptList.addAll(children);
-                deptList.add(deptId);
-            }
+            //Integer deptId = Math.toIntExact(loginUser.getDeptId());
+            //if (deptService.hasChildByDeptId(loginUser.getDeptId())) {
+            //    List<Integer> children = deptService.getDeptChildren(deptId);
+            //    System.err.println(children.size());
+            //    deptList.addAll(children);
+            //    deptList.add(deptId);
+            deptList.add(228);
+            deptList.add(229);
             dept.setDeptList(deptList);
         }
+        if (!ObjectUtils.isEmpty(dept.getDeptList())) {
+            List<Integer> list = dept.getDeptList();
+            System.err.println(list.size());
+            for (Integer integer : list) {
+                System.err.println(integer);
+            }
+
+        }
         return deptMapper.selectDeptList(dept);
     }
 
@@ -193,7 +201,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
      * @return 结果
      */
     @Override
-    public List<Long> getChildIdByDeptId(Long deptId) {
+    public List<Integer> getChildIdByDeptId(Long deptId) {
         return deptMapper.getChildIdByDeptId(deptId);
     }
 
@@ -386,13 +394,13 @@ public class SysDeptServiceImpl implements ISysDeptService {
     }
 
     //获取到子孙级部门id
-    public List<Long> getDeptChildren(Long deptId) {
-        List<Long> deptList = new ArrayList<>();
-        Long did = deptId;
-        List<Long> childByDeptId = getChildIdByDeptId(did);
-        for (Long cid : childByDeptId) {
+    public List<Integer> getDeptChildren(Integer deptId) {
+        List<Integer> deptList = new ArrayList<>();
+        Integer did = deptId;
+        List<Integer> childByDeptId = getChildIdByDeptId(Long.valueOf(did));
+        for (Integer cid : childByDeptId) {
             deptList.add(cid);
-            if (hasChildByDeptId(cid)) {
+            if (hasChildByDeptId(Long.valueOf(cid))) {
                 deptList.addAll(getDeptChildren(cid));
             }
         }

+ 16 - 15
purchase-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -28,33 +28,34 @@
         from sys_dept d
     </sql>
 
-    <select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
+    <select id="selectDeptList" parameterType="com.ozs.common.core.domain.entity.SysDept" resultMap="SysDeptResult">
         <include refid="selectDeptVo"/>
         where d.del_flag = '0'
-        <if test="deptId != null and deptId != 0">
-            AND dept_id = #{deptId}
+        <if test="dept.deptId != null and dept.deptId != 0">
+            AND d.dept_id = #{dept.deptId}
         </if>
-        <if test="deptList != null and deptList.size != 0">
-            AND dept_id in
-            <foreach collection="deptList" item="tableId" open="(" separator="," close=")">
-                #{tableId}
+        <if test="dept.deptList != null and dept.deptList.size != 0 ">
+            AND d.dept_id in
+            <foreach collection="dept.deptList" item="item" index="index"
+                     separator="," open="(" close=")">
+                #{item}
             </foreach>
         </if>
-        <if test="parentId != null and parentId != 0">
-            AND parent_id = #{parentId}
+        <if test="dept.parentId != null and dept.parentId != 0">
+            AND d.parent_id = #{dept.parentId}
         </if>
-        <if test="deptName != null and deptName != ''">
-            AND dept_name like concat('%', #{deptName}, '%')
+        <if test="dept.deptName != null and dept.deptName != ''">
+            AND d.dept_name like concat('%', #{dept.deptName}, '%')
         </if>
-        <if test="status != null and status != ''">
-            AND status = #{status}
+        <if test="dept.status != null and dept.status != ''">
+            AND d.status = #{dept.status}
         </if>
         <!-- 数据范围过滤 -->
-        ${params.dataScope}
+        ${dept.params.dataScope}
         order by d.parent_id, d.order_num
     </select>
 
-    <select id="selectDeptListByRoleId" resultType="Long">
+    <select id="selectDeptListByRoleId" resultType="java.lang.Long">
         select d.dept_id
         from sys_dept d
         left join sys_role_dept rd on d.dept_id = rd.dept_id