瀏覽代碼

debug新运维项目

tags/24080901
PoffyZhang 1 年之前
父節點
當前提交
64accbc080
共有 3 個文件被更改,包括 99 次插入1 次删除
  1. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java
  2. +45
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java
  3. +47
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningProjectTask.java

+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java 查看文件

@@ -96,6 +96,13 @@ public class GovProjectCollectionController {
return collectionManage.remove(projId);
}

@PostMapping("/operation/remove/{projId}")
@ApiOperation("运维项目归集删除")
@WebLog("运维项目归集删除")
public String operationRemove(@PathVariable String projId) {
return collectionManage.operationRemove(projId);
}

@GetMapping("/draft-list")
@ApiOperation("项目归集草稿箱列表")
public PageVo<GovBizProjectListVO> draftList(ProjectListReq req) {


+ 45
- 1
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java 查看文件

@@ -914,10 +914,11 @@ public class GovProjectCollectionManage {
GovOperationProjectBaseinfo saveBase = BeanUtil.copyProperties(baseinfo,GovOperationProjectBaseinfo.class);
saveBase.setBaseProjName(baseProjName);
saveBase.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE);
saveBase.setBaseAreaCode(baseAreaCode);
if(Objects.nonNull(oldBaseInfo)){
saveBase.setId(oldBaseInfo.getId());
saveBase.setBaseAreaCode(null);
}else{
saveBase.setBaseAreaCode(baseAreaCode);
saveBase.setTongTime(LocalDateTime.now());
saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(),RegionConst.RL_COUNTY));
}
@@ -1354,6 +1355,49 @@ public class GovProjectCollectionManage {
.set(GovBizProjectProcure::getUpdateBy,username));
return BizConst.OP_SUCCESS;
}
public String operationRemove(String projId) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
String username = user.getUsername();

GovOperationProjectBaseinfo baseinfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class)
.eq(GovOperationProjectBaseinfo::getBaseProjId, projId)
.last(BizConst.LIMIT_1));

VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("运维项目不存在!");

//改正逻辑删除
baseinfo.setDeleted(Boolean.TRUE);
baseinfo.setUpdateBy(username);
baseinfo.setUpdateOn(LocalDateTime.now());
operationProjectBaseinfoService.updateById(baseinfo);

projectApplyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjId,projId)
.set(GovBizProjectApply::getDeleted,Boolean.TRUE)
.set(GovBizProjectApply::getUpdateOn,LocalDateTime.now())
.set(GovBizProjectApply::getUpdateBy,username));
approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjId,projId)
.set(GovBizProjectApprove::getDeleted,Boolean.TRUE)
.set(GovBizProjectApprove::getUpdateOn,LocalDateTime.now())
.set(GovBizProjectApprove::getUpdateBy,username));
cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class)
.eq(GovBizProjectCimplement::getBaseProjId,projId)
.set(GovBizProjectCimplement::getDeleted,Boolean.TRUE)
.set(GovBizProjectCimplement::getUpdateOn,LocalDateTime.now())
.set(GovBizProjectCimplement::getUpdateBy,username));
mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class)
.eq(GovBizProjectMimplement::getBaseProjId,projId)
.set(GovBizProjectMimplement::getDeleted,Boolean.TRUE)
.set(GovBizProjectMimplement::getUpdateOn,LocalDateTime.now())
.set(GovBizProjectMimplement::getUpdateBy,username));
procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId,projId)
.set(GovBizProjectProcure::getDeleted,Boolean.TRUE)
.set(GovBizProjectProcure::getUpdateOn,LocalDateTime.now())
.set(GovBizProjectProcure::getUpdateBy,username));
return BizConst.OP_SUCCESS;
}

/**
* 项目归集 草稿箱删除


+ 47
- 0
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningProjectTask.java 查看文件

@@ -0,0 +1,47 @@
package com.ningdatech.pmapi.scheduler.task;

import cn.hutool.core.date.StopWatch;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;

/**
* @author ZPF
* @date 2023/8/3 上午9:53
* 预警填报 超时任务
*/
@Component
@Slf4j
@RequiredArgsConstructor
public class EarlyWarningProjectTask {

private final IProjectService projectService;

@Value("${hostname}")
private String HOST_NAME;

@Scheduled(fixedDelay = 12000)
public void doEarlyWarningDeclared() throws UnknownHostException {
if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) {
return;
}

log.info("=========== 预警项目维度任务开始 ========");
StopWatch stopWatch = new StopWatch();
stopWatch.start();

List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE));

stopWatch.stop();
log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds());
}
}

Loading…
取消
儲存