package com.mvc.service.weixin;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.mvc.dao.*;
import com.mvc.entity.*;
import com.mvc.model.*;
import com.mvc.model.weixin.DeviceStatusModel;
import com.mvc.model.weixin.TotalDeviceInfo;
import com.mvc.model.weixin.YslModel;
import com.mvc.othermodel.WxTjModel;
import com.mvc.service.TAffiliatedunitService;
import com.mvc.service.copy.TAireadService;
import com.mvc.service.dic.DicMarkTypeService;
import com.mvc.service.taizhang.CustomUserService;
import com.mvc.service.taizhang.StationAccService;
import com.mvc.service.taizhang.TAicbqCfgService;
import com.mvc.utils.DateUtil;
import com.mvc.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;

@Service
@Transactional
public class WxTongjiService {

    @Resource
    private StationAccMapper stationAccMapper;

    @Resource
    private TAffiliatedunitService tAffiliatedunitService;

    @Resource
    private TAffiliatedunitMapper tAffiliatedunitMapper;

    @Resource
    private StationAccService stationAccService;

    @Resource
    private TAireadService tAireadService;

    @Resource
    private TAicbqCfgService TAicbqCfgService;

    @Resource
    private DeviceAlarmMapper deviceAlarmMapper;

    @Resource
    private TAireadMapper tAireadMapper;

    @Resource
    private TMarkRecordMapper tMarkRecordMapper;

    @Resource
    private CustomizeGroupMapper customizeGroupMapper;

    @Resource
    private CustomUserService customUserService;

    @Resource
    private DicMarkTypeService dicMarkTypeService;


    public TotalDeviceInfo findTotalInfo(String unitCode, String deviceType) {
        TAffiliatedunitModel userUnitModel = tAffiliatedunitService.findTAffiliatedunit(unitCode);
        TotalDeviceInfo resModel = new TotalDeviceInfo();
        StationAccExample example = new StationAccExample();
        StationAccExample.Criteria criteria = example.createCriteria();
        if (deviceType != null) {
            criteria.andDeviceTypeEqualTo(deviceType);
        }
        if (!unitCode.equals("88888888")) {//小程序特殊处理,内部用户看全部用水户 2022-08-27 guozhao
            if (userUnitModel.getUnitType().equals("4")) {
                criteria.andUnitCodeEqualTo(unitCode);
            } else {
                criteria.andVisUnitCodesLike("%" + unitCode + "%");
            }
        }
        criteria.andDeviceSetupFlagEqualTo("1");//已安装
        List<StationAcc> stationAccs = stationAccMapper.selectByExample(example);
        List<String> stations = stationAccs.stream().map(o -> o.getStationCode()).collect(Collectors.toList());
        if (stations.size() == 0) {
            return resModel;
        }
        //设备总数
        resModel.setDevtotalnum(stationAccs.size());
        //较上一日设备新增数
        Date nowdate = DateUtil.parseTimeStr(DateUtil.formateDate(new Date(), "yyyyMMdd"), "yyyyMMdd");
        List<StationAcc> listadd = stationAccs.stream().filter(p -> p.getDeviceSetupDate() != null && p.getDeviceSetupDate().after(DateUtil.getOtherDateByCurrentDate(nowdate, -1))).collect(Collectors.toList());
        resModel.setDevtotalnum_add(listadd.size());

        //设备在线数
        TAireadExample aireadExample = new TAireadExample();
        TAireadExample.Criteria aircriteria = aireadExample.createCriteria();
        aircriteria.andSampleTimeGreaterThanOrEqualTo(nowdate);
        aircriteria.andStationCodeIn(stations);
        List<TAiread> tAireads = tAireadMapper.selectByExample(aireadExample);
        List<String> accall1 = tAireads.stream().map(o -> o.getStationCode()).collect(Collectors.toList());
        List<String> accdistinct1 = accall1.stream().distinct().collect(Collectors.toList());

        Date beforedate = DateUtil.getOtherDateByCurrentDate(nowdate, -1);
        TAireadExample aireadExample2 = new TAireadExample();
        TAireadExample.Criteria criteria1 = aireadExample2.createCriteria();
        criteria1.andSampleTimeGreaterThanOrEqualTo(beforedate);
        criteria1.andSampleTimeLessThan(nowdate);
        criteria1.andStationCodeIn(stations);
        List<TAiread> tAireads2 = tAireadMapper.selectByExample(aireadExample2);
        List<String> accall2 = tAireads2.stream().map(o -> o.getStationCode()).collect(Collectors.toList());
        List<String> accdistinct2 = accall2.stream().distinct().collect(Collectors.toList());
        resModel.setDevonlinenum(accdistinct1.size());
        resModel.setDevonlinenum_add(accdistinct1.size() - accdistinct2.size());
        //设备故障数
        TMarkRecordExample markRecordExample = new TMarkRecordExample();
        TMarkRecordExample.Criteria tmarkcriteria = markRecordExample.createCriteria();
        tmarkcriteria.andStationCodeIn(stations);
        tmarkcriteria.andProcessResultsEqualTo("0");
        List<TMarkRecord> tMarkRecords = tMarkRecordMapper.selectByExample(markRecordExample);
        List<TMarkRecord> markadd = tMarkRecords.stream().filter(a -> a.getCreateTime().after(nowdate)).collect(Collectors.toList());
        resModel.setBreakdownnum(tMarkRecords.size());
        resModel.setBreakdownnum_add(markadd.size());
        return resModel;
    }


