Selaa lähdekoodia

modify:

1. 终验列表查询修改;
tags/24090601
WendyYang 2 kuukautta sitten
vanhempi
commit
b53aab797d
4 muutettua tiedostoa jossa 88 lisäystä ja 68 poistoa
  1. +54
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizDateUtil.java
  2. +0
    -28
      hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java
  3. +33
    -39
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java
  4. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java

+ 54
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizDateUtil.java Näytä tiedosto

@@ -0,0 +1,54 @@
package com.hz.pm.api.common.util;

import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.Objects;

/**
* <p>
* BizDateUtil
* </p>
*
* @author WendyYang
* @since 11:24 2024/9/3
*/
public class BizDateUtil {

private BizDateUtil() {

}

public static String toDateStr(LocalDate date) {
if (date == null) {
return StrUtil.EMPTY;
}
return LocalDateTimeUtil.format(date, "yyyy-MM-dd");
}

public static String toDateStr(LocalDateTime date) {
if (date == null) {
return StrUtil.EMPTY;
}
return LocalDateTimeUtil.format(date, "yyyy-MM-dd");
}

public static String toDateTimeStr(LocalDateTime dateTime) {
if (dateTime == null) {
return StrUtil.EMPTY;
}
return LocalDateTimeUtil.format(dateTime, "yyyy-MM-dd HH:mm:ss");
}

public static LocalDateTime convertDate(Date date) {
if (Objects.nonNull(date)) {
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
}
return null;
}

}

+ 0
- 28
hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java Näytä tiedosto

@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONArray;
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.file.entity.vo.result.FileResultVO;
import liquibase.pro.packaged.O;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.NumberUtils;

@@ -112,13 +111,6 @@ public class BizUtils {
return StringUtils.EMPTY;
}

public static LocalDateTime convertDate(Date date) {
if (Objects.nonNull(date)) {
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
}
return null;
}

