package nccloud.hrkq.hrkq.monthottimevo.action;

import org.apache.commons.lang3.StringUtils;

import nc.vo.hi.psndoc.PsnJobVO;
import nc.vo.hrkq.monthottime.AggMonthOtTimeVO;
import nc.vo.hrkq.monthottime.MonthOtTimeVO;
import nc.vo.pub.BusinessRuntimeException;
import nc.vo.uif2.LoginContext;
import nccloud.framework.web.container.IRequest;
import nccloud.framework.web.ui.pattern.billcard.BillCardOperator;
import nccloud.web.hr.pub.HRCommonAction;
import nccloud.web.hr.pub.HRNccUtils;
import nccloud.web.hrkq.common.utils.AttendDataUtil;
import nccloud.web.uapbd.commons.web.ParamUtils;

public class MonthOtVOHeadAddAction extends HRCommonAction{

	@Override
	public <T> Object execute(IRequest request, T para) throws Exception {
		ParamUtils param = new ParamUtils(request);
		LoginContext context = HRNccUtils.getLoginContext(param);
		
		String key = param.getString("key", null);
		if (StringUtils.isBlank(key)) {
			throw new BusinessRuntimeException("Parameter Error!");
		}
		String page_code = param.getString("page_code", null);
		if (StringUtils.isBlank(page_code)) {
			throw new BusinessRuntimeException("Parameter Error!");
		}
		
		String area_code = param.getString("area_code", null);
		if (StringUtils.isBlank(area_code)) {
			throw new BusinessRuntimeException("Parameter Error!");
		}
		BillCardOperator billCardOperator = new BillCardOperator();
		AggMonthOtTimeVO aggVO = new AggMonthOtTimeVO();
		PsnJobVO psnjobVO = AttendDataUtil.queryPsnJob(null);
		MonthOtTimeVO parent = new MonthOtTimeVO();
	    parent.setAttributeValue(MonthOtTimeVO.PK_PSNDOC,psnjobVO.getPk_psndoc());
	    parent.setAttributeValue(MonthOtTimeVO.PK_DEPT,psnjobVO.getPk_dept());
	    parent.setAttributeValue(MonthOtTimeVO.PK_ORG,psnjobVO.getPk_org());
	    parent.setAttributeValue(MonthOtTimeVO.PK_GROUP,psnjobVO.getPk_group());
	    aggVO.setParentVO(parent);
		
	    BillCardOperator operator = new BillCardOperator("60201072_CARD");
	    return operator.toCard(aggVO);
	}

}
