Browse Source

定时任务hostname

master
PoffyZhang 1 year ago
parent
commit
86ec1f44a4
11 changed files with 174 additions and 6 deletions
  1. +29
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/DocumentationController.java
  2. +52
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/DocumentationManage.java
  3. +19
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/param/DocumentationListParam.java
  4. +39
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/DocumentationVO.java
  5. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/IDocumentationService.java
  6. +6
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CheckProvincialReviewResultTask.java
  7. +5
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java
  8. +6
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java
  9. +5
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java
  10. +2
    -0
      pmapi/src/main/resources/application-dev.yml
  11. +2
    -0
      pmapi/src/main/resources/application-prod.yml

+ 29
- 0
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/DocumentationController.java View File

@@ -0,0 +1,29 @@
package com.ningdatech.pmapi.filemanage.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.filemanage.manage.DocumentationManage;
import com.ningdatech.pmapi.filemanage.model.param.DocumentationListParam;
import com.ningdatech.pmapi.filemanage.model.vo.DocumentationVO;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
* @Classname DocumentationController
* @Description
* @Date 2023/6/6 15:48
* @Author PoffyZhang
*/
@RestController
@AllArgsConstructor
@Api(tags = "档案管理-资料文档控制器")
@RequestMapping("/api/v1/file-manage/documentation")
public class DocumentationController {

private final DocumentationManage documentationManage;

@GetMapping("/list")
public PageVo<DocumentationVO> list(@ModelAttribute DocumentationListParam param){
return documentationManage.list(param);
}
}

+ 52
- 0
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/DocumentationManage.java View File

@@ -0,0 +1,52 @@
package com.ningdatech.pmapi.filemanage.manage;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.filemanage.model.entity.Documentation;
import com.ningdatech.pmapi.filemanage.model.param.DocumentationListParam;
import com.ningdatech.pmapi.filemanage.model.vo.DocumentationVO;
import com.ningdatech.pmapi.filemanage.service.IDocumentationService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @Classname DocumentationManage
* @Description
* @Date 2023/6/6 16:04
* @Author PoffyZhang
*/
@Component
@AllArgsConstructor
@Slf4j
public class DocumentationManage {

private final IDocumentationService documentationService;

/**
* 文档列表
* @param param
* @return
*/
public PageVo<DocumentationVO> list(DocumentationListParam param) {
Page<Documentation> page = param.page();
documentationService.page(page, Wrappers.lambdaQuery(Documentation.class)
.eq(Objects.nonNull(param.getGroupId()), Documentation::getGroupId, param.getGroupId()));

if(0L == page.getTotal()){
return PageVo.empty();
}

List<DocumentationVO> vos = page.getRecords().stream()
.map(d -> BeanUtil.copyProperties(d,DocumentationVO.class))
.collect(Collectors.toList());

return PageVo.of(vos,page.getTotal());
}
}

+ 19
- 0
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/param/DocumentationListParam.java View File

@@ -0,0 +1,19 @@
package com.ningdatech.pmapi.filemanage.model.param;

import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* @Classname DocumentationListParam
* @Description
* @Date 2023/6/6 16:06
* @Author PoffyZhang
*/
@Data
public class DocumentationListParam extends PagePo {

@ApiModelProperty("分组ID")
private Long groupId;

}

+ 39
- 0
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/DocumentationVO.java View File

@@ -0,0 +1,39 @@
package com.ningdatech.pmapi.filemanage.model.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;

/**
* @Classname Documentation
* @Description
* @Date 2023/6/6 14:41
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "nd_documentation", description = "资料文档")
public class DocumentationVO {

@ApiModelProperty("主键")
private Long id;

@ApiModelProperty("文件名")
private String fileName;

@ApiModelProperty("上传人")
private String creatBy;

@ApiModelProperty("上传时间")
private LocalDateTime creatOn;

@ApiModelProperty("文档大小 kb")
private Long size;

@ApiModelProperty("文档分类ID")
private Long groupId;

@ApiModelProperty("排序")
private Integer sort;
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/service/IDocumentationService.java View File

@@ -0,0 +1,9 @@
package com.ningdatech.pmapi.filemanage.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.filemanage.model.entity.Documentation;

public interface IDocumentationService extends IService<Documentation> {


}

+ 6
- 2
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CheckProvincialReviewResultTask.java View File

@@ -16,6 +16,7 @@ import com.ningdatech.pmapi.scheduler.contants.TaskContant;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.net.InetAddress;
@@ -40,10 +41,13 @@ public class CheckProvincialReviewResultTask {
private final IProjectService projectService;
private final StateMachineUtils stateMachineUtils;

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

@Scheduled(cron = "0 */2 * * * ?")
public void statusFlow() throws UnknownHostException {
//测试暂时用自己电脑HOST
if (TaskContant.Host.HOST_207.equals(InetAddress.getLocalHost().getHostName())) {
//
if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) {
//1. 定时取 省级部门联审中的项目 去取项目
List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode())


+ 5
- 1
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java View File

@@ -22,6 +22,7 @@ import com.wflow.workflow.service.WflowFormsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@@ -48,9 +49,12 @@ public class InitProcessTask {

private final RegionCacheHelper regionCacheHelper;

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

@Scheduled(cron = "0 14 16 07 3 ?")
public void doTask() throws UnknownHostException {
if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) {
if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) {
log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务开始");
StopWatch stopWatch = new StopWatch();
stopWatch.start();


+ 6
- 2
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java View File

@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.staging.service.IProjectStagingService;
import com.ningdatech.pmapi.staging.utils.ProjectStatusFlowMapUtil;
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;

@@ -40,10 +41,13 @@ public class ProjectStatusFlowTask {

private final ProjectStatusFlowMapUtil projectStatusFlowMapUtil;

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

@Scheduled(cron = "0 */1 * * * ?")
public void statusFlow() throws UnknownHostException {
//测试暂时用自己207
if (TaskContant.Host.HOST_207.equals(InetAddress.getLocalHost().getHostName())) {
//
if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) {
//1. 定时取 项目暂存表的数据 去进行状态继续流转
List<ProjectStaging> stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class)
.eq(ProjectStaging::getDead,Boolean.FALSE)


+ 5
- 1
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java View File

@@ -10,6 +10,7 @@ import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService;
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo;
import com.ningdatech.zwdd.client.ZwddClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@@ -36,10 +37,13 @@ public class WorkNoticeFlowTask {
private final INdWorkNoticeStagingService workNoticeStagingService;
private final ZwddClient zwddClient;

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

@Scheduled(cron = "0 */1 * * * ?")
public void statusFlow() throws UnknownHostException {
//测试暂时用自己电脑HOST
if (TaskContant.Host.HOST_207.equals(InetAddress.getLocalHost().getHostName())) {
if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) {
//1. 定时取 工作通知暂存表的数据进行发送
List<WorkNoticeStaging> stagingList = workNoticeStagingService.list(Wrappers.lambdaQuery(WorkNoticeStaging.class)
.eq(WorkNoticeStaging::getDead, Boolean.FALSE)


+ 2
- 0
pmapi/src/main/resources/application-dev.yml View File

@@ -208,3 +208,5 @@ irs:
access-key: 3
secret-key: 4
api-url: https://ibcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf

hostname: iZbp13nwyvib53j4j1p2xoZ

+ 2
- 0
pmapi/src/main/resources/application-prod.yml View File

@@ -214,3 +214,5 @@ irs:
access-key: 3
secret-key: 4
api-url: https://ibcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf

hostname: iZ6mx01gyeodd80imxd2gbZ

Loading…
Cancel
Save