|
|
@@ -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); |
|
|
|
}); |
|
|
|
} |
|
|
|