Browse Source

报表显示选择处理

chenzhfa 3 years ago
parent
commit
ba01229a94

+ 59 - 7
hrrpt/nccloud/src/client/nccloud/web/hr/rpt/action/WaRptQryAfterEditAction.java

@@ -22,6 +22,7 @@ import nc.vo.uif2.LoginContext;
 import nc.vo.wa.category.WaClassVO;
 import nc.vo.wa.classitem.WaClassItemVO;
 import nc.vo.wa.item.WaItemVO;
+import nc.vo.wa.paydata.WaClassItemShowInfVO;
 import nc.vo.wa.paydata.WaPaydataDspVO;
 import nc.vo.wa.pub.PeriodStateVO;
 import nc.vo.wa.pub.WaLoginContext;
@@ -41,6 +42,8 @@ import nccloud.web.hr.pub.HRNccTemplateUtils;
 import nccloud.web.hr.pub.HRNccUtils;
 import nccloud.web.hr.rpt.pub.INccHrRptConst;
 import nccloud.web.hrhi.pub.PsndocTempUtils;
+import nccloud.web.hrwa.helper.WaLoginContextUtils;
+import nccloud.web.hrwa.paydata.action.WaPaydataClassItemHelper;
 import nccloud.web.uapbd.commons.web.ParamUtils;
 
 /**
@@ -52,6 +55,7 @@ public class WaRptQryAfterEditAction extends HRCommonAction {
 	public <T> Object execute(IRequest iRequest, T t) throws Exception {
 		ParamUtils param = new ParamUtils(iRequest);
 		LoginContext loginContext = HRNccUtils.getLoginContext(param);
+		WaLoginContext context = WaLoginContextUtils.getWaLoginContext(param);
 
 		String areaCode = param.getString("area_code", null);
 		if (StringUtils.isBlank(areaCode)) {
@@ -90,7 +94,7 @@ public class WaRptQryAfterEditAction extends HRCommonAction {
 				waGlobalVO.setWaClassPK(waClassPk);
 				waGlobalVO.setWaYear(Cyear);
 				result.put("item_list", getItemList(waGlobalVO, 0));
-				extracted(result, vo);
+				extracted(result, vo,context);
 				return result;
 			}
 		} else if ("WaItemQueryConditionPanelForGroup".equals(areaCode) || "WaBaseQueryConditionPanel".equals(areaCode) || "WaSumByPsnclQueryConditionPanel".equals(areaCode)
@@ -134,7 +138,7 @@ public class WaRptQryAfterEditAction extends HRCommonAction {
 					waGlobalVO.setCurUserid(loginContext.getPk_loginUser());
 				}
 				result.put("item_list", getItemList(waGlobalVO, 0));
-				extracted(result, vo);
+				extracted(result, vo,context);
 				if ("WaBaseQueryConditionPanel".equals(areaCode) || "WaSumByDeptQueryConditionPanel".equals(areaCode) || "WaItemQueryConditionPanel".equals(areaCode)) {
 					// 这三个要查询数值型薪资项目和字符型薪资项目
 					IPaydataQueryService service = ServiceLocator.find(IPaydataQueryService.class);
@@ -195,7 +199,7 @@ public class WaRptQryAfterEditAction extends HRCommonAction {
 				waGlobalVO.setWaClassPK(waClassPk);
 				waGlobalVO.setWaYear(Cyear);
 				result.put("item_list", getItemList(waGlobalVO, 0));
-				extracted(result, vo);
+				extracted(result, vo,context);
 				return result;
 			}
 		} else if ("WaMultiRptQueryConditionPanel".equals(areaCode)) {
@@ -225,7 +229,7 @@ public class WaRptQryAfterEditAction extends HRCommonAction {
 				}
 				WaItemVO[] items = ServiceLocator.find(IClassitemQry.class).queryItemInfoWithPowerForMutiClasses(waGlobalVOs, 0);
 				result.put("item_list", createList(items));
-				extracted(result, vo);
+				extracted(result, vo,context);
 				return result;
 			}
 		} else if ("OrgWaAccountQueryConditionPanel".equals(areaCode) || "DeptWaAccountQueryConditionPanel".equals(areaCode)) {
@@ -252,7 +256,7 @@ public class WaRptQryAfterEditAction extends HRCommonAction {
 		return result;
 	}
 
-	private void extracted(HashMap result, GeneralVO vo) throws BusinessException {
+	private void extracted(HashMap result, GeneralVO vo,WaLoginContext context) throws BusinessException {
 		//add by@chenzf 添加薪资发放设置的通用项目 2022-5-23 17:49:52 begin 
 		if(result.get("item_list") != null) {
 			List<Map> map = (List<Map>) result.get("item_list");
@@ -260,21 +264,69 @@ public class WaRptQryAfterEditAction extends HRCommonAction {
 			List<Map> ymap = new ArrayList();//已选
 			if(map.size() > 0) {
 				String waClassPk = (String) vo.getAttributeValue(WaProviderConst.WA_CLASS_PK);
-//				select * from wa_paydatadsp where type = 0 and pk_wa_class = '1001A1100000000MYC7Z' and bshow = 'Y' and iswaitem = 'Y' order by displayseq;
+				String baseCperiod = (String) vo.getAttributeValue(WaProviderConst.BASE_CPERIOD);
+				WaLoginVO waLoginVO = null;
+				if (baseCperiod != null && baseCperiod.length() == 6) {
+					String m_waYear = baseCperiod.substring(0, 4);
+					String m_waPeriod = baseCperiod.substring(4, baseCperiod.length());
+					// 设置薪资类别参数
+					waLoginVO = new WaLoginVO();
+					waLoginVO.setPk_wa_class(waClassPk);
+					waLoginVO.setPk_prnt_class(waClassPk);
+					waLoginVO.setCyear(m_waYear);
+					waLoginVO.setCperiod(m_waPeriod);
+					waLoginVO.setPk_org(context.getPk_org());
+					waLoginVO.setPk_group(context.getPk_group());
+					context.setWaLoginVO(waLoginVO);
+				}
 				List<WaPaydataDspVO> list = ServiceLocator.find(IClassitemQry.class).queryWaPaydataDspVOByPkWaClass(waClassPk);
 				if(list != null && list.size() > 0) {
 					List<String> keyList = new ArrayList();
 					for(WaPaydataDspVO dspVO : list) {
 						keyList.add(dspVO.getItem_key());
 					}
+					for(String key : keyList) {
+						for(Map m : map) {
+							if(key.equals(m.get("itemkey"))) {
+								ymap.add(m);
+							}
+						}
+					}
 					for(Map m : map) {
 						if(keyList.contains(m.get("itemkey"))) {
-							ymap.add(m);
+//							ymap.add(m);
 						} else {
 							dmap.add(m);
 						}
 					}
 				}
+//				WaClassItemVO[] waClassItemVO = ServiceLocator.find(IClassitemQry.class).getUserShowClassItemVOs(context);
+//				if(list != null && list.size() > 0) {
+//					List<String> keyList = new ArrayList();
+//					if(waClassItemVO != null && waClassItemVO.length > 0) {
+//						for(WaClassItemVO item : waClassItemVO) {
+//							for(WaPaydataDspVO dspVO : list) {
+//								if(item.getItemkey().equals(dspVO.getItem_key())) {
+//									keyList.add(item.getItemkey());
+//								}
+//							}
+//						}
+//					}
+//					for(String key : keyList) {
+//						for(Map m : map) {
+//							if(key.equals(m.get("itemkey"))) {
+//								ymap.add(m);
+//							}
+//						}
+//					}
+//					for(Map m : map) {
+//						if(keyList.contains(m.get("itemkey"))) {
+////							ymap.add(m);
+//						} else {
+//							dmap.add(m);
+//						}
+//					}
+//				}
 			}
 			result.put("item_list", dmap);
 			result.put("yitem_list", ymap);

+ 118 - 0
hrrpt/nccloud/src/client/nccloud/web/hr/rpt/action/WaRptQryBeforeEditAction.java

@@ -0,0 +1,118 @@
+package nccloud.web.hr.rpt.action;
+
+import nc.vo.hr.tools.pub.GeneralVO;
+import nc.vo.pub.BusinessRuntimeException;
+import nc.vo.uif2.LoginContext;
+import nc.wa.smartmodel.provider.util.WaProviderConst;
+import nccloud.framework.web.container.IRequest;
+import nccloud.web.hr.pub.HRCommonAction;
+import nccloud.web.hr.pub.HRNccTemplateUtils;
+import nccloud.web.hr.pub.HRNccUtils;
+import nccloud.web.hrhi.pub.PsndocTempUtils;
+import nccloud.web.uapbd.commons.web.ParamUtils;
+import nccloud.commons.lang.StringUtils;
+
+import java.util.HashMap;
+
+/**
+ * 编辑前事件
+ */
+public class WaRptQryBeforeEditAction extends HRCommonAction {
+
+	@Override
+	public <T> Object execute(IRequest iRequest, T t) throws Exception {
+		ParamUtils param = new ParamUtils(iRequest);
+		LoginContext loginContext = HRNccUtils.getLoginContext(param);
+
+		String areaCode = param.getString("area_code", null);
+		if (StringUtils.isBlank(areaCode)) {
+			throw new BusinessRuntimeException("Parameter Error!");
+		}
+
+		String itemKey = param.getString("key", null);
+		if (StringUtils.isBlank(itemKey)) {
+			throw new BusinessRuntimeException("Parameter Error!");
+		}
+		HashMap result = new HashMap();
+		result.put("editable", true);
+		// model参数
+		GeneralVO vo = HRNccTemplateUtils.getVOFromForm(GeneralVO.class, PsndocTempUtils.getModelStr(param, null));
+		if ("WaAccountByYearQueryConditionPanel".equals(areaCode)) {
+			// 单位年度工资台账
+			if (WaProviderConst.BASE_CYEAR.equals(itemKey)) {
+				HashMap refParam = new HashMap();
+				// ) 子表的部门不限制是否撤销,保存时交验
+				refParam.put("pk_wa_class", vo.getAttributeValue(WaProviderConst.WA_CLASS_PK));
+				result.put("refParam", refParam);
+				return result;
+			} else if (WaProviderConst.WA_CLASS_PK.equals(itemKey)) {
+				HashMap refParam = new HashMap();
+				// ) 子表的部门不限制是否撤销,保存时交验
+				refParam.put("pk_org", loginContext.getPk_org());
+				refParam.put("pk_group", loginContext.getPk_group());
+				result.put("refParam", refParam);
+				return result;
+			}
+		} else if ("WaItemQueryConditionPanelForGroup".equals(areaCode) || "WaBaseQueryConditionPanel".equals(areaCode) || "WaSumByPsnclQueryConditionPanel".equals(areaCode)
+				|| "WaSumByDeptQueryConditionPanel".equals(areaCode) || "WaItemQueryConditionPanel".equals(areaCode)) {
+			// 集团级薪资明细表&薪资变动***表&人员类别汇总表&部门汇总表&薪资明细表
+			if (WaProviderConst.BASE_CPERIOD.equals(itemKey) || WaProviderConst.COMPARE_CPERIOD.equals(itemKey)) {
+				HashMap refParam = new HashMap();
+				// ) 子表的部门不限制是否撤销,保存时交验
+				refParam.put("pk_wa_class", vo.getAttributeValue(WaProviderConst.WA_CLASS_PK));
+				result.put("refParam", refParam);
+				return result;
+			} else if (WaProviderConst.WA_CLASS_PK.equals(itemKey)) {
+				HashMap refParam = new HashMap();
+				// ) 子表的部门不限制是否撤销,保存时交验
+				refParam.put("pk_org", loginContext.getPk_org());
+				refParam.put("pk_group", loginContext.getPk_group());
+				result.put("refParam", refParam);
+				return result;
+			}
+		} else if ("WaAccountByMonthQueryConditionPanel".equals(areaCode)) {
+			// 年度对比分析
+			if (WaProviderConst.BASE_CYEAR.equals(itemKey) || WaProviderConst.COMPARE_CYEAR.equals(itemKey)) {
+				HashMap refParam = new HashMap();
+				// ) 子表的部门不限制是否撤销,保存时交验
+				refParam.put("pk_wa_class", vo.getAttributeValue(WaProviderConst.WA_CLASS_PK));
+				result.put("refParam", refParam);
+				return result;
+			} else if (WaProviderConst.WA_CLASS_PK.equals(itemKey)) {
+				HashMap refParam = new HashMap();
+				// ) 子表的部门不限制是否撤销,保存时交验
+				refParam.put("pk_org", loginContext.getPk_org());
+				refParam.put("pk_group", loginContext.getPk_group());
+				result.put("refParam", refParam);
+				return result;
+			}
+		} else if ("WaMultiRptQueryConditionPanel".equals(areaCode)) {
+			if (WaProviderConst.WA_CLASS_PK.equals(itemKey)) {
+				HashMap refParam = new HashMap();
+				// ) 子表的部门不限制是否撤销,保存时交验
+				refParam.put("waYear", vo.getAttributeValue(WaProviderConst.CAC_CYEAR));
+				String cacCperiod = (String) vo.getAttributeValue(WaProviderConst.CAC_CPERIOD);
+				if (cacCperiod != null && cacCperiod.trim().length() == 1) {
+					cacCperiod = "0" + cacCperiod.trim();
+				}
+				refParam.put("waPeriod", cacCperiod);
+				refParam.put("pk_org", loginContext.getPk_org());
+				result.put("refParam", refParam);
+				return result;
+			}
+		}
+		
+		if("WaSumByDeptQueryConditionPanel".equals(areaCode) || "DeptWaAccountQueryConditionPanel".equals(areaCode)){
+			if (WaProviderConst.SUM_DEPT.equals(itemKey)) {
+				HashMap refParam = new HashMap();
+				// ) 子表的部门不限制是否撤销,保存时交验
+				refParam.put("pk_org", loginContext.getPk_org());
+				refParam.put("pk_group", loginContext.getPk_group());
+				result.put("refParam", refParam);
+				return result;
+			}
+		}
+
+		return result;
+	}
+}

