/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  org.springframework.beans.factory.annotation.Autowired
 *  org.springframework.stereotype.Repository
 */
package com.hst.taxService.dao.imp;

import com.hst.common.domain.TaxCommonReturnDomain;
import com.hst.common.util.HstWxServiceUtil;
import com.hst.framework.common.HstSqlMapClientTemplate;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.util.HstDateUtil;
import com.hst.taxService.dao.TaxCtais2AppDao;
import com.hst.taxService.domain.ctais2.FplgxxAppDomain;
import com.hst.taxService.domain.ctais2.FplgxxDomain;
import com.hst.taxService.domain.ctais2.FplgxxReturnDomain;
import com.hst.taxService.domain.gt3.HxzgFpCxfpfsxxlbRequestDomain;
import com.hst.taxService.domain.gt3.HxzgFpCxfpfsxxlbResponseDomain;
import com.hst.taxService.domain.gt3.HxzgFplgqcmxDomain;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class TaxCtais2NsrfplgxxAppDaoImp
implements TaxCtais2AppDao {
    @Autowired
    private HstSqlMapClientTemplate sqlMapClientTemplate;

    public TaxCommonReturnDomain query(FplgxxAppDomain domain) throws Exception {
        FplgxxReturnDomain returnDomain = new FplgxxReturnDomain();
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("nsrsbh", domain.getNsrsbh());
        map.put("ssyf", domain.getSsyf());
        map.put("nsrFplgxxList", null);
        this.sqlMapClientTemplate.queryForObjectByCurr("queryNsrFplgxxList", "nsrFplgxxList", map);
        ArrayList<FplgxxDomain> dataList = new ArrayList();
        dataList = (List)map.get("nsrFplgxxList");
        returnDomain.setDataList(dataList);
        returnDomain.setCode("00");
        returnDomain.setMess("");
        return returnDomain;
    }

    public TaxCommonReturnDomain queryGt3(FplgxxAppDomain domain) throws Exception {
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("nsrsbh", domain.getNsrsbh());
        String djxh = (String)this.sqlMapClientTemplate.queryForObject("selectCtais2Nsrdjxh", map);
        FplgxxReturnDomain returnDomain = new FplgxxReturnDomain();
        HxzgFpCxfpfsxxlbRequestDomain request = new HxzgFpCxfpfsxxlbRequestDomain();
        request.setDjxh(djxh);
        request.setSssqq(domain.getSsyf());
        request.setSssqz(HstDateUtil.getLastDayOfMonth(domain.getSsyf()));
        request.setBid("GT3.HxzgFpCxfpfsxxlb");
        HxzgFpCxfpfsxxlbResponseDomain response = HstWxServiceUtil.sendMess(WebConstants.GT3JK_SJ_URL, request, "GT3.HxzgFpCxfpfsxxlb", HxzgFpCxfpfsxxlbResponseDomain.class);
        if ("00".equals(response.getCode())) {
            ArrayList<FplgxxDomain> dataList = new ArrayList<FplgxxDomain>();
            for (HxzgFplgqcmxDomain dom : response.getDataList()) {
                FplgxxDomain tmp = new FplgxxDomain();
                tmp.setFpzlDm(dom.getFpzlDm());
                tmp.setFpDm(dom.getFpDm());
                tmp.setFs(dom.getFpsl());
                tmp.setFpqh(dom.getFpqshm());
                tmp.setFpzh(dom.getFpzzhm());
                tmp.setRq(dom.getXgrq());
                dataList.add(tmp);
            }
            returnDomain.setCode(response.getCode());
            returnDomain.setMess(response.getMess());
            returnDomain.setDataList(dataList);
        } else {
            returnDomain.setCode(response.getCode());
            returnDomain.setMess(response.getMess());
        }
        return returnDomain;
    }
}
