1.根據(jù)條件刪除List集合里面的數(shù)據(jù)留晚。這里以dataAllList為列子
@Override
public MyPageInfo<AdminStationVO> findAdminStationList(Integer uid, PageParams params,
AdminStationVO adminStationVO) {
System.out.println("adminStationVO 傳進(jìn)來(lái)的參數(shù)"+adminStationVO);
// try {
//權(quán)限校驗(yàn)
Integer stationUid = ValidUtils.AdminStation(uid);
//station返回2,說(shuō)明有權(quán)限告嘲,0沒(méi)有權(quán)限
List<AdminStationVO> newDataList=new ArrayList<AdminStationVO>();
//封裝數(shù)據(jù)
List<AdminStationVO> dataAllList=new ArrayList<AdminStationVO>();
Integer ischeck = adminStationVO.getIscheck();
Integer instorage = adminStationVO.getInstorage();//未入庫(kù)
Integer isExpirationEmpty = adminStationVO.getIsExpirationEmpty();
System.out.println("isExpirationEmpty11111111"+isExpirationEmpty);
Integer expireDateStatus=null;
Integer picturestatus = adminStationVO.getPicturestatus();
Integer videostatus = adminStationVO.getVideostatus();
Integer platformstatus = adminStationVO.getPlatformstatus();
Integer keyamount = adminStationVO.getKeyamount();//序列號(hào)數(shù)量
Integer serialamount = adminStationVO.getSerialamount();//終端設(shè)備數(shù)量
String salesman = adminStationVO.getSalesman();//業(yè)務(wù)員
String channel = adminStationVO.getChannel();
String username = adminStationVO.getUsername();//用戶(hù)名
String stationname = adminStationVO.getStationname();
if(stationUid==2) {
//查詢(xún)所有的機(jī)構(gòu) findDepartName
String deptName = adminStationVO.getDeptName();
List<Department> findDepartName = departmentService.findDepartName(uid, deptName);
for (Department department : findDepartName) {
AdminStationVO adminStation=new AdminStationVO();
adminStation.setId(adminStationVO.getId());
adminStation.setStationname(adminStationVO.getStationname());
adminStation.setStationStarTime(adminStationVO.getStationStarTime());
adminStation.setStationEndTime(adminStationVO.getStationEndTime());
adminStation.setDeptid(department.getId());
adminStation.setDeptName(department.getDeptName());
adminStation.setStarTime(adminStationVO.getStarTime());
adminStation.setEndTime(adminStationVO.getEndTime());
adminStation.setIsExpirationEmpty(adminStationVO.getIsExpirationEmpty());//到期時(shí)間是否為空
System.out.println("adminStationVO.getStationStarTime() 開(kāi)始時(shí)間"+adminStationVO.getStationStarTime());
System.out.println("adminStationVO.getStationEndTime() 結(jié)束時(shí)間"+adminStationVO.getStationEndTime());
//通過(guò)磅點(diǎn) 磅點(diǎn)名稱(chēng)错维,磅點(diǎn)的時(shí)間,磅點(diǎn)id
List<AdminStationVO> findIdDateNameAll = mapper.findIdDateNameAll(adminStation);
System.out.println("findIdDateNameAll"+findIdDateNameAll);
for (int i = 0; i < findIdDateNameAll.size(); i++) {//findfuncidStatus
//磅點(diǎn)查詢(xún)機(jī)構(gòu) 獲取 機(jī)構(gòu)名稱(chēng)
Department findStationDpName = departmentMapper.findStationDpName(findIdDateNameAll.get(i).getId());
if(findStationDpName !=null) {
findIdDateNameAll.get(i).setDeptName(findStationDpName.getDeptName());
}
//查詢(xún)功能碼
List<Integer> findfuncidStatus = stationFuncMapper.findfuncidStatus(findIdDateNameAll.get(i).getId());
findIdDateNameAll.get(i).setFuncStatus(findfuncidStatus);
//查詢(xún)業(yè)務(wù)員
Salesman findStationById = salesmanMapper.findStationById(findIdDateNameAll.get(i).getId());
Integer channelId =null;
if(findStationById !=null) {
findIdDateNameAll.get(i).setSalesman(findStationById.getSalesman());
findIdDateNameAll.get(i).setPhone(findStationById.getPhone());
findIdDateNameAll.get(i).setChannelid(findStationById.getChannelId());
channelId = findStationById.getChannelId();//獲取業(yè)務(wù)員對(duì)應(yīng)的渠道id
}
//查詢(xún)渠道表
Cannel findSalesmanId = cannelMapper.findSalesmanId(channelId);
System.out.println("findSalesmanId 渠道"+findSalesmanId);
if(findSalesmanId !=null) {
findIdDateNameAll.get(i).setChannel(findSalesmanId.getChannel());
}
//查詢(xún)加密狗獲取審核人信息橄唬,授權(quán)過(guò)期時(shí)間(激活到期時(shí)間)赋焕,授權(quán)提交時(shí)間(激活時(shí)間)findStationidData
expireDateStatus = adminStationVO.getExpireDateStatus();//判斷激活已到期的 狀態(tài)
AuthorizeKey findStationidData = authorizeKeyMapper.findStationidData(findIdDateNameAll.get(i).getId(),ischeck,instorage,expireDateStatus);
if(findStationidData !=null) {
findIdDateNameAll.get(i).setChecker(findStationidData.getChecker());
findIdDateNameAll.get(i).setCheckdate(findStationidData.getCheckDate());
findIdDateNameAll.get(i).setIscheck(findStationidData.getIsCheck());
findIdDateNameAll.get(i).setInstorage(findStationidData.getInStorage());
findIdDateNameAll.get(i).setAkexpiredate(findStationidData.getExpireDate());
}
//查詢(xún)磅點(diǎn)對(duì)應(yīng)的操作人員 findOperratorNew
Operrator findOperratorNew = operratorMapper.findOperratorNew(findIdDateNameAll.get(i).getId());
if(findOperratorNew !=null) {
findIdDateNameAll.get(i).setOperator(findOperratorNew.getOperator());
findIdDateNameAll.get(i).setTime(findOperratorNew.getTime());
}
//用戶(hù)名查詢(xún)磅點(diǎn)信息
User findStationIdUserData = userMapper.findStationIdUserData(findIdDateNameAll.get(i).getId(),username);
if(findStationIdUserData !=null) {
findIdDateNameAll.get(i).setUsername(findStationIdUserData.getUsername());
}
}
//通過(guò)磅點(diǎn)查詢(xún)業(yè)務(wù)員
dataAllList.addAll(findIdDateNameAll);
//System.out.println("dataAllList"+dataAllList);
}
}
System.out.println("dataAllList"+dataAllList);
//判斷勾選的狀態(tài)
AdminStationVO adminData =null;
//判斷用戶(hù)
if(dataAllList !=null && dataAllList.size()>0) {
Iterator<AdminStationVO> iterator = dataAllList.iterator();
while (iterator.hasNext()) {
AdminStationVO nextdata = iterator.next();
if(username !=null) {
String usernameData = nextdata.getUsername();
if(usernameData==null || !username.equals(usernameData)) {
iterator.remove();
}
}
}
}
//判斷渠道
if(dataAllList !=null && dataAllList.size()>0) {
Iterator<AdminStationVO> iterator = dataAllList.iterator();
while (iterator.hasNext()) {
adminData = (AdminStationVO) iterator.next();
if(channel !=null) {
String channelData = adminData.getChannel();
if(channelData==null || !channel.equals(channelData)) {
iterator.remove();
}
}
}
}
//判斷業(yè)務(wù)員是否存在數(shù)據(jù)
if(dataAllList !=null && dataAllList.size()>0) {
Iterator<AdminStationVO> iterator = dataAllList.iterator();
while (iterator.hasNext()) {
adminData = (AdminStationVO) iterator.next();
if(salesman !=null) {//salesman
String salesmanName = adminData.getSalesman();
if(salesmanName==null || !salesman.equals(salesmanName)) {
iterator.remove();
}
}
}
}
//判斷設(shè)備數(shù)量
if(dataAllList !=null && dataAllList.size()>0) {
Iterator<AdminStationVO> iterator = dataAllList.iterator();
while (iterator.hasNext()) {
adminData = (AdminStationVO) iterator.next();
if(serialamount !=null) {
Integer serialaCount = adminData.getSerialamount();
if(serialamount<serialaCount) {
iterator.remove();
}
}
}
}
//判斷加密狗數(shù)量
if(dataAllList !=null && dataAllList.size()>0) {
Iterator<AdminStationVO> iterator = dataAllList.iterator();
while (iterator.hasNext()) {
adminData = (AdminStationVO) iterator.next();
if(keyamount !=null) {
Integer keyCount = adminData.getKeyamount();
if(keyamount<keyCount) {
iterator.remove();
}
}
}
}
//判斷開(kāi)通平臺(tái)
if(dataAllList !=null && dataAllList.size()>0) {
Iterator<AdminStationVO> iterator = dataAllList.iterator();
while (iterator.hasNext()) {
adminData = (AdminStationVO) iterator.next();
if(platformstatus !=null) {
if(platformstatus==0) {//不開(kāi)通
List<Integer> funcStatus = adminData.getFuncStatus();
for (Integer integer : funcStatus) {
if(integer==1) {
iterator.remove();
}
}
}else if(platformstatus==1) {//開(kāi)通
List<Integer> funcStatus = adminData.getFuncStatus();
if(!funcStatus.contains(1)) {
iterator.remove();
}
}
}
}
}
//判斷開(kāi)通視頻
if(dataAllList !=null && dataAllList.size()>0) {
Iterator<AdminStationVO> iterator = dataAllList.iterator();
while (iterator.hasNext()) {
adminData = (AdminStationVO) iterator.next();
if(videostatus !=null) {
if(videostatus==0) {//不開(kāi)通
List<Integer> funcStatus = adminData.getFuncStatus();
for (Integer integer : funcStatus) {
if(integer==3) {
iterator.remove();
}
}
}else if(videostatus==3) {//開(kāi)通
List<Integer> funcStatus = adminData.getFuncStatus();
if(!funcStatus.contains(3)) {
iterator.remove();
}
}
}
}
}
//判斷開(kāi)通圖片
if(dataAllList !=null && dataAllList.size()>0) {
Iterator<AdminStationVO> iterator = dataAllList.iterator();
while (iterator.hasNext()) {
adminData = (AdminStationVO) iterator.next();
if(picturestatus !=null) {
if(picturestatus==0) {//不開(kāi)通
List<Integer> funcStatus = adminData.getFuncStatus();
for (Integer integer : funcStatus) {
if(integer==2) {
iterator.remove();
}
}
}else if(picturestatus==2) {//開(kāi)通
List<Integer> funcStatus = adminData.getFuncStatus();
if(!funcStatus.contains(2)) {
iterator.remove();
}
}
}
}
}
//判斷加密狗審核
if(dataAllList !=null && dataAllList.size()>0) {
Iterator<AdminStationVO> iterator = dataAllList.iterator();
while (iterator.hasNext()) {
adminData = (AdminStationVO) iterator.next();
if(ischeck !=null) {
if(ischeck.equals(0)) {
if(adminData.getIscheck() != null) {
iterator.remove();
}
}else if(ischeck.equals(2)) {
if(adminData.getIscheck() == null) {
iterator.remove();
}
}
}
}
}
//判斷加密狗未入庫(kù)有錯(cuò)吳
if(dataAllList !=null && dataAllList.size()>0) {
Iterator<AdminStationVO> iterator = dataAllList.iterator();
while (iterator.hasNext()) {
adminData = (AdminStationVO) iterator.next();
if(instorage !=null) {
if(instorage.equals(0)) {
if(adminData.getInstorage() == null || adminData.getInstorage() != 0) {
iterator.remove();
}
}else if(instorage.equals(1)) {
if(adminData.getInstorage() == null || adminData.getInstorage() != 1) {
iterator.remove();
}
}
}
}
}
//判斷加密狗是否過(guò)期
if(dataAllList !=null && dataAllList.size()>0) {
Iterator<AdminStationVO> iterator = dataAllList.iterator();
while (iterator.hasNext()) {
adminData = (AdminStationVO) iterator.next();
if(isExpirationEmpty !=null) {
if(isExpirationEmpty==0) {
if(adminData.getAkexpiredate()!=null) {
System.out.println("1111111111");
iterator.remove();
}
}else if(isExpirationEmpty==1) {
if(adminData.getAkexpiredate()==null) {
System.out.println("222222");
iterator.remove();
}
}
}
}
}
System.out.println("dataAllList"+dataAllList);
List<AdminStationVO> startPage = PageUtil.startPage(dataAllList, params.getPageNum(), params.getPageSize());
MyPageInfo<AdminStationVO> myPageInfo = new MyPageInfo<AdminStationVO>(params.getPageNum(),dataAllList.size(),startPage);
return myPageInfo;
// } catch (Exception e) {
// throw new MyException("對(duì)不起。請(qǐng)選擇正確的磅點(diǎn)");
// }
}