public static String computeRise(Integer numa, Integer numb) {
if ((Objects.isNull(numb) || numb.equals(0)) &&
(Objects.isNull(numa) || numa.equals(0))) {
@@ -140,24 +132,4 @@ public class BizUtils {
return JSON.toJSONString(jsonArray);
}

public static LocalDateTime convertLocalDateTime(String time) {
if (StringUtils.isBlank(time)) {
return null;
}
String[] timeSplit = time.split(StrPool.DASH);
String year = timeSplit[0];
String month = "01";
String dayOfMonth = "01";
if (timeSplit.length > 1) {
month = timeSplit[1];
}
if (timeSplit.length > 2) {
dayOfMonth = timeSplit[2];
}
return LocalDateTime.of(Integer.parseInt(year),
Integer.parseInt(month),
Integer.parseInt(dayOfMonth)
, 0, 0, 0);
}

}

+ 33
- 39
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java Näytä tiedosto

@@ -14,6 +14,8 @@ import com.hz.pm.api.common.enumeration.ProjectProcessType;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil;
import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.common.util.BizDateUtil;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.common.util.ExcelDownUtil;
import com.hz.pm.api.common.util.ExcelExportStyle;
import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO;
@@ -52,7 +54,6 @@ import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
import com.wflow.workflow.service.ProcessInstanceService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -61,10 +62,9 @@ import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.Collectors;

import static com.hz.pm.api.user.helper.MhUnitQueryHelper.*;
import static com.hz.pm.api.user.helper.MhUnitQueryHelper.UnitQueryState;

/**
* @Classname FinalAcceptanceManage
@@ -92,14 +92,14 @@ public class FinalAcceptanceManage {

//==================================================================================================================

private static final List<TenderMainStatus> FINAL_INSPECTED_TENDER_STATUS;
private static final List<Integer> FINAL_INSPECTED_TENDER_STATUS;

static {
FINAL_INSPECTED_TENDER_STATUS = new ArrayList<>();
FINAL_INSPECTED_TENDER_STATUS.add(TenderMainStatus.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY);
FINAL_INSPECTED_TENDER_STATUS.add(TenderMainStatus.ON_FINALLY_INSPECTED_APPLY);
FINAL_INSPECTED_TENDER_STATUS.add(TenderMainStatus.FINALLY_INSPECTED_PASSED);
FINAL_INSPECTED_TENDER_STATUS.add(TenderMainStatus.FINALLY_INSPECTED_FAILED);
FINAL_INSPECTED_TENDER_STATUS.add(TenderMainStatus.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY.getCode());
FINAL_INSPECTED_TENDER_STATUS.add(TenderMainStatus.ON_FINALLY_INSPECTED_APPLY.getCode());
FINAL_INSPECTED_TENDER_STATUS.add(TenderMainStatus.FINALLY_INSPECTED_PASSED.getCode());
FINAL_INSPECTED_TENDER_STATUS.add(TenderMainStatus.FINALLY_INSPECTED_FAILED.getCode());
}

/**
@@ -111,7 +111,7 @@ public class FinalAcceptanceManage {
public FinalAcceptProgressStatisticsVO finalAcceptProgressStatistics(ProjectListReq req) {
LambdaQueryWrapper<Purchase> purchaseQuery = Wrappers.lambdaQuery(Purchase.class)
.select(Purchase::getProjectId, Purchase::getStatus)
.in(Purchase::getStatus, CollUtils.fieldList(FINAL_INSPECTED_TENDER_STATUS, TenderMainStatus::getCode));
.in(Purchase::getStatus, FINAL_INSPECTED_TENDER_STATUS);
List<Purchase> purchases = purchaseService.list(purchaseQuery);
if (purchases.isEmpty()) {
return null;
@@ -157,22 +157,30 @@ public class FinalAcceptanceManage {
* @return \
*/
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) {
Set<Long> projectIds = purchaseService.listProjectIdByStatus(FINAL_INSPECTED_TENDER_STATUS);
if (projectIds.isEmpty()) {
return PageVo.empty();
}
UserInfoDetails user = LoginUserUtil.loginUserDetail();
String buildOrgCode = req.getBuildOrgCode();
req.setBuildOrgCode(null);
LambdaQueryWrapper<Project> query = ProjectManageUtil.projectQuery(req)
.in(Project::getId, projectIds)
.eq(Project::getNewest, Boolean.TRUE)
.orderByAsc(Project::getApprovalDate);
Long buildOrgCodeNum = NumberUtil.parseLong(buildOrgCode, null);
UnitQueryState queryState = mhUnitQueryHelper.listCanViewUnitIds(buildOrgCodeNum, user);
if (!queryState.isState()) {
return null;
}
LambdaQueryWrapper<Purchase> purchaseQuery = Wrappers.lambdaQuery(Purchase.class)
.select(Purchase::getStatus, Purchase::getProjectId, Purchase::getId, Purchase::getBidName);
if (req.getTabStatus() == null) {
purchaseQuery.in(Purchase::getStatus, FINAL_INSPECTED_TENDER_STATUS);
} else {
purchaseQuery.eq(Purchase::getStatus, req.getTabStatus());
}
List<Purchase> purchases = purchaseService.list(purchaseQuery);
if (purchases.isEmpty()) {
return PageVo.empty();
}
List<Long> projectIds = CollUtils.fieldList(purchases, Purchase::getProjectId);
LambdaQueryWrapper<Project> query = ProjectManageUtil.projectQuery(req)
.in(Project::getId, projectIds)
.eq(Project::getNewest, Boolean.TRUE)
.orderByAsc(Project::getApprovalDate);
if (CollUtil.isNotEmpty(queryState.getUnitIds())) {
query.in(Project::getBuildOrgCode, CollUtils.convert(queryState.getUnitIds(), String::valueOf));
}
@@ -180,20 +188,8 @@ public class FinalAcceptanceManage {
if (page.getTotal() == 0) {
return PageVo.empty();
}
Set<Long> allProjectIds = CollUtils.fieldSet(page.getRecords(), Project::getId);
Wrapper<Purchase> purchaseQuery = Wrappers.lambdaQuery(Purchase.class)
.in(Purchase::getProjectId, allProjectIds)
.eq(Purchase::getStatus, req.getTabStatus());
List<Purchase> purchases = purchaseService.list(purchaseQuery);
Map<Long, List<Purchase>> purchaseMap;
Map<Long, Contract> contractMap;
if (!purchases.isEmpty()) {
purchaseMap = CollUtils.group(purchases, Purchase::getProjectId);
contractMap = contractService.listByProjectIds(projectIds);
} else {
purchaseMap = Collections.emptyMap();
contractMap = Collections.emptyMap();
}
Map<Long, List<Purchase>> purchaseMap = CollUtils.group(purchases, Purchase::getProjectId);
Map<Long, Contract> contractMap = contractService.listByProjectIds(projectIds);
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
@@ -212,11 +208,10 @@ public class FinalAcceptanceManage {
item.setReviewAmount(w.getReviewAmount());
item.setApprovedAmount(w.getApprovalAmount());
item.setApprovalDate(w.getApprovalDate());
item.setBuildCycle(StrUtil.isNotBlank(w.getBuildCycle()) ? Integer.valueOf(w.getBuildCycle()) : null);
item.setBuildCycle(NumberUtil.parseInt(w.getBuildCycle(), null));
item.setPlanAcceptanceTime(w.getPlanAcceptanceTime());
List<Purchase> currPurchases = purchaseMap.get(w.getId());
if (currPurchases != null) {
List<TenderListInfoVO> tmpPurchases = CollUtils.convert(currPurchases, x -> {
BizUtils.notNull(purchaseMap.get(w.getId()), tmp -> {
List<TenderListInfoVO> tenders = CollUtils.convert(tmp, x -> {
TenderListInfoVO tender = new TenderListInfoVO();
tender.setBidName(x.getBidName());
tender.setBidId(x.getId());
@@ -228,8 +223,8 @@ public class FinalAcceptanceManage {
}
return tender;
});
item.setTenders(tmpPurchases);
}
item.setTenders(tenders);
});
return item;
});
return PageVo.of(records, page.getTotal());
@@ -260,8 +255,7 @@ public class FinalAcceptanceManage {
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm");
item.setCreateOn(createOnStr);
item.setSerialNumber(serialNumber.incrementAndGet());
item.setPlanAcceptanceTime(Objects.nonNull(r.getPlanAcceptanceTime()) ?
NdDateUtils.format(r.getPlanAcceptanceTime(), "yyyy-MM-dd") : StringUtils.EMPTY);
item.setPlanAcceptanceTime(BizDateUtil.toDateStr(r.getPlanAcceptanceTime()));
collect.add(item);
});
}


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java Näytä tiedosto

@@ -1,7 +1,7 @@
package com.hz.pm.api.projectlib.model.req;

import com.ningdatech.basic.model.PagePo;
import com.hz.pm.api.common.enumeration.ExportOptionEnum;
import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;


Loading…
Peruuta
Tallenna