Kaynağa Gözat

报销类别查询 业务差旅费和业务操作奖

huangguoce 2 hafta önce
ebeveyn
işleme
6e4b40d8cc

+ 13 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/reimApprovalType/controller/CwReimbursementTypeController.java

@@ -54,6 +54,19 @@ public class CwReimbursementTypeController {
         return ResponseEntity.ok(list);
     }
 
+
+    /**
+     * 根据业务差旅费和业务操作奖查询
+     * @param info
+     * @return
+     */
+    @ApiOperation(value = "列表查询")
+    @GetMapping("/bxListByClCz")
+    public ResponseEntity<List<CwReimbursementTypeInfo>> bxListByClCz(CwReimbursementTypeInfo info) {
+        List<CwReimbursementTypeInfo> list = service.bxListByClCz(info);
+        return ResponseEntity.ok(list);
+    }
+
     /**
      * 采购类型列表查询
      * @param info

+ 93 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/reimApprovalType/service/CwReimbursementTypeService.java

@@ -373,4 +373,97 @@ public class CwReimbursementTypeService {
         }
         return info;
     }
+
+    public List<CwReimbursementTypeInfo> bxListByClCz(CwReimbursementTypeInfo info) {
+        LambdaQueryWrapper<CwReimbursementTypeInfo> wrapper = new LambdaQueryWrapper<>();
+            //根据type模糊查询
+            List<CwReimbursementTypeInfo> cwReimbursementTypeInfoList = mapper.selectList(
+                    new QueryWrapper<CwReimbursementTypeInfo>().lambda()
+                            .and(wrappers -> wrappers
+                                    .like(CwReimbursementTypeInfo::getName, "业务差旅费")
+                                    .or()
+                                    .like(CwReimbursementTypeInfo::getName, "业务操作奖"))
+            );
+            List<String> collect = cwReimbursementTypeInfoList.stream().map(CwReimbursementTypeInfo::getId).collect(Collectors.toList());
+            //materialTypeInfoList的父级id全部获取
+            List<String> cupIdList = cwReimbursementTypeInfoList.stream().map(CwReimbursementTypeInfo::getParentId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());
+            //获取materialTypeInfoList的父级id的父级id
+            List<String> cupIdPList = new ArrayList<>();
+            if (CollectionUtil.isNotEmpty(cupIdList)) {
+                cupIdList.stream().forEach(item -> {
+                    CwReimbursementTypeInfo byId = mapper.selectById(item);
+                    if (ObjectUtil.isNotEmpty(byId)) {
+                        if (StringUtils.isNotBlank(byId.getParentId())) {
+                            cupIdPList.add(byId.getParentId());
+                        }
+                    }
+                });
+            }
+            //获取collect的下级id
+            List<String> childIdList = new ArrayList<>();
+            collect.stream().forEach(item -> {
+                List<CwReimbursementTypeInfo> list = mapper.selectList(new LambdaQueryWrapper<CwReimbursementTypeInfo>().eq(CwReimbursementTypeInfo::getParentId, item));
+                if (CollectionUtil.isNotEmpty(list)) {
+                    List<String> collect1 = list.stream().map(CwReimbursementTypeInfo::getId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());
+                    if (CollectionUtil.isNotEmpty(collect1)) {
+                        childIdList.addAll(collect1);
+                        //获取collect的下级的下级的id
+                        collect1.stream().forEach(i -> {
+                            List<CwReimbursementTypeInfo> l = mapper.selectList(new LambdaQueryWrapper<CwReimbursementTypeInfo>().eq(CwReimbursementTypeInfo::getParentId, i));
+                            if (CollectionUtil.isNotEmpty(l)) {
+                                List<String> collect2 = l.stream().map(CwReimbursementTypeInfo::getId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());
+                                if (CollectionUtil.isNotEmpty(collect2)) {
+                                    childIdList.addAll(collect2);
+                                }
+                            }
+                        });
+                    }
+                }
+            });
+            //将获取到的这几个id集合融合到一起并去重,然后根据id查询,即可得到结果
+            collect.addAll(cupIdList);
+            collect.addAll(cupIdPList);
+            collect.addAll(childIdList);
+
+            List<String> idList = collect.stream().distinct().collect(Collectors.toList());
+            if(CollectionUtil.isNotEmpty(idList)){
+                wrapper.in(CwReimbursementTypeInfo::getId,idList);
+            }else{
+                return new ArrayList<>();
+            }
+        if (ObjectUtil.isNotEmpty(info)) {
+            if (StringUtils.isNotBlank(info.getLike())){
+                wrapper.likeRight(CwReimbursementTypeInfo::getSort,info.getLike());
+            }
+        }
+//        if (info.getSort() != null) {
+//            wrapper.like(CwReimbursementTypeInfo::getSort, info.getSort());
+//        }
+
+        wrapper.eq(BaseEntity::getDelFlag, 0);
+        wrapper.orderByAsc(CwReimbursementTypeInfo::getSort);
+        //查当前登陆人的父级部门的id为江苏兴光的
+//        OfficeDomain officeInfo = mapper.officeInfo(info.getOfficeId());
+//        if (null != officeInfo && officeInfo.getGrade().equals("2")){
+//            info.setOfficeId(officeInfo.getId());
+//        } else if (null != officeInfo && officeInfo.getGrade().equals("3")) {
+//            officeInfo = mapper.officeInfo2(officeInfo.getId());
+//            if (null != officeInfo){
+//                info.setOfficeId(officeInfo.getId());
+//            }
+//        }
+        //使用递归的方式来查当前登陆人部门父节点信息
+        List<OfficeDomain> officeDomains = mapper.officeInfo3(info.getOfficeId());
+        if (null != officeDomains && officeDomains.size()>0){
+            for (int i=0;i<officeDomains.size()-1;i++){
+                //当get(i)的父级id与 i+1的id相同,并且i+的部门层级为1的时候
+                if (officeDomains.get(i).getParentId().equals(officeDomains.get(i+1).getId()) && StringUtils.isNotBlank(officeDomains.get(i+1).getGrade()) &&
+                        officeDomains.get(i+1).getGrade().equals("1")){
+                    info.setOfficeId(officeDomains.get(i).getId());
+                }
+            }
+        }
+        return mapper.bxList2(wrapper,info.getOfficeId());
+    }
+
 }