Browse Source

项目

dev_shibei_match
zxc 4 years ago
parent
commit
ae93f390bd
  1. 49
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/CategoryProjectListFormDTO.java
  2. 37
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/ProjectCategoryFormDTO.java
  3. 56
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/CategoryProjectListResultDTO.java
  4. 28
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/PageCategoryProjectListResultDTO.java
  5. 61
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryResultDTO.java
  6. 56
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategorySonResultDTO.java
  7. 34
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java
  8. 31
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java
  9. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java
  10. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectOrgDailyDao.java
  11. 26
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java
  12. 163
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java
  13. 49
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml
  14. 20
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml
  15. 26
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml

49
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/CategoryProjectListFormDTO.java

@ -0,0 +1,49 @@
package com.epmet.project.dto.form;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/4 3:23 下午
* @DESC
*/
@Data
public class CategoryProjectListFormDTO implements Serializable {
private static final long serialVersionUID = -5448734274886241594L;
public interface CategoryProjectListForm{}
@NotNull(message = "pageSize不能为空",groups = CategoryProjectListForm.class)
private Integer pageSize;
@NotNull(message = "pageNo不能为空",groups = CategoryProjectListForm.class)
private Integer pageNo;
/**
* 项目状态closed已结案all全部
*/
@NotNull(message = "status不能为空",groups = CategoryProjectListForm.class)
private String status;
@NotNull(message = "categoryCode不能为空",groups = CategoryProjectListForm.class)
private String categoryCode;
/**
* 组织ID
*/
private String orgId;
/**
* 组织类型agency组织grid网格
*/
private String orgType;
/**
* 是否分页默认truefalse的时候 给导出用
*/
private Boolean isPage = true;
}

37
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/ProjectCategoryFormDTO.java

@ -0,0 +1,37 @@
package com.epmet.project.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/4 3:18 下午
* @DESC
*/
@Data
public class ProjectCategoryFormDTO implements Serializable {
private static final long serialVersionUID = 5047143743629810527L;
public interface ProjectCategoryForm{}
/**
* 组织ID
*/
private String orgId;
/**
* 组织类型 组织agency网格grid
*/
private String orgType;
@NotBlank(message = "结束时间不能为空",groups = ProjectCategoryForm.class)
private String endTime;
/**
* 开始时间
*/
private String startTime;
}

56
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/CategoryProjectListResultDTO.java

@ -0,0 +1,56 @@
package com.epmet.project.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/4 3:31 下午
* @DESC
*/
@Data
public class CategoryProjectListResultDTO implements Serializable {
private static final long serialVersionUID = 8820354423099062062L;
/**
* 分类
*/
private String category;
/**
* 项目状态:待处理 pending结案closed
*/
private String projectStatus;
/**
* 项目标题
*/
private String projectTitle;
/**
* 网格
*/
private String gridName;
/**
* 项目创建时间
*/
private String createTime;
@JsonIgnore
private String orgId;
@JsonIgnore
private String orgType;
public CategoryProjectListResultDTO() {
this.category = "";
this.projectStatus = "";
this.projectTitle = "";
this.gridName = "";
this.createTime = "";
}
}

28
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/PageCategoryProjectListResultDTO.java

@ -0,0 +1,28 @@
package com.epmet.project.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/11/5 1:51 下午
* @DESC
*/
@Data
public class PageCategoryProjectListResultDTO implements Serializable {
private static final long serialVersionUID = 8822993169364931502L;
private Integer total;
private List<CategoryProjectListResultDTO> list;
public PageCategoryProjectListResultDTO() {
this.total = NumConstant.ZERO;
this.list = new ArrayList<>();
}
}

61
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryResultDTO.java