    //根据站代码获取全部可查看的用水户
    public ResPageModel findTAffiliatedunitsByUnitCode(String unitCode, String deviceType, int page, int rows) {
        List<TAffiliatedunitModel> res = new ArrayList<>();
        TAffiliatedunitModel userUnitModel = tAffiliatedunitService.findTAffiliatedunit(unitCode);
        StationAccExample example = new StationAccExample();
        StationAccExample.Criteria criteria = example.createCriteria();
        if (!deviceType.equals("0")) {
            criteria.andDeviceTypeEqualTo(deviceType);
        }
        if (!unitCode.equals("88888888")) {//小程序特殊处理,内部用户看全部用水户 2022-08-27 guozhao
            if (userUnitModel == null || StringUtils.isEmpty(userUnitModel.getUnitType())) {
                Page<Object> pageobject = PageHelper.startPage(page, rows);
                return new ResPageModel(res, pageobject);
            }
            if (userUnitModel.getUnitType().equals("4")) {
                criteria.andUnitCodeEqualTo(unitCode);
            } else {
                criteria.andVisUnitCodesLike("%" + unitCode + "%");
            }
        }
        List<StationAcc> list = stationAccMapper.selectByExample(example);
        Page<Object> pageobject = PageHelper.startPage(page, rows);
        if (list.size() > 0) {
            Map<String, List<StationAcc>> map = list.stream().filter(item -> StringUtils.isNotBlank(item.getUnitCode()))
                    .collect(Collectors.groupingBy(t -> t.getUnitCode()));
            List<String> stations = list.stream().map(o -> o.getUnitCode()).collect(Collectors.toList());
            List<String> unitcodes = stations.stream().distinct().collect(Collectors.toList());
            TAffiliatedunitExample tAffexample = new TAffiliatedunitExample();
            TAffiliatedunitExample.Criteria taffcriteria1 = tAffexample.createCriteria();
            taffcriteria1.andUnitCodeIn(unitcodes);
            List<TAffiliatedunit> units = tAffiliatedunitMapper.selectByExample(tAffexample);
            for (int i = 0; i < units.size(); i++) {
                TAffiliatedunit tAffiliatedunit = units.get(i);
                TAffiliatedunitModel tAffiliatedunitModel = new TAffiliatedunitModel();
                BeanUtils.copyProperties(tAffiliatedunit, tAffiliatedunitModel);
                TotalDeviceInfo totalInfo = findTotalInfo(tAffiliatedunit.getUnitCode(), deviceType);
                tAffiliatedunitModel.setTotalDeviceInfo(totalInfo);
                List<StationAcc> stationAccs = map.get(tAffiliatedunitModel.getUnitCode());
                if (stationAccs != null) {
                    totalInfo.setStationAccnum(stationAccs.size());
                }
                res.add(tAffiliatedunitModel);
            }
        }
        res = res.stream().sorted(Comparator.comparing(TAffiliatedunitModel::getUnitName, Comparator.nullsFirst(String::compareTo))).collect(Collectors.toList());
        ResPageModel resPageModel = new ResPageModel(res, pageobject);
        return resPageModel;
    }

    public Map<String, Object> findStationAccsByUnitCode(String userId, String unitCode, String deviceType, String s, Integer page, Integer rows) {
        deviceType = deviceType.equals("0") ? "" : deviceType;//=0时不过滤类型 2024-04-25 guozhao

        //控制用户未至当日12点时,只能看昨天的数据(看审核后的) 2024-10-17 guozhao
        //String sampleTime = DateUtil.getQueryEndTime();
        Map<String, Object> map = stationAccService.findStationAccsByUnitCode(unitCode, deviceType, true, page, rows);
        //绑定各站点是否关注值
        List<StationAccModel> accs = (List<StationAccModel>) map.get("list");
        CustomizeGroupExample customizeGroupExample = new CustomizeGroupExample();
        CustomizeGroupExample.Criteria criteria = customizeGroupExample.createCriteria();
        criteria.andCodeTypeEqualTo("1");//小程序关注分组
        criteria.andCreateUserIdEqualTo(userId);
        List<CustomizeGroup> customizeGroups = customizeGroupMapper.selectByExample(customizeGroupExample);
        if (customizeGroups.size() > 0 && customizeGroups.get(0).getStationCodes() != null) {
            String gzCodes = customizeGroups.get(0).getStationCodes();
            for (StationAccModel acc : accs) {
                if (gzCodes.indexOf(acc.getStationCode()) >= 0) {
                    acc.setIsgz("1");
                }
            }
        }
        return map;
    }

    //根据4级用水户代码查找用水户下所有站点及设备状态信息
    public ResPageModel findDevicestatusByUnitCode(String unitCode, String deviceType, Integer page, Integer rows) {
        List<StationAccModel> resList = new ArrayList<>();
        Page<Object> pageObject = PageHelper.startPage(page, rows);
        StationAccExample example = new StationAccExample();
        StationAccExample.Criteria criteria = example.createCriteria();
        criteria.andUnitCodeEqualTo(unitCode);
        if (StringUtils.isNotEmpty(deviceType)) {
            criteria.andDeviceTypeEqualTo(deviceType);
        }
        example.setOrderByClause("DEVICE_TYPE,STATION_NAME");
        List<StationAcc> list = stationAccMapper.selectByExample(example);
        if (list != null && list.size() > 0) {
            for (StationAcc acc : list) {
                StationAccModel model = new StationAccModel();
                BeanUtils.copyProperties(acc, model);
                DeviceStatusModel statusModel = new DeviceStatusModel();
                model.setDeviceStatusModel(statusModel);
                //获取最新对数
                TAireadModel taireadM = tAireadService.findLatesTAireadByStationCode(model.getStationCode());
                if (taireadM != null) {
                    statusModel.setRsrp(taireadM.getRsrp());
                    statusModel.setSocRate(taireadM.getSocRate());
                }
                statusModel.setDeviceSn(model.getDeviceSn());
                statusModel.setDeviceSetupDate(model.getDeviceSetupDate());
                statusModel.setDeviceUnitName(tAireadService.getDeviceUnitName(model));
                //获取安装信息
                TAicbqCfgModel tAicbqCfgModel = TAicbqCfgService.findTAicbqCfgModel(model.getDeviceSn(), model.getStationCode(), "1");
                if (tAicbqCfgModel != null) {
                    statusModel.setDnType(tAicbqCfgModel.getDnType());
                    statusModel.setSampleInterval(tAicbqCfgModel.getSampleInterval());
                }

                //获取预警信息
                if (taireadM != null) {
                    int day_cha = DateUtil.getSencondsbetweenTime(taireadM.getSampleTime(), new Date()) / 60 / 60 / 24;
                    if (day_cha > 3) {//三日不在线
                        statusModel.setDangrzx("否");
                        statusModel.setSanrzx("否");
                    } else if (day_cha > 1 && day_cha <= 3) {//
                        statusModel.setDangrzx("否");
                        statusModel.setSanrzx("是");
                    } else {//
                        statusModel.setDangrzx("是");
                        statusModel.setSanrzx("是");
                    }
                } else {
                    statusModel.setDangrzx("否");
                    statusModel.setSanrzx("否");
                }
                resList.add(model);
            }
        }
        return new ResPageModel(resList, pageObject);
    }