+ 91 - 0
hrrpt/nccloud/src/private/nc/impl/wa/rpt/ClassitemImpl.java

@@ -6,15 +6,21 @@ import java.util.List;
 import java.util.Vector;
 
 import nc.bs.dao.BaseDAO;
+import nc.hr.utils.PubEnv;
 import nc.hr.utils.SQLHelper;
 import nc.itf.hr.wa.IClassitemQry;
 import nc.itf.org.IOrgConst;
+import nc.jdbc.framework.SQLParameter;
 import nc.jdbc.framework.processor.BeanListProcessor;
 import nc.jdbc.framework.processor.ResultSetProcessor;
 import nc.vo.hr.pub.FormatVO;
 import nc.vo.pub.BusinessException;
+import nc.vo.wa.classitem.WaClassItemVO;
+import nc.vo.wa.func.WherePartUtil;
 import nc.vo.wa.item.WaItemVO;
 import nc.vo.wa.paydata.WaPaydataDspVO;
+import nc.vo.wa.pub.WaLoginContext;
+import nc.vo.wa.pub.WaLoginVO;
 import nc.wa.smartmodel.provider.util.WaGlobalVO;
 import nccloud.commons.lang.StringUtils;
 /**
@@ -283,4 +289,89 @@ public class ClassitemImpl implements IClassitemQry{
 		List<WaPaydataDspVO> list = (List<WaPaydataDspVO>) dao.executeQuery(sql, new BeanListProcessor(WaPaydataDspVO.class));
 		return list;
 	}
+	
+	/**
+	 * 查询用户设置显示的项目
+	 * 
+	 * wa_classitemdsp 该表已经不用了
+	 *
+	 * @author liangxr on 2010-7-2
+	 * @param loginVO
+	 * @return
+	 * @throws BusinessException
+	 */
+	public WaClassItemVO[] getUserShowClassItemVOs(WaLoginContext loginVO) throws BusinessException {
+		String condition = " wa_classitem.pk_wa_classitem not in (select pk_wa_classitem from wa_classitemdsp "
+				+ "where pk_wa_class = '" + loginVO.getWaLoginVO().getPk_wa_class() + "' and cyear = '" + loginVO.getWaLoginVO().getCyear()
+				+ "' and cperiod = '" + loginVO.getWaLoginVO().getCperiod()+ "' and pk_user = '" + PubEnv.getPk_user()
+				+ "' and bshow = 'N' )";
+		WaClassItemVO[] classitems = testgetRoleClassItemVOs(loginVO.getWaLoginVO(), condition);
+		return classitems;
+	}
+	
+	/**
+	 * 获取薪资发放项目
+	 *
+	 * @author liangxr on 2010-5-13
+	 * @param waLoginVO
+	 * @return
+	 * @throws BusinessException
+	 */
+	private WaClassItemVO[] testgetRoleClassItemVOs(WaLoginVO waLoginVO, String condition) throws BusinessException {
+
+		StringBuffer sqlBuffer = new StringBuffer();
+		sqlBuffer.append(" select wa_item.itemkey, wa_item.iitemtype,wa_item.defaultflag, ");
+		sqlBuffer.append(" wa_item.ifldwidth,wa_item.category_id, ");
+		sqlBuffer.append(" wa_classitem.*, 'Y' editflag,");
+		sqlBuffer.append(" 'Y' as showflag,");
+		sqlBuffer.append(" wa_classitem.idisplayseq as idisplayseq,  ");
+		sqlBuffer.append("itempower.editflag ");
+		sqlBuffer.append("from wa_classitem , wa_item,");
+		sqlBuffer.append("(SELECT pk_wa_item,MAX(editflag) as editflag");
+		sqlBuffer.append("   FROM wa_itempower ");
+		// 判断是否是多次发放
+		// WaClassVO parentvo = NCLocator.getInstance().lookup(IWaClass.class)
+		// .queryParentClass(waLoginVO.getPk_wa_class(),
+		// waLoginVO.getCyear(), waLoginVO.getCperiod());
+
+		sqlBuffer.append("  WHERE pk_wa_class = '" + waLoginVO.getPk_prnt_class() + "'");
+		sqlBuffer.append("    AND pk_group ='" + waLoginVO.getPk_group() + "'");
+
+		// 20160104 shenliangc NCdp205568081 已审批通过的发放申请通知消息,打开单据后,单据子表的审批项目丢失
+		// 历史遗留问题,通知消息双击打开发放申请节点,查询审批项目时waLoginVO.getPk_org()得到的是系统默认主组织,而不是正确的方案主组织。
+		sqlBuffer.append("    AND pk_org = (select pk_org from wa_waclass where pk_wa_class = '"
+				+ waLoginVO.getPk_prnt_class() + "')");
+		// sqlBuffer.append(" AND pk_org = '"+waLoginVO.getPk_org()+"'");
+
+		sqlBuffer.append("    AND ( pk_subject IN(SELECT pk_role ");
+		sqlBuffer.append("				       FROM sm_user_role ");
+		sqlBuffer.append("				      WHERE cuserid = '" + PubEnv.getPk_user() + "'");
+		sqlBuffer.append("                   ) or pk_subject = '" + PubEnv.getPk_user() + "') ");
+		sqlBuffer.append("  GROUP BY pk_wa_item ) as itempower");
+		sqlBuffer.append(" where wa_classitem.pk_wa_item = wa_item.pk_wa_item ");
+		sqlBuffer.append(" and wa_classitem.pk_wa_item = itempower.pk_wa_item ");
+		sqlBuffer.append(" and wa_classitem.pk_wa_class = ? ");
+		sqlBuffer.append(" and wa_classitem.cyear = ?  and wa_classitem.cperiod = ? ");
+		sqlBuffer.append(WherePartUtil.formatAddtionalWhere(condition));
+		sqlBuffer.append(" order by wa_classitem.idisplayseq");
+
+		SQLParameter parameter = this.getCommonParameter(waLoginVO);
+		List<WaClassItemVO> list = (List<WaClassItemVO>) dao.executeQuery(sqlBuffer.toString(), parameter, new BeanListProcessor(WaClassItemVO.class));
+		return list.toArray(new WaClassItemVO[0]);
+	}
+	
+	/**
+	 * pk_wa_class year, period
+	 *
+	 * @author zhangg on 2009-12-2
+	 * @param waLoginVO
+	 * @return
+	 */
+	public SQLParameter getCommonParameter(WaLoginVO waLoginVO) {
+		SQLParameter parameter = new SQLParameter();
+		parameter.addParam(waLoginVO.getPk_wa_class());
+		parameter.addParam(waLoginVO.getCyear());
+		parameter.addParam(waLoginVO.getCperiod());
+		return parameter;
+	}
 }

+ 13 - 0
hrrpt/nccloud/src/public/nc/itf/hr/wa/IClassitemQry.java

@@ -3,8 +3,10 @@ package nc.itf.hr.wa;
 import java.util.List;
 
 import nc.vo.pub.BusinessException;
+import nc.vo.wa.classitem.WaClassItemVO;
 import nc.vo.wa.item.WaItemVO;
 import nc.vo.wa.paydata.WaPaydataDspVO;
+import nc.vo.wa.pub.WaLoginContext;
 import nc.wa.smartmodel.provider.util.WaGlobalVO;
 /**
  * 薪资项目 查询 服务接口
@@ -51,5 +53,16 @@ public interface IClassitemQry {
 	 */
 	public abstract List<WaPaydataDspVO> queryWaPaydataDspVOByPkWaClass(String pk_wa_class) throws BusinessException;
 	
+	/**
+	 * 查询用户设置显示的项目
+	 * 
+	 * wa_classitemdsp 该表已经不用了
+	 *
+	 * @author liangxr on 2010-7-2
+	 * @param loginVO
+	 * @return
+	 * @throws BusinessException
+	 */
+	public WaClassItemVO[] getUserShowClassItemVOs(WaLoginContext loginVO) throws BusinessException;
 }