123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- package com.kingdee.eas.custom.projectbonus.web.vo;
- import com.kingdee.bos.BOSException;
- import com.kingdee.bos.Context;
- import com.kingdee.shr.base.syssetting.context.SHRContext;
- import com.kingdee.shr.base.syssetting.exception.SHRWebException;
- import com.kingdee.shr.base.syssetting.util.SHRBasicItemUtil;
- import com.kingdee.shr.base.syssetting.util.SHREnumUtils;
- import com.kingdee.shr.base.syssetting.util.SelectItem;
- import com.kingdee.util.StringUtils;
- import com.kingdee.util.enums.*;
- import com.kingdee.util.enums.Enum;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * @Description TODO
- * @Date 2024/4/28 10:38
- * @Created by Heyuan
- */
- public class EditOptions {
- // F7Json对象
- private F7Json f7Json;
- //枚举对象
- private SelectJson selectJson;
- //日期
- private DatepickerJson datepickerjson;
- private Map<String, Object> enumSource;
- private String urlSource;
- // ValidateJson对象
- private ValidateJson validateJson;
- public SelectJson getSelectJson() {
- if (selectJson == null) {
- this.selectJson = new SelectJson();
- }
- return selectJson;
- }
- public void setSelectJson(SelectJson selectJson) {
- this.selectJson = selectJson;
- }
- public String getUrlSource() {
- return urlSource;
- }
- public void setUrlSource(String urlSource) throws BOSException, SHRWebException {
- this.urlSource = "/shr/selectEnum.do?method=getSelectEnumData&enumSource=" + urlSource;
- setEnumSource(urlSource);
- }
- public F7Json getF7Json() {
- if (f7Json == null) {
- this.f7Json = new F7Json();
- }
- return f7Json;
- }
- public void setF7Json(F7Json f7Json) {
- this.f7Json = f7Json;
- }
- public ValidateJson getValidateJson() {
- if (validateJson == null) {
- this.validateJson = new ValidateJson();
- }
- return validateJson;
- }
- public void setValidateJson(ValidateJson validateJson) {
- this.validateJson = validateJson;
- }
- public DatepickerJson getDatepickerjson() {
- if (datepickerjson == null) {
- this.datepickerjson = new DatepickerJson();
- }
- return datepickerjson;
- }
- public void setDatepickerjson(DatepickerJson datepickerjson) {
- this.datepickerjson = datepickerjson;
- }
- public void setEnumSource(String entityName) throws SHRWebException, BOSException {
- if (enumSource == null) {
- enumSource = new HashMap<String, Object>();
- }
- enumSource.put("result", "success");
- if (StringUtils.isEmpty(entityName)) {
- throw new BOSException("entityName为空!");
- }
- List<SelectItem> list = new ArrayList();
- Context ctx = SHRContext.getInstance().getContext();
- SHRBasicItemUtil.getUsePolicySelectItem(entityName, list);
- if (null == list || list.size() <= 0) {
- if (!StringUtils.isEmpty(entityName)) {
- List enumList2 = EnumUtils.getEnumList(entityName);
- for (int i = 0; i < enumList2.size(); ++i) {
- Enum objEnum = (Enum) enumList2.get(i);
- Object value = null;
- if (objEnum instanceof StringEnum) {
- value = ((StringEnum) objEnum).getValue();
- } else if (objEnum instanceof DynamicEnum) {
- value = ((DynamicEnum) objEnum).getValue();
- } else if (objEnum instanceof LongEnum) {
- value = ((LongEnum) objEnum).getValue();
- } else if (objEnum instanceof IntEnum) {
- value = ((IntEnum) objEnum).getValue();
- } else if (objEnum instanceof FloatEnum) {
- value = ((FloatEnum) objEnum).getValue();
- } else if (objEnum instanceof DoubleEnum) {
- value = ((DoubleEnum) objEnum).getValue();
- } else {
- value = objEnum.getName();
- }
- String alias = objEnum.getAlias(ctx.getLocale());
- if (StringUtils.isEmpty(alias)) {
- alias = objEnum.getAlias();
- }
- SelectItem item = new SelectItem();
- item.setValue(value);
- item.setAlias(alias);
- item.setMultiAlias(SHREnumUtils.getMultiAlias(objEnum));
- list.add(item);
- }
- }
- }
- enumSource.put("data", list);
- }
- }
|