package com.ibiz.core.module.service.logic.impl;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;

import com.ibiz.core.module.service.logic.IPSXDLogic;
import com.ibiz.core.module.domain.PS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.KieContainer;

/**
 * 关系型数据实体[XD] 对象
 */
@Service
public class PSXDLogicImpl implements IPSXDLogic{

    @Autowired
    private KieContainer kieContainer;

    @Autowired
    private com.ibiz.core.module2.service.IHealthcheckService healthcheckservice;

    @Autowired
    private com.ibiz.core.module.service.IPSService iBzSysDefaultService;

    public void execute(PS et){

          KieSession kieSession = null;
        try{
           kieSession=kieContainer.newKieSession();
           kieSession.insert(et); 
           kieSession.setGlobal("psxddefault",et);
           com.ibiz.core.module2.domain.Healthcheck  psxdhealthcheck =new com.ibiz.core.module2.domain.Healthcheck();
           kieSession.insert(psxdhealthcheck); 
           kieSession.setGlobal("psxdhealthcheck",psxdhealthcheck);
           kieSession.setGlobal("healthcheckservice",healthcheckservice);
           kieSession.setGlobal("iBzSysPsDefaultService",iBzSysDefaultService);
           kieSession.startProcess("com.ibiz.core.module.service.logic.psxd");

        }catch(Exception e){
            throw new RuntimeException("执行[下单]处理逻辑发生异常"+e);
        }finally {
            if(kieSession!=null)
            kieSession.destroy();
        }
    }

}
