| | |
| | | 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=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=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; |
| | | } |
| | | } |