    //根据站点代码获取时、日、月、年用水量
    public List<YslModel> findYslByStationCode(String stationCode, String kssj, String jssj, String type) {
        StationAccModel stationacc = stationAccService.findStationAccByStationCode(stationCode);
        Date startdate = DateUtil.parseTimeStr(kssj, "yyyyMMdd");
        startdate = DateUtil.getOtherDateByCurrentDate(startdate, -1);
        Date enddate = DateUtil.parseTimeStr(jssj, "yyyyMMdd");
        List<YslModel> resList = new ArrayList<>();

        if ("0".equals(type)) {//时用水量
            Date start = DateUtil.parseTimeStr(kssj, "yyyyMMdd");
            Date end = DateUtil.parseTimeStr(jssj, "yyyyMMdd");
            end = DateUtil.getOtherDateByCurrentDate(end, 1);
            TAireadExample example = new TAireadExample();
            TAireadExample.Criteria criteria = example.createCriteria();
            criteria.andSampleTimeLessThan(end);
            criteria.andSampleTimeGreaterThanOrEqualTo(start);
            criteria.andStationCodeEqualTo(stationCode);
            criteria.andResultValueIsNotNull();
            example.setOrderByClause("SAMPLE_TIME DESC");
            List<TAiread> tAireads = tAireadMapper.selectByExample(example);
            for (int i = 0; i < tAireads.size(); i++) {
                TAiread tAiread = tAireads.get(i);
                YslModel yslModel = new YslModel();
                yslModel.setTime(DateUtil.formateDate(tAiread.getSampleTime(), "MM-dd HH:mm"));
                yslModel.setYsl(tAiread.getResultValue());
                yslModel.setStartsmallJpgUrl(tAiread.getSmallJpgUrl());
                yslModel.setEndsmallJpgUrl(tAiread.getSmallJpgUrl());
                resList.add(yslModel);
            }
        } else if ("1".equals(type)) {//日用水量
            TAireadExample example = new TAireadExample();
            TAireadExample.Criteria criteria = example.createCriteria();
            enddate = DateUtil.getOtherDateByCurrentDate(enddate, 1);
            criteria.andSampleTimeLessThanOrEqualTo(enddate);
            criteria.andSampleTimeGreaterThanOrEqualTo(startdate);
            criteria.andStationCodeEqualTo(stationCode);
            criteria.andResultValueIsNotNull();
            example.setOrderByClause("SAMPLE_TIME DESC");
            List<TAiread> tAireads = tAireadMapper.selectByExample(example);
            List<TAiread> list16 = tAireads.stream().filter(a -> a.getSampleTime().getHours() == 16).collect(Collectors.toList());
            for (int i = 0; i < list16.size() - 1; i++) {
                YslModel yslModel = new YslModel();
                TAiread tairead = list16.get(i);
                TAiread beforettairead = list16.get(i + 1);
                String date1 = DateUtil.formateDate(tairead.getSampleTime(), "yyyy-MM-dd");
                String date2 = DateUtil.formateDate(DateUtil.getOtherDateByCurrentDate(beforettairead.getSampleTime(), 1), "yyyy-MM-dd");
                yslModel.setTime(date1);
                yslModel.setStationCode(stationCode);
                yslModel.setStationName(stationacc.getStationName());
                if (date1.equals(date2)) {
                    yslModel.setYsl(tairead.getResultValue().subtract(beforettairead.getResultValue()));
                    yslModel.setStartsmallJpgUrl(beforettairead.getSmallJpgUrl());
                    yslModel.setEndsmallJpgUrl(tairead.getSmallJpgUrl());
                    yslModel.setStartresultValue(beforettairead.getResultValue());
                    yslModel.setEndresultValue(tairead.getResultValue());
                }
                resList.add(yslModel);
            }
        } else if ("2".equals(type)) {//月用水量
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(new Date());
            // calendar.add(Calendar.MONTH, -1);
            calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
            Date nowdate = calendar.getTime();
            nowdate = DateUtil.parseTimeStr(DateUtil.formateDate(nowdate, "yyyyMMdd"), "yyyyMMdd");
            for (int i = 0; i < 12; i++) {
                calendar.add(Calendar.MONTH, -1);
                calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
                Date beforeMoth = calendar.getTime();
                beforeMoth = DateUtil.parseTimeStr(DateUtil.formateDate(beforeMoth, "yyyyMMdd"), "yyyyMMdd");
                //查询本月数据
                TAireadExample tAireadExample = new TAireadExample();
                TAireadExample.Criteria criteria = tAireadExample.createCriteria();
                criteria.andStationCodeEqualTo(stationCode);
                criteria.andSampleTimeGreaterThanOrEqualTo(beforeMoth);
                criteria.andSampleTimeLessThanOrEqualTo(nowdate);
                criteria.andResultValueIsNotNull();
                tAireadExample.setOrderByClause("SAMPLE_TIME");
                List<TAiread> tAireads = tAireadMapper.selectByExample(tAireadExample);
                YslModel yslModel = new YslModel();
                yslModel.setStationCode(stationCode);
                yslModel.setStationName(stationacc.getStationName());
                yslModel.setTime(DateUtil.formateDate(nowdate, "yyyy-MM"));
                resList.add(yslModel);
                if (tAireads.size() > 0) {
                    TAiread tAiread1 = tAireads.get(0);
                    TAiread tAiread2 = tAireads.get(tAireads.size() - 1);
                    yslModel.setYsl(tAiread2.getResultValue().subtract(tAiread1.getResultValue()));
                    yslModel.setStartsmallJpgUrl(tAiread1.getSmallJpgUrl());
                    yslModel.setEndsmallJpgUrl(tAiread2.getSmallJpgUrl());
                    yslModel.setStartresultValue(tAiread1.getResultValue());
                    yslModel.setEndresultValue(tAiread2.getResultValue());
                }
                nowdate = beforeMoth;
            }
        } else if ("3".equals(type)) {//年用水量
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(new Date());
            calendar.set(Calendar.DAY_OF_YEAR, calendar.getActualMaximum(Calendar.DAY_OF_YEAR));
            Date nowdate = calendar.getTime();
            for (int i = 0; i < 3; i++) {
                calendar.add(Calendar.YEAR, -1);
                calendar.set(Calendar.DAY_OF_YEAR, calendar.getActualMaximum(Calendar.DAY_OF_YEAR));
                Date beforeyear = calendar.getTime();
                //查询本年数据
                TAireadExample tAireadExample = new TAireadExample();
                TAireadExample.Criteria criteria = tAireadExample.createCriteria();
                criteria.andStationCodeEqualTo(stationCode);
                criteria.andSampleTimeGreaterThanOrEqualTo(beforeyear);
                criteria.andSampleTimeLessThanOrEqualTo(nowdate);
                tAireadExample.setOrderByClause("SAMPLE_TIME");
                List<TAiread> tAireads = tAireadMapper.selectByExample(tAireadExample);
                YslModel yslModel = new YslModel();
                yslModel.setStationCode(stationCode);
                yslModel.setStationName(stationacc.getStationName());
                yslModel.setTime(DateUtil.formateDate(nowdate, "yyyy"));
                resList.add(yslModel);
                if (tAireads.size() > 0) {
                    TAiread tAiread1 = tAireads.get(0);
                    TAiread tAiread2 = tAireads.get(tAireads.size() - 1);
                    yslModel.setYsl(tAiread2.getResultValue().subtract(tAiread1.getResultValue()));
                    yslModel.setStartsmallJpgUrl(tAiread1.getSmallJpgUrl());
                    yslModel.setEndsmallJpgUrl(tAiread2.getSmallJpgUrl());
                    yslModel.setStartresultValue(tAiread1.getResultValue());
                    yslModel.setEndresultValue(tAiread2.getResultValue());
                }
                nowdate = beforeyear;
            }
        }
        return resList;
    }

