ソースを参照

Merge branch '20230731_ls2_operation+early_warning+safety_risk+portrait' of http://git.ningdatech.com/liushuai/project-management into dev

master
PoffyZhang 1年前
コミット
b4a0a4969e
6個のファイルの変更109行の追加2行の削除
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java
  2. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/EarlyWarningController.java
  3. +35
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/WarningListReq.java
  4. +23
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/WflowEarlyWarningRecordsVO.java
  5. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IEarlyWarningRecordsService.java
  6. +34
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/EarlyWarningRecordsServiceImpl.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java ファイルの表示

@@ -128,7 +128,7 @@ public class EarlyWarningListener {
* 转换出 通知的内容
* @param noticeContent
* @param projectName
* @param byCode
* @param instTypeEnum
* @param timeout
* @return
*/


+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/EarlyWarningController.java ファイルの表示

@@ -1,6 +1,10 @@
package com.ningdatech.pmapi.sys.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.sys.model.req.WarningListReq;
import com.ningdatech.pmapi.sys.model.vo.WflowEarlyWarningRecordsVO;
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService;
import com.wflow.bean.dto.WflowEarlyWarningDTO;
import com.wflow.bean.vo.WflowEarlyWarningVO;
import com.wflow.service.IEarlyWarningService;
@@ -29,6 +33,8 @@ public class EarlyWarningController {

private final IEarlyWarningService earlyWarningService;

private final IEarlyWarningRecordsService earlyWarningRecordsService;

@ApiOperation(value = "预警规则获取", notes = "预警规则获取")
@GetMapping("/detail/{areaCode}")
public List<WflowEarlyWarningVO> detail(@PathVariable String areaCode) {
@@ -41,4 +47,10 @@ public class EarlyWarningController {
public String save(@Validated @RequestBody WflowEarlyWarningDTO dto) {
return earlyWarningService.saveByDto(dto);
}

@ApiOperation(value = "预警记录查询", notes = "预警记录查询")
@GetMapping("/records/{ruleType}")
public PageVo<WflowEarlyWarningRecordsVO> records(@PathVariable Integer ruleType, WarningListReq req) {
return earlyWarningRecordsService.records(ruleType,req);
}
}

+ 35
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/WarningListReq.java ファイルの表示

@@ -0,0 +1,35 @@
package com.ningdatech.pmapi.sys.model.req;

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

import java.time.LocalDateTime;

/**
* <p>
* WarningListReq
* </p>
*
* @author ZPF
* @since 00:32 2022/7/23
*/
@Data
@ApiModel("预警记录查询参数类")
@EqualsAndHashCode(callSuper = true)
public class WarningListReq extends PagePo {

@ApiModelProperty("项目名称")
private String projectName;

@ApiModelProperty("申报单位")
private String buildOrgName;

@ApiModelProperty("提醒开始时间")
private LocalDateTime startTime;

@ApiModelProperty("提醒结束时间")
private LocalDateTime endTime;
}

+ 23
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/WflowEarlyWarningRecordsVO.java ファイルの表示

@@ -1,14 +1,17 @@
package com.ningdatech.pmapi.sys.model.vo;

import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum;
import com.wflow.enums.WarningRuleTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
* 实体类
@@ -103,4 +106,23 @@ public class WflowEarlyWarningRecordsVO implements Serializable {
private LocalDateTime updateOn;
private String updateBy;

public String getInstTypeName(){
if(Objects.nonNull(this.instType)){
InstTypeEnum instEnum = InstTypeEnum.getByCode(this.instType);
if(Objects.nonNull(instEnum)){
return instEnum.getDesc();
}
}
return StringUtils.EMPTY;
}

public String getRuleTypeName(){
if(Objects.nonNull(this.ruleType)){
WarningRuleTypeEnum warningEnum = WarningRuleTypeEnum.checkByCode(this.instType);
if(Objects.nonNull(warningEnum)){
return warningEnum.getDesc();
}
}
return StringUtils.EMPTY;
}
}

+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IEarlyWarningRecordsService.java ファイルの表示

@@ -1,11 +1,15 @@
package com.ningdatech.pmapi.sys.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords;
import com.ningdatech.pmapi.sys.model.req.WarningListReq;
import com.ningdatech.pmapi.sys.model.vo.WflowEarlyWarningRecordsVO;

/**
* @author PoffyZhang
*/
public interface IEarlyWarningRecordsService extends IService<WflowEarlyWarningRecords> {

PageVo<WflowEarlyWarningRecordsVO> records(Integer ruleType, WarningListReq req);
}

+ 34
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/EarlyWarningRecordsServiceImpl.java ファイルの表示

@@ -1,13 +1,25 @@
package com.ningdatech.pmapi.sys.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.sys.mapper.EarlyWarningRecordsMapper;
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords;
import com.ningdatech.pmapi.sys.model.req.WarningListReq;
import com.ningdatech.pmapi.sys.model.vo.WflowEarlyWarningRecordsVO;
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

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


/**
* <p>
@@ -23,4 +35,26 @@ import org.springframework.stereotype.Service;
public class EarlyWarningRecordsServiceImpl extends ServiceImpl<EarlyWarningRecordsMapper, WflowEarlyWarningRecords>
implements IEarlyWarningRecordsService {

@Override
public PageVo<WflowEarlyWarningRecordsVO> records(Integer ruleType, WarningListReq req) {
Page<WflowEarlyWarningRecords> page = req.page();
LambdaQueryWrapper<WflowEarlyWarningRecords> wrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class)
.eq(WflowEarlyWarningRecords::getRuleType, ruleType)
.like(StringUtils.isNotBlank(req.getProjectName()), WflowEarlyWarningRecords::getProjectName, req.getProjectName())
.like(StringUtils.isNotBlank(req.getBuildOrgName()), WflowEarlyWarningRecords::getBuildOrgName, req.getBuildOrgName())
.ge(Objects.nonNull(req.getStartTime()),WflowEarlyWarningRecords::getWarningTime,req.getStartTime())
.le(Objects.nonNull(req.getEndTime()),WflowEarlyWarningRecords::getWarningTime,req.getEndTime());

this.page(page,wrapper);

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

List<WflowEarlyWarningRecordsVO> res = page.getRecords().stream()
.map(p -> BeanUtil.copyProperties(p,WflowEarlyWarningRecordsVO.class))
.collect(Collectors.toList());

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

読み込み中…
キャンセル
保存