福利名单添加功能:
1、人员名单:添加问题反馈、按工会确认、按工会取消确认、勾选确认、勾选取消确认;及添加按钮权限控制:导入名单、添加人员、备注、删除 2、确认统计 3、事项反馈
This commit is contained in:
+52
@@ -0,0 +1,52 @@
|
||||
package com.budwk.app.zhgh.welfare.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.welfare.service.WelfareListService;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareProjectService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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/welfare/personconfirm")
|
||||
@Api("职工福利确认统计")
|
||||
@Ok("json:full")
|
||||
public class WelfareConfirmStatisticsController {
|
||||
|
||||
@Inject
|
||||
private WelfareListService welfareListService;
|
||||
@Inject
|
||||
private WelfareProjectService welfareProjectService;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/welfare/personconfirm/index.html")
|
||||
@SaCheckPermission("welfare.personconfirm")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("工会确认情况分页统计")
|
||||
@SaCheckPermission("welfare.personconfirm")
|
||||
public Result pageData(PageForm pageForm, Integer year, String projectId, String unionId) {
|
||||
return Result.success(welfareListService.confirmStatistics(
|
||||
pageForm.getPageNumber(),
|
||||
pageForm.getPageSize(),
|
||||
year,
|
||||
projectId,
|
||||
unionId
|
||||
));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("按年度查询福利项目")
|
||||
@SaCheckPermission("welfare.personconfirm")
|
||||
public Result listProject(Integer year) {
|
||||
return Result.success(welfareProjectService.getWelfareList(year == null ? DateUtil.thisYear() : year));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.budwk.app.zhgh.welfare.controller;
|
||||
|
||||
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.constant.RoleConstant;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareFeedbackService;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareListService;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareProjectService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
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;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/welfare/feedback")
|
||||
@Api("职工福利事项反馈")
|
||||
@Ok("json:full")
|
||||
public class WelfareFeedbackController {
|
||||
|
||||
@Inject
|
||||
private WelfareFeedbackService welfareFeedbackService;
|
||||
@Inject
|
||||
private WelfareProjectService welfareProjectService;
|
||||
@Inject
|
||||
private WelfareListService welfareListService;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/welfare/feedbackQuery/index.html")
|
||||
@SaCheckPermission("welfare.feedback")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("反馈列表分页")
|
||||
@SaCheckPermission("welfare.feedback")
|
||||
public Result pageData(PageForm pageForm, String year, String projectId, String unionId) {
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_WELFARE_ADMIN.name()) && StrUtil.isBlank(unionId)) {
|
||||
unionId = SecurityUtil.getUnionId();
|
||||
}
|
||||
return Result.success(welfareFeedbackService.listFeedbackPage(
|
||||
pageForm.getPageNumber(),
|
||||
pageForm.getPageSize(),
|
||||
year,
|
||||
projectId,
|
||||
unionId
|
||||
));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("批量删除反馈")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "职工福利事项反馈", msg = "批量删除反馈")
|
||||
@SaCheckPermission("welfare.feedback")
|
||||
public Result deleteFeedbackBatch(String ids) {
|
||||
String[] idArray = welfareListService.parseIds(ids);
|
||||
NutMap result = welfareFeedbackService.deleteFeedbackBatch(idArray);
|
||||
if (result.getInt("code") == 0) {
|
||||
return Result.success(result.getString("msg"));
|
||||
}
|
||||
return Result.error(result.getString("msg"));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("按年度查询福利项目")
|
||||
@SaCheckPermission("welfare.feedback")
|
||||
public Result listProject(Integer year) {
|
||||
return Result.success(welfareProjectService.getWelfareList(year == null ? DateUtil.thisYear() : year));
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,10 @@ 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.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
@@ -15,12 +17,14 @@ import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.easyexcel.EasyExcelUtil;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.welfare.mode.WelfareUserImportExcel;
|
||||
import com.budwk.app.zhgh.welfare.mode.WelfareUserTemp;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareUserSelection;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareFilterUserPageForm;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareListPageForm;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareFeedbackService;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareListService;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareProjectService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -61,6 +65,8 @@ public class WelfareListController {
|
||||
private WelfareListService welfareListService;
|
||||
@Inject
|
||||
private WelfareProjectService welfareProjectService;
|
||||
@Inject
|
||||
private WelfareFeedbackService welfareFeedbackService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/welfare/welfareUser/index.html")
|
||||
@@ -70,7 +76,6 @@ public class WelfareListController {
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@Ok("json:{dateFormat:'yyyy-MM-dd'}")
|
||||
public Result pageData(@Valid @Param("pageForm") WelfareListPageForm pageForm) {
|
||||
if (StrUtil.isBlank(pageForm.getProjectId())) {
|
||||
return Result.success(new Pagination<>(1, 10, 0, Collections.emptyList()));
|
||||
@@ -83,7 +88,7 @@ public class WelfareListController {
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("查询福利会员")
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@SaCheckPermission(value = {"welfare.list.mange","welfare.list.mange.delete"}, mode = SaMode.AND)
|
||||
@SLog(tag = "福利名单管理", msg = "管理员删除某个福利会员")
|
||||
public Result delete(String projectId, String userId, String id) {
|
||||
welfareListService.delete(id);
|
||||
@@ -100,7 +105,7 @@ public class WelfareListController {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@SaCheckPermission(value = {"welfare.list.mange","welfare.list.mange.addData"}, mode = SaMode.AND)
|
||||
@ApiOperation("添加用户到福利名单")
|
||||
public Result addWelfareUser(@Valid @Param("pageForm") WelfareFilterUserPageForm pageForm) {
|
||||
welfareListService.addWelfareUser(pageForm);
|
||||
@@ -116,7 +121,7 @@ public class WelfareListController {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@SaCheckPermission(value = {"welfare.list.mange","welfare.list.mange.updateRemark"}, mode = SaMode.AND)
|
||||
@ApiOperation("编辑备注")
|
||||
public Result updateRemark(@Param("remark") String remark, @Param("id") @Valid String id) {
|
||||
welfareListService.update(Chain.make("remark", remark), Cnd.where("id", "=", id));
|
||||
@@ -132,10 +137,82 @@ public class WelfareListController {
|
||||
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
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@SLog(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 = welfareListService.auditByProjectAndUnion(projectId, unionId, flag);
|
||||
if (result.getInt("code") == 0) {
|
||||
return Result.success(result.getString("msg"));
|
||||
}
|
||||
return Result.error(result.getString("msg"));
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@SLog(tag = "职工福利名单", msg = "按勾选人员确认或取消确认福利名单")
|
||||
public Result doAuditSelected(String ids, Boolean flag) {
|
||||
String[] idArray = welfareListService.parseIds(ids);
|
||||
if (idArray.length == 0) {
|
||||
return Result.error("请选择需要操作的人员");
|
||||
}
|
||||
welfareListService.auditSelected(idArray, flag);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
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(welfareFeedbackService.listFeedback(year, projectId, unionId));
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
public Result saveFeedback(String year, String projectId, String unionId, String feedbackInfo) {
|
||||
if (StrUtil.isBlank(unionId)) {
|
||||
unionId = SecurityUtil.getUnionId();
|
||||
}
|
||||
NutMap result = welfareFeedbackService.saveFeedback(year, projectId, unionId, feedbackInfo);
|
||||
if (result.getInt("code") == 0) {
|
||||
return Result.success(result.getString("msg"));
|
||||
}
|
||||
return Result.error(result.getString("msg"));
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
public Result deleteFeedback(String id) {
|
||||
NutMap result = welfareFeedbackService.deleteFeedback(id);
|
||||
if (result.getInt("code") == 0) {
|
||||
return Result.success(result.getString("msg"));
|
||||
}
|
||||
return Result.error(result.getString("msg"));
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@@ -192,7 +269,7 @@ public class WelfareListController {
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("welfare.list.mange")
|
||||
@SaCheckPermission(value = {"welfare.list.mange","welfare.list.mange.delete"}, mode = SaMode.AND)
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@SLog(tag = "福利名单管理", msg = "导入福利名单")
|
||||
public Result importByExcel(@Param("file") TempFile tempFile, @Param("projectId") String projectId) {
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.budwk.app.zhgh.welfare.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("welfare_feedback")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("职工福利反馈")
|
||||
public class WelfareFeedback 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;
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 福利名单
|
||||
*
|
||||
@@ -96,4 +98,19 @@ public class WelfareList extends BaseModel{
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String remark;
|
||||
|
||||
@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;
|
||||
|
||||
}
|
||||
|
||||
@@ -55,4 +55,7 @@ public class WelfareListPageForm extends PageForm {
|
||||
@ApiModelProperty("在职状态")
|
||||
private String[] userStates;
|
||||
|
||||
@ApiModelProperty("确认状态")
|
||||
private String isAudit;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.budwk.app.zhgh.welfare.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareFeedback;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface WelfareFeedbackService extends BaseService<WelfareFeedback> {
|
||||
|
||||
/**
|
||||
* Query feedback records for the roster feedback dialog.
|
||||
*/
|
||||
List<NutMap> listFeedback(String year, String projectId, String unionId);
|
||||
|
||||
/**
|
||||
* Save one feedback item and snapshot project/union names for later query pages.
|
||||
*/
|
||||
NutMap saveFeedback(String year, String projectId, String unionId, String feedbackInfo);
|
||||
|
||||
/**
|
||||
* Delete one feedback item from the roster feedback dialog.
|
||||
*/
|
||||
NutMap deleteFeedback(String id);
|
||||
|
||||
/**
|
||||
* Delete selected feedback rows from the feedback query page.
|
||||
*/
|
||||
NutMap deleteFeedbackBatch(String[] ids);
|
||||
|
||||
/**
|
||||
* Query feedback records for the standalone feedback query page.
|
||||
*/
|
||||
Pagination<NutMap> listFeedbackPage(Integer pageNumber, Integer pageSize, String year, String projectId, String unionId);
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareFilterUserPageForm;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareListPageForm;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -52,4 +53,25 @@ public interface WelfareListService extends BaseService<WelfareList> {
|
||||
* @param response
|
||||
*/
|
||||
void exportXlsx(WelfareListPageForm pageForm, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* Confirm or cancel all welfare roster rows in one project and union.
|
||||
*/
|
||||
NutMap auditByProjectAndUnion(String projectId, String unionId, Boolean flag);
|
||||
|
||||
/**
|
||||
* Confirm or cancel selected welfare roster rows by list ids.
|
||||
*/
|
||||
void auditSelected(String[] ids, Boolean flag);
|
||||
|
||||
/**
|
||||
* Summarize welfare roster confirmation progress by union.
|
||||
*/
|
||||
Pagination<NutMap> confirmStatistics(Integer pageNumber, Integer pageSize, Integer year,
|
||||
String projectId, String unionId);
|
||||
|
||||
/**
|
||||
* Parse comma-separated or JSON-array id values posted by list pages.
|
||||
*/
|
||||
String[] parseIds(String ids);
|
||||
}
|
||||
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
package com.budwk.app.zhgh.welfare.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.welfare.model.WelfareFeedback;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProject;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareFeedbackService;
|
||||
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 WelfareFeedbackServiceImpl extends BaseServiceImpl<WelfareFeedback> implements WelfareFeedbackService {
|
||||
|
||||
public WelfareFeedbackServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> listFeedback(String year, String projectId, String unionId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("year", "=", year)
|
||||
.and("projectId", "=", projectId)
|
||||
.and("unionId", "=", unionId)
|
||||
.desc("createdAt");
|
||||
List<WelfareFeedback> feedbackList = query(cnd);
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
for (WelfareFeedback 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", "请输入反馈信息");
|
||||
}
|
||||
|
||||
WelfareProject project = dao().fetch(WelfareProject.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", "当前分工会不存在,请重新选择");
|
||||
}
|
||||
|
||||
WelfareFeedback feedback = new WelfareFeedback();
|
||||
feedback.setYear(year);
|
||||
feedback.setProjectId(projectId);
|
||||
feedback.setProjectName(project.getName());
|
||||
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不能为空");
|
||||
}
|
||||
WelfareFeedback feedback = fetch(id);
|
||||
if (feedback == null) {
|
||||
return NutMap.NEW().addv("code", 1).addv("msg", "反馈记录不存在");
|
||||
}
|
||||
delete(id);
|
||||
return NutMap.NEW().addv("code", 0).addv("msg", "删除成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap deleteFeedbackBatch(String[] ids) {
|
||||
if (ids == null || ids.length == 0) {
|
||||
return NutMap.NEW().addv("code", 1).addv("msg", "请选择需要删除的反馈");
|
||||
}
|
||||
clear(Cnd.where("id", "in", ids));
|
||||
return NutMap.NEW().addv("code", 0).addv("msg", "批量删除成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination<NutMap> listFeedbackPage(Integer pageNumber, Integer pageSize, String year, String projectId, String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
feedback.id,
|
||||
feedback.year,
|
||||
feedback.projectName,
|
||||
feedback.unionName,
|
||||
feedback.feedbackInfo,
|
||||
feedback.createdAt,
|
||||
user.username AS createdByName
|
||||
FROM welfare_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);
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,10 @@ 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.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
@@ -389,7 +391,7 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
|
||||
t2.loginname,
|
||||
t2.username,
|
||||
t2.sex,
|
||||
t2.birthday
|
||||
DATE_FORMAT(t2.birthday,'%Y-%m-%d') birthday
|
||||
FROM
|
||||
`welfare_list` t1
|
||||
LEFT JOIN `vw_user` t2 ON t2.id = t1.userId
|
||||
@@ -416,6 +418,7 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
|
||||
cnd.andEX("t1.personType", "in", pageForm.getPersonTypes());
|
||||
cnd.andEX("t1.preparedBy", "in", pageForm.getPreparedBys());
|
||||
cnd.andEX("t1.userState", "in", pageForm.getUserStates());
|
||||
appendAuditFilter(cnd, pageForm.getIsAudit(), "t1");
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.asc("t1.welfareUnionName");
|
||||
cnd.asc("t1.welfareUnitName");
|
||||
@@ -587,6 +590,7 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
|
||||
cnd.andEX("t1.personType", "in", pageForm.getPersonTypes());
|
||||
cnd.andEX("t1.preparedBy", "in", pageForm.getPreparedBys());
|
||||
cnd.andEX("t1.userState", "in", pageForm.getUserStates());
|
||||
appendAuditFilter(cnd, pageForm.getIsAudit(), "t1");
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.asc("t1.welfareUnionName");
|
||||
@@ -609,6 +613,14 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
|
||||
entities.add(new ExcelExportEntity("所属工会", "welfareUnionName", 20));
|
||||
entities.add(new ExcelExportEntity("所属单位", "welfareUnitName", 20));
|
||||
entities.add(new ExcelExportEntity("备注", "remark", 20));
|
||||
entities.add(new ExcelExportEntity("确认状态", "isAuditText", 20));
|
||||
entities.add(new ExcelExportEntity("确认时间", "auditTimeText", 25));
|
||||
|
||||
for (NutMap row : list) {
|
||||
row.put("isAuditText", Boolean.TRUE.equals(row.getBoolean("isAudit")) ? "已确认" : "未确认");
|
||||
Object auditTime = row.get("auditTime");
|
||||
row.put("auditTimeText", auditTime instanceof Date ? DateUtil.format((Date) auditTime, "yyyy-MM-dd HH:mm:ss") : "");
|
||||
}
|
||||
|
||||
// 设置导出参数
|
||||
ExportParams exportParams = new ExportParams();
|
||||
@@ -620,4 +632,102 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
|
||||
log.error("导出Excel失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap auditByProjectAndUnion(String projectId, String unionId, Boolean flag) {
|
||||
Cnd cnd = Cnd.NEW()
|
||||
.and("projectId", "=", projectId)
|
||||
.and("welfareUnionId", "=", unionId);
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_WELFARE_ADMIN.name())) {
|
||||
cnd.and("welfareUnionId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
// The page treats union confirmation as a bulk operation, so empty data must be reported explicitly.
|
||||
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);
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_WELFARE_ADMIN.name())) {
|
||||
cnd.and("welfareUnionId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
updateAuditState(cnd, flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination<NutMap> confirmStatistics(Integer pageNumber, Integer pageSize, Integer year, String projectId, String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
su.id AS unionId,
|
||||
su.name AS unionName,
|
||||
COUNT(CASE WHEN project.id IS NOT NULL THEN info.id END) AS totalCount,
|
||||
SUM(CASE WHEN project.id IS NOT NULL AND info.isAudit = 1 THEN 1 ELSE 0 END) AS confirmedCount,
|
||||
SUM(CASE WHEN project.id IS NOT NULL AND info.id IS NOT NULL AND (info.isAudit IS NULL OR info.isAudit <> 1) THEN 1 ELSE 0 END) AS unconfirmedCount,
|
||||
CASE
|
||||
WHEN COUNT(CASE WHEN project.id IS NOT NULL THEN info.id END) > 0
|
||||
AND COUNT(CASE WHEN project.id IS NOT NULL THEN info.id END) = SUM(CASE WHEN project.id IS NOT NULL AND info.isAudit = 1 THEN 1 ELSE 0 END) THEN '已完成'
|
||||
ELSE '未完成'
|
||||
END AS completeStatus
|
||||
FROM sys_union su
|
||||
LEFT JOIN welfare_list info ON info.welfareUnionId = su.id
|
||||
AND info.projectId = @projectId
|
||||
AND info.delFlag = 0
|
||||
LEFT JOIN welfare_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);
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_WELFARE_ADMIN.name())) {
|
||||
cnd.and("su.id", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
cnd.groupBy("su.id,su.name");
|
||||
cnd.asc("completeStatus");
|
||||
cnd.asc("su.unionCode");
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public 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(",");
|
||||
}
|
||||
|
||||
private void appendAuditFilter(Cnd cnd, String isAudit, String alias) {
|
||||
if (StrUtil.isBlank(isAudit)) {
|
||||
return;
|
||||
}
|
||||
if ("1".equals(isAudit)) {
|
||||
cnd.and(alias + ".isAudit", "=", true);
|
||||
} else if ("0".equals(isAudit)) {
|
||||
cnd.and(Cnd.exps(alias + ".isAudit", "=", false).or(alias + ".isAudit", "is", null));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAuditState(Cnd cnd, Boolean flag) {
|
||||
Chain chain = Chain.make("isAudit", Boolean.TRUE.equals(flag));
|
||||
if (Boolean.TRUE.equals(flag)) {
|
||||
chain.add("auditTime", new Date());
|
||||
chain.add("auditUser", SecurityUtil.getUserId());
|
||||
} else {
|
||||
chain.add("auditTime", null);
|
||||
chain.add("auditUser", null);
|
||||
}
|
||||
dao().update(WelfareList.class, chain, cnd);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user