package com.chinaweal.aiccs.aiccs.annual.service.impl;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.chinaweal.aiccs.aiccs.annual.entity.EPubObjection;
import com.chinaweal.aiccs.aiccs.annual.mapper.EPubObjectionMapper;
import com.chinaweal.aiccs.aiccs.annual.service.EPubObjectionService;
import com.chinaweal.aiccs.common.util.StringUtils;
import com.chinaweal.youfool.framework.springboot.mybatis.plus.BaseServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author sh
 * @since 2021-10-17
 */
@Service
public class EPubObjectionServiceImpl extends BaseServiceImpl<EPubObjectionMapper, EPubObjection> implements EPubObjectionService {

    @Override
    public IPage<EPubObjection> selectEPubObjectionPage(IPage<EPubObjection> page, Map<String, Object> params) {
        String UNISCIDandREGNO = "";
        if(params!=null){
            if(params.get("UNISCIDandREGNO")!=null){
                UNISCIDandREGNO = params.get("UNISCIDandREGNO").toString();
                if(StringUtils.isNotBlank(UNISCIDandREGNO)){
                    if(StringUtils.isUscc(UNISCIDandREGNO)){
                        params.put("UNISCID", UNISCIDandREGNO);
                    } else {
                        params.put("REGNO", UNISCIDandREGNO);
                    }
                }
            }
            if (params.get("establishDate")!=null) {
                List<String> establishDate = (List<String>) params.get("establishDate");
                if(establishDate.size()>0){
                    params.put("OBJECTION_TIME_start", establishDate.get(0));
                    params.put("OBJECTION_TIME_end", establishDate.get(1));
                }
            }
        }
        return baseMapper.selectEPubObjectionPage(page,params);
    }
}
