Parcourir la source

二开系统环境变量不需要,删除

chengchaohua il y a 2 mois
Parent
commit
6cfcb1484b

+ 0 - 45
code/base/nckd-jimin-base-common/src/main/java/nckd/jimin/base/common/utils/capp/CacheBusinessData.java

@@ -1,45 +0,0 @@
-package nckd.jimin.base.common.utils.capp;
-
-import kd.bos.cache.CacheFactory;
-import kd.bos.cache.DistributeSessionlessCache;
-
-
-/**
- *  自定义缓存
- * author: chengchaohua
- * date: 2024-08-27
- */
-public class CacheBusinessData
-{
-  private static final String CACHE_REGION = "BUSSINESS_DATA";
-  private static final String CACHE_TIMEOUT_KEY = "capp.cache.timeout";
-  private static final String DEFAULT_CACHE_TIMEOUT = System.getProperty("capp.cache.timeout", String.valueOf(43200));
-
-
-  private static DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("BUSSINESS_DATA");
-
-
-  public static void set(String type, String key, String value, int timeout) {
-    cache.put(getCombinedKey(type, key), value, timeout);
-  }
-
-  public static void set(String type, String key, String value) {
-    set(type, key, value, Integer.parseInt(DEFAULT_CACHE_TIMEOUT));
-  }
-
-  public static String get(String type, String key) {
-    return (String)cache.get(getCombinedKey(type, key));
-  }
-
-  public static void remove(String type, String key) {
-    cache.remove(getCombinedKey(type, key));
-  }
-
-  private static String getKeyPrefix(String type) {
-    return type + "-";
-  }
-
-  private static String getCombinedKey(String type, String key) {
-    return getKeyPrefix(type) + key + "_" + System.getProperty("clusterName");
-  }
-}

+ 0 - 89
code/base/nckd-jimin-base-common/src/main/java/nckd/jimin/base/common/utils/capp/CappConfig.java

@@ -1,89 +0,0 @@
-package nckd.jimin.base.common.utils.capp;
-
-import kd.bos.db.DB;
-import kd.bos.db.DBRoute;
-import kd.bos.encrypt.Encrypters;
-import kd.bos.util.StringUtils;
-
-/**
- * 系统配置参数缓存取值--自定义开发
- * 该类会用到的地方:单据名称:capp配置表  标识:capp_config
- * 用于维护系统配置或接口参数
- * author: chengchaohua
- * date: 2024-08-27
- */
-public class CappConfig {
-    // 缓存前缀标记
-    private static final String CAPP_CONFIG = "capp_config";
-
-    //缓存无值时,取设置的默认值
-    public static String getConfigValue(String code, String def) {
-        String ret;
-        try {
-            ret = getConfigValue(code);
-            if (StringUtils.isEmpty(ret) && !StringUtils.isEmpty(def)) {
-                ret = def;
-                CacheBusinessData.set(CAPP_CONFIG, code, def);
-            }
-        } catch (Exception ignored) {
-            return def;
-        }
-        return ret;
-    }
-
-    /**
-     * 根据编码从缓存或数据库中获取配置参数值
-     * 若缓存中没有,从数据库中获取后放入缓存中,过期时间12小时
-     *
-     * @return String
-     */
-    public static String getConfigValue(String code) {
-        if (code == null || code.length() == 0) {
-            return null;
-        }
-        String value = CacheBusinessData.get(CAPP_CONFIG, code);
-        if (value != null) {
-            value = Encrypters.decode(value);
-            return value;
-        } else {
-            value = DB.query(DBRoute.of("sys"), "select fvalue from t_capp_config where fenable = '1' and fcode =  ?", new Object[]{code}, resultSet -> {
-                String valuetemp = null;
-                while (resultSet.next()) {
-                    valuetemp = resultSet.getString(1);
-                }
-                if (valuetemp == null) {
-                    return null;
-                }
-                CacheBusinessData.set(CAPP_CONFIG, code, valuetemp);
-                valuetemp = Encrypters.decode(valuetemp);
-                return valuetemp;
-            });
-            return value;
-        }
-    }
-
-    /**
-     * 根据编码刷新配置参数值缓存
-     *
-     * @param code 编码
-     */
-    public static void refreshConfigValueCache(String code) {
-        // 清缓存
-        removeConfigValueCache(code);
-        // 重新赋新值给缓存
-        getConfigValue(code);
-    }
-
-    /**
-     * 清缓存
-     *
-     * @param code
-     */
-    public static void removeConfigValueCache(String code) {
-        if (code == null || code.length() == 0) {
-            return;
-        }
-        // 清缓存
-        CacheBusinessData.remove(CAPP_CONFIG, code);
-    }
-}

