瀏覽代碼

运维项目 推送 预警

master
PoffyZhang 1 年之前
父節點
當前提交
b80efd76ce
共有 14 個文件被更改,包括 549 次插入18 次删除
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java
  2. +22
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
  3. +4
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java
  4. +17
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java
  5. +23
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java
  6. +104
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectBaseinfoDTO.java
  7. +50
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectSaveDTO.java
  8. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectBaseinfo.java
  9. +116
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectBaseinfoVO.java
  10. +50
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectDetailVO.java
  11. +48
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java
  12. +102
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java
  13. +8
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java
  14. +1
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java 查看文件

@@ -48,5 +48,5 @@ public interface UserInfoHelper {
*/
String getUserEmpPosUnitCode(Long userId);

List<UserInfo> getUsersByRoleType(String roleType);
}

+ 22
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java 查看文件

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
@@ -13,6 +14,7 @@ import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.pmapi.sys.mapper.RoleMapper;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.sys.model.entity.UserRole;
import com.ningdatech.pmapi.sys.service.IRoleService;
import com.ningdatech.pmapi.sys.service.IUserRoleService;
import com.ningdatech.pmapi.user.constant.UserAvailableEnum;
import com.ningdatech.pmapi.user.entity.UserInfo;
@@ -41,6 +43,8 @@ public class UserInfoHelperImpl implements UserInfoHelper {
private final IUserRoleService iUserRoleService;
private final RoleMapper roleMapper;

private final IRoleService roleService;


@Override
public String getOrganizationCode(Long userId) {
@@ -234,4 +238,22 @@ public class UserInfoHelperImpl implements UserInfoHelper {
UserFullInfoDTO userFullInfo = getUserFullInfo(userId);
return userFullInfo.getEmpPosUnitCode();
}

@Override
public List<UserInfo> getUsersByRoleType(String roleType) {
Role regionRole = roleService.getOne(Wrappers.lambdaQuery(Role.class)
.eq(Role::getCode, roleType)
.last(BizConst.LIMIT_1));
if(Objects.isNull(regionRole)){
return Collections.emptyList();
}
List<UserRole> userRoles = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class)
.eq(UserRole::getRoleId, regionRole.getId()));
if(CollUtil.isEmpty(userRoles)){
return Collections.emptyList();
}
List<Long> userIds = userRoles.stream().map(UserRole::getUserId)
.collect(Collectors.toList());
return userInfoService.listByIds(userIds);
}
}

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

