移动bug

dev
zhanglei 2026-08-04 09:47:29 +08:00
parent f0ebc579ab
commit 784845fc74
5 changed files with 36 additions and 6 deletions

View File

@ -42,7 +42,7 @@ public class AppEvalProjectController {
@ApiOperation("我的项目统计")
@GetMapping("/projectStatistics")
public SingleResponse<EvalProjectStatisticsCO> projectStatistics() {
return evalProjectApi.projectStatistics();
return evalProjectApi.appProjectStatistics();
}
@ApiOperation("安评项目枚举映射")

View File

@ -278,6 +278,28 @@ public class EvalProjectExecutor implements EvalProjectApi {
return PageResponse.of(co, pageResult.getTotal());
}
@Override
public SingleResponse<EvalProjectStatisticsCO> appProjectStatistics() {
EvalProjectPageQuery evalProjectPageQuery = new EvalProjectPageQuery();
List<EvalProjectCO> data = myPage(evalProjectPageQuery).getData();
EvalProjectStatisticsCO co = new EvalProjectStatisticsCO();
if (!CollectionUtils.isEmpty(data)) {
EvalProjectMemberQuery query = new EvalProjectMemberQuery();
query.setOrgId(ThreadLocalUserInfoAdapter.getOrgId());
query.setPersonnelId(AuthUserContextAdapter.getCurrentUserId());
query.setPageNum(1L);
query.setPageSize(200L);
query.setProjectIds(data.stream().map(EvalProjectCO::getId).map(Long::valueOf).collect(Collectors.toList()));
List<Long> pIds = evalProjectMemberGateway.page(query).getRecords().stream().map(EvalProjectMemberEntity::getProjectId).distinct().collect(Collectors.toList());
if (!CollectionUtils.isEmpty(pIds)) {
long onSiteTaskSum = evalProjectMapper.onSiteTaskSum(pIds, ProjectStageEnum.SITE_SURVEY.getVal());
co.setOnSiteTaskSum(onSiteTaskSum);
}
}
co.setPendingMyHandlingSum(data.stream().filter(item -> "NORMAL".equals(item.getProjectPhaseCode()) && item.getArchiveFlag() == 0).count());
return SingleResponse.success(co);
}
private CustomerEvalProjectCO convertToCustomerCO(EvalProjectEntity entity) {
CustomerEvalProjectCO co = new CustomerEvalProjectCO();
co.setId(entity.getId() == null ? null : String.valueOf(entity.getId()));

View File

@ -11,13 +11,16 @@ import org.qinan.safetyeval.domain.entity.EvalSurveyAttachEntity;
import org.qinan.safetyeval.domain.service.EvalSurveyDomainService;
import org.qinan.safetyeval.domain.service.ProjectStageSyncService;
import org.qinan.safetyeval.infrastructure.dataobject.EvalSurveyAttachDO;
import org.qinan.safetyeval.infrastructure.dataobject.EvalSurveyDO;
import org.qinan.safetyeval.infrastructure.mapper.EvalSurveyAttachMapper;
import org.qinan.safetyeval.infrastructure.mapper.EvalSurveyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
@Service
public class EvalSurveyAttachExecutor implements EvalSurveyAttachApi {
@ -33,6 +36,8 @@ public class EvalSurveyAttachExecutor implements EvalSurveyAttachApi {
private ProjectStageSyncService projectStageSyncService;
@Autowired
private EvalSurveyAttachMapper evalSurveyAttachMapper;
@Autowired
private EvalSurveyMapper evalSurveyMapper;
@Override
@Transactional(rollbackFor = Exception.class)
@ -44,7 +49,9 @@ public class EvalSurveyAttachExecutor implements EvalSurveyAttachApi {
EvalSurveyAttachEntity entity = evalSurveyCmdConvertor.convertAttachSaveCmdToE(cmd);
evalSurveyDomainService.saveOrUpdateAttach(entity);
}
if (cmdList.get(0).getProjectId() != null) {
Long num = evalSurveyMapper.selectCount(new LambdaQueryWrapper<EvalSurveyDO>()
.eq(EvalSurveyDO::getProjectId, cmdList.get(0).getProjectId()));
if (cmdList.get(0).getProjectId() != null && (Objects.isNull(num) ? 0 : num) >= 2) {
projectStageSyncService.onNodeCompleted(Long.valueOf(cmdList.get(0).getProjectId()), ProjectStageEnum.SITE_SURVEY.getNode());
}
return SingleResponse.success(true);

View File

@ -44,4 +44,6 @@ public interface EvalProjectApi {
PageResponse<CustomerEvalProjectCO> customerPage(CustomerEvalProjectPageQuery query);
PageResponse<EvalProjectCO> myPage(EvalProjectPageQuery query);
SingleResponse<EvalProjectStatisticsCO> appProjectStatistics();
}

View File

@ -1,6 +1,5 @@
package org.qinan.safetyeval.domain.service;
import org.qinan.safetyeval.domain.constant.ProjectStageEnum;
import org.qinan.safetyeval.domain.entity.EvalSurveyAttachEntity;
import org.qinan.safetyeval.domain.entity.EvalSurveyEntity;
import org.qinan.safetyeval.domain.exception.BizException;
@ -40,9 +39,9 @@ public class EvalSurveyDomainService {
entity.setOrgId(existing.getOrgId());
result = evalSurveyGateway.modify(entity);
}
if (result.getProjectId() != null) {
projectStageSyncService.onNodeCompleted(result.getProjectId(), ProjectStageEnum.SITE_SURVEY.getNode());
}
// if (result.getProjectId() != null) {
// projectStageSyncService.onNodeCompleted(result.getProjectId(), ProjectStageEnum.SITE_SURVEY.getNode());
// }
return result;
}