+ 0 - 209
code/base/nckd-jimin-base-common/src/main/java/nckd/jimin/base/common/utils/capp/CappConfigListPlugin.java

@@ -1,209 +0,0 @@
-package nckd.jimin.base.common.utils.capp;
-
-import kd.bos.context.RequestContext;
-import kd.bos.data.BusinessDataReader;
-import kd.bos.dataentity.entity.DynamicObject;
-import kd.bos.dataentity.entity.DynamicObjectCollection;
-import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
-import kd.bos.dataentity.utils.StringUtils;
-import kd.bos.entity.EntityMetadataCache;
-import kd.bos.entity.MainEntityType;
-import kd.bos.entity.datamodel.ListSelectedRow;
-import kd.bos.entity.datamodel.ListSelectedRowCollection;
-import kd.bos.entity.list.IListDataProvider;
-import kd.bos.form.control.events.BeforeItemClickEvent;
-import kd.bos.form.control.events.ItemClickEvent;
-import kd.bos.form.events.BeforeCreateListDataProviderArgs;
-import kd.bos.list.BillList;
-import kd.bos.list.IListView;
-import kd.bos.list.plugin.AbstractListPlugin;
-import kd.bos.mvc.list.ListDataProvider;
-import kd.bos.orm.query.QFilter;
-import kd.bos.servicehelper.BusinessDataServiceHelper;
-import kd.bos.servicehelper.operation.SaveServiceHelper;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * 单据名称:capp配置表  标识:capp_config 列表插件
- * 用于维护系统配置或接口参数
- * author: chengchaohua
- * date: 2024-08-27
- */
-public class CappConfigListPlugin extends AbstractListPlugin
-{
-  private static final String DELETE = "delete";
-
-  public void beforeItemClick(BeforeItemClickEvent evt) {
-    super.beforeItemClick(evt);
-    String itemKey = evt.getItemKey();
-
-    BillList billList = (BillList)getControl("billlistap");
-    ListSelectedRowCollection listSelectedRowCol = billList.getSelectedRows();
-
-    if (StringUtils.equals("delete", itemKey)) {
-      if (listSelectedRowCol.size() == 0) {
-        getView().showTipNotification("请选择要执行的数据。");
-        evt.setCancel(true);
-      } else {
-        String formId = ((IListView)getView()).getBillFormId();
-        QFilter qFilter = (new QFilter("id", "in", listSelectedRowCol.getPrimaryKeyValues())).and(new QFilter("enable", "=", "1"));
-        Map<Object, DynamicObject> map = BusinessDataServiceHelper.loadFromCache(formId, new QFilter[] { qFilter });
-        if (map.size() > 0) {
-          getView().showTipNotification("请先禁用数据。");
-          evt.setCancel(true);
-          return;
-        }
-      }
-    }
-  }
-
-
-  public void itemClick(ItemClickEvent evt) {
-    super.itemClick(evt);
-
-    String formId = ((IListView)getView()).getBillFormId();
-
-    BillList billList = (BillList)getControl("billlistap");
-
-    ListSelectedRowCollection listSelectedRowCol = billList.getSelectedRows();
-
-
-    Date currentDate = new Date();
-    DynamicObject modifier = null;
-    if (StringUtils.equals("enablebutton", evt.getItemKey()) || StringUtils.equals("disablebutton", evt.getItemKey())) {
-      long userId = RequestContext.get().getCurrUserId();
-      MainEntityType userDT = EntityMetadataCache.getDataEntityType("bos_user");
-      modifier = BusinessDataReader.loadSingle(Long.valueOf(userId), (DynamicObjectType)userDT);
-    }
-
-    if (StringUtils.equals("enablebutton", evt.getItemKey())) {
-
-      if (listSelectedRowCol != null && listSelectedRowCol.size() > 0) {
-        List<DynamicObject> listSelectedRowCol2 = new ArrayList<>();
-
-        for (ListSelectedRow tempRowDataId : listSelectedRowCol) {
-
-          DynamicObject tempRowData = BusinessDataServiceHelper.loadSingle(tempRowDataId.getPrimaryKeyValue(), formId);
-          if (!StringUtils.equals(tempRowData.getString("enable"), "1")) {
-
-            tempRowData.set("enable", "1");
-
-            tempRowData.set("modifydatefield", currentDate);
-            tempRowData.set("modifierfield", modifier);
-            listSelectedRowCol2.add(tempRowData);
-          }
-        }
-        if (listSelectedRowCol2.size() > 0) {
-
-          Object[] result = SaveServiceHelper.save(listSelectedRowCol2.<DynamicObject>toArray(new DynamicObject[0]));
-
-          ((IListView)getView()).refresh();
-          getView().showSuccessNotification("启用更新成功" + result.length + "条。");
-
-          for (DynamicObject obj : listSelectedRowCol2) {
-            CappConfig.refreshConfigValueCache(obj.getString("code"));
-          }
-
-          StringBuilder opDescription = new StringBuilder();
-          for (DynamicObject dynamicObject : listSelectedRowCol2) {
-            opDescription.append(dynamicObject.getString("code")).append(",");
-          }
-          CappLogUtil.cappOperationLog("启用", "编码:" + opDescription + "操作成功。", "capp_config");
-        } else {
-          getView().showTipNotification("数据已为可用状态。");
-        }
-      }
-    } else if (StringUtils.equals("disablebutton", evt.getItemKey())) {
-
-      if (listSelectedRowCol != null && listSelectedRowCol.size() > 0) {
-        List<DynamicObject> listSelectedRowCol2 = new ArrayList<>();
-
-        for (ListSelectedRow tempRowDataId : listSelectedRowCol) {
-
-          DynamicObject tempRowData = BusinessDataServiceHelper.loadSingle(tempRowDataId.getPrimaryKeyValue(), formId);
-          if (!StringUtils.equals(tempRowData.getString("enable"), "0")) {
-            tempRowData.set("enable", "0");
-            tempRowData.set("modifydatefield", currentDate);
-            tempRowData.set("modifierfield", modifier);
-            listSelectedRowCol2.add(tempRowData);
-          }
-        }
-        if (listSelectedRowCol2.size() > 0) {
-
-          Object[] result = SaveServiceHelper.save(listSelectedRowCol2.<DynamicObject>toArray(new DynamicObject[0]));
-
-          ((IListView)getView()).refresh();
-          getView().showSuccessNotification("禁用更新成功" + result.length + "条。");
-
-          for (DynamicObject obj : listSelectedRowCol2) {
-            CappConfig.removeConfigValueCache(obj.getString("code"));
-          }
-
-          StringBuilder opDescription = new StringBuilder();
-          for (DynamicObject dynamicObject : listSelectedRowCol2) {
-            opDescription.append(dynamicObject.getString("code")).append(",");
-          }
-          CappLogUtil.cappOperationLog("禁用", "编码:" + opDescription + "操作成功。", "capp_config");
-        } else {
-          getView().showTipNotification("数据已为禁用状态。");
-        }
-      }
-    } else if (StringUtils.equals("refreshcache", evt.getItemKey())) {
-
-      if (listSelectedRowCol != null && listSelectedRowCol.size() > 0) {
-        int executnum = 0;
-
-        for (ListSelectedRow tempRowDataId : listSelectedRowCol) {
-
-          DynamicObject tempRowData = BusinessDataServiceHelper.loadSingle(tempRowDataId.getPrimaryKeyValue(), formId);
-          if (StringUtils.equals(tempRowData.getString("enable"), "1")) {
-
-            CappConfig.refreshConfigValueCache(tempRowData.getString("code"));
-            executnum++;
-          }
-        }
-        getView().showSuccessNotification("更新缓存成功" + executnum + "条。");
-      }
-    } else if (StringUtils.equals("delete", evt.getItemKey())) {
-
-
-
-
-
-      for (ListSelectedRow tempRowDataId : listSelectedRowCol) {
-
-        DynamicObject tempRowData = BusinessDataServiceHelper.loadSingle(tempRowDataId.getPrimaryKeyValue(), formId);
-        CappConfig.removeConfigValueCache(tempRowData.getString("code"));
-      }
-    }
-  }
-
-
-
-  public void beforeCreateListDataProvider(BeforeCreateListDataProviderArgs args) {
-    super.beforeCreateListDataProvider(args);
-    args.setListDataProvider((IListDataProvider)new CappConfigListDataProvider());
-  }
-
-  static class CappConfigListDataProvider
-    extends ListDataProvider {
-    public DynamicObjectCollection getData(int arg0, int arg1) {
-      DynamicObjectCollection rows = super.getData(arg0, arg1);
-      if (rows.isEmpty()) {
-        return rows;
-      }
-
-      for (DynamicObject row : rows) {
-        if (StringUtils.equals("3", row.getString("type")) && !StringUtils.isBlank(row.getString("usevalue"))) {
-          row.set("usevalue", "••••••");
-        }
-      }
-      return rows;
-    }
-  }
-}

