123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438 |
- package com.kingdee.shr.customer.gtiit.handler;
- import com.alibaba.fastjson.JSONObject;
- import com.google.common.collect.Lists;
- import com.google.common.collect.Maps;
- import com.kingdee.bos.BOSException;
- import com.kingdee.bos.Context;
- import com.kingdee.bos.util.EASResource;
- import com.kingdee.eas.common.EASBizException;
- 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.compensation.CalFlag;
- import com.kingdee.shr.compensation.app.integrate.BatchSubmitSchemeBillDataSource;
- import com.kingdee.shr.compensation.app.integrate.CalSchemeItemForF7Info;
- import com.kingdee.shr.compensation.app.integrate.CalSubmitItemDataType;
- import com.kingdee.shr.compensation.app.integrate.CalSubmitItemInfo;
- import com.kingdee.shr.compensation.app.integrate.CalSubmitSchemeFactory;
- import com.kingdee.shr.compensation.app.integrate.CalSubmitSchemeInfo;
- import com.kingdee.shr.compensation.app.integrate.CalSubmitSchemeItemCollection;
- import com.kingdee.shr.compensation.app.integrate.CalSubmitSchemeItemFactory;
- import com.kingdee.shr.compensation.app.integrate.CalSubmitSchemeItemInfo;
- import com.kingdee.shr.compensation.app.integrate.DateTypeEnum;
- import com.kingdee.shr.compensation.app.integrate.TargetType;
- import com.kingdee.shr.compensation.util.columnModel.CmpColumnModelWrapper;
- import com.kingdee.shr.compensation.util.columnModel.CmpColumnModels;
- import com.kingdee.shr.compensation.util.integrate.CmpIntegrateUtils;
- import com.kingdee.shr.compensation.web.handler.integrate.helper.CmpIntegrateWebHelper;
- import com.kingdee.shr.customer.gtiit.helper.CmpDisplayViewAnalyzing;
- import com.kingdee.shr.ml.util.SHRServerResource;
- import java.lang.reflect.Method;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import java.util.Set;
- import org.apache.commons.lang3.StringUtils;
- public class BaseSubmitBillEntryGenerator {
- protected static final String UIPK_ADMINORGUNIT = "com.kingdee.eas.basedata.org.app.AdminOrgUnit.F7";
- protected static final String UIPK_CMPEMPORELATION_STORES = "com.kingdee.shr.compensation.app.integrate.stores.CmpEmpORelation.F7";
- protected static final String UIPK_CMPEMPORELATION = "com.kingdee.shr.compensation.app.integrate.CmpEmpORelation.F7";
- protected static final String UIPK_SUBMITELEMENT = "com.kingdee.shr.compensation.app.integrate.SubmitElement.usable.list";
- protected static final String UIPK_CURRENCY = "com.kingdee.eas.basedata.assistant.app.Currency.CMP.F7";
- public static final String DISPLAY = "com.kingdee.shr.compensation.app.integrate.BatchSubmitShemeBill.form.display";
- protected final Map<String, Map<String, Boolean>> attrMap;
- protected Map<String, String> fieldName2MethodName;
- protected Map<String, Object> params;
- protected CalSubmitSchemeInfo submitScheme;
- public BaseSubmitBillEntryGenerator() {
- Context ctx = SHRContext.getInstance().getContext();
- try {
- this.attrMap = CmpDisplayViewAnalyzing.complementDefaultField(ctx, "com.kingdee.shr.compensation.app.integrate.BatchSubmitShemeBill.form.display");
- assembleFieldName2MethodName();
- assembleNeedField();
- } catch (Exception e) {
- throw new RuntimeException();
- }
- }
- public BaseSubmitBillEntryGenerator(Context ctx) {
- try {
- this.attrMap = CmpDisplayViewAnalyzing.complementDefaultField(ctx, "com.kingdee.shr.compensation.app.integrate.BatchSubmitShemeBill.form.display");
- assembleFieldName2MethodName();
- assembleNeedField();
- } catch (Exception e) {
- throw new RuntimeException();
- }
- }
- protected void assembleNeedField() {
- if (!this.attrMap.containsKey("adminOrgUnit")) {
- Map<String, Boolean> adminMap = Maps.newHashMap();
- adminMap.put("hidden", Boolean.TRUE);
- this.attrMap.put("adminOrgUnit", adminMap);
- }
- if (!this.attrMap.containsKey("position")) {
- Map<String, Boolean> positionMap = Maps.newHashMap();
- positionMap.put("hidden", Boolean.TRUE);
- this.attrMap.put("position", positionMap);
- }
- }
- protected void assembleFieldName2MethodName() throws SHRWebException {
- this.fieldName2MethodName = Maps.newHashMap();
- this.fieldName2MethodName.put("id", "assembleId");
- this.fieldName2MethodName.put("number", "assembleNumber");
- this.fieldName2MethodName.put("person", "assemblePersonName");
- this.fieldName2MethodName.put("adminOrgUnit", "assembleAdminOrgName");
- this.fieldName2MethodName.put("position", "assemblePositionName");
- this.fieldName2MethodName.put("cmpEmpORelation", "assembleCmpEmpORelationName");
- this.fieldName2MethodName.put("tempId", "assembleTempPropName");
- this.fieldName2MethodName.put("submitElement", "assembleSubmitElement");
- this.fieldName2MethodName.put("currency", "assembleCurrency");
- this.fieldName2MethodName.put("effectDate", "assembleEffectDate");
- this.fieldName2MethodName.put("leffectDate", "assembleLEffectDate");
- this.fieldName2MethodName.put("submitItem", "assembleDynamicItem");
- this.fieldName2MethodName.put("description", "assembleDescription");
- }
- public CmpColumnModels getEntryColumnModels(Context ctx, String submitSchemeId, Map<String, Object> params) throws SHRWebException {
- this.params = params;
- this.submitScheme = getCalSubmitSchemeInfo(ctx, submitSchemeId);
- if (this.attrMap == null)
- return getEntryColumnModelsFormat(ctx);
- return getEntryColumnModelsCustom(ctx);
- }
- public CmpColumnModels getEntryColumnModelsFormat(Context ctx) throws SHRWebException {
- CmpColumnModels cmpColumnModels = new CmpColumnModels();
- assembleId(ctx, cmpColumnModels);
- if (TargetType.org.equals(this.submitScheme.getSubmitTarget())) {
- assembleOrgSubmitMainBizKey(ctx, cmpColumnModels);
- } else {
- assemblePersonSubmitMainBizKey(ctx, cmpColumnModels);
- }
- assembleSubmitElement(ctx, cmpColumnModels);
- assembleCurrency(ctx, cmpColumnModels);
- assembleEffectDate(ctx, cmpColumnModels);
- assembleLEffectDate(ctx, cmpColumnModels);
- assembleDynamicItem(ctx, cmpColumnModels);
- assembleDescription(ctx, cmpColumnModels);
- return cmpColumnModels;
- }
- public CmpColumnModels getEntryColumnModelsCustom(Context ctx) throws SHRWebException {
- CmpColumnModels cmpColumnModels = new CmpColumnModels();
- beforeInvokeAttrMap(ctx, cmpColumnModels);
- for (String name : this.attrMap.keySet()) {
- try {
- String methodName = this.fieldName2MethodName.get(name);
- if (StringUtils.isEmpty(methodName))
- continue;
- Method method = getClass().getMethod(methodName, new Class[] { Context.class, CmpColumnModels.class });
- method.invoke(this, new Object[] { ctx, cmpColumnModels });
- } catch (Exception e) {
- throw new SHRWebException(e.getMessage(), e);
- }
- }
- return cmpColumnModels;
- }
- protected void beforeInvokeAttrMap(Context ctx, CmpColumnModels cmpColumnModels) {}
- public CalSubmitSchemeInfo getCalSubmitSchemeInfo(Context ctx, String submitSchemeId) throws SHRWebException {
- CalSubmitSchemeInfo submitScheme;
- try {
- submitScheme = CalSubmitSchemeFactory.getLocalInstance(ctx).getCalSubmitSchemeInfo("where id = '" + submitSchemeId + "'");
- } catch (EASBizException e) {
- throw new ShrWebBizException(e.getMessage(), e);
- } catch (BOSException e) {
- throw new SHRWebException(e.getMessage(), e);
- }
- return submitScheme;
- }
- protected void assembleOrgSubmitMainBizKey(Context ctx, CmpColumnModels cmpColumnModels) {
- String submitOrgName = getMultiLan(ctx, "label0");
- cmpColumnModels.add(submitOrgName, CmpColumnModelWrapper.createF7ColModel("orgUnit", submitOrgName, Integer.valueOf(90)).assembleF7Editoptions(submitOrgName, "com.kingdee.eas.basedata.org.app.AdminOrgUnit.F7", true, false).frozen().get());
- }
- protected void assemblePersonSubmitMainBizKey(Context ctx, CmpColumnModels cmpColumnModels) {
- assembleNumber(ctx, cmpColumnModels);
- assemblePersonName(ctx, cmpColumnModels);
- assembleAdminOrgName(ctx, cmpColumnModels);
- assemblePositionName(ctx, cmpColumnModels);
- assembleCmpEmpORelationName(ctx, cmpColumnModels);
- assembleTempPropName(ctx, cmpColumnModels);
- }
- public void assembleId(Context ctx, CmpColumnModels cmpColumnModels) {
- String idName = "ID";
- Map<String, Boolean> attr = (this.attrMap == null) ? new HashMap<>() : this.attrMap.get("id");
- cmpColumnModels.add(idName, CmpColumnModelWrapper.createTextColModel("id", idName, Integer.valueOf(150)).frozen(attr.get("frozen")).hidden(attr.get("hidden")).key().get());
- }
- public void assembleNumber(Context ctx, CmpColumnModels cmpColumnModels) {
- String numberName = getMultiLan(ctx, "label1");
- Map<String, Boolean> attr = (this.attrMap == null) ? new HashMap<>() : this.attrMap.get("number");
- cmpColumnModels.add(numberName, CmpColumnModelWrapper.createTextColModel("number", numberName, Integer.valueOf(90)).frozen(attr.get("frozen")).hidden(attr.get("hidden")).key().sortable().disable().get());
- }
- public void assemblePersonName(Context ctx, CmpColumnModels cmpColumnModels) {
- String personName = getMultiLan(ctx, "label2");
- Integer dataSource = (Integer)this.params.get("datasource");
- String cmpEmpORelF7Uipk = (dataSource != null && BatchSubmitSchemeBillDataSource.getEnum(dataSource.intValue()) == BatchSubmitSchemeBillDataSource.TEAM_SUBMIT) ? "com.kingdee.shr.compensation.app.integrate.stores.CmpEmpORelation.F7" : "com.kingdee.shr.compensation.app.integrate.CmpEmpORelation.F7";
-
- Map<String, Boolean> attr = (this.attrMap == null) ? new HashMap<>() : this.attrMap.get("person");
- cmpColumnModels.add(personName, CmpColumnModelWrapper.createF7ColModel("person", personName, Integer.valueOf(90)).assembleF7Editoptions(personName, cmpEmpORelF7Uipk, true, false)
- .frozen(attr.get("frozen")).hidden(attr.get("hidden")).sortable().get());
- }
- public void assembleAdminOrgName(Context ctx, CmpColumnModels cmpColumnModels) {
- String adminOrgName = getMultiLan(ctx, "label3");
- Map<String, Boolean> attr = (this.attrMap == null) ? new HashMap<>() : this.attrMap.get("adminOrgUnit");
- cmpColumnModels.add(adminOrgName, CmpColumnModelWrapper.createF7ColModel("adminOrgUnit", adminOrgName, Integer.valueOf(150)).frozen(attr.get("frozen")).hidden(attr.get("hidden")).disable().get());
- }
- public void assemblePositionName(Context ctx, CmpColumnModels cmpColumnModels) {
- String positionName = getMultiLan(ctx, "label4");
- Map<String, Boolean> attr = (this.attrMap == null) ? new HashMap<>() : this.attrMap.get("position");
- cmpColumnModels.add(positionName, CmpColumnModelWrapper.createF7ColModel("position", positionName, Integer.valueOf(150)).frozen(attr.get("frozen")).hidden(attr.get("hidden")).disable().get());
- }
- public void assembleCmpEmpORelationName(Context ctx, CmpColumnModels cmpColumnModels) {
- String cmpEmpORelationName = getMultiLan(ctx, "label5");
- Map<String, Boolean> attr = (this.attrMap == null) ? new HashMap<>() : this.attrMap.get("cmpEmpORelation");
- cmpColumnModels.add(cmpEmpORelationName, CmpColumnModelWrapper.createF7ColModel("cmpEmpORelation", cmpEmpORelationName, Integer.valueOf(90)).frozen(attr.get("frozen")).hidden(attr.get("hidden")).get());
- }
- public void assembleTempPropName(Context ctx, CmpColumnModels cmpColumnModels) {
- String tempPropName = "tempId";
- Map<String, Boolean> attr = (this.attrMap == null) ? new HashMap<>() : this.attrMap.get("tempId");
- cmpColumnModels.add(tempPropName, CmpColumnModelWrapper.createTextColModel("tempId", tempPropName, Integer.valueOf(90)).frozen(attr.get("frozen")).hidden(attr.get("hidden")).key().get());
- }
- public void assembleSubmitElement(Context ctx, CmpColumnModels cmpColumnModels) {
- if (this.submitScheme.isIsEnableSubmitElement()) {
- String hrOrgUnitId = this.submitScheme.getHrOrgUnit().getId().toString();
- String filterSql = "hrOrgUse.id ='" + hrOrgUnitId + "' and state = " + 'd';
- String submtElementName = getMultiLan(ctx, "label6");
- Map<String, Boolean> attr = (this.attrMap == null) ? new HashMap<>() : this.attrMap.get("submitElement");
- cmpColumnModels.add(submtElementName, CmpColumnModelWrapper.createF7ColModel("submitElement", submtElementName, Integer.valueOf(90))
- .assembleF7Editoptions(submtElementName, "com.kingdee.shr.compensation.app.integrate.SubmitElement.usable.list", true, filterSql, true).frozen(attr.get("frozen")).hidden(attr.get("hidden")).required().get());
- }
- }
- public void assembleEffectDate(Context ctx, CmpColumnModels cmpColumnModels) {
- String effectDateName = this.submitScheme.isIscycle() ? getMultiLan(ctx, "label41") : getMultiLan(ctx, "label8");
- if(!(ctx.getLocale().toString().equalsIgnoreCase("zh_CN") || ctx.getLocale().toString().equalsIgnoreCase("l2") || ctx.getLocale().toString().equalsIgnoreCase("L2"))) {
- effectDateName = "Occurring Date";
- }
- boolean isRemoveDay = (DateTypeEnum.yyyyMM == this.submitScheme.getEffectDateDisplay());
- Map<String, Boolean> attr = (this.attrMap == null) ? new HashMap<>() : this.attrMap.get("effectDate");
- cmpColumnModels.add(effectDateName, CmpColumnModelWrapper.createDateColModel("effectDate", effectDateName, Integer.valueOf(90)).assembleDateEditoptions(true, isRemoveDay)
- .frozen(attr.get("frozen")).hidden(attr.get("hidden")).key().get());
- }
- public void assembleLEffectDate(Context ctx, CmpColumnModels cmpColumnModels) {
- if (this.submitScheme.isIscycle()) {
- String leffectDateName = getMultiLan(ctx, "label33");
- Map<String, Boolean> attr = (this.attrMap == null) ? new HashMap<>() : this.attrMap.get("leffectDate");
- cmpColumnModels.add(leffectDateName, CmpColumnModelWrapper.createDateColModel("leffectDate", leffectDateName, Integer.valueOf(90)).assembleDateEditoptions(false, false)
- .frozen(attr.get("frozen")).hidden(attr.get("hidden")).get());
- }
- }
- public void assembleCurrency(Context ctx, CmpColumnModels cmpColumnModels) {
- String currencyName = getMultiLan(ctx, "label7");
- Map<String, Boolean> attr = (this.attrMap == null) ? new HashMap<>() : this.attrMap.get("currency");
- cmpColumnModels.add(currencyName, CmpColumnModelWrapper.createF7ColModel("currency", currencyName, Integer.valueOf(90)).assembleF7Editoptions(currencyName, "com.kingdee.eas.basedata.assistant.app.Currency.CMP.F7", true, false)
- .frozen(attr.get("frozen")).hidden(attr.get("hidden")).get());
- }
- public void assembleDescription(Context ctx, CmpColumnModels cmpColumnModels) {
- assembleAddNewPropName(ctx, cmpColumnModels);
-
- String descriptionName = getMultiLan(ctx, "label9");
- Map<String, Boolean> attr = (this.attrMap == null) ? new HashMap<>() : this.attrMap.get("description");
- cmpColumnModels.add(descriptionName, CmpColumnModelWrapper.createMultiLanColModel("description", descriptionName, Integer.valueOf(250)).assembleTextInputEditOptions(false, 255)
- .frozen(attr.get("frozen")).hidden(attr.get("hidden")).get());
- }
-
- /**
- * 自定义字段添加
- * @param ctx
- * @param cmpColumnModels
- */
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public void assembleAddNewPropName(Context ctx, CmpColumnModels cmpColumnModels) {
- Map<String, Map<String, Boolean>> attrMap = null;
- try {
- attrMap = CmpDisplayViewAnalyzing.complementDefaultField(ctx, "com.kingdee.shr.compensation.app.integrate.BatchSubmitShemeBill.form.display");
- } catch (SHRWebException e) {
- e.printStackTrace();
- }
-
- String tempPropName = "Contract Start Time(合同开始时间)";
- Map<String, Boolean> attr = attrMap == null ? new HashMap() : (Map)attrMap.get("beginContractDate");
- Map<String, Object> modelMap = CmpColumnModelWrapper.createDateColModel("beginContractDate", tempPropName, 90).assembleDateEditoptions(false, false).frozen((Boolean) ((Map) attr).get("frozen")).hidden((Boolean) ((Map) attr).get("hidden")).key().disable().get();
- cmpColumnModels.add(tempPropName, modelMap);
-
- tempPropName = "Contract End Time(合同结束时间)";
- attr = attrMap == null ? new HashMap() : (Map)attrMap.get("endContractDate");
- modelMap = CmpColumnModelWrapper.createDateColModel("endContractDate", tempPropName, 90).assembleDateEditoptions(false, false).frozen((Boolean) ((Map) attr).get("frozen")).hidden((Boolean) ((Map) attr).get("hidden")).key().disable().get();
- cmpColumnModels.add(tempPropName, modelMap);
-
- tempPropName = "Line Manager(直属上级)";
- attr = attrMap == null ? new HashMap() : (Map)attrMap.get("superiorId");
- cmpColumnModels.add(tempPropName, CmpColumnModelWrapper.createTextColModel("superiorId", tempPropName, 90).frozen((Boolean)((Map)attr).get("frozen")).hidden((Boolean)((Map)attr).get("hidden")).key().disable().get());
-
- tempPropName = "Line Manager(直属上级)";
- attr = attrMap == null ? new HashMap() : (Map)attrMap.get("superiorName");
- cmpColumnModels.add(tempPropName, CmpColumnModelWrapper.createTextColModel("superiorName", tempPropName, 90).frozen((Boolean)((Map)attr).get("frozen")).hidden((Boolean)((Map)attr).get("hidden")).key().disable().get());
-
- tempPropName = "Hourly Rate(时薪)";
- attr = attrMap == null ? new HashMap() : (Map)attrMap.get("hourlyWage");
- cmpColumnModels.add(tempPropName, CmpColumnModelWrapper.createDecimalColModel("hourlyWage", tempPropName, 90).assembleDecimalInputEditOptions(true, 2, 2).frozen((Boolean)((Map)attr).get("frozen")).hidden((Boolean)((Map)attr).get("hidden")).disable().get());
-
- tempPropName = "*Start Time(开始时间)";
- attr = attrMap == null ? new HashMap() : (Map)attrMap.get("startTime");
- modelMap = CmpColumnModelWrapper.createDateColModel("startTime", tempPropName, 90).assembleDateEditoptions(true, false).frozen((Boolean) ((Map) attr).get("frozen")).hidden((Boolean) ((Map) attr).get("hidden")).key().get();
- setDataType(modelMap);
- cmpColumnModels.add(tempPropName, modelMap);
-
- tempPropName = "*End Time(结束时间)";
- attr = attrMap == null ? new HashMap() : (Map)attrMap.get("endTime");
- modelMap = CmpColumnModelWrapper.createDateColModel("endTime", tempPropName, 90).assembleDateEditoptions(true, false).frozen((Boolean) ((Map) attr).get("frozen")).hidden((Boolean) ((Map) attr).get("hidden")).key().get();
- setDataType(modelMap);
- cmpColumnModels.add(tempPropName, modelMap);
- tempPropName = "Start Break Time(休息开始时间)";
- attr = attrMap == null ? new HashMap() : (Map)attrMap.get("restStartTime");
- modelMap = CmpColumnModelWrapper.createDateColModel("restStartTime", tempPropName, 90).assembleDateEditoptions(false, false).frozen((Boolean) ((Map) attr).get("frozen")).hidden((Boolean) ((Map) attr).get("hidden")).key().get();
- setDataType(modelMap);
- cmpColumnModels.add(tempPropName, modelMap);
- tempPropName = "End Break Time(休息结束时间)";
- attr = attrMap == null ? new HashMap() : (Map)attrMap.get("restEndTime");
- modelMap = CmpColumnModelWrapper.createDateColModel("restEndTime", tempPropName, 90).assembleDateEditoptions(false, false).frozen((Boolean) ((Map) attr).get("frozen")).hidden((Boolean) ((Map) attr).get("hidden")).key().get();
- setDataType(modelMap);
- cmpColumnModels.add(tempPropName, modelMap);
- tempPropName = "Working hours(总工时)";
- attr = attrMap == null ? new HashMap() : (Map)attrMap.get("totalWorkHours");
- cmpColumnModels.add(tempPropName, CmpColumnModelWrapper.createDecimalColModel("totalWorkHours", tempPropName, 90).assembleDecimalInputEditOptions(true, 2, 2).frozen((Boolean)((Map)attr).get("frozen")).hidden((Boolean)((Map)attr).get("hidden")).disable().get());
-
- tempPropName = "Total Payment(总金额)";
- attr = attrMap == null ? new HashMap() : (Map)attrMap.get("totalAmount");
- cmpColumnModels.add(tempPropName, CmpColumnModelWrapper.createDecimalColModel("totalAmount", tempPropName, 90).assembleDecimalInputEditOptions(true, 2, 2).frozen((Boolean)((Map)attr).get("frozen")).hidden((Boolean)((Map)attr).get("hidden")).disable().get());
-
- tempPropName = "Note(说明)";
- attr = attrMap == null ? new HashMap() : (Map)attrMap.get("explain");
- cmpColumnModels.add(tempPropName, CmpColumnModelWrapper.createTextColModel("explain", tempPropName, 230).frozen((Boolean)((Map)attr).get("frozen")).hidden((Boolean)((Map)attr).get("hidden")).key().get());
-
- tempPropName = "Remark(备注)";
- attr = attrMap == null ? new HashMap() : (Map)attrMap.get("remark");
- cmpColumnModels.add(tempPropName, CmpColumnModelWrapper.createTextColModel("remark", tempPropName, 250).assembleTextInputEditOptions(false, 500).frozen((Boolean)((Map)attr).get("frozen")).hidden((Boolean)((Map)attr).get("hidden")).key().get());
- }
-
- /**
- * 将日期控件类型改成时间控件
- * @param modelMap
- */
- @SuppressWarnings("unchecked")
- public void setDataType(Map<String, Object> modelMap){
- Map<String, Object> editoptions = (Map<String, Object>) modelMap.get("editoptions");
- Map<String, Object> datepickerjson = (Map<String, Object>) editoptions.get("datepickerjson");
- datepickerjson.put("ctrlType", "Time");
- }
- public void assembleDynamicItem(Context ctx, CmpColumnModels cmpColumnModels) throws SHRWebException {
- CalSubmitSchemeItemCollection schemeItemCols;
- String submitSchemeId = this.submitScheme.getId().toString();
- try {
- schemeItemCols = CalSubmitSchemeItemFactory.getLocalInstance(ctx).getCalSubmitSchemeItemCollection("select calSubmitItem.*,isRequired where calSubmitScheme = '" + submitSchemeId + "' and isShow = 1 and state = 1 order by sortSn asc");
- } catch (BOSException e) {
- throw new SHRWebException(e.getMessage(), e);
- }
- Set<String> calItemPropNames = CmpIntegrateWebHelper.getCalItemPropNames(ctx, submitSchemeId);
- Map<String, List<Map<String, Object>>> autoCalFieldOptionMap = CmpIntegrateUtils.initAutoCalFieldOption(ctx, submitSchemeId);
- Map<String, CalSchemeItemForF7Info> f7ItemAndFilterUipkMap = CmpIntegrateWebHelper.getItemAndItemForF7Map(ctx, submitSchemeId);
- String usualDataMsg = SHRServerResource.getString("com.kingdee.shr.cmpdesign.resource.AdjustSalaryApplyResource", "label57", ctx);
- for (int i = 0; i < schemeItemCols.size(); i++) {
- CmpColumnModelWrapper wrapper;
- CalSubmitSchemeItemInfo calSchemeItem = schemeItemCols.get(i);
- CalSubmitItemInfo calItem = calSchemeItem.getCalSubmitItem();
- String calItemNumber = calItem.getNumber();
- if(StringUtils.equals("GS001", calItemNumber)) {
- continue;
- }
- String propName = "S" + calItem.getFieldSn();
- boolean isRequired = (CalFlag.YES == calSchemeItem.getIsRequired());
- isRequired = isRequired(ctx, cmpColumnModels, this.submitScheme, this.params, isRequired);
- if (CalSubmitItemDataType.number == calItem.getDataType()) {
- wrapper = CmpColumnModelWrapper.createDecimalColModel(propName, calItem.getName(), Integer.valueOf(100));
- wrapper.assembleDecimalInputEditOptions(isRequired, calItem.getDataDot().getValue(), calItem.getDataLength());
- if (autoCalFieldOptionMap.containsKey(propName)) {
- JSONObject editoptions = (JSONObject)wrapper.get().get("editoptions");
- editoptions.put("autoCal", Boolean.valueOf(true));
- editoptions.put("cellFomular", autoCalFieldOptionMap.get(propName));
- }
- } else if (CalSubmitItemDataType.String == calItem.getDataType()) {
- wrapper = CmpColumnModelWrapper.createTextColModel(propName, calItem.getName(), Integer.valueOf(90));
- wrapper.assembleTextInputEditOptions(isRequired, calItem.getDataLength());
- } else if (CalSubmitItemDataType.Date == calItem.getDataType()) {
- wrapper = CmpColumnModelWrapper.createDateColModel(propName, calItem.getName(), Integer.valueOf(90));
- boolean isRemoveDay = (DateTypeEnum.yyyyMM == calItem.getDateType());
- wrapper.assembleDateEditoptions(isRequired, isRemoveDay);
- } else if (CalSubmitItemDataType.F7 == calItem.getDataType()) {
- CalSchemeItemForF7Info itemForF7 = f7ItemAndFilterUipkMap.get(calItem.getId().toString());
- String f7Filter = getF7Filter(calItem, itemForF7, this.params);
- wrapper = CmpColumnModelWrapper.createF7ColModel(propName, calItem.getName(), Integer.valueOf(90));
- wrapper.assembleF7Editoptions(calItem.getName(), itemForF7.getUipk(), isRequired, f7Filter, itemForF7.isIsBasic());
- if (itemForF7.isIsBasic())
- ((Map<String, String>)((List<Map<String, String>>)((Map)((Map)((Map)wrapper.get().get("editoptions")).get("f7Json")).get("subWidgetOptions")).get("filterConfig")).get(0)).put("alias", usualDataMsg);
- } else {
- wrapper = CmpColumnModelWrapper.createEmptyColModel();
- }
- if (calItemPropNames.contains(propName)) {
- wrapper.disable();
- if (isRequired)
- wrapper.requiredAndDisable();
- }
- cmpColumnModels.add(calItem.getName(), wrapper.get());
- }
- }
- protected boolean isRequired(Context ctx, CmpColumnModels cmpColumnModels, CalSubmitSchemeInfo submitScheme, Map<String, Object> params, boolean isRequired) {
- return isRequired;
- }
- protected String getF7Filter(CalSubmitItemInfo calItem, CalSchemeItemForF7Info itemForF7, Map<String, Object> params) {
- List<String> filerList = Lists.newArrayList();
- if (itemForF7.isIsBasic())
- filerList.add("state = 100");
- String hrOrgUnitId = (String)params.get("hrOrgUnitId");
- if (!StringUtils.isEmpty(hrOrgUnitId) && itemForF7.isIsBasic())
- filerList.add("hrOrgUse.id = '" + hrOrgUnitId + "'");
- String costTypeId = (String)params.get("costTypeId");
- if ("AwardName".equals(calItem.getNumber()) && !StringUtils.isEmpty(costTypeId))
- filerList.add("costType.id = '" + costTypeId + "'");
- return StringUtils.join(filerList, " and ");
- }
- protected String getMultiLan(Context ctx, String label) {
- return EASResource.getString("com.kingdee.shr.compensation.resource.SubmitShemeBillResource", label, ctx.getLocale());
- }
- }
|