Browse Source

Merge remote-tracking branch 'origin/master'

master
WendyYang 11 months ago
parent
commit
ab845fac42
5 changed files with 161 additions and 5 deletions
  1. +5
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/DataDTO.java
  2. +7
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/DashboardConstant.java
  3. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/StatisticsController.java
  4. +109
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/ProjectCostStatisticsManage.java
  5. +31
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CostStatisticsVO.java

+ 5
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/DataDTO.java View File

@@ -26,8 +26,11 @@ public class DataDTO {
private String name; private String name;


@ApiModelProperty("数量") @ApiModelProperty("数量")
private Integer num;
private Integer num = 0;

@ApiModelProperty("金额")
private BigDecimal amount = BigDecimal.ZERO;


@ApiModelProperty("比例") @ApiModelProperty("比例")
private BigDecimal rate;
private BigDecimal rate = BigDecimal.ZERO;
} }

+ 7
- 3
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/DashboardConstant.java View File

@@ -1,5 +1,7 @@
package com.ningdatech.pmapi.dashboard.constant; package com.ningdatech.pmapi.dashboard.constant;


import java.math.BigDecimal;

/** /**
* @author liuxinxin * @author liuxinxin
* @date 2023/8/2 下午2:46 * @date 2023/8/2 下午2:46
@@ -7,7 +9,7 @@ package com.ningdatech.pmapi.dashboard.constant;


public class DashboardConstant { public class DashboardConstant {


public class Protrait{
public static class Protrait{
public static final String NONE = "暂无"; public static final String NONE = "暂无";
public static final String PLAN = "计划"; public static final String PLAN = "计划";
public static final String DECLARED = "申报"; public static final String DECLARED = "申报";
@@ -26,13 +28,13 @@ public class DashboardConstant {
} }




public class CockpitStats{
public static class CockpitStats{
//总数 //总数
public static final String TOTAL = "TOTAL"; public static final String TOTAL = "TOTAL";
public static final int NONE_YEAR = 0; public static final int NONE_YEAR = 0;
} }


public class Expert {
public static class Expert {
public static final String ACCOUNT_STATUS_OK = "available"; public static final String ACCOUNT_STATUS_OK = "available";


public static final String DISTRIBUTION_SHENG = "省维度"; public static final String DISTRIBUTION_SHENG = "省维度";
@@ -65,5 +67,7 @@ public class DashboardConstant {
public static final String EXPERT_LEVEL_CHUJI = "900003"; public static final String EXPERT_LEVEL_CHUJI = "900003";


public static final String EXPERT_LEVEL_NULL = "900004"; public static final String EXPERT_LEVEL_NULL = "900004";

public static final BigDecimal REVIEW_AOUMT_EXPERT = BigDecimal.valueOf(0.05);
} }
} }

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/StatisticsController.java View File

@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.dashboard.controller;
import com.ningdatech.pmapi.dashboard.manage.ExpertStatisticsManage; import com.ningdatech.pmapi.dashboard.manage.ExpertStatisticsManage;
import com.ningdatech.pmapi.dashboard.manage.FundStatisticsManage; import com.ningdatech.pmapi.dashboard.manage.FundStatisticsManage;
import com.ningdatech.pmapi.dashboard.manage.MeetingStatisticsManage; import com.ningdatech.pmapi.dashboard.manage.MeetingStatisticsManage;
import com.ningdatech.pmapi.dashboard.manage.ProjectCostStatisticsManage;
import com.ningdatech.pmapi.dashboard.model.vo.*; import com.ningdatech.pmapi.dashboard.model.vo.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@@ -27,6 +28,8 @@ public class StatisticsController {


private final MeetingStatisticsManage meetingStatisticsManage; private final MeetingStatisticsManage meetingStatisticsManage;


private final ProjectCostStatisticsManage costStatisticsManage;

@GetMapping("/fund") @GetMapping("/fund")
@ApiOperation("项目资金统计") @ApiOperation("项目资金统计")
public FundStatisticsVO fund(@RequestParam(required = false) Integer year) { public FundStatisticsVO fund(@RequestParam(required = false) Integer year) {
@@ -44,4 +47,10 @@ public class StatisticsController {
public MeetingStatisticsVO meeting(@RequestParam(required = false) Integer year) { public MeetingStatisticsVO meeting(@RequestParam(required = false) Integer year) {
return meetingStatisticsManage.statistics(year); return meetingStatisticsManage.statistics(year);
} }

@GetMapping("/project-cost")
@ApiOperation("项目成本统计")
public CostStatisticsVO projectCost() {
return costStatisticsManage.statistics();
}
} }

+ 109
- 0
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/ProjectCostStatisticsManage.java View File

@@ -0,0 +1,109 @@
package com.ningdatech.pmapi.dashboard.manage;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.ningdatech.pmapi.common.model.entity.DataDTO;
import com.ningdatech.pmapi.dashboard.constant.DashboardConstant;
import com.ningdatech.pmapi.dashboard.model.vo.CostStatisticsVO;
import com.ningdatech.pmapi.expert.service.IExpertReviewService;
import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService;
import com.ningdatech.pmapi.meeting.service.IMeetingService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @Classname ProjectCostStatisticsManage
* @Description
* @Date 2023/12/05 17:44
* @Author PoffyZhang
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class ProjectCostStatisticsManage {

private final IExpertReviewService expertReviewService;

private final IMeetingExpertService meetingExpertService;

private final IMeetingService meetingService;

List<Integer> thisTwoYears = Lists.newArrayList(LocalDateTime.now().getYear() - 1
,LocalDateTime.now().getYear());

public CostStatisticsVO statistics() {
CostStatisticsVO res = new CostStatisticsVO();
List<Meeting> meetings = meetingService.list(Wrappers.lambdaQuery(Meeting.class));
List<Long> meetingIds = meetings.stream().map(Meeting::getId)
.collect(Collectors.toList());
//算出所有的 同意的专家
List<MeetingExpert> meetingExperts = meetingExpertService.listAgreedExperts(meetingIds);

//评审费 每人500 (0.05万)
BigDecimal reviewAoumtExpert = DashboardConstant.Expert.REVIEW_AOUMT_EXPERT;

//计算累积
res.setReviewAmount(reviewAoumtExpert.multiply(BigDecimal.valueOf(meetingExperts.size())));
res.setPricingAmount(BigDecimal.ZERO);

//近两年
List<DataDTO> twoYearsReviews = Lists.newArrayList();
List<DataDTO> twoYearsPricing = Lists.newArrayList();
List<DataDTO> twoYearsAvg = Lists.newArrayList();

DataDTO reviewAvg = new DataDTO();
reviewAvg.setName("评审费");
DataDTO pricingAvg = new DataDTO();
pricingAvg.setName("核价费");
BigDecimal reviewTwoYearTotal = BigDecimal.ZERO;
BigDecimal pricingTwoYearTotal = BigDecimal.ZERO;
for(Integer thisYear : thisTwoYears){
DataDTO reviewData = new DataDTO();
DataDTO pricingData = new DataDTO();
//查出 年份的 会议数据
List<Meeting> yearMeetings = meetings.stream().filter(m -> {
if(Objects.nonNull(m.getStartTime()) &&
( thisYear.equals(m.getStartTime().getYear()))){
return Boolean.TRUE;
}
return Boolean.FALSE;
}).collect(Collectors.toList());
List<Long> yearMeetingIds = yearMeetings.stream().map(Meeting::getId)
.collect(Collectors.toList());
//算出所有的 同意的专家
List<MeetingExpert> yearMeetingExperts = Lists.newArrayList();
if(CollUtil.isNotEmpty(yearMeetingIds)){
yearMeetingExperts = meetingExpertService.listAgreedExperts(yearMeetingIds);
}

reviewData.setName(thisYear.toString());
reviewData.setAmount(reviewAoumtExpert.multiply(BigDecimal
.valueOf(yearMeetingExperts.size())));
pricingData.setName(thisYear.toString());
twoYearsReviews.add(reviewData);
twoYearsPricing.add(pricingData);

reviewTwoYearTotal = reviewTwoYearTotal.add(reviewAoumtExpert.multiply(BigDecimal
.valueOf(yearMeetingExperts.size())));
}
reviewAvg.setAmount(reviewTwoYearTotal.divide(BigDecimal.valueOf(2),BigDecimal.ROUND_CEILING,
RoundingMode.HALF_UP));
twoYearsAvg.add(reviewAvg);
twoYearsAvg.add(pricingAvg);
res.setTwoYearsReviews(twoYearsReviews);
res.setTwoYearsPricing(twoYearsPricing);
res.setTwoYearsAvg(twoYearsAvg);
return res;
}
}

+ 31
- 0
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CostStatisticsVO.java View File

@@ -0,0 +1,31 @@
package com.ningdatech.pmapi.dashboard.model.vo;

import com.ningdatech.pmapi.common.model.entity.DataDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

@Data
@ApiModel(value = "项目成本统计", description = "")
public class CostStatisticsVO implements Serializable {
private static final long serialVersionUID = 1L;

@ApiModelProperty("累积专家评审费用")
private BigDecimal reviewAmount = BigDecimal.ZERO;

@ApiModelProperty("累积专家核价费用")
private BigDecimal pricingAmount = BigDecimal.ZERO;

@ApiModelProperty("市本级近两年人工核价费")
private List<DataDTO> twoYearsPricing;

@ApiModelProperty("市本级近两年人工评审费")
private List<DataDTO> twoYearsReviews;

@ApiModelProperty("市本级近两年平均专家评审/核价费")
private List<DataDTO> twoYearsAvg;
}

Loading…
Cancel
Save