@ -0,0 +1,61 @@
package com.epmet.project.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/11/4 3:13 下午
* @DESC
*/
@Data
public class ProjectCategoryResultDTO implements Serializable {
private static final long serialVersionUID = -2662970383306349424L;
/**
* 分类CODE
*/
private String categoryCode;
/**
* 分类名字
*/
private String categoryName;
/**
* 项目总数
*/
private Integer projectTotal;
/**
* 结案项目数
*/
private Integer closedProjectTotal;
/**
* 总数占比
*/
private String totalRatio;
/**
* 结案率
*/
private String closedRatio;
private List<ProjectCategorySonResultDTO> children;
public ProjectCategoryResultDTO() {
this.categoryCode = "";
this.categoryName = "";
this.projectTotal = NumConstant.ZERO;
this.closedProjectTotal = NumConstant.ZERO;
this.totalRatio = "";
this.closedRatio = "";
this.children = new ArrayList<>();
}
}

56
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategorySonResultDTO.java

@ -0,0 +1,56 @@
package com.epmet.project.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/4 3:13 下午
* @DESC
*/
@Data
public class ProjectCategorySonResultDTO implements Serializable {
private static final long serialVersionUID = -2662970383306349424L;
/**
* 分类CODE
*/
private String categoryCode;
/**
* 分类名字
*/
private String categoryName;
/**
* 项目总数
*/
private Integer projectTotal;
/**
* 结案项目数
*/
private Integer closedProjectTotal;
/**
* 总数占比
*/
private String totalRatio;
/**
* 结案率
*/
private String closedRatio;
public ProjectCategorySonResultDTO() {
this.categoryCode = "";
this.categoryName = "";
this.projectTotal = NumConstant.ZERO;
this.closedProjectTotal = NumConstant.ZERO;
this.totalRatio = "";
this.closedRatio = "";
}
}

34
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java

@ -1,5 +1,7 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectOrgDailyService;
@ -12,8 +14,13 @@ import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO;
import com.epmet.evaluationindex.screen.dto.result.ProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import com.epmet.project.dto.form.CategoryProjectListFormDTO;
import com.epmet.project.dto.form.CategoryTopAppealFormDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import com.epmet.project.dto.result.CategoryProjectListResultDTO;
import com.epmet.project.dto.result.CategoryTopAppealResultDTO;
import com.epmet.project.dto.result.PageCategoryProjectListResultDTO;
import com.epmet.project.dto.result.ProjectCategoryResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -155,4 +162,31 @@ public class ScreenProjectController {
return new Result<List<CategoryTopAppealResultDTO>>().ok(screenProjectService.categoryTopAppeal(formDTO));
}
/**
* @Description 项目分类查询项目分类
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:38 下午
*/
@PostMapping("selectprojectcategory")
public Result<List<ProjectCategoryResultDTO>> selectProjectCategory(@RequestBody ProjectCategoryFormDTO formDTO, @LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, ProjectCategoryFormDTO.ProjectCategoryForm.class);
return new Result<List<ProjectCategoryResultDTO>>().ok(screenProjectService.selectProjectCategory(formDTO,tokenDto));
}
/**
* @Description 项目分类查询分类下的项目
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:39 下午
*/
@PostMapping("selectcategoryprojectlist")
public Result<PageCategoryProjectListResultDTO> selectCategoryProjectList(@RequestBody CategoryProjectListFormDTO formDTO, @LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, CategoryProjectListFormDTO.CategoryProjectListForm.class);
return new Result<PageCategoryProjectListResultDTO>().ok(screenProjectService.selectCategoryProjectList(formDTO,tokenDto));
}
}

31
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java