+ 0 - 78
code/base/nckd-jimin-base-common/src/main/java/nckd/jimin/base/common/utils/capp/CappConfigPlugin.java

@@ -1,78 +0,0 @@
-package nckd.jimin.base.common.utils.capp;
-
-import kd.bos.dataentity.utils.StringUtils;
-import kd.bos.encrypt.Encrypters;
-import kd.bos.form.control.Control;
-import kd.bos.form.control.events.BeforeClickEvent;
-import kd.bos.form.control.events.ClickListener;
-import kd.bos.form.events.AfterDoOperationEventArgs;
-import kd.bos.form.plugin.AbstractFormPlugin;
-
-import java.util.EventObject;
-
-/**
- * 单据名称:capp配置表  标识:capp_config 单据插件
- * 用于维护系统配置或接口参数
- * author: chengchaohua
- * date: 2024-08-27
- */
-public class CappConfigPlugin extends AbstractFormPlugin implements ClickListener
-{
-    private static final String PICTURE_FIELD = "picturefield";
-    private static final String ENCODE_VALUE = "encodevalue";
-    private static final String TEXT_VALUE = "textvalue";
-    private static final String USER_VALUE = "usevalue";
-
-    public void registerListener(EventObject e) {
-        super.registerListener(e);
-        addClickListeners(new String[] { "save" });
-    }
-
-
-    public void beforeClick(BeforeClickEvent evt) {
-        super.beforeClick(evt);
-        if (StringUtils.equals("save", ((Control)evt.getSource()).getKey())) {
-
-            getModel().setValue("code", ((String)getModel().getValue("code")).trim());
-            getModel().setValue("desc", ((String)getModel().getValue("desc")).trim());
-            String type = (String)getModel().getValue("type");
-            // type: 1- 文本 ,2- 图片 ,3- 密文
-            if ("1".equals(type)) {
-
-                getModel().setValue("picturefield", "");
-                getModel().setValue("encodevalue", "");
-
-                String textvalue = ((String)getModel().getValue("textvalue")).trim();
-                getModel().setValue("usevalue", textvalue);
-                getModel().setValue("textvalue", textvalue);
-            } else if ("2".equals(type)) {
-
-                getModel().setValue("textvalue", "");
-                getModel().setValue("encodevalue", "");
-                getModel().setValue("usevalue", getModel().getValue("picturefield"));
-            } else if ("3".equals(type)) {
-
-                getModel().setValue("textvalue", "");
-                getModel().setValue("picturefield", "");
-                String encodevalue = ((String)getModel().getValue("encodevalue")).trim();
-                String uservalue = (String)getModel().getValue("usevalue");
-                String temp = encodevalue;
-                if (!StringUtils.equals(uservalue, encodevalue) && !StringUtils.isBlank(encodevalue)) {
-                    temp = Encrypters.encode(encodevalue);
-                }
-                getModel().setValue("usevalue", temp);
-                getModel().setValue("encodevalue", temp);
-            }
-        }
-    }
-
-
-
-
-
-    public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
-        super.afterDoOperation(afterDoOperationEventArgs);
-        if ("save".equals(afterDoOperationEventArgs.getOperateKey()))
-            CappConfig.refreshConfigValueCache((String)getModel().getValue("code"));
-    }
-}