@@ -4,8 +4,10 @@ import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.gov.manage.GovProjectCollectionManage;
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO;
import com.ningdatech.pmapi.gov.model.dto.GovOperationProjectSaveDTO;
import com.ningdatech.pmapi.gov.model.vo.GovBizProjectDetailVO;
import com.ningdatech.pmapi.gov.model.vo.GovBizProjectListVO;
import com.ningdatech.pmapi.gov.model.vo.GovOperationProjectDetailVO;
import com.ningdatech.pmapi.gov.model.vo.GovProjectDictionaryVO;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.scheduler.task.SynProjectCollectionTask;
@@ -66,7 +68,7 @@ public class GovProjectCollectionController {

@GetMapping("/operation/detail/{projId}")
@ApiOperation("运维项目归集详情")
public GovBizProjectDetailVO operationDetail(@PathVariable String projId) {
public GovOperationProjectDetailVO operationDetail(@PathVariable String projId) {
return collectionManage.operationDetail(projId);
}

@@ -80,7 +82,7 @@ public class GovProjectCollectionController {
@PostMapping("/operation/save")
@ApiOperation("运维项目归集保存")
@WebLog("运维项目归集保存")
public String operationSave(@Valid @RequestBody GovBizProjectSaveDTO saveDTO) {
public String operationSave(@Valid @RequestBody GovOperationProjectSaveDTO saveDTO) {
return collectionManage.operationSave(saveDTO,null);
}



+ 17
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java 查看文件

@@ -62,6 +62,17 @@ public class ProjectConvert {
return req;
}

public static ProjectPushReq convertWithConvertPdf(GovOperationProjectDetailVO vo) {
ProjectPushReq req = new ProjectPushReq();
req.setBaseinfo(convertBaseVo(vo.getBaseinfo(),BizProjectContant.EFFECTIVE_CODE));
req.setApply(convertApplyVoWithConvertPdf(vo.getApply()));
req.setApprove(convertApproveVoWithConvertPdf(vo.getApprove()));
req.setCimplement(convertCimplementVoWithConvertPdf(vo.getCimplement()));
req.setMimplement(convertMimplementVoWithConvertPdf(vo.getMimplement()));
req.setProcures(convertProcuresVoWithConvertPdf(vo.getProcures()));
return req;
}

private static List<ProjectProcureReq> convertProcures(List<GovBizProjectProcureDTO> procures) {
if(CollUtil.isEmpty(procures)){
return Collections.emptyList();
@@ -430,4 +441,10 @@ public class ProjectConvert {
req.setIsEffective(isEffective);
return req;
}

public static ProjectBaseInfoReq convertBaseVo(GovOperationProjectBaseinfoVO baseinfo,String isEffective) {
ProjectBaseInfoReq req = BeanUtil.copyProperties(baseinfo,ProjectBaseInfoReq.class);
req.setIsEffective(isEffective);
return req;
}
}

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

@@ -441,8 +441,8 @@ public class GovProjectCollectionManage {
return res;
}

public GovBizProjectDetailVO operationDetail(String projId) {
GovBizProjectDetailVO res = new GovBizProjectDetailVO();
public GovOperationProjectDetailVO operationDetail(String projId) {
GovOperationProjectDetailVO res = new GovOperationProjectDetailVO();
//1.先查 基本信息
GovOperationProjectBaseinfo baseinfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class)
.eq(GovOperationProjectBaseinfo::getBaseProjId, projId)
@@ -454,7 +454,7 @@ public class GovProjectCollectionManage {
}
res.setBaseProjId(baseinfo.getBaseProjId());
res.setBaseProjName(baseinfo.getBaseProjName());
res.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoVO.class));
res.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovOperationProjectBaseinfoVO.class));

//2.再查 申报信息
GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class)
@@ -841,18 +841,18 @@ public class GovProjectCollectionManage {
* @param user
* @return
*/
public String operationSave(GovBizProjectSaveDTO saveDTO, UserInfoDetails user) {
public String operationSave(GovOperationProjectSaveDTO saveDTO, UserInfoDetails user) {
if(Objects.isNull(user)){
user = LoginUserUtil.loginUserDetail();
}

GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo();
GovOperationProjectBaseinfoDTO base = saveDTO.getBaseinfo();
String baseProjId = saveDTO.getBaseProjId();
String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST;
String baseProjName = base.getBaseProjName();

//1.保存基本信息
GovBizProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo();
GovOperationProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo();
baseinfo.setBaseProjId(baseProjId);
baseinfo.setBaseProjName(baseProjName);
baseinfo.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE);
@@ -1379,6 +1379,23 @@ public class GovProjectCollectionManage {
}
}

public void pushProjectVo(GovOperationProjectDetailVO vo) {
String url = pushUrl;
ProjectPushReq req = ProjectConvert.convertWithConvertPdf(vo);
try{
log.info("推送消息体 {} ,{},{}",vo.getBaseProjId(),url, JSON.toJSONString(req));
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
headers.setContentType(type);
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
HttpEntity<ProjectPushReq> formEntity = new HttpEntity<ProjectPushReq>(req, headers);
ResponseEntity<String> response = restTemplate.postForEntity(url, formEntity, String.class);
log.info("推送结果 {} :{}",vo.getBaseProjId(),response);
}catch (Exception e){
log.info("推送失败,{}",e.getMessage());
}
}

/**
* 把项目置为无效
* @param baseinfo


+ 104
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectBaseinfoDTO.java 查看文件

@@ -0,0 +1,104 @@
package com.ningdatech.pmapi.gov.model.dto;

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

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 项目基本信息表
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@ApiModel(value = "GovBizProjectBaseinfo对象", description = "项目基本信息表")
public class GovOperationProjectBaseinfoDTO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("项目编号")
private String baseProjId;

@ApiModelProperty("是否推送 省局归集")
private Boolean push;

@ApiModelProperty("基本项目名称")
private String baseProjName;

@ApiModelProperty("基本项目区域code")
private String baseAreaCode;

@ApiModelProperty("基本项目区域名")
private String baseAreaName;

@ApiModelProperty("是否涉密")
private String baseProjIsConfidentiality;

@ApiModelProperty("项目类型")
private String baseProjType;

@ApiModelProperty("内容类别")
private String baseConstructionType;

@ApiModelProperty("项目状态")
private String baseProjSetProg;

@ApiModelProperty("信息是否有效")
private String isEffective;

@ApiModelProperty("上级主管单位")
private String baseProvManDeprt;

@ApiModelProperty("上级主管单位钉id")
private String baseProvManDeprtDing;

@ApiModelProperty("是否省级 1省级 2非省级")
private Integer baseProvManDeprtType;

@ApiModelProperty("本级主管单位")
private String baseManDeprt;

@ApiModelProperty("本级主管单位ding code")
private String baseManDeprtDing;

@ApiModelProperty("本级主管单位社会统一信用代码")
private String baseManDepartUsci;

@ApiModelProperty("建设单位")
private String baseBuildDeprt;

@ApiModelProperty("建设单位Ding Code")
private String baseBuildDeprtDing;

@ApiModelProperty("建设单位社会统一信用代码")
private String baseBuildDepartUsci;

@ApiModelProperty("项目负责人")
private String baseProjPrincipal;

@ApiModelProperty("项目负责人手机号")
private String baseProjPrincipalCall;

@ApiModelProperty("项目联系人")
private String baseProjContacts;

@ApiModelProperty("项目联系人联系方式")
private String baseProjContactsCall;

@ApiModelProperty("数据来源")
private String areaCode;

@ApiModelProperty("生产时间")
private LocalDateTime bizTime;

@ApiModelProperty("操作标记")
private String op;

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;
}

+ 50
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectSaveDTO.java 查看文件

@@ -0,0 +1,50 @@
package com.ningdatech.pmapi.gov.model.dto;

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

import java.io.Serializable;
import java.util.List;

/**
* <p>
* 项目归集总VO
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@ApiModel(value = "GovOperationProjectSaveDTO", description = "运维项目总详情DTO")
public class GovOperationProjectSaveDTO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("项目编号")
private String baseProjId;

@ApiModelProperty("基本项目名称")
private String baseProjName;

@ApiModelProperty("草稿id")
private Long draftId;

@ApiModelProperty("项目基本信息")
private GovOperationProjectBaseinfoDTO baseinfo;

@ApiModelProperty("项目申报信息")
private GovBizProjectApplyDTO apply;

@ApiModelProperty("项目审批信息")
private GovBizProjectApproveDTO approve;

@ApiModelProperty("实施项目实施信息")
private GovBizProjectCimplementDTO cimplement;

@ApiModelProperty("运维项目实施信息")
private GovBizProjectMimplementDTO mimplement;

@ApiModelProperty("项目采购信息")
private List<GovBizProjectProcureDTO> procures;
}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectBaseinfo.java 查看文件

@@ -29,6 +29,9 @@ public class GovOperationProjectBaseinfo implements Serializable {
@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("是否推送 省局归集")
private Boolean push;

@ApiModelProperty("项目编号")
private String baseProjId;



+ 116
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectBaseinfoVO.java 查看文件

@@ -0,0 +1,116 @@
package com.ningdatech.pmapi.gov.model.vo;

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

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 项目基本信息表
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@ApiModel(value = "GovBizProjectBaseinfo对象", description = "项目基本信息表")
public class GovOperationProjectBaseinfoVO implements Serializable {

private static final long serialVersionUID = 1L;

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

@ApiModelProperty("是否推送 省局归集")
private Boolean push;

@ApiModelProperty("项目编号")
private String baseProjId;

@ApiModelProperty("基本项目名称")
private String baseProjName;

@ApiModelProperty("基本项目区域code")
private String baseAreaCode;

@ApiModelProperty("基本项目区域名")
private String baseAreaName;

@ApiModelProperty("是否涉密")
private String baseProjIsConfidentiality;

@ApiModelProperty("项目类型")
private String baseProjType;

@ApiModelProperty("内容类别")
private String baseConstructionType;

@ApiModelProperty("项目状态")
private String baseProjSetProg;

@ApiModelProperty("信息是否有效")
private String isEffective;

@ApiModelProperty("是否省级 1省级 2非省级")
private Integer baseProvManDeprtType;

@ApiModelProperty("上级主管单位")
private String baseProvManDeprt;

@ApiModelProperty("上级主管单位钉id")
private String baseProvManDepartDing;

@ApiModelProperty("本级主管单位")
private String baseManDeprt;

@ApiModelProperty("本级主管单位ding code")
private String baseManDeprtDing;

@ApiModelProperty("本级主管单位社会统一信用代码")
private String baseManDepartUsci;

@ApiModelProperty("建设单位")
private String baseBuildDeprt;

@ApiModelProperty("建设单位Ding Code")
private String baseBuildDeprtDing;

@ApiModelProperty("建设单位社会统一信用代码")
private String baseBuildDepartUsci;

@ApiModelProperty("项目负责人")
private String baseProjPrincipal;

@ApiModelProperty("项目负责人手机号")
private String baseProjPrincipalCall;

@ApiModelProperty("项目联系人")
private String baseProjContacts;

@ApiModelProperty("项目联系人联系方式")
private String baseProjContactsCall;

@ApiModelProperty("数据来源")
private String areaCode;

@ApiModelProperty("生产时间")
private LocalDateTime bizTime;

@ApiModelProperty("操作标记")
private String op;

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;

@ApiModelProperty("逻辑删除")
private Boolean deleted;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("最后修改人")
private String updateBy;
}

+ 50
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectDetailVO.java 查看文件

@@ -0,0 +1,50 @@
package com.ningdatech.pmapi.gov.model.vo;

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

import java.io.Serializable;
import java.util.List;

/**
* <p>
* 运维项目总详情VO
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@ApiModel(value = "GovOperationProjectDetailVO", description = "运维项目总详情VO")
public class GovOperationProjectDetailVO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("项目编号")
private String baseProjId;

@ApiModelProperty("基本项目名称")
private String baseProjName;

@ApiModelProperty("草稿id")
private Long draftId;

@ApiModelProperty("项目基本信息")
private GovOperationProjectBaseinfoVO baseinfo;

@ApiModelProperty("项目申报信息")
private GovBizProjectApplyVO apply;

@ApiModelProperty("项目审批信息")
private GovBizProjectApproveVO approve;

@ApiModelProperty("实施项目实施信息")
private GovBizProjectCimplementVO cimplement;

@ApiModelProperty("运维项目实施信息")
private GovBizProjectMimplementVO mimplement;

@ApiModelProperty("项目采购信息")
private List<GovBizProjectProcureVO> procures;
}

+ 48
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java 查看文件

@@ -5,9 +5,7 @@ import com.ningdatech.basic.function.VUtils;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.gov.contants.BizProjectContant;
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO;
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO;
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO;
import com.ningdatech.pmapi.gov.model.dto.*;
import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo;
import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectBaseinfo;
import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService;
@@ -169,4 +167,51 @@ public class GenerateProjectCodeUtil {
// 生成20位的项目编号
return currentCode + String.format(ProjectCodeContant.SHUZI_5, max);
}

public String generateProjectCode(GovOperationProjectSaveDTO dto) {
// 获取所属行政区划代码(9位)
GovOperationProjectBaseinfoDTO baseinfo = dto.getBaseinfo();
GovBizProjectApplyDTO apply = dto.getApply();

VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!");
VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!");

String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_LS + BizConst.NINE_AREA_CODE_LAST);
// 获取建设年度 (10-13)
String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear()
: String.valueOf(LocalDateTime.now().getYear());
// 14-15 项目类型
String projectType = StringUtils.isNotBlank(baseinfo.getBaseProjType()) ? baseinfo.getBaseProjType() :
BizProjectContant.ProjectCollection.IS_EFFECTIVE;
String currentCode = areaCode + year + projectType;
// 16-20 项目序号00001
//要查询 两边的项目序号
Long max = 0L;
GovBizProjectBaseinfo baseMax = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.like(GovBizProjectBaseinfo::getBaseProjId, currentCode)
.orderByDesc(GovBizProjectBaseinfo::getBaseProjId)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(baseMax) && StringUtils.isNotBlank(baseMax.getBaseProjId())){
max = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5));
}
GovOperationProjectBaseinfo operationBaseMax = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class)
.like(GovOperationProjectBaseinfo::getBaseProjId, currentCode)
.orderByDesc(GovOperationProjectBaseinfo::getBaseProjId)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(operationBaseMax) && StringUtils.isNotBlank(operationBaseMax.getBaseProjId())){
Long operationMax = Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5));
max = Math.max(max,operationMax);
}
Project projectMax = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.like(Project::getProjectCode, currentCode)
.orderByDesc(Project::getProjectCode)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(projectMax) && StringUtils.isNotBlank(projectMax.getProjectCode())){
Long projectMaxCode = Long.valueOf(projectMax.getProjectCode().substring(projectMax.getProjectCode().length() - 5));
max = Math.max(max,projectMaxCode);
}
max = max + 1;
// 生成20位的项目编号
return currentCode + String.format(ProjectCodeContant.SHUZI_5, max);
}
}

+ 102
- 4
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java 查看文件

@@ -8,18 +8,19 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract;
import com.ningdatech.pmapi.projectdeclared.model.entity.Operation;
import com.ningdatech.pmapi.projectdeclared.service.IContractService;
import com.ningdatech.pmapi.projectdeclared.service.IOperationService;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.WarningFlowTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.WarningNoticeTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.WarningOperationTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.*;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration;
import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.sys.manage.EarlyWarningManage;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.wflow.bean.entity.WflowEarlyWarning;
import com.wflow.enums.WarningRuleTypeEnum;
@@ -63,6 +64,10 @@ public class EarlyWarningInstanceNotStartTask {

private final IUserInfoService userInfoService;

private final IProjectRenewalFundDeclarationService renewalFundDeclarationService;

private final UserInfoHelper userInfoHelper;

@Scheduled(cron = "0 0/2 * * * ?")
public void doEarlyWarningDeclared() throws UnknownHostException {
if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) {
@@ -331,4 +336,97 @@ public class EarlyWarningInstanceNotStartTask {
stopWatch.stop();
log.info("=========== 预警实施超时任务结束 耗时{}s", stopWatch.getTotalTimeSeconds());
}

/**
* 续建项目资金 超时未审批定时器
* @throws UnknownHostException
*/
@Scheduled(cron = "20 0/2 * * * ?")
public void doEarlyWarningRenewalFund() throws UnknownHostException {
if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) {
return;
}

log.info("=========== 预警续建资金项目 超时任务开始 ========");
StopWatch stopWatch = new StopWatch();
stopWatch.start();

// 1.查询 填报的 预警规则 填报类型的 每个区域 续建项目资金审批
List<WflowEarlyWarning> warnings = earlyWarningService.list(Wrappers.lambdaQuery(WflowEarlyWarning.class)
.eq(WflowEarlyWarning::getRuleType, WarningRuleTypeEnum.RENEWAL_FUND.getCode()));
for(WflowEarlyWarning warning : warnings){
//2. 取出rule的数据
if(!warning.getIsOpen()){
log.info(warning.getId() + " 此规则关闭了");
continue;
}

String noticeMethod = warning.getNoticeMethod();
if(StringUtils.isBlank(noticeMethod) ||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) &&
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){
log.info("通知方式为空或者错误!");
return;
}

String noticeContent = warning.getNoticeContent();
String rule = warning.getRule();
if(StringUtils.isNotBlank(rule)){
JSONArray ruleArray = JSON.parseArray(rule);
if(CollUtil.isNotEmpty(ruleArray)){
ruleArray.forEach(r -> {
JSONObject rJson = JSON.parseObject(JSON.toJSONString(r));
Integer time = rJson.getInteger("time");
if(Objects.isNull(time)){
log.info("规则数据 错误 :{}",rJson);
return;
}

//得出 对应待提交的续建项目区域信息
String areaCode = warning.getAreaCode();
//测试先用分钟
//查询 所有这个区域的项目 未提交的项目
List<ProjectRenewalFundDeclaration> needNextProjects = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.eq(ProjectRenewalFundDeclaration::getRegionCode, areaCode)
.eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE)
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PENDING.getCode()));

//需要发通知的项目
List<ProjectRenewalFundDeclaration> needToWaringProjects = needNextProjects.stream()
.filter(p -> {
//初验
if(Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60
Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60
return Boolean.TRUE;
}

return Boolean.FALSE;
})
.collect(Collectors.toList());

if(StringUtils.isBlank(noticeMethod) ||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) &&
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){
log.info("通知方式为空或者错误!");
return;
}

for(ProjectRenewalFundDeclaration needToWaringProject : needToWaringProjects){
Project project = projectService.getProjectByCode(needToWaringProject.getProjectCode());
//去预警通知 发给区管
List<UserInfo> users = userInfoHelper.getUsersByRoleType(RoleEnum.REGION_MANAGER.name());
for(UserInfo user : users){
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,time,null,
needToWaringProject.getUpdateOn(),user.getEmployeeCode(),project,
WarningRuleTypeEnum.OPERATION_WARNING.getCode());
}
}
});
}
}
}

