|
|
@@ -1,212 +1,176 @@
|
|
|
+// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
|
|
|
+// Jad home page: http://www.kpdus.com/jad.html
|
|
|
+// Decompiler options: packimports(3)
|
|
|
+// Source File Name: MemberManagementListHandler.java
|
|
|
+
|
|
|
package com.kingdee.eas.hr.project.handler;
|
|
|
|
|
|
-import com.google.common.collect.Maps;
|
|
|
-import com.google.common.collect.Sets;
|
|
|
import com.kingdee.bos.BOSException;
|
|
|
import com.kingdee.bos.Context;
|
|
|
-import com.kingdee.bos.ctrl.kdf.table.IRow;
|
|
|
+import com.kingdee.bos.dao.IObjectValue;
|
|
|
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
|
|
|
-import com.kingdee.bos.metadata.entity.*;
|
|
|
-import com.kingdee.bos.metadata.query.util.CompareType;
|
|
|
-import com.kingdee.bos.rabbitmq.guava.Lists;
|
|
|
-import com.kingdee.eas.basedata.person.PersonFactory;
|
|
|
-import com.kingdee.eas.basedata.person.PersonInfo;
|
|
|
+import com.kingdee.bos.framework.DynamicObjectFactory;
|
|
|
+import com.kingdee.bos.framework.IDynamicObject;
|
|
|
+import com.kingdee.bos.util.BOSObjectType;
|
|
|
+import com.kingdee.bos.util.BOSUuid;
|
|
|
+import com.kingdee.eas.basedata.person.*;
|
|
|
import com.kingdee.eas.common.EASBizException;
|
|
|
import com.kingdee.eas.framework.ICoreBase;
|
|
|
import com.kingdee.eas.hr.project.*;
|
|
|
+import com.kingdee.eas.hr.project.utils.ManageUtils;
|
|
|
import com.kingdee.eas.util.app.DbUtil;
|
|
|
-import com.kingdee.jdbc.rowset.IRowSet;
|
|
|
+import com.kingdee.shr.base.syssetting.ISHRCommonFacade;
|
|
|
import com.kingdee.shr.base.syssetting.SHRCommonFacadeFactory;
|
|
|
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.ml.SHRWebResource;
|
|
|
-import com.kingdee.shr.base.syssetting.web.dynamic.model.ListUIViewInfo;
|
|
|
-import com.kingdee.shr.base.syssetting.web.dynamic.model.TreeNavigationInfo;
|
|
|
-import com.kingdee.shr.base.syssetting.web.dynamic.model.UIViewInfo;
|
|
|
-import com.kingdee.shr.base.syssetting.web.handler.ListHandler;
|
|
|
-import com.kingdee.shr.base.syssetting.web.plugin.PluginUtil;
|
|
|
import com.kingdee.util.StringUtils;
|
|
|
-import org.springframework.ui.ModelMap;
|
|
|
+import java.io.PrintStream;
|
|
|
+import java.text.MessageFormat;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import java.lang.reflect.InvocationTargetException;
|
|
|
-import java.lang.reflect.Method;
|
|
|
-import java.sql.SQLException;
|
|
|
-import java.text.MessageFormat;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
-
|
|
|
-/**
|
|
|
- * @BelongsProject: dataImpExp820
|
|
|
- * @BelongsPackage: com.kingdee.eas.hr.project.handler
|
|
|
- * @Author: lhbj
|
|
|
- * @CreateTime: 2024-11-27 18:21
|
|
|
- * @Description: TODO
|
|
|
- * @Version: 1.0
|
|
|
- */
|
|
|
-public class MemberManagementListHandler extends ProjectTreeListHandler {
|
|
|
- protected String pTypeManagerNumber = "ProjectManager";
|
|
|
-
|
|
|
- protected String pTypeNumber = "ProjectMember";
|
|
|
-
|
|
|
- @Override
|
|
|
- public String enableAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
|
|
|
- String billId = this.getBillId(request);
|
|
|
- String[] ids = billId.split(",");
|
|
|
- Context ctx = SHRContext.getInstance().getContext();
|
|
|
-
|
|
|
- boolean isHandleEnable=false;
|
|
|
- try {
|
|
|
- IMemberManagement iManagement = MemberManagementFactory.getLocalInstance(ctx);
|
|
|
- IProjectRole iProjectRole = ProjectRoleFactory.getLocalInstance(ctx);
|
|
|
- IProjectType iPType = ProjectTypeFactory.getLocalInstance(ctx);
|
|
|
- for (String str : ids) {
|
|
|
- Set<String> idset = Sets.newHashSet();
|
|
|
- idset.addAll(Arrays.asList(ids));
|
|
|
- idset.remove(str);
|
|
|
- MemberManagementInfo management = iManagement.getMemberManagementInfo(new ObjectUuidPK(str));
|
|
|
- ProjectRoleInfo projectRole = management.getProjectRole();
|
|
|
- PersonInfo personInfo = management.getEmployee();
|
|
|
- ProjectManagementInfo projectManagement = management.getProjectManagement();
|
|
|
- ProjectTypeInfo pType = management.getPtype();
|
|
|
- pType = iPType.getProjectTypeInfo(new ObjectUuidPK(pType.getId()));
|
|
|
- projectRole =iProjectRole.getProjectRoleInfo(new ObjectUuidPK(projectRole.getId()));
|
|
|
- //判断当前项目下有没有已经启用
|
|
|
- StringBuilder selPe = new StringBuilder();
|
|
|
- selPe.append(" select fid from CT_PRO_MEMBERMANAGEMENT ");
|
|
|
- selPe.append(" where CFPROJECTMANAGEMENID = ? ");
|
|
|
- selPe.append(" and CFEMPLOYEEID = ? ");
|
|
|
- selPe.append(" and CFSTATE = 1 ");
|
|
|
- IRowSet rs = DbUtil.executeQuery(ctx,selPe.toString(),new String[]{projectManagement.getId().toString(),personInfo.getId().toString()});
|
|
|
- if(rs.next()){
|
|
|
- isHandleEnable=false;
|
|
|
- throw new ShrWebBizException("已经存在项目类别:" + pType.getName() + "的成员了,请先将该员工禁用后再启用,请检查。");
|
|
|
- }
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
|
|
|
- FilterInfo filterInfo = new FilterInfo();
|
|
|
- filterInfo.getFilterItems().add(new FilterItemInfo("projectManagement.id", projectManagement.getId().toString(), CompareType.EQUALS));
|
|
|
- //不为角色类型为项目经理时才判断角色
|
|
|
- if(!(pTypeManagerNumber.equals(pType.getNumber()))) {
|
|
|
- filterInfo.getFilterItems().add(new FilterItemInfo("projectRole.id", projectRole.getId().toString(), CompareType.EQUALS));
|
|
|
- }
|
|
|
- filterInfo.getFilterItems().add(new FilterItemInfo("state", "1", CompareType.EQUALS));
|
|
|
- filterInfo.getFilterItems().add(new FilterItemInfo("ptype.id", pType.getId().toString(), CompareType.EQUALS));
|
|
|
- filterInfo.getFilterItems().add(new FilterItemInfo("ptype.number", pTypeNumber, CompareType.NOTEQUALS));
|
|
|
+// Referenced classes of package com.kingdee.eas.hr.project.handler:
|
|
|
+// ProjectTreeListHandler
|
|
|
|
|
|
- FilterInfo filterInfo4Or = new FilterInfo();
|
|
|
- filterInfo4Or.getFilterItems().add(new FilterItemInfo("id",idset,CompareType.INCLUDE));
|
|
|
- filterInfo4Or.getFilterItems().add(new FilterItemInfo("projectManagement.id", projectManagement.getId().toString(), CompareType.EQUALS));
|
|
|
- //不为角色类型为项目经理时才判断角色
|
|
|
- if(!(pTypeManagerNumber.equals(pType.getNumber()))) {
|
|
|
- filterInfo4Or.getFilterItems().add(new FilterItemInfo("projectRole.id", projectRole.getId().toString(), CompareType.EQUALS));
|
|
|
- }
|
|
|
- //filterInfo4Or.getFilterItems().add(new FilterItemInfo("state", "1", CompareType.EQUALS));
|
|
|
- filterInfo4Or.getFilterItems().add(new FilterItemInfo("ptype.id", pType.getId().toString(), CompareType.EQUALS));
|
|
|
- filterInfo4Or.getFilterItems().add(new FilterItemInfo("ptype.number", pTypeNumber, CompareType.NOTEQUALS));
|
|
|
+public class MemberManagementListHandler extends ProjectTreeListHandler
|
|
|
+{
|
|
|
|
|
|
- filterInfo.mergeFilter(filterInfo4Or, "or");
|
|
|
- System.out.println(filterInfo.toSql());
|
|
|
- if (iManagement.exists(filterInfo)) {
|
|
|
- isHandleEnable=false;
|
|
|
- if((pTypeManagerNumber.equals(pType.getNumber()))) {
|
|
|
- throw new ShrWebBizException("已经存在项目类别:" + pType.getName() + "的成员了,请先将该员工禁用后再启用。或者选择了多位项目经理,请检查。");
|
|
|
- }else {
|
|
|
- throw new ShrWebBizException("已经存在项目类别:" + pType.getName() + ",项目角色:" + projectRole.getName() + "的成员了,请先将该员工禁用后再启用。");
|
|
|
- }
|
|
|
+ public MemberManagementListHandler()
|
|
|
+ {
|
|
|
+ pTypeManagerNumber = "ProjectManager";
|
|
|
+ pTypeNumber = "ProjectMember";
|
|
|
+ }
|
|
|
|
|
|
- }else{
|
|
|
- isHandleEnable=true;
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (BOSException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- } catch (EASBizException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- } catch (SQLException throwables) {
|
|
|
- throwables.printStackTrace();
|
|
|
- }
|
|
|
- if(isHandleEnable){
|
|
|
- this.handleEnableEx(request, "enable");
|
|
|
- }
|
|
|
+ public String enableAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap)
|
|
|
+ throws SHRWebException
|
|
|
+ {
|
|
|
+ String billId = getBillId(request);
|
|
|
+ String ids[] = billId.split(",");
|
|
|
+ Context ctx = SHRContext.getInstance().getContext();
|
|
|
+ boolean isHandleEnable = ManageUtils.memberManagementEnable(ids, pTypeManagerNumber, pTypeNumber, ctx);
|
|
|
+ if(isHandleEnable)
|
|
|
+ handleEnableEx(request, "enable");
|
|
|
return null;
|
|
|
}
|
|
|
- public String disableAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
|
|
|
- return this.handleEnableEx(request, "disable");
|
|
|
- }
|
|
|
- protected String handleEnableEx(HttpServletRequest request, String methodName) throws SHRWebException {
|
|
|
- String billId = this.getBillId(request);
|
|
|
- String[] ids = billId.split(",");
|
|
|
- ICoreBase iCoreBase = this.getBizInterface(request);
|
|
|
- Context ctx = SHRContext.getInstance().getContext();
|
|
|
- String[] var7;
|
|
|
- int var8;
|
|
|
- int var9;
|
|
|
- String id;
|
|
|
- if (!"disable".equals(methodName) && !"enable".equals(methodName)) {
|
|
|
- throw new ShrWebBizException(MessageFormat.format(SHRWebResource.getString("com.kingdee.shr.base.syssetting.SHRSyssettingResource", "method_notexist"), iCoreBase.getName(), methodName));
|
|
|
- } else {
|
|
|
- var7 = ids;
|
|
|
- var8 = ids.length;
|
|
|
|
|
|
- for(var9 = 0; var9 < var8; ++var9) {
|
|
|
- id = var7[var9];
|
|
|
- this.doEnableBySqlEx(ctx ,id, methodName);
|
|
|
- }
|
|
|
+ public String disableAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap)
|
|
|
+ throws SHRWebException
|
|
|
+ {
|
|
|
+ return handleEnableEx(request, "disable");
|
|
|
+ }
|
|
|
|
|
|
- return null;
|
|
|
+ protected String handleEnableEx(HttpServletRequest request, String methodName)
|
|
|
+ throws SHRWebException
|
|
|
+ {
|
|
|
+ String billId = getBillId(request);
|
|
|
+ String ids[] = billId.split(",");
|
|
|
+ ICoreBase iCoreBase = getBizInterface(request);
|
|
|
+ Context ctx = SHRContext.getInstance().getContext();
|
|
|
+ if(!"disable".equals(methodName) && !"enable".equals(methodName))
|
|
|
+ throw new ShrWebBizException(MessageFormat.format(SHRWebResource.getString("com.kingdee.shr.base.syssetting.SHRSyssettingResource", "method_notexist"), new Object[] {
|
|
|
+ iCoreBase.getName(), methodName
|
|
|
+ }));
|
|
|
+ String var7[] = ids;
|
|
|
+ int var8 = ids.length;
|
|
|
+ for(int var9 = 0; var9 < var8; var9++)
|
|
|
+ {
|
|
|
+ String id = var7[var9];
|
|
|
+ doEnableBySqlEx(ctx, id, methodName);
|
|
|
}
|
|
|
+
|
|
|
+ return null;
|
|
|
}
|
|
|
- protected void doEnableBySqlEx(Context ctx,String billId, String math) throws SHRWebException {
|
|
|
- try {
|
|
|
|
|
|
+ protected void doEnableBySqlEx(Context ctx, String billId, String math)
|
|
|
+ throws SHRWebException
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
IMemberManagement iManagement = MemberManagementFactory.getLocalInstance(ctx);
|
|
|
MemberManagementInfo management = iManagement.getMemberManagementInfo(new ObjectUuidPK(billId));
|
|
|
- ProjectManagementInfo projectManagement= ProjectManagementFactory.getLocalInstance(ctx).
|
|
|
- getProjectManagementInfo(new ObjectUuidPK(management.getProjectManagement().getId()));
|
|
|
- PersonInfo personInfo= PersonFactory.getLocalInstance(ctx).
|
|
|
- getPersonInfo(new ObjectUuidPK(management.getEmployee().getId()));
|
|
|
- if ("disable".equals(math)) {
|
|
|
- String number= projectManagement.getNumber()+ "-" +personInfo.getNumber()+"-2";
|
|
|
+ ProjectManagementInfo projectManagement = ProjectManagementFactory.getLocalInstance(ctx).getProjectManagementInfo(new ObjectUuidPK(management.getProjectManagement().getId()));
|
|
|
+ PersonInfo personInfo = PersonFactory.getLocalInstance(ctx).getPersonInfo(new ObjectUuidPK(management.getEmployee().getId()));
|
|
|
+ if("disable".equals(math))
|
|
|
+ {
|
|
|
+ String number = (new StringBuilder(String.valueOf(projectManagement.getNumber()))).append("-").append(personInfo.getNumber()).append("-2").toString();
|
|
|
management.setNumber(number);
|
|
|
- }else if("enable".equals(math)){
|
|
|
- String number= projectManagement.getNumber()+ "-" +personInfo.getNumber()+"-1";
|
|
|
+ } else
|
|
|
+ if("enable".equals(math))
|
|
|
+ {
|
|
|
+ String number = (new StringBuilder(String.valueOf(projectManagement.getNumber()))).append("-").append(personInfo.getNumber()).append("-1").toString();
|
|
|
management.setNumber(number);
|
|
|
}
|
|
|
- System.out.println("doEnableBySqlEx:"+management.getNumber());
|
|
|
- DbUtil.execute(ctx,"update CT_PRO_MemberManagement set fnumber='"+management.getNumber()+"' where fid='"+billId+"'");
|
|
|
+ System.out.println((new StringBuilder("doEnableBySqlEx:")).append(management.getNumber()).toString());
|
|
|
+ DbUtil.execute(ctx, (new StringBuilder("update CT_PRO_MemberManagement set fnumber='")).append(management.getNumber()).append("' where fid='").append(billId).append("'").toString());
|
|
|
SHRCommonFacadeFactory.getRemoteInstance().updateEnable(billId, math);
|
|
|
- } catch (EASBizException var4) {
|
|
|
+ }
|
|
|
+ catch(EASBizException var4)
|
|
|
+ {
|
|
|
throw new ShrWebBizException(var4.getMessage(), var4);
|
|
|
- } catch (BOSException var5) {
|
|
|
+ }
|
|
|
+ catch(BOSException var5)
|
|
|
+ {
|
|
|
throw new SHRWebException(var5.getMessage(), var5);
|
|
|
}
|
|
|
}
|
|
|
- protected String getBillId(HttpServletRequest request) throws SHRWebException {
|
|
|
+
|
|
|
+ protected String getBillId(HttpServletRequest request)
|
|
|
+ throws SHRWebException
|
|
|
+ {
|
|
|
String billId = (String)request.getAttribute("billId");
|
|
|
- if (StringUtils.isEmpty(billId)) {
|
|
|
+ if(StringUtils.isEmpty(billId))
|
|
|
billId = request.getParameter("billId");
|
|
|
- }
|
|
|
-
|
|
|
- if (StringUtils.isEmpty(billId)) {
|
|
|
+ if(StringUtils.isEmpty(billId))
|
|
|
billId = request.getParameter("billID");
|
|
|
- }
|
|
|
-
|
|
|
- if (StringUtils.isEmpty(billId)) {
|
|
|
- throw new ShrWebBizException(MessageFormat.format(SHRWebResource.getString("com.kingdee.shr.base.syssetting.SHRSyssettingResource", "is_empty"), "billId"));
|
|
|
- } else {
|
|
|
+ if(StringUtils.isEmpty(billId))
|
|
|
+ throw new ShrWebBizException(MessageFormat.format(SHRWebResource.getString("com.kingdee.shr.base.syssetting.SHRSyssettingResource", "is_empty"), new Object[] {
|
|
|
+ "billId"
|
|
|
+ }));
|
|
|
+ else
|
|
|
return billId;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String deleteAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap)
|
|
|
+ throws SHRWebException
|
|
|
+ {
|
|
|
+ String billId = getBillId(request);
|
|
|
+ checkDataSize(billId);
|
|
|
+ Context ctx = SHRContext.getInstance().getContext();
|
|
|
+ IDynamicObject bizInterface = DynamicObjectFactory.getLocalInstance(ctx);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ com.kingdee.bos.dao.IObjectPK pk = new ObjectUuidPK(BOSUuid.read(billId));
|
|
|
+ IObjectValue value = bizInterface.getValue(getBillBosType(billId), pk);
|
|
|
+ if(value != null && value.getInt("billstate") != 0)
|
|
|
+ throw new ShrWebBizException(SHRWebResource.getString("com.kingdee.shr.base.syssetting.CommonplateResourse", "notallow_deletebill"));
|
|
|
+ }
|
|
|
+ catch(BOSException var9)
|
|
|
+ {
|
|
|
+ var9.printStackTrace();
|
|
|
}
|
|
|
+ return super.deleteAction(request, response, modelMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void checkDataSize(String billId)
|
|
|
+ throws SHRWebException
|
|
|
+ {
|
|
|
+ String ids[] = billId.split(",");
|
|
|
+ if(ids.length > 1)
|
|
|
+ throw new ShrWebBizException(SHRWebResource.getString("com.kingdee.shr.base.syssetting.CommonplateResourse", "please_selectone"));
|
|
|
+ else
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ private BOSObjectType getBillBosType(String billId)
|
|
|
+ {
|
|
|
+ BOSUuid bosId = BOSUuid.read(billId);
|
|
|
+ BOSObjectType objType = bosId.getType();
|
|
|
+ return objType;
|
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
-// protected FilterInfo getDefaultFilter(HttpServletRequest request, HttpServletResponse response) throws SHRWebException {
|
|
|
-// String userAdminOrgRangeSql = this.assembleTreeDataUserAdminOrgRangeSQL(request);
|
|
|
-// FilterInfo ifo = new FilterInfo();
|
|
|
-// ifo.getFilterItems().add(new FilterItemInfo("projectManagement.adminOrg.id in("+userAdminOrgRangeSql+")"));
|
|
|
-// ifo.getFilterItems().add(new FilterItemInfo("projectManagement.projectState in('1','2')"));
|
|
|
-// return ifo;
|
|
|
-// }
|
|
|
+ protected String pTypeManagerNumber;
|
|
|
+ protected String pTypeNumber;
|
|
|
}
|