Browse Source

Merge remote-tracking branch 'origin/4.0' into 4.0

4.0
lip 2 years ago
parent
commit
cacfd6482e
4 changed files with 70 additions and 30 deletions
  1. +6
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/login/AuthService.java
  2. +50
    -0
      smtweb-framework/bpm/src/main/resources/static/event/bpm/sys/user/area/area.js
  3. +0
    -30
      smtweb-framework/bpm/src/main/resources/static/event/bpm/sys/user/area/area_list.js
  4. +14
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/cache/CacheManager.java

+ 6
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/login/AuthService.java View File

@@ -3,6 +3,7 @@ package cc.smtweb.system.bpm.web.login;
import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
@@ -112,6 +113,11 @@ public class AuthService {
return R.success();
}

public R refreshCache() {
CacheManager.getIntance().refresh();
return R.success();
}

// defaultRun 命名的函数是默认函数
// @SwPerm(SwPerm.NONE)
// public R defaultRun(@SwPathParam String path) {


+ 50
- 0
smtweb-framework/bpm/src/main/resources/static/event/bpm/sys/user/area/area.js View File

@@ -0,0 +1,50 @@
/**
* Created by 1 at 2022-09-09 17:50:25
* 注册事件类【行政区划管理】,参看event.defaultEvent.js
*/
window.$swEvent.setup("bpm.sys.user.area.area", {
setup(page) {
const {$params, $refs, $widgets, $model, $utils, $tabRouter, $api} = page || {};
const {$$message, $$http} = $utils || {};
const custom = {};
const typeMap = {2: 105100, 4: 105101, 6: 105102, 9: 105103, 12: 105104};
//
const focusName = () => {
custom.name = $model.areacard.getFormVal("ar_name");
};
const changeName = (value) => {
if ($model.areacard.getFormVal("ar_full_name") === custom.name)
$model.areacard.setFormVal("ar_full_name", value);
};

const focusCode = () => {
custom.code = $model.areacard.getFormVal("ar_code");
};
const changeCode = (value) => {
if ($model.areacard.getFormVal("ar_seq") === custom.code)
$model.areacard.setFormVal("ar_seq", value);
//根据编码长度设置区划级别
$model.areacard.setFormVal("ar_type", typeMap[value.length]);
$model.areacard.setFormVal("ar_parent_id", getParentArea(value));

};

const getParentArea = (value) => {
if (value.length == 12) {
return value.substring(0, 9);
}
if (value.length == 9) {
return value.substring(0, 6);
}
if (value.length == 6) {
return value.substring(0, 4);
}
if (value.length == 4) {
return value.substring(0, 2);
}
}
return {
focusName, changeName, focusCode, changeCode
}
}
});

+ 0
- 30
smtweb-framework/bpm/src/main/resources/static/event/bpm/sys/user/area/area_list.js View File

@@ -1,30 +0,0 @@
/**
* Created by 1 at 2022-07-26 17:18:17
* 注册事件类【行政区划管理】,参看event.defaultEvent.js
*/
window.$swEvent.setup("bpm.sys.user.area.area_list", {
setup(page){
const { $params,$refs, $widgets, $model, $utils, $tabRouter, $api } = page || {};
const { $$message, $$http } = $utils || {};
const custom = {};
//
const focusName = () => {
custom.name = $model.areacard.getFormVal("ar_name");
};
const changeName = (value) => {
if ($model.areacard.getFormVal("ar_full_name") === custom.name)
$model.areacard.setFormVal("ar_full_name", value);
};

const focusCode = () => {
custom.code = $model.areacard.getFormVal("ar_code");
};
const changeCode = (value) => {
if ($model.areacard.getFormVal("ar_seq") === custom.code)
$model.areacard.setFormVal("ar_seq", value);
};
return {
focusName, changeName, focusCode, changeCode
}
}
});

+ 14
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/cache/CacheManager.java View File

@@ -90,6 +90,20 @@ public class CacheManager {
}
}

public void refresh() {
listCache.sort((o1, o2) -> {
//o1依赖o2
if (isContains(o1.getDepends(), o2.getIdent())) return 1;
//o2依赖o1
if (isContains(o2.getDepends(), o1.getIdent())) return -1;

return 0;//getPluginIndex(o1) - getPluginIndex(o2);
});
for (AbstractCache cache : listCache) {
cache.init();
}
}

private boolean isContains(String[] src, String dest) {
if (src == null || src.length == 0) return false;
for (String s : src) {


Loading…
Cancel
Save