省级互助保障:添加人员名单、确认统计、事项反馈三个页面

This commit is contained in:
2026-05-18 14:08:26 +08:00
parent af7cdebed6
commit 480fa9d559
17 changed files with 2477 additions and 4 deletions
@@ -40,9 +40,9 @@ public class SmsNcuServiceImpl implements SmsService {
@Inject
private Dao dao;
private static final String SEND_MSG_URL = "https://poa.ncu.edu.cn/apis/messagecenter/v1/poaMessage/messageSend";
private static final String APP_ID = "72e34a101d3011f1a74cbae5193504f4";
private static final String TEMPLATE_ID = "MT1773223005000";
private static final String SEND_MSG_URL = "";
private static final String APP_ID = "";
private static final String TEMPLATE_ID = "";
@Override
public void sendSingleMessage(String loginName, String content) {
@@ -0,0 +1,58 @@
package com.budwk.app.zhgh.staffbenefit.mutualInsurance.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateUtil;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.model.MutualInsuranceProject;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.service.MutualInsuranceProjectService;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.service.MutualInsuranceRosterUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.List;
@IocBean
@At("/platform/mutualInsurance/personconfirm")
@Api("省级互助保障确认统计")
@Ok("json:full")
public class MutualInsuranceConfirmStatisticsController {
@Inject
private MutualInsuranceRosterUserService mutualInsuranceRosterUserService;
@Inject
private MutualInsuranceProjectService mutualInsuranceProjectService;
@At("/index")
@Ok("beetl:/platform/zhgh/staffbenefit/mutualInsurance/personconfirm/index.html")
@SaCheckPermission("mutualInsurance.personconfirm")
public void index() {
}
@At
@ApiOperation("工会确认情况分页统计")
@SaCheckPermission("mutualInsurance.personconfirm")
public Result pageData(PageForm pageForm, Integer year, String projectId, String unionId) {
return Result.success(mutualInsuranceRosterUserService.confirmStatistics(
pageForm.getPageNumber(),
pageForm.getPageSize(),
year,
projectId,
unionId
));
}
@At
@ApiOperation("按年度查询事项")
@SaCheckPermission("mutualInsurance.personconfirm")
public Result listProject(Integer year) {
List<MutualInsuranceProject> list = mutualInsuranceProjectService.query(
Cnd.NEW().andEX("year", "=", year == null ? DateUtil.thisYear() : year).desc("startTime"));
return Result.success(list);
}
}
@@ -0,0 +1,95 @@
package com.budwk.app.zhgh.staffbenefit.mutualInsurance.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.model.MutualInsuranceProject;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.service.MutualInsuranceFeedbackService;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.service.MutualInsuranceProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.List;
@IocBean
@At("/platform/mutualInsurance/feedback")
@Api("省级互助保障反馈")
@Ok("json:full")
public class MutualInsuranceFeedbackController {
@Inject
private MutualInsuranceFeedbackService mutualInsuranceFeedbackService;
@Inject
private MutualInsuranceProjectService mutualInsuranceProjectService;
@At("/index")
@Ok("beetl:/platform/zhgh/staffbenefit/mutualInsurance/feedbackQuery/index.html")
@SaCheckPermission("mutualInsurance.feedback")
public void index() {
}
@At
@ApiOperation("反馈列表分页")
@SaCheckPermission("mutualInsurance.feedback")
public Result pageData(PageForm pageForm, String year, String projectId, String unionId) {
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name()) && StrUtil.isBlank(unionId)) {
unionId = SecurityUtil.getUnionId();
}
return Result.success(mutualInsuranceFeedbackService.listFeedbackPage(
pageForm.getPageNumber(),
pageForm.getPageSize(),
year,
projectId,
unionId
));
}
@At
@ApiOperation("批量删除反馈")
@Aop(TransAop.READ_COMMITTED)
@SLog(type = "mutualInsurance", tag = "省级互助保障", msg = "批量删除反馈")
@SaCheckPermission("mutualInsurance.feedback")
public Result deleteFeedbackBatch(String ids) {
String[] idArray = parseIds(ids);
NutMap result = mutualInsuranceFeedbackService.deleteFeedbackBatch(idArray);
if (result.getInt("code") == 0) {
return Result.success(result.getString("msg"));
}
return Result.error(result.getString("msg"));
}
@At
@ApiOperation("按年度查询事项")
@SaCheckPermission("mutualInsurance.feedback")
public Result listProject(Integer year) {
List<MutualInsuranceProject> list = mutualInsuranceProjectService.query(
Cnd.NEW().andEX("year", "=", year == null ? DateUtil.thisYear() : year).desc("startTime"));
return Result.success(list);
}
private String[] parseIds(String ids) {
if (StrUtil.isBlank(ids)) {
return new String[0];
}
String value = ids.trim();
if (value.startsWith("[")) {
return JSONUtil.parseArray(value).toList(String.class).toArray(new String[0]);
}
return value.split(",");
}
}
@@ -0,0 +1,297 @@
package com.budwk.app.zhgh.staffbenefit.mutualInsurance.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.model.ExcelImportRes;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.CommonDownloadUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.model.MutualInsuranceProject;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.param.MutualInsuranceRosterUserPageForm;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.service.MutualInsuranceFeedbackService;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.service.MutualInsuranceProjectService;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.service.MutualInsuranceRosterUserService;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.template.MutualInsuranceUserImportTemp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@IocBean
@At("/platform/mutualInsurance/roster")
@Api("省级互助保障人员名单")
@Ok("json:full")
@Slf4j
public class MutualInsuranceRosterController {
@Inject
private MutualInsuranceRosterUserService mutualInsuranceRosterUserService;
@Inject
private MutualInsuranceProjectService mutualInsuranceProjectService;
@Inject
private MutualInsuranceFeedbackService mutualInsuranceFeedbackService;
@At("/index")
@Ok("beetl:/platform/zhgh/staffbenefit/mutualInsurance/roster/index.html")
@SaCheckPermission("mutualInsurance.roster")
public void index() {
}
@At
@ApiOperation("人员名单分页查询")
@SaCheckPermission("mutualInsurance.roster")
public Result pageData(PageForm pageForm, Integer year, String projectId, String unionId,
String unitId, String isAudit) {
return Result.success(mutualInsuranceRosterUserService.rosterPageData(
pageForm.getPageNumber(),
pageForm.getPageSize(),
year,
projectId,
unionId,
unitId,
pageForm.getSearchKeyword(),
isAudit
));
}
@At
@ApiOperation("按年度查询事项")
@SaCheckPermission("mutualInsurance.roster")
public Result listProject(Integer year) {
List<MutualInsuranceProject> list = mutualInsuranceProjectService.query(
Cnd.NEW()
.andEX("year", "=", year == null ? DateUtil.thisYear() : year)
.and("isOpen", "=", true)
.desc("startTime"));
return Result.success(list);
}
@At
@ApiOperation("按事项和工会确认名单")
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("mutualInsurance.roster")
@SLog(type = "mutualInsurance", tag = "省级互助保障", msg = "按事项和工会确认名单")
public Result doAuditUser(String projectId, String unionId, Boolean flag) {
if (StrUtil.isBlank(projectId)) {
return Result.error("请选择事项");
}
if (StrUtil.isBlank(unionId)) {
unionId = SecurityUtil.getUnionId();
}
if (StrUtil.isBlank(unionId)) {
return Result.error("请选择分工会");
}
NutMap result = mutualInsuranceRosterUserService.auditByProjectAndUnion(projectId, unionId, flag);
if (result.getInt("code") == 0) {
return Result.success(result.getString("msg"));
}
return Result.error(result.getString("msg"));
}
@At
@ApiOperation("按勾选人员确认名单")
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("mutualInsurance.roster")
@SLog(type = "mutualInsurance", tag = "省级互助保障", msg = "按勾选人员确认名单")
public Result doAuditSelected(String ids, Boolean flag) {
String[] idArray = parseIds(ids);
if (idArray.length == 0) {
return Result.error("请选择需要操作的人员");
}
mutualInsuranceRosterUserService.auditSelected(idArray, flag);
return Result.success();
}
@At
@ApiOperation("按勾选人员删除名单")
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("mutualInsurance.roster")
@SLog(type = "mutualInsurance", tag = "省级互助保障", msg = "按勾选人员删除名单")
public Result deleteSelected(String ids) {
String[] idArray = parseIds(ids);
if (idArray.length == 0) {
return Result.error("请选择需要删除的人员");
}
mutualInsuranceRosterUserService.deleteSelected(idArray);
return Result.success();
}
@At
@Ok("void")
@ApiOperation("下载人员名单导入模板")
@SaCheckPermission("mutualInsurance.roster")
public void downloadTem(HttpServletResponse response) {
List<ExcelExportEntity> entities = new ArrayList<>();
entities.add(new ExcelExportEntity("工号", "loginName", 20));
entities.add(new ExcelExportEntity("姓名", "userName", 20));
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, Collections.emptyList());
CommonDownloadUtil.download("省级互助保障人员名单导入模板.xlsx", workbook, response);
}
@At
@ApiOperation("导入人员名单")
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("mutualInsurance.roster.import")
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
public Result importRoster(TempFile file, String projectId) {
if (file == null || file.getFile() == null) {
return Result.error("请选择导入文件");
}
if (StrUtil.isBlank(projectId)) {
return Result.error("请选择事项");
}
ExcelImportRes<MutualInsuranceUserImportTemp> result = mutualInsuranceRosterUserService.importRoster(file.getFile(), projectId);
return Result.success(result);
}
@At
@ApiOperation("分页查询可添加人员")
@SaCheckPermission("mutualInsurance.roster")
@Ok("json:{dateFormat:'yyyy-MM-dd'}")
public Result notRosterUserPageData(@Valid @Param("pageForm") MutualInsuranceRosterUserPageForm pageForm) {
if (pageForm.getYear() == null) {
return Result.error("请选择年度");
}
if (StrUtil.isBlank(pageForm.getProjectId())) {
return Result.error("请选择事项");
}
return Result.success(mutualInsuranceRosterUserService.notRosterUserPageData(pageForm));
}
@At
@ApiOperation("按筛选条件添加人员")
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("mutualInsurance.roster")
public Result addRosterUser(@Valid @Param("pageForm") MutualInsuranceRosterUserPageForm pageForm) {
if (pageForm.getYear() == null) {
return Result.error("请选择年度");
}
if (StrUtil.isBlank(pageForm.getProjectId())) {
return Result.error("请选择事项");
}
NutMap result = mutualInsuranceRosterUserService.addRosterUser(pageForm);
if (result.getInt("code") == 0) {
return Result.success(result.getString("msg"));
}
return Result.error(result.getString("msg"));
}
@At
@Ok("void")
@ApiOperation("导出人员名单")
@SaCheckPermission("mutualInsurance.roster")
public void exportRoster(Integer year, String projectId, String unionId, String unitId,
String searchKeyword, String isAudit, HttpServletResponse response) {
List<NutMap> list = mutualInsuranceRosterUserService.rosterList(year, projectId, unionId, unitId, searchKeyword, isAudit);
for (int i = 0; i < list.size(); i++) {
NutMap row = list.get(i);
row.put("index", i + 1);
row.put("isAuditText", Boolean.TRUE.equals(row.getBoolean("isAudit")) ? "已确认" : "未确认");
Object auditTime = row.get("auditTime");
if (auditTime instanceof java.util.Date) {
row.put("auditTimeText", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format((java.util.Date) auditTime));
} else if (auditTime != null) {
row.put("auditTimeText", auditTime.toString());
}
}
List<ExcelExportEntity> entityList = new ArrayList<>();
entityList.add(new ExcelExportEntity("序号", "index", 10));
entityList.add(new ExcelExportEntity("工号", "loginName", 20));
entityList.add(new ExcelExportEntity("姓名", "userName", 20));
entityList.add(new ExcelExportEntity("性别", "sex", 20));
entityList.add(new ExcelExportEntity("所属工会", "unionName", 20));
entityList.add(new ExcelExportEntity("所属单位", "unitName", 20));
entityList.add(new ExcelExportEntity("事项名称", "projectName", 30));
entityList.add(new ExcelExportEntity("手机号", "mobile", 20));
entityList.add(new ExcelExportEntity("身份证号", "idCard", 25));
entityList.add(new ExcelExportEntity("是否确认", "isAuditText", 20));
entityList.add(new ExcelExportEntity("确认时间", "auditTimeText", 25));
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
exportParams.setTitle("省级互助保障人员名单");
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, list);
CommonDownloadUtil.download("省级互助保障人员名单.xlsx", workbook, response);
}
@At
@ApiOperation("反馈列表")
@SaCheckPermission("mutualInsurance.roster")
public Result feedbackList(String year, String projectId, String unionId) {
if (StrUtil.isBlank(unionId)) {
unionId = SecurityUtil.getUnionId();
}
if (StrUtil.hasBlank(year, projectId, unionId)) {
return Result.error("请选择年度、事项、分工会后再查看反馈");
}
return Result.success(mutualInsuranceFeedbackService.listFeedback(year, projectId, unionId));
}
@At
@ApiOperation("保存反馈")
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("mutualInsurance.roster")
public Result saveFeedback(String year, String projectId, String unionId, String feedbackInfo) {
if (StrUtil.isBlank(unionId)) {
unionId = SecurityUtil.getUnionId();
}
NutMap result = mutualInsuranceFeedbackService.saveFeedback(year, projectId, unionId, feedbackInfo);
if (result.getInt("code") == 0) {
return Result.success(result.getString("msg"));
}
return Result.error(result.getString("msg"));
}
@At
@ApiOperation("删除反馈")
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("mutualInsurance.roster")
public Result deleteFeedback(String id) {
NutMap result = mutualInsuranceFeedbackService.deleteFeedback(id);
if (result.getInt("code") == 0) {
return Result.success(result.getString("msg"));
}
return Result.error(result.getString("msg"));
}
private String[] parseIds(String ids) {
if (StrUtil.isBlank(ids)) {
return new String[0];
}
String value = ids.trim();
if (value.startsWith("[")) {
return JSONUtil.parseArray(value).toList(String.class).toArray(new String[0]);
}
return value.split(",");
}
}
@@ -0,0 +1,59 @@
package com.budwk.app.zhgh.staffbenefit.mutualInsurance.model;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.entity.annotation.TableMeta;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("mutual_insurance_feedback")
@TableMeta("{'mysql-charset':'utf8mb4'}")
@Comment("省级互助保障反馈")
public class MutualInsuranceFeedback extends BaseModel implements Serializable {
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("年度")
@ColDefine(type = ColType.VARCHAR, width = 4)
private String year;
@Column
@Comment("事项id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String projectId;
@Column
@Comment("事项名称")
@ColDefine(type = ColType.VARCHAR, width = 255)
private String projectName;
@Column
@Comment("工会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("工会名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String unionName;
@Column
@Comment("反馈内容")
@ColDefine(type = ColType.TEXT)
private String feedbackInfo;
}
@@ -0,0 +1,112 @@
package com.budwk.app.zhgh.staffbenefit.mutualInsurance.model;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.util.Date;
/**
* 省级互助保障人员名单独立存储,避免名单确认、导入、删除影响原申请业务表。
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Table("mutual_insurance_roster_user")
@TableMeta("{'mysql-charset':'utf8mb4'}")
@Comment("省级互助保障人员名单")
public class MutualInsuranceRosterUser extends BaseModel implements Serializable {
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("年度")
@ColDefine(type = ColType.INT)
private Integer year;
@Column
@Comment("事项Id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String projectId;
@Column
@Comment("事项名称")
@ColDefine(type = ColType.VARCHAR, width = 255)
private String projectName;
@Column
@Comment("用户Id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userId;
@Column
@Comment("工号")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String loginName;
@Column
@Comment("姓名")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String userName;
@Column
@Comment("性别")
@ColDefine(type = ColType.VARCHAR, width = 4)
private String sex;
@Column
@Comment("所属工会Id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("所属工会")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unionName;
@Column
@Comment("所属单位Id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("所属单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unitName;
@Column
@Comment("手机号")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String mobile;
@Column
@Comment("身份证号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String idCard;
@Column
@Comment("导入时间")
@ColDefine(type = ColType.DATETIME)
private Date importTime;
@Column
@Comment("确认状态")
@ColDefine(type = ColType.BOOLEAN)
private Boolean isAudit;
@Column
@Comment("确认时间")
@ColDefine(type = ColType.DATETIME)
private Date auditTime;
@Column
@Comment("确认人")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String auditUser;
}
@@ -0,0 +1,54 @@
package com.budwk.app.zhgh.staffbenefit.mutualInsurance.param;
import com.budwk.app.base.param.PageForm;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel("省级互助保障添加人员筛选参数")
public class MutualInsuranceRosterUserPageForm extends PageForm {
@ApiModelProperty("年度")
private Integer year;
@ApiModelProperty("事项id")
private String projectId;
@ApiModelProperty("姓名")
private String userName;
@ApiModelProperty("工号")
private String loginName;
@ApiModelProperty("性别")
private String sex;
@ApiModelProperty("出生日期")
private Date birthday;
@ApiModelProperty("出生月份")
private String[] birthMonths;
@ApiModelProperty("工会id")
private String unionId;
@ApiModelProperty("单位id")
private String[] unitIds;
@ApiModelProperty("人员类型")
private String[] personTypes;
@ApiModelProperty("聘用方式")
private String[] preparedBys;
@ApiModelProperty("在职状态")
private String[] userStates;
@ApiModelProperty("是否会员")
private Boolean isMember;
}
@@ -0,0 +1,37 @@
package com.budwk.app.zhgh.staffbenefit.mutualInsurance.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.model.MutualInsuranceFeedback;
import org.nutz.lang.util.NutMap;
import java.util.List;
public interface MutualInsuranceFeedbackService extends BaseService<MutualInsuranceFeedback> {
/**
* 按事项和分工会查询当前名单页的问题反馈
*/
List<NutMap> listFeedback(String year, String projectId, String unionId);
/**
* 保存问题反馈并回填事项名称和分工会名称保证反馈记录可独立查询展示
*/
NutMap saveFeedback(String year, String projectId, String unionId, String feedbackInfo);
/**
* 删除单条问题反馈
*/
NutMap deleteFeedback(String id);
/**
* 批量删除问题反馈
*/
NutMap deleteFeedbackBatch(String[] ids);
/**
* 分页查询反馈列表页面数据
*/
Pagination<NutMap> listFeedbackPage(Integer pageNumber, Integer pageSize, String year,
String projectId, String unionId);
}
@@ -0,0 +1,63 @@
package com.budwk.app.zhgh.staffbenefit.mutualInsurance.service;
import com.budwk.app.base.model.ExcelImportRes;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.model.MutualInsuranceRosterUser;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.param.MutualInsuranceRosterUserPageForm;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.template.MutualInsuranceUserImportTemp;
import org.nutz.lang.util.NutMap;
import java.io.File;
import java.util.List;
public interface MutualInsuranceRosterUserService extends BaseService<MutualInsuranceRosterUser> {
/**
* 查询省级互助保障人员名单统一承载页面列表和导出数据范围
*/
Pagination<NutMap> rosterPageData(Integer pageNumber, Integer pageSize, Integer year, String projectId,
String unionId, String unitId, String searchKeyword, String isAudit);
/**
* 查询省级互助保障人员名单不分页用于按当前筛选条件导出
*/
List<NutMap> rosterList(Integer year, String projectId, String unionId, String unitId,
String searchKeyword, String isAudit);
/**
* 导入事项人员名单并按工号从系统用户视图补齐人员基础信息
*/
ExcelImportRes<MutualInsuranceUserImportTemp> importRoster(File file, String projectId);
/**
* 分页查询当前筛选条件下尚未加入名单的系统人员
*/
Pagination<NutMap> notRosterUserPageData(MutualInsuranceRosterUserPageForm pageForm);
/**
* 将当前筛选条件下的系统人员批量加入省级互助保障人员名单
*/
NutMap addRosterUser(MutualInsuranceRosterUserPageForm pageForm);
/**
* 按事项和工会批量确认或取消确认名单并在当前条件无名单数据时返回失败信息
*/
NutMap auditByProjectAndUnion(String projectId, String unionId, Boolean flag);
/**
* 按列表勾选记录批量确认或取消确认名单
*/
void auditSelected(String[] ids, Boolean flag);
/**
* 按列表勾选记录批量删除人员名单非校工会管理员只能删除本工会数据
*/
void deleteSelected(String[] ids);
/**
* 按工会统计互助保障人员名单确认完成情况
*/
Pagination<NutMap> confirmStatistics(Integer pageNumber, Integer pageSize, Integer year,
String projectId, String unionId);
}
@@ -0,0 +1,123 @@
package com.budwk.app.zhgh.staffbenefit.mutualInsurance.service.impl;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.sys.models.Sys_union;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.model.MutualInsuranceFeedback;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.model.MutualInsuranceProject;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.service.MutualInsuranceFeedbackService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import java.util.ArrayList;
import java.util.List;
@IocBean(args = {"refer:dao"})
public class MutualInsuranceFeedbackServiceImpl extends BaseServiceImpl<MutualInsuranceFeedback> implements MutualInsuranceFeedbackService {
public MutualInsuranceFeedbackServiceImpl(Dao dao) {
super(dao);
}
@Override
public List<NutMap> listFeedback(String year, String projectId, String unionId) {
Cnd cnd = Cnd.NEW();
cnd.and("year", "=", year)
.and("projectId", "=", projectId)
.and("unionId", "=", unionId)
.desc("createdAt");
List<MutualInsuranceFeedback> feedbackList = query(cnd);
List<NutMap> result = new ArrayList<>();
for (MutualInsuranceFeedback feedback : feedbackList) {
result.add(NutMap.NEW()
.addv("id", feedback.getId())
.addv("year", feedback.getYear())
.addv("projectName", feedback.getProjectName())
.addv("unionName", feedback.getUnionName())
.addv("feedbackInfo", feedback.getFeedbackInfo())
.addv("createdBy", feedback.getCreatedBy())
.addv("createdAt", feedback.getCreatedAt()));
}
return result;
}
@Override
public NutMap saveFeedback(String year, String projectId, String unionId, String feedbackInfo) {
if (StrUtil.hasBlank(year, projectId, unionId)) {
return NutMap.NEW().addv("code", 1).addv("msg", "请选择年度、事项、分工会后再录入反馈");
}
if (StrUtil.isBlank(feedbackInfo)) {
return NutMap.NEW().addv("code", 1).addv("msg", "请输入反馈信息");
}
MutualInsuranceProject project = dao().fetch(MutualInsuranceProject.class, projectId);
if (project == null) {
return NutMap.NEW().addv("code", 1).addv("msg", "当前事项不存在,请重新选择");
}
Sys_union union = dao().fetch(Sys_union.class, unionId);
if (union == null) {
return NutMap.NEW().addv("code", 1).addv("msg", "当前分工会不存在,请重新选择");
}
MutualInsuranceFeedback feedback = new MutualInsuranceFeedback();
feedback.setYear(year);
feedback.setProjectId(projectId);
feedback.setProjectName(project.getProjectName());
feedback.setUnionId(unionId);
feedback.setUnionName(union.getName());
feedback.setFeedbackInfo(feedbackInfo);
insert(feedback);
return NutMap.NEW().addv("code", 0).addv("msg", "保存成功");
}
@Override
public NutMap deleteFeedback(String id) {
if (StrUtil.isBlank(id)) {
return NutMap.NEW().addv("code", 1).addv("msg", "反馈ID不能为空");
}
MutualInsuranceFeedback feedback = fetch(id);
if (feedback == null) {
return NutMap.NEW().addv("code", 1).addv("msg", "反馈记录不存在");
}
delete(id);
return NutMap.NEW().addv("code", 0).addv("msg", "删除成功");
}
@Override
public NutMap deleteFeedbackBatch(String[] ids) {
if (ids == null || ids.length == 0) {
return NutMap.NEW().addv("code", 1).addv("msg", "请选择需要删除的反馈");
}
clear(Cnd.where("id", "in", ids));
return NutMap.NEW().addv("code", 0).addv("msg", "批量删除成功");
}
@Override
public Pagination<NutMap> listFeedbackPage(Integer pageNumber, Integer pageSize, String year, String projectId, String unionId) {
Sql sql = Sqls.create("""
SELECT
feedback.id,
feedback.year,
feedback.projectName,
feedback.unionName,
feedback.feedbackInfo,
feedback.createdAt,
user.username AS createdByName
FROM mutual_insurance_feedback feedback
LEFT JOIN sys_user user ON user.id = feedback.createdBy
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("feedback.year", "=", year);
cnd.andEX("feedback.projectId", "=", projectId);
cnd.andEX("feedback.unionId", "=", unionId);
cnd.desc("feedback.createdAt");
sql.setCondition(cnd);
return listPageMap(pageNumber, pageSize, sql);
}
}
@@ -0,0 +1,422 @@
package com.budwk.app.zhgh.staffbenefit.mutualInsurance.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.model.ExcelImportRes;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.base.utils.easyexcel.EasyExcelUtil;
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.SecurityUtil;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.model.MutualInsuranceProject;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.model.MutualInsuranceRosterUser;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.param.MutualInsuranceRosterUserPageForm;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.service.MutualInsuranceRosterUserService;
import com.budwk.app.zhgh.staffbenefit.mutualInsurance.template.MutualInsuranceUserImportTemp;
import org.apache.poi.ss.formula.functions.T;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import java.io.File;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@IocBean(args = {"refer:dao"})
public class MutualInsuranceRosterUserServiceImpl extends BaseServiceImpl<MutualInsuranceRosterUser> implements MutualInsuranceRosterUserService {
public MutualInsuranceRosterUserServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination<NutMap> rosterPageData(Integer pageNumber, Integer pageSize, Integer year, String projectId,
String unionId, String unitId, String searchKeyword, String isAudit) {
return listPageMap(pageNumber, pageSize, buildRosterSql(year, projectId, unionId, unitId, searchKeyword, isAudit));
}
@Override
public List<NutMap> rosterList(Integer year, String projectId, String unionId, String unitId,
String searchKeyword, String isAudit) {
return listMap(buildRosterSql(year, projectId, unionId, unitId, searchKeyword, isAudit));
}
@Override
public ExcelImportRes<MutualInsuranceUserImportTemp> importRoster(File file, String projectId) {
List<T> rows = EasyExcelUtil.syncReadModel(file, MutualInsuranceUserImportTemp.class, 0, 1);
List<MutualInsuranceUserImportTemp> importRows = JSONUtil.parseArray(JSONUtil.toJsonStr(rows)).toList(MutualInsuranceUserImportTemp.class);
ExcelImportRes<MutualInsuranceUserImportTemp> result = new ExcelImportRes<>();
result.setTotalRecords(importRows.size());
MutualInsuranceProject project = dao().fetch(MutualInsuranceProject.class, projectId);
if (project == null) {
markAllFailed(importRows, "事项不存在");
fillImportResult(result, importRows, 0);
return result;
}
if (!Boolean.TRUE.equals(project.getIsOpen())) {
markAllFailed(importRows, "只能导入已发布事项人员");
fillImportResult(result, importRows, 0);
return result;
}
Date now = new Date();
if ((project.getStartTime() != null && now.before(project.getStartTime()))
|| (project.getEndTime() != null && now.after(project.getEndTime()))) {
markAllFailed(importRows, "当前事项不在可导入时间范围内");
fillImportResult(result, importRows, 0);
return result;
}
List<String> loginNames = importRows.stream()
.map(MutualInsuranceUserImportTemp::getLoginName)
.filter(StrUtil::isNotBlank)
.map(Strings::trim)
.distinct()
.collect(Collectors.toList());
List<View_user> users = loginNames.isEmpty()
? Collections.emptyList()
: dao().query(View_user.class, Cnd.where(View_user::getLoginname, "in", loginNames));
int successCount = 0;
for (int i = 0; i < importRows.size(); i++) {
MutualInsuranceUserImportTemp row = importRows.get(i);
String loginName = Strings.trim(row.getLoginName());
if (StrUtil.isBlank(loginName)) {
row.setErrInfo("工号不能为空", i + 1);
continue;
}
if (importRows.stream().filter(item -> loginName.equals(Strings.trim(item.getLoginName()))).count() > 1) {
row.setErrInfo("导入文件中工号重复", i + 1);
continue;
}
View_user user = users.stream()
.filter(item -> loginName.equals(item.getLoginname()))
.findFirst()
.orElse(null);
if (user == null) {
row.setErrInfo("工号在系统中不存在", i + 1);
continue;
}
upsertRosterUser(project, user);
successCount++;
}
fillImportResult(result, importRows, successCount);
return result;
}
@Override
public Pagination<NutMap> notRosterUserPageData(MutualInsuranceRosterUserPageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.loginname,
u.username,
u.sex,
u.birthday,
u.personType,
u.preparedBy,
u.userState,
u.unitId,
u.unitName,
u.unionId,
u.unionName,
u.member
FROM vw_user u
LEFT JOIN mutual_insurance_roster_user info ON u.id = info.userId
AND info.projectId = @projectId
AND info.delFlag = 0
$condition
""").setParam("projectId", pageForm.getProjectId());
Cnd cnd = buildAddUserFilterCnd(pageForm);
cnd.and("info.userId", "is", null);
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
public NutMap addRosterUser(MutualInsuranceRosterUserPageForm pageForm) {
MutualInsuranceProject project = validateAddRosterProject(pageForm);
if (project == null) {
return NutMap.NEW().addv("code", 1).addv("msg", "添加失败,请选择有效的年度和事项");
}
Sql sql = Sqls.create("""
SELECT
u.id,
u.loginname,
u.username,
u.sex,
u.unitId,
u.unitName,
u.unionId,
u.unionName,
u.mobile,
u.idCard
FROM vw_user u
$condition
""");
Cnd cnd = buildAddUserFilterCnd(pageForm);
cnd.and("u.id", "not in", Sqls.create("""
SELECT userId FROM mutual_insurance_roster_user
WHERE projectId = @projectId AND delFlag = 0
""").setParam("projectId", pageForm.getProjectId()));
sql.setCondition(cnd);
List<NutMap> users = listMap(sql);
if (users.isEmpty()) {
return NutMap.NEW().addv("code", 1).addv("msg", "添加失败,暂无数据");
}
for (NutMap user : users) {
upsertRosterUser(project, user);
}
return NutMap.NEW().addv("code", 0).addv("msg", "添加成功");
}
@Override
public NutMap auditByProjectAndUnion(String projectId, String unionId, Boolean flag) {
Cnd cnd = Cnd.NEW().and("projectId", "=", projectId).and("unionId", "=", unionId).and("delFlag", "=", false);
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
cnd.and("unionId", "=", SecurityUtil.getUnionId());
}
// 按工会确认依赖当前事项和工会筛选结果空数据时要明确返回失败避免页面误认为已确认
if (count(cnd) == 0) {
return NutMap.NEW().addv("code", 1).addv("msg", "确认失败,暂无数据");
}
updateAuditState(cnd, flag);
return NutMap.NEW().addv("code", 0).addv("msg", "操作成功");
}
@Override
public void auditSelected(String[] ids, Boolean flag) {
if (ids == null || ids.length == 0) {
return;
}
Cnd cnd = Cnd.where("id", "in", ids).and("delFlag", "=", false);
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
cnd.and("unionId", "=", SecurityUtil.getUnionId());
}
updateAuditState(cnd, flag);
}
@Override
public void deleteSelected(String[] ids) {
if (ids == null || ids.length == 0) {
return;
}
Cnd cnd = Cnd.where("id", "in", ids).and("delFlag", "=", false);
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
cnd.and("unionId", "=", SecurityUtil.getUnionId());
}
// 人员名单删除采用逻辑删除避免导入确认类数据被物理清除后无法追溯
dao().update(MutualInsuranceRosterUser.class, Chain.make("delFlag", true), cnd);
}
@Override
public Pagination<NutMap> confirmStatistics(Integer pageNumber, Integer pageSize, Integer year, String projectId, String unionId) {
Sql sql = Sqls.create("""
SELECT
su.id AS unionId,
su.name AS unionName,
COUNT(CASE WHEN project.id IS NOT NULL THEN info.id END) AS totalCount,
SUM(CASE WHEN project.id IS NOT NULL AND info.isAudit = 1 THEN 1 ELSE 0 END) AS confirmedCount,
SUM(CASE WHEN project.id IS NOT NULL AND info.id IS NOT NULL AND (info.isAudit IS NULL OR info.isAudit <> 1) THEN 1 ELSE 0 END) AS unconfirmedCount,
CASE
WHEN COUNT(CASE WHEN project.id IS NOT NULL THEN info.id END) > 0
AND COUNT(CASE WHEN project.id IS NOT NULL THEN info.id END) = SUM(CASE WHEN project.id IS NOT NULL AND info.isAudit = 1 THEN 1 ELSE 0 END) THEN '已完成'
ELSE '未完成'
END AS completeStatus
FROM sys_union su
LEFT JOIN mutual_insurance_roster_user info ON info.unionId = su.id
AND info.delFlag = 0
AND info.projectId = @projectId
LEFT JOIN mutual_insurance_project project ON project.id = info.projectId
AND project.delFlag = 0
AND project.year = @year
$condition
""").setParam("projectId", projectId).setParam("year", year);
Cnd cnd = Cnd.NEW();
cnd.andEX("su.id", "=", unionId);
cnd.groupBy("su.id,su.name");
cnd.asc("completeStatus");
cnd.asc("su.unionCode");
sql.setCondition(cnd);
return listPageMap(pageNumber, pageSize, sql);
}
private Sql buildRosterSql(Integer year, String projectId, String unionId, String unitId,
String searchKeyword, String isAudit) {
Sql sql = Sqls.create("""
SELECT
info.*,
project.year AS projectYear
FROM mutual_insurance_roster_user info
LEFT JOIN mutual_insurance_project project ON project.id = info.projectId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("info.delFlag", "=", false);
cnd.and("project.delFlag", "=", false);
cnd.andEX("project.year", "=", year);
cnd.andEX("info.projectId", "=", projectId);
cnd.andEX("info.unionId", "=", unionId);
cnd.andEX("info.unitId", "=", unitId);
if (StrUtil.isNotBlank(isAudit)) {
if ("1".equals(isAudit)) {
cnd.and("info.isAudit", "=", true);
} else if ("0".equals(isAudit)) {
SqlExpressionGroup group = Cnd.NEW().where();
group.andEX("info.isAudit", "=", false);
group.orIsNull("info.isAudit");
cnd.and(group);
}
}
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
cnd.andEX("info.unionId", "=", SecurityUtil.getUnionId());
}
if (StrUtil.isNotBlank(searchKeyword)) {
SqlExpressionGroup group = new SqlExpressionGroup();
group.orLike("info.userName", searchKeyword);
group.orLike("info.loginName", searchKeyword);
cnd.and(group);
}
cnd.desc("info.importTime");
cnd.desc("info.createdAt");
sql.setCondition(cnd);
return sql;
}
private void upsertRosterUser(MutualInsuranceProject project, View_user user) {
MutualInsuranceRosterUser info = dao().fetch(MutualInsuranceRosterUser.class,
Cnd.where("projectId", "=", project.getId()).and("userId", "=", user.getId()));
if (info == null) {
info = new MutualInsuranceRosterUser();
info.setProjectId(project.getId());
info.setProjectName(project.getProjectName());
info.setYear(project.getYear());
info.setImportTime(new Date());
info.setIsAudit(false);
}
info.setDelFlag(false);
info.setUserId(user.getId());
info.setLoginName(user.getLoginname());
info.setUserName(user.getUsername());
info.setSex(user.getSex());
info.setUnitId(user.getUnitId());
info.setUnitName(user.getUnitName());
info.setUnionId(user.getUnionId());
info.setUnionName(user.getUnionName());
info.setMobile(user.getMobile());
info.setIdCard(user.getIdCard());
dao().insertOrUpdate(info);
}
private void upsertRosterUser(MutualInsuranceProject project, NutMap user) {
MutualInsuranceRosterUser info = dao().fetch(MutualInsuranceRosterUser.class,
Cnd.where("projectId", "=", project.getId()).and("userId", "=", user.getString("id")));
if (info == null) {
info = new MutualInsuranceRosterUser();
info.setProjectId(project.getId());
info.setProjectName(project.getProjectName());
info.setYear(project.getYear());
info.setImportTime(new Date());
info.setIsAudit(false);
}
info.setDelFlag(false);
info.setUserId(user.getString("id"));
info.setLoginName(user.getString("loginname"));
info.setUserName(user.getString("username"));
info.setSex(user.getString("sex"));
info.setUnitId(user.getString("unitId"));
info.setUnitName(user.getString("unitName"));
info.setUnionId(user.getString("unionId"));
info.setUnionName(user.getString("unionName"));
info.setMobile(user.getString("mobile"));
info.setIdCard(user.getString("idCard"));
dao().insertOrUpdate(info);
}
private MutualInsuranceProject validateAddRosterProject(MutualInsuranceRosterUserPageForm pageForm) {
if (pageForm == null || pageForm.getYear() == null || StrUtil.isBlank(pageForm.getProjectId())) {
return null;
}
MutualInsuranceProject project = dao().fetch(MutualInsuranceProject.class,
Cnd.where("id", "=", pageForm.getProjectId()).and("year", "=", pageForm.getYear()).and("isOpen", "=", true));
if (project == null) {
return null;
}
Date now = new Date();
if ((project.getStartTime() != null && now.before(project.getStartTime()))
|| (project.getEndTime() != null && now.after(project.getEndTime()))) {
return null;
}
return project;
}
private Cnd buildAddUserFilterCnd(MutualInsuranceRosterUserPageForm pageForm) {
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(pageForm.getUserName())) {
cnd.where().andLike("u.username", pageForm.getUserName());
}
if (StrUtil.isNotBlank(pageForm.getLoginName())) {
cnd.where().andLike("u.loginname", pageForm.getLoginName());
}
cnd.andEX("u.sex", "=", pageForm.getSex());
cnd.andEX("u.birthday", "=", pageForm.getBirthday());
if (pageForm.getBirthMonths() != null && pageForm.getBirthMonths().length > 0) {
cnd.andEX("MONTH(u.birthday)", "in", pageForm.getBirthMonths());
}
cnd.andEX("u.unionId", "=", pageForm.getUnionId());
cnd.andEX("u.unitId", "in", pageForm.getUnitIds());
cnd.andEX("u.personType", "in", pageForm.getPersonTypes());
cnd.andEX("u.preparedBy", "in", pageForm.getPreparedBys());
cnd.andEX("u.userState", "in", pageForm.getUserStates());
cnd.andEX("u.member", "=", pageForm.getIsMember());
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
cnd.and("u.unionId", "=", SecurityUtil.getUnionId());
}
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.asc("u.unionCode");
cnd.asc("u.unitCode");
cnd.asc("u.sex");
} else {
cnd.orderBy("u." + pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
}
return cnd;
}
private void updateAuditState(Cnd cnd, Boolean flag) {
Chain chain = Chain.make("isAudit", Boolean.TRUE.equals(flag));
if (Boolean.TRUE.equals(flag)) {
chain.add("auditTime", DateUtil.date());
chain.add("auditUser", SecurityUtil.getUserId());
} else {
chain.add("auditTime", null);
chain.add("auditUser", null);
}
dao().update(MutualInsuranceRosterUser.class, chain, cnd);
}
private void markAllFailed(List<MutualInsuranceUserImportTemp> rows, String msg) {
for (int i = 0; i < rows.size(); i++) {
rows.get(i).setErrInfo(msg, i + 1);
}
}
private void fillImportResult(ExcelImportRes<MutualInsuranceUserImportTemp> result,
List<MutualInsuranceUserImportTemp> rows,
int successCount) {
result.setSuccessCount(successCount);
result.setErrorDetails(rows.stream().filter(row -> StrUtil.isNotBlank(row.getErrMsg())).collect(Collectors.toList()));
result.setFailedCount(result.getErrorDetails().size());
}
}
@@ -19,7 +19,6 @@ public class MutualInsuranceUserServiceImpl extends BaseServiceImpl<MutualInsura
super(dao);
}
// @Override
// public void setBasicUserInfo(MutualInsuranceUserInfo userInfo) {
// User user = dao().fetch(User.class, Cnd.where("id", "=", ShiroUtil.getUserId()));
@@ -0,0 +1,23 @@
package com.budwk.app.zhgh.staffbenefit.mutualInsurance.template;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.budwk.app.base.model.ExcelImportError;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class MutualInsuranceUserImportTemp extends ExcelImportError {
@ExcelProperty("工号")
private String loginName;
@ExcelProperty("姓名")
private String userName;
}
@@ -0,0 +1,179 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" class="platform" v-cloak>
<guava ref="guava" padding="0 5%">
<template>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年度">
<el-date-picker v-model="pageForm.year"
type="year"
value-format="yyyy"
placeholder="请选择年度"
style="width: 100%"
@change="yearChange"></el-date-picker>
</search-item>
<search-item label="事项名称">
<el-select v-model="pageForm.projectId"
clearable
filterable
placeholder="请选择事项"
style="width: 100%"
@change="doSearch">
<el-option v-for="item in projectOptions"
:key="item.id"
:label="item.projectName"
:value="item.id"></el-option>
</el-select>
</search-item>
<search-item label="分工会" v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">
<el-select v-model="pageForm.unionId"
clearable
filterable
placeholder="请选择分工会"
style="width: 100%"
@change="doSearch">
<el-option v-for="item in unions"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="反馈列表">
<el-button type="danger"
size="small"
:disabled="selectedFeedbackIds.length === 0"
@click="deleteFeedbackBatch">批量删除</el-button>
</table-tool>
<el-table :data="tableData"
style="width: 100%"
row-key="id"
:size="tableSize"
v-loading="tableLoading"
@selection-change="handleSelectionChange"
ref="table"
class="vi-table">
<el-table-column type="selection" width="55" align="center" header-align="center"></el-table-column>
<el-table-column type="index" :index="indexMethod" label="序号" width="80px" align="center" header-align="center"></el-table-column>
<el-table-column prop="year" label="年度" align="center" header-align="center"></el-table-column>
<el-table-column prop="projectName" label="事项名称" min-width="180px" align="center" header-align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="unionName" label="分工会" min-width="160px" align="center" header-align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="feedbackInfo" label="反馈信息" min-width="240px" align="center" header-align="center" show-overflow-tooltip>
<template slot-scope="{row}">
<div v-html="row.feedbackInfo" style="white-space: pre-line !important;"></div>
</template>
</el-table-column>
<el-table-column prop="createdByName" label="创建人" align="center" header-align="center"></el-table-column>
<el-table-column prop="createdAt" label="创建时间" width="180px" align="center" header-align="center">
<template slot-scope="{row}">
{{ row.createdAt ? $moment(row.createdAt).format("YYYY-MM-DD HH:mm:ss") : "" }}
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
</guava>
</div>
<script>
const vue = new Vue({
el: "#app",
mixins: [initTableMixins],
data() {
return {
pageForm: {
year: moment().format("YYYY")
},
tableData: [],
selectedFeedbackIds: [],
unions: [],
projectOptions: []
}
},
methods: {
handleSelectionChange(rows) {
this.selectedFeedbackIds = rows.map(function (item) {
return item.id
})
},
yearChange() {
return $.get("/platform/mutualInsurance/feedback/listProject", {year: this.pageForm.year}).then((resp) => {
if (resp.code === 0) {
this.projectOptions = resp.data || []
if (this.projectOptions.length > 0) {
const currentProjectId = this.pageForm.projectId
if (!currentProjectId || !this.projectOptions.some(function (item) {
return item.id === currentProjectId
})) {
this.pageForm.projectId = this.projectOptions[0].id
}
} else {
this.pageForm.projectId = ""
}
this.doSearch()
} else {
this.notifyError(resp.msg)
}
})
},
pageData() {
this.tableLoading = true
return $.post("/platform/mutualInsurance/feedback/pageData", this.pageForm).then((resp) => {
if (resp.code === 0) {
this.tableData = resp.data.list || []
this.selectedFeedbackIds = []
this.pageForm.totalCount = resp.data.totalCount || 0
} else {
this.notifyError(resp.msg)
}
}).always(() => {
this.tableLoading = false
})
},
doSearch() {
this.pageForm.pageNumber = 1
return this.pageData()
},
deleteFeedbackBatch() {
if (this.selectedFeedbackIds.length === 0) {
this.notifyWarning("请选择需要删除的反馈")
return
}
this.$confirm("确认批量删除选中的反馈吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
$.post("/platform/mutualInsurance/feedback/deleteFeedbackBatch", {
ids: this.selectedFeedbackIds.join(",")
}).then((resp) => {
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.pageData()
} else {
this.notifyError(resp.msg)
}
})
})
}
},
created() {
this.$businessTool.listUnion().then((res) => {
this.unions = res
if (!this.pageForm.unionId && this.unions && this.unions.length === 1) {
this.pageForm.unionId = this.unions[0].id
}
})
this.yearChange()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,133 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" class="platform" v-cloak>
<guava ref="guava" padding="0 5%">
<template>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年度">
<el-date-picker v-model="pageForm.year"
type="year"
value-format="yyyy"
placeholder="请选择年度"
style="width: 100%"
@change="yearChange"></el-date-picker>
</search-item>
<search-item label="事项名称">
<el-select v-model="pageForm.projectId"
clearable
filterable
placeholder="请选择事项"
style="width: 100%"
@change="doSearch">
<el-option v-for="item in projectOptions"
:key="item.id"
:label="item.projectName"
:value="item.id"></el-option>
</el-select>
</search-item>
<search-item label="所属工会">
<el-select v-model="pageForm.unionId"
clearable
filterable
placeholder="请选择所属工会"
style="width: 100%"
@change="doSearch">
<el-option v-for="item in unions"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="工会确认情况统计"></table-tool>
<el-table :data="tableData"
:size="tableSize"
row-key="unionId"
style="width: 100%"
v-loading="tableLoading"
ref="table"
class="vi-table">
<el-table-column type="index" :index="indexMethod" label="序号" width="80px" align="center" header-align="center"></el-table-column>
<el-table-column prop="unionName" label="工会名称" align="center" header-align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="totalCount" label="总人数" align="center" header-align="center"></el-table-column>
<el-table-column prop="confirmedCount" label="已确认人数" align="center" header-align="center"></el-table-column>
<el-table-column prop="unconfirmedCount" label="未确认人数" align="center" header-align="center"></el-table-column>
<el-table-column prop="completeStatus" label="确认完成状态" align="center" header-align="center"></el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
</guava>
</div>
<script>
const vue = new Vue({
el: "#app",
mixins: [initTableMixins],
data() {
return {
pageForm: {
year: moment().format("YYYY")
},
unions: [],
projectOptions: []
}
},
methods: {
yearChange() {
return $.get("/platform/mutualInsurance/personconfirm/listProject", {year: this.pageForm.year}).then((resp) => {
if (resp.code === 0) {
this.projectOptions = resp.data || []
if (this.projectOptions.length > 0) {
this.$set(this.pageForm, "projectId", this.projectOptions[0].id)
} else {
this.$set(this.pageForm, "projectId", "")
}
this.doSearch()
} else {
this.notifyError(resp.msg)
}
})
},
pageData() {
if (!this.pageForm.year || !this.pageForm.projectId) {
this.tableData = []
this.pageForm.totalCount = 0
return Promise.resolve()
}
this.tableLoading = true
return $.post("/platform/mutualInsurance/personconfirm/pageData", this.pageForm).then((resp) => {
if (resp.code === 0) {
this.tableData = resp.data.list || []
this.pageForm.totalCount = resp.data.totalCount || 0
} else {
this.notifyError(resp.msg)
}
}).always(() => {
this.tableLoading = false
})
},
doSearch() {
this.pageForm.pageNumber = 1
return this.pageData()
}
},
created() {
this.$businessTool.listUnion().then((res) => {
this.unions = res
if (!this.pageForm.unionId && this.unions && this.unions.length === 1) {
this.pageForm.unionId = this.unions[0].id
}
})
this.yearChange()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,649 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" class="platform" v-cloak>
<guava ref="guava" padding="0 5%">
<template>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年度">
<el-date-picker v-model="pageForm.year"
type="year"
value-format="yyyy"
placeholder="请选择年度"
style="width: 100%"
@change="yearChange"></el-date-picker>
</search-item>
<search-item label="事项名称">
<el-select v-model="pageForm.projectId"
placeholder="请选择事项"
clearable
filterable
style="width: 100%"
@change="doSearch">
<el-option v-for="item in projectOptions"
:key="item.id"
:label="item.projectName"
:value="item.id"></el-option>
</el-select>
</search-item>
<search-item label="姓名/工号">
<el-input v-model="pageForm.searchKeyword" clearable placeholder="请输入姓名或工号"></el-input>
</search-item>
<search-item label="所属工会" v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">
<el-select v-model="pageForm.unionId"
placeholder="请选择所属工会"
clearable
filterable
style="width: 100%"
@change="flushUnits"
@clear="flushUnits">
<el-option v-for="item in unions"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</search-item>
<search-item label="所属单位">
<el-select v-model="pageForm.unitId"
placeholder="请选择所属单位"
clearable
filterable
style="width: 100%">
<el-option v-for="item in units"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</search-item>
<search-item label="确认状态">
<el-select v-model="pageForm.isAudit" placeholder="请选择确认状态" clearable style="width: 100%">
<el-option label="已确认" value="1"></el-option>
<el-option label="未确认" value="0"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="人员名单">
<el-button type="primary" size="small" @click="openFeedback">问题反馈</el-button>
<el-button type="primary"
size="small"
@click="openImport"
v-if="$auth.hasPermissionOr(['mutualInsurance.roster.import'])">导入名单</el-button>
<el-button type="primary" size="small" @click="openAddUser">添加人员</el-button>
<el-button type="primary" size="small" @click="exportData">导出</el-button>
<el-button type="primary" size="small" :disabled="!pageForm.projectId" @click="doAuditByUnion(true)">按工会确认</el-button>
<el-button type="danger" size="small" :disabled="!pageForm.projectId" @click="doAuditByUnion(false)">按工会取消确认</el-button>
<el-button type="primary" size="small" :disabled="selectedIds.length === 0" @click="doAuditSelected(true)">勾选确认</el-button>
<el-button type="danger" size="small" :disabled="selectedIds.length === 0" @click="doAuditSelected(false)">勾选取消确认</el-button>
<el-button type="danger" size="small" :disabled="selectedIds.length === 0" @click="deleteSelected">批量删除</el-button>
</table-tool>
<el-table :data="tableData"
style="width: 100%"
row-key="id"
:size="tableSize"
v-loading="tableLoading"
@selection-change="handleSelectionChange"
@sort-change="pageOrder"
ref="table"
class="vi-table">
<el-table-column type="selection" width="55" align="center" header-align="center"></el-table-column>
<el-table-column type="index" :index="indexMethod" label="序号" width="80px" align="center" header-align="center"></el-table-column>
<el-table-column prop="loginName" label="工号" align="center" header-align="center"></el-table-column>
<el-table-column prop="userName" label="姓名" align="center" header-align="center"></el-table-column>
<el-table-column prop="sex" label="性别" align="center" header-align="center"></el-table-column>
<el-table-column prop="unionName" label="所属工会" align="center" header-align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="unitName" label="所属单位" align="center" header-align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="projectName" label="事项名称" min-width="180px" align="center" header-align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="mobile" label="手机号" align="center" header-align="center"></el-table-column>
<el-table-column prop="idCard" label="身份证号" min-width="170px" align="center" header-align="center"></el-table-column>
<el-table-column prop="isAudit" label="确认状态" align="center" header-align="center">
<template slot-scope="{row}">
<el-tag type="success" v-if="row.isAudit">已确认</el-tag>
<el-tag type="info" v-else>未确认</el-tag>
</template>
</el-table-column>
<el-table-column prop="auditTime" label="确认时间" min-width="160px" align="center" header-align="center"></el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
</guava>
<el-dialog title="问题反馈" :visible.sync="feedbackDialog" width="60%" :close-on-click-modal="false">
<el-form :model="feedbackForm" label-width="100px">
<el-form-item label="反馈信息">
<el-input v-model="feedbackForm.feedbackInfo" placeholder="请输入反馈信息"></el-input>
</el-form-item>
</el-form>
<el-row type="flex" justify="end" class="mb10">
<el-button @click="feedbackDialog=false" type="primary" plain>取消</el-button>
<el-button @click="saveFeedback" type="primary" v-loading="feedbackLoading">保存</el-button>
</el-row>
<el-table :data="feedbackList" border>
<el-table-column align="center" label="问题反馈" prop="feedbackInfo" show-overflow-tooltip="false"></el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template slot-scope="{row}">
<el-button @click="deleteFeedback(row)" type="danger" size="mini">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
<el-dialog title="添加人员" :visible.sync="addUserVisible" width="80%" :close-on-click-modal="false">
<el-card shadow="never">
<search @search="addUserDoSearch">
<search-item label="姓名">
<el-input v-model="addUserPageForm.userName"
@keyup.enter.native="addUserDoSearch"
clearable
placeholder="请输入姓名"></el-input>
</search-item>
<search-item label="工号">
<el-input v-model="addUserPageForm.loginName"
@keyup.enter.native="addUserDoSearch"
clearable
placeholder="请输入工号"></el-input>
</search-item>
<search-item label="性别">
<el-select v-model="addUserPageForm.sex" clearable placeholder="请选择性别" style="width: 100%">
<el-option v-for="sex in addUserSexOptions" :key="sex" :label="sex" :value="sex"></el-option>
</el-select>
</search-item>
<search-item label="出生日期">
<el-date-picker v-model="addUserPageForm.birthday"
type="date"
placeholder="选择出生日期"
value-format="yyyy-MM-dd"
style="width: 100%"></el-date-picker>
</search-item>
<search-item label="出生月份">
<el-select v-model="addUserPageForm.birthMonths"
multiple
collapse-tags
placeholder="请选择出生月份"
style="width: 100%">
<el-option v-for="month in 12" :key="month" :label="month + '月'" :value="month"></el-option>
</el-select>
</search-item>
<search-item label="所属工会" v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">
<el-select v-model="addUserPageForm.unionId"
clearable
filterable
placeholder="请选择所属工会"
style="width: 100%"
@change="addUserUnionChange"
@clear="addUserUnionChange">
<el-option v-for="item in addUserUnionOptions"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</search-item>
<search-item label="所属单位">
<el-select v-model="addUserPageForm.unitIds"
clearable
filterable
multiple
collapse-tags
placeholder="请选择所属单位"
style="width: 100%">
<el-option v-for="item in addUserUnitOptions"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</search-item>
<search-item label="人员类型">
<dict-select clearable
code="USER_PERSON_TYPE"
multiple
collapse-tags
placeholder="请选择人员类型"
v-model="addUserPageForm.personTypes"></dict-select>
</search-item>
<search-item label="编制类别">
<dict-select clearable
code="USER_PREPARED_BY_TYPE"
multiple
collapse-tags
placeholder="请选择编制类别"
v-model="addUserPageForm.preparedBys"></dict-select>
</search-item>
<search-item label="在职状态">
<dict-select clearable
code="USER_STATE"
multiple
collapse-tags
placeholder="请选择人员状态"
v-model="addUserPageForm.userStates"></dict-select>
</search-item>
<search-item label="是否会员">
<el-select v-model="addUserPageForm.isMember" clearable placeholder="请选择是否会员" style="width: 100%">
<el-option label="全部" :value="null"></el-option>
<el-option label="是" :value="true"></el-option>
<el-option label="否" :value="false"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card shadow="never" class="mt10">
<el-table :data="addUserTableData"
:size="tableSize"
row-key="id"
v-loading="addUserTableLoading"
style="width: 100%">
<el-table-column type="index" :index="addUserIndexMethod" label="序号" width="80px" align="center"></el-table-column>
<el-table-column prop="loginname" label="工号" align="center" header-align="center"></el-table-column>
<el-table-column prop="username" label="姓名" align="center" header-align="center"></el-table-column>
<el-table-column prop="sex" label="性别" align="center" header-align="center"></el-table-column>
<el-table-column prop="birthday" label="出生日期" align="center" header-align="center"></el-table-column>
<el-table-column prop="personType" label="人员类型" align="center" header-align="center"></el-table-column>
<el-table-column prop="preparedBy" label="编制类别" align="center" header-align="center"></el-table-column>
<el-table-column prop="userState" label="在职状态" align="center" header-align="center"></el-table-column>
<el-table-column prop="unionName" label="所属工会" align="center" header-align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="unitName" label="所属单位" align="center" header-align="center" show-overflow-tooltip></el-table-column>
</el-table>
<div class="mt10 text-right">
<el-pagination background
layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="addUserPageForm.pageNumber"
:page-size.sync="addUserPageForm.pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="addUserPageForm.totalCount || 0"
@size-change="addUserPageData"
@current-change="addUserPageData"></el-pagination>
</div>
</el-card>
<template slot="footer">
<el-button @click="addUserVisible=false">取消</el-button>
<el-button type="primary" @click="submitAddUser">确定</el-button>
</template>
</el-dialog>
<excel-import
ref="excelImportRef"
url="/platform/mutualInsurance/roster/importRoster"
template_url="/platform/mutualInsurance/roster/downloadTem"
:visible.sync="importVisible"
title="导入人员名单"
width="700px"
:extra_params="{projectId:pageForm.projectId}"
@import-success="doSearch"
></excel-import>
</div>
<script>
const vue = new Vue({
el: "#app",
mixins: [initTableMixins],
data() {
return {
pageForm: {
year: moment().format("YYYY")
},
unions: [],
units: [],
projectOptions: [],
selectedIds: [],
importVisible: false,
feedbackDialog: false,
feedbackLoading: false,
feedbackList: [],
feedbackForm: {
year: "",
projectId: "",
unionId: "",
feedbackInfo: ""
},
addUserVisible: false,
addUserTableLoading: false,
addUserTableData: [],
addUserSexOptions: ["男", "女"],
addUserUnionOptions: [],
addUserUnitOptions: [],
addUserPageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
year: "",
projectId: "",
userName: "",
loginName: "",
sex: "",
birthday: "",
birthMonths: [],
unionId: "",
unitIds: [],
personTypes: [],
preparedBys: [],
userStates: [],
isMember: null
}
}
},
methods: {
handleSelectionChange(rows) {
this.selectedIds = rows.map(function (item) {
return item.id
})
},
yearChange() {
return $.get("/platform/mutualInsurance/roster/listProject", {year: this.pageForm.year}).then((resp) => {
if (resp.code === 0) {
this.projectOptions = resp.data || []
if (this.projectOptions.length > 0) {
this.$set(this.pageForm, "projectId", this.projectOptions[0].id)
} else {
this.$set(this.pageForm, "projectId", "")
}
this.doSearch()
} else {
this.notifyError(resp.msg)
}
})
},
pageData() {
this.tableLoading = true
return $.post("/platform/mutualInsurance/roster/pageData", this.pageForm).then((resp) => {
if (resp.code === 0) {
this.tableData = resp.data.list || []
this.pageForm.totalCount = resp.data.totalCount || 0
this.selectedIds = []
} else {
this.notifyError(resp.msg)
}
}).always(() => {
this.tableLoading = false
})
},
doSearch() {
this.pageForm.pageNumber = 1
return this.pageData()
},
flushUnits() {
this.$set(this.pageForm, "unitId", "")
if (this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN"])) {
this.$businessTool.listUnit(this.pageForm.unionId).then((res) => {
this.units = res
})
} else {
this.$businessTool.listUnit().then((res) => {
this.units = res
})
}
this.doSearch()
},
openImport() {
if (!this.pageForm.projectId) {
this.notifyWarning("请先选择事项")
return
}
this.importVisible = true
},
openAddUser() {
if (!this.pageForm.year || !this.pageForm.projectId) {
this.notifyWarning("请先选择年度、事项名称")
return
}
this.resetAddUserPageForm()
this.addUserPageForm.year = this.pageForm.year
this.addUserPageForm.projectId = this.pageForm.projectId
this.addUserVisible = true
this.$businessTool.listUnion().then((res) => {
this.addUserUnionOptions = res
})
if (this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN"])) {
this.$businessTool.listUnit(this.addUserPageForm.unionId).then((res) => {
this.addUserUnitOptions = res
})
} else {
this.$businessTool.listUnit().then((res) => {
this.addUserUnitOptions = res
})
}
this.addUserPageData()
},
resetAddUserPageForm() {
this.addUserPageForm = {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
year: "",
projectId: "",
userName: "",
loginName: "",
sex: "",
birthday: "",
birthMonths: [],
unionId: "",
unitIds: [],
personTypes: [],
preparedBys: [],
userStates: [],
isMember: null
}
this.addUserTableData = []
},
addUserUnionChange() {
this.$set(this.addUserPageForm, "unitIds", [])
if (this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN"])) {
this.$businessTool.listUnit(this.addUserPageForm.unionId).then((res) => {
this.addUserUnitOptions = res
})
}
},
addUserPageData() {
this.addUserTableLoading = true
return $.post("/platform/mutualInsurance/roster/notRosterUserPageData", {
pageForm: JSON.stringify(this.addUserPageForm)
}).then((resp) => {
if (resp.code === 0) {
this.addUserTableData = resp.data.list || []
this.addUserPageForm.totalCount = resp.data.totalCount || 0
} else {
this.notifyError(resp.msg)
}
}).always(() => {
this.addUserTableLoading = false
})
},
addUserDoSearch() {
this.addUserPageForm.pageNumber = 1
this.addUserPageData()
},
addUserIndexMethod(index) {
return (this.addUserPageForm.pageNumber - 1) * this.addUserPageForm.pageSize + index + 1
},
submitAddUser() {
if (!this.pageForm.year || !this.pageForm.projectId) {
this.notifyWarning("请先选择年度、事项名称")
return
}
this.addUserPageForm.year = this.pageForm.year
this.addUserPageForm.projectId = this.pageForm.projectId
this.$confirm("当前筛选出" + (this.addUserPageForm.totalCount || 0) + "条数据,确认添加到人员名单吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
const loading = this.$loading({
lock: true,
text: "数据保存中,请稍后...",
spinner: "el-icon-loading"
})
$.post("/platform/mutualInsurance/roster/addRosterUser", {
pageForm: JSON.stringify(this.addUserPageForm)
}).then((resp) => {
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.addUserVisible = false
this.doSearch()
} else {
this.notifyError(resp.msg)
}
}).always(() => {
loading.close()
})
})
},
doAuditByUnion(flag) {
if (this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN"]) && !this.pageForm.unionId) {
this.notifyWarning("请选择需要确认的分工会")
return
}
const msg = flag ? "确定按当前事项和分工会确认名单吗?" : "确定按当前事项和分工会取消确认吗?"
this.$confirm(msg, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
$.post("/platform/mutualInsurance/roster/doAuditUser", {
projectId: this.pageForm.projectId,
unionId: this.pageForm.unionId,
flag: flag
}).then((resp) => {
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.doSearch()
} else {
this.notifyError(resp.msg)
}
})
})
},
doAuditSelected(flag) {
const msg = flag ? "确定确认勾选人员吗?" : "确定取消确认勾选人员吗?"
this.$confirm(msg, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
$.post("/platform/mutualInsurance/roster/doAuditSelected", {
ids: this.selectedIds.join(","),
flag: flag
}).then((resp) => {
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.doSearch()
} else {
this.notifyError(resp.msg)
}
})
})
},
exportData() {
const form = this.pageForm
window.open("/platform/mutualInsurance/roster/exportRoster?year=" + encodeURIComponent(form.year || "") +
"&projectId=" + encodeURIComponent(form.projectId || "") +
"&unionId=" + encodeURIComponent(form.unionId || "") +
"&unitId=" + encodeURIComponent(form.unitId || "") +
"&searchKeyword=" + encodeURIComponent(form.searchKeyword || "") +
"&isAudit=" + encodeURIComponent(form.isAudit || ""))
},
validateFeedbackCondition() {
if (!this.pageForm.year || !this.pageForm.projectId || !this.pageForm.unionId) {
this.notifyWarning("请先选择年度、事项、所属工会")
return false
}
return true
},
openFeedback() {
if (!this.validateFeedbackCondition()) {
return
}
this.feedbackForm.year = this.pageForm.year
this.feedbackForm.projectId = this.pageForm.projectId
this.feedbackForm.unionId = this.pageForm.unionId
this.feedbackForm.feedbackInfo = ""
this.queryFeedbackList().then(() => {
this.feedbackDialog = true
})
},
queryFeedbackList() {
return $.get("/platform/mutualInsurance/roster/feedbackList", {
year: this.pageForm.year,
projectId: this.pageForm.projectId,
unionId: this.pageForm.unionId
}).then((resp) => {
if (resp.code === 0) {
this.feedbackList = resp.data || []
} else {
this.notifyError(resp.msg)
}
})
},
saveFeedback() {
if (!this.validateFeedbackCondition()) {
return
}
if (!this.feedbackForm.feedbackInfo) {
this.notifyWarning("请输入反馈信息")
return
}
this.feedbackLoading = true
$.post("/platform/mutualInsurance/roster/saveFeedback", this.feedbackForm).then((resp) => {
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.feedbackForm.feedbackInfo = ""
this.queryFeedbackList()
} else {
this.notifyError(resp.msg)
}
}).always(() => {
this.feedbackLoading = false
})
},
deleteFeedback(row) {
this.$confirm("确认删除这条反馈吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
$.post("/platform/mutualInsurance/roster/deleteFeedback", {id: row.id}).then((resp) => {
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.queryFeedbackList()
} else {
this.notifyError(resp.msg)
}
})
})
},
deleteSelected() {
this.$confirm("确认删除勾选人员吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
$.post("/platform/mutualInsurance/roster/deleteSelected", {
ids: this.selectedIds.join(",")
}).then((resp) => {
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.doSearch()
} else {
this.notifyError(resp.msg)
}
})
})
}
},
created() {
this.$businessTool.listUnion().then((res) => {
this.unions = res
if (!this.pageForm.unionId && this.unions && this.unions.length === 1) {
this.pageForm.unionId = this.unions[0].id
}
})
this.flushUnits()
this.yearChange()
}
})
</script>
<!--#
}
#-->