fg电池监控平台的达梦数据库版本
whycxzp
2024-11-12 92ba7a968c67e8c8a64efea1759929649189f390
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
package com.whyc.service;
 
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.mapper.Ld9testdatastopMapper;
import com.whyc.pojo.Battinf;
import com.whyc.pojo.Ld9testdataInf;
import com.whyc.pojo.Ld9testdatastop;
import com.whyc.pojo.UserInf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.stream.Collectors;
 
@Service
public class Ld9testdatastopService {
    @Resource
    private Ld9testdatastopMapper mapper;
 
    @Autowired
    private SubTablePageInfoService subService;
 
    @Autowired
    private BattGroupStationUserService battGroupStationUserService;
 
    //查询LD9测试组端数据
    public Response serchByInfo(int testRecordCount, int battGroupId, int testMonNum) {
        //List<Ld9testdatastop> list=mapper.serchByInfo(testRecordCount,battGroupId,testMonNum);
        List<Ld9testdatastop> list=subService.serchByInfo(testRecordCount,battGroupId,testMonNum);
        PageInfo pageInfo=new PageInfo(list);
        return new Response().set(1,pageInfo);
    }
    //查询LD9一次测试中所有单体的实际容量
    public Response serchByCondition(int testRecordCount, int battGroupId) {
        //List<Ld9testdatastop> list=mapper.serchByCondition(testRecordCount,battGroupId);
        List<Ld9testdatastop> list=subService.serchByCondition(testRecordCount,battGroupId);
        PageInfo pageInfo=new PageInfo(list);
        return new Response().set(1,pageInfo);
    }
    //查询存放ld9stop在testrecordcount下有哪些单体存在放电记录
    public List<Ld9testdatastop> searchlinftestdata(Ld9testdataInf linf, HttpServletRequest req) throws Exception {
        //List<Ld9testdatastop> list=mapper.searchlinftestdata(linf);
 
        //校验传入的linf.getBattGroupId()是否为当前用户管理的
        UserInf user = (UserInf) req.getSession().getAttribute("user");
        if(user == null){
            user = new UserInf();
            user.setUName("未登录的用户账号");
            user.setUId(0L);
            user.setURole(0);
        }
        Integer battGroupId = linf.getBattGroupId();
        List<Battinf> stationInfoList = battGroupStationUserService.getStationInfoList(user.getUId());
        List<Integer> ownedBattGroupIdList = stationInfoList.stream().map(Battinf::getBattGroupId).collect(Collectors.toList());
        if(!ownedBattGroupIdList.contains(battGroupId)){
            throw new Exception("查询失败,当前用户无权限查询传参电池组的单体放电记录");
        }
        List<Ld9testdatastop> list=subService.searchlinftestdata(linf);
        return list;
    }
}