/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.google.common.reflect.TypeToken
 *  com.google.gson.Gson
 *  org.springframework.beans.factory.annotation.Autowired
 *  org.springframework.stereotype.Service
 */
package com.hst.task.service;

import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.hst.common.domain.TaxCommonReturnDomain;
import com.hst.common.util.HstWxServiceUtil;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.dao.BaseDao;
import com.hst.framework.service.BaseService;
import com.hst.task.dao.ZhdMqDaoImp;
import com.hst.task.domain.zhdtmq.BaseReturnDomain;
import com.hst.task.domain.zhdtmq.BsdtGetBsdtRltjxxReturnDomain;
import com.hst.task.domain.zhdtmq.BsdtGetBsdtYwtjxxReturnDomain;
import com.hst.task.domain.zhdtmq.DqYjdjDomain;
import com.hst.task.domain.zhdtmq.DqYjzbZtqkDomain;
import com.hst.task.domain.zhdtmq.DqckxxDomain;
import com.hst.task.domain.zhdtmq.DqdhrsfbDomain;
import com.hst.task.domain.zhdtmq.DqyjzbYwflDomain;
import com.hst.task.domain.zhdtmq.QhjGetYwflDomain;
import com.hst.task.domain.zhdtmq.QhjGetYwflReturnDomain;
import com.hst.taxService.dao.imp.TaxSmzAppDaoImp;
import com.hst.taxService.domain.dsyyqh.BookableItemsDto;
import com.hst.taxService.domain.dsyyqh.DsYyqhBaseResponse;
import com.hst.taxService.domain.smz.JhxtGetJhListReturnDomain;
import com.hst.taxService.domain.smz.JhxtGetYwfl2AppDomain;
import com.hst.taxService.domain.smz.JhxtGetYwfl2ReturnDomain;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ZhdtMqService
implements BaseService {
    @Autowired
    private ZhdMqDaoImp dao;

    public void doYWFL() throws Exception {
        String mqkey = "BSDT_YWFL_" + WebConstants.SMZ_RXBD_BSDT_DJXH;
        QhjGetYwflReturnDomain returnDomain = this.dao.doYWFL();
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("mqkey", mqkey);
        map.put("mqdata", new Gson().toJson((Object)returnDomain));
        HstWxServiceUtil.sendMess(WebConstants.MQ_TRANSFER_URL, map, "utf-8");
    }

    public void doYWLTJ() throws Exception {
        String mqkey = "BSDT_YWLTJ_" + WebConstants.SMZ_RXBD_BSDT_DJXH;
        BsdtGetBsdtYwtjxxReturnDomain returnDomain = this.dao.doYWLTJ();
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("mqkey", mqkey);
        map.put("mqdata", new Gson().toJson((Object)returnDomain));
        HstWxServiceUtil.sendMess(WebConstants.MQ_TRANSFER_URL, map, "utf-8");
    }

    public void doRLLXX() throws Exception {
        String mqkey = "BSDT_RLLXX_" + WebConstants.SMZ_RXBD_BSDT_DJXH;
        BsdtGetBsdtRltjxxReturnDomain returnDomain = this.dao.doRLLXX();
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("mqkey", mqkey);
        map.put("mqdata", new Gson().toJson((Object)returnDomain));
        HstWxServiceUtil.sendMess(WebConstants.MQ_TRANSFER_URL, map, "utf-8");
    }

    public void doYWFLDHXX() throws Exception {
        String mqkey = "BSDT_YWFLDHXX_" + WebConstants.SMZ_RXBD_BSDT_DJXH;
        HashMap<String, String> map = new HashMap<String, String>();
        JhxtGetYwfl2ReturnDomain returnDomain = (JhxtGetYwfl2ReturnDomain)((TaxSmzAppDaoImp)this.getDao("taxSmzAppDaoImp")).JhxtGetYwfl2(new JhxtGetYwfl2AppDomain());
        map.put("mqkey", mqkey);
        map.put("mqdata", new Gson().toJson((Object)returnDomain));
        HstWxServiceUtil.sendMess(WebConstants.MQ_TRANSFER_URL, map, "utf-8");
    }

    public void doDQHHLIST() throws Exception {
        String mqkey = "BSDT_DQHHLIST_" + WebConstants.SMZ_RXBD_BSDT_DJXH;
        HashMap<String, String> map = new HashMap<String, String>();
        JhxtGetJhListReturnDomain returnDomain = new JhxtGetJhListReturnDomain();
        returnDomain.setDataList(WebConstants.JHXT_JHXX_LIST);
        returnDomain.setCode("00");
        map.put("mqkey", mqkey);
        map.put("mqdata", new Gson().toJson((Object)returnDomain));
        HstWxServiceUtil.sendMess(WebConstants.MQ_TRANSFER_URL, map, "utf-8");
    }

    public void doDsYwfl() throws Exception {
        String path = "/openintf/booking/getBookableItemsByArea.json";
        for (Map.Entry<String, String> entry : WebConstants.YYQH_DS_BSDT.entrySet()) {
            Type objectType;
            QhjGetYwflReturnDomain returnDomain = new QhjGetYwflReturnDomain();
            HashMap<String, String> params = new HashMap<String, String>();
            params.put("areaId", entry.getValue());
            Map<String, String> res = HstWxServiceUtil.sendMessForBasicAuth(String.valueOf(WebConstants.DS_YYQH_URL) + path, params, "utf-8", WebConstants.DS_YYQH_USERNAME, WebConstants.DS_YYQH_PASSWORD);
            if (!"00".equals(res.get("code"))) continue;
            Gson gson = new Gson();
            String json = res.get("mess");
            DsYyqhBaseResponse response = (DsYyqhBaseResponse)gson.fromJson(json, objectType = new TypeToken<DsYyqhBaseResponse<List<BookableItemsDto>>>(){}.getType());
            if ("0".equals(response.getCode())) {
                ArrayList<QhjGetYwflDomain> dataList = new ArrayList<QhjGetYwflDomain>();
                for (BookableItemsDto dto : (List)response.getData()) {
                    QhjGetYwflDomain data = new QhjGetYwflDomain();
                    data.setYwflbm(dto.getTicketItemId());
                    data.setYwflmc(dto.getTicketItemName());
                    dataList.add(data);
                }
                returnDomain.setDataList(dataList);
                returnDomain.setCode("00");
                String mqkey = "BSDT_YWFL_" + entry.getKey();
                HashMap<String, String> map = new HashMap<String, String>();
                map.put("mqkey", mqkey);
                map.put("mqdata", new Gson().toJson((Object)returnDomain));
                HstWxServiceUtil.sendMess(WebConstants.ZHDT_SERVICE_URL, map, "utf-8");
                continue;
            }
            returnDomain.setCode("01");
            returnDomain.setMess(response.getMessage());
        }
    }

    public BaseDao getDao(String daoName) {
        return (BaseDao)WebConstants.WEB_APP_CONTEXT.getBean(daoName);
    }

    public void doDQYJDJ() {
        String mqkey = "BSDT_DQYJDJ_" + WebConstants.SMZ_RXBD_BSDT_DJXH;
        HashMap<String, String> map = new HashMap<String, String>();
        BaseReturnDomain<DqYjdjDomain> returnDomain = this.dao.doDQYJDJ();
        map.put("mqkey", mqkey);
        map.put("mqdata", new Gson().toJson(returnDomain));
        HstWxServiceUtil.sendMess(WebConstants.MQ_TRANSFER_URL, map, "utf-8");
    }

    public void doDQYJZBZTQK() {
        String mqkey = "BSDT_DQYJZBZTQK_" + WebConstants.SMZ_RXBD_BSDT_DJXH;
        HashMap<String, String> map = new HashMap<String, String>();
        BaseReturnDomain<DqYjzbZtqkDomain> returnDomain = this.dao.doDQYJZBZTQK();
        map.put("mqkey", mqkey);
        map.put("mqdata", new Gson().toJson(returnDomain));
        HstWxServiceUtil.sendMess(WebConstants.MQ_TRANSFER_URL, map, "utf-8");
    }

    public void doDQYJZBYWFL() {
        String mqkey = "BSDT_DQYJZBYWFL_" + WebConstants.SMZ_RXBD_BSDT_DJXH;
        HashMap<String, String> map = new HashMap<String, String>();
        BaseReturnDomain<DqyjzbYwflDomain> returnDomain = this.dao.doDQYJZBYWFL();
        map.put("mqkey", mqkey);
        map.put("mqdata", new Gson().toJson(returnDomain));
        HstWxServiceUtil.sendMess(WebConstants.MQ_TRANSFER_URL, map, "utf-8");
    }

    public void doDQDHRSFB() {
        String mqkey = "BSDT_DQDHRSFB_" + WebConstants.SMZ_RXBD_BSDT_DJXH;
        HashMap<String, String> map = new HashMap<String, String>();
        BaseReturnDomain<DqdhrsfbDomain> returnDomain = this.dao.doDQDHRSFB();
        map.put("mqkey", mqkey);
        map.put("mqdata", new Gson().toJson(returnDomain));
        HstWxServiceUtil.sendMess(WebConstants.MQ_TRANSFER_URL, map, "utf-8");
    }

    public void doDQCKXX() {
        String mqkey = "BSDT_DQCKXX_" + WebConstants.SMZ_RXBD_BSDT_DJXH;
        HashMap<String, String> map = new HashMap<String, String>();
        BaseReturnDomain<DqckxxDomain> returnDomain = this.dao.doDQCKXX();
        map.put("mqkey", mqkey);
        map.put("mqdata", new Gson().toJson(returnDomain));
        HstWxServiceUtil.sendMess(WebConstants.MQ_TRANSFER_URL, map, "utf-8");
    }

    public void doYjJs() {
        TaxCommonReturnDomain jsRetrun = this.dao.doYjJs();
        _logger.debug((Object)("YJJS_RTN" + jsRetrun.getCode() + jsRetrun.getMess()));
        if ("0".equals(jsRetrun.getCode()) || "00".equals(jsRetrun.getCode())) {
            this.doDQYJDJ();
            this.doDQYJZBZTQK();
            this.doDQYJZBYWFL();
            this.doDQDHRSFB();
            this.doDQCKXX();
        }
    }
}
