diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml new file mode 100644 index 00000000..0984c769 --- /dev/null +++ b/dependency-reduced-pom.xml @@ -0,0 +1,170 @@ + + + 4.0.0 + com.budwk + mini + 5.6.0-plus + + + + src/main/resources + + **/* + + + + ${project.artifactId} + + + maven-compiler-plugin + 3.8.1 + + 17 + 17 + + --add-opens + java.base/java.lang=ALL-UNNAMED + + false + + + + maven-javadoc-plugin + 3.0.1 + + + attach-javadocs + + jar + + + + + UTF-8 + UTF-8 + UTF-8 + + + + maven-source-plugin + 3.0.1 + + + compile + + jar + + + + + true + + + + maven-surefire-plugin + 2.22.0 + + true + + + + org.nutz.boot + nutzboot-maven-plugin + ${nutzboot.version} + + com.budwk.app.MainLauncher + + + + + + + nutz + https://jfrog.nutz.cn/artifactory/libs-release + + + + false + + + always + + nutz-snapshots + https://jfrog.nutz.cn/artifactory/snapshots + + + + + + false + + + always + + nutz-snapshots + https://jfrog.nutz.cn/artifactory/snapshots + + + + + javax.xml + jaxrpc + 1.1 + compile + + + org.nutz + nutzboot-starter-test-junit4 + 2.6.0-SNAPSHOT + test + + + junit + junit + 4.13.1 + test + + + hamcrest-core + org.hamcrest + + + + + + + + org.nutz + nutzboot-parent + ${nutzboot.version} + pom + import + + + javax.xml.bind + jaxb-api + ${jaxb-api.version} + + + + + 4.5.0 + 1.15.3 + 8.0.28 + 1.25.0 + 1.6.2 + 4.0.0 + 2.3.1 + 1.18.34 + 2.0.8 + 1.12.2 + 4.1.2 + 3.8.1 + UTF-8 + 2.5.1 + 2.6.0-SNAPSHOT + 1.5.8 + 1.r.70-SNAPSHOT + 4.0.11 + + diff --git a/src/main/java/com/budwk/app/base/sms/impl/ncu/SmsNcuServiceImpl.java b/src/main/java/com/budwk/app/base/sms/impl/ncu/SmsNcuServiceImpl.java index 5ccaebf4..d50b92ec 100644 --- a/src/main/java/com/budwk/app/base/sms/impl/ncu/SmsNcuServiceImpl.java +++ b/src/main/java/com/budwk/app/base/sms/impl/ncu/SmsNcuServiceImpl.java @@ -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) { diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/controller/MutualInsuranceConfirmStatisticsController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/controller/MutualInsuranceConfirmStatisticsController.java new file mode 100644 index 00000000..0f31b5fe --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/controller/MutualInsuranceConfirmStatisticsController.java @@ -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 list = mutualInsuranceProjectService.query( + Cnd.NEW().andEX("year", "=", year == null ? DateUtil.thisYear() : year).desc("startTime")); + return Result.success(list); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/controller/MutualInsuranceFeedbackController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/controller/MutualInsuranceFeedbackController.java new file mode 100644 index 00000000..d0b501de --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/controller/MutualInsuranceFeedbackController.java @@ -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 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(","); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/controller/MutualInsuranceRosterController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/controller/MutualInsuranceRosterController.java new file mode 100644 index 00000000..992771df --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/controller/MutualInsuranceRosterController.java @@ -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 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 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 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 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 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(","); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/model/MutualInsuranceFeedback.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/model/MutualInsuranceFeedback.java new file mode 100644 index 00000000..cb83face --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/model/MutualInsuranceFeedback.java @@ -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; +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/model/MutualInsuranceRosterUser.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/model/MutualInsuranceRosterUser.java new file mode 100644 index 00000000..d9707ae3 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/model/MutualInsuranceRosterUser.java @@ -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; +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/param/MutualInsuranceRosterUserPageForm.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/param/MutualInsuranceRosterUserPageForm.java new file mode 100644 index 00000000..c3735bed --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/param/MutualInsuranceRosterUserPageForm.java @@ -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; +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/MutualInsuranceFeedbackService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/MutualInsuranceFeedbackService.java new file mode 100644 index 00000000..824439e1 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/MutualInsuranceFeedbackService.java @@ -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 { + + /** + * 按事项和分工会查询当前名单页的问题反馈。 + */ + List 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 listFeedbackPage(Integer pageNumber, Integer pageSize, String year, + String projectId, String unionId); +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/MutualInsuranceRosterUserService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/MutualInsuranceRosterUserService.java new file mode 100644 index 00000000..ffeb386d --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/MutualInsuranceRosterUserService.java @@ -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 { + + /** + * 查询省级互助保障人员名单,统一承载页面列表和导出数据范围。 + */ + Pagination rosterPageData(Integer pageNumber, Integer pageSize, Integer year, String projectId, + String unionId, String unitId, String searchKeyword, String isAudit); + + /** + * 查询省级互助保障人员名单,不分页,用于按当前筛选条件导出。 + */ + List rosterList(Integer year, String projectId, String unionId, String unitId, + String searchKeyword, String isAudit); + + /** + * 导入事项人员名单,并按工号从系统用户视图补齐人员基础信息。 + */ + ExcelImportRes importRoster(File file, String projectId); + + /** + * 分页查询当前筛选条件下尚未加入名单的系统人员。 + */ + Pagination 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 confirmStatistics(Integer pageNumber, Integer pageSize, Integer year, + String projectId, String unionId); +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/impl/MutualInsuranceFeedbackServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/impl/MutualInsuranceFeedbackServiceImpl.java new file mode 100644 index 00000000..f095b02f --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/impl/MutualInsuranceFeedbackServiceImpl.java @@ -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 implements MutualInsuranceFeedbackService { + + public MutualInsuranceFeedbackServiceImpl(Dao dao) { + super(dao); + } + + @Override + public List listFeedback(String year, String projectId, String unionId) { + Cnd cnd = Cnd.NEW(); + cnd.and("year", "=", year) + .and("projectId", "=", projectId) + .and("unionId", "=", unionId) + .desc("createdAt"); + List feedbackList = query(cnd); + List 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 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); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/impl/MutualInsuranceRosterUserServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/impl/MutualInsuranceRosterUserServiceImpl.java new file mode 100644 index 00000000..ce928e49 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/impl/MutualInsuranceRosterUserServiceImpl.java @@ -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 implements MutualInsuranceRosterUserService { + public MutualInsuranceRosterUserServiceImpl(Dao dao) { + super(dao); + } + + @Override + public Pagination 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 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 importRoster(File file, String projectId) { + List rows = EasyExcelUtil.syncReadModel(file, MutualInsuranceUserImportTemp.class, 0, 1); + List importRows = JSONUtil.parseArray(JSONUtil.toJsonStr(rows)).toList(MutualInsuranceUserImportTemp.class); + ExcelImportRes 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 loginNames = importRows.stream() + .map(MutualInsuranceUserImportTemp::getLoginName) + .filter(StrUtil::isNotBlank) + .map(Strings::trim) + .distinct() + .collect(Collectors.toList()); + List 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 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 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 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 rows, String msg) { + for (int i = 0; i < rows.size(); i++) { + rows.get(i).setErrInfo(msg, i + 1); + } + } + + private void fillImportResult(ExcelImportRes result, + List rows, + int successCount) { + result.setSuccessCount(successCount); + result.setErrorDetails(rows.stream().filter(row -> StrUtil.isNotBlank(row.getErrMsg())).collect(Collectors.toList())); + result.setFailedCount(result.getErrorDetails().size()); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/impl/MutualInsuranceUserServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/impl/MutualInsuranceUserServiceImpl.java index afeb074a..ef780298 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/impl/MutualInsuranceUserServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/mutualInsurance/service/impl/MutualInsuranceUserServiceImpl.java @@ -19,7 +19,6 @@ public class MutualInsuranceUserServiceImpl extends BaseServiceImpl +
+ + + +
+ + + diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/mutualInsurance/personconfirm/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/mutualInsurance/personconfirm/index.html new file mode 100644 index 00000000..7576ac12 --- /dev/null +++ b/src/main/resources/views/platform/zhgh/staffbenefit/mutualInsurance/personconfirm/index.html @@ -0,0 +1,133 @@ + +
+ + + +
+ + + diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/mutualInsurance/roster/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/mutualInsurance/roster/index.html new file mode 100644 index 00000000..2abca5c1 --- /dev/null +++ b/src/main/resources/views/platform/zhgh/staffbenefit/mutualInsurance/roster/index.html @@ -0,0 +1,649 @@ + +
+ + + + + + + + + + + + 取消 + 保存 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + +
+ + +