package com.kingdee.eas.custom.synctask.handler;

import com.kingdee.eas.basedata.org.PositionInfo;
import com.kingdee.eas.framework.CoreBaseInfo;
import com.kingdee.eas.hr.org.web.handler.PositionEditHandler;
import com.kingdee.shr.base.syssetting.exception.SHRWebException;
import org.springframework.ui.ModelMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @author qingwu
 * @date 2024/10/28
 * @apiNote
 */
public class PositionEditHandlerEx extends PositionEditHandler {
    @Override
    protected void setInitData(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap, Map<String, Object> initData) throws SHRWebException {
        super.setInitData(request, response, modelMap, initData);
        PositionInfo positionInfo = (PositionInfo) modelMap.get("model");
        positionInfo.setAdminOrgUnit(null);
    }

    @Override
    protected void afterCreateNewModel(HttpServletRequest request, HttpServletResponse response, CoreBaseInfo coreBaseInfo) throws SHRWebException {
        super.afterCreateNewModel(request, response, coreBaseInfo);
        PositionInfo position = (PositionInfo)coreBaseInfo;
        position.setAdminOrgUnit(null);
    }
}
