commit
This commit is contained in:
+104
-45
@@ -5,14 +5,18 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.convert.NumberChineseFormatter;
|
||||
import cn.hutool.core.convert.NumberWordFormatter;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.OfficePlusUtil;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.base.utils.SysOfficeTemplateUtil;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
@@ -39,6 +43,7 @@ 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.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
@@ -47,9 +52,12 @@ import org.nutz.mvc.annotation.Ok;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -129,24 +137,24 @@ public class ActivityReimbursementMineController {
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
if (AuthUtil.hasPermission("activityReimbursement.apply.schoolHas")){
|
||||
group.or("info.reimbursementIdentity","=","school");
|
||||
if (AuthUtil.hasPermission("activityReimbursement.apply.schoolHas")) {
|
||||
group.or("info.reimbursementIdentity", "=", "school");
|
||||
}
|
||||
if (AuthUtil.hasPermission("activityReimbursement.apply.unionHas")){
|
||||
if (AuthUtil.hasPermission("activityReimbursement.apply.unionHas")) {
|
||||
SqlExpressionGroup unionGroup = new SqlExpressionGroup();
|
||||
unionGroup.and("info.unionId", "=", SecurityUtil.getUnionId());
|
||||
unionGroup.and("info.reimbursementIdentity","=","union");
|
||||
unionGroup.and("info.reimbursementIdentity", "=", "union");
|
||||
group.or(unionGroup);
|
||||
}
|
||||
if (AuthUtil.hasPermission("activityReimbursement.apply.clubHas")){
|
||||
if (AuthUtil.hasPermission("activityReimbursement.apply.clubHas")) {
|
||||
SqlExpressionGroup clubGroup = new SqlExpressionGroup();
|
||||
clubGroup.and("info.clubId", "in", SecurityUtil.getClubIds());
|
||||
clubGroup.and("info.reimbursementIdentity","=","club");
|
||||
clubGroup.and("info.reimbursementIdentity", "=", "club");
|
||||
group.or(clubGroup);
|
||||
}
|
||||
if (Lang.isNotEmpty(group)){
|
||||
cnd.and(group);
|
||||
}else{
|
||||
if (Lang.isNotEmpty(group)) {
|
||||
cnd.and(group);
|
||||
} else {
|
||||
cnd.and("info.userId", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
|
||||
@@ -158,7 +166,7 @@ public class ActivityReimbursementMineController {
|
||||
cnd.orderBy("info." + pageParam.getPageOrderName(), PageUtil.getOrder(pageParam.getPageOrderBy()));
|
||||
}
|
||||
// cnd.groupBy("t.id");
|
||||
cnd.groupBy("info.id");
|
||||
cnd.groupBy("info.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = activityReimbursementService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
@@ -207,9 +215,11 @@ public class ActivityReimbursementMineController {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
us.mobile,
|
||||
ins.id AS instanceId
|
||||
FROM
|
||||
`activity_reimbursement_info` info
|
||||
LEFT JOIN sys_user us on us.id=info.userId
|
||||
LEFT JOIN wf_process_instance ins ON ins.businessNo = info.id
|
||||
WHERE
|
||||
ins.state = 20 AND info.id = @id
|
||||
@@ -257,9 +267,13 @@ public class ActivityReimbursementMineController {
|
||||
|
||||
// 组合结果
|
||||
String actualMoneyChinese = integerChinese + decimalChinese;
|
||||
info.put("actualMoney", actualMoneyChinese);
|
||||
info.put("bigActualMoney", actualMoneyChinese);
|
||||
info.put("actualMoney", info.getString("actualMoney"));
|
||||
|
||||
info.put("sign", sysOfficeTemplateUtil.createPictureRenderData(info.getString("sign")));
|
||||
info.put("applyTime", info.getString("applyTime").substring(0, 10));
|
||||
List<NutMap> billFiles = Json.fromJsonAsList(NutMap.class, info.getString("billFiles"));
|
||||
info.put("fileNum", billFiles.size());
|
||||
|
||||
docData.put("schoolName", Globals.AppName);
|
||||
docData.put("info", info);
|
||||
@@ -327,68 +341,101 @@ public class ActivityReimbursementMineController {
|
||||
doneTaskVos.add(taskVO);
|
||||
}
|
||||
|
||||
List<NutMap> auditList = new ArrayList<>();
|
||||
|
||||
// 分工会审核
|
||||
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"));
|
||||
NutMap map = new NutMap();
|
||||
map.put("unit", "分工会审核");
|
||||
map.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
map.put("userName", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_userSign"))) {
|
||||
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_userSign")));
|
||||
map.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_userSign")));
|
||||
}
|
||||
approval.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
docData.put("fgh", approval);
|
||||
map.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
auditList.add(map);
|
||||
});
|
||||
|
||||
// 协会负责人审核
|
||||
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"));
|
||||
NutMap map = new NutMap();
|
||||
map.put("unit", "协会负责人审核");
|
||||
map.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
map.put("userName", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_userSign"))) {
|
||||
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_userSign")));
|
||||
map.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_userSign")));
|
||||
}
|
||||
approval.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
docData.put("xh", approval);
|
||||
map.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
auditList.add(map);
|
||||
});
|
||||
|
||||
// 校工会负责人审核
|
||||
doneTaskVos.stream().filter(task -> "校工会负责人审核".equals(task.getDisplayName()))
|
||||
// 协会负责人审核
|
||||
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"));
|
||||
NutMap map = new NutMap();
|
||||
map.put("unit", "校工会财务审核");
|
||||
map.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
map.put("userName", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_userSign"))) {
|
||||
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_userSign")));
|
||||
map.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_userSign")));
|
||||
}
|
||||
approval.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
docData.put("xfzr", approval);
|
||||
map.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
auditList.add(map);
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 校工会负责人审核
|
||||
doneTaskVos.stream().filter(task -> "校工会预审".equals(task.getDisplayName()))
|
||||
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
|
||||
.ifPresent(v -> {
|
||||
Dict taskFormData = v.getTaskFormData();
|
||||
NutMap map = new NutMap();
|
||||
map.put("unit", "校工会预审");
|
||||
map.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
map.put("userName", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_userSign"))) {
|
||||
map.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_userSign")));
|
||||
}
|
||||
map.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
auditList.add(map);
|
||||
});
|
||||
|
||||
doneTaskVos.stream().filter(task -> "校工会副主席审核".equals(task.getDisplayName()))
|
||||
.max(Comparator.comparing(ProcessTaskVO::getCreatedAt))
|
||||
.ifPresent(v -> {
|
||||
Dict taskFormData = v.getTaskFormData();
|
||||
NutMap map = new NutMap();
|
||||
map.put("unit", "校工会副主席审核");
|
||||
map.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
map.put("userName", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_userSign"))) {
|
||||
map.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_userSign")));
|
||||
}
|
||||
map.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
auditList.add(map);
|
||||
});
|
||||
|
||||
// 校工会主席审核
|
||||
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"));
|
||||
NutMap map = new NutMap();
|
||||
map.put("unit", "校工会主席审核");
|
||||
map.put("date", DateUtil.format(v.getFinishTime(), "yyyy年MM月dd日"));
|
||||
map.put("userName", taskFormData.getStr("tf_userName"));
|
||||
if (StrUtil.isNotBlank(taskFormData.getStr("tf_userSign"))) {
|
||||
approval.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_userSign")));
|
||||
map.put("sign", sysOfficeTemplateUtil.createPictureRenderData(taskFormData.getStr("tf_userSign")));
|
||||
}
|
||||
approval.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
docData.put("xzx", approval);
|
||||
map.put("opinion", taskFormData.getStr("tf_opinion"));
|
||||
auditList.add(map);
|
||||
});
|
||||
|
||||
String budgetsStr = info.getString("budgets");
|
||||
@@ -398,17 +445,29 @@ public class ActivityReimbursementMineController {
|
||||
}
|
||||
|
||||
docData.put("budgets", list);
|
||||
docData.put("auditList", auditList);
|
||||
|
||||
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
||||
Configure config = Configure.builder()
|
||||
.bind("budgets", policy)
|
||||
.bind("auditList", policy)
|
||||
.build();
|
||||
|
||||
String fileName = Globals.AppName + "【" + info.getString("activityName") + "】报销凭证表.docx";
|
||||
String fileName = Globals.AppName + "【" + info.getString("activityName") + "】报销凭证表.pdf";
|
||||
|
||||
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
|
||||
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate("activity_reimbursement_voucher"), config).render(docData).writeAndClose(byteArrayOutputStream);
|
||||
CommonDownloadUtil.download(fileName, byteArrayOutputStream.toByteArray(), response);
|
||||
|
||||
byte[] bytes = byteArrayOutputStream.toByteArray();
|
||||
File sourceFile = File.createTempFile("file_convert_origin", ".docx");
|
||||
Files.write(sourceFile.toPath(), bytes, StandardOpenOption.WRITE);
|
||||
|
||||
File pdfFile = File.createTempFile("file_convert", ".pdf");
|
||||
OfficePlusUtil.convert(sourceFile.getPath(), pdfFile.getPath());
|
||||
CommonDownloadUtil.download(fileName, IoUtil.readBytes(FileUtil.getInputStream(pdfFile)), response);
|
||||
// 删除临时文件
|
||||
FileUtil.del(sourceFile);
|
||||
FileUtil.del(pdfFile.toPath());
|
||||
} catch (IOException e) {
|
||||
log.error("报销凭证表导出失败,id:{},错误信息:{}", id, e.getMessage());
|
||||
}
|
||||
|
||||
+3
-3
@@ -255,7 +255,7 @@ layout("/layouts/platform.html"){
|
||||
<el-form-item prop="billFiles" label="发票等">
|
||||
<file-upload :value.sync="formData.billFiles"
|
||||
upload_mode="drag"
|
||||
:upload_number="10" upload_result_category="array"
|
||||
:upload_number="20" upload_result_category="array"
|
||||
accept=".doc, .docx, .xls, .xlsx, .pdf, .ppt, .jpg, .jpeg, .png"
|
||||
complete_result></file-upload>
|
||||
</el-form-item>
|
||||
@@ -265,7 +265,7 @@ layout("/layouts/platform.html"){
|
||||
<el-form-item prop="photoFiles" label="活动报道照片/总结/链接">
|
||||
<file-upload :value.sync="formData.photoFiles"
|
||||
upload_mode="drag"
|
||||
:upload_number="10" upload_result_category="array"
|
||||
:upload_number="20" upload_result_category="array"
|
||||
accept=".doc, .docx, .xls, .xlsx, .pdf, .ppt, .jpg, .jpeg, .png"
|
||||
complete_result></file-upload>
|
||||
</el-form-item>
|
||||
@@ -275,7 +275,7 @@ layout("/layouts/platform.html"){
|
||||
<el-form-item prop="otherFiles" label="奖品/纪念品/服装/道具等活动人员名单">
|
||||
<file-upload :value.sync="formData.otherFiles"
|
||||
upload_mode="drag"
|
||||
:upload_number="10" upload_result_category="array"
|
||||
:upload_number="20" upload_result_category="array"
|
||||
accept=".doc, .docx, .xls, .xlsx, .pdf, .ppt, .jpg, .jpeg, .png"
|
||||
complete_result></file-upload>
|
||||
</el-form-item>
|
||||
|
||||
Reference in New Issue
Block a user