This commit is contained in:
=
2026-04-16 09:14:06 +08:00
parent bce4001d4c
commit 3b372a2425
22 changed files with 591 additions and 209 deletions
@@ -198,6 +198,12 @@ public class Sys_user extends BaseModel implements Serializable {
@DataCenterColumn(name = "教职工类别码", key = "JZGLBMC")
private String personType;
@Column
@Comment("用人方式码")
@ColDefine(type = ColType.VARCHAR, width = 30)
@DataCenterColumn(name = "用人方式码", key = "YRFSMC")
private String employmentType;
@Column
@Comment("编制类别码")
@ColDefine(type = ColType.VARCHAR, width = 30)
@@ -35,7 +35,7 @@ import java.util.List;
*/
@IocBean
@At("/platform/condolence/branchUnionApproval")
@Api("职工慰问分工会审核")
@Api("职工慰问分工会主席审核")
@Ok("json:full")
public class CondolenceBranchUnionApprovalController {
@@ -3,6 +3,8 @@ package com.budwk.app.zhgh.staffbenefit.condolence.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.constant.RoleConstant;
@@ -11,17 +13,23 @@ import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.sms.SmsService;
import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.base.utils.SysOfficeTemplateUtil;
import com.budwk.app.flow.engine.FlowEngine;
import com.budwk.app.flow.entity.ProcessTask;
import com.budwk.app.flow.vo.ProcessTaskVO;
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.condolence.model.Condolence;
import com.budwk.app.zhgh.staffbenefit.condolence.model.CondolenceType;
import com.budwk.app.zhgh.staffbenefit.condolence.service.CondolenceService;
import com.deepoove.poi.XWPFTemplate;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
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;
@@ -34,6 +42,20 @@ import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* @ClassName CondolenceApplyController
* @Author JyuHsin
@@ -45,12 +67,19 @@ import org.nutz.mvc.annotation.Param;
@At("/platform/condolence/mine")
@Api("职工慰问我的")
@Ok("json:full")
@Slf4j
public class CondolenceMineController {
@Inject
private SysOfficeTemplateUtil sysOfficeTemplateUtil;
@Inject
private CondolenceService condolenceService;
@Inject
private FlowEngine flowEngine;
@Inject
private SmsService smsService;
@Inject
private Dao dao;
@At("/")
@Ok("beetl:/platform/zhgh/staffbenefit/condolence/mine/index.html")
@@ -106,13 +135,13 @@ public class CondolenceMineController {
cnd.andEX("year(info.createTime)", "=", year);
cnd.andEX("info.type", "=", type);
cnd.and("info.createdBy", "=", SecurityUtil.getUserId());
cnd.groupBy("info.id");
if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) {
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
} else {
cnd.desc("info.createTime");
}
sql.setCondition(cnd);
Pagination<NutMap> pagination = condolenceService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
@@ -140,6 +169,126 @@ public class CondolenceMineController {
//smsService.send("20182040", "这是一条由智慧工会系统发出的测试消息。");
return Result.success(nutMap);
}
@Inject
private SmsService smsService;
@At
@Ok("void")
public void doExport(String id, HttpServletResponse response) throws Exception {
Condolence condolence = condolenceService.fetch(id);
if (condolence == null) {
throw new RuntimeException("慰问记录不存在");
}
Sql sql = Sqls.create("""
SELECT
info.*,
type.name as typeName,
type.uploadFileDesc,
ins.id AS instanceId
FROM
`condolence` info
LEFT JOIN wf_process_instance ins ON ins.businessNo = info.id
LEFT JOIN condolence_type type ON type.id = info.type
WHERE
ins.state = 20 AND info.id = @id
""").setParam("id", id);
sql.setCallback(Sqls.callback.map());
dao.execute(sql);
NutMap info = (NutMap) sql.getResult();
HashMap<String, Object> docData = new HashMap<>();
docData.put("applyUserName", condolence.getApplyUserName());
docData.put("applyMobile", condolence.getApplyMobile());
docData.put("helpUserName", condolence.getHelpUserName());
docData.put("helpMobile", condolence.getHelpMobile());
docData.put("applyUnionName", condolence.getApplyUnionName());
docData.put("type", info.getString("typeName"));
docData.put("uploadFileDesc", info.getString("uploadFileDesc"));
//附件名称导出
if (condolence.getFiles() != null && !condolence.getFiles().isEmpty()) {
List<String> fileNames = condolence.getFiles().stream()
.map(file -> file.getStr("name"))
.filter(StrUtil::isNotBlank)
.collect(Collectors.toList());
docData.put("fileNames", String.join("\n", fileNames));
} else {
docData.put("fileNames", "");
}
docData.put("info", info);
docData.put("way", condolence.getWay());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime createTime = LocalDateTime.parse(condolence.getCreateTime(), formatter);
String fileName = "工会会员慰问报销审批单_" +
DateUtil.format(createTime, "yyyyMMdd") + ".docx";
List<ProcessTaskVO> doneTaskVos = new ArrayList<>();
List<ProcessTask> doneTaskList = flowEngine.processTaskService().getDoneTaskList(info.getLong("instanceId"), null);
for (ProcessTask doneTask : doneTaskList) {
ProcessTaskVO taskVO = flowEngine.processTaskService().findById(doneTask.getId());
doneTaskVos.add(taskVO);
}
doneTaskVos.stream().filter(task -> "分工会主席审核".equals(task.getDisplayName()))
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
.ifPresent(v -> {
Dict taskFormData = v.getTaskFormData();
HashMap<String, Object> approval = new HashMap<>();
approval.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
approval.put("user", taskFormData.getStr("tf_userName"));
if (StrUtil.isNotBlank(taskFormData.getStr("tf_sign"))) {
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_sign")));
}
approval.put("opinion", taskFormData.getStr("tf_opinion"));
docData.put("fgh", approval);
});
doneTaskVos.stream().filter(task -> "校工会会计审核".equals(task.getDisplayName()))
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
.ifPresent(v -> {
Dict taskFormData = v.getTaskFormData();
HashMap<String, Object> approval = new HashMap<>();
approval.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
approval.put("user", taskFormData.getStr("tf_userName"));
if (StrUtil.isNotBlank(taskFormData.getStr("tf_sign"))) {
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_sign")));
}
approval.put("opinion", taskFormData.getStr("tf_opinion"));
docData.put("kj", approval);
});
doneTaskVos.stream().filter(task -> "工会主席审核".equals(task.getDisplayName()))
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
.ifPresent(v -> {
Dict taskFormData = v.getTaskFormData();
HashMap<String, Object> approval = new HashMap<>();
approval.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
approval.put("user", taskFormData.getStr("tf_userName"));
if (StrUtil.isNotBlank(taskFormData.getStr("tf_sign"))) {
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_sign")));
}
approval.put("opinion", taskFormData.getStr("tf_opinion"));
docData.put("xgh", approval);
});
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
response.setHeader("content-disposition", "attachment;filename="
+ URLEncoder.encode(fileName, "UTF-8"));
try {
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate("condolence"))
.render(docData)
.write(response.getOutputStream());
} catch (IOException e) {
log.error("导出慰问审批单失败,ID: {}, 错误信息: {}", id, e.getMessage());
throw e;
}
}
}
@@ -33,7 +33,7 @@ import java.util.List;
*/
@IocBean
@At("/platform/condolence/schoolPrincipalApproval")
@Api("职工慰问校工会预审")
@Api("职工慰问校工会会计审核")
@Ok("json:full")
public class CondolenceSchoolPrincipalApprovalController {
@@ -35,7 +35,7 @@ import java.util.List;
*/
@IocBean
@At("/platform/condolence/schoolUnionApproval")
@Api("职工慰问工会审核")
@Api("职工慰问工会主席审核")
@Ok("json:full")
public class CondolenceSchoolUnionApprovalController {
@@ -65,6 +65,11 @@ public class Condolence extends BaseModel {
@ColDefine(type = ColType.VARCHAR, width = 100)
private String applyUnitName;
@Column
@Comment("申请人手机号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String applyMobile;
@Column
@Comment("补助人ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@@ -100,6 +105,11 @@ public class Condolence extends BaseModel {
@ColDefine(type = ColType.VARCHAR, width = 100)
private String helpUnitName;
@Column
@Comment("补助人手机号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String helpMobile;
@Column
@Comment("类型")
@ColDefine(type = ColType.VARCHAR, width = 20)
@@ -99,6 +99,32 @@ public class WelfareListController {
return Result.success(welfareListService.notWelfareUserPageData(pageForm));
}
@At
@Aop(TransAop.READ_COMMITTED)
@ApiOperation("批量删除福利会员")
@SaCheckPermission("welfare.list.mange")
@SLog(tag = "福利名单管理", msg = "批量删除福利会员")
public Result batchDelete(@Param("ids") String[] ids, @Param("projectId") String projectId) {
if (ids == null || ids.length == 0) {
return Result.error("请选择要删除的数据");
}
List<WelfareList> welfareLists = welfareListService.query(Cnd.where("id", "in", ids));
List<String> userIds = welfareLists.stream()
.map(WelfareList::getUserId)
.filter(StrUtil::isNotBlank)
.collect(Collectors.toList());
welfareListService.delete(ids);
if (StrUtil.isNotBlank(projectId) && !userIds.isEmpty()) {
welfareListService.dao().clear(WelfareUserSelection.class,
Cnd.where("welfareId", "=", projectId).and("selectUserId", "in", userIds));
}
return Result.success("成功删除" + ids.length + "条数据");
}
@At
@SaCheckPermission("welfare.list.mange")
@ApiOperation("添加用户到福利名单")