@@ -118,6 +118,17 @@ public class TenderAction { | |||||
} | } | ||||
/** | /** | ||||
* 终验申报重新提交 | |||||
* | |||||
* @param message \ | |||||
*/ | |||||
@OnTransition(source = "FINALLY_INSPECTED_FAILED", target = "ON_FINALLY_INSPECTED_APPLY") | |||||
public void RESUBMIT_FINALLY_INSPECTED(Message<ProjectStatusChangeEvent> message) { | |||||
Purchase purchase = getPurchaseInfo(message); | |||||
purchase.setStatus(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY.getTenderStatus()); | |||||
} | |||||
/** | |||||
* 终验申报通过 | * 终验申报通过 | ||||
* | * | ||||
* @param message \ | * @param message \ | ||||
@@ -117,6 +117,12 @@ public class TenderStateMachineBuilderImpl implements TenderStateMachineBuilder | |||||
.target(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY) | .target(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY) | ||||
.event(TenderStatusChangeEvent.SUBMIT_FINALLY_INSPECTED) | .event(TenderStatusChangeEvent.SUBMIT_FINALLY_INSPECTED) | ||||
.and() | .and() | ||||
// 终验申报重新提交 | |||||
.withExternal() | |||||
.source(TenderStatusEnum.FINALLY_INSPECTED_FAILED) | |||||
.target(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY) | |||||
.event(TenderStatusChangeEvent.RESUBMIT_FINALLY_INSPECTED) | |||||
.and() | |||||
// 终验申报通过 | // 终验申报通过 | ||||
.withExternal() | .withExternal() | ||||
.source(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY) | .source(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY) | ||||
@@ -50,9 +50,13 @@ public enum TenderStatusChangeEvent { | |||||
*/ | */ | ||||
SUBMIT_FINALLY_INSPECTED(401, null, null), | SUBMIT_FINALLY_INSPECTED(401, null, null), | ||||
/** | /** | ||||
* 终验申报重新提交 | |||||
*/ | |||||
RESUBMIT_FINALLY_INSPECTED(402, null, null), | |||||
/** | |||||
* 终验申报通过 | * 终验申报通过 | ||||
*/ | */ | ||||
FINALLY_INSPECTED_PASSED(501, null, null), | |||||
FINALLY_INSPECTED_PASSED(502, null, null), | |||||
/** | /** | ||||
* 终验申报拒绝 | * 终验申报拒绝 | ||||
*/ | */ | ||||
@@ -33,6 +33,11 @@ public class MhSyncController { | |||||
syncMhUserOrgManage.syncUsers(syncTime); | syncMhUserOrgManage.syncUsers(syncTime); | ||||
} | } | ||||
@GetMapping("/projects") | |||||
public void getUsers() { | |||||
syncMhUserOrgManage.syncMhProjects(); | |||||
} | |||||
@GetMapping("/units") | @GetMapping("/units") | ||||
public void getUnits() { | public void getUnits() { | ||||
syncMhUserOrgManage.syncUnits(); | syncMhUserOrgManage.syncUnits(); | ||||
@@ -1,5 +1,6 @@ | |||||
package com.hz.pm.api.projectdeclared.service; | package com.hz.pm.api.projectdeclared.service; | ||||
import cn.hutool.core.util.ArrayUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
@@ -7,10 +8,7 @@ import com.hz.pm.api.projectdeclared.model.entity.Purchase; | |||||
import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum; | import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import java.util.Arrays; | |||||
import java.util.Collection; | |||||
import java.util.List; | |||||
import java.util.Set; | |||||
import java.util.*; | |||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
/** | /** | ||||
@@ -36,6 +34,9 @@ public interface IPurchaseService extends IService<Purchase> { | |||||
} | } | ||||
default Set<Long> listProjectIdByStatus(TenderStatusEnum... status) { | default Set<Long> listProjectIdByStatus(TenderStatusEnum... status) { | ||||
if (ArrayUtil.isEmpty(status)) { | |||||
return Collections.emptySet(); | |||||
} | |||||
List<Integer> statusCodes = Arrays.stream(status) | List<Integer> statusCodes = Arrays.stream(status) | ||||
.map(TenderStatusEnum::getTenderStatus) | .map(TenderStatusEnum::getTenderStatus) | ||||
.collect(Collectors.toList()); | .collect(Collectors.toList()); | ||||
@@ -78,7 +78,9 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { | |||||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.SUBMIT_PURCHASE_NOTICE.name()) | .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.SUBMIT_PURCHASE_NOTICE.name()) | ||||
.orderByDesc(ProjectStatusChange::getCreateOn) | .orderByDesc(ProjectStatusChange::getCreateOn) | ||||
.last(BizConst.LIMIT_1)); | .last(BizConst.LIMIT_1)); | ||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||||
if (projectStatusChange != null) { | |||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||||
} | |||||
} | } | ||||
processDetailVO.setProcessName(CommonConst.TENDER_PURCHASE); | processDetailVO.setProcessName(CommonConst.TENDER_PURCHASE); | ||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
@@ -1,5 +1,6 @@ | |||||
package com.hz.pm.api.user.manage; | package com.hz.pm.api.user.manage; | ||||
import cn.hutool.core.bean.BeanUtil; | |||||
import cn.hutool.core.collection.CollUtil; | import cn.hutool.core.collection.CollUtil; | ||||
import cn.hutool.core.collection.ListUtil; | import cn.hutool.core.collection.ListUtil; | ||||
import cn.hutool.core.date.DateUtil; | import cn.hutool.core.date.DateUtil; | ||||
@@ -19,7 +20,10 @@ import com.hz.pm.api.meta.helper.DictionaryCache; | |||||
import com.hz.pm.api.meta.model.dto.DictionaryDTO; | import com.hz.pm.api.meta.model.dto.DictionaryDTO; | ||||
import com.hz.pm.api.meta.model.entity.ExpertDictionary; | import com.hz.pm.api.meta.model.entity.ExpertDictionary; | ||||
import com.hz.pm.api.meta.service.IExpertDictionaryService; | import com.hz.pm.api.meta.service.IExpertDictionaryService; | ||||
import com.hz.pm.api.user.helper.MhUnitCache; | |||||
import com.hz.pm.api.projectlib.model.entity.MhProject; | |||||
import com.hz.pm.api.projectlib.model.entity.MhProjectSchemaTargetData; | |||||
import com.hz.pm.api.projectlib.service.IMhProjectSchemaTargetDataService; | |||||
import com.hz.pm.api.projectlib.service.IMhProjectService; | |||||
import com.hz.pm.api.user.model.entity.MhCompany; | import com.hz.pm.api.user.model.entity.MhCompany; | ||||
import com.hz.pm.api.user.model.entity.MhUnit; | import com.hz.pm.api.user.model.entity.MhUnit; | ||||
import com.hz.pm.api.user.model.entity.UserInfo; | import com.hz.pm.api.user.model.entity.UserInfo; | ||||
@@ -32,6 +36,7 @@ import com.ningdatech.basic.util.CollUtils; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | |||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
@@ -62,6 +67,40 @@ public class SyncMhUserOrgManage { | |||||
private final IMhCompanyService mhCompanyService; | private final IMhCompanyService mhCompanyService; | ||||
private final DictionaryCache dictionaryCache; | private final DictionaryCache dictionaryCache; | ||||
private final IExpertDictionaryService expertDictionaryService; | private final IExpertDictionaryService expertDictionaryService; | ||||
private final IMhProjectService mhProjectService; | |||||
private final IMhProjectSchemaTargetDataService mhProjectSchemaTargetDataService; | |||||
@Transactional(rollbackFor = Exception.class) | |||||
public void syncMhProjects() { | |||||
MhRetDTO<List<MhProjectDTO>> mhRet = mhApiClient.listProjects(); | |||||
if (mhRet.isOk()) { | |||||
List<MhProjectDTO> mhRetData = mhRet.getData(); | |||||
if (CollUtil.isEmpty(mhRetData)) { | |||||
log.warn("未获取到可同步的项目信息:{}", JSONUtil.toJsonStr(mhRet)); | |||||
return; | |||||
} | |||||
Map<String, MhProjectDTO> retProjectMap = CollUtils.listToMap(mhRetData, w -> w.getProjectName() + "#" + w.getUnitId()); | |||||
List<MhProject> preProjects = mhProjectService.list(); | |||||
Map<String, MhProject> preProjectMap = CollUtils.listToMap(preProjects, w -> w.getProjectName() + "#" + w.getUnitId()); | |||||
retProjectMap.forEach((k, v) -> { | |||||
MhProject preProject = preProjectMap.get(k); | |||||
if (preProject != null) { | |||||
BeanUtil.copyProperties(v, preProject); | |||||
} else { | |||||
preProject = BeanUtil.copyProperties(v, MhProject.class); | |||||
} | |||||
mhProjectService.saveOrUpdate(preProject); | |||||
if (v.getSchemeTargetData() != null) { | |||||
MhProjectSchemaTargetData schemaTargetData = new MhProjectSchemaTargetData(); | |||||
BeanUtil.copyProperties(v.getSchemeTargetData(), schemaTargetData); | |||||
schemaTargetData.setMhProjectId(preProject.getId()); | |||||
mhProjectSchemaTargetDataService.saveOrUpdate(schemaTargetData); | |||||
} | |||||
}); | |||||
} else { | |||||
log.error("同步项目信息失败:{}", JSONUtil.toJsonStr(mhRet)); | |||||
} | |||||
} | |||||
public void syncUsers(LocalDateTime syncDateTime) { | public void syncUsers(LocalDateTime syncDateTime) { | ||||
MhRetDTO<List<MhUserDTO>> mhRet = mhApiClient.queryUsers(syncDateTime); | MhRetDTO<List<MhUserDTO>> mhRet = mhApiClient.queryUsers(syncDateTime); | ||||