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 com.budwk.app.sys.utils.DataCenterUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
|
import org.nutz.dao.Chain;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Dao;
|
import org.nutz.dao.Dao;
|
||||||
import org.nutz.dao.Sqls;
|
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("本次拉取单位数据,新增{}条,更新{}条", insertList.size(), updateList.size());
|
||||||
log.info("本次跳过一级或无编码单位{}条", skipCount);
|
log.info("本次跳过一级或无编码单位{}条", skipCount);
|
||||||
dao().insert(insertList);
|
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();
|
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
|
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() {
|
init() {
|
||||||
if (this.bizId) {
|
if (this.bizId) {
|
||||||
this.findOne(this.bizId).then(async data => {
|
this.findOne(this.bizId).then(async data => {
|
||||||
@@ -347,17 +357,19 @@ layout("/layouts/platform.html"){
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} 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 = {
|
this.formData = {
|
||||||
userId: id,
|
userId: user.id,
|
||||||
userName: username,
|
userName: user.username,
|
||||||
loginName: loginname,
|
loginName: user.loginname,
|
||||||
professionalTitle: this.$store.state.user.professionalTitle || "",
|
professionalTitle: user.professionalTitle || "",
|
||||||
unitName: unit.name,
|
unitName: unit.name || "",
|
||||||
unitId: unit.id,
|
unitId: unit.id || "",
|
||||||
unionName: union.name,
|
unionName: union.name || "",
|
||||||
unionId: union.id,
|
unionId: union.id || "",
|
||||||
mobile: mobile,
|
mobile: user.mobile,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -365,6 +377,7 @@ layout("/layouts/platform.html"){
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
|
await this.ensureUserLoaded()
|
||||||
this.init()
|
this.init()
|
||||||
this.getEnrollmentRegistrationPlan()
|
this.getEnrollmentRegistrationPlan()
|
||||||
|
|
||||||
|
|||||||
+23
-10
@@ -258,6 +258,16 @@ layout("/layouts/platform_h5.html"){
|
|||||||
this.registrationTypeOption = res.data
|
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() {
|
init() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.childRelationshipOption = this.dict.type.ENROLLMENT_REGISTRATION_CHILD_RELATIONSHIP
|
this.childRelationshipOption = this.dict.type.ENROLLMENT_REGISTRATION_CHILD_RELATIONSHIP
|
||||||
@@ -292,17 +302,19 @@ layout("/layouts/platform_h5.html"){
|
|||||||
|
|
||||||
})
|
})
|
||||||
} else {
|
} 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 = {
|
this.formData = {
|
||||||
userId: id,
|
userId: user.id,
|
||||||
userName: username,
|
userName: user.username,
|
||||||
loginName: loginname,
|
loginName: user.loginname,
|
||||||
professionalTitle: this.$store.state.user.professionalTitle || "",
|
professionalTitle: user.professionalTitle || "",
|
||||||
unitName: unit.name,
|
unitName: unit.name || "",
|
||||||
unitId: unit.id,
|
unitId: unit.id || "",
|
||||||
unionName: union.name,
|
unionName: union.name || "",
|
||||||
unionId: union.id,
|
unionId: union.id || "",
|
||||||
mobile: mobile,
|
mobile: user.mobile,
|
||||||
childrenBirthdayDate: new Date(2000, 0, 1),
|
childrenBirthdayDate: new Date(2000, 0, 1),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,6 +485,7 @@ layout("/layouts/platform_h5.html"){
|
|||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
await this.getEnrollmentRegistrationPlan()
|
await this.getEnrollmentRegistrationPlan()
|
||||||
|
await this.ensureUserLoaded()
|
||||||
this.init()
|
this.init()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user