@ -19,7 +19,9 @@ package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.screen.CategoryAnalysisResultDTO;
import com.epmet.project.CustomerProjectCategoryDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import com.epmet.project.dto.result.CategoryTopAppealResultDTO;
import com.epmet.project.dto.result.ProjectCategoryResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -52,4 +54,33 @@ public interface ScreenProjectCategoryOrgDailyDao {
* @date 2021/8/18 1:40 下午
*/
List<CategoryTopAppealResultDTO> categoryTopAppeal(@Param("agencyId") String agencyId,@Param("customerId")String customerId,@Param("topCount")Integer topCount);
/**
* @Description 组织查询分类
* @param customerId
* @param time
* @param orgId
* @author zxc
* @date 2021/11/5 8:54 上午
*/
List<ProjectCategoryResultDTO> selectProjectCategoryByAgency(@Param("customerId")String customerId,@Param("time")String time,@Param("orgId")String orgId);
/**
* @Description 网格查询分类
* @param customerId
* @param time
* @param orgId
* @author zxc
* @date 2021/11/5 8:55 上午
*/
List<ProjectCategoryResultDTO> selectProjectCategoryByGrid(@Param("customerId")String customerId,@Param("time")String time,@Param("orgId")String orgId);
/**
* @Description 查询客户下所有分类
* @param customerId
* @author zxc
* @date 2021/11/4 5:45 下午
*/
List<ProjectCategoryResultDTO> selectCategoryByCustomerId(@Param("customerId")String customerId);
}

12
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java

@ -3,6 +3,7 @@ package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.screen.ColorProjectTotalResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import com.epmet.project.dto.result.CategoryProjectListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -45,4 +46,15 @@ public interface ScreenProjectDataDao {
* @date 2021/6/1 3:48 下午
*/
List<ColorProjectTotalResultDTO> selectColorProjectByAreaCode(@Param("areaCode") String areaCode,@Param("monthCount")Integer monthCount);
/**
* @Description 查询分类下的项目列表
* @param customerId
* @param orgId
* @author zxc
* @date 2021/11/5 1:40 下午
*/
List<CategoryProjectListResultDTO> selectCategoryProjectList(@Param("customerId") String customerId,@Param("orgId") String orgId,
@Param("categoryCode")String categoryCode,@Param("status")String status);
}

6
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectOrgDailyDao.java

@ -19,6 +19,7 @@ package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.screen.EfficiencyAnalysisResultDTO;
import com.epmet.dto.result.screen.ProjectQuantityResultDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -45,4 +46,9 @@ public interface ScreenProjectOrgDailyDao {
* @description 下级组织的效率解决率列表
**/
List<EfficiencyAnalysisResultDTO> queryEfficiencyAnalysis(@Param("customerId")String customerId,@Param("areaCode") String areaCode);
Integer selectProjectTotalByAgency(@Param("customerId")String customerId,@Param("time")String time,@Param("orgId")String orgId);
Integer selectProjectTotalByGrid(@Param("customerId")String customerId,@Param("time")String time,@Param("orgId")String orgId);
}

26
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java

@ -1,5 +1,6 @@
package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.screen.CategoryAnalysisFormDTO;
import com.epmet.dto.form.screen.ColorProjectTotalFormDTO;
@ -10,8 +11,13 @@ import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO;
import com.epmet.evaluationindex.screen.dto.result.ProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import com.epmet.project.dto.form.CategoryProjectListFormDTO;
import com.epmet.project.dto.form.CategoryTopAppealFormDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import com.epmet.project.dto.result.CategoryProjectListResultDTO;
import com.epmet.project.dto.result.CategoryTopAppealResultDTO;
import com.epmet.project.dto.result.PageCategoryProjectListResultDTO;
import com.epmet.project.dto.result.ProjectCategoryResultDTO;
import java.util.List;
@ -62,4 +68,24 @@ public interface ScreenProjectService {
*/
List<CategoryTopAppealResultDTO> categoryTopAppeal(CategoryTopAppealFormDTO formDTO);
/**
* @Description 项目分类查询项目分类
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:38 下午
*/
List<ProjectCategoryResultDTO> selectProjectCategory(ProjectCategoryFormDTO formDTO, TokenDto tokenDto);
/**
* @Description 项目分类查询分类下的项目
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:39 下午
*/
PageCategoryProjectListResultDTO selectCategoryProjectList(CategoryProjectListFormDTO formDTO, TokenDto tokenDto);
}

163
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java

