Parcourir la source

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

tags/24080901
PoffyZhang il y a 1 an
Parent
révision
7da22f9a8b
3 fichiers modifiés avec 31 ajouts et 19 suppressions
  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 Voir le fichier

@@ -3,7 +3,11 @@ package com.ningdatech.pmapi.projectlib.helper;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.vo.ProjectApplicationVO;
import org.springframework.beans.BeanUtils;

/**
* <p>
@@ -48,4 +52,25 @@ public class ProjectHelper {
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 Voir le fichier

@@ -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.ProjectApplication;
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.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectAnnualAccumulateAmountService;
@@ -87,25 +86,15 @@ public class ProjectLibManage {
.eq(ProjectApplication::getProjectId, vo.getId()));
Optional.ofNullable(applications).ifPresent(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)
.eq(ProjectAnnualAccumulateAmount::getProjectId, vo.getId())
.orderByAsc(ProjectAnnualAccumulateAmount::getProjectYear));
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;
}


+ 3
- 5
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java Voir le fichier

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

/**
@@ -35,11 +36,8 @@ public class ProjectAnnualAccumulateAmount implements Serializable {
@ApiModelProperty("年度投资金额")
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() {
if(Objects.nonNull(this.annualAccumulateAmount)){


Chargement…
Annuler
Enregistrer