This commit is contained in:
那些花儿
2025-10-16 18:25:14 +08:00
parent 45ee9b7285
commit fbcee4d894
48 changed files with 2559 additions and 326 deletions
@@ -207,4 +207,7 @@ public class View_user {
@Column
private String clubIds;
@Column
private Boolean aidFundMember;
}
@@ -1,83 +0,0 @@
package com.budwk.app.zhgh.dayofficework.fund.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.dayofficework.fund.service.FundMemberService;
import io.swagger.annotations.Api;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
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 javax.servlet.http.HttpServletResponse;
@IocBean
@At("/platform/fundMember/query")
@Ok("json:full")
@Api(tags = "基金会员-查询")
public class FundMemberQueryController {
@Inject
private FundMemberService fundMemberService;
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/fundMember/query/index.html")
@SaCheckPermission("fundMember.query")
public void index() {
}
@At
@SaCheckPermission("fundMember.query")
public Result pageData(PageForm pageForm, Integer year) {
Sql sql = Sqls.create("""
SELECT
info.*,
ins.id AS instanceId,
ins.businessNo,
ins.state instanceState,
ins.variable instanceVariable,
ins.processDefineId instanceProcessDefineId,
t.id taskId,
t.taskName AS taskKey,
t.displayName taskName,
t.taskType,
t.performType taskPerformType,
t.taskState,
t.finishTime,
t.taskParentId
FROM
fund_member info
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
$condition
""");
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("info.userName", pageForm.getSearchKeyword());
seg.orLike("info.loginName", pageForm.getSearchKeyword());
cnd.and(seg);
}
cnd.andEX("YEAR(info.submitTime)", "=", year);
sql.setCondition(cnd);
Pagination pagination = fundMemberService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@SaCheckPermission("fundMember.query")
@Ok("void")
public void exportExcel(Integer year, HttpServletResponse response) {
}
}
@@ -0,0 +1,164 @@
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
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.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.model.ExcelImportRes;
import com.budwk.app.base.page.Pagination;
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.sys.models.Sys_user;
import com.budwk.app.zhgh.dayofficework.fund.member.mode.FundMemberImportExcelMode;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberChangeRecordService;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
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.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
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 java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@IocBean
@At("/platform/fundMember/batchJoin")
@Ok("json:full")
@Api("基金会员-批量加入")
public class FundMemberBatchJoinController {
@Inject
private Dao dao;
@Inject
private FundMemberService fundMemberService;
@Inject
private FundMemberChangeRecordService fundMemberChangeRecordService;
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/fund/member/batchJoin/index.html")
@SaCheckPermission("fundMember.batchJoin")
public void index() {
}
@At
@SaCheckPermission("fundMember.batchJoin")
public Result pageData(PageForm pageForm, String unionId, String unitId, String userState) {
Sql sql = Sqls.create("""
SELECT
id,
username,
loginname,
sex,
userState,
unitName,
unionName
FROM
vw_user
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("aidFundMember", "!=", 1);
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("username", pageForm.getSearchKeyword());
seg.orLike("loginname", pageForm.getSearchKeyword());
cnd.and(seg);
}
cnd.andEX("unionId", "=", unionId);
cnd.andEX("unitId", "=", unitId);
cnd.andEX("userState", "=", userState);
cnd.asc("unionName").asc("unitName").asc("id");
sql.setCondition(cnd);
Pagination pagination = fundMemberService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@SaCheckPermission("fundMember.batchJoin")
@ApiOperation("批量加入")
@SLog(tag = "基金会员-批量加入", msg = "批量加入")
public Result confirm(@Param("loginNames") String[] loginNames) {
dao.update(Sys_user.class, Chain.make("aidFundMember", 1), Cnd.where("id", "in", loginNames));
for (String loginName : loginNames) {
fundMemberChangeRecordService.insertRecord(loginName, true, "批量加入");
}
return Result.success();
}
@At
@SaCheckPermission("fundMember.batchJoin")
@ApiOperation("批量导入")
@SLog(tag = "基金会员-批量导入", msg = "批量导入")
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
public Result batchImport(@Param("file") TempFile file) {
// 读取
List<FundMemberImportExcelMode> importMembers = ExcelImportUtil.importExcel(file.getFile(), FundMemberImportExcelMode.class, new ImportParams());
// 创建结果集
ExcelImportRes<FundMemberImportExcelMode> excelImportRes = new ExcelImportRes<>();
excelImportRes.setTotalRecords(importMembers.size());
for (int i = 0; i < importMembers.size(); i++) {
FundMemberImportExcelMode member = importMembers.get(i);
if (StrUtil.isBlank(member.getLoginName())) {
member.setErrInfo("工号为空", i);
continue;
}
int count = dao.count(Sys_user.class, Cnd.where(Sys_user::getLoginname, "=", member.getLoginName()));
if (count == 0) {
member.setErrInfo("系统中查询不到该用户", i);
continue;
}
dao.update(Sys_user.class, Chain.make("aidFundMember", 1), Cnd.where(Sys_user::getLoginname, "=", member.getLoginName()));
fundMemberChangeRecordService.insertRecord(member.getLoginName(), true, "批量导入");
}
// 添加错误记录
excelImportRes.setErrorDetails(importMembers.stream().filter(s -> StrUtil.isNotBlank(s.getErrMsg())).collect(Collectors.toList()));
excelImportRes.setFailedCount(excelImportRes.getErrorDetails().size());
excelImportRes.setSuccessCount(Math.max(importMembers.size() - excelImportRes.getFailedCount(), 0));
return Result.success(excelImportRes);
}
@At
@SaCheckPermission("fundMember.batchJoin")
@Ok("void")
public void downLoadTemplate(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);
}
}
@@ -1,4 +1,4 @@
package com.budwk.app.zhgh.dayofficework.fund.controller;
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
@@ -6,12 +6,10 @@ import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.dayofficework.fund.models.FundMember;
import com.budwk.app.zhgh.dayofficework.fund.service.FundMemberService;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberService;
import io.swagger.annotations.Api;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
@@ -34,7 +32,7 @@ public class FundMemberBranchUnionApprovalController {
private FundMemberService fundMemberService;
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/fundMember/branchUnionApproval/index.html")
@Ok("beetl:/platform/zhgh/dayofficework/fund/member/branchUnionApproval/index.html")
@SaCheckPermission("fundMember.branchUnionApproval")
public void index() {
@@ -65,15 +63,15 @@ public class FundMemberBranchUnionApprovalController {
FROM
wf_process_task t
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
LEFT JOIN fund_member info ON info.id = ins.businessNo
LEFT JOIN fund_member_apply info ON info.id = ins.businessNo
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("t.taskName", "=", "fgh");
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())){
cnd.and("t.taskName", "in", List.of("fgh", "ltx"));
if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
}
@@ -0,0 +1,58 @@
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberChangeRecord;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberChangeRecordService;
import io.swagger.annotations.Api;
import org.nutz.dao.Cnd;
import org.nutz.dao.util.cri.SqlExpressionGroup;
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;
@IocBean
@At("/platform/fundMember/changeRecord")
@Ok("json:full")
@Api(tags = "基金会员变更记录")
public class FundMemberChangeRecordController {
@Inject
private FundMemberChangeRecordService fundMemberChangeRecordService;
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/fund/member/changeRecord/index.html")
@SaCheckPermission("fundMember.changeRecord")
public void index() {
}
@At
@SaCheckPermission("fundMember.changeRecord")
public Result pageData(PageForm pageForm, Integer year, String unionId, String unitId, String userState, Boolean isJoin) {
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(changeTime)", "=", year);
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("loginName", pageForm.getSearchKeyword());
seg.orLike("userName", pageForm.getSearchKeyword());
cnd.and(seg);
}
cnd.andEX(FundMemberChangeRecord::getUnionId, "=", unionId);
cnd.andEX(FundMemberChangeRecord::getUserState, "=", userState);
cnd.andEX(FundMemberChangeRecord::getIsJoin, "=", isJoin);
if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
} else {
cnd.desc(FundMemberChangeRecord::getChangeTime);
}
Pagination pagination = fundMemberChangeRecordService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
return Result.success(pagination);
}
}
@@ -1,4 +1,4 @@
package com.budwk.app.zhgh.dayofficework.fund.controller;
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil;
@@ -10,8 +10,8 @@ import com.budwk.app.flow.engine.FlowEngine;
import com.budwk.app.flow.entity.ProcessInstance;
import com.budwk.app.flow.entity.ProcessTask;
import com.budwk.app.flow.vo.ProcessTaskVO;
import com.budwk.app.zhgh.dayofficework.fund.models.FundMember;
import com.budwk.app.zhgh.dayofficework.fund.service.FundMemberService;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberApply;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberService;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import io.swagger.annotations.Api;
@@ -51,7 +51,7 @@ public class FundMemberCommonController {
@At
@SaCheckPermission("fundMember")
public Result info(@Valid String id) {
FundMember fundMember = fundMemberService.fetch(id);
FundMemberApply fundMember = fundMemberService.fetch(id);
return Result.success(fundMember);
}
@@ -60,7 +60,7 @@ public class FundMemberCommonController {
@Ok("void")
@ApiOperation("导出申请表")
public void exportDocx(@Valid String id, HttpServletResponse response) {
FundMember fundMember = dao.fetch(FundMember.class, id);
FundMemberApply fundMember = dao.fetch(FundMemberApply.class, id);
Map<String, Object> docData = BeanUtil.beanToMap(fundMember);
docData.put("birthday", DateUtil.format(fundMember.getBirthday(), "yyyy年MM月dd日"));
@@ -0,0 +1,61 @@
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberService;
import io.swagger.annotations.Api;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
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;
@IocBean
@At("/platform/fundMember/his")
@Ok("json:full")
@Api(tags = "基金会员-历史")
public class FundMemberHisController {
@Inject
private FundMemberService fundMemberService;
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/fund/member/his/index.html")
@SaCheckPermission("fundMember.his")
public void index() {
}
@At
@SaCheckPermission("fundMember.his")
public Result pageData(PageForm pageForm, Integer year, String unionId) {
Sql sql = Sqls.create("""
SELECT
his.*,
(SELECT changeTime FROM fund_member_change_record WHERE loginName = his.loginName AND isJoin = 1 ORDER BY changeTime DESC) joinTime
FROM
fund_member_his his
$condition
""");
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("username", pageForm.getSearchKeyword());
seg.orLike("loginname", pageForm.getSearchKeyword());
cnd.and(seg);
}
cnd.andEX("year", "=", year);
cnd.andEX("unionId", "=", unionId);
sql.setCondition(cnd);
Pagination pagination = fundMemberService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
}
@@ -1,14 +1,13 @@
package com.budwk.app.zhgh.dayofficework.fund.controller;
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
import com.budwk.app.flow.engine.FlowEngine;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.dayofficework.fund.models.FundMember;
import com.budwk.app.zhgh.dayofficework.fund.service.FundMemberService;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberApply;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.nutz.aop.interceptor.ioc.TransAop;
@@ -39,7 +38,7 @@ public class FundMemberMineController {
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/fundMember/mine/index.html")
@Ok("beetl:/platform/zhgh/dayofficework/fund/member/mine/index.html")
@SaCheckPermission("fundMember.mine")
public void index() {
@@ -68,7 +67,7 @@ public class FundMemberMineController {
IF((SELECT taskName FROM wf_process_task tt WHERE tt.id = t.taskParentId) = 'startTask', 1, 0) canRevoke,
(select MAX(id) from wf_process_task where processInstanceId = ins.id and taskName = 'startTask' AND taskState in (10,20)) AS startTaskId
FROM
fund_member info
fund_member_apply info
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
@@ -87,7 +86,7 @@ public class FundMemberMineController {
@ApiOperation("删除")
@SLog(tag = "基金会员-我的申请", msg = "删除")
public Result delete(@Param("id") String id) {
dao.delete(FundMember.class, id);
dao.delete(FundMemberApply.class, id);
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
return Result.success();
}
@@ -0,0 +1,235 @@
package com.budwk.app.zhgh.dayofficework.fund.member.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 com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
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.sys.models.Sys_user;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.web.commons.base.Globals;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberApply;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberHis;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberChangeRecordService;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
import org.nutz.aop.interceptor.ioc.TransAop;
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.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 javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
@IocBean
@At("/platform/fundMember/query")
@Ok("json:full")
@Api(tags = "基金会员-查询")
public class FundMemberQueryController {
@Inject
private Dao dao;
@Inject
private FundMemberService fundMemberService;
@Inject
private FundMemberChangeRecordService fundMemberChangeRecordService;
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/fund/member/query/index.html")
@SaCheckPermission("fundMember.query")
public void index() {
}
@At
@SaCheckPermission("fundMember.query")
public Result pageData(PageForm pageForm, Integer year, String unionId) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username AS userName,
u.loginname AS loginName,
u.sex,
u.birthday,
u.userState,
u.unitName,
u.unionName,
(SELECT changeTime FROM fund_member_change_record WHERE loginName = u.loginName AND isJoin = 1 ORDER BY changeTime DESC) joinTime
FROM
vw_user u
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("u.aidFundMember", "=", 1);
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("u.username", pageForm.getSearchKeyword());
seg.orLike("u.loginname", pageForm.getSearchKeyword());
cnd.and(seg);
}
cnd.andEX("u.unionId", "=", unionId);
sql.setCondition(cnd);
Pagination pagination = fundMemberService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@SaCheckPermission("fundMember.query")
@Ok("void")
@ApiOperation("导出登记汇总Excel")
public void exportExcel(Integer year, String unionId, HttpServletResponse response) {
Cnd cnd = Cnd.NEW();
cnd.and("YEAR(submitTime)", "=", year);
cnd.andEX("unionId", "=", unionId);
cnd.andEX(FundMemberApply::getIsJoin, "=", 1);
cnd.asc("unionId");
List<FundMemberApply> list = fundMemberService.query(cnd);
for (int i = 0; i < list.size(); i++) {
list.get(i).setIndex(i + 1);
}
List<ExcelExportEntity> exportEntities = new ArrayList<>();
exportEntities.add(new ExcelExportEntity("序号", "index", 10));
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
exportEntities.add(new ExcelExportEntity("分工会", "unionName", 20));
exportEntities.add(new ExcelExportEntity("性别", "sex", 10));
ExcelExportEntity birthEntity = new ExcelExportEntity("出生年月", "birthday", 20);
birthEntity.setFormat("yyyy-MM-dd");
exportEntities.add(birthEntity);
ExcelExportEntity joinWorkEntity = new ExcelExportEntity("入校工作时间", "joinWorkTime", 20);
joinWorkEntity.setFormat("yyyy-MM-dd");
exportEntities.add(joinWorkEntity);
ExcelExportEntity retireEntity = new ExcelExportEntity("退休时间", "retireTime", 20);
retireEntity.setFormat("yyyy-MM-dd");
exportEntities.add(retireEntity);
exportEntities.add(new ExcelExportEntity("身份证号码", "idCard", 20));
exportEntities.add(new ExcelExportEntity("家庭住址", "address", 30));
exportEntities.add(new ExcelExportEntity("联系电话", "mobile", 20));
String title = Globals.AppName + "教职工医疗互助“爱心”基金入会登记表";
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
exportParams.setTitle(title);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
CommonDownloadUtil.download(title + ".xlsx", workbook, response);
}
@At
@SaCheckPermission("fundMember.query")
@Ok("void")
@ApiOperation("导出新会员Excel")
public void exportNewMemberExcel(HttpServletResponse response) {
Sql sql = Sqls.create("""
SELECT
r.*
FROM
fund_member_change_record r
LEFT JOIN sys_user u ON u.loginname = r.loginName
WHERE
r.isJoin = 1
AND YEAR(r.changeTime) = @year
AND u.aidFundMember = 1
""");
sql.setParam("year", DateUtil.thisYear());
List<NutMap> list = fundMemberService.listMap(sql);
for (int i = 0; i < list.size(); i++) {
list.get(i).put("index", i + 1);
}
List<ExcelExportEntity> exportEntities = new ArrayList<>();
exportEntities.add(new ExcelExportEntity("序号", "index", 10));
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
exportEntities.add(new ExcelExportEntity("分工会", "unionName", 20));
exportEntities.add(new ExcelExportEntity("性别", "sex", 10));
ExcelExportEntity birthEntity = new ExcelExportEntity("出生年月", "birthday", 20);
birthEntity.setFormat("yyyy-MM-dd");
exportEntities.add(birthEntity);
ExcelExportEntity joinWorkEntity = new ExcelExportEntity("入校工作时间", "joinWorkTime", 20);
joinWorkEntity.setFormat("yyyy-MM-dd");
exportEntities.add(joinWorkEntity);
ExcelExportEntity retireEntity = new ExcelExportEntity("退休时间", "retireTime", 20);
retireEntity.setFormat("yyyy-MM-dd");
exportEntities.add(retireEntity);
exportEntities.add(new ExcelExportEntity("身份证号码", "idCard", 20));
exportEntities.add(new ExcelExportEntity("家庭住址", "address", 30));
exportEntities.add(new ExcelExportEntity("联系电话", "mobile", 20));
String title = Globals.AppName + "医疗互助“爱心”基金" + DateUtil.thisYear() + "年新入会教职工";
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
exportParams.setTitle(title);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
CommonDownloadUtil.download(title + ".xlsx", workbook, response);
}
@At
@SaCheckPermission("fundMember.query")
@ApiOperation("退出基金")
@Aop(TransAop.READ_COMMITTED)
public Result quit(@Valid String loginName) {
// 修改user表
dao.update(Sys_user.class, Chain.make("aidFundMember", 0), Cnd.where(Sys_user::getLoginname, "=", loginName));
// 添加变更记录
fundMemberChangeRecordService.insertRecord(loginName, false, "台账管理-退会");
return Result.success();
}
@At
@SaCheckPermission("fundMember.query")
@ApiOperation("备份")
@Aop(TransAop.READ_COMMITTED)
@SLog(tag = "基金会员-备份", msg = "备份")
public Result backup(Integer year) {
dao.clear(FundMemberHis.class, Cnd.where(FundMemberHis::getYear, "=", year));
List<View_user> list = dao.query(View_user.class, Cnd.where(View_user::getAidFundMember, "=", 1));
List<FundMemberHis> fundMemberHisList = list.stream().map(user -> {
FundMemberHis his = new FundMemberHis();
his.setYear(year);
his.setLoginName(user.getLoginname());
his.setUserName(user.getUsername());
his.setSex(user.getSex());
his.setBirthday(user.getBirthday());
his.setIdCard(user.getIdCard());
his.setMobile(user.getMobile());
his.setUnionId(user.getUnionId());
his.setUnionName(user.getUnionName());
his.setUserState(user.getUserState());
return his;
}).toList();
dao.insert(fundMemberHisList);
return Result.success();
}
}
@@ -1,4 +1,4 @@
package com.budwk.app.zhgh.dayofficework.fund.controller;
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
@@ -9,7 +9,7 @@ import com.budwk.app.base.result.Result;
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.dayofficework.fund.service.FundMemberService;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberService;
import io.swagger.annotations.Api;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
@@ -32,7 +32,7 @@ public class FundMemberSchoolUnionApprovalController {
private FundMemberService fundMemberService;
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/fundMember/schoolUnionApproval/index.html")
@Ok("beetl:/platform/zhgh/dayofficework/fund/member/schoolUnionApproval/index.html")
@SaCheckPermission("fundMember.schoolUnionApproval")
public void index() {
@@ -63,7 +63,7 @@ public class FundMemberSchoolUnionApprovalController {
FROM
wf_process_task t
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
LEFT JOIN fund_member info ON info.id = ins.businessNo
LEFT JOIN fund_member_apply info ON info.id = ins.businessNo
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
@@ -1,7 +1,6 @@
package com.budwk.app.zhgh.dayofficework.fund.controller;
package com.budwk.app.zhgh.dayofficework.fund.member.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.lang.Dict;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.result.Result;
@@ -12,8 +11,7 @@ import com.budwk.app.flow.entity.ProcessTask;
import com.budwk.app.flow.enums.ProcessSubmitTypeEnum;
import com.budwk.app.flow.service.FlowCommonService;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.dayofficework.fund.models.FundMember;
import com.budwk.app.zhgh.democratic.suggestionBox.models.SuggestionBox;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberApply;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.nutz.aop.interceptor.ioc.TransAop;
@@ -42,7 +40,7 @@ public class FundMemberWriteController {
private FlowCommonService flowCommonService;
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/fundMember/write/index.html")
@Ok("beetl:/platform/zhgh/dayofficework/fund/member/write/index.html")
@SaCheckPermission("fundMember.write")
public void index() {
@@ -52,7 +50,7 @@ public class FundMemberWriteController {
@SaCheckPermission("fundMember.write")
@ApiOperation("保存申请")
@SLog(tag = "建言献策-填写申请", msg = "保存申请")
public Result save(@Param("data") FundMember fundMember) {
public Result save(@Param("data") FundMemberApply fundMember) {
dao.insertOrUpdate(fundMember);
return Result.success();
}
@@ -63,8 +61,9 @@ public class FundMemberWriteController {
@ApiOperation("提交申请")
@Aop(TransAop.READ_COMMITTED)
@SLog(tag = "基金会员-填写申请", msg = "提交申请")
public Result submit(@Param("data") FundMember fundMember) {
public Result submit(@Param("data") FundMemberApply fundMember) {
fundMember.setSubmitTime(new Date());
fundMember.setIsJoin(true);
dao.insertOrUpdate(fundMember);
// 开启流程实例
Dict args = Dict.create();
@@ -85,7 +84,7 @@ public class FundMemberWriteController {
@ApiOperation("重新提交申请")
@Aop(TransAop.READ_COMMITTED)
@SLog(tag = "基金会员-填写申请", msg = "重新提交申请")
public Result submitAgain(@Param("data") FundMember fundMember, @Param("taskId") Long taskId) {
public Result submitAgain(@Param("data") FundMemberApply fundMember, @Param("taskId") Long taskId) {
dao.insertOrUpdate(fundMember);
Dict dict = Dict.create();
@@ -99,7 +98,7 @@ public class FundMemberWriteController {
@SaCheckPermission("fundMember.write")
@ApiOperation("获取申请信息")
public Result info(@Param("id") String id) {
FundMember box = dao.fetch(FundMember.class, id);
FundMemberApply box = dao.fetch(FundMemberApply.class, id);
return Result.success(box);
}
@@ -0,0 +1,37 @@
package com.budwk.app.zhgh.dayofficework.fund.member.interceptor;
import cn.hutool.core.bean.BeanUtil;
import com.budwk.app.flow.engine.FlowInterceptor;
import com.budwk.app.flow.engine.core.Execution;
import com.budwk.app.flow.engine.core.ServiceContext;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberApply;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberChangeRecord;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.aop.Aop;
import org.nutz.json.Json;
import java.util.Date;
/**
* 基金会员审核通过拦截器
*/
public class FundMemberPassInterceptor implements FlowInterceptor {
@Override
@Aop(TransAop.READ_COMMITTED)
public void intercept(Execution execution) {
Dao dao = ServiceContext.find(Dao.class);
FundMemberApply fundMemberApply = Json.fromJson(FundMemberApply.class, execution.getArgs().getStr("f_data"));
// 修改基金会员状态
dao.update(Sys_user.class, Chain.make("aidFundMember", 1), Cnd.where(Sys_user::getLoginname, "=", fundMemberApply.getLoginName()));
// 添加到变更记录
FundMemberChangeRecord record = BeanUtil.copyProperties(fundMemberApply, FundMemberChangeRecord.class, "id");
record.setId(null);
record.setChangeOrigin("流程申请");
record.setChangeTime(new Date());
dao.insert(record);
}
}
@@ -0,0 +1,18 @@
package com.budwk.app.zhgh.dayofficework.fund.member.mode;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.budwk.app.base.model.ExcelImportError;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class FundMemberImportExcelMode extends ExcelImportError {
@Excel(name = "工号")
private String loginName;
@Excel(name = "姓名")
private String userName;
}
@@ -1,5 +1,6 @@
package com.budwk.app.zhgh.dayofficework.fund.models;
package com.budwk.app.zhgh.dayofficework.fund.member.models;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -9,11 +10,11 @@ import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.Date;
@Data
@Table("fund_member")
@Table("fund_member_apply")
@EqualsAndHashCode(callSuper = true)
@TableMeta("{'mysql-charset':'utf8mb4'}")
@Comment("基金会员")
public class FundMember extends BaseModel {
public class FundMemberApply extends BaseModel {
@Name
@Comment("ID")
@@ -21,16 +22,16 @@ public class FundMember extends BaseModel {
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("工号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String loginName;
@Column
@Comment("姓名")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String userName;
@Column
@Comment("工资号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String loginName;
@Column
@Comment("性别")
@ColDefine(type = ColType.VARCHAR, width = 10)
@@ -76,6 +77,21 @@ public class FundMember extends BaseModel {
@ColDefine(type = ColType.VARCHAR, width = 100)
private String avatar;
@Column
@Comment("分工会ID")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String unionId;
@Column
@Comment("分工会名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String unionName;
@Column
@Comment("用户状态")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String userState;
@Column
@Comment("加入、退出")
@ColDefine(type = ColType.BOOLEAN)
@@ -87,4 +103,7 @@ public class FundMember extends BaseModel {
@ColDefine(type = ColType.DATETIME)
private Date submitTime;
@Excel(name = "序号")
private Integer index;
}
@@ -0,0 +1,110 @@
package com.budwk.app.zhgh.dayofficework.fund.member.models;
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.util.Date;
@Data
@Table("fund_member_change_record")
@EqualsAndHashCode(callSuper = true)
@TableMeta("{'mysql-charset':'utf8mb4'}")
@Comment("基金会员变更记录")
public class FundMemberChangeRecord extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("工号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String loginName;
@Column
@Comment("姓名")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String userName;
@Column
@Comment("性别")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String sex;
@Column
@Comment("出生日期")
@ColDefine(type = ColType.DATE)
private Date birthday;
@Column
@Comment("身份证号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String idCard;
@Column
@Comment("参加工作时间")
@ColDefine(type = ColType.DATE)
private Date joinWorkTime;
@Column
@Comment("退休时间")
@ColDefine(type = ColType.DATE)
private Date retireTime;
@Column
@Comment("家庭住址")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String address;
@Column
@Comment("手机号码")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String mobile;
@Column
@Comment("住宅号码")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String homePhone;
@Column
@Comment("照片")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String avatar;
@Column
@Comment("分工会ID")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String unionId;
@Column
@Comment("分工会名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String unionName;
@Column
@Comment("用户状态")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String userState;
@Column
@Comment("加入、退出")
@ColDefine(type = ColType.BOOLEAN)
@Default("1")
private Boolean isJoin;
@Column
@Comment("变更来源")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String changeOrigin;
@Column
@Comment("变更时间")
@ColDefine(type = ColType.DATETIME)
private Date changeTime;
}
@@ -0,0 +1,103 @@
package com.budwk.app.zhgh.dayofficework.fund.member.models;
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.util.Date;
@Data
@Table("fund_member_his")
@EqualsAndHashCode(callSuper = true)
@TableMeta("{'mysql-charset':'utf8mb4'}")
@Comment("基金会员历史台账")
@TableIndexes(value = {
@Index(name = "IDX_FUND_MEMBER_HIS_YEAR", fields = {"year"}, unique = false),
@Index(name = "IDX_FUND_MEMBER_HIS_LOGIN_NAME", fields = {"loginName"}, unique = false)
})
public class FundMemberHis extends BaseModel {
@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("工号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String loginName;
@Column
@Comment("姓名")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String userName;
@Column
@Comment("性别")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String sex;
@Column
@Comment("出生日期")
@ColDefine(type = ColType.DATE)
private Date birthday;
@Column
@Comment("身份证号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String idCard;
@Column
@Comment("参加工作时间")
@ColDefine(type = ColType.DATE)
private Date joinWorkTime;
@Column
@Comment("退休时间")
@ColDefine(type = ColType.DATE)
private Date retireTime;
@Column
@Comment("家庭住址")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String address;
@Column
@Comment("手机号码")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String mobile;
@Column
@Comment("住宅号码")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String homePhone;
@Column
@Comment("照片")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String avatar;
@Column
@Comment("分工会ID")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String unionId;
@Column
@Comment("分工会名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String unionName;
@Column
@Comment("用户状态")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String userState;
}
@@ -0,0 +1,16 @@
package com.budwk.app.zhgh.dayofficework.fund.member.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberChangeRecord;
public interface FundMemberChangeRecordService extends BaseService<FundMemberChangeRecord> {
/**
* 插入一条记录
* @param loginName 工号
* @param isJoin 加入\退出
* @param changeOrigin 来源
*/
void insertRecord(String loginName, boolean isJoin, String changeOrigin);
}
@@ -0,0 +1,7 @@
package com.budwk.app.zhgh.dayofficework.fund.member.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberApply;
public interface FundMemberService extends BaseService<FundMemberApply> {
}
@@ -0,0 +1,40 @@
package com.budwk.app.zhgh.dayofficework.fund.member.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberChangeRecord;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberChangeRecordService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
import java.util.Date;
@IocBean(args = {"refer:dao"})
public class FundMemberChangeRecordServiceImpl extends BaseServiceImpl<FundMemberChangeRecord> implements FundMemberChangeRecordService {
public FundMemberChangeRecordServiceImpl(Dao dao) {
super(dao);
}
@Override
public void insertRecord(String loginName, boolean isJoin, String changeOrigin) {
View_user user = dao().fetch(View_user.class, Cnd.where(View_user::getLoginname, "=", loginName));
FundMemberChangeRecord record = new FundMemberChangeRecord();
record.setLoginName(user.getLoginname());
record.setUserName(user.getUsername());
record.setSex(user.getSex());
record.setBirthday(user.getBirthday());
record.setIdCard(user.getIdCard());
// record.setJoinWorkTime(user.getArrivalAtSchoolDate());
// record.setRetireTime(user.getRetireTime());
record.setUnionId(user.getUnionId());
record.setUnionName(user.getUnionName());
record.setUserState(user.getUserState());
record.setIsJoin(isJoin);
record.setChangeOrigin(changeOrigin);
record.setChangeTime(new Date());
insert(record);
}
}
@@ -1,13 +1,13 @@
package com.budwk.app.zhgh.dayofficework.fund.service.impl;
package com.budwk.app.zhgh.dayofficework.fund.member.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.dayofficework.fund.models.FundMember;
import com.budwk.app.zhgh.dayofficework.fund.service.FundMemberService;
import com.budwk.app.zhgh.dayofficework.fund.member.models.FundMemberApply;
import com.budwk.app.zhgh.dayofficework.fund.member.service.FundMemberService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
@IocBean(args = {"refer:dao"})
public class FundMemberServiceImpl extends BaseServiceImpl<FundMember> implements FundMemberService {
public class FundMemberServiceImpl extends BaseServiceImpl<FundMemberApply> implements FundMemberService {
public FundMemberServiceImpl(Dao dao) {
super(dao);
}
@@ -1,7 +0,0 @@
package com.budwk.app.zhgh.dayofficework.fund.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.dayofficework.fund.models.FundMember;
public interface FundMemberService extends BaseService<FundMember> {
}
@@ -0,0 +1,22 @@
package com.budwk.app.zhgh.dayofficework.fund.subsidy.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.annotations.Api;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
@IocBean
@At("/platform/fundSubsidy/analysis")
@Ok("json:full")
@Api(tags = "基金会员补助-分析")
public class FundSubsidyAnalysisController {
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/fund/subsidy/analysis/index.html")
@SaCheckPermission("fundSubsidy.analysis")
public void index() {
}
}
@@ -0,0 +1,240 @@
package com.budwk.app.zhgh.dayofficework.fund.subsidy.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
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.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
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.base.utils.SysOfficeTemplateUtil;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.zhgh.dayofficework.fund.subsidy.mode.FundSubsidyBasicExcelMode;
import com.budwk.app.zhgh.dayofficework.fund.subsidy.mode.FundSubsidyExcelMode;
import com.budwk.app.zhgh.dayofficework.fund.subsidy.models.FundSubsidy;
import com.budwk.app.zhgh.dayofficework.fund.subsidy.service.FundSubsidyService;
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.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
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 java.io.InputStream;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
@IocBean
@At("/platform/fundSubsidy/query")
@Ok("json:full")
@Api(tags = "基金会员补助-查询")
@Slf4j
public class FundSubsidyQueryController {
@Inject
private Dao dao;
@Inject
private FundSubsidyService fundSubsidyService;
@Inject
private SysOfficeTemplateUtil sysOfficeTemplateUtil;
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/fund/subsidy/query/index.html")
@SaCheckPermission("fundSubsidy.query")
public void index() {
}
@At
@SaCheckPermission("fundSubsidy.query")
public Result pageData(PageForm pageForm, Integer year, String unionId, String unitId) {
Cnd cnd = Cnd.NEW();
cnd.andEX(FundSubsidy::getYear, "=", year);
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("loginName", pageForm.getSearchKeyword());
seg.orLike("userName", pageForm.getSearchKeyword());
cnd.and(seg);
}
cnd.andEX(FundSubsidy::getUnionId, "=", unionId);
List<FundSubsidy> list = fundSubsidyService.query(cnd);
return Result.success(list);
}
@At
@SaCheckPermission("fundSubsidy.query")
@Ok("void")
public void exportExcel(Integer year, HttpServletResponse response) {
Cnd cnd = Cnd.NEW();
cnd.andEX(FundSubsidy::getYear, "=", year);
List<FundSubsidy> list = fundSubsidyService.query(cnd);
List<ExcelExportEntity> exportEntities = new ArrayList<>();
exportEntities.add(new ExcelExportEntity("序号", "index", 10));
exportEntities.add(new ExcelExportEntity("单位", "unitName", 20));
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
exportEntities.add(new ExcelExportEntity("门诊费用", "outpatientCost", 20));
exportEntities.add(new ExcelExportEntity("住院费用", "hospitalCost", 20));
exportEntities.add(new ExcelExportEntity("合计", "totalCost", 20));
exportEntities.add(new ExcelExportEntity("不予补助金额", "noSubsidyCost", 20));
exportEntities.add(new ExcelExportEntity("门诊医保已报金额", "outpatientMedicalInsuranceReportedCost", 20));
exportEntities.add(new ExcelExportEntity("住院医保已报金额", "hospitalMedicalInsuranceReportedCost", 20));
exportEntities.add(new ExcelExportEntity("自费金额", "selfCost", 20));
exportEntities.add(new ExcelExportEntity("补助金额", "subsidyCost", 20));
HashMap<String, Object> excelData = new HashMap<>();
excelData.put("list", list);
// 合计补助金额
list.stream().map(FundSubsidy::getSubsidyCost).reduce(BigDecimal::add).ifPresent(total -> {
excelData.put("totalSubsidyCost", total);
});
try {
InputStream is = sysOfficeTemplateUtil.getTemplate("fundSubsidy");
TemplateExportParams exportParams = new TemplateExportParams(is, null);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, excelData);
CommonDownloadUtil.download(year + "医疗互助“爱心”基金补助申请公示表.xlsx", workbook, response);
} catch (Exception e) {
e.printStackTrace();
log.error("导出基金会员补助失败,{}", e.getMessage());
}
}
@At
@SaCheckPermission("fundSubsidy.query")
@ApiOperation("导入")
@SLog(tag = "爱心补助-导入", msg = "导入")
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
public Result importExcel(@Param("file") TempFile file) {
// 读取
List<FundSubsidyExcelMode> importMembers = ExcelImportUtil.importExcel(file.getFile(), FundSubsidyExcelMode.class, new ImportParams());
// 创建结果集
ExcelImportRes<FundSubsidyExcelMode> excelImportRes = new ExcelImportRes<>();
excelImportRes.setTotalRecords(importMembers.size());
for (int i = 0; i < importMembers.size(); i++) {
FundSubsidyExcelMode subsidy = importMembers.get(i);
if (subsidy.getYear() == null) {
subsidy.setErrInfo("请填写年度", i);
continue;
}
if (StrUtil.isBlank(subsidy.getLoginName())) {
subsidy.setErrInfo("工号为空", i);
continue;
}
if (StrUtil.isBlank(subsidy.getUserName())) {
subsidy.setErrInfo("姓名为空", i);
continue;
}
if (StrUtil.isBlank(subsidy.getUnitName())) {
subsidy.setErrInfo("单位为空", i);
continue;
}
if (subsidy.getOutpatientCost() == null) {
subsidy.setErrInfo("门诊费用为空", i);
continue;
}
if (subsidy.getHospitalCost() == null) {
subsidy.setErrInfo("住院费用为空", i);
continue;
}
if (subsidy.getTotalCost() == null) {
subsidy.setErrInfo("合计为空", i);
continue;
}
if (subsidy.getNoSubsidyCost() == null) {
subsidy.setErrInfo("不予补助金额为空", i);
continue;
}
if (subsidy.getOutpatientMedicalInsuranceReportedCost() == null) {
subsidy.setErrInfo("门诊医保已报金额为空", i);
continue;
}
if (subsidy.getHospitalMedicalInsuranceReportedCost() == null) {
subsidy.setErrInfo("住院医保已报金额为空", i);
continue;
}
if (subsidy.getSelfCost() == null) {
subsidy.setErrInfo("自费金额为空", i);
continue;
}
if (subsidy.getSubsidyCost() == null) {
subsidy.setErrInfo("补助金额为空", i);
continue;
}
View_user user = dao.fetch(View_user.class, Cnd.where(Sys_user::getLoginname, "=", subsidy.getLoginName()));
if (user == null) {
subsidy.setErrInfo("系统中查询不到该用户", i);
continue;
}
FundSubsidy fundSubsidy = BeanUtil.copyProperties(subsidy, FundSubsidy.class);
fundSubsidy.setUnitId(user.getUnitId());
fundSubsidy.setUnionId(user.getUnionId());
fundSubsidy.setUnitName(user.getUnitName());
fundSubsidy.setUnionName(user.getUnionName());
dao.insert(fundSubsidy);
}
// 添加错误记录
excelImportRes.setErrorDetails(importMembers.stream().filter(s -> StrUtil.isNotBlank(s.getErrMsg())).collect(Collectors.toList()));
excelImportRes.setFailedCount(excelImportRes.getErrorDetails().size());
excelImportRes.setSuccessCount(Math.max(importMembers.size() - excelImportRes.getFailedCount(), 0));
return Result.success(excelImportRes);
}
@At
@SaCheckPermission("fundSubsidy.query")
@Ok("void")
public void downloadTemplate(HttpServletResponse response) {
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
List<FundSubsidyBasicExcelMode> list = new ArrayList<>();
list.add(new FundSubsidyBasicExcelMode());
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, FundSubsidyBasicExcelMode.class, list);
CommonDownloadUtil.download("医疗互助“爱心”基金补助导入模板.xlsx", workbook, response);
}
}
@@ -0,0 +1,47 @@
package com.budwk.app.zhgh.dayofficework.fund.subsidy.mode;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class FundSubsidyBasicExcelMode {
@Excel(name = "年度", orderNum = "1", width = 20)
private Integer year;
@Excel(name = "工号", orderNum = "2", width = 20)
private String loginName;
@Excel(name = "姓名", orderNum = "3", width = 20)
private String userName;
@Excel(name = "单位", orderNum = "4", width = 20)
private String unitName;
@Excel(name = "门诊费用", orderNum = "5", numFormat = "0.00", width = 20)
private BigDecimal outpatientCost;
@Excel(name = "住院费用", orderNum = "6", numFormat = "0.00", width = 20)
private BigDecimal hospitalCost;
@Excel(name = "合计", orderNum = "7", numFormat = "0.00", width = 20)
private BigDecimal totalCost;
@Excel(name = "不予补助金额", orderNum = "8", numFormat = "0.00", width = 20)
private BigDecimal noSubsidyCost;
@Excel(name = "门诊医保已报金额", orderNum = "9", numFormat = "0.00", width = 20)
private BigDecimal outpatientMedicalInsuranceReportedCost;
@Excel(name = "住院医保已报金额", orderNum = "10", numFormat = "0.00", width = 20)
private BigDecimal hospitalMedicalInsuranceReportedCost;
@Excel(name = "自费金额", orderNum = "11", numFormat = "0.00", width = 20)
private BigDecimal selfCost;
@Excel(name = "补助金额", orderNum = "12", numFormat = "0.00", width = 20)
private BigDecimal subsidyCost;
}
@@ -0,0 +1,49 @@
package com.budwk.app.zhgh.dayofficework.fund.subsidy.mode;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.budwk.app.base.model.ExcelImportError;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
@EqualsAndHashCode(callSuper = true)
@Data
public class FundSubsidyExcelMode extends ExcelImportError {
@Excel(name = "年度", orderNum = "1")
private Integer year;
@Excel(name = "工号", orderNum = "2")
private String loginName;
@Excel(name = "姓名", orderNum = "3")
private String userName;
@Excel(name = "单位", orderNum = "4")
private String unitName;
@Excel(name = "门诊费用", orderNum = "5",numFormat = "0.00")
private BigDecimal outpatientCost;
@Excel(name = "住院费用", orderNum = "6",numFormat = "0.00")
private BigDecimal hospitalCost;
@Excel(name = "合计", orderNum = "7",numFormat = "0.00")
private BigDecimal totalCost;
@Excel(name = "不予补助金额", orderNum = "8",numFormat = "0.00")
private BigDecimal noSubsidyCost;
@Excel(name = "门诊医保已报金额", orderNum = "9",numFormat = "0.00")
private BigDecimal outpatientMedicalInsuranceReportedCost;
@Excel(name = "住院医保已报金额", orderNum = "10",numFormat = "0.00")
private BigDecimal hospitalMedicalInsuranceReportedCost;
@Excel(name = "自费金额", orderNum = "11",numFormat = "0.00")
private BigDecimal selfCost;
@Excel(name = "补助金额", orderNum = "12",numFormat = "0.00")
private BigDecimal subsidyCost;
}
@@ -0,0 +1,99 @@
package com.budwk.app.zhgh.dayofficework.fund.subsidy.models;
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.math.BigDecimal;
@Data
@EqualsAndHashCode(callSuper = true)
@TableMeta("{'mysql-charset':'utf8mb4'}")
@Table("fund_subsidy")
@Comment("基金会员补助")
public class FundSubsidy extends BaseModel {
@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("工号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String loginName;
@Column
@Comment("姓名")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String userName;
@Column
@Comment("单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("单位")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String unitName;
@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(customType = "decimal(10,2)")
private BigDecimal outpatientCost;
@Column
@Comment("住院费用")
@ColDefine(customType = "decimal(10,2)")
private BigDecimal hospitalCost;
@Column
@Comment("门诊+住院费用")
@ColDefine(customType = "decimal(10,2)")
private BigDecimal totalCost;
@Column
@Comment("不予补助金额")
@ColDefine(customType = "decimal(10,2)")
private BigDecimal noSubsidyCost;
@Column
@Comment("门诊医保已报金额")
@ColDefine(customType = "decimal(10,2)")
private BigDecimal outpatientMedicalInsuranceReportedCost;
@Column
@Comment("住院医保已报金额")
@ColDefine(customType = "decimal(10,2)")
private BigDecimal hospitalMedicalInsuranceReportedCost;
@Column
@Comment("自费金额")
@ColDefine(customType = "decimal(10,2)")
private BigDecimal selfCost;
@Column
@Comment("补助金额")
@ColDefine(customType = "decimal(10,2)")
private BigDecimal subsidyCost;
}
@@ -0,0 +1,7 @@
package com.budwk.app.zhgh.dayofficework.fund.subsidy.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.dayofficework.fund.subsidy.models.FundSubsidy;
public interface FundSubsidyService extends BaseService<FundSubsidy> {
}
@@ -0,0 +1,14 @@
package com.budwk.app.zhgh.dayofficework.fund.subsidy.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.dayofficework.fund.subsidy.models.FundSubsidy;
import com.budwk.app.zhgh.dayofficework.fund.subsidy.service.FundSubsidyService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
@IocBean(args = {"refer:dao"})
public class FundSubsidyServiceImpl extends BaseServiceImpl<FundSubsidy> implements FundSubsidyService {
public FundSubsidyServiceImpl(Dao dao) {
super(dao);
}
}
@@ -43,6 +43,13 @@ public class ProposalCommissionerController {
public void index() {
}
@At("/h5")
@Ok("beetl:/platform/zhghh5/democratic/proposal/transact/commissioner/index.html")
@SaCheckPermission("proposal.commissioner")
public void h5Index() {
}
@At
@SaCheckPermission("proposal.commissioner")
public Result pageData(@Valid ProposalSearchParam pageForm, boolean approval) {