@ -3,14 +3,15 @@ package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenEventDataDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenEventImgDataDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectDataDao;
import com.epmet.datareport.constant.FactConstant;
import com.epmet.datareport.dao.evaluationindex.screen.*;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectService;
import com.epmet.dto.UserDTO;
import com.epmet.dto.form.CustomerAgencyUserRoleFormDTO;
@ -26,15 +27,21 @@ import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.project.CustomerProjectCategoryDTO;
import com.epmet.project.dto.form.CategoryProjectListFormDTO;
import com.epmet.project.dto.form.CategoryTopAppealFormDTO;
import com.epmet.project.dto.result.CategoryTopAppealResultDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import com.epmet.project.dto.result.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -63,6 +70,9 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
@Autowired
private EpmetUserOpenFeignClient userOpenFeignClient;
@Autowired
private ScreenProjectOrgDailyDao screenProjectOrgDailyDao;
/**
* @Description 3项目详情
* @param projectDetailFormDTO
@ -228,4 +238,147 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
}
return result;
}
/**
* @Description 项目分类查询项目分类
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:38 下午
*/
@Override
public List<ProjectCategoryResultDTO> selectProjectCategory(ProjectCategoryFormDTO formDTO, TokenDto tokenDto) {
if (StringUtils.isBlank(formDTO.getOrgId())){
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == staffInfo){
throw new RenException("未查询到此工作人员的所属组织信息...");
}
formDTO.setOrgId(staffInfo.getAgencyId());
formDTO.setOrgType(FactConstant.AGENCY);
}
String customerId = tokenDto.getCustomerId();
String endTime = formDTO.getEndTime();
String startTime = formDTO.getStartTime();
String orgId = formDTO.getOrgId();
// 查询客户下的所有分类
List<ProjectCategoryResultDTO> result = screenProjectCategoryOrgDailyDao.selectCategoryByCustomerId(tokenDto.getCustomerId());
List<ProjectCategoryResultDTO> endCategoryList = new ArrayList<>();
if (formDTO.getOrgType().equals(FactConstant.AGENCY)){
Integer endTotal = screenProjectOrgDailyDao.selectProjectTotalByAgency(customerId, endTime, orgId);
endTotal = null == endTotal ? NumConstant.ZERO : endTotal;
endCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByAgency(customerId,endTime,orgId);
Integer total = endTotal;
if (StringUtils.isNotBlank(startTime)){
Integer startTotal = screenProjectOrgDailyDao.selectProjectTotalByAgency(customerId, startTime, orgId);
startTotal = null == startTotal ? NumConstant.ZERO : startTotal;
total = endTotal - startTotal;
List<ProjectCategoryResultDTO> startCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByAgency(customerId,startTime,orgId);
endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setProjectTotal(subtract(e.getProjectTotal(),s.getProjectTotal()))));
endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setClosedProjectTotal(subtract(e.getClosedProjectTotal(),s.getClosedProjectTotal()))));
}
Integer finalTotal = total;
endCategoryList.forEach(e -> {
e.setTotalRatio(ratio(e.getProjectTotal(), finalTotal));
e.setClosedRatio(ratio(e.getClosedProjectTotal(),e.getProjectTotal()));
});
}else {
Integer endTotal = screenProjectOrgDailyDao.selectProjectTotalByGrid(customerId, endTime, orgId);
endTotal = null == endTotal ? NumConstant.ZERO : endTotal;
endCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByGrid(customerId,endTime,orgId);
Integer total = endTotal;
if (StringUtils.isNotBlank(startTime)){
Integer startTotal = screenProjectOrgDailyDao.selectProjectTotalByGrid(customerId, startTime, orgId);
startTotal = null == startTotal ? NumConstant.ZERO : startTotal;
total = endTotal - startTotal;
List<ProjectCategoryResultDTO> startCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByGrid(customerId,startTime,orgId);
endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setProjectTotal(subtract(e.getProjectTotal(),s.getProjectTotal()))));
endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setClosedProjectTotal(subtract(e.getClosedProjectTotal(),s.getClosedProjectTotal()))));
}
Integer finalTotal = total;
endCategoryList.forEach(e -> {
e.setTotalRatio(ratio(e.getProjectTotal(), finalTotal));
e.setClosedRatio(ratio(e.getClosedProjectTotal(),e.getProjectTotal()));
});
}
List<ProjectCategoryResultDTO> finalEndCategoryList = endCategoryList;
result.forEach(r -> {
finalEndCategoryList.stream().filter(e -> r.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> {
r.setTotalRatio(e.getTotalRatio());r.setClosedRatio(e.getClosedRatio());
});
r.getChildren().forEach(son -> finalEndCategoryList.stream().filter(e -> son.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> {
son.setTotalRatio(e.getTotalRatio());son.setClosedRatio(e.getClosedRatio());
}));
});
// 排序
List<ProjectCategoryResultDTO> collect = result.stream().sorted(Comparator.comparing(ProjectCategoryResultDTO::getProjectTotal).reversed()).collect(Collectors.toList());
collect.forEach(c -> {
c.setChildren(c.getChildren().stream().sorted(Comparator.comparing(ProjectCategorySonResultDTO::getProjectTotal).reversed()).collect(Collectors.toList()));
});
return collect;
}
/**
* @Description 俩数相减小于0就赋值为0
* @param end
* @param start
* @author zxc
* @date 2021/11/5 9:18 上午
*/
public Integer subtract(Integer end,Integer start){
return end - start < NumConstant.ZERO ? NumConstant.ZERO : end - start;
}
/**
* @Description 返回占比,保留小数点2位
* @param molecule 分子
* @param denominator 分母
* @author zxc
* @date 2021/11/5 9:26 上午
*/
public String ratio(Integer molecule, Integer denominator){
if (denominator == NumConstant.ZERO){
return "0.00%";
}
BigDecimal bigDecimalMolecule = new BigDecimal(molecule);
BigDecimal bigDecimalDenominator = new BigDecimal(denominator);
BigDecimal divide = bigDecimalMolecule.divide(bigDecimalDenominator, NumConstant.FOUR, BigDecimal.ROUND_HALF_UP);
return divide.multiply(NumConstant.ONE_HUNDRED_DECIMAL)+"%";
}
/**
* @Description 项目分类查询分类下的项目
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:39 下午
*/
@Override
public PageCategoryProjectListResultDTO selectCategoryProjectList(CategoryProjectListFormDTO formDTO, TokenDto tokenDto) {
if (StringUtils.isBlank(formDTO.getOrgId())){
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == staffInfo){
throw new RenException("未查询到此工作人员的所属组织信息...");
}
formDTO.setOrgId(staffInfo.getAgencyId());
formDTO.setOrgType(FactConstant.AGENCY);
}
PageCategoryProjectListResultDTO result = new PageCategoryProjectListResultDTO();
if (formDTO.getIsPage()){
PageInfo<CategoryProjectListResultDTO> objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> screenProjectDataDao.selectCategoryProjectList(tokenDto.getCustomerId(), formDTO.getOrgId(), formDTO.getCategoryCode(), formDTO.getStatus()));
List<CategoryProjectListResultDTO> list = objectPageInfo.getList();
result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal())));
if (!CollectionUtils.isEmpty(list)){
list.forEach(l -> {
if (l.getOrgType().equals(FactConstant.AGENCY)){
}else {
}
});
}
}
return result;
}
}

