whyclxw
2025-05-28 e16302f9d475c7cc4dd18c5abf1a23cb5502e362
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
68
package com.whyc.service;
 
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.AlarmDaoFactory;
import com.whyc.dto.Response;
import com.whyc.dto.paramter.AlarmPar;
import com.whyc.mapper.BattAlarmDataVerifyMapper;
import com.whyc.pojo.BattAlarmDataVerify;
import com.whyc.pojo.WorkflowMain;
import com.whyc.util.ActionUtil;
import com.whyc.util.MessageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
 
@Service
public class BattAlarmDataVerifyService {
 
    @Resource
    private BattAlarmDataVerifyMapper mapper;
 
    @Autowired
    @Lazy
    private AlarmManualClearService clearService;
 
 
    public Response<Object> getPage(AlarmPar param) {
        List<Integer> allMainIds = clearService.getAllMainIds();
        //int userId = ActionUtil.getUser().getUId().intValue();
        PageHelper.startPage(param.getPage().getPageCurr(),param.getPage().getPageSize());
        List<BattAlarmDataVerify> list = mapper.getList(param);
        for (BattAlarmDataVerify data : list) {
            data.setAlarmName(AlarmDaoFactory.getAllAlarmName(data.getAlmSignalId()));
            WorkflowMain main = data.getMain();
            if (main != null && allMainIds.contains(main.getId())){
                main.setFaultUploadDone(true);
            }
        }
        PageInfo<BattAlarmDataVerify> pageInfo = new PageInfo<>(list);
        return new Response<>().set(1,pageInfo);
    }
 
    public BattAlarmDataVerify getById(Integer num) {
        return mapper.selectById(num);
    }
 
    public void delete(Integer num) {
        mapper.deleteById(num);
    }
 
    public Response getPageOfWebSocket(AlarmPar alarmPar, String lang) {
        try {
            PageHelper.startPage(alarmPar.getPage().getPageCurr(), alarmPar.getPage().getPageSize());
            List<BattAlarmDataVerify> list = mapper.getList(alarmPar);
            list.stream().forEach(data -> {
                data.setAlarmName(MessageUtils.getMessageSocket(AlarmDaoFactory.getAlarmName(data.getAlmSignalId()), lang));
            });
            PageInfo<BattAlarmDataVerify> pageInfo = new PageInfo<>(list);
            return new Response<>().set(1, pageInfo);
        }catch (Exception e){
            return new Response().setII(0,"接口发生异常:"+e.getCause());
        }
    }
}