产值
This commit is contained in:
@ -20,7 +20,7 @@ public interface BusMaterialsorderMapper extends BaseMapperPlus<BusMaterialsorde
|
||||
List<GrossOutputRes> grossOutput(
|
||||
@Param("projectId") Long projectId,
|
||||
@Param("statusArr") String[] statusArr,
|
||||
@Param("startYue") String startYue,
|
||||
@Param("endYue") String endYue);
|
||||
@Param("month") String month,
|
||||
@Param("type") int type);
|
||||
|
||||
}
|
||||
|
@ -230,24 +230,14 @@ public class BusMaterialsorderServiceImpl extends ServiceImpl<BusMaterialsorderM
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal grossOutput(Long projectId, String startYue, String endYue) {
|
||||
public BigDecimal grossOutput(Long projectId, String month,int type) {
|
||||
//项目id不能为空
|
||||
if (projectId == null){
|
||||
throw new RuntimeException("项目ID不能为空");
|
||||
}
|
||||
//年月可以为空,但是如果有值格式那么就必须是yyyy-MM
|
||||
if (startYue != null){
|
||||
if (!startYue.matches("\\d{4}-\\d{2}")){
|
||||
throw new RuntimeException("年月格式错误");
|
||||
}
|
||||
}
|
||||
if (endYue != null){
|
||||
if (!endYue.matches("\\d{4}-\\d{2}")){
|
||||
throw new RuntimeException("年月格式错误");
|
||||
}
|
||||
}
|
||||
|
||||
final String[] arr = {"1","2","3"}; //到货的几个状态
|
||||
List<GrossOutputRes> list = baseMapper.grossOutput(projectId, arr, startYue,endYue);
|
||||
List<GrossOutputRes> list = baseMapper.grossOutput(projectId, arr, month,type);
|
||||
//计算出所有的订单数量
|
||||
BigDecimal resBigDecimal = new BigDecimal(0);
|
||||
for (GrossOutputRes grossOutputRes : list) {
|
||||
|
@ -71,6 +71,7 @@ public class OutTableController extends BaseController {
|
||||
|
||||
private final IBusMaterialsorderService busMaterialsorderService;
|
||||
|
||||
BigDecimal parseUnit = new BigDecimal("10000");
|
||||
|
||||
/**
|
||||
* 施工产值报表(计划 VS 实际)
|
||||
@ -109,7 +110,7 @@ public class OutTableController extends BaseController {
|
||||
|
||||
//构建返回数据
|
||||
List<OutMonthlyConstructionVo> outMonthlyConstructionVos = new ArrayList<>();
|
||||
BigDecimal parseUnit = new BigDecimal("10000");
|
||||
|
||||
|
||||
for (BusProjectVo busProjectVo : rows){
|
||||
OutMonthlyConstructionVo vo = new OutMonthlyConstructionVo();
|
||||
@ -126,35 +127,34 @@ public class OutTableController extends BaseController {
|
||||
BigDecimal totalValue = BigDecimal.ZERO;
|
||||
BigDecimal estimatedTotalValue = BigDecimal.ZERO;
|
||||
BigDecimal monthlyEstimatedValue = BigDecimal.ZERO;
|
||||
for (PgsProgressCategory category : collect) {
|
||||
|
||||
List<OutMonthPlanAudit> planAudits = outMonthPlanAudits.stream().filter(plan -> plan.getProjectId().equals(category.getProjectId())).toList();
|
||||
List<OutMonthPlanAudit> planAudits = outMonthPlanAudits.stream().filter(plan -> plan.getProjectId().equals(busProjectVo.getId())).toList();
|
||||
|
||||
for (OutMonthPlanAudit planAudit : planAudits) {
|
||||
totalValue = totalValue.add(planAudit.getConstructionValue());
|
||||
YearMonth planMonth = YearMonth.parse(planAudit.getPlanMonth(), formatter);
|
||||
// 比较大小
|
||||
if (planMonth.isBefore(yearMonth)) {
|
||||
estimatedTotalValue=estimatedTotalValue.add(planAudit.getConstructionValue());
|
||||
} else if (yearMonth.isAfter(planMonth)) {
|
||||
} else if (planMonth.isAfter(yearMonth)) {
|
||||
|
||||
} else {
|
||||
estimatedTotalValue = estimatedTotalValue.add(planAudit.getConstructionValue());
|
||||
monthlyEstimatedValue = planAudit.getConstructionValue();
|
||||
}
|
||||
}
|
||||
|
||||
//计算价格
|
||||
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);
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
//转化单位为万元
|
||||
vo.setTotalValue(totalValue.divide(parseUnit));
|
||||
vo.setEstimatedAccumulatedValue(estimatedTotalValue.divide(parseUnit));
|
||||
@ -213,6 +213,7 @@ public class OutTableController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
vo.setAccumulatedCompletionValue(accumulatedCompletionValue.divide(parseUnit));
|
||||
vo.setTotalCompletionValue(totalCompletionValue.divide(parseUnit));
|
||||
vo.setFirstWeekCompletionValue(firstWeekCompletionValue.divide(parseUnit));
|
||||
@ -225,8 +226,6 @@ public class OutTableController extends BaseController {
|
||||
vo.setValueDifferenceAccumulation(vo.getAccumulatedCompletionValue().subtract(vo.getEstimatedAccumulatedValue()));
|
||||
|
||||
vo.setTotalCompletionProgress(BigDecimalUtil.toPercentage(accumulatedCompletionValue, totalValue));
|
||||
|
||||
}
|
||||
outMonthlyConstructionVos.add(vo);
|
||||
}
|
||||
|
||||
@ -275,28 +274,30 @@ public class OutTableController extends BaseController {
|
||||
BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,null);
|
||||
vo.setTotalCompletionOutputValue(constructionValue);
|
||||
}else if ("3".equals(bo.getValueType())) {
|
||||
//采购完工产值 todo: 掉罗成的接口
|
||||
// BigDecimal purchaseValue = bigDecimal;
|
||||
// vo.setTotalCompletionOutputValue(purchaseValue);
|
||||
//采购完工产值
|
||||
BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,null,0);
|
||||
vo.setTotalCompletionOutputValue(purchaseValue);
|
||||
}else{
|
||||
//设计完工产值
|
||||
BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVoId,null);
|
||||
//施工完工产值
|
||||
BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,null);
|
||||
//采购完工产值 todo: 掉罗成的接口
|
||||
|
||||
// BigDecimal purchaseValue = bigDecimal;
|
||||
|
||||
// vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue));
|
||||
//采购完工产值
|
||||
BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,null,0);
|
||||
vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue));
|
||||
}
|
||||
|
||||
|
||||
//结算产值
|
||||
BigDecimal 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()));
|
||||
|
||||
//转换成万元
|
||||
vo.setTotalCompletionOutputValue(vo.getTotalCompletionOutputValue().divide(parseUnit));
|
||||
vo.setTotalSettlementOutputValue(vo.getTotalSettlementOutputValue().divide(parseUnit));
|
||||
vo.setCompletionUnsettledAmount(vo.getCompletionUnsettledAmount().divide(parseUnit));
|
||||
|
||||
outComparisonOfCompletionAndSettlementVos.add(vo);
|
||||
}
|
||||
|
||||
@ -335,10 +336,9 @@ public class OutTableController extends BaseController {
|
||||
BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVoId,bo.getMonth());
|
||||
//施工完工产值
|
||||
BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,bo.getMonth());
|
||||
//采购完工产值 todo: 掉罗成的接口
|
||||
// BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,bo.getMonth());
|
||||
|
||||
// vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue));
|
||||
//采购完工产值
|
||||
BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,bo.getMonth(),0);
|
||||
vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue));
|
||||
|
||||
//分包结算产值
|
||||
BigDecimal settlementValue = settlementValueSubcontractService.getValueByProjectId(projectVoId,null,bo.getMonth());
|
||||
@ -348,6 +348,13 @@ public class OutTableController extends BaseController {
|
||||
BigDecimal ownerSettlementValue = settlementValueOwnerService.getValueByProjectId(projectVoId,bo.getMonth());
|
||||
vo.setOwnerTotalSettlementOutputValue(ownerSettlementValue);
|
||||
|
||||
|
||||
//转换成万元
|
||||
vo.setOwnerTotalSettlementOutputValue( ownerSettlementValue.divide(parseUnit));
|
||||
vo.setSubTotalSettlementOutputValue( settlementValue.divide(parseUnit));
|
||||
vo.setTotalCompletionOutputValue( vo.getTotalCompletionOutputValue().divide(parseUnit));
|
||||
vo.setDifferenceValue(vo.getOwnerTotalSettlementOutputValue().subtract(vo.getSubTotalSettlementOutputValue()) );
|
||||
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
@ -417,15 +424,23 @@ public class OutTableController extends BaseController {
|
||||
vo.setAccumulatedCompletionValue(accumulatedCompleteValue);
|
||||
|
||||
}else if("2".equals(bo.getValueType())){
|
||||
//todo: 掉罗成的接口
|
||||
// busMaterialsorderService.grossOutput(projectVoId,bo.getMonth())
|
||||
vo.setMonthCompletionValue(BigDecimal.ZERO);
|
||||
|
||||
vo.setMonthCompletionValue(busMaterialsorderService.grossOutput(projectVo.getId(),bo.getMonth(),1));
|
||||
|
||||
vo.setAccumulatedCompletionValue(BigDecimal.ZERO);
|
||||
|
||||
}
|
||||
vo.setValueDifference(vo.getMonthCompletionValue().subtract(vo.getMonthEstimatedValue()));
|
||||
vo.setProjectCompletionRate(BigDecimalUtil.toPercentage(vo.getAccumulatedCompletionValue(), totalValue));
|
||||
|
||||
|
||||
//转换成万元
|
||||
vo.setMonthEstimatedValue(vo.getMonthEstimatedValue().divide((parseUnit)));
|
||||
vo.setMonthCompletionValue(vo.getMonthCompletionValue().divide((parseUnit)));
|
||||
vo.setValueDifference(vo.getValueDifference().divide((parseUnit)));
|
||||
vo.setAccumulatedCompletionValue(vo.getAccumulatedCompletionValue().divide((parseUnit)));
|
||||
vo.setTotalValue(vo.getTotalValue().divide((parseUnit)));
|
||||
|
||||
vos.add(vo);
|
||||
|
||||
}
|
||||
@ -435,7 +450,7 @@ public class OutTableController extends BaseController {
|
||||
rspData.setRows(vos);
|
||||
rspData.setTotal(busProjectVoTableDataInfo.getTotal());
|
||||
|
||||
return TableDataInfo.build();
|
||||
return rspData;
|
||||
}
|
||||
|
||||
|
||||
|
@ -175,7 +175,11 @@ public class OutConstructionValueServiceImpl extends ServiceImpl<OutConstruction
|
||||
|
||||
@Override
|
||||
public BigDecimal getCompleteValue(Long projectId, String month) {
|
||||
return baseMapper.getCompleteValue(projectId,month);
|
||||
BigDecimal completeValue = baseMapper.getCompleteValue(projectId, month);
|
||||
if (completeValue == null) {
|
||||
completeValue = BigDecimal.ZERO;
|
||||
}
|
||||
return completeValue;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -193,7 +193,11 @@ public class OutMonthPlanServiceImpl extends ServiceImpl<OutMonthPlanMapper, Out
|
||||
|
||||
@Override
|
||||
public BigDecimal getDesignValueByProjectId(Long projectId,String month) {
|
||||
return baseMapper.getDesignValueByProjectId(projectId,month);
|
||||
BigDecimal designValueByProjectId = baseMapper.getDesignValueByProjectId(projectId, month);
|
||||
if (designValueByProjectId == null) {
|
||||
designValueByProjectId = BigDecimal.ZERO;
|
||||
}
|
||||
return designValueByProjectId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,6 +135,10 @@ public class OutSettlementValueOwnerServiceImpl extends ServiceImpl<OutSettlemen
|
||||
|
||||
@Override
|
||||
public BigDecimal getValueByProjectId(Long projectId,String month) {
|
||||
return baseMapper.getValueByProjectId(projectId,month);
|
||||
BigDecimal valueByProjectId = baseMapper.getValueByProjectId(projectId, month);
|
||||
if(valueByProjectId == null){
|
||||
valueByProjectId = BigDecimal.ZERO;
|
||||
}
|
||||
return valueByProjectId;
|
||||
}
|
||||
}
|
||||
|
@ -148,6 +148,10 @@ public class OutSettlementValueSubcontractServiceImpl extends ServiceImpl<OutSet
|
||||
|
||||
@Override
|
||||
public BigDecimal getValueByProjectId(Long projectId,String valueType,String month) {
|
||||
return baseMapper.getValueByProjectId(projectId, valueType,month);
|
||||
BigDecimal valueByProjectId = baseMapper.getValueByProjectId(projectId, valueType, month);
|
||||
if(valueByProjectId==null){
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return valueByProjectId;
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="endYue != null">
|
||||
and DATE_FORMAT(a.actual_arrival, '%Y-%m') = #{yue}
|
||||
<if test="month != null and type == 0 ">
|
||||
and DATE_FORMAT(a.actual_arrival, '%Y-%m') = #{month}
|
||||
</if>
|
||||
<if test="month != null and type == 1">
|
||||
and DATE_FORMAT(a.actual_arrival, '%Y-%m') <= #{month}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
Reference in New Issue
Block a user