stopWatch.stop();
log.info("=========== 预警续建资金项目 超时任务结束 耗时{}s", stopWatch.getTotalTimeSeconds());
}
}

+ 8
- 1
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java 查看文件

@@ -9,6 +9,8 @@ import com.ningdatech.pmapi.gov.manage.GovProjectCollectionManage;
import com.ningdatech.pmapi.gov.model.entity.*;
import com.ningdatech.pmapi.gov.model.vo.GovBizProjectDetailVO;
import com.ningdatech.pmapi.gov.model.vo.GovBizProjectListVO;
import com.ningdatech.pmapi.gov.model.vo.GovOperationProjectBaseinfoVO;
import com.ningdatech.pmapi.gov.model.vo.GovOperationProjectDetailVO;
import com.ningdatech.pmapi.gov.service.*;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import lombok.RequiredArgsConstructor;
@@ -106,7 +108,12 @@ public class SynProjectCollectionTask {
PageVo<GovBizProjectListVO> operationList = collectionManage.operationList(req);
log.info("operation list size :{}",operationList.getTotal());
for(GovBizProjectListVO vo : operationList.getRecords()){
GovBizProjectDetailVO operationDetail = collectionManage.operationDetail(vo.getBaseProjId());
GovOperationProjectDetailVO operationDetail = collectionManage.operationDetail(vo.getBaseProjId());
GovOperationProjectBaseinfoVO baseinfo = operationDetail.getBaseinfo();
if(Objects.isNull(baseinfo) || Objects.isNull(baseinfo.getPush()) ||
Boolean.FALSE.equals(baseinfo.getPush())){
log.info("此运维项目不用推送:" + vo.getBaseProjId());
}
collectionManage.pushProjectVo(operationDetail);
}



+ 1
- 1
pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java 查看文件

@@ -109,7 +109,7 @@ public class ProjectRemoveTest extends AppTests {

@Test
public void test(){
List<String> projectCodes = Lists.newArrayList("33112600020240100001");
List<String> projectCodes = Lists.newArrayList("33112600020230100002");

for(String projectCode : projectCodes){
//项目


Loading…
取消
儲存