commit
This commit is contained in:
@@ -14,6 +14,7 @@ import com.budwk.app.sys.services.SysDataUnitPullService;
|
||||
import com.budwk.app.sys.utils.DataCenterUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
@@ -126,7 +127,24 @@ public class SysDataUnitPullServiceImpl extends BaseServiceImpl<Sys_unit> implem
|
||||
log.info("本次拉取单位数据,新增{}条,更新{}条", insertList.size(), updateList.size());
|
||||
log.info("本次跳过一级或无编码单位{}条", skipCount);
|
||||
dao().insert(insertList);
|
||||
dao().update(updateList);
|
||||
updateDataCenterUnitFields(updateList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 只更新数据中心负责维护的单位字段,避免清空本地维护的工会、路径、排序等配置。
|
||||
*
|
||||
* @param updateList 需要更新的单位数据
|
||||
*/
|
||||
private void updateDataCenterUnitFields(List<Sys_unit> updateList) {
|
||||
for (Sys_unit unit : updateList) {
|
||||
Chain chain = Chain.make("unitcode", unit.getUnitcode());
|
||||
addChainIfNotNull(chain, "name", unit.getName());
|
||||
addChainIfNotNull(chain, "unitType", unit.getUnitType());
|
||||
addChainIfNotNull(chain, "unitTypeCode", unit.getUnitTypeCode());
|
||||
addChainIfNotNull(chain, "parentId", unit.getParentId());
|
||||
addChainIfNotNull(chain, "unitLevel", unit.getUnitLevel());
|
||||
dao().update(Sys_unit.class, chain, Cnd.where(Sys_unit::getId, "=", unit.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,4 +161,17 @@ public class SysDataUnitPullServiceImpl extends BaseServiceImpl<Sys_unit> implem
|
||||
}
|
||||
return value == null ? null : value.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据中心字段为空时不加入更新链,避免覆盖本地已有字段值。
|
||||
*
|
||||
* @param chain 更新字段链
|
||||
* @param fieldName 字段名
|
||||
* @param value 字段值
|
||||
*/
|
||||
private void addChainIfNotNull(Chain chain, String fieldName, Object value) {
|
||||
if (value != null) {
|
||||
chain.add(fieldName, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-10
@@ -338,6 +338,16 @@ layout("/layouts/platform.html"){
|
||||
return resp.data
|
||||
}
|
||||
},
|
||||
async ensureUserLoaded() {
|
||||
if (this.$store.state.user && this.$store.state.user.id) {
|
||||
return
|
||||
}
|
||||
const resp = await $.get("/platform/sys/user/getLogonUser")
|
||||
if (resp.code === 0) {
|
||||
window.sessionStorage.setItem("user", JSON.stringify(resp.data))
|
||||
this.$store.commit("setUser", resp.data)
|
||||
}
|
||||
},
|
||||
init() {
|
||||
if (this.bizId) {
|
||||
this.findOne(this.bizId).then(async data => {
|
||||
@@ -347,17 +357,19 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const {id, username, loginname, mobile, union, unit} = this.$store.state.user
|
||||
const user = this.$store.state.user || {}
|
||||
const unit = user.unit || {}
|
||||
const union = user.union || {}
|
||||
this.formData = {
|
||||
userId: id,
|
||||
userName: username,
|
||||
loginName: loginname,
|
||||
professionalTitle: this.$store.state.user.professionalTitle || "",
|
||||
unitName: unit.name,
|
||||
unitId: unit.id,
|
||||
unionName: union.name,
|
||||
unionId: union.id,
|
||||
mobile: mobile,
|
||||
userId: user.id,
|
||||
userName: user.username,
|
||||
loginName: user.loginname,
|
||||
professionalTitle: user.professionalTitle || "",
|
||||
unitName: unit.name || "",
|
||||
unitId: unit.id || "",
|
||||
unionName: union.name || "",
|
||||
unionId: union.id || "",
|
||||
mobile: user.mobile,
|
||||
}
|
||||
|
||||
}
|
||||
@@ -365,6 +377,7 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
await this.ensureUserLoaded()
|
||||
this.init()
|
||||
this.getEnrollmentRegistrationPlan()
|
||||
|
||||
|
||||
+23
-10
@@ -258,6 +258,16 @@ layout("/layouts/platform_h5.html"){
|
||||
this.registrationTypeOption = res.data
|
||||
}
|
||||
},
|
||||
async ensureUserLoaded() {
|
||||
if (this.$store.state.user && this.$store.state.user.id) {
|
||||
return
|
||||
}
|
||||
const resp = await $.get("/platform/sys/user/getLogonUser")
|
||||
if (resp.code === 0) {
|
||||
window.sessionStorage.setItem("user", JSON.stringify(resp.data))
|
||||
this.$store.commit("setUser", resp.data)
|
||||
}
|
||||
},
|
||||
init() {
|
||||
setTimeout(() => {
|
||||
this.childRelationshipOption = this.dict.type.ENROLLMENT_REGISTRATION_CHILD_RELATIONSHIP
|
||||
@@ -292,17 +302,19 @@ layout("/layouts/platform_h5.html"){
|
||||
|
||||
})
|
||||
} else {
|
||||
const {id, username, loginname, mobile, union, unit} = this.$store.state.user
|
||||
const user = this.$store.state.user || {}
|
||||
const unit = user.unit || {}
|
||||
const union = user.union || {}
|
||||
this.formData = {
|
||||
userId: id,
|
||||
userName: username,
|
||||
loginName: loginname,
|
||||
professionalTitle: this.$store.state.user.professionalTitle || "",
|
||||
unitName: unit.name,
|
||||
unitId: unit.id,
|
||||
unionName: union.name,
|
||||
unionId: union.id,
|
||||
mobile: mobile,
|
||||
userId: user.id,
|
||||
userName: user.username,
|
||||
loginName: user.loginname,
|
||||
professionalTitle: user.professionalTitle || "",
|
||||
unitName: unit.name || "",
|
||||
unitId: unit.id || "",
|
||||
unionName: union.name || "",
|
||||
unionId: union.id || "",
|
||||
mobile: user.mobile,
|
||||
childrenBirthdayDate: new Date(2000, 0, 1),
|
||||
}
|
||||
|
||||
@@ -473,6 +485,7 @@ layout("/layouts/platform_h5.html"){
|
||||
},
|
||||
async created() {
|
||||
await this.getEnrollmentRegistrationPlan()
|
||||
await this.ensureUserLoaded()
|
||||
this.init()
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user