    //根据用水户代码获取日、月、年用水量//1 日用水量 2 月用水量  3年度用水量
    public List<YslModel> findYslByUnitCode(String unitCode, String kssj, String jssj, String type) {
        //根据用水户查找所有站点
        StationAccExample accexample = new StationAccExample();
        StationAccExample.Criteria acccriteria = accexample.createCriteria();
        acccriteria.andUnitCodeEqualTo(unitCode);
        acccriteria.andDeviceTypeEqualTo("1");
        acccriteria.andDeviceSetupFlagEqualTo("1");
        accexample.setOrderByClause("DEVICE_TYPE,STATION_NAME");
        List<StationAcc> acclist = stationAccMapper.selectByExample(accexample);
        List<YslModel> resList = new ArrayList<>();

        if ("1".equals(type)) {//日用水量
            Date startdate = DateUtil.parseTimeStr(kssj, "yyyyMMdd");
            Date enddate = DateUtil.parseTimeStr(jssj, "yyyyMMdd");
            enddate = DateUtil.getOtherDateByCurrentDate(enddate, 1);
            for (int i = 0; i < acclist.size(); i++) {
                StationAcc acc = acclist.get(i);
                TAireadExample example = new TAireadExample();
                TAireadExample.Criteria criteria = example.createCriteria();
                criteria.andStationCodeEqualTo(acc.getStationCode());
                criteria.andSampleTimeGreaterThanOrEqualTo(startdate);
                criteria.andSampleTimeLessThanOrEqualTo(enddate);
                criteria.andResultValueIsNotNull();
                example.setOrderByClause("SAMPLE_TIME");
                List<TAiread> tAireads = tAireadMapper.selectByExample(example);

                YslModel yslModel = new YslModel();
                yslModel.setStationName(acc.getStationName());
                yslModel.setStationCode(acc.getStationCode());
                resList.add(yslModel);
                if (tAireads.size() > 0) {
                    yslModel.setYsl(tAireads.get(tAireads.size() - 1).getResultValue().subtract(tAireads.get(0).getResultValue()));
                }
            }
        } else if ("2".equals(type)) {//月用水量
            Date enddate = new Date();
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(enddate);
            calendar.add(Calendar.YEAR, -1);
            Date startdate = calendar.getTime();
            for (int i = 0; i < acclist.size(); i++) {
                StationAcc acc = acclist.get(i);
                TAireadExample example = new TAireadExample();
                TAireadExample.Criteria criteria = example.createCriteria();
                criteria.andStationCodeEqualTo(acc.getStationCode());
                criteria.andSampleTimeGreaterThanOrEqualTo(startdate);
                criteria.andSampleTimeLessThanOrEqualTo(enddate);
                criteria.andResultValueIsNotNull();
                example.setOrderByClause("SAMPLE_TIME");
                List<TAiread> tAireads = tAireadMapper.selectByExample(example);

                YslModel yslModel = new YslModel();
                yslModel.setStationName(acc.getStationName());
                yslModel.setStationCode(acc.getStationCode());
                resList.add(yslModel);
                if (tAireads.size() > 0) {
                    yslModel.setYsl(tAireads.get(tAireads.size() - 1).getResultValue().subtract(tAireads.get(0).getResultValue()));
                }
            }
        } else if ("3".equals(type)) {//年用水量
            Date enddate = new Date();
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(enddate);
            calendar.add(Calendar.YEAR, -3);
            Date startdate = calendar.getTime();
            for (int i = 0; i < acclist.size(); i++) {
                StationAcc acc = acclist.get(i);
                TAireadExample example = new TAireadExample();
                TAireadExample.Criteria criteria = example.createCriteria();
                criteria.andStationCodeEqualTo(acc.getStationCode());
                criteria.andSampleTimeGreaterThanOrEqualTo(startdate);
                criteria.andSampleTimeLessThanOrEqualTo(enddate);
                criteria.andResultValueIsNotNull();
                example.setOrderByClause("SAMPLE_TIME");
                List<TAiread> tAireads = tAireadMapper.selectByExample(example);

                YslModel yslModel = new YslModel();
                yslModel.setStationName(acc.getStationName());
                yslModel.setStationCode(acc.getStationCode());
                resList.add(yslModel);
                if (tAireads.size() > 0) {
                    yslModel.setYsl(tAireads.get(tAireads.size() - 1).getResultValue().subtract(tAireads.get(0).getResultValue()));
                }
            }
        }
        return resList;
    }