+ 0 - 38
code/base/nckd-jimin-base-common/src/main/java/nckd/jimin/base/common/utils/capp/CappLogUtil.java

@@ -1,38 +0,0 @@
-package nckd.jimin.base.common.utils.capp;
-
-import kd.bos.context.RequestContext;
-import kd.bos.log.api.AppLogInfo;
-import kd.bos.servicehelper.log.LogServiceHelper;
-
-import java.util.Date;
-
-
-/**
- * 系统日志--自定义开发
- * author: chengchaohua
- * date: 2024-08-27
- */
-public class CappLogUtil
-{
-  public static void cappOperationLog(String operationName, String opDescription, String bizObjID) {
-    Long userId = Long.valueOf(RequestContext.get().getUserId());
-    AppLogInfo appLogInfo = new AppLogInfo();
-
-    appLogInfo.setUserID(userId);
-
-    appLogInfo.setOrgID(Long.valueOf(RequestContext.get().getOrgId()));
-
-    appLogInfo.setOpTime(new Date());
-
-    appLogInfo.setOpName(operationName);
-
-    appLogInfo.setOpDescription(opDescription);
-
-    appLogInfo.setBizObjID(bizObjID);
-
-    appLogInfo.setBizAppID("1J9X9OLBSOQK");
-    appLogInfo.setClientType(RequestContext.get().getClient());
-    appLogInfo.setClientIP(RequestContext.get().getLoginIP());
-    LogServiceHelper.addLog(appLogInfo);
-  }
-}