|
@@ -15,6 +15,7 @@ import org.jeecg.common.dto.archives.ProArchivesAddReqDTO;
|
|
|
import org.jeecg.common.dto.archives.ProArchivesAddRespDTO;
|
|
|
import org.jeecg.common.dto.archives.ProPlanListReqDTO;
|
|
|
import org.jeecg.common.dto.archives.ProPlanListRespDTO;
|
|
|
+import org.jeecg.common.dto.basedata.ArchivesMilestoneListRespDTO;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.modules.archives.entity.ProjectManageArchives;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -24,8 +25,10 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.modules.archives.entity.ProjectManageBusinessOther;
|
|
|
import org.jeecg.modules.archives.service.ProjectManageArchivesService;
|
|
|
import org.jeecg.modules.archives.service.ProjectManageBusinessOtherService;
|
|
|
+import org.jeecg.modules.basedata.entity.BaseArchivesMilestone;
|
|
|
import org.jeecg.modules.payment.service.ManagerPaymentAndReceiptSlipService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -34,6 +37,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Author jihaosen
|
|
@@ -295,7 +300,8 @@ public class ProjectManageArchivesController {
|
|
|
|
|
|
@ApiOperation(value = "项目档案计划列表查询", notes = "根据主表id查询项目档案计划列表")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name="id", value="id",required=true, dataType="String")
|
|
|
+ @ApiImplicitParam(name="id", value="id",required=true, dataType="String"),
|
|
|
+ @ApiImplicitParam(name="planType", value="计划类型",required=true, dataType="String")
|
|
|
})
|
|
|
@GetMapping(value = "/getPlanListById")
|
|
|
public Result<List<ProPlanListRespDTO>> getListById(@Valid ProPlanListReqDTO reqDTO, BindingResult bindingResult) {
|
|
@@ -313,10 +319,8 @@ public class ProjectManageArchivesController {
|
|
|
.eq("plan_type", reqDTO.getPlanType());
|
|
|
|
|
|
List<ProjectManageBusinessOther> list = projectManageBusinessOtherService.list(queryWrapper);
|
|
|
- List<ProPlanListRespDTO> respDTOS = Lists.newArrayList();
|
|
|
- for(ProjectManageBusinessOther other : list){
|
|
|
- respDTOS.add(new ProPlanListRespDTO(other.getId(), other.getMuilesId(), other.getMuilesName()));
|
|
|
- }
|
|
|
+ list.sort((x, y) -> Integer.compare(x.getSort(), y.getSort()));
|
|
|
+ List<ProPlanListRespDTO> respDTOS = getTreeList(list);
|
|
|
result.setResult(respDTOS);
|
|
|
result.setSuccess(true);
|
|
|
}
|
|
@@ -327,4 +331,53 @@ public class ProjectManageArchivesController {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc 将计划列表转成树状结构
|
|
|
+ */
|
|
|
+ private List<ProPlanListRespDTO> getTreeList( List<ProjectManageBusinessOther> list) {
|
|
|
+ List<ProPlanListRespDTO> resp = Lists.newArrayList();
|
|
|
+ //根据parentId分组
|
|
|
+ Map<String, List<ProjectManageBusinessOther>> postMap = list.stream().collect(Collectors.groupingBy(ProjectManageBusinessOther :: getParentId));
|
|
|
+ List<ProjectManageBusinessOther> baseArchivesMilestones = postMap.get("0");
|
|
|
+ if(CollectionUtils.isEmpty(baseArchivesMilestones)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ for(ProjectManageBusinessOther other : baseArchivesMilestones){
|
|
|
+ ProPlanListRespDTO respDTO = new ProPlanListRespDTO(other);
|
|
|
+ respDTO.setChildren(getChildes(list, respDTO.getKey(), postMap));
|
|
|
+ //判断是否为末节点
|
|
|
+ List<ProjectManageBusinessOther> posts = postMap.get(respDTO.getKey());
|
|
|
+ if(CollectionUtils.isEmpty(posts)){
|
|
|
+ respDTO.setIsLeaf(true);
|
|
|
+ respDTO.setChildren(null);
|
|
|
+ }
|
|
|
+ resp.add(respDTO);
|
|
|
+ }
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc 获取子节点数据
|
|
|
+ */
|
|
|
+ private List<ProPlanListRespDTO> getChildes(List<ProjectManageBusinessOther> list, String key, Map<String, List<ProjectManageBusinessOther>> postMap) {
|
|
|
+ List<ProPlanListRespDTO> resp = Lists.newArrayList();
|
|
|
+ for(ProjectManageBusinessOther other : list){
|
|
|
+ if(other.getParentId().equals(key)){
|
|
|
+ ProPlanListRespDTO respDTO = new ProPlanListRespDTO(other);
|
|
|
+ respDTO.setChildren(getChildes(list, respDTO.getKey(), postMap));
|
|
|
+ //判断是否为末节点
|
|
|
+ List<ProjectManageBusinessOther> posts = postMap.get(respDTO.getKey());
|
|
|
+ if(CollectionUtils.isEmpty(posts)){
|
|
|
+ respDTO.setIsLeaf(true);
|
|
|
+ respDTO.setChildren(null);
|
|
|
+ }
|
|
|
+ resp.add(respDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
}
|