    //根据userid查询重点关注的水表
    public ResPageModel findAttentionStationsByUserid(String userId, int page, int rows) {
        List<StationAccModel> resList = new ArrayList<>();
        CustomizeGroupExample customizeGroupExample = new CustomizeGroupExample();
        CustomizeGroupExample.Criteria criteria = customizeGroupExample.createCriteria();
        criteria.andCodeTypeEqualTo("1");//小程序关注分组
        criteria.andCreateUserIdEqualTo(userId);
        List<CustomizeGroup> customizeGroups = customizeGroupMapper.selectByExample(customizeGroupExample);
        Page<Object> pageObject = PageHelper.startPage(page, rows);
        if (customizeGroups.size() > 0) {
            CustomizeGroup customizeGroup = customizeGroups.get(0);
            String stationCodes = customizeGroup.getStationCodes();
            StationAccExample stationAccExample = new StationAccExample();
            StationAccExample.Criteria acccriteria = stationAccExample.createCriteria();
            acccriteria.andDeviceSetupFlagEqualTo("1");
            if (stationCodes != null) {
                acccriteria.andStationCodeIn(Arrays.asList(stationCodes.split(",")));
                List<StationAcc> stationAccs = stationAccMapper.selectByExample(stationAccExample);
                for (int i = 0; i < stationAccs.size(); i++) {
                    StationAcc acc = stationAccs.get(i);
                    StationAccModel accModel = new StationAccModel();
                    BeanUtils.copyProperties(acc, accModel);
                    TAireadModel taireadm = tAireadService.findTAireadByStationCodeAndSampleTime(acc.getStationCode(), DateUtil.formateDate(new Date(), "yyyyMMdd"));
                    accModel.settAireadModel(taireadm);
                    resList.add(accModel);
                }
            }

        }
        return new ResPageModel(resList, pageObject);
    }

    //关注站点调用接口
    public int payAttentionByStationcode(String userId, String stationCode) {
        CustomUserModel customUserModel = customUserService.findCustomUserModelByUserId(userId);
        CustomizeGroupExample customizeGroupExample = new CustomizeGroupExample();
        CustomizeGroupExample.Criteria criteria = customizeGroupExample.createCriteria();
        criteria.andCodeTypeEqualTo("1");//小程序关注分组
        criteria.andCreateUserIdEqualTo(userId);
        List<CustomizeGroup> customizeGroups = customizeGroupMapper.selectByExample(customizeGroupExample);
        if (customizeGroups.size() > 0) {//存在关注组
            CustomizeGroup customizeGroup = customizeGroups.get(0);
            if (StringUtils.isEmpty(customizeGroup.getStationCodes())) {
                customizeGroup.setStationCodes(stationCode);
            } else {
                customizeGroup.setStationCodes(customizeGroup.getStationCodes() + "," + stationCode);
            }
            int i = customizeGroupMapper.updateByPrimaryKey(customizeGroup);
            return i;
        } else {//不存在进行创建
            CustomizeGroup group = new CustomizeGroup();
            group.setGroupId(StringUtil.getUuid());
            group.setGroupName(customUserModel.getUserName());
            group.setPublicFlag("0");
            group.setCreateUserId(userId);
            group.setCreateUserName(customUserModel.getUserName());
            group.setCreateTime(new Date());
            group.setUserType("1");
            group.setCodeType("1");
            group.setUnitCode(customUserModel.getUnitCode());
            group.setStationCodes(stationCode);
            int insert = customizeGroupMapper.insert(group);
            return insert;
        }
    }

    //取消站点调用接口
    public int cancelAttentionByStationcode(String userId, String stationCode) {
        CustomizeGroupExample customizeGroupExample = new CustomizeGroupExample();
        CustomizeGroupExample.Criteria criteria = customizeGroupExample.createCriteria();
        criteria.andCodeTypeEqualTo("1");//小程序关注分组
        criteria.andCreateUserIdEqualTo(userId);
        List<CustomizeGroup> customizeGroups = customizeGroupMapper.selectByExample(customizeGroupExample);
        if (customizeGroups.size() > 0) {
            CustomizeGroup group = customizeGroups.get(0);
            String stationCodes = group.getStationCodes();
            if (stationCodes != null && stationCodes.indexOf(stationCode + ",") >= 0) {
                group.setStationCodes(stationCodes.replace(stationCode + ",", ""));
                int res = customizeGroupMapper.updateByPrimaryKey(group);
                return res;
            } else if (stationCodes != null && stationCodes.indexOf(stationCode) >= 0) {
                group.setStationCodes(stationCodes.replace(stationCode, ""));
                int res = customizeGroupMapper.updateByPrimaryKey(group);
                return res;
            }
        }
        return 0;
    }


    public ResPageModel findYujingTAffiliatedunitsByUnitCode(String unitCode, String deviceType, int page, int rows) {
        List<TAffiliatedunitModel> res = new ArrayList<>();
        TAffiliatedunitModel userUnitModel = tAffiliatedunitService.findTAffiliatedunit(unitCode);
        StationAccExample example = new StationAccExample();
        StationAccExample.Criteria criteria = example.createCriteria();
        //等于0时不过滤设备类型 2024-04-25 guozhao
        if (!deviceType.equals("0")) {
            criteria.andDeviceTypeEqualTo(deviceType);
        }

        if (!unitCode.equals("88888888")) {//小程序特殊处理,内部用户看全部用水户 2022-08-27 guozhao
            if (userUnitModel == null || StringUtils.isEmpty(userUnitModel.getUnitType())) {
                Page<Object> pageobject = PageHelper.startPage(page, rows);
                return new ResPageModel(res, pageobject);
            }
            if (userUnitModel.getUnitType().equals("4")) {
                criteria.andUnitCodeEqualTo(unitCode);
            } else {
                criteria.andVisUnitCodesLike("%" + unitCode + "%");
            }
        }
        TMarkRecordExample markRecordExample = new TMarkRecordExample();
        TMarkRecordExample.Criteria markcriteria = markRecordExample.createCriteria();
        markcriteria.andProcessResultsEqualTo("0");
        List<TMarkRecord> tMarkRecords = tMarkRecordMapper.selectByExample(markRecordExample);
        List<String> marklist = tMarkRecords.stream().map(o -> o.getStationCode()).collect(Collectors.toList());
        if (marklist.size() > 0) {
            criteria.andStationCodeIn(marklist);
        }
        List<StationAcc> acclist = stationAccMapper.selectByExample(example);
        Page<Object> pageobject = PageHelper.startPage(page, rows);
        if (acclist != null) {
            List<String> unitlist = acclist.stream().map(o -> o.getUnitCode()).collect(Collectors.toList());
            TAffiliatedunitExample tAffiliatedunitExample = new TAffiliatedunitExample();
            TAffiliatedunitExample.Criteria taffcriteria = tAffiliatedunitExample.createCriteria();
            taffcriteria.andUnitCodeIn(unitlist);
            pageobject = PageHelper.startPage(page, rows);
            List<TAffiliatedunit> units = tAffiliatedunitMapper.selectByExample(tAffiliatedunitExample);
            for (int i = 0; i < units.size(); i++) {
                TAffiliatedunit tAffiliatedunit = units.get(i);
                TAffiliatedunitModel unitModel = new TAffiliatedunitModel();
                BeanUtils.copyProperties(tAffiliatedunit, unitModel);
                TotalDeviceInfo totalInfo = findTotalInfo(unitModel.getUnitCode(), deviceType);
                if (totalInfo.getBreakdownnum() > 0) {//有故障在返回
                    unitModel.setTotalDeviceInfo(totalInfo);
                    res.add(unitModel);
                }
            }
        }
        res = res.stream().sorted(Comparator.comparing(TAffiliatedunitModel::getUnitName, Comparator.nullsFirst(String::compareTo))).collect(Collectors.toList());
        ResPageModel resPageModel = new ResPageModel(res, pageobject);
        return resPageModel;

    }

