Browse Source

累积投资金额 放到项目详情

tags/24080901
PoffyZhang 1 year ago
parent
commit
7da22f9a8b
3 changed files with 31 additions and 19 deletions
  1. +25
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java
  2. +3
    -14
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  3. +3
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java

+ 25
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java View File

@@ -3,7 +3,11 @@ package com.ningdatech.pmapi.projectlib.helper;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO;
import org.springframework.beans.BeanUtils;


/** /**
* <p> * <p>
@@ -48,4 +52,25 @@ public class ProjectHelper {
return query; return query;
} }


/**
* 转换年度投资详情
* @param amount
* @return
*/
public static String convertAnnualAmountDetail(ProjectAnnualAccumulateAmount amount) {
StringBuffer sb = new StringBuffer();
sb.append(amount.getProjectYear() + "年投资" + amount.getConvertTenThousand() + "万元。\n");
return sb.toString();
}

/**
* 转换VO
* @param app
* @return
*/
public static ProjectApplicationVO convertVO(ProjectApplication app) {
ProjectApplicationVO appVo = new ProjectApplicationVO();
BeanUtils.copyProperties(app, appVo);
return appVo;
}
} }

+ 3
- 14
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java View File

@@ -10,7 +10,6 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount; import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectAnnualAccumulateAmountService; import com.ningdatech.pmapi.projectlib.service.IProjectAnnualAccumulateAmountService;
@@ -87,25 +86,15 @@ public class ProjectLibManage {
.eq(ProjectApplication::getProjectId, vo.getId())); .eq(ProjectApplication::getProjectId, vo.getId()));
Optional.ofNullable(applications).ifPresent(apps -> Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps, vo.setProjectApplications(CollUtils.convert(apps,
app-> {
ProjectApplicationVO appVo = new ProjectApplicationVO();
BeanUtils.copyProperties(app, appVo);
return appVo;
}
)
ProjectHelper::convertVO)
)); ));
//查询年度投资金额 //查询年度投资金额
List<ProjectAnnualAccumulateAmount> annualAmount = announcementAccumulateAmountService.list(Wrappers.lambdaQuery(ProjectAnnualAccumulateAmount.class) List<ProjectAnnualAccumulateAmount> annualAmount = announcementAccumulateAmountService.list(Wrappers.lambdaQuery(ProjectAnnualAccumulateAmount.class)
.eq(ProjectAnnualAccumulateAmount::getProjectId, vo.getId()) .eq(ProjectAnnualAccumulateAmount::getProjectId, vo.getId())
.orderByAsc(ProjectAnnualAccumulateAmount::getProjectYear)); .orderByAsc(ProjectAnnualAccumulateAmount::getProjectYear));
Optional.ofNullable(annualAmount).ifPresent(amounts -> Optional.ofNullable(annualAmount).ifPresent(amounts ->
vo.setAnnualAccumulateAmountDetail(CollUtils.joinByComma(amounts,
amount-> {
StringBuffer sb = new StringBuffer();
sb.append(amount.getProjectYear() + "年投资" + amount.getConvertTenThousand() + "万元。\n");
return sb.toString();
}
)
vo.setAnnualAccumulateAmountDetail(CollUtils.joinByComma(
amounts,ProjectHelper::convertAnnualAmountDetail)
)); ));
return vo; return vo;
} }


+ 3
- 5
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java View File

@@ -7,6 +7,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.Objects; import java.util.Objects;


/** /**
@@ -35,11 +36,8 @@ public class ProjectAnnualAccumulateAmount implements Serializable {
@ApiModelProperty("年度投资金额") @ApiModelProperty("年度投资金额")
private BigDecimal annualAccumulateAmount; private BigDecimal annualAccumulateAmount;


@TableField(fill = FieldFill.INSERT)
private Long createBy;

@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updateBy;
private LocalDateTime createOn;
private LocalDateTime updateOn;


public BigDecimal getConvertTenThousand() { public BigDecimal getConvertTenThousand() {
if(Objects.nonNull(this.annualAccumulateAmount)){ if(Objects.nonNull(this.annualAccumulateAmount)){


Loading…
Cancel
Save