|
@@ -1,22 +1,26 @@
|
|
package com.management.platform.service.impl;
|
|
package com.management.platform.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.management.platform.entity.Participation;
|
|
import com.management.platform.entity.Participation;
|
|
import com.management.platform.entity.Project;
|
|
import com.management.platform.entity.Project;
|
|
import com.management.platform.entity.Report;
|
|
import com.management.platform.entity.Report;
|
|
|
|
+import com.management.platform.entity.vo.ProjectVO;
|
|
import com.management.platform.mapper.ParticipationMapper;
|
|
import com.management.platform.mapper.ParticipationMapper;
|
|
import com.management.platform.mapper.ProjectMapper;
|
|
import com.management.platform.mapper.ProjectMapper;
|
|
import com.management.platform.mapper.ReportMapper;
|
|
import com.management.platform.mapper.ReportMapper;
|
|
import com.management.platform.mapper.UserMapper;
|
|
import com.management.platform.mapper.UserMapper;
|
|
import com.management.platform.service.ProjectService;
|
|
import com.management.platform.service.ProjectService;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -64,8 +68,20 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
try {
|
|
try {
|
|
//通过公司id获取该公司所有的项目列表
|
|
//通过公司id获取该公司所有的项目列表
|
|
Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
|
|
Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
|
|
- httpRespMsg.data = projectMapper.selectPage(new Page<Project>(pageIndex, pageSize),
|
|
|
|
|
|
+ IPage<Project> projectIPage = projectMapper.selectPage(new Page<>(pageIndex, pageSize),
|
|
new QueryWrapper<Project>().eq("company_id", companyId));
|
|
new QueryWrapper<Project>().eq("company_id", companyId));
|
|
|
|
+ List<Project> projectList = projectIPage.getRecords();
|
|
|
|
+ List<ProjectVO> list = new ArrayList<>();
|
|
|
|
+ for (Project project : projectList) {
|
|
|
|
+ ProjectVO projectVO = new ProjectVO();
|
|
|
|
+ BeanUtils.copyProperties(project, projectVO);
|
|
|
|
+ projectVO.setParticipator(participationMapper.getParticipator(projectVO.getId()));
|
|
|
|
+ }
|
|
|
|
+ Long total = projectIPage.getTotal();
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("records", list);
|
|
|
|
+ map.put("total", total);
|
|
|
|
+ httpRespMsg.data = map;
|
|
} catch (NullPointerException e) {
|
|
} catch (NullPointerException e) {
|
|
httpRespMsg.setError("验证失败");
|
|
httpRespMsg.setError("验证失败");
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|