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

import com.hst.common.service.imp.BaseBusinessServiceImp;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.util.HstDateUtil;
import com.hst.taxService.dao.XshsCommonDao;
import com.hst.taxService.domain.gt3.GsglSbGrsdsScjysdARequestDomain;
import com.hst.taxService.domain.gt3.GsglSbGrsdsScjysdAResponseDomain;
import com.hst.taxService.domain.gt3.HxzgDjZrrjjDjRequestDomain;
import com.hst.taxService.domain.gt3.HxzgDjZrrjjDjResponseDomain;
import com.hst.taxService.domain.gt3.HxzgSbBcFxmtysbDomain;
import com.hst.taxService.domain.gt3.HxzgSbBcFxmtysbRequestDomain;
import com.hst.taxService.domain.gt3.HxzgSbBcFxmtysbResponseDomain;
import com.hst.taxService.domain.gt3.HxzgSbZzsXgmSbSaveRequestDomain;
import com.hst.taxService.domain.gt3.HxzgSbZzsXgmSbSaveResponseDomain;
import com.hst.taxService.domain.gt3.HxzgSbZzsXgmSbSaveZzsxgmGridlbDomain;
import com.hst.taxService.domain.gt3.ZrrdjxxDomain;
import com.hst.taxService.domain.xshs.TaskJkSbDomain;
import com.hst.taxService.service.Gt3CommonAppService;
import com.hst.taxService.service.XshsCommonService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class XshsCommonServiceImp
extends BaseBusinessServiceImp
implements XshsCommonService {
    @Autowired
    private XshsCommonDao xshsDao;

    @Override
    public void zrrPldj() throws Exception {
        List<ZrrdjxxDomain> dataList = this.xshsDao.queryZrrpldjList();
        HxzgDjZrrjjDjRequestDomain request = null;
        for (ZrrdjxxDomain zrr : dataList) {
            Gt3CommonAppService service = this.getGt3Service();
            request = new HxzgDjZrrjjDjRequestDomain();
            request.setBid("GT3.HxzgDjZrrjjDj");
            request.setSjry(zrr.getSjry());
            request.setSjjg(zrr.getSjjg());
            request.setSfzjlxDm(zrr.getSfzjlxDm());
            request.setSfzjhm(zrr.getSfzjhm());
            request.setXm(zrr.getXm());
            request.setGjDm(zrr.getGjDm());
            request.setCsrq(HstDateUtil.getCurrentDate());
            request.setXb(zrr.getXb());
            request.setSlrDm(zrr.getSlrDm());
            request.setSlswjgDm(zrr.getSlswjgDm());
            HxzgDjZrrjjDjResponseDomain response = (HxzgDjZrrjjDjResponseDomain)service.hxzgDjZrrjjDj(request);
            if (response != null) {
                zrr.setDjxh(response.getDjxh());
                zrr.setNsrsbh(response.getNsrsbh());
                zrr.setErrMess(response.getMess());
            }
            this.xshsDao.updateXshsNsrZrrPldj(zrr);
        }
    }

    @Transactional(value="myTransactionManager_Xshs", readOnly=false, propagation=Propagation.REQUIRED)
    public void updateXshsNsrZrrPldj(ZrrdjxxDomain domain) throws Exception {
    }

    @Override
    public List<TaskJkSbDomain> queryTaskSb(String tdId) throws Exception {
        return this.xshsDao.queryTaskSb(tdId);
    }

    @Override
    public void updateTaskYxjg(TaskJkSbDomain domain) throws Exception {
        this.xshsDao.updateTaskYxjg(domain);
    }

    @Override
    public void doZzsSb(TaskJkSbDomain domain) throws Exception {
        HxzgSbZzsXgmSbSaveRequestDomain appDomain = new HxzgSbZzsXgmSbSaveRequestDomain();
        List<HxzgSbZzsXgmSbSaveZzsxgmGridlbDomain> requestList = this.xshsDao.queryDrcxList(domain, appDomain);
        if (!"00".equals(domain.getCode())) {
            return;
        }
        Gt3CommonAppService service = this.getGt3Service();
        appDomain.setDataList(requestList);
        appDomain.setBid("GT3.HxzgSbZzsXgmSbSave");
        appDomain.setYwxh(domain.getKsjsXh());
        HxzgSbZzsXgmSbSaveResponseDomain returnDomain = (HxzgSbZzsXgmSbSaveResponseDomain)service.hxzgSbZzsXgmSbSave(appDomain);
        domain.setCode(returnDomain.getCode());
        domain.setMess(returnDomain.getMess());
        domain.setPzxh(returnDomain.getPzxh());
        domain.setYbtse(returnDomain.getYbtse());
        this.xshsDao.saveDrjg(domain);
    }

    @Override
    public void doFjsSb(TaskJkSbDomain domain) throws Exception {
        HxzgSbBcFxmtysbRequestDomain appDomain = new HxzgSbBcFxmtysbRequestDomain();
        List<HxzgSbBcFxmtysbDomain> requestList = this.xshsDao.queryFjsDrcxList(domain, appDomain);
        if (!"00".equals(domain.getCode())) {
            return;
        }
        Gt3CommonAppService service = this.getGt3Service();
        appDomain.setDataList(requestList);
        appDomain.setBid("GT3.HxzgSbBcFxmtysb");
        HxzgSbBcFxmtysbResponseDomain returnDomain = (HxzgSbBcFxmtysbResponseDomain)service.hxzgSbBcFxmtysb(appDomain);
        domain.setCode(returnDomain.getCode());
        domain.setMess(returnDomain.getMess());
        domain.setPzxh(returnDomain.getPzxh());
        domain.setYbtse(returnDomain.getYbtse());
        this.xshsDao.saveDrjg(domain);
    }

    @Override
    public void doGrsdsSb(TaskJkSbDomain domain) throws Exception {
        GsglSbGrsdsScjysdARequestDomain appDomain = this.xshsDao.queryGrsdsDrcxList(domain);
        if (!"00".equals(domain.getCode())) {
            return;
        }
        Gt3CommonAppService service = this.getGt3Service();
        appDomain.setBid("GT3.GsglSbGrsdsScjysdA");
        GsglSbGrsdsScjysdAResponseDomain returnDomain = (GsglSbGrsdsScjysdAResponseDomain)service.gsglSbGrsdsScjysdA(appDomain);
        domain.setCode(returnDomain.getCode());
        domain.setMess(returnDomain.getMess());
        domain.setPzxh(returnDomain.getYzpzxh());
        this.xshsDao.saveDrjg(domain);
    }

    public Gt3CommonAppService getGt3Service() {
        return (Gt3CommonAppService)WebConstants.WEB_APP_CONTEXT.getBean("gt3CommonAppServiceImp");
    }
}
