产值
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
package org.dromara.out.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.cailiaoshebei.service.IBusMaterialsorderService;
|
||||
import org.dromara.common.core.enums.BusinessStatusEnum;
|
||||
@ -12,18 +11,13 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.utils.BigDecimalUtil;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.out.domain.OutConstructionValue;
|
||||
import org.dromara.out.domain.OutMonthPlan;
|
||||
import org.dromara.out.domain.OutMonthPlanAudit;
|
||||
import org.dromara.out.domain.bo.OutMonthPlanBo;
|
||||
import org.dromara.out.domain.*;
|
||||
import org.dromara.out.domain.bo.OutTableBo;
|
||||
import org.dromara.out.domain.bo.PurchaseValueAReq;
|
||||
import org.dromara.out.domain.vo.*;
|
||||
import org.dromara.out.service.*;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.domain.PgsProgressPlanDetail;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
import org.dromara.progress.service.IPgsProgressPlanDetailService;
|
||||
import org.dromara.project.domain.BusProject;
|
||||
import org.dromara.project.domain.dto.project.BusProjectQueryReq;
|
||||
import org.dromara.project.domain.vo.project.BusProjectVo;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
@ -31,7 +25,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@ -39,7 +32,6 @@ import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 报表
|
||||
@ -71,6 +63,11 @@ public class OutTableController extends BaseController {
|
||||
|
||||
private final IBusMaterialsorderService busMaterialsorderService;
|
||||
|
||||
private final IOutValueAllocationService valueAllocationService;
|
||||
|
||||
private final IOutMonthPlanService outMonthPlanService;
|
||||
|
||||
|
||||
BigDecimal parseUnit = new BigDecimal("10000");
|
||||
|
||||
/**
|
||||
@ -78,7 +75,9 @@ public class OutTableController extends BaseController {
|
||||
*/
|
||||
// @SaCheckPermission("out:table:list")
|
||||
@GetMapping("/monthlyConstruct")
|
||||
public TableDataInfo<OutMonthlyConstructionVo> list(@NotNull String month, PageQuery pageQuery) {
|
||||
public TableDataInfo<OutMonthlyConstructionVo> list(OutTableBo bo, PageQuery pageQuery) {
|
||||
String month = bo.getMonth();
|
||||
String type = bo.getType();
|
||||
|
||||
//分页查询所有父项目
|
||||
BusProjectQueryReq busProjectQueryReq = new BusProjectQueryReq();
|
||||
@ -88,13 +87,10 @@ public class OutTableController extends BaseController {
|
||||
List<Long> projectIds = rows.stream().map(BusProjectVo::getId).toList();
|
||||
|
||||
//查询每个进度(分项工程)的单价和总量
|
||||
List<PgsProgressCategory> pgsProgressCategories = progressCategoryService.queryListByProjectIds(projectIds);
|
||||
//转为map
|
||||
// Map<Long, PgsProgressCategory> pgsProgressCategoryMap = pgsProgressCategories.stream()
|
||||
// .collect(Collectors.toMap(PgsProgressCategory::getId, category -> category));
|
||||
// List<PgsProgressCategory> pgsProgressCategories = progressCategoryService.queryListByProjectIds(projectIds);
|
||||
|
||||
//查询项目的施工计划产值
|
||||
List<OutMonthPlanAudit> outMonthPlanAudits = outMonthPlanAuditService.queryListByProjectIds(projectIds);
|
||||
List<OutMonthPlanAudit> outMonthPlanAudits = outMonthPlanAuditService.queryListByProjectIds(projectIds, type);
|
||||
|
||||
|
||||
//计算日期
|
||||
@ -119,21 +115,12 @@ public class OutTableController extends BaseController {
|
||||
OutMonthlyConstructionVo vo = new OutMonthlyConstructionVo();
|
||||
vo.setProjectName(busProjectVo.getProjectName());
|
||||
|
||||
//1.总产值的计算 2.预计累计产值(截止当前月) 3.月预计产值
|
||||
// List<BusProject> subProjects = projectService.lambdaQuery().eq(BusProject::getPId, busProjectVo.getId()).list();
|
||||
// List<Long> subProjectIds = subProjects.stream().map(BusProject::getId).toList();
|
||||
|
||||
//所有分项工程
|
||||
// List<PgsProgressCategory> collect = pgsProgressCategories.stream()
|
||||
// .filter(category -> subProjectIds.contains(category.getProjectId())).toList();
|
||||
|
||||
BigDecimal totalValue = BigDecimal.ZERO;
|
||||
BigDecimal estimatedTotalValue = BigDecimal.ZERO;
|
||||
BigDecimal monthlyEstimatedValue = BigDecimal.ZERO;
|
||||
List<OutMonthPlanAudit> planAudits = outMonthPlanAudits.stream().filter(plan -> plan.getProjectId().equals(busProjectVo.getId())).toList();
|
||||
|
||||
for (OutMonthPlanAudit planAudit : planAudits) {
|
||||
totalValue = totalValue.add(planAudit.getConstructionValue());
|
||||
// totalValue = totalValue.add(planAudit.getConstructionValue());
|
||||
YearMonth planMonth = YearMonth.parse(planAudit.getPlanMonth(), formatter);
|
||||
if(!planMonth.isAfter(yearMonth)){
|
||||
estimatedTotalValue=estimatedTotalValue.add(planAudit.getConstructionValue());
|
||||
@ -142,20 +129,9 @@ public class OutTableController extends BaseController {
|
||||
monthlyEstimatedValue = planAudit.getConstructionValue();
|
||||
}
|
||||
}
|
||||
// for (PgsProgressCategory category : collect) {
|
||||
// //计算价格
|
||||
// if ("1".equals(category.getUnitType())) {
|
||||
// // 数量类型: total * unitPrice
|
||||
// BigDecimal total = category.getTotal() != null ? category.getTotal() : BigDecimal.ZERO;
|
||||
// BigDecimal unitPrice = category.getUnitPrice() != null ? category.getUnitPrice() : BigDecimal.ZERO;
|
||||
// totalValue = totalValue.add(total.multiply(unitPrice));
|
||||
//
|
||||
// } else if ("2".equals(category.getUnitType())) {
|
||||
// // 百分比类型: 直接使用 unitPrice
|
||||
// totalValue = totalValue.add(category.getUnitPrice() != null ? category.getUnitPrice() : BigDecimal.ZERO);
|
||||
// }
|
||||
// }
|
||||
//转化单位为万元
|
||||
|
||||
//转化单位为万元 查询总值
|
||||
BigDecimal totalValue = getTotal(type,busProjectVo.getId());
|
||||
vo.setTotalValue(totalValue.divide(parseUnit));
|
||||
vo.setEstimatedAccumulatedValue(estimatedTotalValue.divide(parseUnit));
|
||||
vo.setMonthlyEstimatedValue(monthlyEstimatedValue.divide(parseUnit));
|
||||
@ -240,7 +216,7 @@ public class OutTableController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* 分包完工产值与结算产值对比表
|
||||
* 完工产值与结算产值对比表
|
||||
*/
|
||||
// @SaCheckPermission("out:table:list")
|
||||
@GetMapping("/comparisonOfCompletionAndSettlement")
|
||||
@ -267,28 +243,34 @@ public class OutTableController extends BaseController {
|
||||
// BigDecimal bigDecimal = busMaterialsorderService.grossOutput(projectVoId, null);
|
||||
if("1".equals(bo.getValueType())){
|
||||
//设计完工产值
|
||||
BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVoId,null);
|
||||
BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVoId,null,bo.getType());
|
||||
vo.setTotalCompletionOutputValue( designValue);
|
||||
} else if ("2".equals(bo.getValueType())) {
|
||||
//施工完工产值
|
||||
BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,null);
|
||||
BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,null,bo.getType());
|
||||
vo.setTotalCompletionOutputValue(constructionValue);
|
||||
}else if ("3".equals(bo.getValueType())) {
|
||||
//采购完工产值
|
||||
BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,null,0);
|
||||
PurchaseValueAReq purchaseValueAReq = new PurchaseValueAReq();
|
||||
purchaseValueAReq.setProjectId(projectVoId);
|
||||
purchaseValueAReq.setType(bo.getType());
|
||||
List<BusProcurement> busProcurements = outMonthPlanService.purchaseValueA(purchaseValueAReq);
|
||||
BigDecimal purchaseValue = BigDecimal.ZERO;
|
||||
for (BusProcurement busProcurement : busProcurements) {
|
||||
purchaseValue = purchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()));
|
||||
}
|
||||
vo.setTotalCompletionOutputValue(purchaseValue);
|
||||
}else{
|
||||
//设计完工产值
|
||||
BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVoId,null);
|
||||
//施工完工产值
|
||||
BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,null);
|
||||
//采购完工产值
|
||||
BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,null,0);
|
||||
vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue));
|
||||
}
|
||||
|
||||
//结算产值
|
||||
BigDecimal settlementValue = settlementValueSubcontractService.getValueByProjectId(projectVoId,bo.getValueType(),null);
|
||||
BigDecimal settlementValue;
|
||||
if("1".equals(bo.getType())){
|
||||
//业主结算产值
|
||||
settlementValue = settlementValueOwnerService.getValueByProjectId(projectVoId,bo.getValueType(),null);
|
||||
}else {
|
||||
settlementValue = settlementValueSubcontractService.getValueByProjectId(projectVoId,bo.getValueType(),null);
|
||||
}
|
||||
|
||||
vo.setTotalSettlementOutputValue(settlementValue);
|
||||
vo.setCompletionUnsettledAmount(vo.getTotalSettlementOutputValue().subtract(vo.getTotalCompletionOutputValue()));
|
||||
vo.setCompletionUnsettledRatio(BigDecimalUtil.toPercentage(vo.getCompletionUnsettledAmount(), vo.getTotalCompletionOutputValue()));
|
||||
@ -333,11 +315,19 @@ public class OutTableController extends BaseController {
|
||||
vo.setProjectId(projectVoId);
|
||||
|
||||
//设计完工产值
|
||||
BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVoId,bo.getMonth());
|
||||
BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVoId,bo.getMonth(),bo.getType());
|
||||
//施工完工产值
|
||||
BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,bo.getMonth());
|
||||
BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,bo.getMonth(),bo.getType());
|
||||
//采购完工产值
|
||||
BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,bo.getMonth(),0);
|
||||
PurchaseValueAReq purchaseValueAReq = new PurchaseValueAReq();
|
||||
purchaseValueAReq.setProjectId(projectVoId);
|
||||
purchaseValueAReq.setType(bo.getType());
|
||||
purchaseValueAReq.setPlanMonth(bo.getMonth());
|
||||
List<BusProcurement> busProcurements = outMonthPlanService.purchaseValueA(purchaseValueAReq);
|
||||
BigDecimal purchaseValue = BigDecimal.ZERO;
|
||||
for (BusProcurement busProcurement : busProcurements) {
|
||||
purchaseValue = purchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()));
|
||||
}
|
||||
vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue));
|
||||
|
||||
//分包结算产值
|
||||
@ -345,7 +335,7 @@ public class OutTableController extends BaseController {
|
||||
vo.setSubTotalSettlementOutputValue(settlementValue);
|
||||
|
||||
//业主结算产值
|
||||
BigDecimal ownerSettlementValue = settlementValueOwnerService.getValueByProjectId(projectVoId,bo.getMonth());
|
||||
BigDecimal ownerSettlementValue = settlementValueOwnerService.getValueByProjectId(projectVoId,null,bo.getMonth());
|
||||
vo.setOwnerTotalSettlementOutputValue(ownerSettlementValue);
|
||||
|
||||
|
||||
@ -390,7 +380,9 @@ public class OutTableController extends BaseController {
|
||||
|
||||
List<OutMonthPlan> list = monthPlanService.lambdaQuery()
|
||||
.eq(OutMonthPlan::getProjectId, projectVo.getId())
|
||||
.eq(OutMonthPlan::getType, bo.getType())
|
||||
.eq(OutMonthPlan::getValueType, bo.getValueType())
|
||||
.eq(OutMonthPlan::getCompleteAuditStatus, BusinessStatusEnum.FINISH.getStatus())
|
||||
.list();
|
||||
|
||||
// 计算累计完成值
|
||||
@ -400,21 +392,29 @@ public class OutTableController extends BaseController {
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
vo.setTotalValue(totalValue);
|
||||
|
||||
OutMonthPlan matchedPlan = list.stream()
|
||||
OutMonthPlan complete = list.stream()
|
||||
.filter(plan -> Objects.equals(plan.getPlanMonth(), bo.getMonth()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
|
||||
OutMonthPlan plan = monthPlanService.getOne(
|
||||
Wrappers.lambdaQuery(OutMonthPlan.class)
|
||||
.eq(OutMonthPlan::getProjectId, projectVo.getId())
|
||||
.eq(OutMonthPlan::getPlanMonth, bo.getMonth())
|
||||
.eq(OutMonthPlan::getValueType, bo.getValueType())
|
||||
.eq(OutMonthPlan::getPlanAuditStatus, BusinessStatusEnum.FINISH.getStatus())
|
||||
);
|
||||
// List<OutMonthPlan> matchedPlans = list.stream()
|
||||
// .filter(plan -> plan.getPlanMonth() != null
|
||||
// && bo.getMonth() != null
|
||||
// && plan.getPlanMonth().compareTo(bo.getMonth()) <= 0)
|
||||
// .toList();
|
||||
|
||||
vo.setMonthEstimatedValue(matchedPlan == null? BigDecimal.ZERO :matchedPlan.getPlanValue());
|
||||
vo.setMonthEstimatedValue(plan == null? BigDecimal.ZERO :plan.getPlanValue());
|
||||
|
||||
if("1".equals(bo.getValueType())){
|
||||
vo.setMonthCompletionValue(matchedPlan == null? BigDecimal.ZERO :matchedPlan.getCompleteValue());
|
||||
vo.setMonthCompletionValue(complete == null? BigDecimal.ZERO :complete.getCompleteValue());
|
||||
|
||||
// 计算累计完成值
|
||||
BigDecimal accumulatedCompleteValue = list.stream()
|
||||
@ -424,10 +424,28 @@ public class OutTableController extends BaseController {
|
||||
vo.setAccumulatedCompletionValue(accumulatedCompleteValue);
|
||||
|
||||
}else if("2".equals(bo.getValueType())){
|
||||
//采购完工产值
|
||||
PurchaseValueAReq purchaseValueAReq = new PurchaseValueAReq();
|
||||
purchaseValueAReq.setProjectId(projectVo.getId());
|
||||
purchaseValueAReq.setType(bo.getType());
|
||||
List<BusProcurement> busProcurements = outMonthPlanService.purchaseValueA(purchaseValueAReq);
|
||||
BigDecimal accumulatedCompletionValue = BigDecimal.ZERO;
|
||||
for (BusProcurement busProcurement : busProcurements) {
|
||||
accumulatedCompletionValue = accumulatedCompletionValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()));
|
||||
}
|
||||
vo.setAccumulatedCompletionValue(accumulatedCompletionValue);
|
||||
|
||||
vo.setMonthCompletionValue(busMaterialsorderService.grossOutput(projectVo.getId(),bo.getMonth(),1));
|
||||
|
||||
vo.setAccumulatedCompletionValue(BigDecimal.ZERO);
|
||||
|
||||
|
||||
purchaseValueAReq.setPlanMonth(bo.getMonth());
|
||||
List<BusProcurement> busProcurements1 = outMonthPlanService.purchaseValueA(purchaseValueAReq);
|
||||
|
||||
BigDecimal monthCompletionValue = BigDecimal.ZERO;
|
||||
for (BusProcurement busProcurement : busProcurements1) {
|
||||
monthCompletionValue = monthCompletionValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()));
|
||||
}
|
||||
vo.setMonthCompletionValue(monthCompletionValue);
|
||||
|
||||
}
|
||||
vo.setValueDifference(vo.getMonthCompletionValue().subtract(vo.getMonthEstimatedValue()));
|
||||
@ -453,5 +471,101 @@ public class OutTableController extends BaseController {
|
||||
return rspData;
|
||||
}
|
||||
|
||||
public BigDecimal getTotal(String type,Long projectId){
|
||||
OutValueAllocation one = valueAllocationService.getOne(Wrappers.lambdaQuery(OutValueAllocation.class)
|
||||
.eq(OutValueAllocation::getProjectId,projectId));
|
||||
if("1".equals(type)){
|
||||
return one == null ? BigDecimal.ZERO : one.getOwnerTotalValue();
|
||||
}
|
||||
return one == null ? BigDecimal.ZERO : one.getSubTotalValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 甲乙产值对比
|
||||
*/
|
||||
// @SaCheckPermission("out:table:list")
|
||||
@GetMapping("/outCompare")
|
||||
public TableDataInfo<OutCompareVo> outCompare(OutTableBo bo, PageQuery pageQuery){
|
||||
|
||||
//分页查询所有父项目
|
||||
BusProjectQueryReq busProjectQueryReq = new BusProjectQueryReq();
|
||||
busProjectQueryReq.setPId(0L);
|
||||
TableDataInfo<BusProjectVo> busProjectVoTableDataInfo = projectService.queryPageList(busProjectQueryReq, pageQuery);
|
||||
List<BusProjectVo> rows = busProjectVoTableDataInfo.getRows();
|
||||
List<OutCompareVo> vos = new ArrayList<>();
|
||||
|
||||
for (BusProjectVo projectVo : rows) {
|
||||
OutCompareVo vo = new OutCompareVo();
|
||||
vo.setProjectName(projectVo.getProjectName());
|
||||
vo.setProjectId(projectVo.getId());
|
||||
|
||||
|
||||
BigDecimal ownerTotal = getTotal("1", projectVo.getId());
|
||||
vo.setOwnerTotal(ownerTotal.divide(parseUnit));
|
||||
BigDecimal subTotal = getTotal("2", projectVo.getId());
|
||||
vo.setSubTotal(subTotal.divide(parseUnit));
|
||||
|
||||
//查询项目的施工计划产值
|
||||
List<OutMonthPlanAudit> ownerPlan = outMonthPlanAuditService.queryListByProjectIdAndMonth(projectVo.getId(), bo.getMonth(), "1");
|
||||
|
||||
BigDecimal ownerPlanTotal = BigDecimal.ZERO;
|
||||
if(ownerPlan != null && !ownerPlan.isEmpty()){
|
||||
ownerPlanTotal = ownerPlan.stream().map(OutMonthPlanAudit::getTotalValue).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
vo.setOwnerPlanTotal(ownerPlanTotal.divide(parseUnit));
|
||||
|
||||
|
||||
List<OutMonthPlanAudit> subPlan = outMonthPlanAuditService.queryListByProjectIdAndMonth(projectVo.getId(), bo.getMonth(), "2");
|
||||
|
||||
BigDecimal subPlanTotal = BigDecimal.ZERO;
|
||||
if(subPlan != null && !subPlan.isEmpty()){
|
||||
subPlanTotal = subPlan.stream().map(OutMonthPlanAudit::getTotalValue).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
vo.setSubPlanTotal(subPlanTotal.divide(parseUnit));
|
||||
|
||||
//设计完工产值
|
||||
BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVo.getId(),bo.getMonth(),"1");
|
||||
//施工完工产值
|
||||
BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVo.getId(),bo.getMonth(),"1");
|
||||
//采购完工产值
|
||||
PurchaseValueAReq purchaseValueAReq = new PurchaseValueAReq();
|
||||
purchaseValueAReq.setProjectId(projectVo.getId());
|
||||
purchaseValueAReq.setType("1");
|
||||
purchaseValueAReq.setPlanMonth(bo.getMonth());
|
||||
List<BusProcurement> busProcurements = outMonthPlanService.purchaseValueA(purchaseValueAReq);
|
||||
BigDecimal purchaseValue = BigDecimal.ZERO;
|
||||
for (BusProcurement busProcurement : busProcurements) {
|
||||
purchaseValue = purchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()));
|
||||
}
|
||||
vo.setOwnerActualTotal( designValue.add(constructionValue).add(purchaseValue).divide(parseUnit));
|
||||
|
||||
|
||||
|
||||
//设计完工产值
|
||||
BigDecimal subDesignValue = monthPlanService.getDesignValueByProjectId(projectVo.getId(),bo.getMonth(),"2");
|
||||
//施工完工产值
|
||||
BigDecimal subConstructionValue = constructionValueService.getCompleteValue(projectVo.getId(),bo.getMonth(),"2");
|
||||
//采购完工产值
|
||||
purchaseValueAReq.setType("2");
|
||||
List<BusProcurement> busProcurements1 = outMonthPlanService.purchaseValueA(purchaseValueAReq);
|
||||
BigDecimal subPurchaseValue = BigDecimal.ZERO;
|
||||
for (BusProcurement busProcurement : busProcurements1) {
|
||||
subPurchaseValue = subPurchaseValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()));
|
||||
}
|
||||
vo.setSubActualTotal( subDesignValue.add(subConstructionValue).add(subPurchaseValue).divide(parseUnit));
|
||||
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
|
||||
TableDataInfo<OutCompareVo> rspData = new TableDataInfo<>();
|
||||
rspData.setCode(HttpStatus.HTTP_OK);
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setRows(vos);
|
||||
rspData.setTotal(busProjectVoTableDataInfo.getTotal());
|
||||
|
||||
return rspData;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class OutConstructionValue extends BaseEntity {
|
||||
private Integer planNum;
|
||||
|
||||
/**
|
||||
* 产值
|
||||
* 対乙产值
|
||||
*/
|
||||
private BigDecimal outValue;
|
||||
|
||||
@ -87,5 +87,8 @@ public class OutConstructionValue extends BaseEntity {
|
||||
*/
|
||||
private String auditStatus;
|
||||
|
||||
|
||||
/**
|
||||
* 对甲产值
|
||||
*/
|
||||
private BigDecimal ownerValue;
|
||||
}
|
||||
|
@ -17,4 +17,9 @@ public class OutTableBo {
|
||||
* 月份
|
||||
*/
|
||||
private String month;
|
||||
|
||||
/**
|
||||
* 类型 1对甲 2对乙
|
||||
*/
|
||||
private String type;
|
||||
}
|
||||
|
@ -24,6 +24,9 @@ public class PurchaseValueAReq implements Serializable {
|
||||
* 类型 1:采购完工产值对甲 2:采购完工产值对乙
|
||||
*/
|
||||
@NotNull
|
||||
private Integer type;
|
||||
private String type;
|
||||
|
||||
|
||||
private String planMonth;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
package org.dromara.out.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class OutCompareVo {
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@ExcelProperty(value = "项目名称")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 对甲计划总产值
|
||||
*/
|
||||
private BigDecimal ownerTotal;
|
||||
/**
|
||||
* 对乙计划总产值
|
||||
*/
|
||||
private BigDecimal subTotal;
|
||||
/**
|
||||
* 对甲月计划产值
|
||||
*/
|
||||
private BigDecimal ownerPlanTotal;
|
||||
/**
|
||||
* 对乙月计划产值
|
||||
*/
|
||||
private BigDecimal subPlanTotal;
|
||||
/**
|
||||
* 对甲月实际产值
|
||||
*/
|
||||
private BigDecimal ownerActualTotal;
|
||||
/**
|
||||
* 对乙月实际产值
|
||||
*/
|
||||
private BigDecimal subActualTotal;
|
||||
}
|
@ -25,6 +25,16 @@ public interface OutConstructionValueMapper extends BaseMapperPlus<OutConstructi
|
||||
"</if>",
|
||||
"</script>"
|
||||
})
|
||||
BigDecimal getCompleteValue( @Param("projectId") Long projectId,@Param("month")String month);
|
||||
BigDecimal getCompleteOutValue( @Param("projectId") Long projectId,@Param("month")String month);
|
||||
|
||||
@Select({
|
||||
"<script>",
|
||||
"select sum(owner_value) from out_construction_value where project_id = #{projectId} and audit_status = 'finish'",
|
||||
"<if test='month != null and month != \"\"'>",
|
||||
"and DATE_FORMAT(report_date, '%Y-%m') = #{month}",
|
||||
"</if>",
|
||||
"</script>"
|
||||
})
|
||||
BigDecimal getCompleteOwnerValue( @Param("projectId") Long projectId,@Param("month")String month);
|
||||
|
||||
}
|
||||
|
@ -20,15 +20,15 @@ public interface OutMonthPlanMapper extends BaseMapperPlus<OutMonthPlan, OutMont
|
||||
|
||||
@Select({
|
||||
"<script>",
|
||||
"select sum(complete_value) from out_month_plan where value_type = 1 and complete_audit_status = 'finish' and project_id = #{projectId}",
|
||||
"select sum(complete_value) from out_month_plan where value_type = 1 and complete_audit_status = 'finish' and type = #{type} and project_id = #{projectId}",
|
||||
"<if test='planMonth != null and planMonth != \"\"'>",
|
||||
"and plan_month = #{planMonth}",
|
||||
"</if>",
|
||||
"</script>"
|
||||
})
|
||||
BigDecimal getDesignValueByProjectId(@Param("projectId") Long projectId,@Param("planMonth") String planMonth);
|
||||
BigDecimal getDesignValueByProjectId(@Param("projectId") Long projectId,@Param("planMonth") String planMonth,@Param("type") String type);
|
||||
|
||||
List<BusProcurement> purchaseValueAA(@Param("projectId") Long projectId);
|
||||
List<BusProcurement> purchaseValueAA(@Param("projectId") Long projectId,@Param("planMonth")String planMonth);
|
||||
|
||||
List<BusProcurement> purchaseValueBB(@Param("projectId") Long projectId);
|
||||
List<BusProcurement> purchaseValueBB(@Param("projectId") Long projectId,@Param("planMonth")String planMonth);
|
||||
}
|
||||
|
@ -20,10 +20,13 @@ public interface OutSettlementValueOwnerMapper extends BaseMapperPlus<OutSettlem
|
||||
@Select({
|
||||
"<script>",
|
||||
"select sum(settlement_value) from out_settlement_value_owner where project_id = #{projectId}",
|
||||
"<if test='valueType != null and valueType != \"\"'>",
|
||||
"and value_type = #{valueType}",
|
||||
"</if>",
|
||||
"<if test='month != null and month != \"\"'>",
|
||||
"and DATE_FORMAT(settlement_date, '%Y-%m') = #{month}",
|
||||
"</if>",
|
||||
"</script>"
|
||||
})
|
||||
BigDecimal getValueByProjectId(@Param("projectId") Long projectId, @Param("month") String month);
|
||||
BigDecimal getValueByProjectId(@Param("projectId") Long projectId,@Param("valueType")String valueType, @Param("month") String month);
|
||||
}
|
||||
|
@ -77,5 +77,5 @@ public interface IOutConstructionValueService extends IService<OutConstructionVa
|
||||
* @param projectId 项目id
|
||||
* @return 项目施工完成值
|
||||
*/
|
||||
BigDecimal getCompleteValue(Long projectId,String month);
|
||||
BigDecimal getCompleteValue(Long projectId,String month,String type);
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -74,5 +73,10 @@ public interface IOutMonthPlanAuditService extends IService<OutMonthPlanAudit>{
|
||||
/**
|
||||
* 根据父项目id获取列表
|
||||
*/
|
||||
List<OutMonthPlanAudit> queryListByProjectIds(List<Long> projectIds);
|
||||
List<OutMonthPlanAudit> queryListByProjectIds(List<Long> projectIds,String type);
|
||||
|
||||
/**
|
||||
* 根据父项目id和月份获取列表
|
||||
*/
|
||||
List<OutMonthPlanAudit> queryListByProjectIdAndMonth(Long projectId,String month,String type);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public interface IOutMonthPlanService extends IService<OutMonthPlan>{
|
||||
/**
|
||||
* 根据项目id查询项目已完工的设计产值
|
||||
*/
|
||||
BigDecimal getDesignValueByProjectId(Long projectId,String month);
|
||||
BigDecimal getDesignValueByProjectId(Long projectId,String month,String type);
|
||||
|
||||
/**
|
||||
* 根据计划月份查询计划
|
||||
|
@ -70,9 +70,8 @@ public interface IOutSettlementValueOwnerService extends IService<OutSettlementV
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
|
||||
/**
|
||||
* 根据项目id获取项目结算产值
|
||||
*/
|
||||
BigDecimal getValueByProjectId(Long projectId,String month);
|
||||
BigDecimal getValueByProjectId(Long projectId,String valueType,String month);
|
||||
}
|
||||
|
@ -127,11 +127,11 @@ public class OutConstructionValueServiceImpl extends ServiceImpl<OutConstruction
|
||||
PgsProgressCategory progressCategory = pgsProgressCategoryService.getById(bo.getProgressCategoryId());
|
||||
if (progressCategory != null) {
|
||||
if ("1".equals(progressCategory.getUnitType())) {
|
||||
// todo add.setOutValue(progressCategory.getUnitPrice().multiply(BigDecimal.valueOf(bo.getArtificialNum())));
|
||||
add.setOutValue(progressCategory.getOwnerPrice().multiply(BigDecimal.valueOf(bo.getArtificialNum())));
|
||||
add.setOutValue(progressCategory.getConstructionPrice().multiply(BigDecimal.valueOf(bo.getArtificialNum())));
|
||||
add.setOwnerValue(progressCategory.getOwnerPrice().multiply(BigDecimal.valueOf(bo.getArtificialNum())));
|
||||
} else if ("2".equals(progressCategory.getUnitType())) {
|
||||
// todo add.setOutValue(progressCategory.getUnitPrice().multiply(BigDecimal.valueOf(bo.getUavNum()).divide(new BigDecimal("100"))));
|
||||
add.setOutValue(progressCategory.getOwnerPrice().multiply(BigDecimal.valueOf(bo.getUavNum()).divide(new BigDecimal("100"))));
|
||||
add.setOwnerValue(progressCategory.getOwnerPrice().multiply(BigDecimal.valueOf(bo.getUavNum()).divide(new BigDecimal("100"))));
|
||||
add.setOutValue(progressCategory.getConstructionPrice().multiply(BigDecimal.valueOf(bo.getUavNum()).divide(new BigDecimal("100"))));
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,8 +178,14 @@ public class OutConstructionValueServiceImpl extends ServiceImpl<OutConstruction
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getCompleteValue(Long projectId, String month) {
|
||||
BigDecimal completeValue = baseMapper.getCompleteValue(projectId, month);
|
||||
public BigDecimal getCompleteValue(Long projectId, String month,String type) {
|
||||
BigDecimal completeValue;
|
||||
if(type.equals("1")){
|
||||
completeValue = baseMapper.getCompleteOwnerValue(projectId, month);
|
||||
}else{
|
||||
completeValue = baseMapper.getCompleteOutValue(projectId, month);
|
||||
}
|
||||
|
||||
if (completeValue == null) {
|
||||
completeValue = BigDecimal.ZERO;
|
||||
}
|
||||
|
@ -135,11 +135,23 @@ public class OutMonthPlanAuditServiceImpl extends ServiceImpl<OutMonthPlanAuditM
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OutMonthPlanAudit> queryListByProjectIds(List<Long> projectIds) {
|
||||
public List<OutMonthPlanAudit> queryListByProjectIds(List<Long> projectIds, String type) {
|
||||
if(projectIds.isEmpty()){
|
||||
return List.of();
|
||||
}
|
||||
return baseMapper.selectList(Wrappers.<OutMonthPlanAudit>lambdaUpdate()
|
||||
.in(OutMonthPlanAudit::getProjectId, projectIds));
|
||||
.in(OutMonthPlanAudit::getProjectId, projectIds)
|
||||
.eq(OutMonthPlanAudit::getType, type));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OutMonthPlanAudit> queryListByProjectIdAndMonth(Long projectId, String month, String type) {
|
||||
|
||||
return baseMapper.selectList(Wrappers.<OutMonthPlanAudit>lambdaUpdate()
|
||||
.eq(OutMonthPlanAudit::getProjectId, projectId)
|
||||
.eq(OutMonthPlanAudit::getType, type)
|
||||
.eq(OutMonthPlanAudit::getPlanMonth, month)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -223,8 +223,8 @@ public class OutMonthPlanServiceImpl extends ServiceImpl<OutMonthPlanMapper, Out
|
||||
|
||||
|
||||
@Override
|
||||
public BigDecimal getDesignValueByProjectId(Long projectId,String month) {
|
||||
BigDecimal designValueByProjectId = baseMapper.getDesignValueByProjectId(projectId, month);
|
||||
public BigDecimal getDesignValueByProjectId(Long projectId,String month,String type) {
|
||||
BigDecimal designValueByProjectId = baseMapper.getDesignValueByProjectId(projectId, month,type);
|
||||
if (designValueByProjectId == null) {
|
||||
designValueByProjectId = BigDecimal.ZERO;
|
||||
}
|
||||
@ -243,7 +243,7 @@ public class OutMonthPlanServiceImpl extends ServiceImpl<OutMonthPlanMapper, Out
|
||||
public List<BusProcurement> purchaseValueA(PurchaseValueAReq req) {
|
||||
//1、为1查询出数据,存储到数据表,并返回数据
|
||||
if ("1".equals(req.getType())){
|
||||
List<BusProcurement> busProcurements = baseMapper.purchaseValueAA(req.getProjectId());
|
||||
List<BusProcurement> busProcurements = baseMapper.purchaseValueAA(req.getProjectId(), req.getPlanMonth());
|
||||
//查询出现有的数据busProcurements1,如果busProcurements的数据已经在busProcurements1中(根据名称和规格)就修改,否则保存
|
||||
List<BusProcurement> busProcurements1 = busProcurementService.list(Wrappers.<BusProcurement>lambdaQuery()
|
||||
.eq(BusProcurement::getProjectId, req.getProjectId())
|
||||
@ -266,7 +266,7 @@ public class OutMonthPlanServiceImpl extends ServiceImpl<OutMonthPlanMapper, Out
|
||||
}
|
||||
//2、为2查询出数据,直接返回
|
||||
else if ("2".equals(req.getType())){
|
||||
return baseMapper.purchaseValueBB(req.getProjectId());
|
||||
return baseMapper.purchaseValueBB(req.getProjectId(), req.getPlanMonth());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -134,8 +134,8 @@ public class OutSettlementValueOwnerServiceImpl extends ServiceImpl<OutSettlemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getValueByProjectId(Long projectId,String month) {
|
||||
BigDecimal valueByProjectId = baseMapper.getValueByProjectId(projectId, month);
|
||||
public BigDecimal getValueByProjectId(Long projectId,String valueType,String month) {
|
||||
BigDecimal valueByProjectId = baseMapper.getValueByProjectId(projectId,valueType,month);
|
||||
if(valueByProjectId == null){
|
||||
valueByProjectId = BigDecimal.ZERO;
|
||||
}
|
||||
|
@ -18,6 +18,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
RIGHT JOIN mat_material_receive_item as b on b.`name` = a.`name` and b.specification = a.specification
|
||||
WHERE
|
||||
b.project_id = #{projectId}
|
||||
<if test="planMonth != null and planMonth!=''">
|
||||
and DATE_FORMAT(b.create_time,'%Y-%m') = #{planMonth}
|
||||
</if>
|
||||
GROUP BY yf,b.name,b.specification
|
||||
</select>
|
||||
|
||||
@ -33,6 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
mat_material_receive_item AS b
|
||||
WHERE
|
||||
b.project_id = #{projectId}
|
||||
<if test="planMonth != null and planMonth!='' ">
|
||||
and DATE_FORMAT(b.create_time,'%Y-%m') = #{planMonth}
|
||||
</if>
|
||||
GROUP BY yf,b.name,b.specification
|
||||
</select>
|
||||
|
||||
|
Reference in New Issue
Block a user