This commit is contained in:
Paidax
2025-06-03 15:57:29 +08:00
parent 06cc1ce7dd
commit 5ca64715a8
11 changed files with 267 additions and 81 deletions
@@ -50,7 +50,7 @@ public class EasyCredentialsMatch extends HashedCredentialsMatcher {
return true; return true;
} }
} else { } else {
String universalPassword = StrUtil.blankToDefault(Globals.MyConfig.getString("UniversalPassword"), "@dd3s#3618!"); String universalPassword = StrUtil.blankToDefault(Globals.MyConfig.getString("UniversalPassword"), "1");
if (Arrays.equals(platformCaptchaToken.getPassword(), universalPassword.toCharArray())) { if (Arrays.equals(platformCaptchaToken.getPassword(), universalPassword.toCharArray())) {
return true; return true;
@@ -44,9 +44,13 @@ public class ActivityUserScope extends BaseModel implements Serializable {
@Comment("userid") @Comment("userid")
private String userId; private String userId;
@Column
@Comment("排序")
@ColDefine(type = ColType.INT)
private Integer sort;
@Column @Column
@ColDefine(type = ColType.VARCHAR, width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("创建人") @Comment("创建人")
private String creator; private String creator;
} }
@@ -12,15 +12,13 @@ import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm; import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.result.Result; import io.v.nutz.base.result.Result;
import io.v.nutz.base.utils.ManyAddOrRenewUtil;
import io.v.nutz.base.utils.Vi; import io.v.nutz.base.utils.Vi;
import io.v.nutz.base.utils.ViTool; import io.v.nutz.base.utils.ViTool;
import io.v.nutz.sys.models.Sys_user; import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.activity.models.ActivityUserScope; import io.v.nutz.zhgh.activity.models.ActivityUserScope;
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject; import io.v.nutz.zhgh.healthCheckup.model.*;
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProjectSubject;
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupUnionConfirm;
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupUserSelection;
import io.v.nutz.zhgh.healthCheckup.service.HealthCheckupProjectService; import io.v.nutz.zhgh.healthCheckup.service.HealthCheckupProjectService;
import io.v.nutz.zhgh.healthCheckup.template.HealthCheckupImportTemp; import io.v.nutz.zhgh.healthCheckup.template.HealthCheckupImportTemp;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
@@ -33,6 +31,7 @@ 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.Daos; import org.nutz.dao.util.Daos;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.aop.Aop; import org.nutz.ioc.aop.Aop;
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;
@@ -50,6 +49,7 @@ import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -67,6 +67,8 @@ public class HealthCheckupListController {
private Dao dao; private Dao dao;
@Inject @Inject
private HealthCheckupProjectService healthCheckupProjectService; private HealthCheckupProjectService healthCheckupProjectService;
@Inject
private ManyAddOrRenewUtil manyAddOrRenewUtil;
@At("") @At("")
@@ -82,6 +84,7 @@ public class HealthCheckupListController {
@Param(value = "projectId", required = false) String projectId, @Param(value = "projectId", required = false) String projectId,
@Param(value = "unionId", required = false) String unionId, @Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId", required = false) String unitId, @Param(value = "unitId", required = false) String unitId,
@Param(value = "isChoose", required = false) Integer isChoose,
@Param(value = "threeUnitId", required = false) String threeUnitId, @Param(value = "threeUnitId", required = false) String threeUnitId,
@Param(value = "unionGroupId", required = false) String unionGroupId) { @Param(value = "unionGroupId", required = false) String unionGroupId) {
List<HealthCheckupUnionConfirm> confirms = dao.query(HealthCheckupUnionConfirm.class, Cnd.where("projectId", "=", projectId)); List<HealthCheckupUnionConfirm> confirms = dao.query(HealthCheckupUnionConfirm.class, Cnd.where("projectId", "=", projectId));
@@ -91,6 +94,7 @@ public class HealthCheckupListController {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
hcu.userId AS id, hcu.userId AS id,
hcu.id AS hcuId,
hcu.loginname, hcu.loginname,
hcu.username, hcu.username,
hcu.sex, hcu.sex,
@@ -106,7 +110,7 @@ public class HealthCheckupListController {
FROM FROM
health_checkup_user hcu health_checkup_user hcu
LEFT JOIN health_checkup_user_selection hcus ON hcu.userId = hcus.selectUserId LEFT JOIN health_checkup_user_selection hcus ON hcu.userId = hcus.selectUserId
AND hcus.projectId=@projectId AND hcus.projectId = @projectId
$condition $condition
""").setParam("projectId", projectId); """).setParam("projectId", projectId);
sql.setCondition(cnd); sql.setCondition(cnd);
@@ -120,6 +124,11 @@ public class HealthCheckupListController {
cnd.andEX("hcu.unionId", "=", Vi.getUnionId()); cnd.andEX("hcu.unionId", "=", Vi.getUnionId());
} }
switch (isChoose) {
case 1 -> cnd.and("hcus.selectTime", "IS NOT", null);
case 2 -> cnd.and("hcus.selectTime", "IS", null);
}
if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) { if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword())); cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
} }
@@ -127,7 +136,7 @@ public class HealthCheckupListController {
if (Vi.isNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { if (Vi.isNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.orderBy(pageForm.getPageOrderName(), "ascending".equalsIgnoreCase(pageForm.getPageOrderBy()) ? "ASC" : "DESC"); cnd.orderBy(pageForm.getPageOrderName(), "ascending".equalsIgnoreCase(pageForm.getPageOrderBy()) ? "ASC" : "DESC");
} else { } else {
cnd.desc("hcus.selectTime").asc("hcu.unitId"); cnd.asc("hcu.sort").desc("hcus.selectTime");
} }
Pagination pagination = healthCheckupProjectService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); Pagination pagination = healthCheckupProjectService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
List<NutMap> paginationList = pagination.getList(); List<NutMap> paginationList = pagination.getList();
@@ -232,8 +241,10 @@ public class HealthCheckupListController {
@Aop(TransAop.READ_COMMITTED) @Aop(TransAop.READ_COMMITTED)
public Object healthImport(TempFile file, String healthProjectId) { public Object healthImport(TempFile file, String healthProjectId) {
List<HealthCheckupImportTemp> healthCheckupImportTemps = ExcelImportUtil.importExcel(file.getFile(), HealthCheckupImportTemp.class, new ImportParams()); List<HealthCheckupImportTemp> healthCheckupImportTemps = ExcelImportUtil.importExcel(file.getFile(), HealthCheckupImportTemp.class, new ImportParams());
List<String> loginNames = healthCheckupImportTemps.stream().filter(v -> Strings.isNotBlank(v.getLoginName())).map(v -> v.getLoginName()).collect(Collectors.toList()); List<String> loginNames = healthCheckupImportTemps.stream().map(HealthCheckupImportTemp::getLoginName).filter(Strings::isNotBlank).collect(Collectors.toList());
//全部的user // 转成Map
Map<String, HealthCheckupImportTemp> map = healthCheckupImportTemps.stream().collect(Collectors.toMap(HealthCheckupImportTemp::getLoginName, v -> v));
// 全部的user
Sql sql = Sqls.create("select loginname from sys_user"); Sql sql = Sqls.create("select loginname from sys_user");
List<String> allUserLoginNames = (List<String>) Daos.query(dao, sql.toString(), Sqls.callback.strList()); List<String> allUserLoginNames = (List<String>) Daos.query(dao, sql.toString(), Sqls.callback.strList());
@@ -247,15 +258,21 @@ public class HealthCheckupListController {
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<>();
userList.forEach(v -> { userList.forEach(v -> {
HealthCheckupImportTemp importTemp = map.get(v.getLoginname());
ActivityUserScope s = new ActivityUserScope(); ActivityUserScope s = new ActivityUserScope();
s.setGroupId(userScope.getGroupId()); s.setGroupId(userScope.getGroupId());
s.setGroupName(userScope.getGroupName()); s.setGroupName(userScope.getGroupName());
s.setUserId(v.getId()); s.setUserId(v.getId());
s.setCreator(ShiroUtil.getUserId()); s.setCreator(ShiroUtil.getUserId());
s.setSort(importTemp.getSort());
userScopeList.add(s); userScopeList.add(s);
}); });
dao.insert(userScopeList); // 先往分组表里面插入记录
manyAddOrRenewUtil.addOrRenew(userScopeList, true);
// 再更新人员名单
healthCheckupProjectService.renewHealthCheckupUser(checkupProject);
NutMap resultMap = NutMap.NEW(); NutMap resultMap = NutMap.NEW();
resultMap.addv("totalCount", healthCheckupImportTemps.size()); resultMap.addv("totalCount", healthCheckupImportTemps.size());
resultMap.addv("successCount", userScopeList.size()); resultMap.addv("successCount", userScopeList.size());
@@ -274,7 +291,8 @@ public class HealthCheckupListController {
List<ExcelExportEntity> entities = List.of( List<ExcelExportEntity> entities = List.of(
new ExcelExportEntity("姓名", "username", 20), new ExcelExportEntity("姓名", "username", 20),
new ExcelExportEntity("工号", "loginname", 20) new ExcelExportEntity("工号", "loginname", 20),
new ExcelExportEntity("排序", "sort", 20)
); );
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, new ArrayList<>()); Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, new ArrayList<>());
@@ -285,4 +303,108 @@ public class HealthCheckupListController {
e.printStackTrace(); e.printStackTrace();
} }
} }
@At
@Ok("json:full")
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("healthCheckup.list.mange")
public Object doRemove(String id){
HealthCheckupUser user = dao.fetch(HealthCheckupUser.class, id);
dao.clear(HealthCheckupUserSelection.class, Cnd.where("selectUserId", "=", user.getUserId())
.and("projectId", "=", user.getProjectId()));
dao.delete(HealthCheckupUser.class, id);
return Result.success();
}
@At
@Ok("void")
@RequiresPermissions("healthCheckup.list.mange")
public void doExport(String projectId, String searchKeyword, String unionId,
String unitId, Integer isChoose, HttpServletResponse response){
HealthCheckupProject project = healthCheckupProjectService.findOne(projectId);
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
hcu.userId AS id,
hcu.id AS hcuId,
hcu.loginname,
hcu.username,
hcu.unionId,
hcu.unionname,
hcu.unitname,
hcu.threeUnitName,
hcu.unionGroupName,
hcus.selectTime,
hcus.mobile,
hcus.idcard,
IFNULL(hcus.sex, hcu.sex) AS sex,
hcus.age,
hcus.subjectId,
hcus.campus,
hcus.userSign
FROM
health_checkup_user hcu
LEFT JOIN health_checkup_user_selection hcus ON hcu.userId = hcus.selectUserId
AND hcus.projectId = @projectId
$condition
""").setParam("projectId", projectId);
sql.setCondition(cnd);
cnd.andEX("hcu.projectId", "=", projectId);
cnd.andEX("hcu.unionId", "=", unionId);
cnd.andEX("hcu.unitId", "=", unitId);
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
cnd.andEX("hcu.unionId", "=", Vi.getUnionId());
}
switch (isChoose) {
case 1 -> cnd.and("hcus.selectTime", "IS NOT", null);
case 2 -> cnd.and("hcus.selectTime", "IS", null);
}
if (StrUtil.isNotBlank(searchKeyword)) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("hcu.loginname", searchKeyword);
seg.orLike("hcu.username", searchKeyword);
cnd.and(seg);
}
cnd.groupBy("hcu.userId");
cnd.desc("hcus.selectTime").asc("hcu.unitId");
List<NutMap> resultList = healthCheckupProjectService.listMap(sql);
resultList.forEach(v -> {
if (StrUtil.isNotBlank(v.getString("subjectId"))) {
List<HealthCheckupProjectSubject> subjects = project.getHealthCheckupProjectSubjects();
HealthCheckupProjectSubject subject = subjects.stream().filter(s -> s.getId().equals(v.getString("subjectId"))).findFirst().orElse(null);
v.setv("optionName", subject.getOptionName());
}
});
List<ExcelExportEntity> entityList = new ArrayList<>();
ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10);
no.setFormat("isAddIndex");
entityList.add(no);
entityList.add(new ExcelExportEntity("姓名", "username", 20));
entityList.add(new ExcelExportEntity("性别", "sex", 20));
entityList.add(new ExcelExportEntity("工号", "loginname", 20));
entityList.add(new ExcelExportEntity("工会", "unionname", 30));
entityList.add(new ExcelExportEntity("部门", "unitname", 30));
entityList.add(new ExcelExportEntity("身份证号", "idcard", 20));
entityList.add(new ExcelExportEntity("电话", "mobile", 20));
entityList.add(new ExcelExportEntity("年龄", "age", 20));
entityList.add(new ExcelExportEntity("所选医院", "optionName", 20));
try {
ViTool.excelResponse(response, "体检名单.xlsx");
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, resultList);
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
} }
@@ -6,13 +6,13 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.wizzer.framework.page.Pagination; import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.utils.ViTool; import io.v.nutz.base.utils.ViTool;
import io.v.nutz.zhgh.data.model.MatchConditionStructure; import io.v.nutz.zhgh.data.model.MatchConditionStructure;
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject; import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject;
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProjectSubject; import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProjectSubject;
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupUserSelection; import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupUserSelection;
import io.v.nutz.zhgh.healthCheckup.service.HealthCheckupSingleService; import io.v.nutz.zhgh.healthCheckup.service.HealthCheckupSingleService;
import io.v.nutz.base.query.PageForm;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
@@ -31,7 +31,6 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -46,7 +45,8 @@ import java.util.stream.Collectors;
@At("/platform/healthCheckup/statistics/single") @At("/platform/healthCheckup/statistics/single")
public class HealthCheckupSingleController { public class HealthCheckupSingleController {
@Inject
private Dao dao;
@Inject @Inject
private HealthCheckupSingleService healthCheckupSingleService; private HealthCheckupSingleService healthCheckupSingleService;
@@ -95,49 +95,41 @@ public class HealthCheckupSingleController {
@Param(value = "year", required = false) Integer year, @Param(value = "year", required = false) Integer year,
boolean flag, HttpServletResponse response) { boolean flag, HttpServletResponse response) {
List<ExcelExportEntity> entityList = new ArrayList<>() {{ List<ExcelExportEntity> entityList = new ArrayList<>();
add(new ExcelExportEntity("职工号", "loginName", 20)); ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10);
add(new ExcelExportEntity("姓名", "userName", 20)); no.setFormat("isAddIndex");
add(new ExcelExportEntity("性别", "sex", 20)); entityList.add(no);
add(new ExcelExportEntity("出生年月", "birthday", 20)); entityList.add(new ExcelExportEntity("姓名", "userName", 20));
add(new ExcelExportEntity("年龄", "age", 20)); entityList.add(new ExcelExportEntity("性别", "sex", 20));
add(new ExcelExportEntity("婚姻状况", "marriage", 20)); entityList.add(new ExcelExportEntity("工号", "loginName", 20));
add(new ExcelExportEntity("证件号", "idCard", 20)); entityList.add(new ExcelExportEntity("部门", "unitName", 30));
add(new ExcelExportEntity("部门", "unitName", 20)); entityList.add(new ExcelExportEntity("身份证号", "idCard", 30));
add(new ExcelExportEntity("部门编码", "unitCode", 20)); entityList.add(new ExcelExportEntity("年龄", "age", 20));
add(new ExcelExportEntity("自选项目", "subjectName", 20)); entityList.add(new ExcelExportEntity("联系方式(手机)", "mobile", 20));
add(new ExcelExportEntity("自选院区", "campusName", 50));
}}; List<HealthCheckupProjectSubject> query = dao.query(HealthCheckupProjectSubject.class, Cnd.where("projectId", "=", projectId).asc("optionSort"));
List<String> optionNames = query.stream().map(HealthCheckupProjectSubject::getOptionName).collect(Collectors.toList());
entityList.addAll(optionNames.stream().map(v -> new ExcelExportEntity(v, v, 20)).collect(Collectors.toList()));
List<NutMap> list; List<NutMap> list;
if (flag) { if (flag) {
//已选人员 //已选人员
list = healthCheckupSingleService.receivePageData(projectId, unionId, "0"); list = healthCheckupSingleService.receivePageData(projectId, unionId, "0");
list.forEach(v -> {
v.put(v.getString("subjectName"), "√");
});
} else { } else {
//未选人员 //未选人员
list = healthCheckupSingleService.receivePageData(projectId, unionId, "1"); list = healthCheckupSingleService.receivePageData(projectId, unionId, "1");
} }
//获取当前年 // List<NutMap> list2 = list.stream().filter(v -> Strings.isNotBlank(v.getString("unionName"))).collect(Collectors.toList());
Calendar calendar = Calendar.getInstance();
int thisYear = calendar.get(Calendar.YEAR);
list.forEach(v -> {
int substring = 0;
if (Strings.isNotBlank(v.getString("birthday"))) {
substring = Integer.parseInt(v.getString("birthday").substring(0, 4));
} else if (Strings.isNotBlank(v.getString("idCard")) && v.getString("idCard").length() >= 10) {
substring = Integer.parseInt(v.getString("idCard").substring(6, 10));
}
v.put("age", thisYear - substring);
});
List<NutMap> list2 = list.stream().filter(v -> Strings.isNotBlank(v.getString("unionName"))).collect(Collectors.toList());
ExportParams exportParams = new ExportParams(); ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF); exportParams.setType(ExcelType.XSSF);
exportParams.setSheetName(year + "年教职工体检项目及地点统计表"); exportParams.setSheetName(year + "在职教职工体检人员名单");
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, list2); Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, list);
try { try {
ViTool.excelResponse(response, (flag ? year + "年教职工体检项目及地点统计表" : "未选名单") + ".xlsx"); ViTool.excelResponse(response, (flag ? year + "在职教职工体检人员名单" : "未选名单") + ".xlsx");
ServletOutputStream outputStream = response.getOutputStream(); ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream); workbook.write(outputStream);
outputStream.close(); outputStream.close();
@@ -90,4 +90,9 @@ public class HealthCheckupUser extends BaseModel {
@Comment("工会小组名称") @Comment("工会小组名称")
@ColDefine(type = ColType.VARCHAR, width = 50) @ColDefine(type = ColType.VARCHAR, width = 50)
private String unionGroupName; private String unionGroupName;
@Column
@Comment("排序")
@ColDefine(type = ColType.INT)
private Integer sort;
} }
@@ -33,10 +33,7 @@ import org.nutz.lang.random.R;
import org.nutz.lang.util.NutMap; import org.nutz.lang.util.NutMap;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -166,6 +163,7 @@ public class HealthCheckupProjectServiceImpl extends ViServiceImpl<HealthCheckup
public List<HealthCheckupUser> getHealthCheckupUserListByProject(HealthCheckupProject healthCheckupProject) { public List<HealthCheckupUser> getHealthCheckupUserListByProject(HealthCheckupProject healthCheckupProject) {
String projectId = healthCheckupProject.getId(); String projectId = healthCheckupProject.getId();
List<ActivityUserScope> groupUsers = dao().query(ActivityUserScope.class, Cnd.where("groupId", "=", healthCheckupProject.getActivityGroupId())); List<ActivityUserScope> groupUsers = dao().query(ActivityUserScope.class, Cnd.where("groupId", "=", healthCheckupProject.getActivityGroupId()));
Map<String, ActivityUserScope> map = groupUsers.stream().collect(Collectors.toMap(ActivityUserScope::getUserId, v -> v));
List<String> userIds = groupUsers.stream().map(ActivityUserScope::getUserId).collect(Collectors.toList()); List<String> userIds = groupUsers.stream().map(ActivityUserScope::getUserId).collect(Collectors.toList());
Sql sql = Sqls.create("select id,loginname,username,sex,unitid,unitname,unionid,unionname,threeUnitId,threeUnitName,unionGroupId,unionGroupName from `user` where id in (@userIds)").setParam("userIds", userIds); Sql sql = Sqls.create("select id,loginname,username,sex,unitid,unitname,unionid,unionname,threeUnitId,threeUnitName,unionGroupId,unionGroupName from `user` where id in (@userIds)").setParam("userIds", userIds);
List<NutMap> userMapList = (List<NutMap>) Daos.query(dao(), sql.toString(), Sqls.callback.maps()); List<NutMap> userMapList = (List<NutMap>) Daos.query(dao(), sql.toString(), Sqls.callback.maps());
@@ -185,6 +183,7 @@ public class HealthCheckupProjectServiceImpl extends ViServiceImpl<HealthCheckup
user.setThreeUnitName(v.getString("threeUnitName")); user.setThreeUnitName(v.getString("threeUnitName"));
user.setUnionGroupId(v.getString("unionGroupId")); user.setUnionGroupId(v.getString("unionGroupId"));
user.setUnionGroupName(v.getString("unionGroupName")); user.setUnionGroupName(v.getString("unionGroupName"));
user.setSort(map.get(v.getString("id")).getSort());
return user; return user;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@@ -235,28 +235,18 @@ public class HealthCheckupSingleServiceImpl extends ViServiceImpl<HealthCheckupP
SELECT SELECT
u.loginname AS loginName, u.loginname AS loginName,
u.username AS userName, u.username AS userName,
u.sex, IFNULL(hcus.sex, u.sex) AS sex,
u.birthday, u.birthday,
u.unitname AS unitName, u.unitname AS unitName,
u.unitcode AS unitCode, u.unitcode AS unitCode,
u.marriage, u.marriage,
u.threeUnitName AS threeUnitName, u.threeUnitName AS threeUnitName,
u.unionname AS unionName, u.unionname AS unionName,
u.idcard AS idCard, hcus.idcard AS idCard,
u.mobile, hcus.mobile,
hcps.optionName subjectName, hcps.optionName subjectName,
hcus.userSign, hcus.userSign,
hcc.campusName, hcc.campusName
(
SELECT
GROUP_CONCAT( hcps.optionName )
FROM
health_checkup_user_selection hcus
LEFT JOIN `health_checkup_project_subject` hcps ON hcps.id = hcus.subjectId
WHERE
hcus.projectId = @projectId
AND hcus.selectUserId = u.id
) optionName
FROM FROM
`health_checkup_user_selection` hcus `health_checkup_user_selection` hcus
LEFT JOIN `user` u ON u.id = hcus.selectUserId LEFT JOIN `user` u ON u.id = hcus.selectUserId
@@ -266,7 +256,8 @@ public class HealthCheckupSingleServiceImpl extends ViServiceImpl<HealthCheckupP
""").setParam("projectId", projectId); """).setParam("projectId", projectId);
cnd.and("hcus.projectId", "=", projectId); cnd.and("hcus.projectId", "=", projectId);
cnd.desc("hcus.subjectId"); cnd.desc("hcus.subjectId");
}else if("1".equals(isSelected)){//查看未选择体检 }else if("1".equals(isSelected)){
//查看未选择体检
sql = Sqls.create(""" sql = Sqls.create("""
SELECT SELECT
u.id, u.id,
@@ -18,4 +18,6 @@ public class HealthCheckupImportTemp {
@Excel(name = "单位") @Excel(name = "单位")
private String unitName; private String unitName;
@Excel(name = "排序")
private Integer sort;
} }
File diff suppressed because one or more lines are too long
@@ -111,6 +111,7 @@
<script src="${base!}/assets/platform/js/chengSh.js"></script> <script src="${base!}/assets/platform/js/chengSh.js"></script>
<script src="${base!}/components/plugins/sysDict/DictData.js"></script> <script src="${base!}/components/plugins/sysDict/DictData.js"></script>
<script src="${base!}/assets/platform/js/util/commonUtil.js"></script> <script src="${base!}/assets/platform/js/util/commonUtil.js"></script>
<script src="${base!}/assets/platform/plugins/xlsx/xlsx.full.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
const base = "${base!}" const base = "${base!}"
@@ -51,7 +51,7 @@ layout("/layouts/platform.html"){
<div class="search-item-label">所属工会:</div> <div class="search-item-label">所属工会:</div>
<div class="search-item-option"> <div class="search-item-option">
<el-select <el-select
@change="flushUnits" @change="flushUnits();doSearch()"
@clear="flushUnits" @clear="flushUnits"
clearable clearable
filterable="true" filterable="true"
@@ -109,7 +109,13 @@ layout("/layouts/platform.html"){
<el-card class="mt10" shadow="never"> <el-card class="mt10" shadow="never">
<table-tool :app="this" label="体检项目"> <table-tool :app="this" label="体检项目">
<template #func> <template #func>
<el-button type="primary" size="small" icon="el-icon-document-add" @click="openImport">导入名单</el-button> <el-radio-group @change="doSearch" class="mr10" size="small" v-model="pageForm.isChoose">
<el-radio-button :label="0">全部</el-radio-button>
<el-radio-button :label="1">已选择</el-radio-button>
<el-radio-button :label="2">未选择</el-radio-button>
</el-radio-group>
<el-button type="primary" size="small" @click="openImport">导入名单</el-button>
<el-button type="primary" size="small" @click="doExport">导出</el-button>
<el-button :disabled="!pageForm.projectId" type="primary" size="small" @click="doAudit(true)">确认名单</el-button> <el-button :disabled="!pageForm.projectId" type="primary" size="small" @click="doAudit(true)">确认名单</el-button>
<!-- 取消确认 --> <!-- 取消确认 -->
<el-button :disabled="!pageForm.projectId" type="danger" size="small" @click="doAudit(false)">取消确认</el-button> <el-button :disabled="!pageForm.projectId" type="danger" size="small" @click="doAudit(false)">取消确认</el-button>
@@ -277,15 +283,13 @@ layout("/layouts/platform.html"){
</el-timeline> </el-timeline>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="importVisible = false" :disabled="importLoading">取 消</el-button> <el-button @click="importVisible = false">取 消</el-button>
<el-button type="primary" @click="doImport" :loading="importLoading">导 入</el-button> <el-button type="primary" @click="doImport">导 入</el-button>
<el-button type="primary" @click="doSearch();importVisible = false" :loading="importLoading">确 定</el-button> <el-button type="primary" @click="doSearch();importVisible = false">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
<script src="https://cdn.staticfile.org/xlsx/0.18.5/xlsx.full.min.js"></script>
<script> <script>
const vue = new Vue({ const vue = new Vue({
el: "#app", el: "#app",
@@ -294,7 +298,11 @@ layout("/layouts/platform.html"){
return { return {
pageForm: { pageForm: {
year: moment().format("YYYY"), year: moment().format("YYYY"),
searchName: "hcu.username" searchName: "hcu.username",
searchKeyword: "",
unionId: "",
unitId: "",
isChoose: 0
}, },
threeUnits: [], threeUnits: [],
unionGroups: [], unionGroups: [],
@@ -379,13 +387,12 @@ layout("/layouts/platform.html"){
isThreeUnit: null, isThreeUnit: null,
// 导入名单相关 // 导入名单相关
//导入名单 // 导入名单
importVisible: false, importVisible: false,
importData: { importData: {
fileList: [], fileList: [],
year: 0 year: 0
}, },
importLoading: false,
importResult: { importResult: {
totalCount: 0, totalCount: 0,
successCount: 0, successCount: 0,
@@ -397,6 +404,40 @@ layout("/layouts/platform.html"){
}, },
components: {}, components: {},
methods: { methods: {
// 导出
doExport() {
const { projectId, searchKeyword, unionId, unitId, isChoose } = this.pageForm
window.open(
"/platform/healthCheckup/list/mange/doExport?projectId=" +
projectId +
"&searchKeyword=" +
searchKeyword +
"&unionId=" +
unionId +
"&unitId=" +
unitId +
"&isChoose=" +
isChoose
)
},
async deleteHealthCheckup(row) {
const confirm = await this.$confirm("您确定删除该条数据?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
if (confirm === "confirm") {
const resp = await $.post("/platform/healthCheckup/list/mange/doRemove", {
id: row.hcuId
})
if (resp.code === 0) {
this.pageData()
this.$message.success("删除成功")
} else {
this.$message.warning(resp.msg)
}
}
},
async doAudit(flag) { async doAudit(flag) {
// flag true,确认 false,取消 // flag true,确认 false,取消
if ("${@shiro.hasRole('sysadmin')}" === "true" && !this.pageForm.unionId) { if ("${@shiro.hasRole('sysadmin')}" === "true" && !this.pageForm.unionId) {
@@ -603,7 +644,7 @@ layout("/layouts/platform.html"){
} }
this.importVisible = true this.importVisible = true
}, },
doImport() { async doImport() {
if (this.importData.fileList.length === 0) { if (this.importData.fileList.length === 0) {
this.notifyWarning("请选择文件!") this.notifyWarning("请选择文件!")
return return
@@ -613,7 +654,13 @@ layout("/layouts/platform.html"){
this.importData.fileList.forEach((val) => { this.importData.fileList.forEach((val) => {
data.append("file", val.raw, val.raw.name) data.append("file", val.raw, val.raw.name)
}) })
this.importLoading = true
const loading = this.$loading({
lock: true,
text: "正在导入,请稍候...",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)"
})
$.ajax({ $.ajax({
url: "/platform/healthCheckup/list/mange/healthImport", url: "/platform/healthCheckup/list/mange/healthImport",
type: "post", type: "post",
@@ -621,16 +668,18 @@ layout("/layouts/platform.html"){
processData: false, processData: false,
contentType: false, contentType: false,
success: (resp) => { success: (resp) => {
this.importLoading = false loading.close()
if (resp.code === 0) { if (resp.code === 0) {
if (resp.data.data) {
this.importResult = resp.data.data this.importResult = resp.data.data
}
} else { } else {
this.notifyWarning("导入失败") this.notifyError(resp.msg)
} }
}, },
error: (data) => { error: (data) => {
loading.close()
this.notifyWarning("导入失败") this.notifyWarning("导入失败")
this.importLoading = false
} }
}) })
}, },
@@ -675,7 +724,6 @@ layout("/layouts/platform.html"){
} }
}) })
} }
this.unions = await getUnions() this.unions = await getUnions()
this.flushUnits() this.flushUnits()
await this.yearChange() await this.yearChange()