    public ResPageModel findDYujingeviceStatusByUnitCode(String unitCode, String deviceType, Integer page, Integer rows) {

        {
            List<StationAccModel> resList = new ArrayList<>();
            StationAccExample example = new StationAccExample();
            StationAccExample.Criteria criteria = example.createCriteria();
            criteria.andUnitCodeEqualTo(unitCode);
            if (StringUtils.isNotEmpty(deviceType)) {
                criteria.andDeviceTypeEqualTo(deviceType);
            }
            example.setOrderByClause("DEVICE_TYPE,STATION_NAME");
            List<StationAcc> stationAccs = stationAccMapper.selectByExample(example);
            List<String> stations = stationAccs.stream().map(o -> o.getStationCode()).collect(Collectors.toList());

            //查询用水户下的故障表
            List<TMarkRecord> tMarkRecords = new ArrayList<>();
            Page<Object> pageObject = PageHelper.startPage(page, rows);
            if (stations.size() > 0) {
                TMarkRecordExample markRecordExample = new TMarkRecordExample();
                TMarkRecordExample.Criteria markcriteria = markRecordExample.createCriteria();
                markcriteria.andStationCodeIn(stations);
                markcriteria.andProcessResultsEqualTo("0");
                tMarkRecords = tMarkRecordMapper.selectByExample(markRecordExample);
            }
            Map<String, TMarkRecord> map = tMarkRecords.stream().collect(Collectors.toMap(TMarkRecord::getStationCode, TMarkRecord -> TMarkRecord));
            if (stationAccs != null && stationAccs.size() > 0) {
                for (StationAcc acc : stationAccs) {
                    StationAccModel model = new StationAccModel();
                    BeanUtils.copyProperties(acc, model);
                    DeviceStatusModel statusModel = new DeviceStatusModel();
                    model.setDeviceStatusModel(statusModel);
                    TMarkRecord tMarkRecord = map.get(model.getStationCode());
                    if (tMarkRecord == null) {
                        continue;
                    }
                    DicMarkTypeModel marktype = dicMarkTypeService.findDicMarkTypeModelById(tMarkRecord.getMarkId());
                    statusModel.setMarkName(marktype.getMarkName());
                    resList.add(model);
                    //获取最新对数
                    TAireadModel taireadM = tAireadService.findLatesTAireadByStationCode(model.getStationCode());
                    if (taireadM != null) {
                        statusModel.setRsrp(taireadM.getRsrp());
                        statusModel.setSocRate(taireadM.getSocRate());
                    }
                    statusModel.setDeviceSn(model.getDeviceSn());
                    statusModel.setDeviceSetupDate(model.getDeviceSetupDate());
                    statusModel.setDeviceUnitName(tAireadService.getDeviceUnitName(model));
                    //获取安装信息
                    TAicbqCfgModel tAicbqCfgModel = TAicbqCfgService.findTAicbqCfgModel(model.getDeviceSn(), model.getStationCode(), "1");
                    if (tAicbqCfgModel != null) {
                        statusModel.setDnType(tAicbqCfgModel.getDnType());
                        statusModel.setSampleInterval(tAicbqCfgModel.getSampleInterval());
                    }

                    //获取预警信息
                    if (taireadM != null) {
                        int day_cha = DateUtil.getSencondsbetweenTime(taireadM.getSampleTime(), new Date()) / 60 / 60 / 24;
                        if (day_cha > 3) {//三日不在线
                            statusModel.setDangrzx("否");
                            statusModel.setSanrzx("否");
                        } else if (day_cha > 1 && day_cha <= 3) {//
                            statusModel.setDangrzx("否");
                            statusModel.setSanrzx("是");
                        } else {//
                            statusModel.setDangrzx("是");
                            statusModel.setSanrzx("是");
                        }
                    } else {
                        statusModel.setDangrzx("否");
                        statusModel.setSanrzx("否");
                    }

                }
            }
            return new ResPageModel(resList, pageObject);
        }


    }

