package com.fzzy.regulatory.manager;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.fzzy.igds.constant.RespCodeEnum;
|
import com.fzzy.igds.data.BaseResp;
|
import com.fzzy.igds.data.IgdsBaseParam;
|
import com.fzzy.igds.domain.SnapReply;
|
import com.fzzy.igds.response.BaseResponse;
|
import com.fzzy.igds.service.SnapReplyService;
|
import com.fzzy.igds.utils.ContextUtil;
|
import com.ruoyi.common.utils.StringUtils;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.stereotype.Component;
|
|
import javax.annotation.Resource;
|
import java.util.ArrayList;
|
|
@Slf4j
|
@Component
|
public class SnapReplyManager {
|
|
@Resource
|
private SnapReplyService snapReplyService;
|
|
|
/**
|
* 分页查询数据
|
*
|
* @param param
|
* @return
|
*/
|
public Page<SnapReply> pageData(IgdsBaseParam param) {
|
if (StringUtils.isEmpty(param.getCompanyId())) {
|
param.setCompanyId(ContextUtil.getCompanyId());
|
}
|
Page<SnapReply> corePage = new Page<>(param.getPage(), param.getLimit());
|
snapReplyService.listPage(corePage, param);
|
if (null == corePage.getRecords() || corePage.getRecords().isEmpty()) {
|
return corePage.setRecords(new ArrayList<>());
|
}
|
return corePage;
|
}
|
|
|
/**
|
* 告警批复
|
*
|
* @param snapReply
|
* @return
|
*/
|
public BaseResponse updateData(SnapReply snapReply) {
|
if (null == snapReply) {
|
return new BaseResponse(RespCodeEnum.CODE_2000.getCode(),"参数不能为空");
|
}
|
if(StringUtils.isBlank(snapReply.getReplyText())){
|
return new BaseResponse(RespCodeEnum.CODE_2000.getCode(),"批复内容不能为空");
|
}
|
BaseResp baseResp = snapReplyService.updateData(snapReply);
|
if (!BaseResp.isSuccess(baseResp)) {
|
return new BaseResponse(RespCodeEnum.CODE_1111.getCode(),"更新失败");
|
}
|
return new BaseResponse(RespCodeEnum.CODE_0000.getCode(),"更新成功");
|
}
|
|
|
}
|