功能修改:
体检管理->体检项目:详情页控制体检套餐按需保存 新增功能: 体检管理->体检名单: 1、添加删除功能并控制权限(系统管理员、校工会管理员、校工会主席、分工会管理员、分工会主席) 2、导入名单控制权限(系统管理员、校工会管理员、校工会主席)
This commit is contained in:
+89
-65
@@ -18,6 +18,7 @@ import com.budwk.app.base.utils.easyexcel.EasyExcelUtil;
|
|||||||
import com.budwk.app.sys.views.View_user;
|
import com.budwk.app.sys.views.View_user;
|
||||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||||
|
import com.budwk.app.web.commons.base.Globals;
|
||||||
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
|
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
|
||||||
import com.budwk.app.zhgh.dayofficework.healthCheckup.model.*;
|
import com.budwk.app.zhgh.dayofficework.healthCheckup.model.*;
|
||||||
import com.budwk.app.zhgh.dayofficework.healthCheckup.service.HealthCheckupProjectService;
|
import com.budwk.app.zhgh.dayofficework.healthCheckup.service.HealthCheckupProjectService;
|
||||||
@@ -91,6 +92,7 @@ public class HealthCheckupListController {
|
|||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
|
hcu.id AS headId,
|
||||||
hcu.userId AS id,
|
hcu.userId AS id,
|
||||||
hcu.loginName,
|
hcu.loginName,
|
||||||
hcu.userName,
|
hcu.userName,
|
||||||
@@ -210,82 +212,88 @@ public class HealthCheckupListController {
|
|||||||
@At
|
@At
|
||||||
@ApiOperation("体检名单导入名单")
|
@ApiOperation("体检名单导入名单")
|
||||||
@SLog(type = "healthCheckup", tag = "体检管理", msg = "管理员导入了体检名单")
|
@SLog(type = "healthCheckup", tag = "体检管理", msg = "管理员导入了体检名单")
|
||||||
@SaCheckPermission("healthCheckup.list.mange")
|
@SaCheckPermission("healthCheckup.list.import")
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||||
public Result healthImport(TempFile file, String healthProjectId) {
|
public Result healthImport(TempFile file, String healthProjectId) {
|
||||||
// 读取数据
|
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(),
|
||||||
List<T> ts = EasyExcelUtil.syncReadModel(file.getFile(), HealthCheckupImportTemp.class, 0, 1);
|
RoleConstant.SCHOOL_UNION_ADMIN.name(),
|
||||||
List<HealthCheckupImportTemp> healthCheckupImportTemps = JSONUtil.parseArray(JSONUtil.toJsonStr(ts)).toList(HealthCheckupImportTemp.class);
|
RoleConstant.SCHOOL_UNION_CHAIRMAN.name())) {
|
||||||
List<String> loginNames = healthCheckupImportTemps.stream().filter(v -> Strings.isNotBlank(v.getLoginName())).map(v -> v.getLoginName()).collect(Collectors.toList());
|
return Result.error("您没有【导入名单】的权限");
|
||||||
//全部的体检名单
|
} else {
|
||||||
List<HealthCheckupUser> healthCheckupUserList = dao.query(HealthCheckupUser.class, Cnd.where(HealthCheckupUser::getProjectId, "=", healthProjectId));
|
// 读取数据
|
||||||
|
List<T> ts = EasyExcelUtil.syncReadModel(file.getFile(), HealthCheckupImportTemp.class, 0, 1);
|
||||||
|
List<HealthCheckupImportTemp> healthCheckupImportTemps = JSONUtil.parseArray(JSONUtil.toJsonStr(ts)).toList(HealthCheckupImportTemp.class);
|
||||||
|
List<String> loginNames = healthCheckupImportTemps.stream().filter(v -> Strings.isNotBlank(v.getLoginName())).map(v -> v.getLoginName()).collect(Collectors.toList());
|
||||||
|
//全部的体检名单
|
||||||
|
List<HealthCheckupUser> healthCheckupUserList = dao.query(HealthCheckupUser.class, Cnd.where(HealthCheckupUser::getProjectId, "=", healthProjectId));
|
||||||
|
|
||||||
|
|
||||||
List<View_user> userList = dao.query(View_user.class, Cnd.where(View_user::getLoginname, "in", loginNames));
|
List<View_user> userList = dao.query(View_user.class, Cnd.where(View_user::getLoginname, "in", loginNames));
|
||||||
|
|
||||||
HealthCheckupProject checkupProject = dao.fetch(HealthCheckupProject.class, healthProjectId);
|
HealthCheckupProject checkupProject = dao.fetch(HealthCheckupProject.class, healthProjectId);
|
||||||
ActivityUserScope userScope = dao.fetch(ActivityUserScope.class, Cnd.where("groupId", "=", checkupProject.getActivityGroupId()));
|
ActivityUserScope userScope = dao.fetch(ActivityUserScope.class, Cnd.where("groupId", "=", checkupProject.getActivityGroupId()));
|
||||||
List<ActivityUserScope> userScopeList = new ArrayList<>();
|
List<ActivityUserScope> userScopeList = new ArrayList<>();
|
||||||
List<HealthCheckupUser> healthCheckupUsersToAdd = new ArrayList<>();
|
List<HealthCheckupUser> healthCheckupUsersToAdd = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
for (int i = 0; i < healthCheckupImportTemps.size(); i++) {
|
for (int i = 0; i < healthCheckupImportTemps.size(); i++) {
|
||||||
HealthCheckupImportTemp excel = healthCheckupImportTemps.get(i);
|
HealthCheckupImportTemp excel = healthCheckupImportTemps.get(i);
|
||||||
if (StrUtil.isBlank(excel.getLoginName())) {
|
if (StrUtil.isBlank(excel.getLoginName())) {
|
||||||
excel.setErrInfo("工号为空", i + 1);
|
excel.setErrInfo("工号为空", i + 1);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 不能在excel里重复
|
||||||
|
if (healthCheckupImportTemps.stream().filter(s -> s.getLoginName().equals(excel.getLoginName())).count() > 1) {
|
||||||
|
excel.setErrInfo("重复数据", i + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
View_user user = userList.stream().filter(s -> s.getLoginname().equals(excel.getLoginName())).findFirst().orElse(null);
|
||||||
|
if (user == null) {
|
||||||
|
excel.setErrInfo("无此用户", i + 1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (healthCheckupUserList.stream().anyMatch(s -> s.getUserId().equals(user.getId()))) {
|
||||||
|
excel.setErrInfo("该用户已加入体检名单", i + 1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ActivityUserScope s = new ActivityUserScope();
|
||||||
|
s.setGroupId(userScope.getGroupId());
|
||||||
|
s.setGroupName(userScope.getGroupName());
|
||||||
|
s.setUserId(user.getId());
|
||||||
|
s.setCreator(SecurityUtil.getUserId());
|
||||||
|
userScopeList.add(s);
|
||||||
|
|
||||||
|
HealthCheckupUser newHealthUser = new HealthCheckupUser();
|
||||||
|
newHealthUser.setProjectId(healthProjectId);
|
||||||
|
newHealthUser.setUserId(user.getId());
|
||||||
|
newHealthUser.setUserName(user.getUsername());
|
||||||
|
newHealthUser.setSex(user.getSex());
|
||||||
|
newHealthUser.setLoginName(user.getLoginname());
|
||||||
|
newHealthUser.setUnionName(user.getUnionName());
|
||||||
|
newHealthUser.setUnionId(user.getUnionId());
|
||||||
|
newHealthUser.setUnitName(user.getUnitName());
|
||||||
|
newHealthUser.setUnitId(user.getUnitId());
|
||||||
|
healthCheckupUsersToAdd.add(newHealthUser);
|
||||||
|
|
||||||
|
successCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 不能在excel里重复
|
|
||||||
if (healthCheckupImportTemps.stream().filter(s -> s.getLoginName().equals(excel.getLoginName())).count() > 1) {
|
|
||||||
excel.setErrInfo("重复数据", i + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
View_user user = userList.stream().filter(s -> s.getLoginname().equals(excel.getLoginName())).findFirst().orElse(null);
|
dao.insert(userScopeList);
|
||||||
if (user == null) {
|
dao.insert(healthCheckupUsersToAdd);
|
||||||
excel.setErrInfo("无此用户", i + 1);
|
// 创建结果集
|
||||||
continue;
|
ExcelImportRes<HealthCheckupImportTemp> excelImportRes = new ExcelImportRes<>();
|
||||||
}
|
excelImportRes.setTotalRecords(healthCheckupImportTemps.size());
|
||||||
|
// 添加错误记录
|
||||||
|
excelImportRes.setErrorDetails(healthCheckupImportTemps.stream().filter(s -> StrUtil.isNotBlank(s.getErrMsg())).collect(Collectors.toList()));
|
||||||
|
excelImportRes.setFailedCount(excelImportRes.getErrorDetails().size());
|
||||||
|
excelImportRes.setSuccessCount(successCount);
|
||||||
|
|
||||||
if (healthCheckupUserList.stream().anyMatch(s -> s.getUserId().equals(user.getId()))) {
|
return Result.success(excelImportRes);
|
||||||
excel.setErrInfo("该用户已加入体检名单", i + 1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivityUserScope s = new ActivityUserScope();
|
|
||||||
s.setGroupId(userScope.getGroupId());
|
|
||||||
s.setGroupName(userScope.getGroupName());
|
|
||||||
s.setUserId(user.getId());
|
|
||||||
s.setCreator(SecurityUtil.getUserId());
|
|
||||||
userScopeList.add(s);
|
|
||||||
|
|
||||||
HealthCheckupUser newHealthUser = new HealthCheckupUser();
|
|
||||||
newHealthUser.setProjectId(healthProjectId);
|
|
||||||
newHealthUser.setUserId(user.getId());
|
|
||||||
newHealthUser.setUserName(user.getUsername());
|
|
||||||
newHealthUser.setSex(user.getSex());
|
|
||||||
newHealthUser.setLoginName(user.getLoginname());
|
|
||||||
newHealthUser.setUnionName(user.getUnionName());
|
|
||||||
newHealthUser.setUnionId(user.getUnionId());
|
|
||||||
newHealthUser.setUnitName(user.getUnitName());
|
|
||||||
newHealthUser.setUnitId(user.getUnitId());
|
|
||||||
healthCheckupUsersToAdd.add(newHealthUser);
|
|
||||||
|
|
||||||
successCount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dao.insert(userScopeList);
|
|
||||||
dao.insert(healthCheckupUsersToAdd);
|
|
||||||
// 创建结果集
|
|
||||||
ExcelImportRes<HealthCheckupImportTemp> excelImportRes = new ExcelImportRes<>();
|
|
||||||
excelImportRes.setTotalRecords(healthCheckupImportTemps.size());
|
|
||||||
// 添加错误记录
|
|
||||||
excelImportRes.setErrorDetails(healthCheckupImportTemps.stream().filter(s -> StrUtil.isNotBlank(s.getErrMsg())).collect(Collectors.toList()));
|
|
||||||
excelImportRes.setFailedCount(excelImportRes.getErrorDetails().size());
|
|
||||||
excelImportRes.setSuccessCount(successCount);
|
|
||||||
|
|
||||||
return Result.success(excelImportRes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@@ -301,4 +309,20 @@ public class HealthCheckupListController {
|
|||||||
CommonDownloadUtil.download("参加人员导入模版.xlsx", workbook, response);
|
CommonDownloadUtil.download("参加人员导入模版.xlsx", workbook, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@ApiOperation("体检名单删除")
|
||||||
|
@SaCheckPermission("healthCheckup.list.delete")
|
||||||
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
|
public Result doDelete(String id) {
|
||||||
|
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(),
|
||||||
|
RoleConstant.SCHOOL_UNION_ADMIN.name(),
|
||||||
|
RoleConstant.SCHOOL_UNION_CHAIRMAN.name(),
|
||||||
|
RoleConstant.BRANCH_UNION_ADMIN.name(),
|
||||||
|
RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||||
|
return Result.error("您没有【删除】的权限");
|
||||||
|
} else {
|
||||||
|
dao.clear(HealthCheckupUser.class, Cnd.where(HealthCheckupUser::getId, "=", id));
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -62,4 +62,10 @@ public class HealthCheckupProjectSubjectMoney extends BaseModel implements Seria
|
|||||||
@Comment("选项排序")
|
@Comment("选项排序")
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||||
private String sort;
|
private String sort;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("序号")
|
||||||
|
@ColDefine(type = ColType.INT)
|
||||||
|
private Integer serialNumber;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ public class HealthCheckupProjectServiceImpl extends BaseServiceImpl<HealthCheck
|
|||||||
}
|
}
|
||||||
HealthCheckupProject project = fetchLinks(fetch(id), "healthCheckupProjectSubjects", Cnd.NEW().asc("optionSort"));
|
HealthCheckupProject project = fetchLinks(fetch(id), "healthCheckupProjectSubjects", Cnd.NEW().asc("optionSort"));
|
||||||
project.getHealthCheckupProjectSubjects().forEach(v -> {
|
project.getHealthCheckupProjectSubjects().forEach(v -> {
|
||||||
v.setSubjectMoneys(dao().query(HealthCheckupProjectSubjectMoney.class, Cnd.where("subjectId", "=", v.getId())));
|
v.setSubjectMoneys(dao().query(HealthCheckupProjectSubjectMoney.class, Cnd.where("subjectId", "=", v.getId()).asc("serialNumber")));
|
||||||
});
|
});
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -59,7 +59,8 @@ layout("/layouts/platform.html"){
|
|||||||
|
|
||||||
<el-card shadow="never" class="mt10">
|
<el-card shadow="never" class="mt10">
|
||||||
<table-tool label="体检项目">
|
<table-tool label="体检项目">
|
||||||
<el-button type="primary" size="small" @click="openImport">导入名单
|
<el-button type="primary" size="small" @click="openImport"
|
||||||
|
v-if="$auth.hasPermissionOr(['healthCheckup.list.import'])">导入名单
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button :disabled="!pageForm.projectId" type="primary" size="small"
|
<el-button :disabled="!pageForm.projectId" type="primary" size="small"
|
||||||
@click="doAudit(true)">确认名单
|
@click="doAudit(true)">确认名单
|
||||||
@@ -78,7 +79,7 @@ layout("/layouts/platform.html"){
|
|||||||
|
|
||||||
<el-table-column align="center" header-align="center" type="index"
|
<el-table-column align="center" header-align="center" type="index"
|
||||||
:index="indexMethod" label="序号"
|
:index="indexMethod" label="序号"
|
||||||
width="80px"></el-table-column>
|
<!-- width="80px"></el-table-column>-->
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
align="center"
|
||||||
header-align="center"
|
header-align="center"
|
||||||
@@ -106,13 +107,18 @@ layout("/layouts/platform.html"){
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="userOnline" align="center" header-align="center"
|
<el-table-column prop="userOnline" align="center" header-align="center"
|
||||||
label="操作"
|
label="操作" width="160px"
|
||||||
fixed="right">
|
fixed="right">
|
||||||
<template slot-scope="{row}">
|
<template slot-scope="{row}">
|
||||||
<el-button @click="openEditHealthCheckup(row)" size="mini"
|
<el-button @click="openEditHealthCheckup(row)" size="mini"
|
||||||
:disabled="row.isAudit" type="primary">
|
:disabled="row.isAudit" type="primary">
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button @click="doDelete(row.headId)" size="mini"
|
||||||
|
v-if="$auth.hasPermissionOr(['healthCheckup.list.delete'])"
|
||||||
|
:disabled="row.isAudit" type="danger">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -317,7 +323,15 @@ layout("/layouts/platform.html"){
|
|||||||
this.importLoading = false
|
this.importLoading = false
|
||||||
this.doSearch()
|
this.doSearch()
|
||||||
},
|
},
|
||||||
|
async doDelete(id) {
|
||||||
|
const resp = await this.$axios.post(loc() + '/doDelete', {id});
|
||||||
|
if (resp.code === 0) {
|
||||||
|
this.notifySuccess(resp.msg);
|
||||||
|
this.doSearch();
|
||||||
|
} else {
|
||||||
|
this.notifyError(resp.msg);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
this.unions = await this.$businessTool.listUnion()
|
this.unions = await this.$businessTool.listUnion()
|
||||||
|
|||||||
+19
-3
@@ -1,8 +1,6 @@
|
|||||||
<!--#
|
<!--#
|
||||||
layout("/layouts/platform.html"){
|
layout("/layouts/platform.html"){
|
||||||
#-->
|
#-->
|
||||||
|
|
||||||
|
|
||||||
<div id="app" class="platform" v-cloak>
|
<div id="app" class="platform" v-cloak>
|
||||||
<guava ref="guava" padding="0 5%">
|
<guava ref="guava" padding="0 5%">
|
||||||
<template>
|
<template>
|
||||||
@@ -196,6 +194,17 @@ layout("/layouts/platform.html"){
|
|||||||
|
|
||||||
<div class="s-options-list" style="margin-top: 10px;">
|
<div class="s-options-list" style="margin-top: 10px;">
|
||||||
<el-table :data="item.subjectMoneys" border size="small">
|
<el-table :data="item.subjectMoneys" border size="small">
|
||||||
|
<el-table-column label="序号" width="100px">
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<el-input v-model="row.serialNumber"
|
||||||
|
:value="row.serialNumber"
|
||||||
|
autosize
|
||||||
|
class="text-input"
|
||||||
|
data-type="option"
|
||||||
|
readonly
|
||||||
|
></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="名称">
|
<el-table-column label="名称">
|
||||||
<template slot-scope="{row}">
|
<template slot-scope="{row}">
|
||||||
<el-input v-model="row.subjectMoneyName" autosize
|
<el-input v-model="row.subjectMoneyName" autosize
|
||||||
@@ -225,6 +234,7 @@ layout("/layouts/platform.html"){
|
|||||||
<template slot-scope="{row,$index}" slot="header">
|
<template slot-scope="{row,$index}" slot="header">
|
||||||
<el-button size="mini" type="primary"
|
<el-button size="mini" type="primary"
|
||||||
@click="item.subjectMoneys.push({
|
@click="item.subjectMoneys.push({
|
||||||
|
serialNumber: item.subjectMoneys.length + 1,
|
||||||
money:'',
|
money:'',
|
||||||
settlementMoney:'',
|
settlementMoney:'',
|
||||||
subjectMoneyName:'',
|
subjectMoneyName:'',
|
||||||
@@ -593,7 +603,14 @@ layout("/layouts/platform.html"){
|
|||||||
deleteRow(row, index, subjectMoneyIndex) {
|
deleteRow(row, index, subjectMoneyIndex) {
|
||||||
this.formData.healthCheckupProjectSubjects[subjectMoneyIndex].subjectMoneys.splice(index, 1)
|
this.formData.healthCheckupProjectSubjects[subjectMoneyIndex].subjectMoneys.splice(index, 1)
|
||||||
if (row.id) this.deleteRowIds.push(row.id)
|
if (row.id) this.deleteRowIds.push(row.id)
|
||||||
|
this.reloadSubjectMoneySerialNumber(this.formData.healthCheckupProjectSubjects[subjectMoneyIndex].subjectMoneys);
|
||||||
},
|
},
|
||||||
|
reloadSubjectMoneySerialNumber(rowDetail){
|
||||||
|
//重新加载体检套餐序号
|
||||||
|
for (let i = 0; i < rowDetail.length; i++) {
|
||||||
|
rowDetail[i].serialNumber = i + 1;
|
||||||
|
}
|
||||||
|
},
|
||||||
async doDelete(id) {
|
async doDelete(id) {
|
||||||
const confirm = await this.$confirm('确定要删除该项目吗?', '提示', {type: 'warning'})
|
const confirm = await this.$confirm('确定要删除该项目吗?', '提示', {type: 'warning'})
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
@@ -697,7 +714,6 @@ layout("/layouts/platform.html"){
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<!--#
|
<!--#
|
||||||
}
|
}
|
||||||
#-->
|
#-->
|
||||||
|
|||||||
Reference in New Issue
Block a user