    //根据统计数据查看明细  String unitCode,String deviceType, String type, Integer page, Integer rows
    public ResPageModel findDetailInfoByNum(WxTjModel tjmodel) {
        String unitCode = tjmodel.getUnitCode();
        String deviceType = tjmodel.getDeviceType();
        String type = tjmodel.getType();
        String snorname = tjmodel.getSnorname();
        String sn = null;
        String stationName = null;
        if (StringUtils.isNotEmpty(snorname)) {
            if (snorname.matches("[0-9]+")) {
                sn = snorname;
            } else {
                stationName = snorname;
            }
        }
        Integer page = tjmodel.getPage();
        Integer rows = tjmodel.getRows();
        List<StationAccModel> stationAccModelList = new ArrayList<>();

        if ("1".equals(type)) {//设备总数明细
            TAffiliatedunitModel userUnitModel = tAffiliatedunitService.findTAffiliatedunit(unitCode);
            TotalDeviceInfo resModel = new TotalDeviceInfo();
            StationAccExample example = new StationAccExample();
            StationAccExample.Criteria criteria = example.createCriteria();
            if (deviceType != null) {
                criteria.andDeviceTypeEqualTo(deviceType);
            }
            if (!unitCode.equals("88888888")) {//小程序特殊处理,内部用户看全部用水户 2022-08-27 guozhao
                if (userUnitModel.getUnitType().equals("4")) {
                    criteria.andUnitCodeEqualTo(unitCode);
                } else {
                    criteria.andVisUnitCodesLike(StringUtil.getLikeFormat(unitCode));
                }
            }
            if (sn != null) {
                criteria.andDeviceSnLike(StringUtil.getLikeFormat(sn));
            }
            if (stationName != null) {
                criteria.andStationNameLike(StringUtil.getLikeFormat(stationName));
            }
            criteria.andDeviceSetupFlagEqualTo("1");//已安装
            Page<Object> pageObject = PageHelper.startPage(page, rows);
            List<StationAcc> stationAccs = stationAccMapper.selectByExample(example);

            for (StationAcc acc : stationAccs) {
                {
                    StationAccModel model = new StationAccModel();
                    BeanUtils.copyProperties(acc, model);
                    DeviceStatusModel statusModel = new DeviceStatusModel();
                    model.setDeviceStatusModel(statusModel);
                    //获取最新对数
                    TAireadModel taireadM = tAireadService.findLatesTAireadByStationCode(model.getStationCode());
                    if (taireadM != null) {
                        statusModel.setRsrp(taireadM.getRsrp());
                        statusModel.setSocRate(taireadM.getSocRate());
                    }
                    statusModel.setDeviceSn(model.getDeviceSn());
                    statusModel.setDeviceSetupDate(model.getDeviceSetupDate());
                    statusModel.setDeviceUnitName(tAireadService.getDeviceUnitName(model));
                    //获取安装信息
                    TAicbqCfgModel tAicbqCfgModel = TAicbqCfgService.findTAicbqCfgModel(model.getDeviceSn(), model.getStationCode(), "1");
                    if (tAicbqCfgModel != null) {
                        statusModel.setDnType(tAicbqCfgModel.getDnType());
                        statusModel.setSampleInterval(tAicbqCfgModel.getSampleInterval());
                    }
                    //获取预警信息
                    if (taireadM != null) {
                        int day_cha = DateUtil.getSencondsbetweenTime(taireadM.getSampleTime(), new Date()) / 60 / 60 / 24;
                        if (day_cha > 3) {//三日不在线
                            statusModel.setDangrzx("否");
                            statusModel.setSanrzx("否");
                        } else if (day_cha > 1 && day_cha <= 3) {//
                            statusModel.setDangrzx("否");
                            statusModel.setSanrzx("是");
                        } else {//
                            statusModel.setDangrzx("是");
                            statusModel.setSanrzx("是");
                        }
                    } else {
                        statusModel.setDangrzx("否");
                        statusModel.setSanrzx("否");
                    }
                    stationAccModelList.add(model);
                }
            }
            return new ResPageModel(stationAccModelList, pageObject);
        } else if ("2".equals(type)) {//设备在线明细
            TAffiliatedunitModel userUnitModel = tAffiliatedunitService.findTAffiliatedunit(unitCode);
            TotalDeviceInfo resModel = new TotalDeviceInfo();
            StationAccExample example = new StationAccExample();
            StationAccExample.Criteria criteria = example.createCriteria();
            if (deviceType != null) {
                criteria.andDeviceTypeEqualTo(deviceType);
            }
            if (!unitCode.equals("88888888")) {//小程序特殊处理,内部用户看全部用水户 2022-08-27 guozhao
                if (userUnitModel.getUnitType().equals("4")) {
                    criteria.andUnitCodeEqualTo(unitCode);
                } else {
                    criteria.andVisUnitCodesLike("%" + unitCode + "%");
                }
            }
            criteria.andDeviceSetupFlagEqualTo("1");//已安装
            if (sn != null) {
                criteria.andDeviceSnLike(StringUtil.getLikeFormat(sn));
            }
            if (stationName != null) {
                criteria.andStationNameLike(StringUtil.getLikeFormat(stationName));
            }
            List<StationAcc> stationAccs = stationAccMapper.selectByExample(example);
            List<String> stations = stationAccs.stream().map(o -> o.getStationCode()).collect(Collectors.toList());
            if (stations.size() == 0) {
                return new ResPageModel(stationAccModelList, new Page<>());
            }
            //设备在线数
            Date nowdate = DateUtil.parseTimeStr(DateUtil.formateDate(new Date(), "yyyyMMdd"), "yyyyMMdd");
            TAireadExample aireadExample = new TAireadExample();
            TAireadExample.Criteria aircriteria = aireadExample.createCriteria();
            aircriteria.andSampleTimeGreaterThanOrEqualTo(nowdate);
            aircriteria.andStationCodeIn(stations);
            Page<Object> pageObject = new Page<>();
            List<TAiread> tAireads = tAireadMapper.selectByExample(aireadExample);
            List<String> accall1 = tAireads.stream().map(o -> o.getStationCode()).collect(Collectors.toList());
            List<String> accdistinct1 = accall1.stream().distinct().collect(Collectors.toList());
            pageObject.setPageNum(accdistinct1.size() / rows + 1);
            pageObject.setPageSize(rows);
            pageObject.setTotal(accdistinct1.size());
            List<String> accdistinct1_res = new ArrayList<>();
            if (sn == null && stationName == null) {//没有条件走分页
                for (int i = 0; i < 10; i++) {
                    if ((page - 1) * 10 + i < accdistinct1.size()) {
                        accdistinct1_res.add(accdistinct1.get((page - 1) * 10 + i));
                    }
                }
            } else {
                accdistinct1_res.addAll(accdistinct1);
            }
            for (StationAcc acc : stationAccs) {
                {
                    if (accdistinct1_res.contains(acc.getStationCode())) {
                        StationAccModel model = new StationAccModel();
                        BeanUtils.copyProperties(acc, model);
                        DeviceStatusModel statusModel = new DeviceStatusModel();
                        model.setDeviceStatusModel(statusModel);
                        //获取最新对数
                        TAireadModel taireadM = tAireadService.findLatesTAireadByStationCode(model.getStationCode());
                        if (taireadM != null) {
                            statusModel.setRsrp(taireadM.getRsrp());
                            statusModel.setSocRate(taireadM.getSocRate());
                        }
                        statusModel.setDeviceSn(model.getDeviceSn());
                        statusModel.setDeviceSetupDate(model.getDeviceSetupDate());
                        statusModel.setDeviceUnitName(tAireadService.getDeviceUnitName(model));
                        //获取安装信息
                        TAicbqCfgModel tAicbqCfgModel = TAicbqCfgService.findTAicbqCfgModel(model.getDeviceSn(), model.getStationCode(), "1");
                        if (tAicbqCfgModel != null) {
                            statusModel.setDnType(tAicbqCfgModel.getDnType());
                            statusModel.setSampleInterval(tAicbqCfgModel.getSampleInterval());
                        }
                        //获取预警信息
                        if (taireadM != null) {
                            int day_cha = DateUtil.getSencondsbetweenTime(taireadM.getSampleTime(), new Date()) / 60 / 60 / 24;
                            if (day_cha > 3) {//三日不在线
                                statusModel.setDangrzx("否");
                                statusModel.setSanrzx("否");
                            } else if (day_cha > 1 && day_cha <= 3) {//
                                statusModel.setDangrzx("否");
                                statusModel.setSanrzx("是");
                            } else {//
                                statusModel.setDangrzx("是");
                                statusModel.setSanrzx("是");
                            }
                        } else {
                            statusModel.setDangrzx("否");
                            statusModel.setSanrzx("否");
                        }
                        stationAccModelList.add(model);
                    }

                }
            }
            return new ResPageModel(stationAccModelList, pageObject);

        } else if ("3".equals(type)) {//设备故障明细
            TAffiliatedunitModel userUnitModel = tAffiliatedunitService.findTAffiliatedunit(unitCode);
            TotalDeviceInfo resModel = new TotalDeviceInfo();
            StationAccExample example = new StationAccExample();
            StationAccExample.Criteria criteria = example.createCriteria();
            if (deviceType != null) {
                criteria.andDeviceTypeEqualTo(deviceType);
            }
            if (!unitCode.equals("88888888")) {//小程序特殊处理,内部用户看全部用水户 2022-08-27 guozhao
                if (userUnitModel.getUnitType().equals("4")) {
                    criteria.andUnitCodeEqualTo(unitCode);
                } else {
                    criteria.andVisUnitCodesLike("%" + unitCode + "%");
                }
            }
            criteria.andDeviceSetupFlagEqualTo("1");//已安装
            List<StationAcc> stationAccs = stationAccMapper.selectByExample(example);
            List<String> stations = stationAccs.stream().map(o -> o.getStationCode()).collect(Collectors.toList());
            //设备故障数
            TMarkRecordExample markRecordExample = new TMarkRecordExample();
            TMarkRecordExample.Criteria tmarkcriteria = markRecordExample.createCriteria();
            tmarkcriteria.andStationCodeIn(stations);
            tmarkcriteria.andProcessResultsEqualTo("0");
            if (sn != null) {
                tmarkcriteria.andDeviceSnLike(StringUtil.getLikeFormat(sn));
            }
            if (stationName != null) {
                tmarkcriteria.andStationNameLike(StringUtil.getLikeFormat(stationName));
            }
            Page<Object> pageObject = PageHelper.startPage(page, rows);
            List<TMarkRecord> tMarkRecords = tMarkRecordMapper.selectByExample(markRecordExample);
            Map<String, Object> markmap = new HashMap<>();
            for (TMarkRecord mark : tMarkRecords) {
                markmap.put(mark.getStationCode(), mark);
            }
            List<String> stations_tMark = tMarkRecords.stream().map(o -> o.getStationCode()).collect(Collectors.toList());
            for (StationAcc acc : stationAccs) {
                {
                    if (stations_tMark.contains(acc.getStationCode())) {
                        StationAccModel model = new StationAccModel();
                        BeanUtils.copyProperties(acc, model);
                        DeviceStatusModel statusModel = new DeviceStatusModel();
                        TMarkRecord mark = (TMarkRecord) markmap.get(acc.getStationCode());
                        statusModel.setMarkName(mark.getMarkDescription());
                        model.setDeviceStatusModel(statusModel);
                        //获取最新对数
                        TAireadModel taireadM = tAireadService.findLatesTAireadByStationCode(model.getStationCode());
                        if (taireadM != null) {
                            statusModel.setRsrp(taireadM.getRsrp());
                            statusModel.setSocRate(taireadM.getSocRate());
                        }
                        statusModel.setDeviceSn(model.getDeviceSn());
                        statusModel.setDeviceSetupDate(model.getDeviceSetupDate());
                        statusModel.setDeviceUnitName(tAireadService.getDeviceUnitName(model));
                        //获取安装信息
                        TAicbqCfgModel tAicbqCfgModel = TAicbqCfgService.findTAicbqCfgModel(model.getDeviceSn(), model.getStationCode(), "1");
                        if (tAicbqCfgModel != null) {
                            statusModel.setDnType(tAicbqCfgModel.getDnType());
                            statusModel.setSampleInterval(tAicbqCfgModel.getSampleInterval());
                        }
                        //获取预警信息
                        if (taireadM != null) {
                            int day_cha = DateUtil.getSencondsbetweenTime(taireadM.getSampleTime(), new Date()) / 60 / 60 / 24;
                            if (day_cha > 3) {//三日不在线
                                statusModel.setDangrzx("否");
                                statusModel.setSanrzx("否");
                            } else if (day_cha > 1 && day_cha <= 3) {//
                                statusModel.setDangrzx("否");
                                statusModel.setSanrzx("是");
                            } else {//
                                statusModel.setDangrzx("是");
                                statusModel.setSanrzx("是");
                            }
                        } else {
                            statusModel.setDangrzx("否");
                            statusModel.setSanrzx("否");
                        }
                        stationAccModelList.add(model);
                    }

                }
            }
            return new ResPageModel(stationAccModelList, pageObject);
        }
        return null;
    }


}
