Przeglądaj źródła

删除多余文件

Heyuan 1 rok temu
rodzic
commit
4bfcbcdeb8

+ 0 - 331
websrc/com/kingdee/eas/custom/projectbonus/web/handler/BonusCycleDynamicListHandler.java

@@ -1,331 +0,0 @@
-package com.kingdee.eas.custom.projectbonus.web.handler;
-
-import com.kingdee.bos.BOSException;
-import com.kingdee.bos.Context;
-import com.kingdee.bos.metadata.entity.FilterInfo;
-import com.kingdee.bos.metadata.entity.FilterItemCollection;
-import com.kingdee.bos.metadata.entity.FilterItemInfo;
-import com.kingdee.bos.metadata.entity.SelectorItemCollection;
-import com.kingdee.bos.util.BOSUuid;
-import com.kingdee.eas.common.EASBizException;
-import com.kingdee.eas.custom.orgunitEx.ProjectType;
-import com.kingdee.eas.custom.projectbonus.BonusCycleBusDepProjectFactory;
-import com.kingdee.eas.custom.projectbonus.BonusCycleBusDepProjectInfo;
-import com.kingdee.eas.custom.projectbonus.IBonusCycleBusDepProject;
-import com.kingdee.eas.custom.projectbonus.web.vo.*;
-import com.kingdee.eas.framework.ICoreBase;
-import com.kingdee.eas.util.app.DbUtil;
-import com.kingdee.jdbc.rowset.IRowSet;
-import com.kingdee.shr.base.syssetting.StateEnum;
-import com.kingdee.shr.base.syssetting.context.SHRContext;
-import com.kingdee.shr.base.syssetting.exception.SHRWebException;
-import com.kingdee.shr.base.syssetting.exception.ShrWebBizException;
-import com.kingdee.shr.base.syssetting.json.GridDataEntity;
-import com.kingdee.shr.base.syssetting.web.handler.DynamicListHandler;
-import com.kingdee.shr.base.syssetting.web.json.JSONUtils;
-import com.kingdee.util.StringUtils;
-import org.apache.log4j.Logger;
-import org.springframework.ui.ModelMap;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.math.BigDecimal;
-import java.sql.SQLException;
-import java.util.*;
-
-/**
- * @Description 项奖金周期表动态列表handler
- * @Date 2024/4/22 17:56
- * @Created by Heyuan
- */
-public class BonusCycleDynamicListHandler extends DynamicListHandler {
-    private static Logger logger = Logger.getLogger(BonusCycleDynamicListHandler.class);
-
-    /**
-     * 获取生效日期过滤器
-     * 移除父类方法过滤条件
-     *
-     * @param effectDate
-     * @return
-     */
-    protected FilterInfo getEffectDateFilter(Date effectDate) {
-        return null;
-    }
-
-    /**
-     * @param request
-     * @param response
-     * @param gridDataEntity
-     * @throws SHRWebException
-     */
-    protected void afterGetListData(HttpServletRequest request,
-                                    HttpServletResponse response,
-                                    GridDataEntity gridDataEntity) throws SHRWebException {
-        super.afterGetListData(request,response,gridDataEntity);
-        List<Map<String, Object>> rows = gridDataEntity.getRows();
-        //封装F7对象
-        for (int i = 0; i < rows.size(); i++) {
-            Map<String, Object> map = rows.get(i);
-            Map<String, Object> project = new HashMap<String, Object>();
-            Object obj = map.get("principal.id");
-            if (obj != null && !StringUtils.isEmpty(obj.toString())) {
-                project.put("id", obj.toString());
-                project.put("name", map.get("principal.name"));
-            }
-            //负责人
-            map.put("principal.name", project);
-        }
-    }
-
-    /**
-     * 获取默认编辑列
-     *
-     * @param request
-     * @return
-     */
-    protected Map<String, Map<String, Object>> getDefultEditColumnsSetting(HttpServletRequest request) {
-        try {
-            //设置F7编辑列属性
-            Map<String, Map<String, Object>> result = new HashMap();
-            EditColumnInfo editColumnInfo = new EditColumnInfo();
-            editColumnInfo.setName("principal.name");
-            EditOptions editoptions = editColumnInfo.getEditoptions();
-            F7Json f7Json = editoptions.getF7Json();
-            SubWidgetOptions subWidgetOptions = f7Json.getSubWidgetOptions();
-            subWidgetOptions.setUipk("com.kingdee.eas.custom.projectbonus.app.BonusCycle.Person.F7");
-            subWidgetOptions.setTitle("负责人");
-            subWidgetOptions.setQuery("com.kingdee.eas.hr.emp.app.PersonWebListQuery");
-            result.put("principal.name", editColumnInfo.convertToMap());
-            //状态枚举
-//            EditColumnInfo stateEditColumn = new EditColumnInfo();
-//            stateEditColumn.setName("bDP.state");
-//            stateEditColumn.setFormatter("shrselect");
-//            stateEditColumn.setEdittype("shrselect");
-//            stateEditColumn.setType("shrselect");
-//            EditOptions stateEditoptions = stateEditColumn.getEditoptions();
-//            stateEditoptions.setUrlSource("com.kingdee.shr.base.syssetting.StateEnum");
-//            SelectJson selectJson = stateEditoptions.getSelectJson();
-//            selectJson.setId("setState");//方法名称
-//            selectJson.setName("state");//属性名称
-//            selectJson.setEnumSource("com.kingdee.shr.base.syssetting.StateEnum");
-//            result.put("bDP.state", stateEditColumn.convertToMap());
-            return result;
-        } catch (Exception e) {
-            e.printStackTrace();
-            logger.error(e.getMessage());
-            throw new RuntimeException(e.getMessage());
-        }
-    }
-
-    /**
-     * 动态表单保存
-     *
-     * @param request
-     * @param response
-     * @param modelMap
-     * @return
-     * @throws SHRWebException
-     */
-    public void saveDynGridAction(HttpServletRequest request,
-                                  HttpServletResponse response,
-                                  ModelMap modelMap) throws SHRWebException {
-        Context ctx = SHRContext.getInstance().getContext();
-        List<Map<String, Object>> dataList = (List) JSONUtils.convertJsonToObject(request.getParameter("modi"), List.class);
-        try {
-            IBonusCycleBusDepProject iBonusCycleBusDepProject = BonusCycleBusDepProjectFactory.getLocalInstance(ctx);
-            //待更新数据集合
-            Map<String, BonusCycleBusDepProjectInfo> updateCols = new HashMap<String, BonusCycleBusDepProjectInfo>();
-            //待更新字段
-            Map<String, SelectorItemCollection> updateSics = new HashMap<String, SelectorItemCollection>();
-            for (int i = 0; i < dataList.size(); i++) {
-                Map<String, Object> map = dataList.get(i);
-                String idxValue = (String) map.get("fid");
-                BonusCycleBusDepProjectInfo info;
-                SelectorItemCollection updateSic;
-                if (updateCols.containsKey(idxValue)) {
-                    info = updateCols.get(idxValue);
-                } else {
-                    info = new BonusCycleBusDepProjectInfo();
-                    info.setId(BOSUuid.read(idxValue));
-                    updateCols.put(idxValue, info);
-                }
-                //保存更新列
-                if (updateSics.containsKey(idxValue)) {
-                    updateSic = updateSics.get(idxValue);
-                } else {
-                    updateSic = new SelectorItemCollection();
-                    updateSics.put(idxValue, updateSic);
-                }
-                //列名
-                String colName = (String) map.get("column");
-                //数据类型
-                String dataType = (String) map.get("type");
-                //值
-                Object valueObj = map.get("value");
-                if ("BigDecimal".equals(dataType) && StringUtils.isEmpty(valueObj.toString())) {
-                    valueObj = BigDecimal.ZERO;
-                }
-                updateSic.add(colName);
-                info.put(colName, valueObj);
-            }
-            for (String id : updateCols.keySet()) {
-                BonusCycleBusDepProjectInfo info = updateCols.get(id);
-                SelectorItemCollection updateSic = updateSics.get(id);
-                //更新
-                iBonusCycleBusDepProject.updatePartial(info, updateSic);
-            }
-            JSONUtils.SUCCESS("成功修改" + dataList.size() + "条数据");
-        } catch (Exception var27) {
-            var27.printStackTrace();
-            logger.error(var27.getMessage());
-            throw new ShrWebBizException(var27.getMessage(), var27);
-        }
-    }
-
-    /**
-     * 同步事业部项目
-     *
-     * @param request
-     * @param response
-     * @param modelMap
-     * @throws SHRWebException
-     */
-    public void syncDepProjectAction(HttpServletRequest request,
-                                     HttpServletResponse response,
-                                     ModelMap modelMap) throws SHRWebException {
-        String parentId = request.getParameter("parentId");//周期id
-        if (StringUtils.isEmpty(parentId)) {
-            logger.error("周期id不能为空!");
-            throw new ShrWebBizException("周期id不能为空!");
-        }
-        logger.info("syncDepProjectAction_parentId: " + parentId);
-        Context ctx = SHRContext.getInstance().getContext();
-        String querySql = "SELECT" +
-                "   fid," +
-                "   CFProjectType1," +
-                "   FParentID" +
-                " FROM" +
-                "   t_org_admin" +
-                " where" +
-                "   CFProjectType1 in ('1', '2', '3', '4', '5')" +
-                "   and fid not in (" +
-                "       SELECT" +
-                "           case" +
-                "               when CFProjectID is null then CFBusDepID" +
-                "               else CFProjectID" +
-                "           end depId" +
-                "       FROM" +
-                "       CT_PB_BonusCycleBusDepProject" +
-                "       where fparentId = ?) and FIsOUSealUp = 0";
-        logger.info("syncDepProjectAction_querySql: " + querySql);
-        try {
-            IRowSet iRowSet = DbUtil.executeQuery(ctx, querySql, new Object[]{parentId});
-            int addCount = 0;
-            IBonusCycleBusDepProject iBonusCycleBusDepProject = BonusCycleBusDepProjectFactory.getLocalInstance(ctx);
-            while (iRowSet.next()) {
-                String fid = iRowSet.getString("fid");//组织id
-                String projectType = iRowSet.getString("CFProjectType1");
-                String orgParentId = iRowSet.getString("FParentID");//组织父级id
-                BonusCycleBusDepProjectInfo info = new BonusCycleBusDepProjectInfo();
-                //过滤器
-                FilterInfo filterInfo = new FilterInfo();
-                FilterItemCollection filterItems = filterInfo.getFilterItems();
-                filterItems.add(new FilterItemInfo("parent", parentId));
-                info.put("parent", parentId);
-                if ("1".equals(projectType)) {
-                    info.put("busDep", fid);
-                    filterItems.add(new FilterItemInfo("busDep", fid));
-                } else {
-                    info.put("busDep", orgParentId);
-                    info.put("project", fid);
-                    filterItems.add(new FilterItemInfo("busDep", orgParentId));
-                    filterItems.add(new FilterItemInfo("project", fid));
-                }
-                info.setType(ProjectType.getEnum(projectType).getAlias());
-                info.setState(StateEnum.New);
-                if (!iBonusCycleBusDepProject.exists(filterInfo)) {
-                    try {
-                        iBonusCycleBusDepProject.save(info);
-                        addCount++;
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }
-            }
-            logger.info("新增" + addCount + "条事业部项目数据");
-            JSONUtils.SUCCESS("新增" + addCount + "条事业部项目数据");
-        } catch (BOSException e) {
-            e.printStackTrace();
-            throw new ShrWebBizException(e);
-        } catch (SQLException e) {
-            e.printStackTrace();
-            throw new ShrWebBizException(e);
-        } catch (EASBizException e) {
-            e.printStackTrace();
-            throw new ShrWebBizException(e);
-        }
-    }
-
-    /**
-     * @param request
-     * @return
-     * @throws SHRWebException
-     */
-    @Override
-    protected ICoreBase getBizInterface(HttpServletRequest request) throws SHRWebException {
-        Context ctx = SHRContext.getInstance().getContext();
-        try {
-            return BonusCycleBusDepProjectFactory.getLocalInstance(ctx);
-        } catch (BOSException e) {
-            e.printStackTrace();
-            throw new ShrWebBizException(e.getMessage());
-        }
-    }
-
-    /**
-     * 创建事业部项目
-     *
-     * @param request
-     * @param response
-     * @param modelMap
-     * @throws SHRWebException
-     */
-//    public void enableAction(HttpServletRequest request,
-//                             HttpServletResponse response,
-//                             ModelMap modelMap) throws SHRWebException {
-//        String parentId = request.getParameter("parentId");//周期id
-//        String orgUnitIds = request.getParameter("orgUnitIds");//事业部id
-//        if (StringUtils.isEmpty(parentId)) {
-//            throw new ShrWebBizException("周期id不能为空!");
-//        }
-//        if (StringUtils.isEmpty(orgUnitIds)) {
-//            throw new ShrWebBizException("事业部id不能为空!");
-//        }
-//
-//
-//    }
-
-    /**
-     * 创建事业部项目
-     *
-     * @param request
-     * @param response
-     * @param modelMap
-     * @throws SHRWebException
-     */
-//    public void disableAction(HttpServletRequest request,
-//                             HttpServletResponse response,
-//                             ModelMap modelMap) throws SHRWebException {
-//        String parentId = request.getParameter("parentId");//周期id
-//        String orgUnitIds = request.getParameter("orgUnitIds");//事业部id
-//        if (StringUtils.isEmpty(parentId)) {
-//            throw new ShrWebBizException("周期id不能为空!");
-//        }
-//        if (StringUtils.isEmpty(orgUnitIds)) {
-//            throw new ShrWebBizException("事业部id不能为空!");
-//        }
-//
-//
-//    }
-
-}