sgj
5 天以前 f71f31780ed55200f3e370e61c81cfd05feb34bd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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(),"更新成功");
    }
 
 
}