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

import com.hst.common.domain.BaseAppServiceDomain;
import com.hst.common.util.HstWxServiceUtil;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.service.BaseService;
import com.hst.framework.util.HstDateUtil;
import com.hst.task.dao.TaxCommonScudulerDaoImp;
import com.hst.task.domain.ApiUrlData;
import com.hst.task.domain.DsBsdtDybDto;
import com.hst.task.domain.JhxtBsdtTbsjDomain;
import com.hst.task.domain.JhxxData;
import com.hst.taxService.domain.gt3.HxzgQtGetCurtimeResponseDomain;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TaxCommonScdulerService
implements BaseService {
    @Autowired
    private TaxCommonScudulerDaoImp dao;

    public void doGetJhxtJhxxList() throws Exception {
        List<JhxxData> dataList = this.dao.doGetJhxtJhxxList();
        WebConstants.JHXT_JHXX_LIST = dataList;
    }

    public void doUploadServerTime() throws Exception {
        BaseAppServiceDomain request = new BaseAppServiceDomain();
        HxzgQtGetCurtimeResponseDomain response = HstWxServiceUtil.sendMess(WebConstants.GT3JK_SJ_URL, request, "GT3.HxzgQtGetCurtime", HxzgQtGetCurtimeResponseDomain.class);
        String gt3Time = response.getCurtime();
        JhxtBsdtTbsjDomain data = new JhxtBsdtTbsjDomain();
        data.setBsdtDxjh(WebConstants.SMZ_RXBD_BSDT_DJXH);
        data.setGt3Sj(gt3Time);
        String jhjsj = HstDateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
        data.setJhxtSj(jhjsj);
        long sjc = (HstDateUtil.parse(gt3Time, "yyyy-MM-dd HH:mm:ss").getTime() - HstDateUtil.parse(jhjsj, "yyyy-MM-dd HH:mm:ss").getTime()) / 1000L;
        data.setSjc(String.valueOf(sjc));
        this.dao.doUpdateBsdtTbsj(data);
    }

    public void doInitBsdtDsDygx() throws Exception {
        List<DsBsdtDybDto> datalist = this.dao.queryBsdtDsDygx();
        WebConstants.YYQH_DS_BSDT.clear();
        for (DsBsdtDybDto dto : datalist) {
            WebConstants.YYQH_DS_BSDT.put(dto.getBsdtDjxh(), dto.getAreaId());
        }
    }

    public void doInitApiUrl() throws Exception {
        List<ApiUrlData> datalist = this.dao.doInitApiUrl();
        WebConstants.JHXT_BID_URL_MAP.clear();
        for (ApiUrlData dto : datalist) {
            WebConstants.JHXT_BID_URL_MAP.put(dto.getBid(), dto.getUrl());
        }
    }
}
