|
|
|
|
@ -59,6 +59,7 @@ public class ErpProjectPlanServiceImpl implements IErpProjectPlanService {
|
|
|
|
|
|
|
|
|
|
@DubboReference(timeout = 30000)
|
|
|
|
|
private RemoteWorkflowService remoteWorkflowService;
|
|
|
|
|
|
|
|
|
|
@DubboReference(timeout = 30000)
|
|
|
|
|
private RemoteCodeRuleService remoteCodeRuleService;
|
|
|
|
|
|
|
|
|
|
@ -69,7 +70,7 @@ public class ErpProjectPlanServiceImpl implements IErpProjectPlanService {
|
|
|
|
|
* @return 项目计划
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public ErpProjectPlanVo queryById(Long projectPlanId){
|
|
|
|
|
public ErpProjectPlanVo queryById(Long projectPlanId) {
|
|
|
|
|
// 使用自定义方法查询,包含关联数据
|
|
|
|
|
ErpProjectPlanVo projectPlanVo = baseMapper.selectCustomErpProjectPlanVoById(projectPlanId);
|
|
|
|
|
if (ObjectUtils.isEmpty(projectPlanVo)) {
|
|
|
|
|
@ -77,28 +78,28 @@ public class ErpProjectPlanServiceImpl implements IErpProjectPlanService {
|
|
|
|
|
}
|
|
|
|
|
// 查询项目计划阶段列表
|
|
|
|
|
MPJLambdaWrapper<ErpProjectPlanStage> lqw = JoinWrappers.lambda(ErpProjectPlanStage.class)
|
|
|
|
|
.selectAll(ErpProjectPlanStage.class)
|
|
|
|
|
.eq("t.del_flag", "0")
|
|
|
|
|
.eq(projectPlanId != null, ErpProjectPlanStage::getProjectPlanId, projectPlanId);
|
|
|
|
|
.selectAll(ErpProjectPlanStage.class)
|
|
|
|
|
.eq("t.del_flag", "0")
|
|
|
|
|
.eq(projectPlanId != null, ErpProjectPlanStage::getProjectPlanId, projectPlanId);
|
|
|
|
|
List<ErpProjectPlanStageVo> planStageList = planStageMapper.selectVoList(lqw);
|
|
|
|
|
projectPlanVo.setPlanStageList(planStageList);
|
|
|
|
|
return projectPlanVo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分页查询项目计划列表
|
|
|
|
|
*
|
|
|
|
|
* @param bo 查询条件
|
|
|
|
|
* @param pageQuery 分页参数
|
|
|
|
|
* @return 项目计划分页列表
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public TableDataInfo<ErpProjectPlanVo> queryPageList(ErpProjectPlanBo bo, PageQuery pageQuery) {
|
|
|
|
|
MPJLambdaWrapper<ErpProjectPlan> lqw = buildQueryWrapper(bo);
|
|
|
|
|
// 使用自定义分页查询方法获取包含关联数据的结果
|
|
|
|
|
Page<ErpProjectPlanVo> result = baseMapper.selectCustomErpProjectPlanVoList(pageQuery.build(), lqw);
|
|
|
|
|
return TableDataInfo.build(result);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 分页查询项目计划列表
|
|
|
|
|
*
|
|
|
|
|
* @param bo 查询条件
|
|
|
|
|
* @param pageQuery 分页参数
|
|
|
|
|
* @return 项目计划分页列表
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public TableDataInfo<ErpProjectPlanVo> queryPageList(ErpProjectPlanBo bo, PageQuery pageQuery) {
|
|
|
|
|
MPJLambdaWrapper<ErpProjectPlan> lqw = buildQueryWrapper(bo);
|
|
|
|
|
// 使用自定义分页查询方法获取包含关联数据的结果
|
|
|
|
|
Page<ErpProjectPlanVo> result = baseMapper.selectCustomErpProjectPlanVoList(pageQuery.build(), lqw);
|
|
|
|
|
return TableDataInfo.build(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询符合条件的项目计划列表
|
|
|
|
|
@ -116,22 +117,20 @@ public class ErpProjectPlanServiceImpl implements IErpProjectPlanService {
|
|
|
|
|
private MPJLambdaWrapper<ErpProjectPlan> buildQueryWrapper(ErpProjectPlanBo bo) {
|
|
|
|
|
Map<String, Object> params = bo.getParams();
|
|
|
|
|
MPJLambdaWrapper<ErpProjectPlan> lqw = JoinWrappers.lambda(ErpProjectPlan.class)
|
|
|
|
|
.selectAll(ErpProjectPlan.class)
|
|
|
|
|
.eq(ErpProjectPlan::getDelFlag, "0")
|
|
|
|
|
// 关联项目信息
|
|
|
|
|
.select(ErpProjectInfo::getProjectName)
|
|
|
|
|
.leftJoin(ErpProjectInfo.class,ErpProjectInfo::getProjectId, ErpProjectPlan::getProjectId)
|
|
|
|
|
.eq(bo.getProjectId() != null, ErpProjectPlan::getProjectId, bo.getProjectId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getProjectPlanCode()), ErpProjectPlan::getProjectPlanCode, bo.getProjectPlanCode())
|
|
|
|
|
.eq(bo.getManagerId() != null, ErpProjectPlan::getManagerId, bo.getManagerId())
|
|
|
|
|
.eq(bo.getChargeId() != null, ErpProjectPlan::getChargeId, bo.getChargeId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getPaymentMethod()), ErpProjectPlan::getPaymentMethod, bo.getPaymentMethod())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getProjectPlanStatus()), ErpProjectPlan::getProjectPlanStatus, bo.getProjectPlanStatus())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getFlowStatus()), ErpProjectPlan::getFlowStatus, bo.getFlowStatus())
|
|
|
|
|
.eq(bo.getSortOrder() != null, ErpProjectPlan::getSortOrder, bo.getSortOrder())
|
|
|
|
|
.eq(bo.getContractId() != null, ErpProjectPlan::getContractId, bo.getContractId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getOssId()), ErpProjectPlan::getOssId, bo.getOssId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ErpProjectPlan::getActiveFlag, bo.getActiveFlag());
|
|
|
|
|
.selectAll(ErpProjectPlan.class)
|
|
|
|
|
.eq(ErpProjectPlan::getDelFlag, "0")
|
|
|
|
|
.eq(bo.getProjectId() != null, ErpProjectPlan::getProjectId, bo.getProjectId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getProjectPlanCode()), ErpProjectPlan::getProjectPlanCode, bo.getProjectPlanCode())
|
|
|
|
|
.eq(bo.getManagerId() != null, ErpProjectPlan::getManagerId, bo.getManagerId())
|
|
|
|
|
.eq(bo.getChargeId() != null, ErpProjectPlan::getChargeId, bo.getChargeId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getPaymentMethod()), ErpProjectPlan::getPaymentMethod, bo.getPaymentMethod())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getProjectPlanStatus()), ErpProjectPlan::getProjectPlanStatus, bo.getProjectPlanStatus())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getFlowStatus()), ErpProjectPlan::getFlowStatus, bo.getFlowStatus())
|
|
|
|
|
.eq(bo.getSortOrder() != null, ErpProjectPlan::getSortOrder, bo.getSortOrder())
|
|
|
|
|
.eq(bo.getContractId() != null, ErpProjectPlan::getContractId, bo.getContractId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getOssId()), ErpProjectPlan::getOssId, bo.getOssId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ErpProjectPlan::getActiveFlag, bo.getActiveFlag())
|
|
|
|
|
.orderByDesc(ErpProjectPlan::getCreateTime);
|
|
|
|
|
return lqw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -154,7 +153,7 @@ public class ErpProjectPlanServiceImpl implements IErpProjectPlanService {
|
|
|
|
|
if (flag) {
|
|
|
|
|
bo.setProjectPlanId(add.getProjectPlanId());
|
|
|
|
|
bo.setProjectPlanCode(add.getProjectPlanCode());
|
|
|
|
|
if ( ObjectUtils.isNotEmpty(planStageList)) {
|
|
|
|
|
if (ObjectUtils.isNotEmpty(planStageList)) {
|
|
|
|
|
for (ErpProjectPlanStage planStage : planStageList) {
|
|
|
|
|
planStage.setProjectPlanId(add.getProjectPlanId());
|
|
|
|
|
planStage.setProjectId(add.getProjectId());
|
|
|
|
|
@ -227,14 +226,14 @@ public class ErpProjectPlanServiceImpl implements IErpProjectPlanService {
|
|
|
|
|
|
|
|
|
|
// 收集当前计划阶段列表中已存在的计划阶段ID集合
|
|
|
|
|
Set<Long> existingPlanStageIds = planStageList.stream()
|
|
|
|
|
.map(ErpProjectPlanStage::getPlanStageId)
|
|
|
|
|
.filter(Objects::nonNull)
|
|
|
|
|
.collect(Collectors.toSet());
|
|
|
|
|
.map(ErpProjectPlanStage::getPlanStageId)
|
|
|
|
|
.filter(Objects::nonNull)
|
|
|
|
|
.collect(Collectors.toSet());
|
|
|
|
|
|
|
|
|
|
// 从旧的计划阶段列表中筛选出需要删除的记录(即不在当前列表中的记录)
|
|
|
|
|
List<ErpProjectPlanStage> filterPlanStageIds = planStageOldList.stream()
|
|
|
|
|
.filter(stage -> !existingPlanStageIds.contains(stage.getPlanStageId()))
|
|
|
|
|
.toList();
|
|
|
|
|
.filter(stage -> !existingPlanStageIds.contains(stage.getPlanStageId()))
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
// 删除需要移除的计划阶段记录
|
|
|
|
|
for (ErpProjectPlanStage filterPlanStageId : filterPlanStageIds) {
|
|
|
|
|
@ -248,15 +247,15 @@ public class ErpProjectPlanServiceImpl implements IErpProjectPlanService {
|
|
|
|
|
/**
|
|
|
|
|
* 保存前的数据校验
|
|
|
|
|
*/
|
|
|
|
|
private void validEntityBeforeSave(ErpProjectPlan entity){
|
|
|
|
|
private void validEntityBeforeSave(ErpProjectPlan entity) {
|
|
|
|
|
// 唯一性校验:一个项目只能有一个项目计划
|
|
|
|
|
Long projectId = entity.getProjectId();
|
|
|
|
|
if (projectId == null) {
|
|
|
|
|
throw new ServiceException("项目不能为空");
|
|
|
|
|
}
|
|
|
|
|
MPJLambdaWrapper<ErpProjectPlan> lqw = JoinWrappers.lambda(ErpProjectPlan.class)
|
|
|
|
|
.eq(ErpProjectPlan::getProjectId, projectId)
|
|
|
|
|
.eq(ErpProjectPlan::getDelFlag, "0");
|
|
|
|
|
.eq(ErpProjectPlan::getProjectId, projectId)
|
|
|
|
|
.eq(ErpProjectPlan::getDelFlag, "0");
|
|
|
|
|
// 更新时排除自身ID
|
|
|
|
|
if (entity.getProjectPlanId() != null) {
|
|
|
|
|
lqw.ne(ErpProjectPlan::getProjectPlanId, entity.getProjectPlanId());
|
|
|
|
|
@ -308,12 +307,12 @@ public class ErpProjectPlanServiceImpl implements IErpProjectPlanService {
|
|
|
|
|
@Override
|
|
|
|
|
@GlobalTransactional(rollbackFor = Exception.class)
|
|
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
|
|
if(isValid){
|
|
|
|
|
if (isValid) {
|
|
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
|
}
|
|
|
|
|
// 先删除子表
|
|
|
|
|
planStageMapper.delete(Wrappers.<ErpProjectPlanStage>lambdaQuery()
|
|
|
|
|
.in(ErpProjectPlanStage::getProjectPlanId, ids));
|
|
|
|
|
.in(ErpProjectPlanStage::getProjectPlanId, ids));
|
|
|
|
|
baseMapper.deleteByIds(ids);
|
|
|
|
|
//删除工作流
|
|
|
|
|
List<Long> businessIds = ids.stream().toList();
|
|
|
|
|
@ -374,10 +373,10 @@ public class ErpProjectPlanServiceImpl implements IErpProjectPlanService {
|
|
|
|
|
} else if (Objects.equals(processEvent.getStatus(), BusinessStatusEnum.FINISH.getStatus())) {
|
|
|
|
|
projectPlan.setProjectPlanStatus(OAStatusEnum.COMPLETED.getStatus());
|
|
|
|
|
} else if (Objects.equals(processEvent.getStatus(), BusinessStatusEnum.INVALID.getStatus())
|
|
|
|
|
|| Objects.equals(processEvent.getStatus(), BusinessStatusEnum.TERMINATION.getStatus())) {
|
|
|
|
|
|| Objects.equals(processEvent.getStatus(), BusinessStatusEnum.TERMINATION.getStatus())) {
|
|
|
|
|
projectPlan.setProjectPlanStatus(OAStatusEnum.INVALID.getStatus());
|
|
|
|
|
} else if (Objects.equals(processEvent.getStatus(), BusinessStatusEnum.BACK.getStatus())
|
|
|
|
|
|| Objects.equals(processEvent.getStatus(), BusinessStatusEnum.CANCEL.getStatus())) {
|
|
|
|
|
|| Objects.equals(processEvent.getStatus(), BusinessStatusEnum.CANCEL.getStatus())) {
|
|
|
|
|
// 流程驳回:业务状态还原为草稿,允许重新编辑和提交
|
|
|
|
|
projectPlan.setProjectPlanStatus(OAStatusEnum.DRAFT.getStatus());
|
|
|
|
|
}
|
|
|
|
|
|