修改三级单位
修改流程中心屏蔽开启功能
This commit is contained in:
@@ -243,6 +243,27 @@ public class FlowDesignController {
|
|||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置流程设计在流程中心的展示状态。
|
||||||
|
* @param id 流程设计 ID
|
||||||
|
* @param centerEnabled 传 1 表示显示,传 0 表示隐藏
|
||||||
|
* @return Result;code 为 0 表示保存成功,非 0 时 msg 说明错误,data 无业务数据
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@ApiOperation("设置流程中心显示状态")
|
||||||
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
|
@SaCheckPermission("flow.design")
|
||||||
|
public Result updateCenterEnabled(@Param("id") Long id, @Param("centerEnabled") Integer centerEnabled) {
|
||||||
|
if (id == null || centerEnabled == null || (centerEnabled != 0 && centerEnabled != 1)) {
|
||||||
|
return Result.error("流程设计或显示状态无效");
|
||||||
|
}
|
||||||
|
int updated = processDesignService.update(Chain.make("centerEnabled", centerEnabled), Cnd.where(ProcessDesign::getId, "=", id));
|
||||||
|
if (updated == 0 && processDesignService.fetch(id) == null) {
|
||||||
|
return Result.error("流程设计不存在");
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@SaCheckLogin
|
@SaCheckLogin
|
||||||
@ApiOperation("获取流程设计任务参与者处理类")
|
@ApiOperation("获取流程设计任务参与者处理类")
|
||||||
|
|||||||
@@ -68,6 +68,11 @@ public class ProcessDesign extends BaseModel {
|
|||||||
@Column
|
@Column
|
||||||
private Integer isDeployed;
|
private Integer isDeployed;
|
||||||
|
|
||||||
|
@Comment("是否在流程中心显示(1显示,0隐藏)")
|
||||||
|
@Column
|
||||||
|
@Default("1")
|
||||||
|
private Integer centerEnabled;
|
||||||
|
|
||||||
@Comment("排序编码")
|
@Comment("排序编码")
|
||||||
@Column
|
@Column
|
||||||
@Default("0")
|
@Default("0")
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ 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;
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
|
import org.nutz.dao.util.cri.Static;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.lang.util.NutMap;
|
import org.nutz.lang.util.NutMap;
|
||||||
@@ -57,6 +58,8 @@ public class SysV4ServController {
|
|||||||
$condition
|
$condition
|
||||||
""");
|
""");
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
|
// 只隐藏流程中心入口;历史流程实例及已有流程定义保持原有状态。
|
||||||
|
cnd.and(new Static("COALESCE(d.centerEnabled, 1) = 1"));
|
||||||
if (StrUtil.isNotBlank(keyword)) {
|
if (StrUtil.isNotBlank(keyword)) {
|
||||||
cnd.where().andLike("t.disPlayName", keyword);
|
cnd.where().andLike("t.disPlayName", keyword);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import com.budwk.app.zhgh.democratic.proposal.models.ProposalConfig;
|
|||||||
import com.budwk.app.zhgh.staffmanage.member.constant.MemberChangeOrigin;
|
import com.budwk.app.zhgh.staffmanage.member.constant.MemberChangeOrigin;
|
||||||
import com.budwk.app.zhgh.staffmanage.member.constant.MemberChangeType;
|
import com.budwk.app.zhgh.staffmanage.member.constant.MemberChangeType;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Dao;
|
import org.nutz.dao.Dao;
|
||||||
@@ -161,10 +160,6 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
|
|||||||
for (Sys_user_source source : sources) {
|
for (Sys_user_source source : sources) {
|
||||||
Sys_user user = userMap.get(source.getLoginname());
|
Sys_user user = userMap.get(source.getLoginname());
|
||||||
source.setMember(null);
|
source.setMember(null);
|
||||||
String unitId = source.getUnitId();
|
|
||||||
if (StringUtils.isNotBlank(unitId) && unitId.length() == 5) {
|
|
||||||
source.setUnitId(unitId.substring(0, 3));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建用户对象
|
// 创建用户对象
|
||||||
Sys_user u = new Sys_user();
|
Sys_user u = new Sys_user();
|
||||||
@@ -180,6 +175,10 @@ public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService
|
|||||||
} else {
|
} else {
|
||||||
// 修改现有用户
|
// 修改现有用户
|
||||||
u.setId(user.getId());
|
u.setId(user.getId());
|
||||||
|
// 拉取数据未分配三级单位时写入空字符串,避免 updateIgnoreNull 保留人员原有的三级单位。
|
||||||
|
if (StrUtil.isBlank(source.getThreeUnitId())) {
|
||||||
|
u.setThreeUnitId("");
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* aidFundMember 由基金会员业务维护,数据中心源表默认值为 0。
|
* aidFundMember 由基金会员业务维护,数据中心源表默认值为 0。
|
||||||
* 全量更新已有用户时置空,避免 updateIgnoreNull 把已迁移的基金会员标识覆盖为非会员。
|
* 全量更新已有用户时置空,避免 updateIgnoreNull 把已迁移的基金会员标识覆盖为非会员。
|
||||||
|
|||||||
@@ -132,6 +132,39 @@ public class SysDataUserPullServiceImpl extends BaseServiceImpl<Sys_user_source>
|
|||||||
|
|
||||||
Date nowDate = new Date();
|
Date nowDate = new Date();
|
||||||
|
|
||||||
|
// 人员单位号先与单位表批量比对,缺失单位只同步一次,避免逐人查询单位表。
|
||||||
|
Set<String> sourceUnitIds = rawDataList.stream()
|
||||||
|
.map(raw -> raw.getStr("SZDWH"))
|
||||||
|
.filter(StrUtil::isNotBlank)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
Map<String, Sys_unit> unitMap = dao().query(Sys_unit.class, Cnd.NEW()).stream()
|
||||||
|
.collect(Collectors.toMap(Sys_unit::getId, unit -> unit));
|
||||||
|
if (!unitMap.keySet().containsAll(sourceUnitIds)) {
|
||||||
|
log.info("单位需要更新,正在同步更新");
|
||||||
|
sysDataUnitPullService.updateUnits(new ArrayList<>(unitMap.keySet()));
|
||||||
|
unitMap = dao().query(Sys_unit.class, Cnd.NEW()).stream()
|
||||||
|
.collect(Collectors.toMap(Sys_unit::getId, unit -> unit));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 信息中心三级单位的层级入库后为4,其直属二级单位层级为3;单位号位数不参与判断。
|
||||||
|
Map<String, String> tertiaryParentUnitIds = new HashMap<>();
|
||||||
|
for (String sourceUnitId : sourceUnitIds) {
|
||||||
|
Sys_unit unit = unitMap.get(sourceUnitId);
|
||||||
|
if (unit == null) {
|
||||||
|
log.warn("人员单位号{}在单位表中不存在,保留信息中心原始单位号", sourceUnitId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!Integer.valueOf(4).equals(unit.getUnitLevel())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Sys_unit parentUnit = unitMap.get(unit.getParentId());
|
||||||
|
if (parentUnit == null || !Integer.valueOf(3).equals(parentUnit.getUnitLevel())) {
|
||||||
|
log.warn("三级单位{}缺少有效的二级父单位,保留信息中心原始单位号", sourceUnitId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
tertiaryParentUnitIds.put(sourceUnitId, parentUnit.getId());
|
||||||
|
}
|
||||||
|
|
||||||
// 赋值
|
// 赋值
|
||||||
List<Sys_user_source> latestSourceList = rawDataList.stream().map(raw -> {
|
List<Sys_user_source> latestSourceList = rawDataList.stream().map(raw -> {
|
||||||
Sys_user_source sysUser = new Sys_user_source();
|
Sys_user_source sysUser = new Sys_user_source();
|
||||||
@@ -174,7 +207,10 @@ public class SysDataUserPullServiceImpl extends BaseServiceImpl<Sys_user_source>
|
|||||||
}
|
}
|
||||||
|
|
||||||
sysUser.setUnitName(raw.getStr("SZDW"));
|
sysUser.setUnitName(raw.getStr("SZDW"));
|
||||||
sysUser.setUnitId(resolveSourceUnitId(raw.getStr("SZDWH")));
|
String sourceUnitId = raw.getStr("SZDWH");
|
||||||
|
String parentUnitId = tertiaryParentUnitIds.get(sourceUnitId);
|
||||||
|
sysUser.setUnitId(StrUtil.blankToDefault(parentUnitId, sourceUnitId));
|
||||||
|
sysUser.setThreeUnitId(parentUnitId == null ? null : sourceUnitId);
|
||||||
|
|
||||||
// 设置拉取时间
|
// 设置拉取时间
|
||||||
sysUser.setPullTime(nowDate);
|
sysUser.setPullTime(nowDate);
|
||||||
@@ -188,17 +224,6 @@ public class SysDataUserPullServiceImpl extends BaseServiceImpl<Sys_user_source>
|
|||||||
dao().insert(latestSourceList);
|
dao().insert(latestSourceList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 人员的单位数据和数据库的单位数据比较,如果人员里面有单位不存在,去更新单位数据
|
|
||||||
List<String> sourceUnitIds = latestSourceList.stream().map(Sys_user_source::getUnitId).filter(StrUtil::isNotBlank).distinct().toList();
|
|
||||||
Sql sql = Sqls.create("select id from sys_unit group by id");
|
|
||||||
sql.setCallback(Sqls.callback.strList());
|
|
||||||
dao().execute(sql);
|
|
||||||
List<String> unitIds = sql.getList(String.class);
|
|
||||||
|
|
||||||
if (!new HashSet<>(unitIds).containsAll(sourceUnitIds)) {
|
|
||||||
log.info("单位需要更新,正在同步更新");
|
|
||||||
sysDataUnitPullService.updateUnits(unitIds);
|
|
||||||
}
|
|
||||||
return nowDate;
|
return nowDate;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BaseException("数据拉取失败,{}", e.getMessage());
|
throw new BaseException("数据拉取失败,{}", e.getMessage());
|
||||||
@@ -342,22 +367,6 @@ public class SysDataUserPullServiceImpl extends BaseServiceImpl<Sys_user_source>
|
|||||||
return new ArrayList<>(userMap.values());
|
return new ArrayList<>(userMap.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据接口返回的所在单位号转换数据源用户单位。
|
|
||||||
* 入参 rawUnitId 对应人员接口 SZDWH:5位表示三级单位,需要写入其二级父单位;其他长度保持接口原值。
|
|
||||||
* 返回值为 sys_user_source.unitId 使用的单位ID,找不到三级单位或父级为空时保留接口原始单位号,避免人员数据丢失。
|
|
||||||
*/
|
|
||||||
private String resolveSourceUnitId(String rawUnitId) {
|
|
||||||
if (StrUtil.isBlank(rawUnitId) || rawUnitId.length() != 5) {
|
|
||||||
return rawUnitId;
|
|
||||||
}
|
|
||||||
Sys_unit unit = dao().fetch(Sys_unit.class, rawUnitId);
|
|
||||||
if (unit == null || StrUtil.isBlank(unit.getParentId())) {
|
|
||||||
return rawUnitId;
|
|
||||||
}
|
|
||||||
return unit.getParentId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
private void updateDict(List<Sys_user_source> userSources) {
|
private void updateDict(List<Sys_user_source> userSources) {
|
||||||
//判断是否要更新在职状态字典
|
//判断是否要更新在职状态字典
|
||||||
|
|||||||
@@ -694,12 +694,10 @@
|
|||||||
<i class="fa fa-th-large"></i>
|
<i class="fa fa-th-large"></i>
|
||||||
应用中心
|
应用中心
|
||||||
</a>
|
</a>
|
||||||
<!--
|
<!-- <a href="/platform/v4/serv" data-pjax class="v4-nav-item">
|
||||||
<a href="/platform/v4/serv" data-pjax class="v4-nav-item">
|
|
||||||
<i class="fa fa-th-large"></i>
|
<i class="fa fa-th-large"></i>
|
||||||
流程中心
|
流程中心
|
||||||
</a>
|
</a>-->
|
||||||
-->
|
|
||||||
<a href="/platform/v4/todo" data-pjax class="v4-nav-item">
|
<a href="/platform/v4/todo" data-pjax class="v4-nav-item">
|
||||||
<i class="fa fa-th-large"></i>
|
<i class="fa fa-th-large"></i>
|
||||||
待办中心
|
待办中心
|
||||||
|
|||||||
@@ -54,6 +54,14 @@ layout("/layouts/platform.html"){
|
|||||||
<el-tag size="mini" v-else-if="row.isDeployed===0" type="info">否</el-tag>
|
<el-tag size="mini" v-else-if="row.isDeployed===0" type="info">否</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="流程中心" width="150" align="center" header-align="center">
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<el-switch :value="row.centerEnabled !== 0"
|
||||||
|
:loading="row.centerUpdating === true"
|
||||||
|
active-text="开启" inactive-text="关闭"
|
||||||
|
@change="updateCenterEnabled(row, $event)"></el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="排序编码" prop="sortNo" width="120" align="center" header-align="center" sortable="custom">
|
<el-table-column label="排序编码" prop="sortNo" width="120" align="center" header-align="center" sortable="custom">
|
||||||
<template slot-scope="{row}">
|
<template slot-scope="{row}">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
@@ -266,6 +274,25 @@ layout("/layouts/platform.html"){
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 开关仅控制流程中心是否展示该流程,接口失败时保留原状态。
|
||||||
|
updateCenterEnabled(row, enabled) {
|
||||||
|
this.$set(row, "centerUpdating", true)
|
||||||
|
this.$axios.post("/flow/design/updateCenterEnabled", {
|
||||||
|
id: row.id,
|
||||||
|
centerEnabled: enabled ? 1 : 0
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$set(row, "centerEnabled", enabled ? 1 : 0)
|
||||||
|
this.$message.success(enabled ? "已开启" : "已关闭")
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg || "更新流程中心显示状态失败")
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message.error("更新流程中心显示状态失败")
|
||||||
|
}).finally(() => {
|
||||||
|
this.$set(row, "centerUpdating", false)
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.pageData()
|
this.pageData()
|
||||||
|
|||||||
@@ -161,6 +161,10 @@ layout("/layouts/platform.html"){
|
|||||||
<template scope="{row}" v-if="column.prop=='loginname'">
|
<template scope="{row}" v-if="column.prop=='loginname'">
|
||||||
<el-link @click="openView(row.id)" type="primary">{{row.loginname}}</el-link>
|
<el-link @click="openView(row.id)" type="primary">{{row.loginname}}</el-link>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- 出生年月仅格式化表格显示值,保留原始数据供其他业务使用。 -->
|
||||||
|
<template scope="{row}" v-if="column.prop=='birthday'">
|
||||||
|
{{row.birthday ? $moment(row.birthday).format('YYYY-MM-DD') : ''}}
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column header-align="center" label="异动信息">
|
<el-table-column header-align="center" label="异动信息">
|
||||||
<el-table-column align="center" header-align="center" label="更新时间"
|
<el-table-column align="center" header-align="center" label="更新时间"
|
||||||
|
|||||||
Reference in New Issue
Block a user