49
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml

@ -63,4 +63,53 @@
AND DATE_ID = (select date_id from screen_project_category_org_daily where del_flag = '0' and ORG_ID = #{agencyId} and CUSTOMER_ID= #{customerId} order by date_id desc, created_time desc limit 1)
ORDER BY PROJECT_TOTAL DESC LIMIT #{topCount}
</select>
<!-- 组织查询分类 -->
<select id="selectProjectCategoryByAgency" resultType="com.epmet.project.dto.result.ProjectCategoryResultDTO">
SELECT
co.CATEGORY_CODE,
co.PROJECT_TOTAL,
co.CLOSED_PROJECT_TOTAL
FROM screen_project_category_org_daily co
WHERE co.DEL_FLAG = '0'
AND co.ORG_ID = #{orgId}
AND co.CUSTOMER_ID = #{customerId}
AND co.DATE_ID = #{time}
</select>
<!-- 网格查询分类 -->
<select id="selectProjectCategoryByGrid" resultType="com.epmet.project.dto.result.ProjectCategoryResultDTO">
SELECT
co.CATEGORY_CODE,
co.PROJECT_TOTAL,
co.CLOSED_PROJECT_TOTAL
FROM screen_project_category_grid_daily co
WHERE co.DEL_FLAG = '0'
AND co.GRID_ID = #{orgId}
AND co.CUSTOMER_ID = #{customerId}
AND co.DATE_ID = #{time}
</select>
<!-- 查询客户下所有分类 -->
<resultMap id="selectCategoryByCustomerIdMap" type="com.epmet.project.dto.result.ProjectCategoryResultDTO">
<result column="c" property="categoryCode"/>
<result column="n" property="categoryName"/>
<collection property="children" ofType="com.epmet.project.dto.result.ProjectCategorySonResultDTO">
<result column="c2" property="categoryCode"/>
<result column="n2" property="categoryName"/>
</collection>
</resultMap>
<select id="selectCategoryByCustomerId" resultMap="selectCategoryByCustomerIdMap">
SELECT
p1.CATEGORY_CODE AS c,
p2.CATEGORY_CODE AS c2,
p1.CATEGORY_NAME AS n,
p2.CATEGORY_NAME AS n2
FROM customer_project_category_dict p1,customer_project_category_dict p2
WHERE p1.DEL_FLAG = '0'
AND p2.DEL_FLAG = '0'
AND p1.CUSTOMER_ID = #{customerId}
AND p2.CUSTOMER_ID = #{customerId}
AND p1.CATEGORY_CODE = p2.PARENT_CATEGORY_CODE
</select>
</mapper>

20
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml

@ -158,4 +158,24 @@
AND UNIX_TIMESTAMP(pd.CREATED_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL #{monthCount} MONTH))
)
</select>
<!-- 查询分类下的项目列表 -->
<select id="selectCategoryProjectList" resultType="com.epmet.project.dto.result.CategoryProjectListResultDTO">
SELECT
ALL_CATEGORY_NAME AS category,
CASE WHEN PROJECT_STATUS_CODE = 'closed_case' THEN 'closed' ELSE PROJECT_STATUS_CODE END AS projectStatus,
IFNULL(PROJECT_TITLE,'') AS projectTitle,
DATE_FORMAT(PROJECT_CREATE_TIME,'%Y-%m-%d %h:%i:%s') AS createTime,
ORG_ID,
ORG_TYPE
FROM screen_project_data
WHERE DEL_FLAG = '0'
<if test=' status == "closed" '>
AND PROJECT_STATUS_CODE IN ('closed_case','closed')
</if>
AND CONCAT(ALL_PARENT_IDS,':',ORG_ID) LIKE CONCAT('%',#{orgId},'%')
AND CATEGORY_CODE LIKE CONCAT('%',#{categoryCode},'%')
AND CUSTOMER_ID = #{customerId}
ORDER BY PROJECT_CREATE_TIME DESC
</select>
</mapper>

26
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml

@ -54,4 +54,30 @@
)and m.CUSTOMER_ID=#{customerId}
order by resolvedRatio+0 desc
</select>
<!-- 查询项目总数组织 -->
<select id="selectProjectTotalByAgency" resultType="java.lang.Integer">
SELECT
PROJECT_TOTAL
FROM
screen_project_org_daily
WHERE
del_flag = '0'
AND ORG_ID = #{orgId}
AND DATE_ID = #{time}
AND CUSTOMER_ID = #{customerId}
</select>
<!-- 查询项目总数网格 -->
<select id="selectProjectTotalByGrid" resultType="java.lang.Integer">
SELECT
PROJECT_TOTAL
FROM
screen_project_grid_daily
WHERE
del_flag = '0'
AND grid_id = #{orgId}
AND DATE_ID = #{time}
AND CUSTOMER_ID = #{customerId}
</select>
</mapper>
Loading…
Cancel
Save