Compare commits
20
Commits
53bfc7f1cf
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
790e8e9f50 | ||
|
|
81fd5cb773 | ||
|
|
efad953710 | ||
|
|
e0004e410f | ||
|
|
f8457386fd | ||
|
|
16cae3ed2b | ||
|
|
29260423d5 | ||
|
|
d8e7adfe9a | ||
|
|
bc1b3bf7fe | ||
|
|
59fd83ba24 | ||
|
|
3059603186 | ||
|
|
f17f6153b5 | ||
|
|
e87014fa72 | ||
|
|
0bde359113 | ||
|
|
2ebc204803 | ||
|
|
5f064b076c | ||
|
|
783e751560 | ||
|
|
b325e8a8f5 | ||
|
|
45121f7b2e | ||
|
|
7d76ae4e36 |
@@ -2,6 +2,8 @@
|
||||
**/node_modules/
|
||||
**/dist/
|
||||
**/build/
|
||||
!src/main/resources/static/assets/platform/plugins/pdfJs/build/
|
||||
!src/main/resources/static/assets/platform/plugins/pdfJs/build/**
|
||||
**/target/
|
||||
**/out/
|
||||
**/.next/
|
||||
|
||||
@@ -19,6 +19,7 @@ RoleConstant {
|
||||
SCHOOL_UNION_ADMIN("校工会管理员"),
|
||||
SCHOOL_UNION_CHAIRMAN("校工会主席"),
|
||||
SCHOOL_UNION_VICE_CHAIRMAN("校工会副主席"),
|
||||
SCHOOL_OFFICE_DIRECTOR("校工会办公室主任"),
|
||||
SCHOOL_UNION_WELFARE_ADMIN("校工会福利管理员"),
|
||||
SCHOOL_UNION_MEMBER_ADMIN("校工会会员管理员"),
|
||||
SCHOOL_UNION_TC_ADMIN("校工会教代会管理员"),
|
||||
@@ -50,7 +51,7 @@ RoleConstant {
|
||||
BRANCH_UNION_WENTI_SPORTS("分工会文体福利委员"),
|
||||
|
||||
UNIT_PARTY_SECRETARY("单位党委书记"),
|
||||
UNIT_SCHOOL_LEADER("分管校领导"),
|
||||
UNIT_SCHOOL_LEADER("单位分管校领导"),
|
||||
|
||||
TEACHER_CONGRESS_DELEGATE_FORMAL("教代会正式代表"),
|
||||
TEACHER_CONGRESS_DELEGATE_ATTENDANCE("教代会列席代表"),
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.sys.models.Sys_file;
|
||||
import com.budwk.app.sys.models.Sys_office_template;
|
||||
import com.budwk.app.sys.utils.SysFileMinIoUtil;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.data.ByteArrayPictureRenderData;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
import com.deepoove.poi.data.PictureType;
|
||||
@@ -18,6 +20,12 @@ import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -31,6 +39,20 @@ public class SysOfficeTemplateUtil {
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
public String getTemplateFileName(String templateCode) {
|
||||
Sys_office_template officeTemplate = dao.fetch(Sys_office_template.class, Cnd.where(Sys_office_template::getTemplateCode, "=", templateCode));
|
||||
if (ObjectUtil.isNull(officeTemplate)) {
|
||||
throw new BaseException("代码为:{}的模板不存在", templateCode);
|
||||
}
|
||||
String templatePath = officeTemplate.getTemplatePath();
|
||||
String id = templatePath.substring(templatePath.indexOf("id=") + "id=".length());
|
||||
Sys_file sysFile = dao.fetch(Sys_file.class, id);
|
||||
if (ObjectUtil.isEmpty(sysFile)) {
|
||||
throw new BaseException("模板文件不存在");
|
||||
}
|
||||
return sysFile.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模板文件输入流
|
||||
*
|
||||
@@ -52,6 +74,88 @@ public class SysOfficeTemplateUtil {
|
||||
return new ByteArrayInputStream(fileBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一渲染 DOC/DOCX 模板,保留调用方的循环表格等策略;模板输入流由调用方关闭。
|
||||
*/
|
||||
public byte[] renderTemplate(InputStream input, Object data, Configure config, boolean pdf, String context) throws Exception {
|
||||
if (input == null) throw new BaseException("模板文件不存在");
|
||||
byte[] templateBytes = input.readAllBytes();
|
||||
try (ByteArrayInputStream formatInput = new ByteArrayInputStream(templateBytes)) {
|
||||
if (com.aspose.words.FileFormatUtil.detectFileFormat(formatInput).getLoadFormat() != com.aspose.words.LoadFormat.DOCX) {
|
||||
try (ByteArrayInputStream source = new ByteArrayInputStream(templateBytes);
|
||||
ByteArrayOutputStream converted = new ByteArrayOutputStream()) {
|
||||
new com.aspose.words.Document(source).save(converted, com.aspose.words.SaveFormat.DOCX);
|
||||
templateBytes = converted.toByteArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
byte[] wordBytes;
|
||||
try (ByteArrayInputStream templateInput = new ByteArrayInputStream(templateBytes);
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
XWPFTemplate template = XWPFTemplate.compile(templateInput, config == null ? Configure.builder().build() : config)) {
|
||||
template.render(data).write(output);
|
||||
wordBytes = output.toByteArray();
|
||||
} catch (Exception e) {
|
||||
log.error("[Office模板渲染] Word模板渲染失败,context={}", context, e);
|
||||
throw e;
|
||||
}
|
||||
log.info("[Office模板渲染] Word渲染完成,context={}, templateBytes={}, outputBytes={}", context, templateBytes.length, wordBytes.length);
|
||||
if (!pdf) return wordBytes;
|
||||
try (ByteArrayInputStream wordInput = new ByteArrayInputStream(wordBytes);
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream()) {
|
||||
com.aspose.words.Document document = new com.aspose.words.Document(wordInput);
|
||||
configureDocumentFonts(document, context);
|
||||
com.aspose.words.PdfSaveOptions options = new com.aspose.words.PdfSaveOptions();
|
||||
options.setFontEmbeddingMode(com.aspose.words.PdfFontEmbeddingMode.EMBED_ALL);
|
||||
document.save(output, options);
|
||||
log.info("[Office模板渲染] PDF转换完成,context={}, outputBytes={}", context, output.size());
|
||||
return output.toByteArray();
|
||||
} catch (Exception e) {
|
||||
log.error("[Office模板渲染] PDF转换失败,context={}", context, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private void configureDocumentFonts(com.aspose.words.Document document, String context) throws Exception {
|
||||
com.aspose.words.FontSettings settings = new com.aspose.words.FontSettings();
|
||||
List<com.aspose.words.FontSourceBase> sources = new ArrayList<>(List.of(settings.getFontsSources()));
|
||||
Set<String> folders = new LinkedHashSet<>();
|
||||
String windowsDir = System.getenv("WINDIR");
|
||||
if (StrUtil.isNotBlank(windowsDir)) folders.add(new File(windowsDir, "Fonts").getPath());
|
||||
String localAppData = System.getenv("LOCALAPPDATA");
|
||||
if (StrUtil.isNotBlank(localAppData)) folders.add(new File(localAppData, "Microsoft/Windows/Fonts").getPath());
|
||||
folders.add(new File(System.getProperty("user.dir"), "fonts").getPath());
|
||||
for (String folder : folders) {
|
||||
File directory = new File(folder);
|
||||
log.info("[Office模板渲染] 字体目录,context={}, path={}, readable={}", context, folder, directory.isDirectory() && directory.canRead());
|
||||
if (directory.isDirectory() && directory.canRead()) sources.add(new com.aspose.words.FolderFontSource(folder, true));
|
||||
}
|
||||
settings.setFontsSources(sources.toArray(new com.aspose.words.FontSourceBase[0]));
|
||||
Set<String> availableFonts = new LinkedHashSet<>();
|
||||
for (com.aspose.words.FontSourceBase source : sources) {
|
||||
for (com.aspose.words.PhysicalFontInfo font : source.getAvailableFonts()) availableFonts.add(font.getFontFamilyName());
|
||||
}
|
||||
String chineseFont = null;
|
||||
for (String candidate : List.of("SimSun", "宋体", "Microsoft YaHei", "微软雅黑", "DengXian", "等线", "SimHei", "黑体", "FangSong", "仿宋", "Noto Serif CJK SC", "Noto Sans CJK SC")) {
|
||||
if (availableFonts.contains(candidate)) {
|
||||
chineseFont = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
log.info("[Office模板渲染] 中文字体选择,context={}, fontCount={}, chineseFont={}", context, availableFonts.size(), chineseFont);
|
||||
if (chineseFont != null) {
|
||||
settings.getSubstitutionSettings().getDefaultFontSubstitution().setDefaultFontName(chineseFont);
|
||||
for (String name : List.of("宋体", "SimSun", "新宋体", "NSimSun", "黑体", "SimHei", "仿宋", "FangSong", "楷体", "KaiTi", "微软雅黑", "Microsoft YaHei")) {
|
||||
if (!availableFonts.contains(name)) settings.getSubstitutionSettings().getTableSubstitution().setSubstitutes(name, chineseFont);
|
||||
}
|
||||
} else {
|
||||
log.warn("[Office模板渲染] 未发现常用中文字体,context={}, availableFonts={}", context, availableFonts);
|
||||
}
|
||||
settings.getFallbackSettings().loadMsOfficeFallbackSettings();
|
||||
document.setFontSettings(settings);
|
||||
document.setWarningCallback(warning -> log.warn("[Office模板渲染] 字体或排版警告,context={}, type={}, detail={}", context, warning.getWarningType(), warning.getDescription()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 签字url转换为poi的图片对象
|
||||
*
|
||||
@@ -63,13 +167,7 @@ public class SysOfficeTemplateUtil {
|
||||
public PictureRenderData createPictureRenderData(int width, int height, String url) {
|
||||
try {
|
||||
byte[] bytes = getFileBytesByUrl(url);
|
||||
// if (StrUtil.isBlank(url)) {
|
||||
// return null;
|
||||
// }
|
||||
// int startIndex = url.indexOf("id=") + "id=".length();
|
||||
// String id = url.substring(startIndex);
|
||||
// Sys_file sysFile = dao.fetch(Sys_file.class, id);
|
||||
// byte[] bytes = SysFileMinIoUtil.getFileBytes(sysFile.getBucket(), sysFile.getStoragePath());
|
||||
log.info("[Office图片读取] 创建图片渲染数据,referenceLength={}, byteCount={}, width={}, height={}", StrUtil.nullToEmpty(url).length(), bytes == null ? null : bytes.length, width, height);
|
||||
ByteArrayPictureRenderData pictureRenderData = new ByteArrayPictureRenderData(bytes, PictureType.PNG);
|
||||
PictureStyle pictureStyle = new PictureStyle();
|
||||
pictureStyle.setWidth(width);
|
||||
@@ -77,7 +175,7 @@ public class SysOfficeTemplateUtil {
|
||||
pictureRenderData.setPictureStyle(pictureStyle);
|
||||
return pictureRenderData;
|
||||
} catch (Exception e) {
|
||||
log.error("文件转换PictureRenderData错误,文件路径:{},{}", url, e.getMessage());
|
||||
log.error("[Office图片读取] 创建图片渲染数据失败,referenceLength={}", StrUtil.nullToEmpty(url).length(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -126,13 +224,20 @@ public class SysOfficeTemplateUtil {
|
||||
public byte[] getFileBytesByUrl(String url) {
|
||||
try {
|
||||
if (StrUtil.isBlank(url)) {
|
||||
log.warn("[Office图片读取] 图片引用为空");
|
||||
return null;
|
||||
}
|
||||
int startIndex = url.indexOf("id=") + "id=".length();
|
||||
String id = url.substring(startIndex);
|
||||
String logFileId = url.contains("id=") ? id : "未识别id参数";
|
||||
log.info("[Office图片读取] 解析文件引用,fileId={}, hasIdParameter={}", logFileId, url.contains("id="));
|
||||
Sys_file sysFile = dao.fetch(Sys_file.class, id);
|
||||
return SysFileMinIoUtil.getFileBytes(sysFile.getBucket(), sysFile.getStoragePath());
|
||||
log.info("[Office图片读取] 查询文件记录,fileId={}, found={}, bucket={}, storagePathPresent={}", logFileId, sysFile != null, sysFile == null ? null : sysFile.getBucket(), sysFile != null && StrUtil.isNotBlank(sysFile.getStoragePath()));
|
||||
byte[] bytes = SysFileMinIoUtil.getFileBytes(sysFile.getBucket(), sysFile.getStoragePath());
|
||||
log.info("[Office图片读取] 读取存储文件完成,fileId={}, byteCount={}", logFileId, bytes == null ? null : bytes.length);
|
||||
return bytes;
|
||||
} catch (Exception e) {
|
||||
log.error("[Office图片读取] 读取图片失败,referenceLength={}", StrUtil.nullToEmpty(url).length(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.budwk.app.base.wxwork;
|
||||
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import java.util.List;
|
||||
|
||||
/** 企业微信自建应用消息服务,接收人的 loginname 必须对应学校企业微信 userid。 */
|
||||
public interface WxWorkMessageService {
|
||||
/**
|
||||
* 单人发送;link 为空发送文本,否则发送文本卡片,相对链接使用配置域名补全。
|
||||
* @param loginname 接收人的企业微信 userid,当前学校直接使用系统 loginname
|
||||
* @param title 消息标题,为空使用配置的默认标题
|
||||
* @param content 消息正文,可含富文本标签,发送前转为纯文本
|
||||
* @param link 业务详情链接,可为空、站内相对路径或完整 HTTP(S) 地址
|
||||
* @return 与 massSend 相同的结果结构;skipped 表示关闭开关而未发送
|
||||
*/
|
||||
NutMap send(String loginname, String title, String content, String link);
|
||||
|
||||
/**
|
||||
* 多人发送相同消息,去重并分批调用企业微信接口。
|
||||
* @param loginNames 接收人 loginname 列表,每项须为企业微信 userid,不接受 @all
|
||||
* @param title 消息标题,为空使用默认标题
|
||||
* @param content 消息正文,清理标签后不能为空
|
||||
* @param link 详情链接;空值为文本消息,非空为文本卡片
|
||||
* @return NutMap:success 为全部批次被接口接受且无无效接收人;skipped 为未发送;
|
||||
* batches 为批次结果列表,每项包含 errcode、errmsg、msgid、invaliduser 等接口字段。
|
||||
* 接口接受不代表用户已读;网络或配置错误抛出业务异常,不自动重发已接受批次。
|
||||
*/
|
||||
NutMap massSend(List<String> loginNames, String title, String content, String link);
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package com.budwk.app.base.wxwork.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.constant.RedisConstant;
|
||||
import com.budwk.app.base.wxwork.WxWorkMessageService;
|
||||
import com.budwk.app.web.commons.base.Globals;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.impl.PropertiesProxy;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/** 企业微信官方消息接口;参考 ypi 的单发、群发及 token 缓存方式,配置与业务调用分离。 */
|
||||
@Slf4j
|
||||
@IocBean
|
||||
public class WxWorkMessageServiceImpl implements WxWorkMessageService {
|
||||
private static final String PREFIX = "wxwork.message.";
|
||||
private static final String API = "https://qyapi.weixin.qq.com/cgi-bin/";
|
||||
@Inject
|
||||
private PropertiesProxy conf;
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
|
||||
/** 参数和返回结构见接口;发送是外部操作,数据库事务无法撤回已发送的消息。 */
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public NutMap send(String loginname, String title, String content, String link) {
|
||||
return massSend(loginname == null ? null : List.of(loginname), title, content, link);
|
||||
}
|
||||
|
||||
/** 先判断独立消息开关,关闭时不读取凭据、不取 token,也不调用外部接口。 */
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public NutMap massSend(List<String> loginNames, String title, String content, String link) {
|
||||
Object switchValue = Globals.MyConfig.get("AppWxWorkMessage");
|
||||
boolean enabled = Boolean.parseBoolean(switchValue == null
|
||||
? conf.get(PREFIX + "enabled", "false") : switchValue.toString());
|
||||
if (!enabled) {
|
||||
return NutMap.NEW().addv("success", false).addv("skipped", true).addv("batches", List.of());
|
||||
}
|
||||
if (loginNames == null || loginNames.isEmpty()
|
||||
|| loginNames.stream().anyMatch(name -> StrUtil.isBlank(name) || name.contains("|") || name.trim().startsWith("@"))) {
|
||||
throw new BaseException("企业微信接收人须为非空 loginname,不允许分隔符或群发标记");
|
||||
}
|
||||
List<String> receivers = loginNames.stream().map(String::trim).distinct().toList();
|
||||
String body = plainText(content);
|
||||
String heading = plainText(StrUtil.blankToDefault(title, conf.get(PREFIX + "default-title", "智慧工会")));
|
||||
if (StrUtil.isBlank(body)) throw new BaseException("企业微信消息正文不能为空");
|
||||
String url = resolveLink(link);
|
||||
long agentId;
|
||||
try {
|
||||
agentId = Long.parseLong(required("wxwork.agentId"));
|
||||
if (agentId <= 0) throw new NumberFormatException();
|
||||
} catch (NumberFormatException e) {
|
||||
throw new BaseException("企业微信 agentId 必须为正整数");
|
||||
}
|
||||
JSONObject payload = JSONUtil.createObj().set("agentid", agentId);
|
||||
if (url == null) {
|
||||
String text = heading + "\n" + body;
|
||||
requireLength(text, 2048, "文本消息");
|
||||
payload.set("msgtype", "text").set("text", JSONUtil.createObj().set("content", text));
|
||||
} else {
|
||||
requireLength(heading, 128, "卡片标题");
|
||||
String description = HtmlUtil.escape(body).replace("\n", "<br>");
|
||||
requireLength(description, 512, "卡片正文");
|
||||
requireLength(url, 2048, "卡片链接");
|
||||
payload.set("msgtype", "textcard").set("textcard", JSONUtil.createObj()
|
||||
.set("title", heading).set("description", description).set("url", url).set("btntxt", "查看详情"));
|
||||
}
|
||||
List<JSONObject> batches = new ArrayList<>();
|
||||
boolean success = true;
|
||||
// 企业微信 touser 单次最多 1000 人;按去重后的接收人分批,禁止自动重复整个批次列表。
|
||||
for (int offset = 0; offset < receivers.size(); offset += 1000) {
|
||||
payload.set("touser", String.join("|", receivers.subList(offset, Math.min(offset + 1000, receivers.size()))));
|
||||
String token = getAccessToken(false);
|
||||
JSONObject result = sendPayload(payload, token);
|
||||
int code = result.getInt("errcode", -1);
|
||||
// 仅在明确的 token 无效/过期返回时刷新一次;超时的发送结果不确定,不能盲目重发。
|
||||
if (code == 40014 || code == 42001 || code == 40001) {
|
||||
result = sendPayload(payload, getAccessToken(true));
|
||||
}
|
||||
batches.add(result);
|
||||
boolean accepted = result.getInt("errcode", -1) == 0
|
||||
&& StrUtil.isBlank(result.getStr("invaliduser"))
|
||||
&& StrUtil.isBlank(result.getStr("unlicenseduser"));
|
||||
success &= accepted;
|
||||
log.info("企业微信消息批次完成:offset={},success={},errcode={},msgid={}",
|
||||
offset, accepted, result.getInt("errcode"), result.getStr("msgid"));
|
||||
}
|
||||
return NutMap.NEW().addv("success", success).addv("skipped", false).addv("batches", batches);
|
||||
}
|
||||
|
||||
/** 标题和富文本正文统一转换为可读纯文本,保留常用段落换行。 */
|
||||
private String plainText(String value) {
|
||||
return HtmlUtil.unescape(HtmlUtil.cleanHtmlTag(StrUtil.blankToDefault(value, "")
|
||||
.replaceAll("(?i)<br\\s*/?>|</p>|</div>", "\n"))).trim();
|
||||
}
|
||||
|
||||
/** 使用 UTF-8 字节数校验接口上限,避免中文按字符计数造成发送失败。 */
|
||||
private void requireLength(String value, int limit, String label) {
|
||||
if (value.getBytes(StandardCharsets.UTF_8).length > limit) {
|
||||
throw new BaseException(label + "超过 " + limit + " 字节,请精简内容");
|
||||
}
|
||||
}
|
||||
|
||||
/** 相对路径按配置的系统域名补全;限制 HTTP(S),避免生成不可打开的卡片链接。 */
|
||||
private String resolveLink(String link) {
|
||||
if (StrUtil.isBlank(link)) return null;
|
||||
try {
|
||||
URI uri = URI.create(link.trim());
|
||||
if (!uri.isAbsolute()) {
|
||||
if (uri.getRawAuthority() != null) throw new IllegalArgumentException();
|
||||
String base = required(PREFIX + "link-base-url").replaceAll("/+$", "") + "/";
|
||||
uri = URI.create(base).resolve(uri);
|
||||
}
|
||||
if (!("https".equalsIgnoreCase(uri.getScheme()) || "http".equalsIgnoreCase(uri.getScheme()))
|
||||
|| uri.getHost() == null || uri.getUserInfo() != null) throw new IllegalArgumentException();
|
||||
return uri.toASCIIString();
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BaseException("企业微信详情链接或系统域名配置无效");
|
||||
}
|
||||
}
|
||||
|
||||
/** 按企业及应用隔离缓存,与登录 token 缓存分开;提前过期以避开有效期临界点。 */
|
||||
private synchronized String getAccessToken(boolean refresh) {
|
||||
String corpId = required("wxwork.corpId");
|
||||
String agentId = required("wxwork.agentId");
|
||||
String secret = required("wxwork.corpSecret");
|
||||
String key = RedisConstant.REDIS_KEY_WX_WORK_TOKEN + "message:" + corpId + ":" + agentId;
|
||||
String cached = refresh ? null : redisService.get(key);
|
||||
if (StrUtil.isNotBlank(cached)) return cached;
|
||||
JSONObject response = execute(HttpRequest.get(API + "gettoken?corpid=" + encode(corpId)
|
||||
+ "&corpsecret=" + encode(secret)));
|
||||
String token = response.getStr("access_token");
|
||||
if (response.getInt("errcode", -1) != 0 || StrUtil.isBlank(token)) {
|
||||
throw new BaseException("企业微信获取 token 失败,errcode=" + response.getInt("errcode", -1));
|
||||
}
|
||||
int expires = response.getInt("expires_in", 7200);
|
||||
redisService.setex(key, Math.max(1, expires - 120), token);
|
||||
return token;
|
||||
}
|
||||
|
||||
/** 提交已校验的消息 JSON;返回企业微信原始业务字段供调用方判断部分失败。 */
|
||||
private JSONObject sendPayload(JSONObject payload, String token) {
|
||||
return execute(HttpRequest.post(API + "message/send?access_token=" + encode(token))
|
||||
.header("Content-Type", "application/json; charset=UTF-8").body(payload.toString()));
|
||||
}
|
||||
|
||||
/** 关闭响应资源并校验 HTTP/JSON;异常不输出带 Secret 或 token 的请求 URL。 */
|
||||
protected JSONObject execute(HttpRequest request) {
|
||||
request.setConnectionTimeout(conf.getInt(PREFIX + "connect-timeout", 5000));
|
||||
request.setReadTimeout(conf.getInt(PREFIX + "read-timeout", 10000));
|
||||
try (HttpResponse response = request.execute()) {
|
||||
if (!response.isOk()) throw new BaseException("企业微信接口 HTTP 状态异常:" + response.getStatus());
|
||||
if (!JSONUtil.isTypeJSONObject(response.body())) throw new BaseException("企业微信接口返回非 JSON 对象");
|
||||
return JSONUtil.parseObj(response.body());
|
||||
} catch (BaseException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new BaseException("企业微信请求失败,请检查网络及接口配置;异常类型:" + e.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
|
||||
/** 必填参数不允许为空或使用原有占位符 1,防止错误配置请求外部接口。 */
|
||||
private String required(String key) {
|
||||
String value = conf.get(key, "").trim();
|
||||
if (StrUtil.isBlank(value) || "1".equals(value)) throw new BaseException("请配置有效的 " + key);
|
||||
return value;
|
||||
}
|
||||
|
||||
private String encode(String value) {
|
||||
return URLEncoder.encode(value, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import com.budwk.app.flow.vo.HighLightVO;
|
||||
import com.budwk.app.flow.vo.ProcessInstanceVO;
|
||||
import com.budwk.app.flow.vo.ProcessTaskVO;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.difficulthelp.models.DifficultHelpInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
@@ -251,6 +252,15 @@ public class FlowCommonController {
|
||||
public Result revokeTask(@Param("taskId") Long taskId) {
|
||||
// 自己任务
|
||||
ProcessTask selfTask = dao.fetch(ProcessTask.class, taskId);
|
||||
if ("startTask".equals(selfTask.getTaskName())) {
|
||||
ProcessInstance instance = dao.fetch(ProcessInstance.class, selfTask.getProcessInstanceId());
|
||||
if (instance != null && StrUtil.isNotBlank(instance.getBusinessNo())) {
|
||||
DifficultHelpInfo helpInfo = dao.fetch(DifficultHelpInfo.class, instance.getBusinessNo());
|
||||
if (helpInfo != null && !SecurityUtil.getUserId().equals(helpInfo.getCreatedBy())) {
|
||||
return Result.error("只能撤回自己创建的困难帮扶申请");
|
||||
}
|
||||
}
|
||||
}
|
||||
selfTask.setTaskState(ProcessTaskStateEnum.DOING.getCode());
|
||||
|
||||
// 撤销任务
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.budwk.app.flow.handler;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.flow.engine.AssignmentHandler;
|
||||
import com.budwk.app.flow.engine.core.Execution;
|
||||
import com.budwk.app.flow.engine.core.ServiceContext;
|
||||
import com.budwk.app.flow.engine.model.TaskModel;
|
||||
import com.budwk.app.sys.models.Sys_role;
|
||||
import com.budwk.app.sys.models.Sys_user_role;
|
||||
import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.zhgh.staffbenefit.condolence.model.Condolence;
|
||||
import com.budwk.app.zhgh.staffbenefit.difficulthelp.models.DifficultHelpInfo;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FlowRecipientUnitSchoolLeaderHandler implements AssignmentHandler {
|
||||
|
||||
@Override
|
||||
public List<String> assign(TaskModel model, Execution execution) {
|
||||
Dao dao = ServiceContext.find(Dao.class);
|
||||
String businessNo = execution.getProcessInstance().getBusinessNo();
|
||||
if (StrUtil.isBlank(businessNo)) {
|
||||
throw new BaseException("申请记录编号不能为空。");
|
||||
}
|
||||
String processName = execution.getProcessModel().getName();
|
||||
String unitId;
|
||||
if ("KNBF".equals(processName)) {
|
||||
DifficultHelpInfo difficultHelpInfo = dao.fetch(DifficultHelpInfo.class, businessNo);
|
||||
if (difficultHelpInfo == null) {
|
||||
throw new BaseException("未找到申请记录。");
|
||||
}
|
||||
unitId = difficultHelpInfo.getUnitId();
|
||||
} else if ("ZGWW".equals(processName)) {
|
||||
Condolence condolence = dao.fetch(Condolence.class, businessNo);
|
||||
if (condolence == null) {
|
||||
throw new BaseException("未找到申请记录。");
|
||||
}
|
||||
unitId = condolence.getHelpUnitId();
|
||||
} else if ("TSWW".equals(processName)) {
|
||||
com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolence info = dao.fetch(
|
||||
com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolence.class, businessNo);
|
||||
if (info == null) throw new BaseException("未找到申请记录。");
|
||||
unitId = info.getHelpUnitId();
|
||||
} else {
|
||||
throw new BaseException("当前流程不支持获取受助人所在单位分管校领导。");
|
||||
}
|
||||
if (StrUtil.isBlank(unitId)) {
|
||||
throw new BaseException("受助人所在单位不能为空。");
|
||||
}
|
||||
SysRoleService sysRoleService = ServiceContext.find(SysRoleService.class);
|
||||
Sys_role role = sysRoleService.getByCode(RoleConstant.UNIT_SCHOOL_LEADER);
|
||||
List<Sys_user_role> roles = dao.query(
|
||||
Sys_user_role.class,
|
||||
Cnd.where(Sys_user_role::getRoleId, "=", role.getId())
|
||||
.and(Sys_user_role::getUnitId, "=", unitId)
|
||||
);
|
||||
if (Lang.isEmpty(roles)) {
|
||||
throw new BaseException("受助人/申请人所在单位未设置单位分管校领导,请联系校工会进行设置。");
|
||||
}
|
||||
return roles.stream().map(Sys_user_role::getUserId).distinct().toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "获取受助人所在单位分管校领导";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.budwk.app.flow.handler;
|
||||
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.flow.engine.AssignmentHandler;
|
||||
import com.budwk.app.flow.engine.core.Execution;
|
||||
import com.budwk.app.flow.engine.core.ServiceContext;
|
||||
import com.budwk.app.flow.engine.model.TaskModel;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FlowSchoolOfficeDirectorHandler implements AssignmentHandler {
|
||||
|
||||
@Override
|
||||
public List<String> assign(TaskModel model, Execution execution) {
|
||||
Dao dao = ServiceContext.find(Dao.class);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
userRole.userId
|
||||
FROM
|
||||
`sys_user_role` userRole
|
||||
LEFT JOIN sys_role role ON role.id = userRole.roleId
|
||||
WHERE
|
||||
role.`code` = @roleCode
|
||||
GROUP BY
|
||||
userRole.userId
|
||||
""").setParam("roleCode", RoleConstant.SCHOOL_OFFICE_DIRECTOR.name());
|
||||
sql.setCallback(Sqls.callback.strList());
|
||||
dao.execute(sql);
|
||||
return sql.getList(String.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "获取校工会办公室主任";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return AssignmentHandler.super.getOrder();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.budwk.app.flow.engine.event.ProcessEvent;
|
||||
import com.budwk.app.flow.engine.event.ProcessEventListener;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.ProcessEventTypeEnum;
|
||||
import com.budwk.app.flow.service.SchoolOaTodoService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
@@ -17,11 +18,16 @@ public class ProcessTaskEndEventListener implements ProcessEventListener {
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SchoolOaTodoService schoolOaTodoService;
|
||||
|
||||
@Override
|
||||
public void onEvent(ProcessEvent event) {
|
||||
if (event.getEventType() == ProcessEventTypeEnum.PROCESS_TASK_END) {
|
||||
Long sourceId = event.getSourceId();
|
||||
ProcessTask task = dao.fetch(ProcessTask.class, sourceId);
|
||||
// service 区分正常完成与废弃,只有正常完成才发送通达 status=2。
|
||||
schoolOaTodoService.completeTodo(task);
|
||||
System.out.println("流程任务完成事件:" + task.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.budwk.app.flow.engine.event.ProcessEventListener;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.ProcessEventTypeEnum;
|
||||
import com.budwk.app.flow.service.SchoolOaTodoService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
@@ -22,11 +23,16 @@ public class ProcessTaskRevokeEventListener implements ProcessEventListener {
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SchoolOaTodoService schoolOaTodoService;
|
||||
|
||||
@Override
|
||||
public void onEvent(ProcessEvent event) {
|
||||
if(event.getEventType()== ProcessEventTypeEnum.PROCESS_TASK_REVOKE){
|
||||
Long taskId = event.getSourceId();
|
||||
ProcessTask task = dao.fetch(ProcessTask.class, taskId);
|
||||
// 公开通达协议未定义取消,集中记录未同步事项,不把撤回冒充正常已办。
|
||||
schoolOaTodoService.cancelTodo(task);
|
||||
|
||||
String taskDisplayName = task.getDisplayName();
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.entity.ProcessTaskActor;
|
||||
import com.budwk.app.flow.enums.ProcessEventTypeEnum;
|
||||
import com.budwk.app.zhgh.dayofficework.message.service.GlobalMessageSendService;
|
||||
import com.budwk.app.zhgh.staffbenefit.difficulthelp.service.DifficultHelpCommonService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
@@ -30,13 +31,22 @@ public class ProcessTaskStartEventListener implements ProcessEventListener {
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private GlobalMessageSendService globalMessageSendService;
|
||||
@Inject
|
||||
private DifficultHelpCommonService difficultHelpCommonService;
|
||||
|
||||
@Override
|
||||
public void onEvent(ProcessEvent event) {
|
||||
if (event.getEventType() == ProcessEventTypeEnum.PROCESS_TASK_START) {
|
||||
Long sourceId = event.getSourceId();
|
||||
ProcessTask task = dao.fetch(ProcessTask.class, sourceId);
|
||||
if (task == null) return;
|
||||
sendMessage(task);
|
||||
// 节点及接收人判断集中在业务 service;通知失败不向流程提交接口抛出异常。
|
||||
try {
|
||||
difficultHelpCommonService.notifyOfficeApproval(task);
|
||||
} catch (Exception e) {
|
||||
log.error("困难帮扶企业微信待办通知异常,taskId={}", sourceId, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.budwk.app.flow.service;
|
||||
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
|
||||
/** 通达 OA 待办同步入口,WF 调用方无需处理鉴权、人员映射或接口参数。 */
|
||||
public interface SchoolOaTodoService {
|
||||
/**
|
||||
* 推送已创建且已分配参与人的 WF 任务;首次自动提交的 startTask 不发送。
|
||||
* @param task 包含任务 ID、实例 ID、状态和表单地址的完整任务
|
||||
* @return 无返回值;开关关闭时跳过,开启后请求失败抛出业务异常
|
||||
*/
|
||||
void createTodo(ProcessTask task);
|
||||
|
||||
/**
|
||||
* 将已完成任务对应的接收人待办同步为 status=2;非完成状态不冒充已办。
|
||||
* @param task 数据库中的完整任务,使用原发起人、接收人、标题和地址组装请求
|
||||
* @return 无返回值;errcode=0 表示接口接受请求,原待办匹配规则仍需学校联调确认
|
||||
*/
|
||||
void completeTodo(ProcessTask task);
|
||||
|
||||
/**
|
||||
* 记录需取消的 OA 待办。通达公开文档未提供取消接口,本方法不发送虚构的删除请求。
|
||||
* @param task 撤回、废弃或转办的原任务,用于记录任务 ID 和状态
|
||||
* @return 无返回值;仅在开关开启时输出待人工处理提示,不代表 OA 已取消
|
||||
*/
|
||||
void cancelTodo(ProcessTask task);
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import com.budwk.app.flow.enums.*;
|
||||
import com.budwk.app.flow.service.ProcessDefineService;
|
||||
import com.budwk.app.flow.service.ProcessInstanceService;
|
||||
import com.budwk.app.flow.service.ProcessTaskService;
|
||||
import com.budwk.app.flow.service.SchoolOaTodoService;
|
||||
import com.budwk.app.flow.vo.ProcessTaskVO;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
@@ -56,6 +57,9 @@ public class ProcessTaskServiceImpl extends BaseServiceImpl<ProcessTask> impleme
|
||||
@Inject
|
||||
private ProcessDefineService processDefineService;
|
||||
|
||||
@Inject
|
||||
private SchoolOaTodoService schoolOaTodoService;
|
||||
|
||||
@Override
|
||||
public boolean save(ProcessTask param) {
|
||||
param.setId(null);
|
||||
@@ -213,6 +217,8 @@ public class ProcessTaskServiceImpl extends BaseServiceImpl<ProcessTask> impleme
|
||||
System.out.println("创建任务:" + processTask.getTaskName() + "," + processTask.getDisplayName());
|
||||
processTaskList.add(processTask);
|
||||
addTaskActor(processTask.getId(), getTaskActors(taskModel, execution));
|
||||
// 参与人落库后统一推送通达待办,开始监听器不再重复推送。
|
||||
schoolOaTodoService.createTodo(processTask);
|
||||
|
||||
return processTaskList;
|
||||
}
|
||||
@@ -284,6 +290,8 @@ public class ProcessTaskServiceImpl extends BaseServiceImpl<ProcessTask> impleme
|
||||
clone.setUpdatedBy(null);
|
||||
dao().insert(clone);
|
||||
addTaskActor(clone.getId(), CollectionUtil.newArrayList(actor));
|
||||
// 并行加签绕过普通节点创建入口,需要为新增的个人任务同步待办。
|
||||
schoolOaTodoService.createTodo(clone);
|
||||
});
|
||||
|
||||
}
|
||||
@@ -318,6 +326,7 @@ public class ProcessTaskServiceImpl extends BaseServiceImpl<ProcessTask> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public ProcessTask rejectTask(ProcessModel model, ProcessTask currentTask) {
|
||||
Long taskParentId = currentTask.getTaskParentId();
|
||||
if (ObjectUtil.isEmpty(taskParentId) || taskParentId.equals(0L)) {
|
||||
@@ -351,6 +360,8 @@ public class ProcessTaskServiceImpl extends BaseServiceImpl<ProcessTask> impleme
|
||||
}
|
||||
saveProcessTask(task);
|
||||
addTaskActor(task.getId(), CollectionUtil.newArrayList(task.getOperator()));
|
||||
// 驳回创建了新的任务 ID,按新任务推送,避免复用历史待办。
|
||||
schoolOaTodoService.createTodo(task);
|
||||
return task;
|
||||
}
|
||||
|
||||
@@ -424,6 +435,8 @@ public class ProcessTaskServiceImpl extends BaseServiceImpl<ProcessTask> impleme
|
||||
System.out.println("创建会签任务:" + processTask.getTaskName() + "," + processTask.getDisplayName());
|
||||
processTaskList.add(processTask);
|
||||
addTaskActor(processTask.getId(), CollectionUtil.newArrayList(taskActor));
|
||||
// 串行和并行会签均按实际生成的个人任务发送待办。
|
||||
schoolOaTodoService.createTodo(processTask);
|
||||
});
|
||||
ProcessInstanceService processInstanceService = ServiceContext.find(ProcessInstanceService.class);
|
||||
// 更新会签变量到流程实例参数中
|
||||
@@ -496,9 +509,12 @@ public class ProcessTaskServiceImpl extends BaseServiceImpl<ProcessTask> impleme
|
||||
|
||||
// 创建转办任务参与者
|
||||
addTaskActor(newTask.getId(), List.of(transferUserId));
|
||||
// 通达取消协议待学校确认;先明确记录原待办未清理,再向新办理人推送。
|
||||
schoolOaTodoService.cancelTodo(task);
|
||||
schoolOaTodoService.createTodo(newTask);
|
||||
|
||||
// 发布流程任务开始事件
|
||||
List<ProcessTask> processTaskList = List.of(task);
|
||||
List<ProcessTask> processTaskList = List.of(newTask);
|
||||
processTaskList.forEach(processTask -> {
|
||||
ProcessPublisher.notify(ProcessEvent.builder().eventType(ProcessEventTypeEnum.PROCESS_TASK_START).sourceId(processTask.getId()).build());
|
||||
});
|
||||
|
||||
@@ -0,0 +1,344 @@
|
||||
package com.budwk.app.flow.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.entity.ProcessTaskActor;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.flow.service.SchoolOaTodoService;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.web.commons.base.Globals;
|
||||
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.ioc.aop.Aop;
|
||||
import org.nutz.ioc.impl.PropertiesProxy;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 通达 V13 流程中心接口适配。所有配置、token 和 HTTP 请求集中在本服务。
|
||||
* 接口依据:https://open.tongda2000.com/oa/v13/interface.html
|
||||
* 同步请求失败向调用方抛出异常;本地事务不能撤销已经成功的远端请求。
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
public class SchoolOaTodoServiceImpl implements SchoolOaTodoService {
|
||||
private static final String PREFIX = "school-oa.todo.";
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private PropertiesProxy conf;
|
||||
|
||||
// token 由同步方法保护;实例内缓存有效期,避免每位接收人重复申请凭据。
|
||||
private String accessToken;
|
||||
private long tokenExpiresAt;
|
||||
private String tokenConfig;
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void createTodo(ProcessTask task) {
|
||||
if (!isEnabled()) return;
|
||||
requireTask(task);
|
||||
if (isInitialTask(task) || !ProcessTaskStateEnum.DOING.getCode().equals(task.getTaskState())) return;
|
||||
sendTask(task, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void completeTodo(ProcessTask task) {
|
||||
if (!isEnabled()) return;
|
||||
requireTask(task);
|
||||
if (isInitialTask(task)) return;
|
||||
// 废弃任务也会发布结束事件;尤其提案附议仍可能可办理,不能直接改为 OA 已办。
|
||||
if (!ProcessTaskStateEnum.FINISHED.getCode().equals(task.getTaskState())) {
|
||||
cancelTodo(task);
|
||||
return;
|
||||
}
|
||||
sendTask(task, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelTodo(ProcessTask task) {
|
||||
if (!isEnabled()) return;
|
||||
requireTask(task);
|
||||
if (isInitialTask(task)) return;
|
||||
log.warn("通达OA取消规则尚未提供,本次未发送取消请求,请核对OA原待办:taskId={},instanceId={},state={}",
|
||||
task.getId(), task.getProcessInstanceId(), task.getTaskState());
|
||||
}
|
||||
|
||||
/** 系统参数优先于文件配置,只有明确为 true 才启用;未配置不访问数据库或 OA。 */
|
||||
private boolean isEnabled() {
|
||||
Object enabled = Globals.MyConfig.get("AppSchoolOa");
|
||||
return Boolean.parseBoolean(enabled == null ? conf.get(PREFIX + "enabled", "false") : enabled.toString());
|
||||
}
|
||||
|
||||
private void requireTask(ProcessTask task) {
|
||||
if (task == null || task.getId() == null || task.getProcessInstanceId() == null) {
|
||||
throw new BaseException("通达OA同步失败:任务或流程实例ID为空");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isInitialTask(ProcessTask task) {
|
||||
return Long.valueOf(0L).equals(task.getTaskParentId()) && "startTask".equals(task.getTaskName());
|
||||
}
|
||||
|
||||
/**
|
||||
* task 为完整 WF 任务;status 只允许本服务传入 1(待办)或 2(已办)。
|
||||
* sender/recipient 使用学校绑定的第三方用户标识;content 为 JSON 字符串,url 为 UTF-8 Base64。
|
||||
* 每个接收人单独请求,响应 JSON 中必须有 errcode=0;不采用参考项目的 uniqueId/state 协议。
|
||||
*/
|
||||
private void sendTask(ProcessTask task, int status) {
|
||||
ProcessInstance instance = dao.fetch(ProcessInstance.class, task.getProcessInstanceId());
|
||||
if (instance == null) throw new BaseException("通达OA同步失败:流程实例不存在");
|
||||
Sys_user sender = dao.fetch(Sys_user.class, instance.getOperator());
|
||||
if (sender == null) throw new BaseException("通达OA同步失败:流程发起人不存在");
|
||||
List<ProcessTaskActor> actors = dao.query(ProcessTaskActor.class,
|
||||
Cnd.where(ProcessTaskActor::getProcessTaskId, "=", task.getId()));
|
||||
if (actors.isEmpty()) throw new BaseException("通达OA同步失败:任务参与人为空");
|
||||
|
||||
String senderId = userIdentifier(sender.getId(), sender.getLoginname());
|
||||
String title = StrUtil.blankToDefault(JSONUtil.parseObj(StrUtil.blankToDefault(instance.getVariable(), "{}"))
|
||||
.getStr(FlowConst.PROCESS_INSTANCE_NAME), "流程申请") + " - " + task.getDisplayName();
|
||||
String targetUrl = buildTaskUrl(task, instance);
|
||||
String systemParam = conf.get(PREFIX + "system-id-param", "clientid");
|
||||
if (!"clientid".equals(systemParam) && !"exsId".equals(systemParam)) {
|
||||
throw new BaseException("通达OA配置 system-id-param 仅支持 clientid 或 exsId");
|
||||
}
|
||||
Map<String, Object> params = new LinkedHashMap<>();
|
||||
params.put(systemParam, requireConfig("system-id"));
|
||||
params.put("status", status);
|
||||
params.put("sender", senderId);
|
||||
params.put("content", JSONUtil.quote(title));
|
||||
params.put("url", Base64.getEncoder().encodeToString(targetUrl.getBytes(StandardCharsets.UTF_8)));
|
||||
// 先校验全部人员,避免处理到中途才发现缺少账号;不假设本地用户 ID 就是 OA 用户 ID。
|
||||
List<String> recipients = actors.stream()
|
||||
.filter(actor -> !FlowConst.ADMIN_ID.equals(actor.getActorId())
|
||||
&& !"superadmin".equalsIgnoreCase(actor.getActorAccount()))
|
||||
.map(actor -> userIdentifier(actor.getActorId(), actor.getActorAccount())).distinct().toList();
|
||||
for (String recipient : recipients) {
|
||||
params.put("recipient", recipient);
|
||||
String endpoint = baseUrl() + "/restapi/1_0/appcenter/affairprocessing?" + encodeParams(params);
|
||||
JSONObject result = execute(HttpRequest.get(endpoint).header("Authorization", "Bearer " + getAccessToken()), "待办同步");
|
||||
Integer errorCode = result.getInt("errcode");
|
||||
if (errorCode == null || errorCode != 0) {
|
||||
String detail = responseError(result);
|
||||
log.error("通达OA待办业务失败,taskId={},instanceId={},status={},errcode={},detail={}",
|
||||
task.getId(), task.getProcessInstanceId(), status, errorCode, detail);
|
||||
throw new BaseException("通达OA待办同步失败:errcode={},taskId={},{}", errorCode, task.getId(), detail);
|
||||
}
|
||||
log.info("通达OA接受待办同步请求,taskId={},status={}", task.getId(), status);
|
||||
}
|
||||
}
|
||||
|
||||
/** 用户映射按学校绑定选择 loginname 或 id,发送人与接收人使用同一规则。 */
|
||||
private String userIdentifier(String id, String account) {
|
||||
String mode = conf.get(PREFIX + "user-id-mode", "loginname");
|
||||
if (!"loginname".equals(mode) && !"id".equals(mode)) {
|
||||
throw new BaseException("通达OA配置 user-id-mode 仅支持 loginname 或 id");
|
||||
}
|
||||
String value = "id".equals(mode) ? id : account;
|
||||
if (StrUtil.isBlank(value) || value.contains(",")) {
|
||||
throw new BaseException("通达OA同步失败:绑定用户标识为空或包含逗号");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/** 通达仅有一个 url 字段,沿用当前 PC 审核页并携带任务、实例及业务参数。 */
|
||||
private String buildTaskUrl(ProcessTask task, ProcessInstance instance) {
|
||||
String form = task.getFormKey();
|
||||
if (StrUtil.isBlank(form)) throw new BaseException("通达OA同步失败:任务PC表单地址为空");
|
||||
String url = form.startsWith("http://") || form.startsWith("https://") ? form
|
||||
: StrUtil.removeSuffix(Globals.AppDomain, "/") + "/" + StrUtil.removePrefix(form, "/");
|
||||
// 原表单带锚点时,查询参数必须放在 # 前,否则服务端收不到 taskId。
|
||||
int fragmentIndex = url.indexOf('#');
|
||||
String fragment = fragmentIndex < 0 ? "" : url.substring(fragmentIndex);
|
||||
if (fragmentIndex >= 0) url = url.substring(0, fragmentIndex);
|
||||
Map<String, Object> query = new LinkedHashMap<>();
|
||||
query.put("taskId", task.getId());
|
||||
query.put("instanceId", instance.getId());
|
||||
query.put("bizId", StrUtil.nullToEmpty(instance.getBusinessNo()));
|
||||
query.put("taskKey", StrUtil.nullToEmpty(task.getTaskName()));
|
||||
return url + (url.contains("?") ? "&" : "?") + encodeParams(query) + fragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /oauth2/token:client_secret 必须是学校提供的 AES 加密结果,不是明文密钥。
|
||||
* 返回 access_token 和 expires_in(秒);缓存提前过期,配置变化立即重新申请。
|
||||
*/
|
||||
private synchronized String getAccessToken() {
|
||||
String base = baseUrl();
|
||||
String clientId = requireConfig("client-id");
|
||||
String secret = requireConfig("client-secret-encrypted");
|
||||
String username = conf.get(PREFIX + "token-username", "username");
|
||||
String password = conf.get(PREFIX + "token-password", "password");
|
||||
String currentConfig = JSONUtil.toJsonStr(List.of(base, clientId, secret, username, password));
|
||||
long now = System.currentTimeMillis();
|
||||
if (currentConfig.equals(tokenConfig) && StrUtil.isNotBlank(accessToken) && now < tokenExpiresAt) {
|
||||
// 只记录缓存剩余有效期,便于区分复用与重新获取,不输出凭据。
|
||||
log.info("通达OA复用token缓存,remainingSeconds={}", (tokenExpiresAt - now) / 1000L);
|
||||
return accessToken;
|
||||
}
|
||||
Map<String, Object> form = new LinkedHashMap<>();
|
||||
form.put("grant_type", "password");
|
||||
form.put("client_id", clientId);
|
||||
form.put("client_secret", secret);
|
||||
form.put("username", username);
|
||||
form.put("password", password);
|
||||
long startedAt = System.nanoTime();
|
||||
JSONObject result = execute(HttpRequest.post(base + "/oauth2/token")
|
||||
.header("Content-Type", "application/x-www-form-urlencoded")
|
||||
.body(encodeParams(form)), "获取凭据");
|
||||
String token = result.getStr("access_token");
|
||||
Long expires = result.getLong("expires_in");
|
||||
if (StrUtil.isBlank(token) || expires == null || expires <= 0 || expires > Integer.MAX_VALUE) {
|
||||
String detail = responseError(result);
|
||||
log.error("通达OA获取凭据业务失败,缺少有效的 access_token 或 expires_in,detail={}", detail);
|
||||
throw new BaseException("通达OA获取凭据失败:缺少有效的 access_token 或 expires_in,{}", detail);
|
||||
}
|
||||
accessToken = token;
|
||||
tokenConfig = currentConfig;
|
||||
tokenExpiresAt = now + (expires - Math.min(60, expires / 10)) * 1000L;
|
||||
log.info("通达OA获取token成功,elapsedMs={},expiresInSeconds={}",
|
||||
(System.nanoTime() - startedAt) / 1_000_000, expires);
|
||||
return token;
|
||||
}
|
||||
|
||||
/** HTTP 成功不代表业务成功;本方法只验证状态码和 JSON,业务码由调用处校验。 */
|
||||
private JSONObject execute(HttpRequest request, String action) {
|
||||
long startedAt = System.nanoTime();
|
||||
int timeout = conf.getInt(PREFIX + "timeout-ms", 10000);
|
||||
// 只记录接口地址,不记录 GET 查询参数、请求头或 token 请求正文。
|
||||
String endpoint = request.getUrl().split("[?#]", 2)[0];
|
||||
try (HttpResponse response = request.timeout(timeout).execute()) {
|
||||
String body = response.body();
|
||||
boolean jsonObject = JSONUtil.isTypeJSONObject(body);
|
||||
// 非 JSON 错误常为 OA 或网关的 HTML 页面;仅在日志保留脱敏摘要,不把页面返回给前端。
|
||||
if (!jsonObject) {
|
||||
log.error("通达OA非JSON响应,action={},method={},endpoint={},httpStatus={},contentType={},bodySummary={}",
|
||||
action, request.getMethod(), endpoint, response.getStatus(),
|
||||
redact(response.header("Content-Type")), responseBodySummary(body));
|
||||
}
|
||||
if (!response.isOk()) {
|
||||
if (response.getStatus() == 401) invalidateToken();
|
||||
String detail = jsonObject
|
||||
? responseError(JSONUtil.parseObj(body)) : "响应不是JSON对象,脱敏响应摘要请查看服务端日志";
|
||||
throw new BaseException("通达OA{}失败:HTTP {},{}", action, response.getStatus(), detail);
|
||||
}
|
||||
if (!jsonObject) throw new BaseException("通达OA{}失败:响应不是JSON对象,脱敏响应摘要请查看服务端日志", action);
|
||||
return JSONUtil.parseObj(body);
|
||||
} catch (Exception e) {
|
||||
long elapsed = (System.nanoTime() - startedAt) / 1_000_000;
|
||||
Throwable root = e;
|
||||
Map<Throwable, Boolean> visited = new IdentityHashMap<>();
|
||||
while (root.getCause() != null && visited.put(root, Boolean.TRUE) == null
|
||||
&& !visited.containsKey(root.getCause())) root = root.getCause();
|
||||
String detail = root.getClass().getName() + ": " + redact(root.getMessage());
|
||||
// 保留各层原因、原始栈帧及 suppressed 异常;先复制脱敏,避免全局异常处理器泄露凭证。
|
||||
Throwable safeCause = diagnosticCause(e, new IdentityHashMap<>());
|
||||
log.error("通达OA请求失败,action={},method={},endpoint={},elapsedMs={},timeoutMs={},rootCause={}",
|
||||
action, request.getMethod(), endpoint, elapsed, timeout, detail, safeCause);
|
||||
// 不自动重放写请求,超时可能发生在远端已成功之后;避免重复待办。
|
||||
BaseException failure = new BaseException("通达OA{}失败,耗时{}ms:{};请核对远端结果后再重试", action, elapsed, detail);
|
||||
failure.initCause(safeCause);
|
||||
throw failure;
|
||||
}
|
||||
}
|
||||
|
||||
/** body 为远端非 JSON 正文;先脱敏再截取最多 2000 字符,避免截断凭据后无法匹配脱敏。 */
|
||||
private String responseBodySummary(String body) {
|
||||
if (StrUtil.isBlank(body)) return "[空响应正文]";
|
||||
String safe = redact(body);
|
||||
return safe.length() > 2000 ? safe.substring(0, 2000) + "[已截断]" : safe;
|
||||
}
|
||||
|
||||
/** 只提取接口错误字段,不输出含 access_token、refresh_token 等内容的整个响应。 */
|
||||
private String responseError(JSONObject response) {
|
||||
Map<String, Object> errors = new LinkedHashMap<>();
|
||||
for (String key : List.of("error", "error_description", "errcode", "errmsg", "message")) {
|
||||
if (response.containsKey(key)) errors.put(key, redact(String.valueOf(response.get(key))));
|
||||
}
|
||||
return errors.isEmpty() ? "OA未返回错误说明" : JSONUtil.toJsonStr(errors);
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制异常诊断信息,message 标注原异常类型,保留原始栈帧和原因链。
|
||||
* visited 防止第三方异常存在循环引用;原异常不修改,也不直接写入日志。
|
||||
*/
|
||||
private Throwable diagnosticCause(Throwable source, Map<Throwable, Throwable> visited) {
|
||||
if (visited.containsKey(source)) return visited.get(source);
|
||||
RuntimeException copy = new RuntimeException(source.getClass().getName() + ": " + redact(source.getMessage()));
|
||||
visited.put(source, copy);
|
||||
copy.setStackTrace(source.getStackTrace());
|
||||
if (source.getCause() != null && !visited.containsKey(source.getCause())) {
|
||||
copy.initCause(diagnosticCause(source.getCause(), visited));
|
||||
}
|
||||
for (Throwable suppressed : source.getSuppressed()) {
|
||||
if (!visited.containsKey(suppressed)) copy.addSuppressed(diagnosticCause(suppressed, visited));
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** 清除已知凭证及可能被远端回显的认证字段、URL查询参数,并移除日志换行。 */
|
||||
private String redact(String message) {
|
||||
if (message == null) return "无异常说明";
|
||||
String text = message;
|
||||
for (String key : List.of("client-secret-encrypted", "token-password", "client-id")) {
|
||||
String value = conf.get(PREFIX + key);
|
||||
if (StrUtil.isNotBlank(value)) {
|
||||
text = text.replace(value, "[REDACTED]")
|
||||
.replace(URLEncoder.encode(value, StandardCharsets.UTF_8), "[REDACTED]");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(accessToken)) text = text.replace(accessToken, "[REDACTED]");
|
||||
text = text.replaceAll("(?i)Bearer\\s+[^\\s,;\\\"']+", "Bearer [REDACTED]");
|
||||
text = text.replaceAll("(?i)((?:client_secret|access_token|refresh_token|password|authorization)[\\\"']?\\s*[:=]\\s*)[\\\"']?[^\\s&,;}\\\"']+[\\\"']?", "$1[REDACTED]");
|
||||
text = text.replaceAll("(https?://[^\\s?#]+)\\?[^\\s]+", "$1?[REDACTED]");
|
||||
return text.replace('\r', ' ').replace('\n', ' ');
|
||||
}
|
||||
|
||||
private synchronized void invalidateToken() {
|
||||
accessToken = null;
|
||||
tokenExpiresAt = 0;
|
||||
}
|
||||
|
||||
private String baseUrl() {
|
||||
String value = requireConfig("base-url");
|
||||
URI uri = URI.create(value);
|
||||
if ((!"http".equals(uri.getScheme()) && !"https".equals(uri.getScheme()))
|
||||
|| uri.getHost() == null || uri.getQuery() != null || uri.getFragment() != null || uri.getUserInfo() != null) {
|
||||
throw new BaseException("通达OA base-url 必须为不含账号、查询参数和锚点的HTTP(S)地址");
|
||||
}
|
||||
return StrUtil.removeSuffix(value, "/");
|
||||
}
|
||||
|
||||
private String requireConfig(String key) {
|
||||
String value = conf.get(PREFIX + key);
|
||||
if (StrUtil.isBlank(value)) throw new BaseException("通达OA配置 {} 未填写", PREFIX + key);
|
||||
return value.trim();
|
||||
}
|
||||
|
||||
/** 每个参数单独编码,保留标题中的中文、引号及 Base64 中的 +、/、=。 */
|
||||
private String encodeParams(Map<String, Object> params) {
|
||||
return params.entrySet().stream().map(entry -> URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8)
|
||||
+ "=" + URLEncoder.encode(String.valueOf(entry.getValue()), StandardCharsets.UTF_8))
|
||||
.collect(Collectors.joining("&"));
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.http.HtmlUtil;
|
||||
import com.budwk.app.base.constant.RedisConstant;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.sms.SmsService;
|
||||
import com.budwk.app.base.wxwork.WxWorkMessageService;
|
||||
import com.budwk.app.base.sms.model.MsgPlatformWechatRequest;
|
||||
import com.budwk.app.base.utils.ManyAddOrRenewUtil;
|
||||
import com.budwk.app.sys.models.Sys_msg;
|
||||
@@ -62,6 +63,8 @@ public class SysMsgServiceImpl extends BaseServiceImpl<Sys_msg> implements SysMs
|
||||
private ManyAddOrRenewUtil manyAddOrRenewUtil;
|
||||
@Inject
|
||||
private SmsService smsService;
|
||||
@Inject
|
||||
private WxWorkMessageService wxWorkMessageService;
|
||||
|
||||
private static NutMap typeMap = NutMap.NEW().addv("system", "系统消息").addv("user", "用户消息");
|
||||
|
||||
@@ -102,14 +105,29 @@ public class SysMsgServiceImpl extends BaseServiceImpl<Sys_msg> implements SysMs
|
||||
}
|
||||
});
|
||||
|
||||
//发送学校平台消息
|
||||
ThreadUtil.execute(() -> {
|
||||
for (String loginName : loginNames) {
|
||||
smsService.sendSmsByAccount(loginName,sysMsg.getNote());
|
||||
smsService.sendWechatTextByAccountOrMobile(loginName,sysMsg.getNote());
|
||||
}
|
||||
|
||||
});
|
||||
// isExternal=false 为仅站内通知;外部通道分别处理异常,避免短信失败阻断企业微信。
|
||||
if (isExternal) {
|
||||
ThreadUtil.execute(() -> {
|
||||
for (String loginName : loginNames) {
|
||||
try {
|
||||
smsService.sendSmsByAccount(loginName, sysMsg.getNote());
|
||||
} catch (Exception e) {
|
||||
log.error("消息短信发送失败,msgId=" + sysMsg.getId(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
ThreadUtil.execute(() -> {
|
||||
try {
|
||||
// 学校企业微信 userid 直接使用 loginname;批量发送标题、正文及业务链接。
|
||||
NutMap result = wxWorkMessageService.massSend(loginNames, sysMsg.getTitle(), sysMsg.getNote(), sysMsg.getUrl());
|
||||
if (!result.getBoolean("skipped", false) && !result.getBoolean("success", false)) {
|
||||
log.warn("企业微信消息存在失败接收人,msgId=" + sysMsg.getId() + ",result=" + result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("企业微信消息发送失败,msgId=" + sysMsg.getId(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return sysMsg;
|
||||
}
|
||||
@@ -292,11 +310,13 @@ public class SysMsgServiceImpl extends BaseServiceImpl<Sys_msg> implements SysMs
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void sendMsg(String loginname, String title, String body, String sender) {
|
||||
sendMsg(List.of(loginname), title, body, SecurityUtil.getUserId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void sendMsg(List<String> loginNames, String title, String body, String sender) {
|
||||
Sys_msg sysMsg = new Sys_msg();
|
||||
sysMsg.setTitle(title);
|
||||
@@ -309,6 +329,7 @@ public class SysMsgServiceImpl extends BaseServiceImpl<Sys_msg> implements SysMs
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void sendMsgInSys(List<String> loginNames, String title, String body, String sender) {
|
||||
Sys_msg sysMsg = new Sys_msg();
|
||||
sysMsg.setTitle(title);
|
||||
|
||||
@@ -189,25 +189,16 @@ public class WkFailProcessor extends ViewProcessor {
|
||||
if (Globals.sso) {
|
||||
//1.判断是否为企业微信浏览器并且对接了企业微信
|
||||
if (browserPlatform == BrowserPlatform.QI_YE_WEI_XIN && propertiesProxy.getBoolean("wxwork.enable", false)) {
|
||||
//进行企业微信授权
|
||||
// String token = getWxWorkToken();
|
||||
// if (StrUtil.isNotBlank(token)) {
|
||||
// //跳转到企业微信授权地址
|
||||
// new ServerRedirectView(buildWxWorkOauth2Url()).render(request, response, null);
|
||||
// } else {
|
||||
// //跳转到错误页 别问我为啥错了 我也不知道 首先去检查配置文件里的参数有没有写对
|
||||
//// new ServerRedirectView(Globals.AppDomain + errorUri).render(request, response, null);
|
||||
// //跳转到cas登录页
|
||||
// String callBackUrl = propertiesProxy.get("cas.client-host-url") + propertiesProxy.get("cas.client-call-back-url") + "?redirect=" + redirect;
|
||||
// String authUrl = propertiesProxy.get("cas.qi-wx-server-login-url") + "?service=" + URLEncoder.encode(callBackUrl, StandardCharsets.UTF_8);
|
||||
// new ServerRedirectView(authUrl).render(request, response, null);
|
||||
// }
|
||||
|
||||
// 武汉城市职业学院 跳转到企业微信cas登录页
|
||||
String callBackUrl = propertiesProxy.get("wecom.wecom-client-host-url") + propertiesProxy.get("wecom.wecom-client-call-back-url") + "?redirect=" + redirect;
|
||||
String authUrl = propertiesProxy.get("wecom.wecom-server-login-url") + "?service=" + URLEncoder.encode(callBackUrl, StandardCharsets.UTF_8);
|
||||
log.info("auth:"+authUrl);
|
||||
new ServerRedirectView(authUrl).render(request, response, null);
|
||||
// 专用企业微信认证配置缺失时整组回退到已接通的 CAS,保留卡片原始页面。
|
||||
try {
|
||||
String authUrl = buildEnterpriseCasUrl(redirect);
|
||||
log.info("auth:" + authUrl);
|
||||
new ServerRedirectView(authUrl).render(request, response, null);
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.error("企业微信登录跳转配置无效:" + e.getMessage());
|
||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||
"统一身份认证配置不完整或无效,请联系管理员检查认证地址及回调地址");
|
||||
}
|
||||
} else if (browserPlatform == BrowserPlatform.WEI_XIN && propertiesProxy.getBoolean("wx.enable", false)) {
|
||||
//进行微信公众号授权
|
||||
//跳转到微信授权页
|
||||
@@ -225,6 +216,53 @@ public class WkFailProcessor extends ViewProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造企业微信内的 CAS 登录地址。redirect 为已 URL 编码的原始站内路径及查询参数;
|
||||
* 返回携带 service 参数的完整认证 URL,认证回调通过 redirect 返回卡片页面。
|
||||
* 三个 wecom 配置必须同时存在,否则整体使用 cas 配置,避免混用两套认证平台。
|
||||
*/
|
||||
private String buildEnterpriseCasUrl(String redirect) {
|
||||
String loginUrl = propertiesProxy.get("wecom.wecom-server-login-url");
|
||||
String clientHost = propertiesProxy.get("wecom.wecom-client-host-url");
|
||||
String callbackPath = propertiesProxy.get("wecom.wecom-client-call-back-url");
|
||||
if (missingAuthConfig(loginUrl) || missingAuthConfig(clientHost) || missingAuthConfig(callbackPath)) {
|
||||
loginUrl = propertiesProxy.get("cas.server-login-url");
|
||||
clientHost = propertiesProxy.get("cas.client-host-url");
|
||||
callbackPath = propertiesProxy.get("cas.client-call-back-url");
|
||||
}
|
||||
if (missingAuthConfig(loginUrl) || missingAuthConfig(clientHost) || missingAuthConfig(callbackPath)) {
|
||||
throw new IllegalArgumentException("CAS 登录地址、系统域名或回调路径为空");
|
||||
}
|
||||
loginUrl = loginUrl.trim();
|
||||
clientHost = clientHost.trim();
|
||||
callbackPath = callbackPath.trim();
|
||||
validateAuthUrl(loginUrl);
|
||||
validateAuthUrl(clientHost);
|
||||
// 回调必须是本系统路径,不能被绝对 URL 或双斜线路径覆盖到其他主机。
|
||||
if (!callbackPath.startsWith("/") || callbackPath.startsWith("//") || callbackPath.contains("#")) {
|
||||
throw new IllegalArgumentException("认证回调必须是以单斜线开头的站内路径");
|
||||
}
|
||||
String callback = clientHost.replaceAll("/+$", "") + callbackPath
|
||||
+ (callbackPath.contains("?") ? "&" : "?") + "redirect=" + redirect;
|
||||
// 保留部署配置中的 HTTP/HTTPS 协议;工会 HTTPS 回调不会被改为 HTTP。
|
||||
return loginUrl + (loginUrl.contains("?") ? "&" : "?") + "service="
|
||||
+ URLEncoder.encode(callback, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/** 空值和字面量 null 都视为未配置,防止拼接出浏览器相对地址 null?service=...。 */
|
||||
private boolean missingAuthConfig(String value) {
|
||||
return StrUtil.isBlank(value) || "null".equalsIgnoreCase(value.trim());
|
||||
}
|
||||
|
||||
/** 认证地址和回调域名必须为完整 HTTP(S) URL,拒绝无主机名、片段或用户信息的地址。 */
|
||||
private void validateAuthUrl(String value) {
|
||||
java.net.URI uri = java.net.URI.create(value);
|
||||
if (!("https".equalsIgnoreCase(uri.getScheme()) || "http".equalsIgnoreCase(uri.getScheme()))
|
||||
|| uri.getHost() == null || uri.getFragment() != null || uri.getUserInfo() != null) {
|
||||
throw new IllegalArgumentException("认证配置不是有效的 HTTP(S) 地址");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断浏览器平台
|
||||
*
|
||||
|
||||
+33
-31
@@ -82,16 +82,7 @@ import java.util.stream.Collectors;
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> implements ProposalCommonService {
|
||||
|
||||
/** 确定立案提案的 Word 模板编码。 */
|
||||
private static final String PROPOSAL_CONFIRM_FILING_TEMPLATE_CODE = "proposal_confirm_filing";
|
||||
|
||||
/** 工作建议提案的 Word 模板编码。 */
|
||||
private static final String PROPOSAL_SUGGESTION_TEMPLATE_CODE = "proposal_suggestion";
|
||||
|
||||
/** 不予立案提案的 Word 模板编码。 */
|
||||
private static final String PROPOSAL_NOT_TEMPLATE_CODE = "proposal_not";
|
||||
|
||||
/** 历史提案立案结果为空或无法识别时使用的原 Word 模板编码。 */
|
||||
/** 所有立案结果统一使用重庆工贸提案征集表模板。 */
|
||||
private static final String PROPOSAL_DEFAULT_TEMPLATE_CODE = "proposal";
|
||||
|
||||
/** PC端提案列表页面的排序字段白名单,页面代码由对应Controller固定传入。 */
|
||||
@@ -1367,6 +1358,11 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
execute(sql);
|
||||
NutMap docData = (NutMap) sql.getResult();
|
||||
|
||||
// 提案可能已被删除,避免在读取模板字段时产生空指针。
|
||||
if (docData == null) {
|
||||
throw new BaseException("提案信息不存在");
|
||||
}
|
||||
|
||||
//处理下富文本
|
||||
String brief = docData.getString("brief");
|
||||
String measures = docData.getString("measures");
|
||||
@@ -1381,12 +1377,23 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
ProcessInstance processInstance = dao().fetch(ProcessInstance.class, Cnd.where(ProcessInstance::getBusinessNo, "=", id));
|
||||
|
||||
List<ProcessTaskVO> doneTaskVos = new ArrayList<>();
|
||||
List<ProcessTask> doneTaskList = flowEngine.processTaskService().getDoneTaskList(processInstance.getId(), null);
|
||||
for (ProcessTask doneTask : doneTaskList) {
|
||||
ProcessTaskVO taskVO = flowEngine.processTaskService().findById(doneTask.getId());
|
||||
doneTaskVos.add(taskVO);
|
||||
// 尚未启动或缺少 WF 实例的提案仍导出基础信息,附议和审批栏保持为空。
|
||||
if (processInstance != null) {
|
||||
List<ProcessTask> doneTaskList = flowEngine.processTaskService().getDoneTaskList(processInstance.getId(), null);
|
||||
for (ProcessTask doneTask : doneTaskList) {
|
||||
ProcessTaskVO taskVO = flowEngine.processTaskService().findById(doneTask.getId());
|
||||
if (taskVO != null && taskVO.getExt() != null) {
|
||||
doneTaskVos.add(taskVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 附议人单元格仅展示已完成附议任务中的姓名,多人以顿号分隔并去重。
|
||||
docData.put("secondNames", doneTaskVos.stream()
|
||||
.filter(task -> "second".equals(task.getTaskName()))
|
||||
.map(task -> task.getTaskFormData().getStr("userName"))
|
||||
.filter(StrUtil::isNotBlank).distinct().collect(Collectors.joining("、")));
|
||||
|
||||
// 按任务节点分组
|
||||
Map<String, List<ProcessTaskVO>> taskGroups = doneTaskVos.stream()
|
||||
.filter(Objects::nonNull)
|
||||
@@ -1394,6 +1401,17 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
docData.putAll(taskGroups);
|
||||
putProposalExportTaskAliases(id, taskGroups, docData);
|
||||
|
||||
// 中文区块名称保持与现有模板一致,实际审核记录按 WF 节点编码匹配。
|
||||
// 区块内继续读取 taskFormData 的意见、姓名和日期;无记录时写入空列表,避免同名节点误填。
|
||||
Map<String, String> approvalTemplateNodes = Map.of(
|
||||
"分工会主席审批", "delegation",
|
||||
"校工会主席审批", "schoolUnionChairApproval",
|
||||
"分管校领导审批", "school_leader");
|
||||
approvalTemplateNodes.forEach((templateKey, taskName) -> docData.put(templateKey, doneTaskVos.stream()
|
||||
.filter(task -> taskName.equals(task.getTaskName()))
|
||||
.sorted(Comparator.comparing(ProcessTaskVO::getFinishTime, Comparator.nullsLast(Comparator.naturalOrder())))
|
||||
.collect(Collectors.toList())));
|
||||
|
||||
// 提案附议
|
||||
List<NutMap> secondInfos = new ArrayList<>();
|
||||
List<ProcessTaskVO> secondTaskVos = taskGroups.get("提案附议");
|
||||
@@ -1475,29 +1493,13 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
docData.put("secondedList", secondInfos);
|
||||
docData.put("delegationAuditList", delegationAuditList);
|
||||
|
||||
String templateCode = getProposalTemplateCode(docData.getString("caseFilingResult"));
|
||||
try {
|
||||
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate(templateCode), config).render(docData).writeAndClose(byteArrayOutputStream);
|
||||
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate(PROPOSAL_DEFAULT_TEMPLATE_CODE), config).render(docData).writeAndClose(byteArrayOutputStream);
|
||||
} catch (IOException e) {
|
||||
log.error("提案导出失败{},提案id:{}", e.getMessage(), id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据立案结果选择数据库办公模板编码。
|
||||
*
|
||||
* @param caseFilingResult 立案结果字典编码:CONFIRM_FILING、SUGGESTION 或 NOT
|
||||
* @return 对应的 Word 模板编码;历史空值或未知编码返回 proposal
|
||||
*/
|
||||
private String getProposalTemplateCode(String caseFilingResult) {
|
||||
return switch (StrUtil.nullToEmpty(caseFilingResult)) {
|
||||
case "CONFIRM_FILING" -> PROPOSAL_CONFIRM_FILING_TEMPLATE_CODE;
|
||||
case "SUGGESTION" -> PROPOSAL_SUGGESTION_TEMPLATE_CODE;
|
||||
case "NOT" -> PROPOSAL_NOT_TEMPLATE_CODE;
|
||||
default -> PROPOSAL_DEFAULT_TEMPLATE_CODE;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 将现行工作流节点映射到历史提案表模板使用的区块名称,并按主协办单位拆分办理答复。
|
||||
* 模板仍使用旧节点名称时,避免已完成的意见和答复因键名不一致而无法渲染。
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.condolence.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.zhgh.staffbenefit.condolence.model.Condolence;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Dao;
|
||||
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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@At("/platform/condolence/approval")
|
||||
public class CondolenceApprovalController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result executeTask(@Param("data") String data) {
|
||||
Dict args = Json.fromJson(Dict.class, data);
|
||||
if (args == null || args.getLong(FlowConst.PROCESS_TASK_ID_KEY) == null) {
|
||||
throw new BaseException("审批任务不能为空");
|
||||
}
|
||||
ProcessTask task = dao.fetch(ProcessTask.class, args.getLong(FlowConst.PROCESS_TASK_ID_KEY));
|
||||
if (task == null) throw new BaseException("审批任务不存在");
|
||||
if (!"4dad0bef-3cf2-4a7d-bba3-35020b9b216d".equals(task.getTaskName())
|
||||
&& !"34f7938e-47a3-4b3a-b4e0-92b7a3f47865".equals(task.getTaskName())
|
||||
&& !"ecdaef3b-edf4-4143-9a96-887dd5921711".equals(task.getTaskName())
|
||||
&& !"cbd41337-3c87-4959-9027-809df5c7ef5e".equals(task.getTaskName())) {
|
||||
throw new BaseException("当前任务不是职工慰问审批任务");
|
||||
}
|
||||
ProcessInstance instance = dao.fetch(ProcessInstance.class, task.getProcessInstanceId());
|
||||
Condolence info = instance == null ? null : dao.fetch(Condolence.class, instance.getBusinessNo());
|
||||
if (info == null) throw new BaseException("职工慰问申请不存在");
|
||||
if (StrUtil.isBlank(args.getStr("tf_sign"))) throw new BaseException("请完成审批签字");
|
||||
if (StrUtil.isBlank(args.getStr("tf_opinion"))) throw new BaseException("请填写审批意见");
|
||||
|
||||
// 参与者权限由流程引擎校验,业务入口不接受客户端指定管理员代办。
|
||||
args.remove(FlowConst.EXT_ENABLE_OPERATOR);
|
||||
flowCommonService.executeTask(args);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
+18
-7
@@ -17,6 +17,7 @@ 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.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
@@ -27,7 +28,7 @@ import org.nutz.mvc.annotation.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName CondolenceBranchUnionApprovalController
|
||||
* @ClassName CondolenceFirstApprovalController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/28 11:33
|
||||
* @Version 1.0
|
||||
@@ -35,26 +36,26 @@ import java.util.List;
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/condolence/branchUnionApproval")
|
||||
@Api("职工慰问分工会审核")
|
||||
@Api("职工慰问一级审核")
|
||||
@Ok("json:full")
|
||||
public class CondolenceBranchUnionApprovalController {
|
||||
public class CondolenceFirstApprovalController {
|
||||
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/condolence/branchUnionApproval/index.html")
|
||||
@SaCheckPermission("condolence.branchUnionApproval")
|
||||
@SaCheckPermission("condolence.firstApproval")
|
||||
public void index() {}
|
||||
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/condolence/branchUnionApproval/index.html")
|
||||
@SaCheckPermission("h5.condolence.branchUnionApproval")
|
||||
@SaCheckPermission("h5.condolence.firstApproval")
|
||||
public void h5Index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"condolence.branchUnionApproval", "h5.condolence.branchUnionApproval"}, mode = SaMode.OR)
|
||||
@SaCheckPermission(value = {"condolence.firstApproval", "h5.condolence.firstApproval"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "type") String type,
|
||||
@@ -90,6 +91,14 @@ public class CondolenceBranchUnionApprovalController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(new Static("""
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM wf_process_task newer
|
||||
WHERE newer.processInstanceId = t.processInstanceId
|
||||
AND newer.taskName = t.taskName
|
||||
AND newer.id > t.id
|
||||
)
|
||||
"""));
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(Condolence::getHelpUserName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
@@ -100,7 +109,9 @@ public class CondolenceBranchUnionApprovalController {
|
||||
cnd.andEX("YEAR(info.createTime)", "=", year);
|
||||
|
||||
cnd.and("t.taskName", "=", "4dad0bef-3cf2-4a7d-bba3-35020b9b216d");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
if (!"superadmin".equals(SecurityUtil.getUserLoginname())) {
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
}
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.condolence.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.staffbenefit.condolence.model.Condolence;
|
||||
import com.budwk.app.zhgh.staffbenefit.condolence.service.CondolenceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.dao.util.cri.Static;
|
||||
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 org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName CondolenceFourthApprovalController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/29 16:23
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/condolence/fourthApproval")
|
||||
@Api("职工慰问四级审核")
|
||||
@Ok("json:full")
|
||||
public class CondolenceFourthApprovalController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/condolence/fourthApproval/index.html")
|
||||
@SaCheckPermission("condolence.fourthApproval")
|
||||
public void index() {}
|
||||
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/condolence/fourthApproval/index.html")
|
||||
@SaCheckPermission("h5.condolence.fourthApproval")
|
||||
public void h5Index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"condolence.fourthApproval", "h5.condolence.fourthApproval"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "type") String type,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@Param(value = "approval") Boolean approval) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.name as typeName,
|
||||
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,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN condolence info ON info.id = ins.businessNo
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN condolence_type type ON info.type = type.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(new Static("""
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM wf_process_task newer
|
||||
WHERE newer.processInstanceId = t.processInstanceId
|
||||
AND newer.taskName = t.taskName
|
||||
AND newer.id > t.id
|
||||
)
|
||||
"""));
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(Condolence::getHelpUserName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or(Condolence::getHelpLoginName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.andEX("info.type", "=", type);
|
||||
cnd.andEX("YEAR(info.createTime)", "=", year);
|
||||
cnd.andEX("info.applyUnionId", "=", unionId);
|
||||
cnd.andEX("info.applyUnitId", "=", unitId);
|
||||
|
||||
cnd.and("t.taskName", "=", "cbd41337-3c87-4959-9027-809df5c7ef5e");
|
||||
if (!"superadmin".equals(SecurityUtil.getUserLoginname()) && !AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name())) {
|
||||
Sql unitSql = Sqls.queryString("""
|
||||
SELECT DISTINCT ur.unitId
|
||||
FROM sys_user_role ur
|
||||
INNER JOIN sys_role r ON r.id = ur.roleId
|
||||
WHERE ur.userId = @userId
|
||||
AND ur.enable = true
|
||||
AND r.disabled = false
|
||||
AND r.code = @roleCode
|
||||
AND ur.unitId IS NOT NULL
|
||||
AND ur.unitId <> ''
|
||||
""");
|
||||
unitSql.setParam("userId", SecurityUtil.getUserId());
|
||||
unitSql.setParam("roleCode", RoleConstant.UNIT_SCHOOL_LEADER.name());
|
||||
dao.execute(unitSql);
|
||||
List<String> managedUnitIds = unitSql.getList(String.class);
|
||||
if (managedUnitIds.isEmpty()) {
|
||||
cnd.and(new Static("1 = 0"));
|
||||
} else {
|
||||
cnd.and("info.applyUnitId", "in", managedUnitIds);
|
||||
}
|
||||
}
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.createTime");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = condolenceService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
}
|
||||
+111
@@ -3,23 +3,35 @@ 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;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
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.sms.SmsService;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.SysOfficeTemplateUtil;
|
||||
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.enums.ProcessInstanceStateEnum;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
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.data.PictureRenderData;
|
||||
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.Sqls;
|
||||
@@ -34,6 +46,10 @@ 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.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName CondolenceApplyController
|
||||
* @Author JyuHsin
|
||||
@@ -41,6 +57,7 @@ import org.nutz.mvc.annotation.Param;
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@At("/platform/condolence/mine")
|
||||
@Api("职工慰问我的")
|
||||
@@ -51,6 +68,8 @@ public class CondolenceMineController {
|
||||
private CondolenceService condolenceService;
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private SysOfficeTemplateUtil sysOfficeTemplateUtil;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/condolence/mine/index.html")
|
||||
@@ -132,6 +151,98 @@ public class CondolenceMineController {
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出职工慰问申请表")
|
||||
@SaCheckPermission("condolence.mine")
|
||||
public void doExportApply(String id, HttpServletResponse response, Boolean print) throws Exception {
|
||||
log.info("[职工慰问导出] 开始,applyId={}, userId={}, format={}", id, SecurityUtil.getUserId(), Boolean.TRUE.equals(print) ? "PDF" : "Word");
|
||||
Condolence condolence = condolenceService.fetch(id);
|
||||
if (condolence == null) throw new BaseException("该条记录不存在");
|
||||
if (!SecurityUtil.getUserId().equals(condolence.getCreatedBy())) {
|
||||
throw new BaseException("只能导出本人提交的申请");
|
||||
}
|
||||
ProcessInstance instance = condolenceService.dao().fetch(ProcessInstance.class,
|
||||
Cnd.where("businessNo", "=", id).desc("id"));
|
||||
if (instance == null || !ProcessInstanceStateEnum.FINISHED.getCode().equals(instance.getState())) {
|
||||
throw new BaseException("只能导出已完成的申请");
|
||||
}
|
||||
log.info("[职工慰问导出] 流程已完成,applyId={}, instanceId={}, state={}, applicantSignPresent={}", id, instance.getId(), instance.getState(), StrUtil.isNotBlank(condolence.getSignature()));
|
||||
NutMap docData = Lang.obj2nutmap(condolence);
|
||||
docData.put("payUserName", StrUtil.nullToEmpty(condolence.getBankUserName()));
|
||||
CondolenceType type = condolenceService.dao().fetch(CondolenceType.class, condolence.getType());
|
||||
docData.put("typeName", type == null ? "" : type.getName());
|
||||
docData.put("signature", null);
|
||||
if (StrUtil.isNotBlank(condolence.getSignature())) {
|
||||
PictureRenderData signature = sysOfficeTemplateUtil.createPictureRenderData(90, 40, condolence.getSignature());
|
||||
if (signature == null) throw new BaseException("申请人签字图片读取失败");
|
||||
docData.put("signature", signature);
|
||||
}
|
||||
fillApplyApprovals(docData, instance);
|
||||
for (String field : List.of("signature", "firstApprovalSign", "secondApprovalSign", "thirdApprovalSign", "fourthApprovalSign")) {
|
||||
Object value = docData.get(field);
|
||||
log.info("[职工慰问导出] 渲染前图片字段,applyId={}, instanceId={}, field={}, valueType={}", id, instance.getId(), field, value == null ? "null" : value.getClass().getName());
|
||||
}
|
||||
String fileName = "重庆工贸职业技术学院职工慰问申请表_" + StrUtil.nullToEmpty(condolence.getHelpUserName());
|
||||
try (InputStream input = getClass().getResourceAsStream("/templates/condolence/重庆工贸职业技术学院职工慰问申请表.doc")) {
|
||||
if (input == null) throw new BaseException("职工慰问申请表模板不存在");
|
||||
boolean pdf = Boolean.TRUE.equals(print);
|
||||
byte[] bytes = sysOfficeTemplateUtil.renderTemplate(input, docData, null, pdf, "condolence:" + id);
|
||||
log.info("[职工慰问导出] 渲染完成,applyId={}, format={}, outputBytes={}", id, pdf ? "PDF" : "Word", bytes.length);
|
||||
CommonDownloadUtil.download(fileName + (pdf ? ".pdf" : ".docx"), bytes, response);
|
||||
} catch (Exception e) {
|
||||
log.error("[职工慰问导出] 模板渲染或文件输出失败,applyId={}, instanceId={}, format={}", id, instance.getId(), Boolean.TRUE.equals(print) ? "PDF" : "Word", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private void fillApplyApprovals(NutMap docData, ProcessInstance instance) {
|
||||
String[] taskKeys = {"4dad0bef-3cf2-4a7d-bba3-35020b9b216d", "34f7938e-47a3-4b3a-b4e0-92b7a3f47865",
|
||||
"ecdaef3b-edf4-4143-9a96-887dd5921711", "cbd41337-3c87-4959-9027-809df5c7ef5e"};
|
||||
String[] fields = {"firstApproval", "secondApproval", "thirdApproval", "fourthApproval"};
|
||||
List<String> suffixes = List.of("Opinion", "Sign", "Year", "Month", "Day");
|
||||
for (String field : fields) {
|
||||
for (String suffix : suffixes) docData.put(field + suffix, "Sign".equals(suffix) ? null : "");
|
||||
}
|
||||
List<ProcessTask> tasks = condolenceService.dao().query(ProcessTask.class,
|
||||
Cnd.where("processInstanceId", "=", instance.getId()).asc("id"));
|
||||
log.info("[职工慰问导出] 查询审批记录,applyId={}, instanceId={}, taskCount={}, expectedTaskKeys={}", instance.getBusinessNo(), instance.getId(), tasks.size(), List.of(taskKeys));
|
||||
for (ProcessTask task : tasks) {
|
||||
ProcessTaskVO taskVO = flowEngine.processTaskService().findById(task.getId());
|
||||
log.info("[职工慰问导出] 审批记录,instanceId={}, taskId={}, taskKey={}, displayName={}, state={}, finishTime={}, isFirstTaskNode={}, matchedApproval={}", instance.getId(), task.getId(), task.getTaskName(), task.getDisplayName(), task.getTaskState(), task.getFinishTime(), taskVO.getExt() == null ? null : taskVO.getExt().get("isFirstTaskNode"), List.of(taskKeys).contains(task.getTaskName()));
|
||||
if ("startTask".equals(task.getTaskName()) || (!List.of(taskKeys).contains(task.getTaskName())
|
||||
&& taskVO.getExt() != null && Boolean.TRUE.equals(taskVO.getExt().getBool("isFirstTaskNode")))) {
|
||||
log.info("[职工慰问导出] 申请节点重置本轮审批字段,instanceId={}, taskId={}, taskKey={}", instance.getId(), task.getId(), task.getTaskName());
|
||||
// 重新申请后,仅导出本轮审批记录。
|
||||
for (String field : fields) {
|
||||
for (String suffix : suffixes) docData.put(field + suffix, "Sign".equals(suffix) ? null : "");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
for (int i = 0; i < taskKeys.length; i++) {
|
||||
if (!taskKeys[i].equals(task.getTaskName())) continue;
|
||||
for (String suffix : suffixes) docData.put(fields[i] + suffix, "Sign".equals(suffix) ? null : "");
|
||||
if (!ProcessTaskStateEnum.FINISHED.getCode().equals(task.getTaskState())) {
|
||||
log.info("[职工慰问导出] 跳过未完成审批,instanceId={}, taskId={}, field={}, state={}", instance.getId(), task.getId(), fields[i], task.getTaskState());
|
||||
continue;
|
||||
}
|
||||
Dict data = taskVO.getExt() == null ? Dict.create() : taskVO.getTaskFormData();
|
||||
log.info("[职工慰问导出] 读取审批表单,instanceId={}, taskId={}, field={}, formKeys={}, signPresent={}, signReferenceLength={}", instance.getId(), task.getId(), fields[i], data.keySet(), StrUtil.isNotBlank(data.getStr("sign")), StrUtil.nullToEmpty(data.getStr("sign")).length());
|
||||
if (StrUtil.isBlank(data.getStr("sign"))) log.warn("[职工慰问导出] 已完成审批缺少签名字段,instanceId={}, taskId={}, field={}", instance.getId(), task.getId(), fields[i]);
|
||||
docData.put(fields[i] + "Opinion", StrUtil.nullToEmpty(data.getStr("opinion")));
|
||||
if (StrUtil.isNotBlank(data.getStr("sign"))) {
|
||||
PictureRenderData signature = sysOfficeTemplateUtil.createPictureRenderData(90, 40, data.getStr("sign"));
|
||||
if (signature == null) throw new BaseException("审批签字图片读取失败");
|
||||
docData.put(fields[i] + "Sign", signature);
|
||||
log.info("[职工慰问导出] 审批签名填充完成,instanceId={}, taskId={}, field={}", instance.getId(), task.getId(), fields[i] + "Sign");
|
||||
}
|
||||
docData.put(fields[i] + "Year", task.getFinishTime() == null ? "" : DateUtil.format(task.getFinishTime(), "yyyy"));
|
||||
docData.put(fields[i] + "Month", task.getFinishTime() == null ? "" : DateUtil.format(task.getFinishTime(), "M"));
|
||||
docData.put(fields[i] + "Day", task.getFinishTime() == null ? "" : DateUtil.format(task.getFinishTime(), "d"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
|
||||
+25
-12
@@ -6,14 +6,13 @@ 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.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.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.flow.enums.ProcessInstanceStateEnum;
|
||||
import com.budwk.app.sys.param.SysMsgSummaryPageForm;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
@@ -94,10 +93,12 @@ public class CondolenceReadController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("ins.state", "=", ProcessInstanceStateEnum.FINISHED.getCode());
|
||||
cnd.andEX("info.type", "=", type);
|
||||
cnd.andEX("YEAR(info.createTime)", "=", year);
|
||||
cnd.andEX("info.applyUnionId", "=", unionId);
|
||||
cnd.andEX("info.applyUnitId", "=", unitId);
|
||||
applyReadScope(cnd, "info");
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
@@ -106,9 +107,6 @@ public class CondolenceReadController {
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
cnd.and("info.applyUnionId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.createTime");
|
||||
@@ -142,20 +140,18 @@ public class CondolenceReadController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(ProcessInstance::getState, "=", ProcessTaskStateEnum.FINISHED.getCode());
|
||||
cnd.and("ins.state", "=", ProcessInstanceStateEnum.FINISHED.getCode());
|
||||
cnd.andEX("con.type", "=", type);
|
||||
cnd.andEX("YEAR(info.createTime)", "=", year);
|
||||
cnd.andEX("YEAR(con.createTime)", "=", year);
|
||||
cnd.andEX("con.applyUnionId", "=", unionId);
|
||||
cnd.andEX("con.applyUnitId", "=", unitId);
|
||||
applyReadScope(cnd, "con");
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("info.helpUserName", "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or("info.helpLoginName", "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or("con.helpUserName", "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or("con.helpLoginName", "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
cnd.and("con.applyUnionId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = condolenceService.listMap(sql);
|
||||
|
||||
@@ -174,4 +170,21 @@ public class CondolenceReadController {
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
|
||||
CommonDownloadUtil.download("申报人汇总.xlsx", workbook, response);
|
||||
}
|
||||
|
||||
private void applyReadScope(Cnd cnd, String alias) {
|
||||
if (AuthUtil.hasPermission("all_school")) {
|
||||
return;
|
||||
}
|
||||
if (AuthUtil.hasPermission("branch_union")) {
|
||||
String unionId = SecurityUtil.getUnionId();
|
||||
if (StrUtil.isNotBlank(unionId)) {
|
||||
cnd.and(alias + ".applyUnionId", "=", unionId);
|
||||
return;
|
||||
}
|
||||
} else if (AuthUtil.hasPermission("self")) {
|
||||
cnd.and(alias + ".createdBy", "=", SecurityUtil.getUserId());
|
||||
return;
|
||||
}
|
||||
cnd.and("1", "=", 0);
|
||||
}
|
||||
}
|
||||
|
||||
+14
-5
@@ -17,6 +17,7 @@ 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.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
@@ -33,26 +34,26 @@ import java.util.List;
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/condolence/schoolPrincipalApproval")
|
||||
@Api("职工慰问校工会预审")
|
||||
@Api("职工慰问二级审核")
|
||||
@Ok("json:full")
|
||||
public class CondolenceSchoolPrincipalApprovalController {
|
||||
public class CondolenceSecondApprovalController {
|
||||
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/condolence/schoolPrincipalApproval/index.html")
|
||||
@SaCheckPermission("condolence.schoolPrincipalApproval")
|
||||
@SaCheckPermission("condolence.secondApproval")
|
||||
public void index() {}
|
||||
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/condolence/schoolPrincipalApproval/index.html")
|
||||
@SaCheckPermission("h5.condolence.schoolPrincipalApproval")
|
||||
@SaCheckPermission("h5.condolence.secondApproval")
|
||||
public void h5Index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"condolence.schoolPrincipalApproval", "h5.condolence.schoolPrincipalApproval"}, mode = SaMode.OR)
|
||||
@SaCheckPermission(value = {"condolence.secondApproval", "h5.condolence.secondApproval"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "type") String type,
|
||||
@@ -90,6 +91,14 @@ public class CondolenceSchoolPrincipalApprovalController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(new Static("""
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM wf_process_task newer
|
||||
WHERE newer.processInstanceId = t.processInstanceId
|
||||
AND newer.taskName = t.taskName
|
||||
AND newer.id > t.id
|
||||
)
|
||||
"""));
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(Condolence::getHelpUserName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
+18
-7
@@ -17,6 +17,7 @@ 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.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
@@ -27,7 +28,7 @@ import org.nutz.mvc.annotation.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName CondolenceSchoolUnionApprovalController
|
||||
* @ClassName CondolenceThirdApprovalController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/29 16:23
|
||||
* @Version 1.0
|
||||
@@ -35,26 +36,26 @@ import java.util.List;
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/condolence/schoolUnionApproval")
|
||||
@Api("职工慰问校工会审核")
|
||||
@Api("职工慰问三级审核")
|
||||
@Ok("json:full")
|
||||
public class CondolenceSchoolUnionApprovalController {
|
||||
public class CondolenceThirdApprovalController {
|
||||
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/condolence/schoolUnionApproval/index.html")
|
||||
@SaCheckPermission("condolence.schoolUnionApproval")
|
||||
@SaCheckPermission("condolence.thirdApproval")
|
||||
public void index() {}
|
||||
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/condolence/schoolUnionApproval/index.html")
|
||||
@SaCheckPermission("h5.condolence.schoolUnionApproval")
|
||||
@SaCheckPermission("h5.condolence.thirdApproval")
|
||||
public void h5Index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"condolence.schoolUnionApproval", "h5.condolence.schoolUnionApproval"}, mode = SaMode.OR)
|
||||
@SaCheckPermission(value = {"condolence.thirdApproval", "h5.condolence.thirdApproval"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "type") String type,
|
||||
@@ -92,6 +93,14 @@ public class CondolenceSchoolUnionApprovalController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(new Static("""
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM wf_process_task newer
|
||||
WHERE newer.processInstanceId = t.processInstanceId
|
||||
AND newer.taskName = t.taskName
|
||||
AND newer.id > t.id
|
||||
)
|
||||
"""));
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(Condolence::getHelpUserName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
@@ -104,7 +113,9 @@ public class CondolenceSchoolUnionApprovalController {
|
||||
cnd.andEX("info.applyUnitId", "=", unitId);
|
||||
|
||||
cnd.and("t.taskName", "=", "ecdaef3b-edf4-4143-9a96-887dd5921711");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
if (!"superadmin".equals(SecurityUtil.getUserLoginname())) {
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
}
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
+10
-7
@@ -112,6 +112,7 @@ public class DifficultHelpApplyController {
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
@SLog(tag = "困难补助申请", msg = "保存申请,填写人: ${args[0].proxyUserName}")
|
||||
public Result save(@Param("data") DifficultHelpInfo difficultHelpInfo) {
|
||||
difficultHelpCommonService.validateApplyUser(difficultHelpInfo);
|
||||
difficultHelpInfo.setApplyTime(ObjectUtil.defaultIfNull(difficultHelpInfo.getApplyTime(), new Date()));
|
||||
difficultHelpCommonService.refreshApplyCount(difficultHelpInfo);
|
||||
if (difficultHelpCommonService.hasAppliedInYear(difficultHelpInfo.getUserId(), difficultHelpInfo.getApplyTime(), difficultHelpInfo.getId())) {
|
||||
@@ -128,6 +129,7 @@ public class DifficultHelpApplyController {
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
@SLog(tag = "困难补助申请", msg = "提交申请,填写人: ${args[0].proxyUserName}")
|
||||
public Result submit(@Param("data") DifficultHelpInfo difficultHelpInfo){
|
||||
difficultHelpCommonService.validateApplyUser(difficultHelpInfo);
|
||||
difficultHelpInfo.setApplyTime(new Date());
|
||||
difficultHelpCommonService.refreshApplyCount(difficultHelpInfo);
|
||||
if (difficultHelpCommonService.hasAppliedInYear(difficultHelpInfo.getUserId(), difficultHelpInfo.getApplyTime(), difficultHelpInfo.getId())) {
|
||||
@@ -156,6 +158,7 @@ public class DifficultHelpApplyController {
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
@SLog(tag = "困难补助申请", msg = "重新提交申请,填写人: ${args[0].proxyUserName}")
|
||||
public Result submitAgain(@Param("data") DifficultHelpInfo difficultHelpInfo, @Param("taskId") Long taskId) {
|
||||
difficultHelpCommonService.validateApplyUser(difficultHelpInfo);
|
||||
difficultHelpInfo.setApplyTime(ObjectUtil.defaultIfNull(difficultHelpInfo.getApplyTime(), new Date()));
|
||||
difficultHelpCommonService.refreshApplyCount(difficultHelpInfo);
|
||||
if (difficultHelpCommonService.hasAppliedInYear(difficultHelpInfo.getUserId(), difficultHelpInfo.getApplyTime(), difficultHelpInfo.getId())) {
|
||||
@@ -176,6 +179,12 @@ public class DifficultHelpApplyController {
|
||||
@ApiOperation("获取受助人")
|
||||
@SaCheckPermission("difficultHelp.apply")
|
||||
public Result queryRecipients(String key){
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
return Result.error("只有分工会主席可以替他人申请");
|
||||
}
|
||||
if (Strings.isBlank(SecurityUtil.getUnionId())) {
|
||||
return Result.error("当前用户未设置所属分工会");
|
||||
}
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
@@ -194,13 +203,7 @@ public class DifficultHelpApplyController {
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("id", "<>", SecurityUtil.getUserId());
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
if (AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_CHAIRMAN.name(), RoleConstant.BRANCH_UNION_ADMIN.name(), RoleConstant.BRANCH_UNION_OPERATOR.name())) {
|
||||
cnd.and("unionid", "=", SecurityUtil.getUnionId());
|
||||
} else {
|
||||
cnd.and("id", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
}
|
||||
cnd.and("unionid", "=", SecurityUtil.getUnionId());
|
||||
|
||||
if (Strings.isNotBlank(key)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.difficulthelp.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
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.zhgh.staffbenefit.difficulthelp.models.DifficultHelpInfo;
|
||||
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.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@At("/platform/difficultHelp/approval")
|
||||
public class DifficultHelpApprovalController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result executeTask(@Param("data") String data) {
|
||||
Dict args = Json.fromJson(Dict.class, data);
|
||||
if (args == null || args.getLong(FlowConst.PROCESS_TASK_ID_KEY) == null) {
|
||||
throw new BaseException("审批任务不能为空");
|
||||
}
|
||||
ProcessTask task = dao.fetch(ProcessTask.class, args.getLong(FlowConst.PROCESS_TASK_ID_KEY));
|
||||
if (task == null) throw new BaseException("审批任务不存在");
|
||||
boolean amountApproval = "715ece82-4ae3-433c-ad18-ed875f45d1e3".equals(task.getTaskName());
|
||||
if (!amountApproval && !"36ebafda-44c2-4bd3-bd7f-10839a575a0d".equals(task.getTaskName())
|
||||
&& !"e405f96c-5fc0-4f63-b323-e69dfe853253".equals(task.getTaskName())) {
|
||||
throw new BaseException("当前任务不是困难帮扶审批任务");
|
||||
}
|
||||
ProcessInstance instance = dao.fetch(ProcessInstance.class, task.getProcessInstanceId());
|
||||
DifficultHelpInfo info = instance == null ? null : dao.fetch(DifficultHelpInfo.class, instance.getBusinessNo());
|
||||
if (info == null) throw new BaseException("困难帮扶申请不存在");
|
||||
if (StrUtil.isBlank(args.getStr("tf_sign"))) throw new BaseException("请完成审批签字");
|
||||
if (StrUtil.isBlank(args.getStr("tf_opinion"))) throw new BaseException("请填写审批意见");
|
||||
|
||||
args.remove("level");
|
||||
args.remove("tf_level");
|
||||
Double money = amountApproval ? args.getDouble("money") : null;
|
||||
if (amountApproval) {
|
||||
if (money == null || !Double.isFinite(money) || money < 0) {
|
||||
throw new BaseException("请填写有效的帮扶金额");
|
||||
}
|
||||
args.put("tf_money", money);
|
||||
} else {
|
||||
args.remove("money");
|
||||
args.remove("tf_money");
|
||||
}
|
||||
// 参与者权限由流程引擎校验,业务入口不接受客户端指定管理员代办。
|
||||
args.remove(FlowConst.EXT_ENABLE_OPERATOR);
|
||||
flowCommonService.executeTask(args);
|
||||
if (amountApproval && Integer.valueOf(ProcessSubmitTypeEnum.AGREE.getCode()).equals(args.getInt(FlowConst.SUBMIT_TYPE))) {
|
||||
dao.update(DifficultHelpInfo.class, Chain.make("money", money), Cnd.where("id", "=", info.getId()));
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
+26
-12
@@ -2,10 +2,12 @@ package com.budwk.app.zhgh.staffbenefit.difficulthelp.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.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.staffbenefit.difficulthelp.service.DifficultHelpCommonService;
|
||||
import com.budwk.app.zhgh.staffbenefit.difficulthelp.vo.DifficultHelpPageParam;
|
||||
@@ -14,6 +16,7 @@ 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.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
@@ -25,15 +28,15 @@ import java.util.List;
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:DifficultHelpBranchUnionApprovalController
|
||||
* @name:DifficultHelpFirstApprovalController
|
||||
* @Date 2025/7/31 11:47
|
||||
* @注释
|
||||
* @注释 困难帮扶一级审批
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@ApiOperation("困难补助分工会审核")
|
||||
@ApiOperation("困难帮扶一级审批")
|
||||
@At("/platform/difficultHelp/branchUnionApproval")
|
||||
public class DifficultHelpBranchUnionApprovalController {
|
||||
public class DifficultHelpFirstApprovalController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@@ -41,27 +44,27 @@ public class DifficultHelpBranchUnionApprovalController {
|
||||
private DifficultHelpCommonService difficultHelpCommonService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("difficultHelp.branchUnionApproval")
|
||||
@SaCheckPermission("difficultHelp.firstApproval")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/difficulthelp/branchunionapproval/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("difficultHelp.branchUnionApproval")
|
||||
@SaCheckPermission("difficultHelp.firstApproval")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/difficulthelp/branchunionapproval/form.html")
|
||||
public void form() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.difficultHelp.branchUnionApproval")
|
||||
@SaCheckPermission("h5.difficultHelp.firstApproval")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/difficulthelp/branchunionapproval/index.html")
|
||||
public void h5() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("困难补助分工会审核列表")
|
||||
@SaCheckPermission("difficultHelp.branchUnionApproval")
|
||||
@ApiOperation("困难帮扶一级审批列表")
|
||||
@SaCheckPermission("difficultHelp.firstApproval")
|
||||
public Result pageData(DifficultHelpPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
@@ -102,10 +105,21 @@ public class DifficultHelpBranchUnionApprovalController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
cnd.and(new Static("""
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM wf_process_task newer
|
||||
WHERE newer.processInstanceId = t.processInstanceId
|
||||
AND newer.taskName = t.taskName
|
||||
AND newer.id > t.id
|
||||
)
|
||||
"""));
|
||||
boolean schoolApproval = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_OFFICE_DIRECTOR.name());
|
||||
pageParam.buildSearch(cnd, "info.", !schoolApproval);
|
||||
|
||||
cnd.and("t.taskName", "=", "9d11798e-a0e4-4ff5-939b-e6c5519e0eb6");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
cnd.and("t.taskName", "=", "36ebafda-44c2-4bd3-bd7f-10839a575a0d");
|
||||
if (!schoolApproval) {
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
}
|
||||
|
||||
if (pageParam.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
+10
-2
@@ -1,6 +1,7 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.difficulthelp.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
@@ -68,6 +69,7 @@ public class DifficultHelpMineController {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.id,
|
||||
info.createdBy,
|
||||
info.proxyUserName,
|
||||
info.proxyLoginName,
|
||||
info.userName,
|
||||
@@ -78,6 +80,7 @@ public class DifficultHelpMineController {
|
||||
LEFT(info.applyTime, 10) AS applyTime,
|
||||
info.applyCount,
|
||||
info.mobile,
|
||||
info.applyMoney,
|
||||
info.money,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
@@ -103,7 +106,8 @@ public class DifficultHelpMineController {
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
cnd.and("info.createdBy", "=", SecurityUtil.getUserId());
|
||||
cnd.and(Cnd.exps("info.createdBy", "=", SecurityUtil.getUserId())
|
||||
.or("info.userId", "=", SecurityUtil.getUserId()));
|
||||
if (StrUtil.isAllBlank(pageParam.getPageOrderName(), pageParam.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
@@ -121,6 +125,10 @@ public class DifficultHelpMineController {
|
||||
@SaCheckPermission("difficultHelp.mine")
|
||||
@SLog(tag = "困难补助申请", msg = "删除困难补助申请,id: ${args[0]}")
|
||||
public Result onDelete(@Valid String id){
|
||||
DifficultHelpInfo helpInfo = dao.fetch(DifficultHelpInfo.class, id);
|
||||
if (helpInfo == null || !SecurityUtil.getUserId().equals(helpInfo.getCreatedBy())) {
|
||||
return Result.error("只能删除自己创建的申请记录");
|
||||
}
|
||||
dao.clear(DifficultHelpInfo.class, Cnd.where("id", "=", id));
|
||||
// 删除流程相关操作
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
|
||||
@@ -130,7 +138,7 @@ public class DifficultHelpMineController {
|
||||
|
||||
@At
|
||||
@ApiModelProperty("获取困难补助申请")
|
||||
@SaCheckPermission("difficultHelp.mine")
|
||||
@SaCheckPermission(value = {"difficultHelp.mine", "difficultHelp.reading"}, mode = SaMode.OR)
|
||||
public Result findOne(String id) {
|
||||
DifficultHelpInfo helpInfo = dao.fetch(DifficultHelpInfo.class, id);
|
||||
return Result.success().addData(helpInfo);
|
||||
|
||||
+99
-41
@@ -9,7 +9,6 @@ import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
@@ -18,9 +17,12 @@ 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.MoneyUtil;
|
||||
import com.budwk.app.base.utils.OfficePlusUtil;
|
||||
import com.budwk.app.base.utils.SysOfficeTemplateUtil;
|
||||
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.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
@@ -35,7 +37,6 @@ import com.budwk.app.zhgh.staffbenefit.difficulthelp.service.DifficultHelpCommon
|
||||
import com.budwk.app.zhgh.staffbenefit.difficulthelp.vo.DifficultHelpPageParam;
|
||||
import com.budwk.app.zhgh.staffbenefit.difficulthelp.vo.moneyImportVo;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.aidFund.param.AidFundPageForm;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
||||
@@ -70,8 +71,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -155,7 +154,7 @@ public class DifficultHelpReadingController {
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("ins.state", "=", 20);
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
pageParam.buildSearch(cnd, "info.", false);
|
||||
cnd.groupBy("info.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = difficultHelpCommonService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
@@ -239,6 +238,7 @@ public class DifficultHelpReadingController {
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("difficultHelp.reading")
|
||||
public void doExportAllApply(DifficultHelpPageParam pageParam, HttpServletResponse response) throws Exception {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
@@ -269,7 +269,7 @@ public class DifficultHelpReadingController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
pageParam.buildSearch(cnd, "info.", false);
|
||||
cnd.groupBy("info.id");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = difficultHelpCommonService.listMap(sql);
|
||||
@@ -315,9 +315,9 @@ public class DifficultHelpReadingController {
|
||||
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
||||
Configure config = Configure.builder().bind("familyList", policy).build();
|
||||
|
||||
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate("difficulty_apply"), config)
|
||||
.render(docData)
|
||||
.write(zipOutputStream);
|
||||
try (InputStream input = sysOfficeTemplateUtil.getTemplate("difficulty_apply")) {
|
||||
zipOutputStream.write(sysOfficeTemplateUtil.renderTemplate(input, docData, config, false, "difficulthelp:batch:" + record.getString("id")));
|
||||
}
|
||||
zipOutputStream.closeEntry();
|
||||
}
|
||||
zipOutputStream.flush();
|
||||
@@ -361,6 +361,9 @@ public class DifficultHelpReadingController {
|
||||
.build();
|
||||
|
||||
String templateName= "difficulty_apply";
|
||||
docData.put("applyMoney", difficultHelp.getApplyMoney());
|
||||
docData.put("money", difficultHelp.getMoney());
|
||||
fillApplyApprovals(docData, difficultHelp.getId());
|
||||
if (print) {
|
||||
exportAsPDF(templateName, docData, config, difficultHelp, response);
|
||||
} else {
|
||||
@@ -368,49 +371,106 @@ public class DifficultHelpReadingController {
|
||||
}
|
||||
}
|
||||
|
||||
private void fillApplyApprovals(HashMap<String, Object> docData, String businessId) {
|
||||
String[] taskKeys = {"36ebafda-44c2-4bd3-bd7f-10839a575a0d", "715ece82-4ae3-433c-ad18-ed875f45d1e3", "e405f96c-5fc0-4f63-b323-e69dfe853253"};
|
||||
String[] fields = {"firstApproval", "secondApproval", "thirdApproval"};
|
||||
for (String field : fields) {
|
||||
for (String suffix : List.of("", "Opinion", "User", "Date", "Year", "Month", "Day", "Sign")) docData.put(field + suffix, "Sign".equals(suffix) ? null : "");
|
||||
}
|
||||
ProcessInstance instance = dao.fetch(ProcessInstance.class, Cnd.where("businessNo", "=", businessId).desc("id"));
|
||||
if (instance == null) return;
|
||||
List<ProcessTask> tasks = dao.query(ProcessTask.class, Cnd.where("processInstanceId", "=", instance.getId()).asc("id"));
|
||||
for (ProcessTask task : tasks) {
|
||||
ProcessTaskVO taskVO = flowEngine.processTaskService().findById(task.getId());
|
||||
if ("startTask".equals(task.getTaskName()) || (!List.of(taskKeys).contains(task.getTaskName())
|
||||
&& taskVO.getExt() != null && Boolean.TRUE.equals(taskVO.getExt().getBool("isFirstTaskNode")))) {
|
||||
// 重新申请后,仅导出本轮审批,避免混入上一次退回或撤销前的意见。
|
||||
for (String field : fields) {
|
||||
for (String suffix : List.of("", "Opinion", "User", "Date", "Year", "Month", "Day", "Sign")) docData.put(field + suffix, "Sign".equals(suffix) ? null : "");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!Integer.valueOf(ProcessTaskStateEnum.FINISHED.getCode()).equals(task.getTaskState())) continue;
|
||||
for (int i = 0; i < taskKeys.length; i++) {
|
||||
if (!taskKeys[i].equals(task.getTaskName())) continue;
|
||||
cn.hutool.core.lang.Dict data = taskVO.getTaskFormData();
|
||||
String opinion = StrUtil.nullToEmpty(data.getStr("opinion"));
|
||||
docData.put(fields[i] + "Opinion", opinion);
|
||||
docData.put(fields[i] + "User", StrUtil.nullToEmpty(data.getStr("userName")));
|
||||
if (StrUtil.isNotBlank(data.getStr("sign"))) {
|
||||
PictureRenderData signature = sysOfficeTemplateUtil.createPictureRenderData(90, 40, data.getStr("sign"));
|
||||
if (signature == null) throw new IllegalStateException("审批签字图片读取失败");
|
||||
docData.put(fields[i] + "Sign", signature);
|
||||
}
|
||||
docData.put(fields[i] + "Date", task.getFinishTime() == null ? "" : DateUtil.format(task.getFinishTime(), "yyyy-MM-dd"));
|
||||
docData.put(fields[i] + "Year", task.getFinishTime() == null ? "" : DateUtil.format(task.getFinishTime(), "yyyy"));
|
||||
docData.put(fields[i] + "Month", task.getFinishTime() == null ? "" : DateUtil.format(task.getFinishTime(), "M"));
|
||||
docData.put(fields[i] + "Day", task.getFinishTime() == null ? "" : DateUtil.format(task.getFinishTime(), "d"));
|
||||
String approval = "审批意见:" + opinion;
|
||||
approval += "\n审批人:" + StrUtil.nullToEmpty(data.getStr("userName"));
|
||||
approval += "\n审批日期:" + (task.getFinishTime() == null ? "" : DateUtil.format(task.getFinishTime(), "yyyy-MM-dd"));
|
||||
docData.put(fields[i], approval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private InputStream getApplyTemplate(String templateName) throws Exception {
|
||||
byte[] templateBytes;
|
||||
try (InputStream input = sysOfficeTemplateUtil.getTemplate(templateName)) {
|
||||
templateBytes = input.readAllBytes();
|
||||
}
|
||||
// 按审批栏限定通用日期占位符,同时将旧版 Word 模板转换为 DOCX。
|
||||
try (ByteArrayInputStream input = new ByteArrayInputStream(templateBytes);
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream()) {
|
||||
com.aspose.words.Document document = new com.aspose.words.Document(input);
|
||||
com.aspose.words.NodeCollection cells = document.getChildNodes(com.aspose.words.NodeType.CELL, true);
|
||||
for (int index = 0; index < cells.getCount(); index++) {
|
||||
com.aspose.words.Cell cell = (com.aspose.words.Cell) cells.get(index);
|
||||
for (String field : List.of("firstApproval", "secondApproval", "thirdApproval")) {
|
||||
if (!cell.getText().contains("{{" + field + "Opinion}}")) continue;
|
||||
com.aspose.words.FindReplaceOptions options = new com.aspose.words.FindReplaceOptions();
|
||||
cell.getRange().replace("{{year}}", "{{" + field + "Year}}", options);
|
||||
cell.getRange().replace("{{month}}", "{{" + field + "Month}}", options);
|
||||
cell.getRange().replace("{{day}}", "{{" + field + "Day}}", options);
|
||||
if ("firstApproval".equals(field)) {
|
||||
cell.getRange().replace("{{secondApprovalUser}}", "{{firstApprovalUser}}", options);
|
||||
}
|
||||
cell.getRange().replace("{{" + field + "User}}", "{{@" + field + "Sign}}", options);
|
||||
}
|
||||
}
|
||||
document.save(output, com.aspose.words.SaveFormat.DOCX);
|
||||
templateBytes = output.toByteArray();
|
||||
}
|
||||
return new ByteArrayInputStream(templateBytes);
|
||||
}
|
||||
|
||||
@At
|
||||
private void exportAsPDF(String templateName, HashMap<String, Object> docData,Configure config,
|
||||
DifficultHelpInfo difficultHelp, HttpServletResponse response) throws Exception {
|
||||
String fileName = "中国地质大学(武汉)困难慰问申请表_" + difficultHelp.getUserName() + "_" +
|
||||
String fileName = FileUtil.mainName(sysOfficeTemplateUtil.getTemplateFileName(templateName)) + "_" + difficultHelp.getUserName() + "_" +
|
||||
DateUtil.format(difficultHelp.getApplyTime(), "yyyyMMdd") + ".pdf";
|
||||
|
||||
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
|
||||
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate(templateName),config)
|
||||
.render(docData)
|
||||
.writeAndClose(byteArrayOutputStream);
|
||||
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("困难慰问申请表导出PDF失败,id:{},错误信息:{}", difficultHelp.getId(), e.getMessage());
|
||||
try (InputStream input = getApplyTemplate(templateName)) {
|
||||
byte[] bytes = sysOfficeTemplateUtil.renderTemplate(input, docData, config, true, "difficulthelp:" + difficultHelp.getId());
|
||||
CommonDownloadUtil.download(fileName, bytes, response);
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
private void exportAsWord(String templateName, HashMap<String, Object> docData,Configure config,
|
||||
DifficultHelpInfo difficultHelp, HttpServletResponse response) throws Exception {
|
||||
String fileName = "中国地质大学(武汉)困难慰问申请表_" + difficultHelp.getUserName() + "_" +
|
||||
String fileName = FileUtil.mainName(sysOfficeTemplateUtil.getTemplateFileName(templateName)) + "_" + difficultHelp.getUserName() + "_" +
|
||||
DateUtil.format(difficultHelp.getApplyTime(), "yyyyMMdd") + ".docx";
|
||||
|
||||
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
|
||||
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate(templateName),config)
|
||||
.render(docData)
|
||||
.writeAndClose(byteArrayOutputStream);
|
||||
CommonDownloadUtil.download(fileName, byteArrayOutputStream.toByteArray(), response);
|
||||
} catch (IOException e) {
|
||||
log.error("困难慰问申请表导出Word失败,id:{},错误信息:{}", difficultHelp.getId(), e.getMessage());
|
||||
try (InputStream input = getApplyTemplate(templateName)) {
|
||||
byte[] bytes = sysOfficeTemplateUtil.renderTemplate(input, docData, config, false, "difficulthelp:" + difficultHelp.getId());
|
||||
CommonDownloadUtil.download(fileName, bytes, response);
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("difficultHelp.reading")
|
||||
public void exportSummary(DifficultHelpPageParam pageParam,String flag,
|
||||
HttpServletResponse response) throws Exception {
|
||||
NutMap result = new NutMap();
|
||||
@@ -440,7 +500,7 @@ public class DifficultHelpReadingController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
pageParam.buildSearch(cnd, "info.", false);
|
||||
cnd.groupBy("info.id");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = difficultHelpCommonService.listMap(sql);
|
||||
@@ -483,15 +543,13 @@ public class DifficultHelpReadingController {
|
||||
throw new RuntimeException("导出Excel汇总表失败:" + e.getMessage());
|
||||
}
|
||||
} else if ("docx".equals(flag)) {
|
||||
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
try (InputStream input = sysOfficeTemplateUtil.getTemplate(resource)) {
|
||||
Configure config = Configure.builder()
|
||||
.bind("da", new LoopRowTableRenderPolicy())
|
||||
.build();
|
||||
|
||||
XWPFTemplate.compile(sysOfficeTemplateUtil.getTemplate(resource), config)
|
||||
.render(result)
|
||||
.writeAndClose(out);
|
||||
CommonDownloadUtil.download(fileName + ".docx", out.toByteArray(), response);
|
||||
byte[] bytes = sysOfficeTemplateUtil.renderTemplate(input, result, config, false, "difficulthelp:summary:" + resource);
|
||||
CommonDownloadUtil.download(fileName + ".docx", bytes, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-11
@@ -2,10 +2,12 @@ package com.budwk.app.zhgh.staffbenefit.difficulthelp.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.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.staffbenefit.difficulthelp.service.DifficultHelpCommonService;
|
||||
import com.budwk.app.zhgh.staffbenefit.difficulthelp.vo.DifficultHelpPageParam;
|
||||
@@ -14,6 +16,7 @@ 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.Static;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
@@ -26,15 +29,15 @@ import java.util.List;
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:DifficultHelpBranchUnionApprovalController
|
||||
* @name:DifficultHelpSecondApprovalController
|
||||
* @Date 2025/7/31 11:47
|
||||
* @注释
|
||||
* @注释 困难帮扶二级审批
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@ApiOperation("困难补助二级党组织审核")
|
||||
@ApiOperation("困难帮扶二级审批")
|
||||
@At("/platform/difficultHelp/unionLeaderApproval")
|
||||
public class DifficultHelpBranchUnionLeaderApprovalController {
|
||||
public class DifficultHelpSecondApprovalController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@@ -42,27 +45,27 @@ public class DifficultHelpBranchUnionLeaderApprovalController {
|
||||
private DifficultHelpCommonService difficultHelpCommonService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("difficultHelp.unionLeaderApproval")
|
||||
@SaCheckPermission("difficultHelp.secondApproval")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/difficulthelp/unionLeaderApproval/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("difficultHelp.unionLeaderApproval")
|
||||
@SaCheckPermission("difficultHelp.secondApproval")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/difficulthelp/unionLeaderApproval/form.html")
|
||||
public void form() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.difficultHelp.unionLeaderApproval")
|
||||
@SaCheckPermission("h5.difficultHelp.secondApproval")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/difficulthelp/unionLeaderApproval/index.html")
|
||||
public void h5() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("困难补助分工会审核列表")
|
||||
@SaCheckPermission("difficultHelp.unionLeaderApproval")
|
||||
@ApiOperation("困难帮扶二级审批列表")
|
||||
@SaCheckPermission("difficultHelp.secondApproval")
|
||||
public Result pageData(DifficultHelpPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
@@ -103,6 +106,14 @@ public class DifficultHelpBranchUnionLeaderApprovalController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(new Static("""
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM wf_process_task newer
|
||||
WHERE newer.processInstanceId = t.processInstanceId
|
||||
AND newer.taskName = t.taskName
|
||||
AND newer.id > t.id
|
||||
)
|
||||
"""));
|
||||
// pageParam.buildSearchUnit(cnd, "info.");
|
||||
|
||||
if (StrUtil.isNotBlank(pageParam.getSearchKeyword())) {
|
||||
@@ -114,8 +125,10 @@ public class DifficultHelpBranchUnionLeaderApprovalController {
|
||||
cnd.andEX("info.unionId", "=", pageParam.getUnionId());
|
||||
cnd.andEX("info.unitId", "=", pageParam.getUnitId());
|
||||
|
||||
cnd.and("t.taskName", "=", "36ebafda-44c2-4bd3-bd7f-10839a575a0d");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
cnd.and("t.taskName", "=", "715ece82-4ae3-433c-ad18-ed875f45d1e3");
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CHAIRMAN.name())) {
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
}
|
||||
|
||||
if (pageParam.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
+46
-15
@@ -4,10 +4,12 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.page.Pagination;
|
||||
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.staffbenefit.difficulthelp.models.DifficultHelpInfo;
|
||||
import com.budwk.app.zhgh.staffbenefit.difficulthelp.service.DifficultHelpCommonService;
|
||||
@@ -17,6 +19,7 @@ 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.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
@@ -30,15 +33,15 @@ import java.util.List;
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:DifficultHelpSchoolUnionApprovalController
|
||||
* @name:DifficultHelpThirdApprovalController
|
||||
* @Date 2025/7/31 11:47
|
||||
* @注释
|
||||
* @注释 困难帮扶三级审批
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@ApiOperation("困难补助校工会审核")
|
||||
@ApiOperation("困难帮扶三级审批")
|
||||
@At("/platform/difficultHelp/schoolUnionApproval")
|
||||
public class DifficultHelpSchoolUnionApprovalController {
|
||||
public class DifficultHelpThirdApprovalController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@@ -46,26 +49,26 @@ public class DifficultHelpSchoolUnionApprovalController {
|
||||
private DifficultHelpCommonService difficultHelpCommonService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("difficultHelp.schoolUnionApproval")
|
||||
@SaCheckPermission("difficultHelp.thirdApproval")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/difficulthelp/schoolunionapproval/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("difficultHelp.schoolUnionApproval")
|
||||
@SaCheckPermission("difficultHelp.thirdApproval")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/difficulthelp/schoolunionapproval/form.html")
|
||||
public void form() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.difficultHelp.schoolUnionApproval")
|
||||
@SaCheckPermission("h5.difficultHelp.thirdApproval")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/difficulthelp/schoolunionapproval/index.html")
|
||||
public void h5() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("困难补助校工会审核列表")
|
||||
@SaCheckPermission("difficultHelp.schoolUnionApproval")
|
||||
@ApiOperation("困难帮扶三级审批列表")
|
||||
@SaCheckPermission("difficultHelp.thirdApproval")
|
||||
public Result pageData(DifficultHelpPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
@@ -106,10 +109,39 @@ public class DifficultHelpSchoolUnionApprovalController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
pageParam.buildSearch(cnd, "info.");
|
||||
cnd.and(new Static("""
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM wf_process_task newer
|
||||
WHERE newer.processInstanceId = t.processInstanceId
|
||||
AND newer.taskName = t.taskName
|
||||
AND newer.id > t.id
|
||||
)
|
||||
"""));
|
||||
pageParam.buildSearch(cnd, "info.", false);
|
||||
|
||||
cnd.and("t.taskName", "=", "715ece82-4ae3-433c-ad18-ed875f45d1e3");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
cnd.and("t.taskName", "=", "e405f96c-5fc0-4f63-b323-e69dfe853253");
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name())) {
|
||||
Sql unitSql = Sqls.queryString("""
|
||||
SELECT DISTINCT ur.unitId
|
||||
FROM sys_user_role ur
|
||||
INNER JOIN sys_role r ON r.id = ur.roleId
|
||||
WHERE ur.userId = @userId
|
||||
AND ur.enable = true
|
||||
AND r.disabled = false
|
||||
AND r.code = @roleCode
|
||||
AND ur.unitId IS NOT NULL
|
||||
AND ur.unitId <> ''
|
||||
""");
|
||||
unitSql.setParam("userId", SecurityUtil.getUserId());
|
||||
unitSql.setParam("roleCode", RoleConstant.UNIT_SCHOOL_LEADER.name());
|
||||
dao.execute(unitSql);
|
||||
List<String> managedUnitIds = unitSql.getList(String.class);
|
||||
if (managedUnitIds.isEmpty()) {
|
||||
cnd.and(new Static("1 = 0"));
|
||||
} else {
|
||||
cnd.and("info.unitId", "in", managedUnitIds);
|
||||
}
|
||||
}
|
||||
|
||||
if (pageParam.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
@@ -131,11 +163,10 @@ public class DifficultHelpSchoolUnionApprovalController {
|
||||
|
||||
@At
|
||||
@ApiOperation("保存补助金额、级别")
|
||||
@SaCheckPermission("difficultHelp.schoolUnionApproval")
|
||||
@SaCheckPermission("difficultHelp.thirdApproval")
|
||||
@SLog(tag = "困难补助申请", msg = "保存申请,填写人: ${args[0].proxyUserName}")
|
||||
public Result save(@Param("data") DifficultHelpInfo difficultHelpInfo) {
|
||||
dao.updateIgnoreNull(difficultHelpInfo);
|
||||
return Result.success();
|
||||
return Result.error("三级审批不再设置级别和帮扶金额,请在一级、二级审批中填写");
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -6,6 +6,7 @@ import com.budwk.app.flow.engine.core.Execution;
|
||||
import com.budwk.app.flow.engine.core.ServiceContext;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.zhgh.staffbenefit.difficulthelp.models.DifficultHelpInfo;
|
||||
import com.budwk.app.zhgh.staffbenefit.difficulthelp.service.DifficultHelpCommonService;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
@@ -29,6 +30,7 @@ public class DifficultHelpSaveInterceptor implements FlowInterceptor {
|
||||
|
||||
Dao dao = ServiceContext.find(Dao.class);
|
||||
DifficultHelpInfo difficultHelpInfo = Json.fromJson(DifficultHelpInfo.class, formDataStr);
|
||||
ServiceContext.find(DifficultHelpCommonService.class).validateApplyUser(difficultHelpInfo);
|
||||
difficultHelpInfo.setApplyTime(new Date());
|
||||
dao.insertOrUpdate(difficultHelpInfo);
|
||||
|
||||
|
||||
+5
@@ -194,6 +194,11 @@ public class DifficultHelpInfo extends BaseModel {
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer applyCount;
|
||||
|
||||
@Column
|
||||
@Comment("申请金额")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private Double applyMoney;
|
||||
|
||||
@Column
|
||||
@Comment("补助金额")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
|
||||
+11
@@ -1,6 +1,7 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.difficulthelp.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.zhgh.staffbenefit.difficulthelp.models.DifficultHelpInfo;
|
||||
import com.budwk.app.zhgh.staffbenefit.difficulthelp.vo.DifficultHelpPageParam;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.aidFund.param.AidFundPageForm;
|
||||
@@ -19,6 +20,16 @@ import java.util.List;
|
||||
*/
|
||||
public interface DifficultHelpCommonService extends BaseService<DifficultHelpInfo> {
|
||||
|
||||
void validateApplyUser(DifficultHelpInfo difficultHelpInfo);
|
||||
|
||||
/**
|
||||
* 困难帮扶进入校工会办公室主任审批时,通知本次任务的实际参与人。
|
||||
* @param task WF 已创建且参与人已落库的任务;仅 KNBF 办公室审批待办触发,
|
||||
* 接收人使用任务参与人的 actorAccount(系统 loginname)
|
||||
* @return 无返回值;开关关闭或非目标节点不发送,发送失败记录日志而不阻断流程
|
||||
*/
|
||||
void notifyOfficeApproval(ProcessTask task);
|
||||
|
||||
/**
|
||||
* 导入实际金额数据处理
|
||||
* @param file 文件
|
||||
|
||||
+91
@@ -4,6 +4,16 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.wxwork.WxWorkMessageService;
|
||||
import com.budwk.app.flow.entity.ProcessDefine;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.entity.ProcessTaskActor;
|
||||
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.base.utils.ManyAddOrRenewUtil;
|
||||
import com.budwk.app.base.utils.easyexcel.EasyExcelUtil;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
@@ -27,6 +37,8 @@ import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
|
||||
import java.util.*;
|
||||
@@ -42,6 +54,8 @@ import java.util.stream.IntStream;
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class DifficultHelpCommonServiceImpl extends BaseServiceImpl<DifficultHelpInfo> implements DifficultHelpCommonService {
|
||||
private static final Log log = Logs.get();
|
||||
private static final String OFFICE_APPROVAL_TASK = "36ebafda-44c2-4bd3-bd7f-10839a575a0d";
|
||||
|
||||
public DifficultHelpCommonServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
@@ -49,6 +63,83 @@ public class DifficultHelpCommonServiceImpl extends BaseServiceImpl<DifficultHel
|
||||
|
||||
@Inject
|
||||
private ManyAddOrRenewUtil manyAddOrRenewUtil;
|
||||
@Inject
|
||||
private WxWorkMessageService wxWorkMessageService;
|
||||
|
||||
/**
|
||||
* 只通知 KNBF 办公室待办的实际审核人;重新提交生成的新任务沿用同一入口。
|
||||
* task 为任务开始事件对应的 WF 任务,actorAccount 为学校企业微信 userid。
|
||||
* 无返回值;服务返回 skipped 表示开关关闭,success=false 表示接口失败或部分接收人无效。
|
||||
*/
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void notifyOfficeApproval(ProcessTask task) {
|
||||
if (task == null || task.getId() == null || task.getProcessInstanceId() == null
|
||||
|| !OFFICE_APPROVAL_TASK.equals(task.getTaskName())
|
||||
|| !ProcessTaskStateEnum.DOING.getCode().equals(task.getTaskState())) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ProcessInstance instance = dao().fetch(ProcessInstance.class, task.getProcessInstanceId());
|
||||
if (instance == null || instance.getProcessDefineId() == null) return;
|
||||
ProcessDefine define = dao().fetch(ProcessDefine.class, instance.getProcessDefineId());
|
||||
// 使用实例所属定义核验流程 KEY,避免其他流程复用同一个节点 ID 时误发。
|
||||
if (define == null || !"KNBF".equals(define.getName())) return;
|
||||
DifficultHelpInfo info = StrUtil.isBlank(instance.getBusinessNo()) ? null : fetch(instance.getBusinessNo());
|
||||
if (info == null) {
|
||||
log.warnf("困难帮扶企业微信通知跳过:申请不存在,taskId=%s", task.getId());
|
||||
return;
|
||||
}
|
||||
List<ProcessTaskActor> actors = dao().query(ProcessTaskActor.class,
|
||||
Cnd.where(ProcessTaskActor::getProcessTaskId, "=", task.getId()));
|
||||
List<String> loginNames = actors.stream().map(ProcessTaskActor::getActorAccount)
|
||||
.filter(StrUtil::isNotBlank).map(String::trim).distinct().toList();
|
||||
// 不按角色扩大接收范围,未绑定工号时不以内部用户 ID 代替企业微信 userid。
|
||||
if (loginNames.isEmpty()) {
|
||||
log.warnf("困难帮扶企业微信通知跳过:审核人 loginname 为空,taskId=%s", task.getId());
|
||||
return;
|
||||
}
|
||||
String content = "您有一条困难帮扶申请待审核,受助人:"
|
||||
+ StrUtil.blankToDefault(info.getUserName(), "未填写") + ",请进入校工会办公室审批页面办理。";
|
||||
// 流程定义中仍保留旧的 unionLeaderApproval 链接,本节点实际办理入口为 branchUnionApproval。
|
||||
NutMap result = wxWorkMessageService.massSend(loginNames, "困难帮扶待办提醒", content,
|
||||
"/platform/difficultHelp/branchUnionApproval/h5");
|
||||
if (!result.getBoolean("skipped", false) && !result.getBoolean("success", false)) {
|
||||
log.warnf("困难帮扶企业微信通知发送失败或部分失败,taskId=%s,result=%s", task.getId(), result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 外部消息不改变审批结果;日志保留任务 ID,便于定位接口、账号或配置问题。
|
||||
log.error("困难帮扶企业微信通知异常,taskId=" + task.getId(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateApplyUser(DifficultHelpInfo difficultHelpInfo) {
|
||||
if (difficultHelpInfo == null || StrUtil.isBlank(difficultHelpInfo.getUserId())) {
|
||||
throw new BaseException("请选择受助人");
|
||||
}
|
||||
if (StrUtil.isNotBlank(difficultHelpInfo.getId())) {
|
||||
DifficultHelpInfo dbInfo = dao().fetch(DifficultHelpInfo.class, difficultHelpInfo.getId());
|
||||
if (dbInfo != null && !SecurityUtil.getUserId().equals(dbInfo.getCreatedBy())) {
|
||||
throw new BaseException("只能查看他人代为申请的记录,不能修改或提交");
|
||||
}
|
||||
}
|
||||
if (difficultHelpInfo.getApplyMoney() == null || !Double.isFinite(difficultHelpInfo.getApplyMoney())
|
||||
|| difficultHelpInfo.getApplyMoney() <= 0) {
|
||||
throw new BaseException("请填写大于零的申请金额");
|
||||
}
|
||||
if (difficultHelpInfo.getUserId().equals(SecurityUtil.getUserId())) {
|
||||
return;
|
||||
}
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
throw new BaseException("只有分工会主席可以替他人申请");
|
||||
}
|
||||
View_user recipient = dao().fetch(View_user.class, Cnd.where("id", "=", difficultHelpInfo.getUserId()));
|
||||
if (recipient == null || StrUtil.isBlank(SecurityUtil.getUnionId())
|
||||
|| !SecurityUtil.getUnionId().equals(recipient.getUnionId())) {
|
||||
throw new BaseException("只能替本分工会人员申请");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAppliedInYear(String userId, Date applyTime, String excludeRecordId) {
|
||||
|
||||
+5
-1
@@ -33,6 +33,10 @@ public class DifficultHelpPageParam extends PageForm {
|
||||
private List<String> dateRange;
|
||||
|
||||
public void buildSearch(Cnd cnd, String prefix){
|
||||
buildSearch(cnd, prefix, true);
|
||||
}
|
||||
|
||||
public void buildSearch(Cnd cnd, String prefix, boolean restrictDataScope){
|
||||
if (cnd == null) {
|
||||
cnd = Cnd.NEW();
|
||||
}
|
||||
@@ -46,7 +50,7 @@ public class DifficultHelpPageParam extends PageForm {
|
||||
|
||||
cnd.andEX("YEAR(" + prefix + "applyTime)", "=", this.getYear());
|
||||
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
if (restrictDataScope && !AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
if (AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_CHAIRMAN.name(), RoleConstant.BRANCH_UNION_ADMIN.name(), RoleConstant.BRANCH_UNION_OPERATOR.name())) {
|
||||
cnd.and(prefix + "unionid", "=", SecurityUtil.getUnionId());
|
||||
} else {
|
||||
|
||||
+252
@@ -0,0 +1,252 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckRole;
|
||||
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;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.SysOfficeTemplateUtil;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
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.enums.ProcessSubmitTypeEnum;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
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.democratic.suggestionBox.models.SuggestionBox;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolence;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialCondolenceApplyController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/8/20 15:40
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@SaCheckRole("BRANCH_UNION_CHAIRMAN")
|
||||
@IocBean
|
||||
@At("/platform/special_condolence/apply")
|
||||
@Api("特殊慰问申请")
|
||||
@Ok("json:full")
|
||||
public class SpecialCondolenceApplyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private SpecialCondolenceService specialcondolenceService;
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
@Inject
|
||||
private SysOfficeTemplateUtil sysOfficeTemplateUtil;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/specialcondolence/apply/index.html")
|
||||
@SaCheckPermission("special_condolence.apply")
|
||||
public void index() {}
|
||||
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/specialcondolence/apply/index.html")
|
||||
@SaCheckPermission("h5.special_condolence.apply")
|
||||
public void h5Index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("保存申请")
|
||||
@SaCheckPermission(value = {"special_condolence.apply", "h5.special_condolence.apply"}, mode = SaMode.OR)
|
||||
@SLog(tag = "特殊慰问系统-慰问申请", msg = "保存申请")
|
||||
public Result save(@Param("data") SpecialCondolence specialcondolence) {
|
||||
if(StrUtil.isBlank(specialcondolence.getId())) specialcondolence.setCreateTime(DateUtil.now());
|
||||
prepareApplication(specialcondolence);
|
||||
specialcondolenceService.saveDraftApplication(specialcondolence);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("提交申请")
|
||||
@SaCheckPermission(value = {"special_condolence.apply", "h5.special_condolence.apply"}, mode = SaMode.OR)
|
||||
@SLog(tag = "特殊慰问系统-慰问申请", msg = "提交申请")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result submit(@Param("data") SpecialCondolence specialcondolence) {
|
||||
if (StrUtil.isBlank(specialcondolence.getRemark()) || specialcondolence.getRemark().trim().length() > 500) throw new com.budwk.app.base.exception.BaseException("请填写500字以内的申请事由");
|
||||
if (StrUtil.isBlank(specialcondolence.getSignature())) throw new com.budwk.app.base.exception.BaseException("请完成申请人签字");
|
||||
if(StrUtil.isBlank(specialcondolence.getId())) specialcondolence.setCreateTime(DateUtil.now());
|
||||
prepareApplication(specialcondolence);
|
||||
specialcondolenceService.saveApplication(specialcondolence);
|
||||
// 开启流程实例
|
||||
Dict args = Dict.create();
|
||||
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
|
||||
args.set(FlowConst.FORM_DATA, specialcondolence);
|
||||
ProcessInstance instance = flowEngine.startProcessInstanceByKey("TSWW", specialcondolence.getId(), SecurityUtil.getUserId(), args);
|
||||
|
||||
// 自动完成第一个申请任务
|
||||
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
|
||||
for (ProcessTask task : doingTaskList) {
|
||||
flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("重新提交申请")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission(value = {"special_condolence.apply", "h5.special_condolence.apply"}, mode = SaMode.OR)
|
||||
public Result submitAgain(@Param("data") SpecialCondolence specialcondolence, @Param("taskId") Long taskId) {
|
||||
if (StrUtil.isBlank(specialcondolence.getRemark()) || specialcondolence.getRemark().trim().length() > 500) throw new com.budwk.app.base.exception.BaseException("请填写500字以内的申请事由");
|
||||
if (StrUtil.isBlank(specialcondolence.getSignature())) throw new com.budwk.app.base.exception.BaseException("请完成申请人签字");
|
||||
ProcessTask task = taskId == null ? null : dao.fetch(ProcessTask.class, taskId);
|
||||
ProcessInstance instance = task == null ? null : dao.fetch(ProcessInstance.class, task.getProcessInstanceId());
|
||||
if (instance == null || !StrUtil.equals(instance.getBusinessNo(), specialcondolence.getId())
|
||||
|| !"startTask".equals(task.getTaskName()) || !SecurityUtil.getUserId().equals(instance.getOperator())) {
|
||||
throw new com.budwk.app.base.exception.BaseException("申请任务不匹配");
|
||||
}
|
||||
prepareApplication(specialcondolence);
|
||||
specialcondolenceService.saveApplication(specialcondolence);
|
||||
|
||||
Dict dict = Dict.create();
|
||||
dict.set(FlowConst.PROCESS_TASK_ID_KEY, taskId);
|
||||
dict.set(FlowConst.FORM_DATA, specialcondolence);
|
||||
dict.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.RE_APPLY.getCode());
|
||||
flowCommonService.executeTask(dict);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询用户")
|
||||
@SaCheckPermission(value = {"special_condolence.apply", "h5.special_condolence.apply"}, mode = SaMode.OR)
|
||||
public Object listUser(String keyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
u.id,
|
||||
u.idCard,
|
||||
u.personType,
|
||||
bank.bankOfDeposit,
|
||||
bank.bankUserName,
|
||||
bank.bankCardNumber,
|
||||
username as userName,
|
||||
loginname as loginName,
|
||||
sex,
|
||||
mobile,
|
||||
technicalTitle,
|
||||
IFNULL(unitname, '暂无') as unitName,
|
||||
unitid as unitId,
|
||||
unionid as unionId,
|
||||
unionname as unionName
|
||||
from
|
||||
vw_user u
|
||||
LEFT JOIN (
|
||||
SELECT idCard, bankOfDeposit, bankUserName, bankCardNumber,
|
||||
ROW_NUMBER() OVER (PARTITION BY idCard ORDER BY createdAt DESC, id DESC) rn
|
||||
FROM special_condolence_recipient WHERE delFlag = false
|
||||
) bank ON bank.idCard = u.idCard AND bank.rn = 1 AND u.idCard <> ''
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(View_user::getLoginname, "like", "%" + keyword + "%");
|
||||
seg.or(View_user::getUsername, "like", "%" + keyword + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (StrUtil.isBlank(SecurityUtil.getUnionId())) throw new com.budwk.app.base.exception.BaseException("申请人未关联分工会");
|
||||
cnd.and("u.unionId", "=", SecurityUtil.getUnionId());
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = specialcondolenceService.listPageMap(1, 50, sql);
|
||||
return Result.success(pagination.getList());
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission(value = {"special_condolence.apply", "h5.special_condolence.apply"}, mode = SaMode.OR)
|
||||
public void importTemplate(javax.servlet.http.HttpServletResponse response) throws Exception {
|
||||
String templateCode = "special_condolence_import";
|
||||
try (java.io.InputStream input = sysOfficeTemplateUtil.getTemplate(templateCode)) {
|
||||
com.budwk.app.base.utils.CommonDownloadUtil.download(
|
||||
sysOfficeTemplateUtil.getTemplateFileName(templateCode), input.readAllBytes(), response);
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"special_condolence.apply", "h5.special_condolence.apply"}, mode = SaMode.OR)
|
||||
@org.nutz.mvc.annotation.AdaptBy(type = org.nutz.mvc.upload.UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Result importRecipients(@Param("file") org.nutz.mvc.upload.TempFile file) throws Exception {
|
||||
if (file == null) throw new com.budwk.app.base.exception.BaseException("请选择Excel文件");
|
||||
if (!file.getSubmittedFileName().toLowerCase(java.util.Locale.ROOT).matches(".*\\.(xlsx|xls)$")) throw new com.budwk.app.base.exception.BaseException("仅支持xlsx、xls文件");
|
||||
String[] headers = {"慰问对象", "工号", "身份证号码", "开户行", "户名", "收款账户"};
|
||||
String[] fields = {"helpUserName", "helpLoginName", "idCard", "bankOfDeposit", "bankUserName", "bankCardNumber"};
|
||||
java.util.List<cn.hutool.json.JSONObject> result = new java.util.ArrayList<>();
|
||||
try (java.io.InputStream input = new java.io.FileInputStream(file.getFile());
|
||||
org.apache.poi.ss.usermodel.Workbook workbook = org.apache.poi.ss.usermodel.WorkbookFactory.create(input)) {
|
||||
if (workbook.getNumberOfSheets() == 0) throw new com.budwk.app.base.exception.BaseException("Excel中没有工作表");
|
||||
org.apache.poi.ss.usermodel.Sheet sheet = workbook.getSheetAt(0);
|
||||
org.apache.poi.ss.usermodel.DataFormatter formatter = new org.apache.poi.ss.usermodel.DataFormatter();
|
||||
org.apache.poi.ss.usermodel.Row header = sheet.getRow(0);
|
||||
for (int c = 0; c < headers.length; c++) {
|
||||
if (header == null || !headers[c].equals(formatter.formatCellValue(header.getCell(c)).trim())) throw new com.budwk.app.base.exception.BaseException("表头不正确,请下载导入模板");
|
||||
}
|
||||
if (sheet.getLastRowNum() > 1000) throw new com.budwk.app.base.exception.BaseException("最多导入1000行");
|
||||
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
|
||||
org.apache.poi.ss.usermodel.Row excelRow = sheet.getRow(r);
|
||||
if (excelRow == null) continue;
|
||||
String prefix = "慰问对象" + (result.size() + 1) + " ";
|
||||
cn.hutool.json.JSONObject row = new cn.hutool.json.JSONObject();
|
||||
boolean empty = true;
|
||||
for (int c = 0; c < fields.length; c++) {
|
||||
org.apache.poi.ss.usermodel.Cell cell = excelRow.getCell(c);
|
||||
String value = formatter.formatCellValue(cell).trim();
|
||||
if (c != 1 && cell != null && cell.getCellType() == org.apache.poi.ss.usermodel.CellType.FORMULA) throw new com.budwk.app.base.exception.BaseException(prefix + "不支持公式,请填写实际值");
|
||||
if ((c == 2 || c == 5) && cell != null && cell.getCellType() == org.apache.poi.ss.usermodel.CellType.NUMERIC) throw new com.budwk.app.base.exception.BaseException(prefix + "工号、身份证和收款账户请使用文本格式,避免数字失真");
|
||||
row.set(fields[c], value);
|
||||
empty = empty && value.isEmpty();
|
||||
}
|
||||
if (empty) continue;
|
||||
if (!com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceRecipients.validIdCard(row.getStr("idCard"))) throw new com.budwk.app.base.exception.BaseException(prefix + "身份证号码格式不正确");
|
||||
if (!row.getStr("bankCardNumber").matches("[0-9]{6,30}")) throw new com.budwk.app.base.exception.BaseException(prefix + "收款账户格式不正确");
|
||||
result.add(row);
|
||||
}
|
||||
}
|
||||
if (result.isEmpty()) throw new com.budwk.app.base.exception.BaseException("没有可导入的数据");
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
private void prepareApplication(SpecialCondolence info) {
|
||||
if (StrUtil.isNotBlank(info.getId())) {
|
||||
SpecialCondolence existing = dao.fetch(SpecialCondolence.class, info.getId());
|
||||
if (existing == null || !SecurityUtil.getUserId().equals(existing.getCreatedBy())) {
|
||||
throw new com.budwk.app.base.exception.BaseException("只能修改本人申请");
|
||||
}
|
||||
info.setCreatedBy(existing.getCreatedBy());
|
||||
}
|
||||
info.setApplyUserId(SecurityUtil.getUserId());
|
||||
info.setApplyUserName(SecurityUtil.getUserUsername());
|
||||
info.setApplyLoginName(SecurityUtil.getUserLoginname());
|
||||
info.setApplyUnionId(SecurityUtil.getUnionId());
|
||||
info.setApplyUnitId(SecurityUtil.getUnitId());
|
||||
}
|
||||
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolence;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Dao;
|
||||
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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@At("/platform/special_condolence/approval")
|
||||
public class SpecialCondolenceApprovalController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result executeTask(@Param("data") String data) {
|
||||
Dict args = Json.fromJson(Dict.class, data);
|
||||
if (args == null || args.getLong(FlowConst.PROCESS_TASK_ID_KEY) == null) {
|
||||
throw new BaseException("审批任务不能为空");
|
||||
}
|
||||
ProcessTask task = dao.fetch(ProcessTask.class, args.getLong(FlowConst.PROCESS_TASK_ID_KEY));
|
||||
if (task == null) throw new BaseException("审批任务不存在");
|
||||
if (!"c438972e-2f67-4907-b229-cb7aa17da147".equals(task.getTaskName())
|
||||
&& !"7f560675-aeea-4254-a57e-957d03d6b786".equals(task.getTaskName())
|
||||
&& !"af363a4e-fc56-42a0-9906-8c7a2814006b".equals(task.getTaskName())) {
|
||||
throw new BaseException("当前任务不是特殊慰问审批任务");
|
||||
}
|
||||
ProcessInstance instance = dao.fetch(ProcessInstance.class, task.getProcessInstanceId());
|
||||
com.budwk.app.flow.entity.ProcessDefine define = instance == null ? null : dao.fetch(com.budwk.app.flow.entity.ProcessDefine.class, instance.getProcessDefineId());
|
||||
SpecialCondolence info = define == null || !"TSWW".equals(define.getName()) ? null : dao.fetch(SpecialCondolence.class, instance.getBusinessNo());
|
||||
if (info == null) throw new BaseException("特殊慰问申请不存在");
|
||||
if (StrUtil.isBlank(args.getStr("tf_sign"))) throw new BaseException("请完成审批签字");
|
||||
if (StrUtil.isBlank(args.getStr("tf_opinion"))) throw new BaseException("请填写审批意见");
|
||||
|
||||
// 参与者权限由流程引擎校验,业务入口不接受客户端指定管理员代办。
|
||||
args.remove(FlowConst.EXT_ENABLE_OPERATOR);
|
||||
flowCommonService.executeTask(args);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.staffbenefit.specialcondolence.model.SpecialCondolence;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.dao.util.cri.Static;
|
||||
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 org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialCondolenceFourthApprovalController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/29 16:23
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/special_condolence/fourthApproval")
|
||||
@Api("特殊慰问四级审核")
|
||||
@Ok("json:full")
|
||||
public class SpecialCondolenceFourthApprovalController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private SpecialCondolenceService specialcondolenceService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/specialcondolence/fourthApproval/index.html")
|
||||
@SaCheckPermission("special_condolence.fourthApproval")
|
||||
public void index() {}
|
||||
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/specialcondolence/fourthApproval/index.html")
|
||||
@SaCheckPermission("h5.special_condolence.fourthApproval")
|
||||
public void h5Index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"special_condolence.fourthApproval", "h5.special_condolence.fourthApproval"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "type") String type,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@Param(value = "approval") Boolean approval) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
COALESCE(recipientTotals.recipientCount, 0) AS recipientCount,
|
||||
type.name as typeName,
|
||||
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,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN special_condolence info ON info.id = ins.businessNo
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN (
|
||||
SELECT applyId, COUNT(*) AS recipientCount
|
||||
FROM special_condolence_recipient
|
||||
WHERE delFlag = false
|
||||
GROUP BY applyId
|
||||
) recipientTotals ON recipientTotals.applyId = info.id
|
||||
LEFT JOIN special_condolence_type type ON info.type = type.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("info.id", "is not", null);
|
||||
cnd.and(new Static("""
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM wf_process_task newer
|
||||
WHERE newer.processInstanceId = t.processInstanceId
|
||||
AND newer.taskName = t.taskName
|
||||
AND newer.id > t.id
|
||||
)
|
||||
"""));
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(SpecialCondolence::getHelpUserName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or(SpecialCondolence::getHelpLoginName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.andEX("info.type", "=", type);
|
||||
cnd.andEX("YEAR(info.createTime)", "=", year);
|
||||
cnd.andEX("info.applyUnionId", "=", unionId);
|
||||
cnd.andEX("info.applyUnitId", "=", unitId);
|
||||
|
||||
cnd.and("t.taskName", "=", "af363a4e-fc56-42a0-9906-8c7a2814006b");
|
||||
if (!"superadmin".equals(SecurityUtil.getUserLoginname()) && !AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name())) {
|
||||
Sql unitSql = Sqls.queryString("""
|
||||
SELECT DISTINCT ur.unitId
|
||||
FROM sys_user_role ur
|
||||
INNER JOIN sys_role r ON r.id = ur.roleId
|
||||
WHERE ur.userId = @userId
|
||||
AND ur.enable = true
|
||||
AND r.disabled = false
|
||||
AND r.code = @roleCode
|
||||
AND ur.unitId IS NOT NULL
|
||||
AND ur.unitId <> ''
|
||||
""");
|
||||
unitSql.setParam("userId", SecurityUtil.getUserId());
|
||||
unitSql.setParam("roleCode", RoleConstant.UNIT_SCHOOL_LEADER.name());
|
||||
dao.execute(unitSql);
|
||||
List<String> managedUnitIds = unitSql.getList(String.class);
|
||||
if (managedUnitIds.isEmpty()) {
|
||||
cnd.and(new Static("1 = 0"));
|
||||
} else {
|
||||
cnd.and("info.applyUnitId", "in", managedUnitIds);
|
||||
}
|
||||
}
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.createTime");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = specialcondolenceService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
}
|
||||
+303
@@ -0,0 +1,303 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.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;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
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.sms.SmsService;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.SysOfficeTemplateUtil;
|
||||
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.enums.ProcessInstanceStateEnum;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
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.specialcondolence.model.SpecialCondolence;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolenceType;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceService;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
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.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.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
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.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialCondolenceApplyController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/28 11:06
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@At("/platform/special_condolence/mine")
|
||||
@Api("特殊慰问我的")
|
||||
@Ok("json:full")
|
||||
public class SpecialCondolenceMineController {
|
||||
|
||||
@Inject
|
||||
private SpecialCondolenceService specialcondolenceService;
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private SysOfficeTemplateUtil sysOfficeTemplateUtil;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/specialcondolence/mine/index.html")
|
||||
@SaCheckPermission("special_condolence.mine")
|
||||
public void index() {}
|
||||
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/specialcondolence/mine/index.html")
|
||||
@SaCheckPermission("h5.special_condolence.mine")
|
||||
public void h5Index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"special_condolence.mine", "h5.special_condolence.mine"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "type") String type) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
COALESCE(recipientTotals.recipientCount, 0) AS recipientCount,
|
||||
type.name as typeName,
|
||||
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,
|
||||
t.variable taskVariable,
|
||||
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') AS startTaskId
|
||||
FROM
|
||||
special_condolence info
|
||||
LEFT JOIN (
|
||||
SELECT applyId, COUNT(*) AS recipientCount
|
||||
FROM special_condolence_recipient
|
||||
WHERE delFlag = false
|
||||
GROUP BY applyId
|
||||
) recipientTotals ON recipientTotals.applyId = info.id
|
||||
LEFT JOIN special_condolence_type type ON info.type = type.id
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
id,
|
||||
processInstanceId,
|
||||
taskName,
|
||||
displayName,
|
||||
taskType,
|
||||
performType,
|
||||
taskState,
|
||||
finishTime,
|
||||
taskParentId,
|
||||
variable,
|
||||
ROW_NUMBER() OVER (PARTITION BY processInstanceId ORDER BY createdAt DESC, id DESC) AS rn
|
||||
FROM wf_process_task
|
||||
WHERE taskState = 10
|
||||
) t ON t.processInstanceId = ins.id AND t.rn = 1
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(SpecialCondolence::getHelpUserName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or(SpecialCondolence::getHelpLoginName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.andEX("year(info.createTime)", "=", year);
|
||||
cnd.andEX("info.type", "=", type);
|
||||
cnd.and("info.createdBy", "=", SecurityUtil.getUserId());
|
||||
|
||||
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 = specialcondolenceService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出特殊慰问申请表")
|
||||
@SaCheckPermission("special_condolence.mine")
|
||||
public void doExportApply(String id, HttpServletResponse response, Boolean print) throws Exception {
|
||||
log.info("[特殊慰问导出] 开始,applyId={}, userId={}, format={}", id, SecurityUtil.getUserId(), Boolean.TRUE.equals(print) ? "PDF" : "Word");
|
||||
SpecialCondolence specialcondolence = specialcondolenceService.loadApplication(id);
|
||||
if (specialcondolence == null) throw new BaseException("该条记录不存在");
|
||||
if (!SecurityUtil.getUserId().equals(specialcondolence.getCreatedBy())) {
|
||||
throw new BaseException("只能导出本人提交的申请");
|
||||
}
|
||||
ProcessInstance instance = specialcondolenceService.dao().fetch(ProcessInstance.class,
|
||||
Cnd.where("businessNo", "=", id).desc("id"));
|
||||
if (instance == null || !ProcessInstanceStateEnum.FINISHED.getCode().equals(instance.getState())) {
|
||||
throw new BaseException("只能导出已完成的申请");
|
||||
}
|
||||
log.info("[特殊慰问导出] 流程已完成,applyId={}, instanceId={}, state={}, applicantSignPresent={}", id, instance.getId(), instance.getState(), StrUtil.isNotBlank(specialcondolence.getSignature()));
|
||||
NutMap docData = Lang.obj2nutmap(specialcondolence);
|
||||
docData.put("payUserName", StrUtil.nullToEmpty(specialcondolence.getBankUserName()));
|
||||
SpecialCondolenceType type = specialcondolenceService.dao().fetch(SpecialCondolenceType.class, specialcondolence.getType());
|
||||
docData.put("typeName", type == null ? "" : type.getName());
|
||||
docData.put("signature", null);
|
||||
if (StrUtil.isNotBlank(specialcondolence.getSignature())) {
|
||||
PictureRenderData signature = sysOfficeTemplateUtil.createPictureRenderData(90, 40, specialcondolence.getSignature());
|
||||
if (signature == null) throw new BaseException("申请人签字图片读取失败");
|
||||
docData.put("signature", signature);
|
||||
}
|
||||
fillApplyApprovals(docData, instance);
|
||||
for (String field : List.of("signature", "secondApprovalSign", "thirdApprovalSign", "fourthApprovalSign")) {
|
||||
Object value = docData.get(field);
|
||||
log.info("[特殊慰问导出] 渲染前图片字段,applyId={}, instanceId={}, field={}, valueType={}", id, instance.getId(), field, value == null ? "null" : value.getClass().getName());
|
||||
}
|
||||
String fileName = "重庆工贸职业技术学院特殊慰问申请表_" + StrUtil.nullToEmpty(specialcondolence.getHelpUserName());
|
||||
try (InputStream input = getClass().getResourceAsStream("/templates/condolence/重庆工贸职业技术学院职工慰问申请表.doc")) {
|
||||
if (input == null) throw new BaseException("特殊慰问申请表模板不存在");
|
||||
boolean pdf = Boolean.TRUE.equals(print);
|
||||
com.aspose.words.Document template = new com.aspose.words.Document(input);
|
||||
template.getRange().replace("职工慰问", "特殊慰问", new com.aspose.words.FindReplaceOptions());
|
||||
com.aspose.words.NodeCollection rows = template.getChildNodes(com.aspose.words.NodeType.ROW, true);
|
||||
for (int i = rows.getCount() - 1; i >= 0; i--) {
|
||||
com.aspose.words.Node row = rows.get(i);
|
||||
if (row.getText().contains("firstApproval") || row.getText().contains("分工会主席")) row.remove();
|
||||
}
|
||||
java.io.ByteArrayOutputStream templateOutput = new java.io.ByteArrayOutputStream();
|
||||
template.save(templateOutput, com.aspose.words.SaveFormat.DOCX);
|
||||
byte[] bytes;
|
||||
if (specialcondolence.getRecipients() != null && !specialcondolence.getRecipients().isEmpty()) {
|
||||
com.aspose.words.Document combined = null;
|
||||
for (cn.hutool.json.JSONObject person : specialcondolence.getRecipients()) {
|
||||
NutMap personData = new NutMap();
|
||||
personData.putAll(docData);
|
||||
personData.putAll(person);
|
||||
personData.put("payUserName", person.getStr("bankUserName"));
|
||||
byte[] rendered = sysOfficeTemplateUtil.renderTemplate(new java.io.ByteArrayInputStream(templateOutput.toByteArray()), personData, null, false, "specialcondolence:" + id);
|
||||
com.aspose.words.Document part = new com.aspose.words.Document(new java.io.ByteArrayInputStream(rendered));
|
||||
if (combined == null) combined = part;
|
||||
else combined.appendDocument(part, com.aspose.words.ImportFormatMode.KEEP_SOURCE_FORMATTING);
|
||||
}
|
||||
java.io.ByteArrayOutputStream output = new java.io.ByteArrayOutputStream();
|
||||
combined.save(output, pdf ? com.aspose.words.SaveFormat.PDF : com.aspose.words.SaveFormat.DOCX);
|
||||
bytes = output.toByteArray();
|
||||
} else {
|
||||
bytes = sysOfficeTemplateUtil.renderTemplate(new java.io.ByteArrayInputStream(templateOutput.toByteArray()), docData, null, pdf, "specialcondolence:" + id);
|
||||
}
|
||||
log.info("[特殊慰问导出] 渲染完成,applyId={}, format={}, outputBytes={}", id, pdf ? "PDF" : "Word", bytes.length);
|
||||
CommonDownloadUtil.download(fileName + (pdf ? ".pdf" : ".docx"), bytes, response);
|
||||
} catch (Exception e) {
|
||||
log.error("[特殊慰问导出] 模板渲染或文件输出失败,applyId={}, instanceId={}, format={}", id, instance.getId(), Boolean.TRUE.equals(print) ? "PDF" : "Word", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private void fillApplyApprovals(NutMap docData, ProcessInstance instance) {
|
||||
String[] taskKeys = {"c438972e-2f67-4907-b229-cb7aa17da147",
|
||||
"7f560675-aeea-4254-a57e-957d03d6b786", "af363a4e-fc56-42a0-9906-8c7a2814006b"};
|
||||
String[] fields = {"secondApproval", "thirdApproval", "fourthApproval"};
|
||||
List<String> suffixes = List.of("Opinion", "Sign", "Year", "Month", "Day");
|
||||
for (String field : fields) {
|
||||
for (String suffix : suffixes) docData.put(field + suffix, "Sign".equals(suffix) ? null : "");
|
||||
}
|
||||
List<ProcessTask> tasks = specialcondolenceService.dao().query(ProcessTask.class,
|
||||
Cnd.where("processInstanceId", "=", instance.getId()).asc("id"));
|
||||
log.info("[特殊慰问导出] 查询审批记录,applyId={}, instanceId={}, taskCount={}, expectedTaskKeys={}", instance.getBusinessNo(), instance.getId(), tasks.size(), List.of(taskKeys));
|
||||
for (ProcessTask task : tasks) {
|
||||
ProcessTaskVO taskVO = flowEngine.processTaskService().findById(task.getId());
|
||||
log.info("[特殊慰问导出] 审批记录,instanceId={}, taskId={}, taskKey={}, displayName={}, state={}, finishTime={}, isFirstTaskNode={}, matchedApproval={}", instance.getId(), task.getId(), task.getTaskName(), task.getDisplayName(), task.getTaskState(), task.getFinishTime(), taskVO.getExt() == null ? null : taskVO.getExt().get("isFirstTaskNode"), List.of(taskKeys).contains(task.getTaskName()));
|
||||
if ("startTask".equals(task.getTaskName()) || (!List.of(taskKeys).contains(task.getTaskName())
|
||||
&& taskVO.getExt() != null && Boolean.TRUE.equals(taskVO.getExt().getBool("isFirstTaskNode")))) {
|
||||
log.info("[特殊慰问导出] 申请节点重置本轮审批字段,instanceId={}, taskId={}, taskKey={}", instance.getId(), task.getId(), task.getTaskName());
|
||||
// 重新申请后,仅导出本轮审批记录。
|
||||
for (String field : fields) {
|
||||
for (String suffix : suffixes) docData.put(field + suffix, "Sign".equals(suffix) ? null : "");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
for (int i = 0; i < taskKeys.length; i++) {
|
||||
if (!taskKeys[i].equals(task.getTaskName())) continue;
|
||||
for (String suffix : suffixes) docData.put(fields[i] + suffix, "Sign".equals(suffix) ? null : "");
|
||||
if (!ProcessTaskStateEnum.FINISHED.getCode().equals(task.getTaskState())) {
|
||||
log.info("[特殊慰问导出] 跳过未完成审批,instanceId={}, taskId={}, field={}, state={}", instance.getId(), task.getId(), fields[i], task.getTaskState());
|
||||
continue;
|
||||
}
|
||||
Dict data = taskVO.getExt() == null ? Dict.create() : taskVO.getTaskFormData();
|
||||
log.info("[特殊慰问导出] 读取审批表单,instanceId={}, taskId={}, field={}, formKeys={}, signPresent={}, signReferenceLength={}", instance.getId(), task.getId(), fields[i], data.keySet(), StrUtil.isNotBlank(data.getStr("sign")), StrUtil.nullToEmpty(data.getStr("sign")).length());
|
||||
if (StrUtil.isBlank(data.getStr("sign"))) log.warn("[特殊慰问导出] 已完成审批缺少签名字段,instanceId={}, taskId={}, field={}", instance.getId(), task.getId(), fields[i]);
|
||||
docData.put(fields[i] + "Opinion", StrUtil.nullToEmpty(data.getStr("opinion")));
|
||||
if (StrUtil.isNotBlank(data.getStr("sign"))) {
|
||||
PictureRenderData signature = sysOfficeTemplateUtil.createPictureRenderData(90, 40, data.getStr("sign"));
|
||||
if (signature == null) throw new BaseException("审批签字图片读取失败");
|
||||
docData.put(fields[i] + "Sign", signature);
|
||||
log.info("[特殊慰问导出] 审批签名填充完成,instanceId={}, taskId={}, field={}", instance.getId(), task.getId(), fields[i] + "Sign");
|
||||
}
|
||||
docData.put(fields[i] + "Year", task.getFinishTime() == null ? "" : DateUtil.format(task.getFinishTime(), "yyyy"));
|
||||
docData.put(fields[i] + "Month", task.getFinishTime() == null ? "" : DateUtil.format(task.getFinishTime(), "M"));
|
||||
docData.put(fields[i] + "Day", task.getFinishTime() == null ? "" : DateUtil.format(task.getFinishTime(), "d"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission(value = {"special_condolence.mine", "h5.special_condolence.mine"}, mode = SaMode.OR)
|
||||
@SLog(tag = "特殊慰问系统-我的申请", msg = "删除特殊慰问")
|
||||
public Result delete(@Param("id") String id) {
|
||||
specialcondolenceService.deleteApplication(id);
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询单个慰问申请信息")
|
||||
@SaCheckPermission(value = {"special_condolence", "h5.special_condolence"}, mode = SaMode.OR)
|
||||
public Result info(String id) {
|
||||
SpecialCondolence specialcondolence = specialcondolenceService.loadApplication(id);
|
||||
SpecialCondolenceType type = specialcondolenceService.dao().fetch(SpecialCondolenceType.class, Cnd.where(SpecialCondolenceType::getId, "=", specialcondolence.getType()));
|
||||
NutMap nutMap = Lang.obj2nutmap(specialcondolence);
|
||||
nutMap.put("typeName", type == null ? "" : type.getName());
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
@Inject
|
||||
private SmsService smsService;
|
||||
}
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.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.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.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.enums.ProcessInstanceStateEnum;
|
||||
import com.budwk.app.sys.param.SysMsgSummaryPageForm;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolence;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceService;
|
||||
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.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.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialCondolenceReadController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/29 16:25
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "特殊慰问阅览")
|
||||
@At("/platform/special_condolence/read")
|
||||
public class SpecialCondolenceReadController {
|
||||
|
||||
@Inject
|
||||
private SpecialCondolenceService specialcondolenceService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("special_condolence.read")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/specialcondolence/read/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("special_condolence.read")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "type") String type,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
(SELECT COUNT(*) FROM special_condolence_recipient recipient WHERE recipient.applyId = info.id AND recipient.delFlag = false) AS recipientCount,
|
||||
ins.id AS instanceId,
|
||||
type.name as typeName,
|
||||
ins.state instanceState,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.displayName taskName
|
||||
FROM
|
||||
special_condolence info
|
||||
LEFT JOIN wf_process_instance ins ON ins.businessNo = info.id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
processInstanceId,
|
||||
displayName,
|
||||
createdAt,
|
||||
ROW_NUMBER() OVER (PARTITION BY processInstanceId ORDER BY createdAt DESC) AS rn
|
||||
FROM wf_process_task
|
||||
) t ON t.processInstanceId = ins.id AND t.rn = 1
|
||||
LEFT JOIN special_condolence_type type ON info.type = type.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("ins.state", "=", ProcessInstanceStateEnum.FINISHED.getCode());
|
||||
cnd.andEX("info.type", "=", type);
|
||||
cnd.andEX("YEAR(info.createTime)", "=", year);
|
||||
cnd.andEX("info.applyUnionId", "=", unionId);
|
||||
cnd.andEX("info.applyUnitId", "=", unitId);
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("info.helpUserName", "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or("info.helpLoginName", "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.createTime");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = specialcondolenceService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("special_condolence.read")
|
||||
@ApiOperation("导出特殊慰问汇总表")
|
||||
public void onExport(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "type") String type,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
HttpServletResponse response) {
|
||||
//查询审核通过的数据
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
con.subject,
|
||||
case when recipient.id is null then con.helpUserName else recipient.helpUserName end as helpUserName,
|
||||
case when recipient.id is null then con.helpLoginName else recipient.helpLoginName end as helpLoginName,
|
||||
con.applyUserName,
|
||||
con.helpUnionName,
|
||||
con.helpUnitName,
|
||||
case when recipient.id is null then type.name else recipient.typeName end as typeName,
|
||||
case when recipient.id is null then con.money else recipient.money end as money,
|
||||
con.remark
|
||||
from
|
||||
special_condolence con
|
||||
left join special_condolence_recipient recipient on recipient.applyId = con.id and recipient.delFlag = false
|
||||
left join wf_process_instance ins on ins.businessNo = con.id
|
||||
left join special_condolence_type type on type.id = con.type
|
||||
$condition
|
||||
order by con.createTime desc, con.id, recipient.sortNum, recipient.id
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("ins.state", "=", ProcessInstanceStateEnum.FINISHED.getCode());
|
||||
cnd.andEX("con.type", "=", type);
|
||||
cnd.andEX("YEAR(con.createTime)", "=", year);
|
||||
cnd.andEX("con.applyUnionId", "=", unionId);
|
||||
cnd.andEX("con.applyUnitId", "=", unitId);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("con.helpUserName", "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or("con.helpLoginName", "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = specialcondolenceService.listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("事项", "subject", 30));
|
||||
exportEntities.add(new ExcelExportEntity("慰问对象", "helpUserName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("慰问对象工号", "helpLoginName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("申请人", "applyUserName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所在工会", "helpUnionName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所在单位", "helpUnitName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("慰问类型", "typeName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("慰问金额", "money", 20));
|
||||
exportEntities.add(new ExcelExportEntity("申请理由", "remark", 20));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
|
||||
CommonDownloadUtil.download("申报人汇总.xlsx", workbook, response);
|
||||
}
|
||||
}
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
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.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolence;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.dao.util.cri.Static;
|
||||
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 org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/12/23 14:13
|
||||
* @description 校工会预审
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/special_condolence/schoolPrincipalApproval")
|
||||
@Api("特殊慰问二级审核")
|
||||
@Ok("json:full")
|
||||
public class SpecialCondolenceSecondApprovalController {
|
||||
|
||||
@Inject
|
||||
private SpecialCondolenceService specialcondolenceService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/specialcondolence/schoolPrincipalApproval/index.html")
|
||||
@SaCheckPermission("special_condolence.secondApproval")
|
||||
public void index() {}
|
||||
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/specialcondolence/schoolPrincipalApproval/index.html")
|
||||
@SaCheckPermission("h5.special_condolence.secondApproval")
|
||||
public void h5Index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"special_condolence.secondApproval", "h5.special_condolence.secondApproval"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "type") String type,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@Param(value = "approval") Boolean approval) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
COALESCE(recipientTotals.recipientCount, 0) AS recipientCount,
|
||||
type.name as typeName,
|
||||
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,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN special_condolence info ON info.id = ins.businessNo
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN (
|
||||
SELECT applyId, COUNT(*) AS recipientCount
|
||||
FROM special_condolence_recipient
|
||||
WHERE delFlag = false
|
||||
GROUP BY applyId
|
||||
) recipientTotals ON recipientTotals.applyId = info.id
|
||||
LEFT JOIN special_condolence_type type ON info.type = type.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("info.id", "is not", null);
|
||||
cnd.and(new Static("""
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM wf_process_task newer
|
||||
WHERE newer.processInstanceId = t.processInstanceId
|
||||
AND newer.taskName = t.taskName
|
||||
AND newer.id > t.id
|
||||
)
|
||||
"""));
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(SpecialCondolence::getHelpUserName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or(SpecialCondolence::getHelpLoginName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.andEX("info.type", "=", type);
|
||||
cnd.andEX("YEAR(info.createTime)", "=", year);
|
||||
cnd.andEX("info.applyUnionId", "=", unionId);
|
||||
cnd.andEX("info.applyUnitId", "=", unitId);
|
||||
|
||||
cnd.and("t.taskName", "=", "c438972e-2f67-4907-b229-cb7aa17da147");
|
||||
// cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.createTime");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = specialcondolenceService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
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.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolence;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.dao.util.cri.Static;
|
||||
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 org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialCondolenceThirdApprovalController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/29 16:23
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/special_condolence/schoolUnionApproval")
|
||||
@Api("特殊慰问三级审核")
|
||||
@Ok("json:full")
|
||||
public class SpecialCondolenceThirdApprovalController {
|
||||
|
||||
@Inject
|
||||
private SpecialCondolenceService specialcondolenceService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/specialcondolence/schoolUnionApproval/index.html")
|
||||
@SaCheckPermission("special_condolence.thirdApproval")
|
||||
public void index() {}
|
||||
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/specialcondolence/schoolUnionApproval/index.html")
|
||||
@SaCheckPermission("h5.special_condolence.thirdApproval")
|
||||
public void h5Index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission(value = {"special_condolence.thirdApproval", "h5.special_condolence.thirdApproval"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "type") String type,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@Param(value = "approval") Boolean approval) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
COALESCE(recipientTotals.recipientCount, 0) AS recipientCount,
|
||||
type.name as typeName,
|
||||
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,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN special_condolence info ON info.id = ins.businessNo
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN (
|
||||
SELECT applyId, COUNT(*) AS recipientCount
|
||||
FROM special_condolence_recipient
|
||||
WHERE delFlag = false
|
||||
GROUP BY applyId
|
||||
) recipientTotals ON recipientTotals.applyId = info.id
|
||||
LEFT JOIN special_condolence_type type ON info.type = type.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("info.id", "is not", null);
|
||||
cnd.and(new Static("""
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM wf_process_task newer
|
||||
WHERE newer.processInstanceId = t.processInstanceId
|
||||
AND newer.taskName = t.taskName
|
||||
AND newer.id > t.id
|
||||
)
|
||||
"""));
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(SpecialCondolence::getHelpUserName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or(SpecialCondolence::getHelpLoginName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.andEX("info.type", "=", type);
|
||||
cnd.andEX("YEAR(info.createTime)", "=", year);
|
||||
cnd.andEX("info.applyUnionId", "=", unionId);
|
||||
cnd.andEX("info.applyUnitId", "=", unitId);
|
||||
|
||||
cnd.and("t.taskName", "=", "7f560675-aeea-4254-a57e-957d03d6b786");
|
||||
if (!"superadmin".equals(SecurityUtil.getUserLoginname())) {
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
}
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.createTime");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = specialcondolenceService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
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.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolenceType;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceTypeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialCondolenceTypeController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/29 10:00
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@Api(tags = "特殊慰问类型")
|
||||
@At("/platform/special_condolence/type")
|
||||
public class SpecialCondolenceTypeController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private SpecialCondolenceTypeService typeService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("special_condolence.type")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/specialcondolence/type/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("special_condolence.type")
|
||||
public Result pageData(PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(SpecialCondolenceType::getName, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.or(SpecialCondolenceType::getCode, "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.asc("code");
|
||||
Pagination pagination = typeService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增/修改特殊慰问类型")
|
||||
@SaCheckPermission("special_condolence.type")
|
||||
@SLog(tag = "特殊慰问系统-慰问类型", msg = "新增/修改特殊慰问类型")
|
||||
public Object onSubmit(SpecialCondolenceType type) {
|
||||
typeService.insertOrUpdate(type);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除特殊慰问类型")
|
||||
@SaCheckPermission("special_condolence.type")
|
||||
@SLog(tag = "特殊慰问系统-慰问类型", msg = "删除特殊慰问类型")
|
||||
public Object onDelete(String id) {
|
||||
typeService.delete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询特殊慰问类型")
|
||||
@SaCheckLogin
|
||||
public Result querySpecialCondolenceType() {
|
||||
List<SpecialCondolenceType> list = typeService.query(Cnd.where(SpecialCondolenceType::getEnable, "=", true).asc(SpecialCondolenceType::getCode));
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.interceptor;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
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.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.zhgh.dayofficework.article.models.Article;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolence;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.json.Json;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialCondolenceSaveInterceptor
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/28 11:01
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public class SpecialCondolenceSaveInterceptor implements FlowInterceptor {
|
||||
|
||||
@Override
|
||||
public void intercept(Execution execution) {
|
||||
if (!com.budwk.app.web.commons.auth.utils.AuthUtil.hasRoleOr("BRANCH_UNION_CHAIRMAN")) {
|
||||
throw new com.budwk.app.base.exception.BaseException("仅分工会主席可发起特殊慰问申请");
|
||||
}
|
||||
String formDataStr = execution.getArgs().getStr(FlowConst.FORM_DATA);
|
||||
SpecialCondolence specialcondolence = Json.fromJson(SpecialCondolence.class, formDataStr);
|
||||
|
||||
if(StrUtil.isBlank(specialcondolence.getId())) specialcondolence.setCreateTime(DateUtil.now());
|
||||
|
||||
Dao dao = ServiceContext.find(Dao.class);
|
||||
ServiceContext.find(com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceService.class).saveApplication(specialcondolence);
|
||||
|
||||
// 设置流程变量
|
||||
execution.getArgs().set("origin", specialcondolence.getOrigin());
|
||||
|
||||
int instanceId = execution.getArgs().getInt(FlowConst.PROCESS_INSTANCE_ID_KEY);
|
||||
dao.update(ProcessInstance.class, Chain.make("businessNo", specialcondolence.getId()), Cnd.where(ProcessInstance::getId, "=", instanceId));
|
||||
|
||||
}
|
||||
}
|
||||
+310
@@ -0,0 +1,310 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.model;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.sys.models.Sys_file;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialCondolence
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/28 11:03
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("special_condolence")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("特殊慰问")
|
||||
public class SpecialCondolence extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("事项")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String subject;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("申请人ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String applyUserId;
|
||||
|
||||
@Column
|
||||
@Comment("申请人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String applyUserName;
|
||||
|
||||
@Column
|
||||
@Comment("申请人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
private String applyLoginName;
|
||||
|
||||
@Column
|
||||
@Comment("申请人分工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String applyUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("申请人分工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String applyUnionName;
|
||||
|
||||
@Column
|
||||
@Comment("申请人单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String applyUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("申请人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String applyUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("补助人ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String helpUserId;
|
||||
|
||||
@Column
|
||||
@Comment("补助人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String helpUserName;
|
||||
|
||||
@Column
|
||||
@Comment("补助人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
private String helpLoginName;
|
||||
|
||||
@Column
|
||||
@Comment("补助人分工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String helpUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("补助人分工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String helpUnionName;
|
||||
|
||||
@Column
|
||||
@Comment("补助人单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String helpUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("补助人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String helpUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String origin;
|
||||
|
||||
@Column
|
||||
@Comment("收款人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String payUserId;
|
||||
|
||||
@Column
|
||||
@Comment("收款人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String payUserName;
|
||||
|
||||
@Column
|
||||
@Comment("收款人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String payLoginName;
|
||||
|
||||
@Column
|
||||
@Comment("慰问类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String type;
|
||||
|
||||
@Column
|
||||
@Comment("慰问编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String typeCode;
|
||||
|
||||
@Column
|
||||
@Comment("慰问方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String way;
|
||||
|
||||
@Column
|
||||
@Comment("统一每人慰问金额")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private java.math.BigDecimal perMoney;
|
||||
|
||||
@Column
|
||||
@Comment("慰问金额")
|
||||
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||
private Double money;
|
||||
|
||||
@Column
|
||||
@Comment("发生时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String occurTime;
|
||||
|
||||
@Column
|
||||
@Comment("生育几孩(孩次)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String child;
|
||||
|
||||
@Column
|
||||
@Comment("所在医院")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String hospital;
|
||||
|
||||
@Column
|
||||
@Comment("病房床号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String hospitalHouseNum;
|
||||
|
||||
@Column
|
||||
@Comment("病房床号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String hospitalHouseBedNum;
|
||||
|
||||
@Column
|
||||
@Comment("住院病由")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String hospitalBy;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String remark;
|
||||
|
||||
@Column
|
||||
@Comment("附件")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> files;
|
||||
|
||||
@Comment("签字")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
@Column(hump = true)
|
||||
private String signature;
|
||||
|
||||
@Column
|
||||
@Comment("申请时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String createTime;
|
||||
|
||||
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("户名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String bankUserName;
|
||||
|
||||
@Column
|
||||
@Comment("银行账号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String bankCardNumber;
|
||||
|
||||
@Column
|
||||
@Comment("开户行")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String bankOfDeposit;
|
||||
|
||||
@Column
|
||||
@Comment("证明人ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String certifierUserId;
|
||||
|
||||
@Column
|
||||
@Comment("证明人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String certifierUserName;
|
||||
|
||||
@Column
|
||||
@Comment("证明人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
private String certifierLoginName;
|
||||
|
||||
@Column
|
||||
@Comment("证明人分工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String certifierUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("证明人分工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String certifierUnionName;
|
||||
|
||||
@Column
|
||||
@Comment("证明人单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String certifierUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("证明人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String certifierUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("经办人ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String handlerUserId;
|
||||
|
||||
@Column
|
||||
@Comment("经办人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String handlerUserName;
|
||||
|
||||
@Column
|
||||
@Comment("经办人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
private String handlerLoginName;
|
||||
|
||||
@Column
|
||||
@Comment("经办人分工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String handlerUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("经办人分工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String handlerUnionName;
|
||||
|
||||
@Column
|
||||
@Comment("经办人单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String handlerUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("经办人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String handlerUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("入院时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String hospitalizationTime;
|
||||
|
||||
@Column
|
||||
@Comment("出院时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String leaveHospitalTime;
|
||||
|
||||
@Column
|
||||
@Comment("当年第几次住院")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer thisYearHospitalizationNum;
|
||||
|
||||
@Comment("慰问对象明细,由明细表加载")
|
||||
private List<JSONObject> recipients;
|
||||
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("special_condolence_recipient")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@TableIndexes({@Index(name = "idx_special_condolence_recipient_apply", fields = {"applyId"}, unique = false)})
|
||||
@Comment("特殊慰问被申请人明细")
|
||||
public class SpecialCondolenceRecipient extends BaseModel {
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("申请ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String applyId;
|
||||
|
||||
@Column
|
||||
@Comment("慰问对象用户ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String helpUserId;
|
||||
|
||||
@Column
|
||||
@Comment("人员类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String personType;
|
||||
|
||||
@Column
|
||||
@Comment("慰问对象工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
private String helpLoginName;
|
||||
|
||||
@Column
|
||||
@Comment("慰问对象")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String helpUserName;
|
||||
|
||||
@Column
|
||||
@Comment("慰问类型ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String type;
|
||||
|
||||
@Column
|
||||
@Comment("慰问类型名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String typeName;
|
||||
|
||||
@Column
|
||||
@Comment("慰问类型编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String typeCode;
|
||||
|
||||
@Column
|
||||
@Comment("慰问方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String way;
|
||||
|
||||
@Column
|
||||
@Comment("身份证号码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 18)
|
||||
private String idCard;
|
||||
|
||||
@Column
|
||||
@Comment("开户行")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String bankOfDeposit;
|
||||
|
||||
@Column
|
||||
@Comment("户名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String bankUserName;
|
||||
|
||||
@Column
|
||||
@Comment("收款账户")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String bankCardNumber;
|
||||
|
||||
@Column
|
||||
@Comment("慰问金额")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private java.math.BigDecimal money;
|
||||
|
||||
@Column
|
||||
@Comment("慰问时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String occurTime;
|
||||
|
||||
@Column
|
||||
@Comment("行序号")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer sortNum;
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialCondolenceType
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/29 9:59
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("special_condolence_type")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("特殊慰问类型")
|
||||
public class SpecialCondolenceType extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String code;
|
||||
|
||||
@Column
|
||||
@Comment("名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("费用")
|
||||
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||
private Double money;
|
||||
|
||||
@Column
|
||||
@Comment("慰问方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String way;
|
||||
|
||||
@Column
|
||||
@Comment("是否启用")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("1")
|
||||
private Boolean enable;
|
||||
|
||||
@Column
|
||||
@Comment("是否上传附件")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isUploadFile;
|
||||
|
||||
@Column
|
||||
@Comment("上传附件说明")
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
private String uploadFileDesc;
|
||||
|
||||
@Column
|
||||
@Comment("排序字段")
|
||||
@Prev({
|
||||
@SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM special_condolence_type"),
|
||||
@SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM special_condolence_type")
|
||||
})
|
||||
private Integer location;
|
||||
|
||||
@Column
|
||||
@Comment("排序")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private int sortNum;
|
||||
|
||||
@Column
|
||||
@Comment("上传会议纪要")
|
||||
@Default("0")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean uploadMeetingRecord;
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.service;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolence;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolenceType;
|
||||
import org.nutz.dao.Dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
public final class SpecialCondolenceRecipients {
|
||||
private SpecialCondolenceRecipients() {}
|
||||
|
||||
public static void prepare(SpecialCondolence info, Dao dao) {
|
||||
if (info.getSubject() == null || info.getSubject().trim().isEmpty() || info.getSubject().trim().length() > 200) throw new BaseException("请填写200字以内的事项");
|
||||
info.setSubject(info.getSubject().trim());
|
||||
List<JSONObject> rows = info.getRecipients();
|
||||
if (rows == null || rows.isEmpty()) throw new BaseException("请添加慰问对象");
|
||||
if (rows.size() > 1000) throw new BaseException("每次申请最多1000人");
|
||||
if (info.getFiles() != null && info.getFiles().size() > 5) throw new BaseException("最多上传5个附件");
|
||||
if (info.getRemark() != null && info.getRemark().trim().length() > 500) throw new BaseException("申请事由最多500字");
|
||||
if (info.getPerMoney() == null || info.getPerMoney().signum() <= 0 || info.getPerMoney().compareTo(new BigDecimal("10000")) > 0 || info.getPerMoney().scale() > 2) throw new BaseException("每人慰问金额须大于0且不超过10000元,最多两位小数");
|
||||
try { LocalDate.parse(info.getOccurTime()); }
|
||||
catch (Exception e) { throw new BaseException("请选择有效的统一慰问时间"); }
|
||||
BigDecimal total = BigDecimal.ZERO;
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.get(i);
|
||||
String prefix = "第" + (i + 1) + "行:";
|
||||
if (row == null) throw new BaseException(prefix + "明细不能为空");
|
||||
row.set("type", info.getType());
|
||||
row.set("money", info.getPerMoney().toPlainString());
|
||||
row.set("occurTime", info.getOccurTime());
|
||||
if (cn.hutool.core.util.StrUtil.isNotBlank(row.getStr("helpUserId"))) resolveUser(row, dao, prefix);
|
||||
String[] fields = {"helpUserName", "type", "idCard", "bankOfDeposit", "bankUserName", "bankCardNumber", "money", "occurTime"};
|
||||
for (String field : fields) {
|
||||
String value = row.getStr(field);
|
||||
if (value == null || value.trim().isEmpty()) throw new BaseException(prefix + "请填写完整的慰问对象信息");
|
||||
row.set(field, value.trim());
|
||||
}
|
||||
if (!validIdCard(row.getStr("idCard"))) throw new BaseException(prefix + "身份证号码不正确");
|
||||
if (!row.getStr("bankCardNumber").matches("[0-9]{6,30}")) throw new BaseException(prefix + "收款账户须为6至30位数字");
|
||||
if (row.getStr("helpUserName").length() > 100 || row.getStr("bankOfDeposit").length() > 100 || row.getStr("bankUserName").length() > 100) throw new BaseException(prefix + "姓名、开户行、户名不能超过100字");
|
||||
if (!row.getStr("money").matches("[0-9]+(\\.[0-9]{1,2})?")) throw new BaseException(prefix + "金额最多两位小数");
|
||||
BigDecimal money = new BigDecimal(row.getStr("money"));
|
||||
if (money.signum() <= 0 || money.compareTo(new BigDecimal("10000")) > 0) throw new BaseException(prefix + "金额须大于0且不超过10000元");
|
||||
try { LocalDate.parse(row.getStr("occurTime")); }
|
||||
catch (Exception e) { throw new BaseException(prefix + "慰问时间格式须为yyyy-MM-dd"); }
|
||||
SpecialCondolenceType type = dao.fetch(SpecialCondolenceType.class, row.getStr("type"));
|
||||
if (type == null || !Boolean.TRUE.equals(type.getEnable())) throw new BaseException(prefix + "慰问类型不存在或已停用");
|
||||
row.set("typeName", type.getName());
|
||||
row.set("typeCode", type.getCode());
|
||||
row.set("way", type.getWay());
|
||||
if (Boolean.TRUE.equals(type.getIsUploadFile()) && (info.getFiles() == null || info.getFiles().isEmpty())) throw new BaseException(prefix + "该慰问类型需要上传附件");
|
||||
total = total.add(money);
|
||||
}
|
||||
JSONObject first = rows.get(0);
|
||||
String name = first.getStr("helpUserName");
|
||||
info.setHelpUserName((rows.size() > 1 && name.length() > 90 ? name.substring(0, 90) : name) + (rows.size() > 1 ? "等" + rows.size() + "人" : ""));
|
||||
info.setHelpUnitId(info.getApplyUnitId());
|
||||
info.setHelpUnitName(info.getApplyUnitName());
|
||||
info.setHelpUnionId(info.getApplyUnionId());
|
||||
info.setHelpUnionName(info.getApplyUnionName());
|
||||
info.setType(first.getStr("type"));
|
||||
info.setTypeCode(first.getStr("typeCode"));
|
||||
info.setWay(first.getStr("way"));
|
||||
info.setOccurTime(first.getStr("occurTime"));
|
||||
info.setMoney(total.doubleValue());
|
||||
info.setBankOfDeposit(first.getStr("bankOfDeposit"));
|
||||
info.setBankUserName(first.getStr("bankUserName"));
|
||||
info.setBankCardNumber(first.getStr("bankCardNumber"));
|
||||
}
|
||||
|
||||
public static void resolveUser(JSONObject row, Dao dao, String prefix) {
|
||||
String userId = row.getStr("helpUserId");
|
||||
com.budwk.app.sys.views.View_user user;
|
||||
String unionId = com.budwk.app.web.commons.auth.utils.SecurityUtil.getUnionId();
|
||||
if (cn.hutool.core.util.StrUtil.isBlank(unionId)) throw new BaseException(prefix + "申请人未关联分工会");
|
||||
if (cn.hutool.core.util.StrUtil.isNotBlank(userId)) {
|
||||
user = dao.fetch(com.budwk.app.sys.views.View_user.class, org.nutz.dao.Cnd.where("id", "=", userId));
|
||||
} else {
|
||||
java.util.List<com.budwk.app.sys.views.View_user> users = dao.query(com.budwk.app.sys.views.View_user.class,
|
||||
org.nutz.dao.Cnd.where("idCard", "=", row.getStr("idCard"))
|
||||
.and("username", "=", row.getStr("helpUserName")));
|
||||
if (users.isEmpty()) throw new BaseException(prefix + "姓名、身份证与人员档案不匹配");
|
||||
java.util.List<com.budwk.app.sys.views.View_user> members = users.stream()
|
||||
.filter(member -> java.util.Objects.equals(member.getUnionId(), unionId))
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
if (members.isEmpty()) throw new BaseException(prefix + "只能选择申请人本工会人员");
|
||||
String loginName = row.getStr("helpLoginName");
|
||||
if (cn.hutool.core.util.StrUtil.isNotBlank(loginName)) {
|
||||
members = members.stream().filter(member -> "劳务派遣人员".equals(member.getPersonType())
|
||||
|| java.util.Objects.equals(member.getLoginname(), loginName))
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
}
|
||||
if (members.isEmpty()) throw new BaseException(prefix + "工号与慰问对象不一致");
|
||||
if (members.size() > 1) throw new BaseException(prefix + "人员身份重复,请核对档案");
|
||||
user = members.get(0);
|
||||
}
|
||||
if (user == null) throw new BaseException(prefix + "慰问对象不存在");
|
||||
if (!java.util.Objects.equals(user.getUnionId(), unionId)) throw new BaseException(prefix + "只能选择申请人本工会人员");
|
||||
if (!"劳务派遣人员".equals(user.getPersonType()) && cn.hutool.core.util.StrUtil.isBlank(row.getStr("helpLoginName"))) throw new BaseException(prefix + "普通人员必须填写工号");
|
||||
if (!"劳务派遣人员".equals(user.getPersonType()) && (cn.hutool.core.util.StrUtil.isBlank(row.getStr("helpLoginName")) || !java.util.Objects.equals(user.getLoginname(), row.getStr("helpLoginName")))) throw new BaseException(prefix + "工号与慰问对象不一致");
|
||||
if (cn.hutool.core.util.StrUtil.isNotBlank(user.getIdCard()) && !user.getIdCard().equalsIgnoreCase(row.getStr("idCard"))) throw new BaseException(prefix + "身份证号码与所选人员不一致");
|
||||
row.set("helpUserId", user.getId());
|
||||
row.set("helpLoginName", user.getLoginname());
|
||||
row.set("personType", user.getPersonType());
|
||||
row.set("helpUserName", user.getUsername());
|
||||
}
|
||||
|
||||
public static boolean validIdCard(String value) {
|
||||
if (value == null || !value.matches("[1-9][0-9]{16}[0-9Xx]")) return false;
|
||||
try { LocalDate.parse(value.substring(6, 14), java.time.format.DateTimeFormatter.BASIC_ISO_DATE); }
|
||||
catch (Exception e) { return false; }
|
||||
int[] weights = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
|
||||
int sum = 0;
|
||||
for (int i = 0; i < weights.length; i++) sum += (value.charAt(i) - '0') * weights[i];
|
||||
return "10X98765432".charAt(sum % 11) == Character.toUpperCase(value.charAt(17));
|
||||
}
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolence;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialCondolenceService
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/29 11:21
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public interface SpecialCondolenceService extends BaseService<SpecialCondolence> {
|
||||
void saveApplication(SpecialCondolence info);
|
||||
void saveDraftApplication(SpecialCondolence info);
|
||||
SpecialCondolence loadApplication(String id);
|
||||
void deleteApplication(String id);
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolenceType;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialCondolenceTypeService
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/29 10:03
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public interface SpecialCondolenceTypeService extends BaseService<SpecialCondolenceType> {
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolenceRecipient;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceRecipients;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolence;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialCondolenceServiceImpl
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/29 11:22
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SpecialCondolenceServiceImpl extends BaseServiceImpl<SpecialCondolence> implements SpecialCondolenceService {
|
||||
|
||||
public SpecialCondolenceServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void saveApplication(SpecialCondolence info) {
|
||||
SpecialCondolenceRecipients.prepare(info, dao());
|
||||
persistApplication(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void saveDraftApplication(SpecialCondolence info) {
|
||||
if (info.getRecipients() == null) info.setRecipients(new ArrayList<>());
|
||||
info.getRecipients().removeIf(row -> row == null || java.util.stream.Stream.of(
|
||||
"helpUserId", "helpUserName", "helpLoginName", "idCard", "bankOfDeposit", "bankUserName", "bankCardNumber")
|
||||
.allMatch(field -> StrUtil.isBlank(row.getStr(field))));
|
||||
for (JSONObject row : info.getRecipients()) {
|
||||
row.set("type", info.getType());
|
||||
row.set("typeCode", info.getTypeCode());
|
||||
row.set("way", info.getWay());
|
||||
row.set("money", info.getPerMoney());
|
||||
row.set("occurTime", info.getOccurTime());
|
||||
}
|
||||
info.setMoney(info.getPerMoney() == null ? null : info.getPerMoney().multiply(BigDecimal.valueOf(info.getRecipients().size())).doubleValue());
|
||||
persistApplication(info);
|
||||
}
|
||||
|
||||
private void persistApplication(SpecialCondolence info) {
|
||||
dao().insertOrUpdate(info);
|
||||
dao().clear(SpecialCondolenceRecipient.class,
|
||||
Cnd.where("applyId", "=", info.getId()));
|
||||
int sort = 0;
|
||||
for (JSONObject row : info.getRecipients()) {
|
||||
SpecialCondolenceRecipient person = new SpecialCondolenceRecipient();
|
||||
person.setApplyId(info.getId());
|
||||
person.setHelpUserName(row.getStr("helpUserName", ""));
|
||||
person.setHelpUserId(row.getStr("helpUserId", ""));
|
||||
person.setHelpLoginName(row.getStr("helpLoginName"));
|
||||
person.setPersonType(row.getStr("personType"));
|
||||
person.setType(row.getStr("type", ""));
|
||||
person.setTypeName(row.getStr("typeName"));
|
||||
person.setTypeCode(row.getStr("typeCode"));
|
||||
person.setWay(row.getStr("way"));
|
||||
person.setIdCard(row.getStr("idCard", ""));
|
||||
person.setBankOfDeposit(row.getStr("bankOfDeposit", ""));
|
||||
person.setBankUserName(row.getStr("bankUserName", ""));
|
||||
person.setBankCardNumber(row.getStr("bankCardNumber", ""));
|
||||
person.setMoney(row.getBigDecimal("money", BigDecimal.ZERO));
|
||||
person.setOccurTime(row.getStr("occurTime", ""));
|
||||
person.setSortNum(sort++);
|
||||
dao().insert(person);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpecialCondolence loadApplication(String id) {
|
||||
SpecialCondolence info = fetch(id);
|
||||
if (info != null) {
|
||||
List<JSONObject> rows = new ArrayList<>();
|
||||
for (SpecialCondolenceRecipient person : dao().query(
|
||||
SpecialCondolenceRecipient.class,
|
||||
Cnd.where("applyId", "=", id).asc("sortNum").asc("id"))) {
|
||||
rows.add(JSONUtil.parseObj(person));
|
||||
}
|
||||
info.setRecipients(rows);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void deleteApplication(String id) {
|
||||
dao().clear(SpecialCondolenceRecipient.class,
|
||||
Cnd.where("applyId", "=", id));
|
||||
delete(id);
|
||||
}
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.specialcondolence.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolenceType;
|
||||
import com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @ClassName SpecialCondolenceTypeServiceImpl
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/7/29 10:03
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SpecialCondolenceTypeServiceImpl extends BaseServiceImpl<SpecialCondolenceType> implements SpecialCondolenceTypeService {
|
||||
|
||||
public SpecialCondolenceTypeServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
# 新增角色
|
||||
INSERT INTO sys_role (id, name, code, aliasName, disabled, unitid, moduleId, note, sort, createdBy, createdAt,
|
||||
updatedBy, updatedAt, delFlag)
|
||||
VALUES ('494ac71eb8b44d0e99e19b7fde6bd469', '校工会办公室主任', 'SCHOOL_OFFICE_DIRECTOR', null, false, null,
|
||||
'07d940ba34bd47399cda140894f5d86b', null, null, '17a7f8ad3ee947b4a26175049a9c253d', 1791510778436,
|
||||
'17a7f8ad3ee947b4a26175049a9c253d', 1791510778437, false);
|
||||
|
||||
# 修改审核菜单名称
|
||||
UPDATE sys_menu t
|
||||
SET t.name = '校工会办公室主任审批'
|
||||
WHERE t.id = 'df2fb530141c4245826ac9974ec90c9a';
|
||||
|
||||
UPDATE sys_menu t
|
||||
SET t.name = '校工会主席审批'
|
||||
WHERE t.id = 'a473302b80ce404e93bc820f858a14da';
|
||||
|
||||
UPDATE sys_menu t
|
||||
SET t.name = '分管校领导审批'
|
||||
WHERE t.id = '3e0bb63c5f0044bd837ad24633e92560';
|
||||
|
||||
UPDATE sys_menu t
|
||||
SET t.name = '校工会办公室主任审批'
|
||||
WHERE t.id = '23d30124199b486d8af79aba62440b15';
|
||||
|
||||
UPDATE sys_menu t
|
||||
SET t.name = '校工会主席审批'
|
||||
WHERE t.id = 'd736e4d7e8644cf38f248e7ad87ed6ad';
|
||||
|
||||
UPDATE sys_menu t
|
||||
SET t.name = '分管校领导审批'
|
||||
WHERE t.id = '35a9239d754c47b9afccce173cb72d64';
|
||||
|
||||
# 清除之前的菜单角色权限
|
||||
# 校工会办公室主任审批
|
||||
delete
|
||||
from sys_role_menu
|
||||
where menuId = 'df2fb530141c4245826ac9974ec90c9a';
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', 'df2fb530141c4245826ac9974ec90c9a');
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('494ac71eb8b44d0e99e19b7fde6bd469', 'df2fb530141c4245826ac9974ec90c9a');
|
||||
|
||||
delete
|
||||
from sys_role_menu
|
||||
where menuId = '23d30124199b486d8af79aba62440b15';
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '23d30124199b486d8af79aba62440b15');
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('494ac71eb8b44d0e99e19b7fde6bd469', '23d30124199b486d8af79aba62440b15');
|
||||
|
||||
# 校工会主席审批
|
||||
delete
|
||||
from sys_role_menu
|
||||
where menuId = 'a473302b80ce404e93bc820f858a14da';
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', 'a473302b80ce404e93bc820f858a14da');
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('6aece46b946e4fb9ac4cb15c0cd8c3e6', 'a473302b80ce404e93bc820f858a14da');
|
||||
|
||||
delete
|
||||
from sys_role_menu
|
||||
where menuId = 'd736e4d7e8644cf38f248e7ad87ed6ad';
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', 'd736e4d7e8644cf38f248e7ad87ed6ad');
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('6aece46b946e4fb9ac4cb15c0cd8c3e6', 'd736e4d7e8644cf38f248e7ad87ed6ad');
|
||||
|
||||
# 分管校领导审批
|
||||
delete
|
||||
from sys_role_menu
|
||||
where menuId = '3e0bb63c5f0044bd837ad24633e92560';
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '3e0bb63c5f0044bd837ad24633e92560');
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('b3854469e6f44901b22bb791cb538431', '3e0bb63c5f0044bd837ad24633e92560');
|
||||
|
||||
delete
|
||||
from sys_role_menu
|
||||
where menuId = '35a9239d754c47b9afccce173cb72d64';
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '35a9239d754c47b9afccce173cb72d64');
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('b3854469e6f44901b22bb791cb538431', '35a9239d754c47b9afccce173cb72d64');
|
||||
|
||||
# 更新权限
|
||||
UPDATE zhgh_cqgmy.sys_menu
|
||||
SET permission = 'difficultHelp.firstApproval'
|
||||
WHERE permission = 'difficultHelp.branchUnionApproval';
|
||||
|
||||
UPDATE zhgh_cqgmy.sys_menu
|
||||
SET permission = 'difficultHelp.secondApproval'
|
||||
WHERE permission = 'difficultHelp.unionLeaderApproval';
|
||||
|
||||
UPDATE zhgh_cqgmy.sys_menu
|
||||
SET permission = 'difficultHelp.thirdApproval'
|
||||
WHERE permission = 'difficultHelp.schoolUnionApproval';
|
||||
|
||||
UPDATE zhgh_cqgmy.sys_menu
|
||||
SET permission = 'h5.difficultHelp.firstApproval'
|
||||
WHERE permission = 'h5.difficultHelp.branchUnionApproval';
|
||||
|
||||
UPDATE zhgh_cqgmy.sys_menu
|
||||
SET permission = 'h5.difficultHelp.secondApproval'
|
||||
WHERE permission = 'h5.difficultHelp.unionLeaderApproval';
|
||||
|
||||
UPDATE zhgh_cqgmy.sys_menu
|
||||
SET permission = 'h5.difficultHelp.thirdApproval'
|
||||
WHERE permission = 'h5.difficultHelp.schoolUnionApproval';
|
||||
|
||||
# 新增字典项
|
||||
INSERT INTO sys_dict (id, parentId, path, name, code, disabled, location, hasChildren, createdBy, createdAt, updatedBy,
|
||||
updatedAt, delFlag, remark)
|
||||
VALUES ('4d3e3472ae324552b16f0aaf07c37004', '501e0a4edca748ddb739ffb679170d50', '00020017', '校工会办公室主任',
|
||||
'SCHOOL_OFFICE_DIRECTOR', false, 9614, false, '17a7f8ad3ee947b4a26175049a9c253d', 1791517263500,
|
||||
'17a7f8ad3ee947b4a26175049a9c253d', 1791517263500, false, null);
|
||||
|
||||
ALTER TABLE difficult_help_info ADD COLUMN applyMoney VARCHAR(200) NULL COMMENT '申请金额';
|
||||
@@ -0,0 +1,136 @@
|
||||
START TRANSACTION;
|
||||
|
||||
-- 一级:分工会主席审批,节点 4dad0bef-3cf2-4a7d-bba3-35020b9b216d。
|
||||
UPDATE zhgh_cqgmy.sys_menu
|
||||
SET name = '分工会主席审批', initialPinyinName = 'f', note = '分工会主席审批',
|
||||
permission = 'condolence.firstApproval'
|
||||
WHERE id = '8e24dfdb70e448a899ea7de92319789c';
|
||||
|
||||
UPDATE zhgh_cqgmy.sys_menu
|
||||
SET name = '分工会主席审批', initialPinyinName = 'f', note = '分工会主席审批',
|
||||
permission = 'h5.condolence.firstApproval'
|
||||
WHERE id = '330e42e0ae914f5392b96fb933f17b5b';
|
||||
|
||||
-- 二级:校工会办公室主任审批,节点 34f7938e-47a3-4b3a-b4e0-92b7a3f47865。
|
||||
UPDATE zhgh_cqgmy.sys_menu
|
||||
SET name = '校工会办公室主任审批', initialPinyinName = 'x', note = '校工会办公室主任审批',
|
||||
permission = 'condolence.secondApproval'
|
||||
WHERE id = '09a59e7a99204ceca8e5dbbf8b2fafcf';
|
||||
|
||||
UPDATE zhgh_cqgmy.sys_menu
|
||||
SET name = '校工会办公室主任审批', initialPinyinName = 'x', note = '校工会办公室主任审批',
|
||||
permission = 'h5.condolence.secondApproval'
|
||||
WHERE id = '87a2dcfac0da4ec4870b65693807a4d1';
|
||||
|
||||
-- 三级:校工会主席审批,节点 ecdaef3b-edf4-4143-9a96-887dd5921711。
|
||||
UPDATE zhgh_cqgmy.sys_menu
|
||||
SET name = '校工会主席审批', initialPinyinName = 'x', note = '校工会主席审批',
|
||||
permission = 'condolence.thirdApproval'
|
||||
WHERE id = '0917928006574b2a99f7ef3e8804d873';
|
||||
|
||||
UPDATE zhgh_cqgmy.sys_menu
|
||||
SET name = '校工会主席审批', initialPinyinName = 'x', note = '校工会主席审批',
|
||||
permission = 'h5.condolence.thirdApproval'
|
||||
WHERE id = 'c269f94a5c8a4a4a8c8de0bb8f8f9f9a';
|
||||
|
||||
-- 四级:分管校领导审批,节点 cbd41337-3c87-4959-9027-809df5c7ef5e。
|
||||
INSERT INTO zhgh_cqgmy.sys_menu
|
||||
(id, parentId, path, name, aliasName, type, href, target, icon, showit, disabled,
|
||||
permission, note, location, hasChildren, createdBy, createdAt, updatedBy, updatedAt,
|
||||
delFlag, processKey, platform, moduleId, isQuickEntry, picIcon, initialPinyinName,
|
||||
isRecommendApp, isRecommendService)
|
||||
VALUES ('3561e97f44d14b47ae07f63ff8312a90', '3b49290f7db44130b9f6394a8212321f', '00900009',
|
||||
'分管校领导审批', null, 'menu', '/platform/condolence/fourthApproval', null, null, true, false,
|
||||
'condolence.fourthApproval', '分管校领导审批', 146, false,
|
||||
'17a7f8ad3ee947b4a26175049a9c253d', UNIX_TIMESTAMP() * 1000,
|
||||
'17a7f8ad3ee947b4a26175049a9c253d', UNIX_TIMESTAMP() * 1000,
|
||||
false, null, 'PC', '07d940ba34bd47399cda140894f5d86b', false, null, 'f', false, false);
|
||||
|
||||
INSERT INTO zhgh_cqgmy.sys_menu
|
||||
(id, parentId, path, name, aliasName, type, href, target, icon, showit, disabled,
|
||||
permission, note, location, hasChildren, createdBy, createdAt, updatedBy, updatedAt,
|
||||
delFlag, processKey, platform, moduleId, isQuickEntry, picIcon, initialPinyinName,
|
||||
isRecommendApp, isRecommendService)
|
||||
VALUES ('f02d5a68bdeb4c63a1b8ce47296d7304', '024811fd168e44948e6ab84911fc26bb', '01220006',
|
||||
'分管校领导审批', null, 'menu', '/platform/condolence/fourthApproval/h5', null, null, true, false,
|
||||
'h5.condolence.fourthApproval', '分管校领导审批', 32, false,
|
||||
'17a7f8ad3ee947b4a26175049a9c253d', UNIX_TIMESTAMP() * 1000,
|
||||
'17a7f8ad3ee947b4a26175049a9c253d', UNIX_TIMESTAMP() * 1000,
|
||||
false, null, 'H5', '586fffaeddc94a7493c81b6d69e546ab', false, '/platform/sys/file/download?id=d2095854e67dcf28dea1a4a975e90aba', 'f', false, false);
|
||||
|
||||
-- 清除之前的菜单角色权限,按审核角色重新配置。
|
||||
-- 一级:分工会主席审批,节点 4dad0bef-3cf2-4a7d-bba3-35020b9b216d。
|
||||
DELETE FROM zhgh_cqgmy.sys_role_menu WHERE menuId = '8e24dfdb70e448a899ea7de92319789c';
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '8e24dfdb70e448a899ea7de92319789c');
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
values ('fd753e8a8c5a404e8e00ef8e0b0c69da', '8e24dfdb70e448a899ea7de92319789c');
|
||||
|
||||
DELETE FROM zhgh_cqgmy.sys_role_menu WHERE menuId = '330e42e0ae914f5392b96fb933f17b5b';
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '330e42e0ae914f5392b96fb933f17b5b');
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
values ('fd753e8a8c5a404e8e00ef8e0b0c69da', '330e42e0ae914f5392b96fb933f17b5b');
|
||||
|
||||
-- 二级:校工会办公室主任审批,节点 34f7938e-47a3-4b3a-b4e0-92b7a3f47865。
|
||||
DELETE FROM zhgh_cqgmy.sys_role_menu WHERE menuId = '09a59e7a99204ceca8e5dbbf8b2fafcf';
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '09a59e7a99204ceca8e5dbbf8b2fafcf');
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('494ac71eb8b44d0e99e19b7fde6bd469', '09a59e7a99204ceca8e5dbbf8b2fafcf');
|
||||
|
||||
DELETE FROM zhgh_cqgmy.sys_role_menu WHERE menuId = '87a2dcfac0da4ec4870b65693807a4d1';
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '87a2dcfac0da4ec4870b65693807a4d1');
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('494ac71eb8b44d0e99e19b7fde6bd469', '87a2dcfac0da4ec4870b65693807a4d1');
|
||||
|
||||
-- 三级:校工会主席审批,节点 ecdaef3b-edf4-4143-9a96-887dd5921711。
|
||||
DELETE FROM zhgh_cqgmy.sys_role_menu WHERE menuId = '0917928006574b2a99f7ef3e8804d873';
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '0917928006574b2a99f7ef3e8804d873');
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('6aece46b946e4fb9ac4cb15c0cd8c3e6', '0917928006574b2a99f7ef3e8804d873');
|
||||
|
||||
DELETE FROM zhgh_cqgmy.sys_role_menu WHERE menuId = 'c269f94a5c8a4a4a8c8de0bb8f8f9f9a';
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', 'c269f94a5c8a4a4a8c8de0bb8f8f9f9a');
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('6aece46b946e4fb9ac4cb15c0cd8c3e6', 'c269f94a5c8a4a4a8c8de0bb8f8f9f9a');
|
||||
|
||||
DELETE FROM zhgh_cqgmy.sys_role_menu WHERE menuId = '3561e97f44d14b47ae07f63ff8312a90';
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '3561e97f44d14b47ae07f63ff8312a90');
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('b3854469e6f44901b22bb791cb538431', '3561e97f44d14b47ae07f63ff8312a90');
|
||||
|
||||
DELETE FROM zhgh_cqgmy.sys_role_menu WHERE menuId = 'f02d5a68bdeb4c63a1b8ce47296d7304';
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', 'f02d5a68bdeb4c63a1b8ce47296d7304');
|
||||
INSERT INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('b3854469e6f44901b22bb791cb538431', 'f02d5a68bdeb4c63a1b8ce47296d7304');
|
||||
|
||||
-- 补充职工慰问父菜单权限。
|
||||
INSERT IGNORE INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '3b49290f7db44130b9f6394a8212321f');
|
||||
INSERT IGNORE INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('494ac71eb8b44d0e99e19b7fde6bd469', '3b49290f7db44130b9f6394a8212321f');
|
||||
INSERT IGNORE INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('6aece46b946e4fb9ac4cb15c0cd8c3e6', '3b49290f7db44130b9f6394a8212321f');
|
||||
INSERT IGNORE INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('b3854469e6f44901b22bb791cb538431', '3b49290f7db44130b9f6394a8212321f');
|
||||
INSERT IGNORE INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
SELECT id, '3b49290f7db44130b9f6394a8212321f' FROM zhgh_cqgmy.sys_role WHERE code = 'BRANCH_UNION_CHAIRMAN' AND disabled = false AND delFlag = false;
|
||||
|
||||
INSERT IGNORE INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '024811fd168e44948e6ab84911fc26bb');
|
||||
INSERT IGNORE INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('494ac71eb8b44d0e99e19b7fde6bd469', '024811fd168e44948e6ab84911fc26bb');
|
||||
INSERT IGNORE INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('6aece46b946e4fb9ac4cb15c0cd8c3e6', '024811fd168e44948e6ab84911fc26bb');
|
||||
INSERT IGNORE INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
VALUES ('b3854469e6f44901b22bb791cb538431', '024811fd168e44948e6ab84911fc26bb');
|
||||
INSERT IGNORE INTO zhgh_cqgmy.sys_role_menu (roleId, menuId)
|
||||
SELECT id, '024811fd168e44948e6ab84911fc26bb' FROM zhgh_cqgmy.sys_role WHERE code = 'BRANCH_UNION_CHAIRMAN' AND disabled = false AND delFlag = false;
|
||||
|
||||
COMMIT;
|
||||
@@ -0,0 +1,14 @@
|
||||
truncate table condolence_type;
|
||||
|
||||
INSERT INTO condolence_type (id, code, name, money, way, disabled, isUploadFile, uploadFileDesc, sortNum, createdBy, createdAt, updatedBy, updatedAt, delFlag, isDisabled, location, uploadMeetingRecord, enable) VALUES ('00016fcb72234a8f95cd173665bbe563', 'C3', '生育(三孩)', 5000.00, '慰问金 (A)', false, null, null, 0, '17a7f8ad3ee947b4a26175049a9c253d', 1791539298087, '17a7f8ad3ee947b4a26175049a9c253d', 1791539298087, false, null, 8, false, true);
|
||||
INSERT INTO condolence_type (id, code, name, money, way, disabled, isUploadFile, uploadFileDesc, sortNum, createdBy, createdAt, updatedBy, updatedAt, delFlag, isDisabled, location, uploadMeetingRecord, enable) VALUES ('3777d15929dd4c66b3aa9ae67dc62528', 'C2', '生育(二孩)', 3000.00, '慰问金 (A)', false, null, null, 0, '17a7f8ad3ee947b4a26175049a9c253d', 1791539214037, '17a7f8ad3ee947b4a26175049a9c253d', 1791539269588, false, null, 7, false, true);
|
||||
INSERT INTO condolence_type (id, code, name, money, way, disabled, isUploadFile, uploadFileDesc, sortNum, createdBy, createdAt, updatedBy, updatedAt, delFlag, isDisabled, location, uploadMeetingRecord, enable) VALUES ('4cdf253d26044261a1a81359bbde1bb8', 'G', '直系亲属去世', 2000.00, '慰问金 (A)', false, true, '', 0, '17a7f8ad3ee947b4a26175049a9c253d', 1765427298440, '17a7f8ad3ee947b4a26175049a9c253d', 1791539615689, false, null, 2, false, true);
|
||||
INSERT INTO condolence_type (id, code, name, money, way, disabled, isUploadFile, uploadFileDesc, sortNum, createdBy, createdAt, updatedBy, updatedAt, delFlag, isDisabled, location, uploadMeetingRecord, enable) VALUES ('4e316737e71047e0b01aea78524c1416', 'E', '生病住院', 1000.00, '慰问金 (A)', false, true, '每年累计不超过3000元、每人每年最多申请3次', 1, '29847d7826aa415a92d03b9576d01d3f', 1722084651317, '29847d7826aa415a92d03b9576d01d3f', 1791539558039, false, false, null, false, true);
|
||||
INSERT INTO condolence_type (id, code, name, money, way, disabled, isUploadFile, uploadFileDesc, sortNum, createdBy, createdAt, updatedBy, updatedAt, delFlag, isDisabled, location, uploadMeetingRecord, enable) VALUES ('5b5f135e523d4cc5b5dc4355ffe9e024', 'B', '生日', 600.00, '慰问金 (A)', false, null, null, 0, '17a7f8ad3ee947b4a26175049a9c253d', 1791539148841, '17a7f8ad3ee947b4a26175049a9c253d', 1791539148841, false, null, 6, false, true);
|
||||
INSERT INTO condolence_type (id, code, name, money, way, disabled, isUploadFile, uploadFileDesc, sortNum, createdBy, createdAt, updatedBy, updatedAt, delFlag, isDisabled, location, uploadMeetingRecord, enable) VALUES ('60f03a87b62b4823855814afdbf5672a', 'F', '会员去世', 3000.00, '慰问金 (A)', false, true, '需要提供购买的慰问品发票,慰问照片', 0, '17a7f8ad3ee947b4a26175049a9c253d', 1765427276486, '17a7f8ad3ee947b4a26175049a9c253d', 1791539570707, false, null, 1, false, true);
|
||||
INSERT INTO condolence_type (id, code, name, money, way, disabled, isUploadFile, uploadFileDesc, sortNum, createdBy, createdAt, updatedBy, updatedAt, delFlag, isDisabled, location, uploadMeetingRecord, enable) VALUES ('b8ee30faacb2469593dfedb5b52565aa', 'D', '光荣退休', 2000.00, '慰问金 (A)', false, true, '需要提供购买的慰问品发票,慰问照片', 0, '17a7f8ad3ee947b4a26175049a9c253d', 1765427383848, '17a7f8ad3ee947b4a26175049a9c253d', 1791539529423, false, null, 3, false, true);
|
||||
INSERT INTO condolence_type (id, code, name, money, way, disabled, isUploadFile, uploadFileDesc, sortNum, createdBy, createdAt, updatedBy, updatedAt, delFlag, isDisabled, location, uploadMeetingRecord, enable) VALUES ('c90cb10dce6542e99ae271bee6fe8cc0', 'C1', '生育(一孩)', 2000.00, '慰问金 (A)', false, true, '需要提供购买的慰问品发票,慰问照片(会员与婴儿合影照,或慰问人员与会员和婴儿的合影照)', 0, '17a7f8ad3ee947b4a26175049a9c253d', 1765427542820, '17a7f8ad3ee947b4a26175049a9c253d', 1791539263656, false, null, 5, false, true);
|
||||
INSERT INTO condolence_type (id, code, name, money, way, disabled, isUploadFile, uploadFileDesc, sortNum, createdBy, createdAt, updatedBy, updatedAt, delFlag, isDisabled, location, uploadMeetingRecord, enable) VALUES ('cf4ce7af322d464f8f86d818fcc00203', 'A', '结婚', 1000.00, '慰问金 (A)', false, true, '需要提供购买的慰问品的发票、慰问照片、会员的结婚证复印件', 2, '29847d7826aa415a92d03b9576d01d3f', 1722084861840, '29847d7826aa415a92d03b9576d01d3f', 1768875320985, false, false, null, false, true);
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
-- 全量初始化:完整定义特殊慰问申请主表、被申请人明细表和慰问类型表。
|
||||
-- 表已存在时不执行本文件中的建表语句;本文件不复制数据、不配置角色授权和工作流。
|
||||
CREATE TABLE `special_condolence` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`subject` varchar(255) DEFAULT NULL COMMENT '事项',
|
||||
`applyUserId` varchar(32) DEFAULT NULL COMMENT '申请人ID',
|
||||
`applyUserName` varchar(100) DEFAULT NULL COMMENT '申请人姓名',
|
||||
`applyLoginName` varchar(120) DEFAULT NULL COMMENT '申请人工号',
|
||||
`applyUnionId` varchar(32) DEFAULT NULL COMMENT '申请人分工会ID',
|
||||
`applyUnionName` varchar(100) DEFAULT NULL COMMENT '申请人分工会',
|
||||
`applyUnitId` varchar(32) DEFAULT NULL COMMENT '申请人单位ID',
|
||||
`applyUnitName` varchar(100) DEFAULT NULL COMMENT '申请人单位',
|
||||
`helpUserId` varchar(32) DEFAULT NULL COMMENT '补助人ID',
|
||||
`helpUserName` varchar(100) DEFAULT NULL COMMENT '补助人姓名',
|
||||
`helpLoginName` varchar(120) DEFAULT NULL COMMENT '补助人工号',
|
||||
`helpUnionId` varchar(32) DEFAULT NULL COMMENT '补助人分工会ID',
|
||||
`helpUnionName` varchar(100) DEFAULT NULL COMMENT '补助人分工会',
|
||||
`helpUnitId` varchar(32) DEFAULT NULL COMMENT '补助人单位ID',
|
||||
`helpUnitName` varchar(100) DEFAULT NULL COMMENT '补助人单位',
|
||||
`origin` varchar(20) DEFAULT NULL COMMENT '类型',
|
||||
`payUserId` varchar(32) DEFAULT NULL COMMENT '收款人',
|
||||
`payUserName` varchar(30) DEFAULT NULL COMMENT '收款人姓名',
|
||||
`payLoginName` varchar(20) DEFAULT NULL COMMENT '收款人工号',
|
||||
`type` varchar(32) DEFAULT NULL COMMENT '慰问类型',
|
||||
`typeCode` varchar(32) DEFAULT NULL COMMENT '慰问编码',
|
||||
`way` varchar(20) DEFAULT NULL COMMENT '慰问方式',
|
||||
`perMoney` decimal(10,2) DEFAULT NULL COMMENT '统一每人慰问金额',
|
||||
`money` float(10,2) DEFAULT NULL COMMENT '慰问金额',
|
||||
`occurTime` varchar(30) DEFAULT NULL COMMENT '发生时间',
|
||||
`child` varchar(10) DEFAULT NULL COMMENT '生育几孩(孩次)',
|
||||
`hospital` varchar(50) DEFAULT NULL COMMENT '所在医院',
|
||||
`hospitalHouseNum` varchar(20) DEFAULT NULL COMMENT '病房床号',
|
||||
`hospitalHouseBedNum` varchar(20) DEFAULT NULL COMMENT '病房床号',
|
||||
`hospitalBy` varchar(100) DEFAULT NULL COMMENT '住院病由',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`files` json DEFAULT NULL COMMENT '附件',
|
||||
`signature` varchar(255) DEFAULT NULL COMMENT '签字',
|
||||
`createTime` varchar(30) DEFAULT NULL COMMENT '申请时间',
|
||||
`bankUserName` varchar(100) DEFAULT NULL COMMENT '户名',
|
||||
`bankCardNumber` varchar(100) DEFAULT NULL COMMENT '银行账号',
|
||||
`bankOfDeposit` varchar(100) DEFAULT NULL COMMENT '开户行',
|
||||
`certifierUserId` varchar(32) DEFAULT NULL COMMENT '证明人ID',
|
||||
`certifierUserName` varchar(100) DEFAULT NULL COMMENT '证明人姓名',
|
||||
`certifierLoginName` varchar(120) DEFAULT NULL COMMENT '证明人工号',
|
||||
`certifierUnionId` varchar(32) DEFAULT NULL COMMENT '证明人分工会ID',
|
||||
`certifierUnionName` varchar(100) DEFAULT NULL COMMENT '证明人分工会',
|
||||
`certifierUnitId` varchar(32) DEFAULT NULL COMMENT '证明人单位ID',
|
||||
`certifierUnitName` varchar(100) DEFAULT NULL COMMENT '证明人单位',
|
||||
`handlerUserId` varchar(32) DEFAULT NULL COMMENT '经办人ID',
|
||||
`handlerUserName` varchar(100) DEFAULT NULL COMMENT '经办人姓名',
|
||||
`handlerLoginName` varchar(120) DEFAULT NULL COMMENT '经办人工号',
|
||||
`handlerUnionId` varchar(32) DEFAULT NULL COMMENT '经办人分工会ID',
|
||||
`handlerUnionName` varchar(100) DEFAULT NULL COMMENT '经办人分工会',
|
||||
`handlerUnitId` varchar(32) DEFAULT NULL COMMENT '经办人单位ID',
|
||||
`handlerUnitName` varchar(100) DEFAULT NULL COMMENT '经办人单位',
|
||||
`hospitalizationTime` varchar(30) DEFAULT NULL COMMENT '入院时间',
|
||||
`leaveHospitalTime` varchar(30) DEFAULT NULL COMMENT '出院时间',
|
||||
`thisYearHospitalizationNum` int DEFAULT NULL COMMENT '当年第几次住院',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间(毫秒时间戳)',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间(毫秒时间戳)',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='特殊慰问申请';
|
||||
|
||||
CREATE TABLE `special_condolence_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`code` varchar(30) DEFAULT NULL COMMENT '编码',
|
||||
`name` varchar(50) DEFAULT NULL COMMENT '名称',
|
||||
`money` float(10,2) DEFAULT NULL COMMENT '费用',
|
||||
`way` varchar(20) DEFAULT NULL COMMENT '慰问方式',
|
||||
`enable` tinyint(1) DEFAULT 1 COMMENT '是否启用',
|
||||
`isUploadFile` tinyint(1) DEFAULT NULL COMMENT '是否上传附件',
|
||||
`uploadFileDesc` varchar(50) DEFAULT NULL COMMENT '上传附件说明',
|
||||
`location` int DEFAULT NULL COMMENT '排序字段',
|
||||
`sortNum` int NOT NULL DEFAULT 0 COMMENT '排序',
|
||||
`uploadMeetingRecord` tinyint(1) DEFAULT 0 COMMENT '上传会议纪要',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间(毫秒时间戳)',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间(毫秒时间戳)',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='特殊慰问类型';
|
||||
|
||||
-- 一份申请对应一个流程实例;多名被申请人通过 applyId 关联同一份申请。
|
||||
CREATE TABLE `special_condolence_recipient` (
|
||||
`id` varchar(32) NOT NULL COMMENT '明细ID',
|
||||
`applyId` varchar(32) NOT NULL COMMENT '申请主表ID',
|
||||
`helpUserId` varchar(32) NOT NULL COMMENT '慰问对象用户ID',
|
||||
`helpLoginName` varchar(120) DEFAULT NULL COMMENT '慰问对象工号',
|
||||
`personType` varchar(50) DEFAULT NULL COMMENT '人员类型',
|
||||
`helpUserName` varchar(100) NOT NULL COMMENT '慰问对象',
|
||||
`type` varchar(32) NOT NULL COMMENT '慰问类型ID',
|
||||
`typeName` varchar(50) DEFAULT NULL COMMENT '慰问类型名称',
|
||||
`typeCode` varchar(32) DEFAULT NULL COMMENT '慰问类型编码',
|
||||
`way` varchar(20) DEFAULT NULL COMMENT '慰问方式',
|
||||
`idCard` varchar(18) NOT NULL COMMENT '身份证号码',
|
||||
`bankOfDeposit` varchar(100) NOT NULL COMMENT '开户行',
|
||||
`bankUserName` varchar(100) NOT NULL COMMENT '户名',
|
||||
`bankCardNumber` varchar(30) NOT NULL COMMENT '收款账户',
|
||||
`money` decimal(10,2) NOT NULL COMMENT '慰问金额',
|
||||
`occurTime` varchar(30) NOT NULL COMMENT '慰问时间',
|
||||
`sortNum` int NOT NULL DEFAULT 0 COMMENT '行序号',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间(毫秒时间戳)',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间(毫秒时间戳)',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_special_condolence_recipient_apply` (`applyId`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='特殊慰问被申请人明细';
|
||||
|
||||
-- 主表保留原有摘要字段兼容现有列表,money 为整份申请的金额合计。
|
||||
-- 被申请人的完整信息保存在 special_condolence_recipient 中,不在主表使用 JSON 存储。
|
||||
|
||||
-- 新增 PC、H5 菜单,角色授权由管理员另行配置。
|
||||
START TRANSACTION;
|
||||
CREATE TEMPORARY TABLE special_condolence_menu_map AS
|
||||
SELECT id oldId, MD5(CONCAT('special_condolence:', id)) newId
|
||||
FROM sys_menu
|
||||
WHERE id IN ('3b49290f7db44130b9f6394a8212321f', '024811fd168e44948e6ab84911fc26bb')
|
||||
OR (href LIKE '/platform/condolence/%' AND href NOT LIKE '%/branchUnionApproval%');
|
||||
CREATE TEMPORARY TABLE special_condolence_parent_map (
|
||||
oldId varchar(32) NOT NULL COMMENT '原父菜单ID',
|
||||
newId varchar(32) NOT NULL COMMENT '特殊慰问父菜单ID',
|
||||
PRIMARY KEY (oldId)
|
||||
);
|
||||
INSERT INTO special_condolence_parent_map (oldId, newId)
|
||||
SELECT oldId, newId FROM special_condolence_menu_map;
|
||||
|
||||
INSERT INTO sys_menu
|
||||
(id, parentId, path, name, aliasName, type, href, target, icon, showit, disabled,
|
||||
permission, note, location, hasChildren, createdBy, createdAt, updatedBy, updatedAt,
|
||||
delFlag, processKey, platform, moduleId, isQuickEntry, picIcon, initialPinyinName,
|
||||
isRecommendApp, isRecommendService)
|
||||
SELECT map.newId, COALESCE(parent.newId, m.parentId),
|
||||
CONCAT('T', SUBSTRING(map.newId, 1, 7)), REPLACE(m.name, '职工慰问', '特殊慰问'),
|
||||
m.aliasName, m.type, REPLACE(m.href, '/condolence/', '/special_condolence/'), m.target,
|
||||
m.icon, m.showit, m.disabled,
|
||||
CASE m.id WHEN '3b49290f7db44130b9f6394a8212321f' THEN 'special_condolence'
|
||||
WHEN '024811fd168e44948e6ab84911fc26bb' THEN 'h5.special_condolence'
|
||||
ELSE REPLACE(m.permission, 'condolence', 'special_condolence') END,
|
||||
REPLACE(m.note, '职工慰问', '特殊慰问'), m.location, m.hasChildren,
|
||||
m.createdBy, UNIX_TIMESTAMP()*1000, m.updatedBy, UNIX_TIMESTAMP()*1000, m.delFlag,
|
||||
REPLACE(m.processKey, 'ZGWW', 'TSWW'), m.platform, m.moduleId, m.isQuickEntry,
|
||||
m.picIcon, IF(m.name = '职工慰问', 't', m.initialPinyinName), m.isRecommendApp, m.isRecommendService
|
||||
FROM sys_menu m JOIN special_condolence_menu_map map ON map.oldId = m.id
|
||||
LEFT JOIN special_condolence_parent_map parent ON parent.oldId = m.parentId
|
||||
WHERE NOT EXISTS (SELECT 1 FROM sys_menu existing WHERE existing.id = map.newId);
|
||||
|
||||
-- 父子菜单路径保持树形前缀关系。
|
||||
UPDATE sys_menu child JOIN sys_menu parent ON parent.id = child.parentId
|
||||
JOIN special_condolence_menu_map map ON map.newId = child.id
|
||||
SET child.path = CONCAT(parent.path, RIGHT(child.id, 4));
|
||||
|
||||
DROP TEMPORARY TABLE special_condolence_menu_map;
|
||||
DROP TEMPORARY TABLE special_condolence_parent_map;
|
||||
|
||||
-- 权限部分,不要删除
|
||||
-- SYSADMIN
|
||||
-- 特殊慰问 web
|
||||
INSERT INTO sys_role_menu (roleId, menuId) VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '4c46696d75ff0eddf5cb57fac3e5d06d');
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '3e97a91e7aa9566cdae94850038a6212'),
|
||||
('7f4a820d5a394bb8a0a92d6699afe7c8', '6c5be59ffb8d7c524ec72f2a02d6c6d2'),
|
||||
('7f4a820d5a394bb8a0a92d6699afe7c8', '7f66eb63b6ebd81c5eee9c5c2de2ed98'),
|
||||
('7f4a820d5a394bb8a0a92d6699afe7c8', '8d5ebaa091eee01abb33e89e3dcc92f8'),
|
||||
('7f4a820d5a394bb8a0a92d6699afe7c8', '9c37242f50c5fb4a9c1b2b9b9dd0e2fd'),
|
||||
('7f4a820d5a394bb8a0a92d6699afe7c8', '9f4f850904fe751db1cd13977374f99b'),
|
||||
('7f4a820d5a394bb8a0a92d6699afe7c8', 'b24a5bef9ccbf7241c5bb85e80352f8f');
|
||||
|
||||
-- 特殊慰问 h5
|
||||
INSERT INTO sys_role_menu (roleId, menuId) VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '2145812145ee6548552504b4f5a55ff7');
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', '42b4b5f54593cf023961ad1c9ce36f53'),
|
||||
('7f4a820d5a394bb8a0a92d6699afe7c8', '4f3212a13a54fbb2a082ee77651c9a73'),
|
||||
('7f4a820d5a394bb8a0a92d6699afe7c8', '739f64c71fe776dc3520ebb2977c2d68'),
|
||||
('7f4a820d5a394bb8a0a92d6699afe7c8', 'b6c725beaf3bfe9f2b29f46855c45a24'),
|
||||
('7f4a820d5a394bb8a0a92d6699afe7c8', 'eb3d1b27d51b84df1cebf24e1278e26c');
|
||||
|
||||
|
||||
-- 校工会办公室主任
|
||||
-- 特殊慰问 web
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES
|
||||
('494ac71eb8b44d0e99e19b7fde6bd469', '4c46696d75ff0eddf5cb57fac3e5d06d'),
|
||||
('494ac71eb8b44d0e99e19b7fde6bd469', '8d5ebaa091eee01abb33e89e3dcc92f8'),
|
||||
('494ac71eb8b44d0e99e19b7fde6bd469', '7f66eb63b6ebd81c5eee9c5c2de2ed98');
|
||||
|
||||
-- 特殊慰问 h5
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES
|
||||
('494ac71eb8b44d0e99e19b7fde6bd469', '2145812145ee6548552504b4f5a55ff7'),
|
||||
('494ac71eb8b44d0e99e19b7fde6bd469', '42b4b5f54593cf023961ad1c9ce36f53');
|
||||
|
||||
-- 校工会主席
|
||||
-- 特殊慰问 web
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES
|
||||
('6aece46b946e4fb9ac4cb15c0cd8c3e6', '4c46696d75ff0eddf5cb57fac3e5d06d'),
|
||||
('6aece46b946e4fb9ac4cb15c0cd8c3e6', '8d5ebaa091eee01abb33e89e3dcc92f8'),
|
||||
('6aece46b946e4fb9ac4cb15c0cd8c3e6', 'b24a5bef9ccbf7241c5bb85e80352f8f');
|
||||
|
||||
-- 特殊慰问 h5
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES
|
||||
('6aece46b946e4fb9ac4cb15c0cd8c3e6', '2145812145ee6548552504b4f5a55ff7'),
|
||||
('6aece46b946e4fb9ac4cb15c0cd8c3e6', 'b6c725beaf3bfe9f2b29f46855c45a24');
|
||||
|
||||
-- 校工会主席
|
||||
-- 特殊慰问 web
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES
|
||||
('b3854469e6f44901b22bb791cb538431', '4c46696d75ff0eddf5cb57fac3e5d06d'),
|
||||
('b3854469e6f44901b22bb791cb538431', '8d5ebaa091eee01abb33e89e3dcc92f8'),
|
||||
('b3854469e6f44901b22bb791cb538431', '9c37242f50c5fb4a9c1b2b9b9dd0e2fd');
|
||||
|
||||
-- 特殊慰问 h5
|
||||
INSERT INTO sys_role_menu (roleId, menuId)
|
||||
VALUES
|
||||
('b3854469e6f44901b22bb791cb538431', '2145812145ee6548552504b4f5a55ff7'),
|
||||
('b3854469e6f44901b22bb791cb538431', '739f64c71fe776dc3520ebb2977c2d68');
|
||||
|
||||
|
||||
COMMIT;
|
||||
@@ -0,0 +1,7 @@
|
||||
INSERT INTO sys_menu (id, parentId, path, name, aliasName, type, href, target, icon, showit, disabled, permission, note, location, hasChildren, createdBy, createdAt, updatedBy, updatedAt, delFlag, processKey, platform, moduleId, isQuickEntry, picIcon, initialPinyinName, isRecommendApp, isRecommendService) VALUES ('184d56fd537041caa2bde800d0d32436', '90bf20d9065e4e11864952ea18544c25', '009000040003', '个人范围', null, 'data', null, null, null, false, false, 'self', null, 1027, false, '17a7f8ad3ee947b4a26175049a9c253d', 1793418331288, '17a7f8ad3ee947b4a26175049a9c253d', 1793418331288, false, null, 'PC', null, false, null, null, false, false);
|
||||
INSERT INTO sys_menu (id, parentId, path, name, aliasName, type, href, target, icon, showit, disabled, permission, note, location, hasChildren, createdBy, createdAt, updatedBy, updatedAt, delFlag, processKey, platform, moduleId, isQuickEntry, picIcon, initialPinyinName, isRecommendApp, isRecommendService) VALUES ('df87d83ed3184019b3872139c15b53ec', '90bf20d9065e4e11864952ea18544c25', '009000040002', '分工会范围', null, 'data', null, null, null, false, false, 'branch_union', null, 1026, false, '17a7f8ad3ee947b4a26175049a9c253d', 1793418331286, '17a7f8ad3ee947b4a26175049a9c253d', 1793418331286, false, null, 'PC', null, false, null, null, false, false);
|
||||
INSERT INTO sys_menu (id, parentId, path, name, aliasName, type, href, target, icon, showit, disabled, permission, note, location, hasChildren, createdBy, createdAt, updatedBy, updatedAt, delFlag, processKey, platform, moduleId, isQuickEntry, picIcon, initialPinyinName, isRecommendApp, isRecommendService) VALUES ('f2a75d2494724978b5325075815808c9', '90bf20d9065e4e11864952ea18544c25', '009000040001', '全校范围', null, 'data', null, null, null, false, false, 'all_school', null, 1025, false, '17a7f8ad3ee947b4a26175049a9c253d', 1793418331280, '17a7f8ad3ee947b4a26175049a9c253d', 1793418331280, false, null, 'PC', null, false, null, null, false, false);
|
||||
INSERT INTO sys_role_menu (roleId, menuId) VALUES ('fd753e8a8c5a404e8e00ef8e0b0c69da', 'df87d83ed3184019b3872139c15b53ec');
|
||||
INSERT INTO sys_role_menu (roleId, menuId) VALUES ('494ac71eb8b44d0e99e19b7fde6bd469', 'f2a75d2494724978b5325075815808c9');
|
||||
INSERT INTO sys_role_menu (roleId, menuId) VALUES ('6aece46b946e4fb9ac4cb15c0cd8c3e6', 'f2a75d2494724978b5325075815808c9');
|
||||
INSERT INTO sys_role_menu (roleId, menuId) VALUES ('b3854469e6f44901b22bb791cb538431', 'f2a75d2494724978b5325075815808c9');
|
||||
@@ -1,17 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<configuration scan="false" scanPeriod="60000" debug="false">
|
||||
|
||||
<!-- 定义日志文件的存储路径 -->
|
||||
<!-- 日志存储路径 -->
|
||||
<property name="LOG_HOME" value="./logs"/>
|
||||
|
||||
<!-- 控制台输出配置 -->
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- INFO级别日志文件配置 -->
|
||||
|
||||
<!--
|
||||
#################################################################################
|
||||
# #
|
||||
# 全文输出日志(一个文件存储)start #
|
||||
# #
|
||||
#################################################################################
|
||||
-->
|
||||
|
||||
<!-- 所有级别日志写入同一个文件 -->
|
||||
<appender name="ALL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/app.log</file>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/app-%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>300</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<!-- 框架日志级别(按需调整) -->
|
||||
<logger name="org.eclipse.jetty" level="INFO"/>
|
||||
<logger name="org.quartz" level="INFO"/>
|
||||
<logger name="org.nutz" level="DEBUG"/>
|
||||
|
||||
<!-- root logger:DEBUG 级别,输出到控制台和全量文件 -->
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="ALL_FILE"/>
|
||||
</root>
|
||||
|
||||
<!--
|
||||
#################################################################################
|
||||
# #
|
||||
# 全文输出日志(一个文件存储)end #
|
||||
# #
|
||||
#################################################################################
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
#################################################################################
|
||||
# #
|
||||
# debug、info、error分文件输出 start #
|
||||
# #
|
||||
#################################################################################
|
||||
-->
|
||||
|
||||
<!-- DEBUG级别日志文件配置 -->
|
||||
<!--<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/debug.log</file>
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>DEBUG</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/debug-%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>300</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<!– INFO级别日志文件配置 –>
|
||||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/info.log</file>
|
||||
<encoder>
|
||||
@@ -24,11 +92,11 @@
|
||||
</filter>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/info-%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
<maxHistory>300</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<!-- ERROR级别日志文件配置 -->
|
||||
<!– ERROR级别日志文件配置 –>
|
||||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/error.log</file>
|
||||
<encoder>
|
||||
@@ -41,19 +109,31 @@
|
||||
</filter>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/error-%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
<maxHistory>300</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<logger name="java" additivity="false" />
|
||||
<!– 框架日志级别 –>
|
||||
<!– <logger name="java" additivity="false" />–>
|
||||
<logger name="org.eclipse.jetty" level="INFO"/>
|
||||
<logger name="org.quartz" level="INFO"/>
|
||||
<logger name="org.nutz" level="DEBUG"/>
|
||||
|
||||
<!-- 日志级别和appender的关联 -->
|
||||
<!– 日志级别和appender的关联 –>
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="DEBUG_FILE"/>
|
||||
<appender-ref ref="INFO_FILE"/>
|
||||
<appender-ref ref="ERROR_FILE"/>
|
||||
</root>
|
||||
</root>-->
|
||||
|
||||
<!--
|
||||
#################################################################################
|
||||
# #
|
||||
# debug、info、error分文件输出 end #
|
||||
# #
|
||||
#################################################################################
|
||||
-->
|
||||
|
||||
</configuration>
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
7pKr23u2tZHcvXud
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+74513
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="signature-wrap">
|
||||
<canvas id="canvas"></canvas>
|
||||
<canvas ref="canvas" @touchstart.stop @touchmove.stop></canvas>
|
||||
<div :class="isLikelyMobile() ? 'action-buttons' : 'action-buttons pc-action-buttons'">
|
||||
<button @click="clear" class="action-button-danger" type="button">清空</button>
|
||||
<button @click="undo" class="action-button-warning" type="button">撤销</button>
|
||||
@@ -30,23 +30,23 @@
|
||||
// window.addEventListener("orientationchange", a)
|
||||
// a()
|
||||
|
||||
let signature = null
|
||||
module.exports = {
|
||||
name: "sysSignature",
|
||||
data() {
|
||||
return {
|
||||
content: null
|
||||
content: null,
|
||||
signature: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clear() {
|
||||
signature.clear()
|
||||
this.signature.clear()
|
||||
},
|
||||
undo() {
|
||||
signature.undo()
|
||||
this.signature.undo()
|
||||
},
|
||||
rotate() {
|
||||
signature.getRotateCanvas(90)
|
||||
this.signature.getRotateCanvas(90)
|
||||
},
|
||||
isLikelyMobile() {
|
||||
const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
||||
@@ -56,7 +56,7 @@ module.exports = {
|
||||
return hasMobileUA || (isTouchDevice && isSmallScreen);
|
||||
},
|
||||
save() {
|
||||
if (signature.isEmpty()) {
|
||||
if (this.signature.isEmpty()) {
|
||||
// H5 页面使用统一的 Vant 提示;未加载 Vant 的独立签字页保留原生提示作为兼容兜底。
|
||||
if (typeof this.$toast === "function") {
|
||||
this.$toast({
|
||||
@@ -71,11 +71,11 @@ module.exports = {
|
||||
}
|
||||
// const png = signature.getPNG()
|
||||
//旋转一下 横过来
|
||||
const rotateCanvas = signature.getRotateCanvas(-90)
|
||||
const rotateCanvas = this.signature.getRotateCanvas(-90)
|
||||
if (this.isLikelyMobile()) {
|
||||
this.$emit("save", rotateCanvas.toDataURL())
|
||||
} else {
|
||||
this.$emit("save", signature.toDataURL())
|
||||
this.$emit("save", this.signature.toDataURL())
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -83,10 +83,10 @@ module.exports = {
|
||||
const innerWidth = window.innerWidth
|
||||
const innerHeight = window.innerHeight
|
||||
|
||||
const canvas = document.getElementById("canvas")
|
||||
const canvas = this.$refs.canvas
|
||||
canvas.width = window.innerWidth
|
||||
canvas.height = window.innerHeight
|
||||
signature = new SmoothSignature(canvas, {
|
||||
this.signature = new SmoothSignature(canvas, {
|
||||
width: innerWidth - 30,
|
||||
height: innerHeight - 30,
|
||||
scale: 2,
|
||||
@@ -95,6 +95,15 @@ module.exports = {
|
||||
color: "#000000"
|
||||
// bgColor: "#f6f6f6"
|
||||
})
|
||||
canvas.addEventListener("touchstart", this.signature.onDrawStart, { passive: false })
|
||||
canvas.addEventListener("touchmove", this.signature.onDrawMove, { passive: false })
|
||||
document.addEventListener("touchend", this.signature.onDrawEnd, { passive: false })
|
||||
document.addEventListener("touchcancel", this.signature.onDrawEnd, { passive: false })
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.signature) {
|
||||
this.signature.removeListener()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -35,22 +35,58 @@ module.exports = {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//前端唯一标识 当然后端还有用户id作为唯一标识
|
||||
// 二维码携带本次组件实例的标识,与服务端当前登录用户共同确定签字记录。
|
||||
id: new Date().getTime() + Math.floor(Math.random() * 10000) + 1,
|
||||
signatureAddress: null,
|
||||
interval: null,
|
||||
connectionWaitResolve: null,
|
||||
unsubscribeSignature: null,
|
||||
signatureContent: null,
|
||||
loading: true,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async init() {
|
||||
const {code, data} = await this.$axios.post("/platform/signature/get")
|
||||
if (code === 0) {
|
||||
this.signatureContent = data && data.signature
|
||||
this.$emit("input", this.signatureContent)
|
||||
}
|
||||
/**
|
||||
* 无请求参数,返回 Promise;响应 code 为0表示成功,data.signature 为已有签字图片地址。
|
||||
* 请求结束后由 mounted 的 finally 统一关闭 loading。
|
||||
*/
|
||||
init() {
|
||||
this.signatureAddress = origin + "/platform/signature/scanPcCode?id=" + this.id
|
||||
return this.$axios.post("/platform/signature/get")
|
||||
.then((res) => {
|
||||
if (this._isBeingDestroyed || this._isDestroyed) {
|
||||
return
|
||||
}
|
||||
if (res.code !== 0) {
|
||||
throw new Error("签字信息加载失败")
|
||||
}
|
||||
this.signatureContent = res.data && res.data.signature
|
||||
this.$emit("input", this.signatureContent)
|
||||
})
|
||||
},
|
||||
// 返回等待完成的 Promise;连接成功、等待30秒或组件销毁时结束等待。
|
||||
waitForConnection() {
|
||||
return new Promise((resolve) => {
|
||||
const startedAt = Date.now()
|
||||
this.connectionWaitResolve = resolve
|
||||
const checkReady = () => {
|
||||
this.interval = null
|
||||
if (this._isBeingDestroyed || this._isDestroyed ||
|
||||
(webSocketPubSub.ws && webSocketPubSub.ws.readyState === WebSocket.OPEN)) {
|
||||
this.connectionWaitResolve = null
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
if (Date.now() - startedAt >= 30000) {
|
||||
this.connectionWaitResolve = null
|
||||
this.$message.warning("签字消息连接超时,请刷新页面重试")
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
this.interval = setTimeout(checkReady, 100)
|
||||
}
|
||||
checkReady()
|
||||
})
|
||||
},
|
||||
signatureAgain() {
|
||||
const val = sessionStorage.getItem("h5-scan-code-signature-" + this.id)
|
||||
@@ -58,25 +94,42 @@ module.exports = {
|
||||
this.$emit("input", val)
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
await this.init()
|
||||
webSocketPubSub.subscribe("h5-scan-code-signature", (data) => {
|
||||
console.info("ws:收到签字成功消息:", data)
|
||||
mounted() {
|
||||
this.loading = true
|
||||
// 先登记消息回调,连接成功后由公共连接加入房间,避免请求期间遗漏订阅。
|
||||
this.unsubscribeSignature = webSocketPubSub.subscribe("h5-scan-code-signature", (data) => {
|
||||
this.signatureContent = data.value
|
||||
this.$emit("input", data.value)
|
||||
})
|
||||
|
||||
// 可选:轮询或 watch ready 状态
|
||||
const checkReady = () => {
|
||||
if (webSocketPubSub.ws && webSocketPubSub.ws.readyState === WebSocket.OPEN) {
|
||||
console.info("ws.readyState is open");
|
||||
this.loading = false;
|
||||
console.log(this.signatureAddress)
|
||||
} else {
|
||||
setTimeout(checkReady, 100);
|
||||
}
|
||||
};
|
||||
checkReady();
|
||||
this.init()
|
||||
.then(() => {
|
||||
if (!this._isBeingDestroyed && !this._isDestroyed) {
|
||||
return this.waitForConnection()
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
if (!this._isBeingDestroyed && !this._isDestroyed) {
|
||||
this.$message.error("签字信息加载失败,请刷新页面重试")
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
if (!this._isBeingDestroyed && !this._isDestroyed) {
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
beforeDestroy() {
|
||||
// pjax 切换页面时取消轮询和订阅,旧组件不得继续接收签字消息。
|
||||
clearTimeout(this.interval)
|
||||
this.interval = null
|
||||
if (this.connectionWaitResolve) {
|
||||
this.connectionWaitResolve()
|
||||
this.connectionWaitResolve = null
|
||||
}
|
||||
if (this.unsubscribeSignature) {
|
||||
this.unsubscribeSignature()
|
||||
this.unsubscribeSignature = null
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
progress
|
||||
:accept="accept"
|
||||
:max-count="upload_number"
|
||||
:upload-text="upload_text"
|
||||
title=""
|
||||
description=""
|
||||
tip=""
|
||||
@@ -50,6 +51,11 @@ module.exports = {
|
||||
default: 1,
|
||||
required: false
|
||||
},
|
||||
upload_text: {
|
||||
type: String,
|
||||
default: "",
|
||||
required: false
|
||||
},
|
||||
// 上传返回id或url
|
||||
upload_result_type: {
|
||||
type: String,
|
||||
@@ -101,6 +107,7 @@ module.exports = {
|
||||
this.fileList = val.map((v) => {
|
||||
return {
|
||||
...v,
|
||||
file: v.file || { name: v.name },
|
||||
status: null,
|
||||
isImage: ["jpg", "jpeg", "png", "gif", "bmp", "webp"].includes(v.name.split(".").pop().toLowerCase())
|
||||
}
|
||||
@@ -118,6 +125,7 @@ module.exports = {
|
||||
this.fileList = val.map((v) => {
|
||||
return {
|
||||
...v,
|
||||
file: v.file || { name: v.name },
|
||||
url: v.url ? v.url : v.response?.data,
|
||||
isImage: ["jpg", "jpeg", "png", "gif", "bmp", "webp"].includes(v.name.split(".").pop().toLowerCase()),
|
||||
status: null
|
||||
@@ -171,8 +179,8 @@ module.exports = {
|
||||
f.url = resp.data
|
||||
f.response = resp
|
||||
f.percentage = 100
|
||||
f.isImage = true
|
||||
delete f.file
|
||||
f.isImage = ["jpg", "jpeg", "png", "gif", "bmp", "webp"].includes(f.name.split(".").pop().toLowerCase())
|
||||
f.file = { name: f.name }
|
||||
delete f.content
|
||||
} else {
|
||||
f.status = "fail"
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<div class="h5-user-select">
|
||||
<van-field v-bind="$attrs" :value="displayName" readonly clickable is-link @click="open"></van-field>
|
||||
<van-popup v-model="visible" position="bottom" round get-container="body" class="h5-user-select-popup">
|
||||
<div class="h5-user-select-popup__header">
|
||||
<van-button native-type="button" type="default" size="small" @click="visible = false">取消</van-button>
|
||||
<strong>选择慰问对象</strong>
|
||||
<van-button native-type="button" type="info" size="small" :disabled="!pendingUser" @click="confirm">确认</van-button>
|
||||
</div>
|
||||
<van-search v-model="keyword" placeholder="请输入姓名或工号查询" @input="scheduleSearch" @search="search" @clear="search"></van-search>
|
||||
<div class="h5-user-select-popup__list">
|
||||
<div v-if="loading" class="h5-user-select-popup__status"><van-loading size="24px">加载中</van-loading></div>
|
||||
<div v-else-if="error" class="h5-user-select-popup__status"><span class="h5-user-select-popup__error">{{ error }}</span><van-button native-type="button" size="small" @click="search">重新加载</van-button></div>
|
||||
<van-empty v-else-if="!options.length" description="未找到本工会人员"></van-empty>
|
||||
<template v-else>
|
||||
<van-cell v-for="person in options" :key="person.id" clickable
|
||||
:class="{ 'h5-user-select-popup__selected': pendingUser && pendingUser.id === person.id }"
|
||||
:title="person.userName + (person.loginName ? '(' + person.loginName + ')' : '')"
|
||||
:label="[person.unitName, person.personType].filter(Boolean).join(' · ')"
|
||||
@click="pendingUser = person">
|
||||
<van-icon v-if="pendingUser && pendingUser.id === person.id" name="success" color="#1989fa"></van-icon>
|
||||
</van-cell>
|
||||
</template>
|
||||
</div>
|
||||
</van-popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
inheritAttrs: false,
|
||||
model: { prop: 'value', event: 'change' },
|
||||
props: {
|
||||
value: { type: String, default: '' },
|
||||
displayName: { type: String, default: '' },
|
||||
api: { type: String, required: true }
|
||||
},
|
||||
data() {
|
||||
return { visible: false, keyword: '', options: [], pendingUser: null, loading: false, error: '', searchTimer: null, requestId: 0 }
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.searchTimer)
|
||||
this.requestId++
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.keyword = ''
|
||||
this.pendingUser = null
|
||||
this.visible = true
|
||||
this.search()
|
||||
},
|
||||
scheduleSearch() {
|
||||
clearTimeout(this.searchTimer)
|
||||
this.requestId++
|
||||
this.pendingUser = null
|
||||
this.loading = true
|
||||
this.searchTimer = setTimeout(() => this.search(), 250)
|
||||
},
|
||||
async search() {
|
||||
clearTimeout(this.searchTimer)
|
||||
const requestId = ++this.requestId
|
||||
this.loading = true
|
||||
this.error = ''
|
||||
this.pendingUser = null
|
||||
try {
|
||||
const result = await this.$axios.post(this.api, { keyword: this.keyword })
|
||||
if (requestId !== this.requestId) return
|
||||
if (result.code !== 0) throw new Error(result.msg || '人员加载失败')
|
||||
this.options = result.data || []
|
||||
} catch (error) {
|
||||
if (requestId !== this.requestId) return
|
||||
this.options = []
|
||||
this.error = error.message || '人员加载失败'
|
||||
} finally {
|
||||
if (requestId === this.requestId) this.loading = false
|
||||
}
|
||||
},
|
||||
confirm() {
|
||||
if (!this.pendingUser) return
|
||||
const person = this.pendingUser
|
||||
this.$emit('change', person.id)
|
||||
this.$emit('selected', person, person.id)
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.h5-user-select-popup { display: flex; flex-direction: column; height: 72vh; max-height: 640px; padding-bottom: env(safe-area-inset-bottom); box-sizing: border-box; }
|
||||
.h5-user-select-popup__header { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; padding: 14px 16px; border-bottom: 1px solid #ebedf0; }
|
||||
.h5-user-select-popup__header strong { font-size: 16px; color: #323233; }
|
||||
.h5-user-select-popup__header .van-button { min-width: 56px; }
|
||||
.h5-user-select-popup__list { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
|
||||
.h5-user-select-popup__selected { background: #edf6ff; }
|
||||
.h5-user-select-popup__status { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; padding: 40px 16px; }
|
||||
.h5-user-select-popup__error { color: #ee0a24; }
|
||||
</style>
|
||||
@@ -106,7 +106,9 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
onChange(val) {
|
||||
const selected = this.options.find(item => String(item[this.option_value]) === String(val)) || null
|
||||
this.$emit("change", val)
|
||||
this.$emit("selected", selected, val)
|
||||
},
|
||||
|
||||
clearOptions() {
|
||||
@@ -114,7 +116,7 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.clearOptions()
|
||||
this.options = this.option_list || []
|
||||
console.log(this.placeholder)
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -443,50 +443,76 @@
|
||||
constructor() {
|
||||
this.ws = null
|
||||
this.subscribers = new Map()
|
||||
this.isSubscribed = false // 添加订阅状态标记
|
||||
this.isSubscribed = false
|
||||
this.connectTimer = null
|
||||
this.reconnectTimer = null
|
||||
this.pingTimer = null
|
||||
this.isDisposed = false
|
||||
this.init()
|
||||
}
|
||||
|
||||
// 页面只创建一个心跳任务;每次连接自行绑定事件及握手超时。
|
||||
init() {
|
||||
this.setupWindowEvents()
|
||||
this.setupPing()
|
||||
this.connect()
|
||||
}
|
||||
|
||||
// 正在连接或关闭时等待对应事件,避免同时创建多个连接。
|
||||
connect() {
|
||||
if (this.isDisposed || this.reconnectTimer !== null ||
|
||||
(this.ws && this.ws.readyState !== WebSocket.CLOSED)) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
this.connect()
|
||||
const WS_URL = window.location.host + "${base}/websocket"
|
||||
const protocol = window.location.protocol === "http:" ? "ws://" : "wss://"
|
||||
this.ws = new WebSocket(protocol + WS_URL)
|
||||
this.isSubscribed = false
|
||||
this.setupEventListeners()
|
||||
this.setupPing()
|
||||
this.setupWindowEvents()
|
||||
} catch (ex) {
|
||||
console.info(ex)
|
||||
const socket = this.ws
|
||||
// 握手最多等待30秒,心跳不得提前关闭仍处于 CONNECTING 的连接。
|
||||
this.connectTimer = setTimeout(() => {
|
||||
this.connectTimer = null
|
||||
if (this.ws === socket && socket.readyState === WebSocket.CONNECTING) {
|
||||
console.warn("WebSocket 握手超时,关闭当前连接后重试", socket.url)
|
||||
socket.close()
|
||||
}
|
||||
}, 30000)
|
||||
} catch (error) {
|
||||
console.error("WebSocket 创建连接失败", error)
|
||||
this.reconnect()
|
||||
}
|
||||
}
|
||||
|
||||
connect() {
|
||||
const WS_URL = window.location.host + "${base}/websocket"
|
||||
const protocol = window.location.protocol === "http:" ? "ws://" : "wss://"
|
||||
this.ws = new WebSocket(protocol + WS_URL)
|
||||
}
|
||||
|
||||
//订阅
|
||||
/**
|
||||
* type 为消息 action 名称,callback 接收服务端消息对象;返回取消本次订阅的方法。
|
||||
* 连接尚未建立时先保留回调,在 onopen 中统一加入当前用户的消息房间。
|
||||
*/
|
||||
subscribe(type, callback) {
|
||||
if (!this.subscribers.has(type)) {
|
||||
this.subscribers.set(type, new Set())
|
||||
}
|
||||
this.subscribers.get(type).add(callback)
|
||||
|
||||
setTimeout(() => {
|
||||
// 所有订阅完成后,发送 join 消息
|
||||
if (!this.isSubscribed && this.ws.readyState === WebSocket.OPEN) {
|
||||
this.isSubscribed = true
|
||||
this.sendJoinMessage()
|
||||
const callbacks = this.subscribers.get(type)
|
||||
callbacks.add(callback)
|
||||
this.sendJoinMessage()
|
||||
return () => {
|
||||
callbacks.delete(callback)
|
||||
if (callbacks.size === 0 && this.subscribers.get(type) === callbacks) {
|
||||
this.subscribers.delete(type)
|
||||
}
|
||||
}, 2000)
|
||||
}
|
||||
}
|
||||
|
||||
// 事件处理
|
||||
// 事件绑定到本次连接,旧连接的延迟事件不得影响新连接。
|
||||
setupEventListeners() {
|
||||
// 消息处理
|
||||
this.ws.onmessage = (event) => {
|
||||
const socket = this.ws
|
||||
socket.onmessage = (event) => {
|
||||
if (this.isDisposed || this.ws !== socket) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const data = JSON.parse(event.data)
|
||||
// 触发订阅者的回调
|
||||
if (this.subscribers.has(data.action)) {
|
||||
this.subscribers.get(data.action).forEach((callback) => {
|
||||
try {
|
||||
@@ -500,82 +526,112 @@
|
||||
console.error("消息解析错误:", error)
|
||||
}
|
||||
}
|
||||
|
||||
// 连接建立
|
||||
this.ws.onopen = () => {
|
||||
// this.ws.send(
|
||||
// JSON.stringify({
|
||||
// room: store.state.room,
|
||||
// action: "join"
|
||||
// })
|
||||
// )
|
||||
// 连接建立时不立即发送 join,等待订阅完成
|
||||
this.ping()
|
||||
}
|
||||
}
|
||||
|
||||
// 新增发送 join 消息的方法
|
||||
sendJoinMessage() {
|
||||
this.send({
|
||||
room: store.state.room,
|
||||
action: "join"
|
||||
})
|
||||
}
|
||||
|
||||
// 心跳检测
|
||||
setupPing() {
|
||||
setInterval(() => this.ping(), (11624317 / 1000) * 2)
|
||||
}
|
||||
|
||||
ping() {
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
try {
|
||||
this.ws.send("{}")
|
||||
} catch (e) {
|
||||
this.reconnect()
|
||||
socket.onopen = () => {
|
||||
if (this.isDisposed || this.ws !== socket) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
clearTimeout(this.connectTimer)
|
||||
this.connectTimer = null
|
||||
this.sendJoinMessage()
|
||||
this.ping()
|
||||
console.info("WebSocket 连接已建立", socket.url)
|
||||
}
|
||||
socket.onerror = () => {
|
||||
if (!this.isDisposed && this.ws === socket) {
|
||||
console.warn("WebSocket 连接异常,等待关闭后重连", socket.url)
|
||||
}
|
||||
}
|
||||
socket.onclose = (event) => {
|
||||
if (this.isDisposed || this.ws !== socket) {
|
||||
return
|
||||
}
|
||||
clearTimeout(this.connectTimer)
|
||||
this.connectTimer = null
|
||||
this.isSubscribed = false
|
||||
console.warn("WebSocket 已关闭", event.code, event.reason)
|
||||
this.reconnect()
|
||||
}
|
||||
}
|
||||
|
||||
// 每个已建立的连接只加入一次房间,首次连接及断线恢复都补发已有订阅。
|
||||
sendJoinMessage() {
|
||||
if (this.isDisposed || this.isSubscribed || this.subscribers.size === 0 ||
|
||||
!window.store || !store.state.room || !this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
||||
return
|
||||
}
|
||||
this.send({
|
||||
room: store.state.room,
|
||||
action: "join"
|
||||
})
|
||||
this.isSubscribed = true
|
||||
}
|
||||
|
||||
// 沿用原心跳间隔,仅对已建立的连接发送心跳。
|
||||
setupPing() {
|
||||
this.pingTimer = setInterval(() => this.ping(), (11624317 / 1000) * 2)
|
||||
}
|
||||
|
||||
// CONNECTING/CLOSING 状态分别由握手超时和关闭事件处理。
|
||||
ping() {
|
||||
if (this.isDisposed) {
|
||||
return
|
||||
}
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
try {
|
||||
this.ws.send("{}")
|
||||
} catch (error) {
|
||||
console.warn("WebSocket 心跳发送失败,等待关闭后重连", error)
|
||||
this.ws.close()
|
||||
}
|
||||
} else if (!this.ws || this.ws.readyState === WebSocket.CLOSED) {
|
||||
this.reconnect()
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭事件和心跳共用一个重连任务,避免重复定时器创建并行连接。
|
||||
reconnect() {
|
||||
if (this.ws) {
|
||||
this.ws.close() // 确保旧连接已关闭
|
||||
if (this.isDisposed || this.reconnectTimer !== null ||
|
||||
(this.ws && this.ws.readyState !== WebSocket.CLOSED)) {
|
||||
return
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.reconnectTimer = setTimeout(() => {
|
||||
this.reconnectTimer = null
|
||||
this.connect()
|
||||
this.setupEventListeners()
|
||||
// 如果之前已订阅,重新发送join消息
|
||||
if (this.isSubscribed) {
|
||||
setTimeout(() => {
|
||||
if (this.ws.readyState === WebSocket.OPEN) {
|
||||
this.sendJoinMessage()
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
}, 3000) // 延迟3秒重连
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
// 窗口事件处理
|
||||
// 真正离开页面时释放连接和定时器;进入往返缓存时保留页面状态。
|
||||
setupWindowEvents() {
|
||||
let _beforeUnload_time = 0
|
||||
window.onbeforeunload = () => {
|
||||
_beforeUnload_time = new Date().getTime()
|
||||
}
|
||||
window.onunload = () => {
|
||||
const _gap_time = new Date().getTime() - _beforeUnload_time
|
||||
if (_gap_time <= 5) {
|
||||
this.send({
|
||||
room: "${@auth.getPrincipalProperty('loginname')}:${@auth.getSessionId()}",
|
||||
action: "left"
|
||||
})
|
||||
window.addEventListener("pagehide", (event) => {
|
||||
if (event.persisted) {
|
||||
return
|
||||
}
|
||||
}
|
||||
this.isDisposed = true
|
||||
clearTimeout(this.connectTimer)
|
||||
clearTimeout(this.reconnectTimer)
|
||||
clearInterval(this.pingTimer)
|
||||
this.connectTimer = null
|
||||
this.reconnectTimer = null
|
||||
this.pingTimer = null
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
try {
|
||||
this.send({
|
||||
room: store.state.room,
|
||||
action: "left"
|
||||
})
|
||||
} catch (error) {
|
||||
console.warn("WebSocket 离开房间消息发送失败", error)
|
||||
}
|
||||
}
|
||||
if (this.ws && this.ws.readyState !== WebSocket.CLOSED) {
|
||||
this.ws.close()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// message 为消息对象或 JSON 字符串;连接未建立时不发送,返回值为 undefined。
|
||||
send(message) {
|
||||
if (this.ws) {
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
const messageStr = typeof message === "string" ? message : JSON.stringify(message)
|
||||
this.ws.send(messageStr)
|
||||
}
|
||||
|
||||
@@ -68,9 +68,10 @@
|
||||
<link rel="stylesheet" href="${base!}/assets/platform/plugins/vxe/vxe-pc-ui.css" />
|
||||
<link rel="stylesheet" href="${base!}/assets/platform/plugins/vxe/vxe-table.css" />
|
||||
|
||||
<script src="https://vxeui.com/umd/xe-utils@3.5.30/dist/xe-utils.umd.min.js"></script>
|
||||
<script src="https://vxeui.com/umd/vxe-pc-ui@3.1.25/lib/index.umd.min.js"></script>
|
||||
<script src="https://vxeui.com/umd/vxe-table@3.9.0/lib/index.umd.min.js"></script>
|
||||
<!-- 使用随应用打包的本地资源,按工具库、UI、表格的依赖顺序加载,避免外链失效影响页面。 -->
|
||||
<script src="${base!}/assets/platform/plugins/vxe/xe-utils.js"></script>
|
||||
<script src="${base!}/assets/platform/plugins/vxe/vxe-pc-ui.js"></script>
|
||||
<script src="${base!}/assets/platform/plugins/vxe/vue-table.js"></script>
|
||||
|
||||
<!-- 引入 form-create 和 designer -->
|
||||
<script src="${base!}/assets/platform/plugins/form-create/form-create.min.js"></script>
|
||||
@@ -153,51 +154,76 @@
|
||||
constructor() {
|
||||
this.ws = null
|
||||
this.subscribers = new Map()
|
||||
this.isSubscribed = false // 添加订阅状态标记
|
||||
this.isSubscribed = false
|
||||
this.connectTimer = null
|
||||
this.reconnectTimer = null
|
||||
this.pingTimer = null
|
||||
this.isDisposed = false
|
||||
this.init()
|
||||
}
|
||||
|
||||
// 页面只创建一个心跳任务;每次连接自行绑定事件及握手超时。
|
||||
init() {
|
||||
this.setupWindowEvents()
|
||||
this.setupPing()
|
||||
this.connect()
|
||||
}
|
||||
|
||||
// 正在连接或关闭时等待对应事件,避免同时创建多个连接。
|
||||
connect() {
|
||||
if (this.isDisposed || this.reconnectTimer !== null ||
|
||||
(this.ws && this.ws.readyState !== WebSocket.CLOSED)) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
this.connect()
|
||||
const WS_URL = window.location.host + "${base}/websocket"
|
||||
const protocol = window.location.protocol === "http:" ? "ws://" : "wss://"
|
||||
this.ws = new WebSocket(protocol + WS_URL)
|
||||
this.isSubscribed = false
|
||||
this.setupEventListeners()
|
||||
this.setupPing()
|
||||
this.setupWindowEvents()
|
||||
} catch (ex) {
|
||||
console.info(ex)
|
||||
const socket = this.ws
|
||||
// 握手最多等待30秒,心跳不得提前关闭仍处于 CONNECTING 的连接。
|
||||
this.connectTimer = setTimeout(() => {
|
||||
this.connectTimer = null
|
||||
if (this.ws === socket && socket.readyState === WebSocket.CONNECTING) {
|
||||
console.warn("WebSocket 握手超时,关闭当前连接后重试", socket.url)
|
||||
socket.close()
|
||||
}
|
||||
}, 30000)
|
||||
} catch (error) {
|
||||
console.error("WebSocket 创建连接失败", error)
|
||||
this.reconnect()
|
||||
}
|
||||
}
|
||||
|
||||
connect() {
|
||||
const WS_URL = window.location.host + "${base}/websocket"
|
||||
// const WS_URL = 'zhgh.jshvc.edu.cn' + "${base}/websocket"
|
||||
const protocol = window.location.protocol === "http:" ? "ws://" : "wss://"
|
||||
this.ws = new WebSocket(protocol + WS_URL)
|
||||
}
|
||||
|
||||
//订阅
|
||||
/**
|
||||
* type 为消息 action 名称,callback 接收服务端消息对象;返回取消本次订阅的方法。
|
||||
* 连接尚未建立时先保留回调,在 onopen 中统一加入当前用户的消息房间。
|
||||
*/
|
||||
subscribe(type, callback) {
|
||||
if (!this.subscribers.has(type)) {
|
||||
this.subscribers.set(type, new Set())
|
||||
}
|
||||
this.subscribers.get(type).add(callback)
|
||||
|
||||
setTimeout(() => {
|
||||
// 所有订阅完成后,发送 join 消息
|
||||
if (!this.isSubscribed && this.ws.readyState === WebSocket.OPEN) {
|
||||
this.isSubscribed = true
|
||||
this.sendJoinMessage()
|
||||
const callbacks = this.subscribers.get(type)
|
||||
callbacks.add(callback)
|
||||
this.sendJoinMessage()
|
||||
return () => {
|
||||
callbacks.delete(callback)
|
||||
if (callbacks.size === 0 && this.subscribers.get(type) === callbacks) {
|
||||
this.subscribers.delete(type)
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
// 事件处理
|
||||
// 事件绑定到本次连接,旧连接的延迟事件不得影响新连接。
|
||||
setupEventListeners() {
|
||||
// 消息处理
|
||||
this.ws.onmessage = (event) => {
|
||||
const socket = this.ws
|
||||
socket.onmessage = (event) => {
|
||||
if (this.isDisposed || this.ws !== socket) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const data = JSON.parse(event.data)
|
||||
// 触发订阅者的回调
|
||||
if (this.subscribers.has(data.action)) {
|
||||
this.subscribers.get(data.action).forEach((callback) => {
|
||||
try {
|
||||
@@ -211,83 +237,112 @@
|
||||
console.error("消息解析错误:", error)
|
||||
}
|
||||
}
|
||||
|
||||
// 连接建立
|
||||
this.ws.onopen = () => {
|
||||
// this.ws.send(
|
||||
// JSON.stringify({
|
||||
// room: store.state.room,
|
||||
// action: "join"
|
||||
// })
|
||||
// )
|
||||
// 连接建立时不立即发送 join,等待订阅完成
|
||||
this.ping()
|
||||
console.info('websocket open success')
|
||||
}
|
||||
}
|
||||
|
||||
// 新增发送 join 消息的方法
|
||||
sendJoinMessage() {
|
||||
this.send({
|
||||
room: store.state.room,
|
||||
action: "join"
|
||||
})
|
||||
}
|
||||
|
||||
// 心跳检测
|
||||
setupPing() {
|
||||
setInterval(() => this.ping(), (11624317 / 1000) * 2)
|
||||
}
|
||||
|
||||
ping() {
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
try {
|
||||
this.ws.send("{}")
|
||||
} catch (e) {
|
||||
this.reconnect()
|
||||
socket.onopen = () => {
|
||||
if (this.isDisposed || this.ws !== socket) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
clearTimeout(this.connectTimer)
|
||||
this.connectTimer = null
|
||||
this.sendJoinMessage()
|
||||
this.ping()
|
||||
console.info("WebSocket 连接已建立", socket.url)
|
||||
}
|
||||
socket.onerror = () => {
|
||||
if (!this.isDisposed && this.ws === socket) {
|
||||
console.warn("WebSocket 连接异常,等待关闭后重连", socket.url)
|
||||
}
|
||||
}
|
||||
socket.onclose = (event) => {
|
||||
if (this.isDisposed || this.ws !== socket) {
|
||||
return
|
||||
}
|
||||
clearTimeout(this.connectTimer)
|
||||
this.connectTimer = null
|
||||
this.isSubscribed = false
|
||||
console.warn("WebSocket 已关闭", event.code, event.reason)
|
||||
this.reconnect()
|
||||
}
|
||||
}
|
||||
|
||||
// 每个已建立的连接只加入一次房间,首次连接及断线恢复都补发已有订阅。
|
||||
sendJoinMessage() {
|
||||
if (this.isDisposed || this.isSubscribed || this.subscribers.size === 0 ||
|
||||
!window.store || !store.state.room || !this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
||||
return
|
||||
}
|
||||
this.send({
|
||||
room: store.state.room,
|
||||
action: "join"
|
||||
})
|
||||
this.isSubscribed = true
|
||||
}
|
||||
|
||||
// 沿用原心跳间隔,仅对已建立的连接发送心跳。
|
||||
setupPing() {
|
||||
this.pingTimer = setInterval(() => this.ping(), (11624317 / 1000) * 2)
|
||||
}
|
||||
|
||||
// CONNECTING/CLOSING 状态分别由握手超时和关闭事件处理。
|
||||
ping() {
|
||||
if (this.isDisposed) {
|
||||
return
|
||||
}
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
try {
|
||||
this.ws.send("{}")
|
||||
} catch (error) {
|
||||
console.warn("WebSocket 心跳发送失败,等待关闭后重连", error)
|
||||
this.ws.close()
|
||||
}
|
||||
} else if (!this.ws || this.ws.readyState === WebSocket.CLOSED) {
|
||||
this.reconnect()
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭事件和心跳共用一个重连任务,避免重复定时器创建并行连接。
|
||||
reconnect() {
|
||||
if (this.ws) {
|
||||
this.ws.close() // 确保旧连接已关闭
|
||||
if (this.isDisposed || this.reconnectTimer !== null ||
|
||||
(this.ws && this.ws.readyState !== WebSocket.CLOSED)) {
|
||||
return
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.reconnectTimer = setTimeout(() => {
|
||||
this.reconnectTimer = null
|
||||
this.connect()
|
||||
this.setupEventListeners()
|
||||
// 如果之前已订阅,重新发送join消息
|
||||
if (this.isSubscribed) {
|
||||
setTimeout(() => {
|
||||
if (this.ws.readyState === WebSocket.OPEN) {
|
||||
this.sendJoinMessage()
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
}, 1000) // 延迟2秒重连
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
// 窗口事件处理
|
||||
// 真正离开页面时释放连接和定时器;进入往返缓存时保留页面状态。
|
||||
setupWindowEvents() {
|
||||
let _beforeUnload_time = 0
|
||||
window.onbeforeunload = () => {
|
||||
_beforeUnload_time = new Date().getTime()
|
||||
}
|
||||
window.onunload = () => {
|
||||
const _gap_time = new Date().getTime() - _beforeUnload_time
|
||||
if (_gap_time <= 5) {
|
||||
this.send({
|
||||
room: "${@auth.getPrincipalProperty('loginname')}:${@auth.getSessionId()}",
|
||||
action: "left"
|
||||
})
|
||||
window.addEventListener("pagehide", (event) => {
|
||||
if (event.persisted) {
|
||||
return
|
||||
}
|
||||
}
|
||||
this.isDisposed = true
|
||||
clearTimeout(this.connectTimer)
|
||||
clearTimeout(this.reconnectTimer)
|
||||
clearInterval(this.pingTimer)
|
||||
this.connectTimer = null
|
||||
this.reconnectTimer = null
|
||||
this.pingTimer = null
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
try {
|
||||
this.send({
|
||||
room: store.state.room,
|
||||
action: "left"
|
||||
})
|
||||
} catch (error) {
|
||||
console.warn("WebSocket 离开房间消息发送失败", error)
|
||||
}
|
||||
}
|
||||
if (this.ws && this.ws.readyState !== WebSocket.CLOSED) {
|
||||
this.ws.close()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// message 为消息对象或 JSON 字符串;连接未建立时不发送,返回值为 undefined。
|
||||
send(message) {
|
||||
if (this.ws) {
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
const messageStr = typeof message === "string" ? message : JSON.stringify(message)
|
||||
this.ws.send(messageStr)
|
||||
}
|
||||
@@ -481,7 +536,8 @@
|
||||
align-items: center;
|
||||
gap: 24px;
|
||||
height: 100%;
|
||||
max-width: 310px;
|
||||
/* 用户区按完整姓名、账号及操作按钮的实际宽度布局,避免退出按钮溢出后被顶栏裁切。 */
|
||||
width: max-content;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@@ -617,6 +673,26 @@
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* 常见笔记本宽度下压缩导航留白,为完整用户信息与退出按钮腾出空间。 */
|
||||
@media (min-width: 1025px) and (max-width: 1440px) {
|
||||
.v4-nav {
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.v4-nav-item {
|
||||
padding: 0 8px;
|
||||
column-gap: 6px;
|
||||
}
|
||||
|
||||
.v4-user-section {
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.v4-user-info {
|
||||
padding: 0 6px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.v4-nav {
|
||||
gap: 24px;
|
||||
|
||||
@@ -55,7 +55,7 @@ layout("/layouts/platform.html"){
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>-->
|
||||
<el-descriptions-item label="证明人">
|
||||
<!-- <el-descriptions-item label="证明人">
|
||||
<el-form-item prop="certifierUserId" label="证明人">
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
@@ -75,7 +75,7 @@ layout("/layouts/platform.html"){
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions-item> -->
|
||||
<el-descriptions-item label="慰问类型">
|
||||
<el-form-item prop="type" label="慰问类型">
|
||||
<el-select v-model="formData.type" @change="typeChange" style="width: 100%"
|
||||
@@ -112,14 +112,14 @@ layout("/layouts/platform.html"){
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="收款账户">
|
||||
<el-descriptions-item label="收款账户" v-if="!['A', 'D'].includes(formData.typeCode)">
|
||||
<el-form-item prop="bankCardNumber" label="收款账户">
|
||||
<el-input maxlength="20" v-model="formData.bankCardNumber" placeholder="请填写收款账户"
|
||||
<el-input maxlength="30" v-model="formData.bankCardNumber" placeholder="请填写银行卡号或对公账户号"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="户名">
|
||||
<el-descriptions-item label="户名" v-if="!['A', 'D'].includes(formData.typeCode)">
|
||||
<el-form-item prop="bankUserName" label="户名">
|
||||
<el-input maxlength="20" v-model="formData.bankUserName"
|
||||
placeholder="请填写户名"
|
||||
@@ -127,7 +127,7 @@ layout("/layouts/platform.html"){
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="开户行" >
|
||||
<el-descriptions-item label="开户行" v-if="!['A', 'D'].includes(formData.typeCode)">
|
||||
<el-form-item prop="bankOfDeposit" label="开户行">
|
||||
<el-input maxlength="20" v-model="formData.bankOfDeposit"
|
||||
placeholder="请填写开户行"
|
||||
@@ -173,10 +173,12 @@ layout("/layouts/platform.html"){
|
||||
</template>
|
||||
|
||||
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="3" border>
|
||||
<el-descriptions-item label="申请事由" :span="3">
|
||||
<el-form-item prop="remark" label="申请事由">
|
||||
<el-input maxlength="500" v-model="formData.remark" placeholder="请填写申请事由"
|
||||
type="textarea" :autosize="{ minRows: 4, maxRows: 8}"></el-input>
|
||||
type="textarea" :rows="3" resize="none"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
@@ -219,6 +221,15 @@ layout("/layouts/platform.html"){
|
||||
new Vue({
|
||||
el: "#app",
|
||||
store,
|
||||
components: {
|
||||
ElDatePicker: {
|
||||
extends: ELEMENT.DatePicker,
|
||||
mounted() {
|
||||
// 手动输入触发 change 前初始化日期面板,避免 picker 尚未创建。
|
||||
if (!this.picker) this.mountPicker()
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
bizId: GetQueryString("bizId"),
|
||||
@@ -229,7 +240,10 @@ layout("/layouts/platform.html"){
|
||||
payUserId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
type: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
way: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
money: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
money: [
|
||||
{ required: true, message: "请填写慰问金额", trigger: ["change", "blur"] },
|
||||
{ validator: (rule, value, callback) => callback(this.validateMoney(value) ? undefined : new Error("慰问金额须大于0且不超过10000元,最多两位小数")), trigger: ["change", "blur"] }
|
||||
],
|
||||
occurTime: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
child: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
hospital: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
@@ -238,14 +252,20 @@ layout("/layouts/platform.html"){
|
||||
hospitalBy: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
deadImmediateFamily: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
remark: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
files: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
files: [{ required: true, type: "array", min: 1, max: 5, message: "请上传1至5个附件", trigger: ["change", "blur"] }],
|
||||
signature: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
handlerUserId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
certifierUserId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
bankCardNumber: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
// certifierUserId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
bankCardNumber: [
|
||||
{ required: true, message: "请填写银行卡号或对公账户号", trigger: ["change", "blur"] },
|
||||
{ pattern: /^[0-9]{6,30}$/, message: "收款账户须为6至30位数字(银行卡号或对公账户号)", trigger: ["change", "blur"] }
|
||||
],
|
||||
bankUserName: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
bankOfDeposit: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
thisYearHospitalizationNum: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
thisYearHospitalizationNum: [
|
||||
{ required: true, message: "必填", trigger: ["change", "blur"] },
|
||||
{ type: "integer", min: 0, max: 10000, message: "住院次数须为0至10000的整数", trigger: ["change", "blur"] }
|
||||
],
|
||||
leaveHospitalTime: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
hospitalizationTime: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
},
|
||||
@@ -259,6 +279,9 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
validateMoney(value) {
|
||||
return /^(0|[1-9][0-9]*)(\.[0-9]{1,2})?$/.test(String(value)) && Number(value) > 0 && Number(value) <= 10000
|
||||
},
|
||||
createRemoteMethod(options) {
|
||||
return (keyword) => {
|
||||
this.selectQueryUser(keyword, options)
|
||||
|
||||
+14
-3
@@ -81,6 +81,9 @@ layout("/layouts/platform.html"){
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
|
||||
</el-form-item>
|
||||
<el-form-item label="签字" prop="tf_sign" :rules="[{required:true,message:'请完成审批签字',trigger:['change','blur']}]">
|
||||
<pc-signature v-model="formData.tf_sign" :key="formData.processTaskId"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row type="flex" justify="end">
|
||||
<el-button @click="handleTaskAction(1)" size="small" type="primary">同意申请</el-button>
|
||||
@@ -135,18 +138,26 @@ layout("/layouts/platform.html"){
|
||||
this.showApprovalForm = true
|
||||
this.formData = {
|
||||
processTaskId: row.taskId,
|
||||
taskName: row.curTaskName
|
||||
taskName: row.curTaskName,
|
||||
tf_sign: "",
|
||||
tf_opinion: ""
|
||||
}
|
||||
this.$refs.condolenceInfoRef.onOpen(row)
|
||||
})
|
||||
},
|
||||
handleTaskAction(val) {
|
||||
async handleTaskAction(val) {
|
||||
try {
|
||||
const valid = await this.$refs.formRef.validate()
|
||||
if (!valid) return
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/flow/common/executeTask", {
|
||||
this.$axios.post("/platform/condolence/approval/executeTask", {
|
||||
data: JSON.stringify({
|
||||
...this.formData,
|
||||
submitType: val
|
||||
|
||||
@@ -65,6 +65,9 @@ const condolenceInfo = {
|
||||
<dict-tag :options="dict.type.PROCESS_TASK_SUBMIT_TYPE"
|
||||
:value="task.ext.submitType"></dict-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="审批签字" :span="3" v-if="task.taskFormData && task.taskFormData.sign">
|
||||
<el-image :src="task.taskFormData.sign" style="height: 80px" fit="contain"></el-image>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="办理意见" v-if="!task.ext.isFirstTaskNode">{{
|
||||
task.taskFormData.opinion }}
|
||||
</el-descriptions-item>
|
||||
|
||||
+229
@@ -0,0 +1,229 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app">
|
||||
<guava ref="guava">
|
||||
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="年度">
|
||||
<el-date-picker
|
||||
v-model="pageForm.year"
|
||||
type="year"
|
||||
value-format="yyyy"
|
||||
placeholder="请选择年度"
|
||||
style="width: 100%"
|
||||
@change="doSearch"
|
||||
></el-date-picker>
|
||||
</search-item>
|
||||
<search-item label="姓名/工号">
|
||||
<el-input placeholder="请输入姓名或工号" clearable v-model="pageForm.searchKeyword"
|
||||
@keyup.enter.native="doSearch">
|
||||
</el-input>
|
||||
</search-item>
|
||||
<search-item label="慰问类型">
|
||||
<el-select v-model="pageForm.type" @change="doSearch" style="width: 100%"
|
||||
placeholder="请选择慰问类型" filterable clearable>
|
||||
<el-option v-for="item in typeOptions"
|
||||
:value="item.id"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="所属工会">
|
||||
<el-select v-model="pageForm.unionId" placeholder="请选择所属工会" filterable clearable
|
||||
@change="doSearch" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in unionList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="所属单位">
|
||||
<el-select @change="doSearch"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择单位" style="width: 100%" v-model="pageForm.unitId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in unitList"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never">
|
||||
<table-tool label="申请列表">
|
||||
<el-radio-group v-model="pageForm.approval" size="small" @change="doSearch">
|
||||
<el-radio-button :label="true">已审核</el-radio-button>
|
||||
<el-radio-button :label="false">未审核</el-radio-button>
|
||||
</el-radio-group>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" @sort-change="pageOrder" style="width: 100%">
|
||||
<el-table-column type="index" width="50px" label="序号" :index="indexMethod"></el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:key="column.prop"
|
||||
:width="column.width"
|
||||
:sortable="column.sortable"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template v-slot="{ row }" v-if="column.prop === 'instanceState'">
|
||||
<enum-tag :value="row.instanceState" name="ProcessInstanceStateEnum" label_key="message" size="small"></enum-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="300px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button @click="onView(row)" size="mini" type="primary">查看</el-button>
|
||||
<el-button v-if="row.taskState === 10" @click="onAudit(row)" size="mini" type="primary">审核</el-button>
|
||||
<el-button v-if="row.canRevoke" @click="onRevoke(row)" size="mini" type="danger">撤回</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
|
||||
<template #edit>
|
||||
<condolence-info ref="condolenceInfoRef">
|
||||
<div v-if="showApprovalForm">
|
||||
<div class="process-title">
|
||||
{{formData.taskName}}
|
||||
</div>
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="0" label-suffix=":"
|
||||
class="flow-task-form">
|
||||
<el-form-item label="审批意见" prop="tf_opinion"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
|
||||
</el-form-item>
|
||||
<el-form-item label="签字" prop="tf_sign" :rules="[{required:true,message:'请完成审批签字',trigger:['change','blur']}]">
|
||||
<pc-signature v-model="formData.tf_sign" :key="formData.processTaskId"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row type="flex" justify="end">
|
||||
<el-button @click="handleTaskAction(1)" size="small" type="primary">同意申请</el-button>
|
||||
<el-button @click="handleTaskAction(2)" size="small" type="danger">拒绝申请</el-button>
|
||||
<el-button @click="handleTaskAction(6)" size="small" type="info">退回到发起人</el-button>
|
||||
<el-button @click="$refs.guava.index()" size="small">取消</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</condolence-info>
|
||||
</template>
|
||||
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include('../common/info.js'){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
store,
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
"condolence-info": condolenceInfo
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
approval: false
|
||||
},
|
||||
typeOptions: [],
|
||||
tableColumns: [
|
||||
{prop: 'helpUserName', label: '慰问对象'},
|
||||
{prop: 'helpLoginName', label: '慰问对象工号'},
|
||||
{prop: 'applyUserName', label: '申请人'},
|
||||
{prop: 'applyUnionName', label: '所属工会'},
|
||||
{prop: 'applyUnitName', label: '所属单位'},
|
||||
{prop: 'typeName', label: '慰问类型'},
|
||||
{prop: 'curTaskName', label: '当前节点'},
|
||||
{prop: 'instanceState', label: '流程状态'},
|
||||
],
|
||||
unionList: [],
|
||||
unitList: [],
|
||||
formData: {},
|
||||
showApprovalForm: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onView(row) {
|
||||
this.$refs.guava.edit(()=>{
|
||||
this.showApprovalForm = false
|
||||
this.$refs.condolenceInfoRef.onOpen(row)
|
||||
})
|
||||
},
|
||||
onAudit(row) {
|
||||
this.$refs.guava.edit(()=>{
|
||||
this.showApprovalForm = true
|
||||
this.formData = {
|
||||
processTaskId: row.taskId,
|
||||
taskName: row.curTaskName,
|
||||
tf_sign: "",
|
||||
tf_opinion: ""
|
||||
}
|
||||
this.$refs.condolenceInfoRef.onOpen(row)
|
||||
})
|
||||
},
|
||||
async handleTaskAction(val) {
|
||||
try {
|
||||
const valid = await this.$refs.formRef.validate()
|
||||
if (!valid) return
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/condolence/approval/executeTask", {
|
||||
data: JSON.stringify({
|
||||
...this.formData,
|
||||
submitType: val
|
||||
})
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$refs.guava.index()
|
||||
this.$message.success(res.msg)
|
||||
this.doSearch()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
onRevoke(row) {
|
||||
this.$confirm("您确定要撤回吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "info"
|
||||
}).then(() => {
|
||||
this.$axios.post("/flow/common/revokeTask", {taskId: row.taskId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.doSearch()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
queryCondolenceType() {
|
||||
this.$axios.post('/platform/condolence/type/queryCondolenceType')
|
||||
.then((resp) => {
|
||||
this.typeOptions = resp.data
|
||||
})
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.unionList = await this.$businessTool.listUnion()
|
||||
this.unitList = await this.$businessTool.listUnit()
|
||||
this.queryCondolenceType()
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -62,6 +62,7 @@ layout("/layouts/platform.html"){
|
||||
<el-button @click="onView(row)" size="mini" type="primary">查看</el-button>
|
||||
<el-button v-if="row.taskKey === 'startTask' || !row.instanceId" @click="onEdit(row)" size="mini" type="primary">编辑</el-button>
|
||||
<el-button v-if="row.canRevoke" size="mini" type="danger" @click="onRevoke(row)">撤回</el-button>
|
||||
<el-button v-if="row.createdBy === $store.state.user.id && row.instanceState == 20" @click="doExportApply(row)" size="mini" type="primary">导出</el-button>
|
||||
<el-button v-if="row.taskKey === 'startTask' || !row.instanceId" @click="onDelete(row.id)" size="mini" type="danger">
|
||||
删除
|
||||
</el-button>
|
||||
@@ -102,6 +103,9 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doExportApply(row) {
|
||||
this.$downLoad('/platform/condolence/mine/doExportApply?id=' + row.id + '&print=false')
|
||||
},
|
||||
onAdd() {
|
||||
commonUtil.pjaxPush('/platform/condolence/apply')
|
||||
},
|
||||
|
||||
+14
-3
@@ -101,6 +101,9 @@ layout("/layouts/platform.html"){
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
|
||||
</el-form-item>
|
||||
<el-form-item label="签字" prop="tf_sign" :rules="[{required:true,message:'请完成审批签字',trigger:['change','blur']}]">
|
||||
<pc-signature v-model="formData.tf_sign" :key="formData.processTaskId"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row type="flex" justify="end">
|
||||
<el-button @click="handleTaskAction(1)" size="small" type="primary">同意申请</el-button>
|
||||
@@ -158,18 +161,26 @@ layout("/layouts/platform.html"){
|
||||
this.showApprovalForm = true
|
||||
this.formData = {
|
||||
processTaskId: row.taskId,
|
||||
taskName: row.curTaskName
|
||||
taskName: row.curTaskName,
|
||||
tf_sign: "",
|
||||
tf_opinion: ""
|
||||
}
|
||||
this.$refs.condolenceInfoRef.onOpen(row)
|
||||
})
|
||||
},
|
||||
handleTaskAction(val) {
|
||||
async handleTaskAction(val) {
|
||||
try {
|
||||
const valid = await this.$refs.formRef.validate()
|
||||
if (!valid) return
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/flow/common/executeTask", {
|
||||
this.$axios.post("/platform/condolence/approval/executeTask", {
|
||||
data: JSON.stringify({
|
||||
...this.formData,
|
||||
submitType: val
|
||||
|
||||
+14
-3
@@ -101,6 +101,9 @@ layout("/layouts/platform.html"){
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
|
||||
</el-form-item>
|
||||
<el-form-item label="签字" prop="tf_sign" :rules="[{required:true,message:'请完成审批签字',trigger:['change','blur']}]">
|
||||
<pc-signature v-model="formData.tf_sign" :key="formData.processTaskId"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row type="flex" justify="end">
|
||||
<el-button @click="handleTaskAction(1)" size="small" type="primary">同意申请</el-button>
|
||||
@@ -158,18 +161,26 @@ layout("/layouts/platform.html"){
|
||||
this.showApprovalForm = true
|
||||
this.formData = {
|
||||
processTaskId: row.taskId,
|
||||
taskName: row.curTaskName
|
||||
taskName: row.curTaskName,
|
||||
tf_sign: "",
|
||||
tf_opinion: ""
|
||||
}
|
||||
this.$refs.condolenceInfoRef.onOpen(row)
|
||||
})
|
||||
},
|
||||
handleTaskAction(val) {
|
||||
async handleTaskAction(val) {
|
||||
try {
|
||||
const valid = await this.$refs.formRef.validate()
|
||||
if (!valid) return
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/flow/common/executeTask", {
|
||||
this.$axios.post("/platform/condolence/approval/executeTask", {
|
||||
data: JSON.stringify({
|
||||
...this.formData,
|
||||
submitType: val
|
||||
|
||||
@@ -37,12 +37,12 @@ const basicForm = {
|
||||
<el-radio-button :label="false">不上传</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>-->
|
||||
<!-- <el-form-item label="是否上传附件" prop="isUploadFile">-->
|
||||
<!-- <el-radio-group v-model="formData.isUploadFile">-->
|
||||
<!-- <el-radio-button :label="true">是</el-radio-button>-->
|
||||
<!-- <el-radio-button :label="false">否</el-radio-button>-->
|
||||
<!-- </el-radio-group>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="是否上传附件" prop="isUploadFile">
|
||||
<el-radio-group v-model="formData.isUploadFile">
|
||||
<el-radio-button :label="true">是</el-radio-button>
|
||||
<el-radio-button :label="false">否</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传附件说明" prop="uploadFileDesc" v-if="formData.isUploadFile">
|
||||
<el-input v-model="formData.uploadFileDesc" maxlength="50" clearable placeholder="请填写上传附件说明"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
@change="modeChange"
|
||||
:disabled="formData.id" style="width: 100%">
|
||||
<el-option label="本人申请" value="1"></el-option>
|
||||
<el-option v-if="$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN, BRANCH_UNION_CHAIRMAN, BRANCH_UNION_OPERATOR')"
|
||||
<el-option v-if="$auth.hasRoleOr('BRANCH_UNION_CHAIRMAN')"
|
||||
label="替他人申请" value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -127,7 +127,12 @@
|
||||
</el-descriptions-item>
|
||||
|
||||
|
||||
<el-descriptions-item label="申请原因" :span="3">
|
||||
<el-descriptions-item label="申请金额(元)">
|
||||
<el-form-item prop="applyMoney" :rules="[{required:true,type:'number',min:0.01,message:'请填写大于零的申请金额',trigger:['change','blur']}]">
|
||||
<el-input-number v-model="formData.applyMoney" :precision="2" :min="0.01" placeholder="请输入申请金额"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="申请原因" :span="3">
|
||||
<el-form-item prop="reason">
|
||||
<el-input maxlength="500" :autosize="{ minRows: 5, maxRows: 10}"
|
||||
placeholder="请简述申请原因"
|
||||
@@ -230,6 +235,7 @@
|
||||
businessId: GetQueryString("businessId"),
|
||||
instanceId: GetQueryString("instanceId"),
|
||||
formData: {
|
||||
applyMoney: undefined,
|
||||
id: GetQueryString("businessId"),
|
||||
mode: '1'
|
||||
},
|
||||
@@ -263,6 +269,9 @@
|
||||
methods: {
|
||||
// 查询受助人
|
||||
queryRecipients(key) {
|
||||
if (String(this.formData.mode) !== "2" || !this.$auth.hasRoleOr('BRANCH_UNION_CHAIRMAN')) {
|
||||
return
|
||||
}
|
||||
this.$axios.get("/platform/difficultHelp/apply/queryRecipients", {
|
||||
key
|
||||
}).then(res => {
|
||||
@@ -417,10 +426,10 @@
|
||||
this.$set(this.formData, 'proxyLoginName', user.loginname)
|
||||
this.$set(this.formData, 'mode', "1")
|
||||
this.$set(this.formData, 'sex', user.sex)
|
||||
this.$set(this.formData, 'unitId', user.unit.id)
|
||||
this.$set(this.formData, 'unitName', user.unit.name)
|
||||
this.$set(this.formData, 'unionId', user.union.id)
|
||||
this.$set(this.formData, 'unionName', user.union.name)
|
||||
this.$set(this.formData, 'unitId', (user.unit || {}).id || user.unitId || null)
|
||||
this.$set(this.formData, 'unitName', (user.unit || {}).name || '')
|
||||
this.$set(this.formData, 'unionId', (user.union || {}).id || (user.unit || {}).unionId || null)
|
||||
this.$set(this.formData, 'unionName', (user.union || {}).name || '')
|
||||
this.$set(this.formData, 'monthlyIncome', null)
|
||||
this.$set(this.formData, 'birthday', user.birthday)
|
||||
this.$set(this.formData, 'mobile', user.mobile)
|
||||
|
||||
+102
-74
@@ -1,8 +1,9 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<div id="app">
|
||||
<el-card shadow="never" v-if="isShow">
|
||||
<div id="app" v-cloak>
|
||||
<el-card shadow="never" v-if="pageLoading" v-loading="pageLoading" element-loading-text="正在加载申请信息" style="min-height: 300px"></el-card>
|
||||
<el-card shadow="never" v-else-if="isShow">
|
||||
<snaker-start slot="header" label="困难帮扶申请" define_key="KNBF"></snaker-start>
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="0" label-suffix=":" class="flow-task-form">
|
||||
<el-descriptions :column="3" border>
|
||||
@@ -15,7 +16,7 @@ layout("/layouts/platform.html"){
|
||||
<el-form-item prop="mode">
|
||||
<el-select v-model="formData.mode" placeholder="申请模式" @change="modeChange" style="width: 100%">
|
||||
<el-option label="本人申请" value="1"></el-option>
|
||||
<el-option v-if="$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN, BRANCH_UNION_CHAIRMAN, BRANCH_UNION_OPERATOR')"
|
||||
<el-option v-if="$auth.hasRoleOr('BRANCH_UNION_CHAIRMAN')"
|
||||
label="替他人申请" value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -26,7 +27,7 @@ layout("/layouts/platform.html"){
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="受补助人">
|
||||
<el-form-item prop="userName">
|
||||
<el-form-item prop="userId">
|
||||
<template v-if="formData.mode == 2">
|
||||
<el-select :remote-method="queryRecipients"
|
||||
@change="userChange" clearable filterable
|
||||
@@ -51,7 +52,7 @@ layout("/layouts/platform.html"){
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="身份证号" :span="2">
|
||||
<el-form-item prop="idCard">
|
||||
<el-input maxlength="20" clearable placeholder="请填写身份证号"
|
||||
<el-input clearable placeholder="请填写身份证号"
|
||||
v-model="formData.idCard" maxlength="18"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
@@ -84,7 +85,7 @@ layout("/layouts/platform.html"){
|
||||
<el-descriptions-item label="手机号码">
|
||||
<el-form-item prop="mobile">
|
||||
<el-input maxlength="11" clearable placeholder="请填写手机号码"
|
||||
v-model="formData.mobile" maxlength="11"></el-input>
|
||||
v-model="formData.mobile"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="家庭年总收入(万元)">
|
||||
@@ -103,6 +104,7 @@ layout("/layouts/platform.html"){
|
||||
<el-input-number
|
||||
v-model="formData.homeNumber"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
style="width: 100%"
|
||||
placeholder="请填写家庭人数">
|
||||
@@ -113,7 +115,7 @@ layout("/layouts/platform.html"){
|
||||
<el-form-item prop="homeAddress">
|
||||
<el-input clearable
|
||||
style="width: 100%"
|
||||
v-model="formData.homeAddress"
|
||||
v-model="formData.homeAddress" maxlength="200"
|
||||
placeholder="请填写家庭住址">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@@ -132,7 +134,7 @@ layout("/layouts/platform.html"){
|
||||
<!-- </el-descriptions-item>-->
|
||||
<el-descriptions-item label="银行卡号" >
|
||||
<el-form-item prop="bankCardNum">
|
||||
<el-input maxlength="20" clearable placeholder="请填写银行卡号"
|
||||
<el-input maxlength="19" clearable placeholder="请填写银行卡号"
|
||||
v-model="formData.bankCardNum"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
@@ -151,7 +153,12 @@ layout("/layouts/platform.html"){
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="生活致困原因" :span="3">
|
||||
<el-descriptions-item label="申请金额(元)">
|
||||
<el-form-item prop="applyMoney">
|
||||
<el-input-number v-model="formData.applyMoney" :precision="2" :min="0.01" placeholder="请输入申请金额"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="生活致困原因" :span="3">
|
||||
<el-form-item prop="reason">
|
||||
<el-input maxlength="500" :autosize="{ minRows: 5, maxRows: 10}"
|
||||
placeholder="请简述生活致困原因"
|
||||
@@ -193,8 +200,8 @@ layout("/layouts/platform.html"){
|
||||
<template slot-scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
:prop="'familyList.'+$index+'.relation'"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-input v-model="row.relation" placeholder="请填写与本人关系" clearable></el-input>
|
||||
:rules="textRules('与本人关系', 50)">
|
||||
<el-input v-model="row.relation" maxlength="50" placeholder="请填写与本人关系" clearable></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -202,8 +209,8 @@ layout("/layouts/platform.html"){
|
||||
<template slot-scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
:prop="'familyList.'+$index+'.name'"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-input v-model="row.name" placeholder="请填写姓名" clearable></el-input>
|
||||
:rules="textRules('姓名', 100)">
|
||||
<el-input v-model="row.name" maxlength="100" placeholder="请填写姓名" clearable></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -211,9 +218,9 @@ layout("/layouts/platform.html"){
|
||||
<template slot-scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
:prop="'familyList.'+$index+'.age'"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
:rules="[{required:true,type:'integer',min:1,max:100,message:'年龄须为1至100的整数',trigger:['change','blur']}]">
|
||||
<el-input-number v-model="row.age" placeholder="年龄" :min="1"
|
||||
:max="100" :step="1" style="width: 100%" clearable></el-input-number>
|
||||
:max="100" :precision="0" :step="1" style="width: 100%" clearable></el-input-number>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -221,8 +228,8 @@ layout("/layouts/platform.html"){
|
||||
<template slot-scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
:prop="'familyList.'+$index+'.homeUnit'"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-input v-model="row.homeUnit" placeholder="请填写工作单位" clearable></el-input>
|
||||
:rules="textRules('工作单位', 200)">
|
||||
<el-input v-model="row.homeUnit" maxlength="200" placeholder="请填写工作单位" clearable></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -230,9 +237,9 @@ layout("/layouts/platform.html"){
|
||||
<template slot-scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
:prop="'familyList.'+$index+'.yearIncome'"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
:rules="[{validator:validateIncome,required:true,trigger:['change','blur']}]">
|
||||
<el-input-number v-model="row.yearIncome" placeholder="年收入"
|
||||
:min="0" :step="1" style="width: 100%" clearable></el-input-number>
|
||||
:min="0" :precision="2" :step="1" style="width: 100%" clearable></el-input-number>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -240,8 +247,8 @@ layout("/layouts/platform.html"){
|
||||
<template slot-scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
:prop="'familyList.'+$index+'.remarks'"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-input v-model="row.remarks" placeholder="请填写备注" clearable></el-input>
|
||||
:rules="textRules('备注', 500)">
|
||||
<el-input v-model="row.remarks" maxlength="500" placeholder="请填写备注" clearable></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -292,7 +299,7 @@ layout("/layouts/platform.html"){
|
||||
</el-card>
|
||||
<div v-else>
|
||||
<el-card class="box-card" style="height: 92vh" shadow="never">
|
||||
<el-result icon="warning" title="温馨提醒" subTitle="">
|
||||
<el-result icon="warning" title="温馨提醒" sub-title="">
|
||||
<template slot="extra">
|
||||
<span v-if="blockMessage">{{blockMessage}}</span>
|
||||
<span v-else>抱歉,当前时间不能申请,可申请时间为{{time}}。</span>
|
||||
@@ -312,31 +319,47 @@ layout("/layouts/platform.html"){
|
||||
bizId: GetQueryString("bizId"),
|
||||
taskId: GetQueryString("taskId"),
|
||||
isShow: false,
|
||||
pageLoading: true,
|
||||
time: '',
|
||||
blockMessage: '',
|
||||
formData: {
|
||||
applyMoney: undefined,
|
||||
id: GetQueryString("bizId"),
|
||||
mode: '1',
|
||||
applyCount: '1',
|
||||
},
|
||||
formRules: {
|
||||
proxyUserName: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
proxyLoginName: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
sex: [{required: true, message: '请填写性别', trigger: ['blur', 'change']}],
|
||||
userName: [{required: true, message: '请填写受补助人', trigger: ['blur', 'change']}],
|
||||
unitName: [{required: true, message: '请填写所属单位', trigger: ['blur', 'change']}],
|
||||
proxyUserName: this.textRules('填写人姓名', 100),
|
||||
proxyLoginName: this.textRules('填写人工号', 100),
|
||||
mode: [{required: true, type: 'enum', enum: ['1', '2'], message: '请选择申请模式', trigger: ['blur', 'change']}],
|
||||
sex: [{required: true, type: 'enum', enum: ['男', '女'], message: '请选择性别', trigger: ['blur', 'change']}],
|
||||
userId: [{required: true, message: '请选择受补助人', trigger: ['blur', 'change']}],
|
||||
unitName: this.textRules('所属单位', 500),
|
||||
unionName: [{required: true, message: '请填写所属工会', trigger: ['blur', 'change']}],
|
||||
homeAddress: [{required: true, message: '请填写家庭住址', trigger: ['blur', 'change']}],
|
||||
mobile: [{required: true, message: '请填写手机号码', trigger: ['blur', 'change']}],
|
||||
idCard: [{required: true, message: '请填写身份证号', trigger: ['blur', 'change']}],
|
||||
bankCardNum: [{required: true, message: '请填写收款账户卡号', trigger: ['blur', 'change']}],
|
||||
homeAddress: this.textRules('家庭住址', 200),
|
||||
mobile: [
|
||||
{required: true, message: '请填写手机号码', trigger: ['blur', 'change']},
|
||||
{pattern: /^1[3-9]\d{9}$/, message: '请输入正确的11位手机号码', trigger: ['blur', 'change']}
|
||||
],
|
||||
idCard: [{validator: (rule, value, callback) => {
|
||||
const result = this.isValidIdCard(value || '')
|
||||
callback(result.status === 0 ? new Error(result.msg) : undefined)
|
||||
}, required: true, trigger: ['blur', 'change']}],
|
||||
bankCardNum: [{validator: (rule, value, callback) => {
|
||||
const result = this.validateCard(value || '')
|
||||
callback(result.status === 0 ? new Error(result.msg) : undefined)
|
||||
}, required: true, trigger: ['blur', 'change']}],
|
||||
bankUserName: [{required: true, message: '请填写户名', trigger: ['blur', 'change']}],
|
||||
bankOfDeposit: [{required: true, message: '请填写开户行', trigger: ['blur', 'change']}],
|
||||
position: [{required: true, message: '请填写职务', trigger: ['blur', 'change']}],
|
||||
officialCapacity: [{required: true, message: '请填写职称', trigger: ['blur', 'change']}],
|
||||
subsidyStandards: [{required: true, message: '请选择困难类型', trigger: ['blur', 'change']}],
|
||||
reason: [{required: true, message: '请填写申请原因', trigger: ['blur', 'change']}],
|
||||
sign: [{required: true, message: '请签字', trigger: ['blur', 'change']}]
|
||||
bankOfDeposit: this.textRules('开户行', 30),
|
||||
position: this.textRules('职务', 20),
|
||||
officialCapacity: this.textRules('职称', 20),
|
||||
homeIncome: [{validator: this.validateIncome, required: true, trigger: ['blur', 'change']}],
|
||||
homeNumber: [{required: true, type: 'integer', min: 1, message: '家庭人数须为大于零的整数', trigger: ['blur', 'change']}],
|
||||
subsidy: this.textRules('补助类型', 500),
|
||||
subsidyStandards: this.textRules('困难类型', 500),
|
||||
applyMoney: [{validator: this.validateMoney, required: true, trigger: ['blur', 'change']}],
|
||||
reason: this.textRules('生活致困原因', 500),
|
||||
sign: [{required: true, whitespace: true, message: '请完成签字', trigger: ['blur', 'change']}],
|
||||
},
|
||||
|
||||
// 替他人申请相关
|
||||
@@ -344,8 +367,21 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
textRules(label, max) {
|
||||
return [{required: true, whitespace: true, max, message: '请填写' + label + ',且不超过' + max + '个字符', trigger: ['blur', 'change']}]
|
||||
},
|
||||
validateIncome(rule, value, callback) {
|
||||
const valid = typeof value === 'number' && Number.isFinite(value) && value >= 0 && /^\d+(\.\d{1,2})?$/.test(String(value))
|
||||
callback(valid ? undefined : new Error('收入须为不小于零的数字,最多保留两位小数'))
|
||||
},
|
||||
validateMoney(rule, value, callback) {
|
||||
const valid = typeof value === 'number' && Number.isFinite(value) && value > 0 && /^\d+(\.\d{1,2})?$/.test(String(value))
|
||||
callback(valid ? undefined : new Error('申请金额须大于零,最多保留两位小数'))
|
||||
},
|
||||
// 保存
|
||||
onSave() {
|
||||
async onSave() {
|
||||
const valid = await this.$refs.formRef.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
this.$confirm("您确定保存吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
@@ -362,24 +398,13 @@ layout("/layouts/platform.html"){
|
||||
|
||||
// 提交
|
||||
async onSubmit() {
|
||||
this.$refs.formRef.validate().then((valid) => {
|
||||
this.$refs.formRef.validate().catch(() => false).then((valid) => {
|
||||
if (valid) {
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
const result = this.isValidIdCard(this.formData.idCard)
|
||||
if (result.status === 0) {
|
||||
this.$message.warning(result.msg)
|
||||
return
|
||||
}
|
||||
const bankRes = this.validateCard(this.formData.bankCardNum)
|
||||
if (bankRes.status === 0) {
|
||||
this.$message.warning(bankRes.msg)
|
||||
return;
|
||||
}
|
||||
|
||||
this.$axios.post('/platform/difficultHelp/apply/submit', {
|
||||
data: JSON.stringify(this.formData)
|
||||
}).then(res => {
|
||||
@@ -394,7 +419,7 @@ layout("/layouts/platform.html"){
|
||||
},
|
||||
|
||||
async onFinishTask() {
|
||||
this.$refs.formRef.validate().then((valid) => {
|
||||
this.$refs.formRef.validate().catch(() => false).then((valid) => {
|
||||
if (valid) {
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
@@ -402,17 +427,6 @@ layout("/layouts/platform.html"){
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
|
||||
const result = this.isValidIdCard(this.formData.idCard)
|
||||
if (result.status === 0) {
|
||||
this.$message.warning(result.msg)
|
||||
return
|
||||
}
|
||||
const bankRes = this.validateCard(this.formData.bankCardNum)
|
||||
if (bankRes.status === 0) {
|
||||
this.$message.warning(bankRes.msg)
|
||||
return;
|
||||
}
|
||||
|
||||
this.$axios.post('/platform/difficultHelp/apply/submitAgain', {
|
||||
data: JSON.stringify(this.formData),
|
||||
taskId: GetQueryString("taskId")
|
||||
@@ -429,6 +443,9 @@ layout("/layouts/platform.html"){
|
||||
|
||||
// 查询受助人
|
||||
queryRecipients(key) {
|
||||
if (String(this.formData.mode) !== "2" || !this.$auth.hasRoleOr('BRANCH_UNION_CHAIRMAN')) {
|
||||
return
|
||||
}
|
||||
this.$axios.post("/platform/difficultHelp/apply/queryRecipients", {
|
||||
key
|
||||
}).then(res => {
|
||||
@@ -438,10 +455,12 @@ layout("/layouts/platform.html"){
|
||||
})
|
||||
},
|
||||
findOne(id) {
|
||||
this.$axios.post('/platform/difficultHelp/mine/findOne', { id }).then(res => {
|
||||
return this.$axios.post('/platform/difficultHelp/mine/findOne', { id }).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.formData = res.data
|
||||
this.queryRecipients(res.data.loginName)
|
||||
} else {
|
||||
throw new Error(res.msg || '申请信息加载失败,请刷新页面重试')
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -486,10 +505,10 @@ layout("/layouts/platform.html"){
|
||||
this.$set(this.formData, 'proxyLoginName', user.loginname)
|
||||
this.$set(this.formData, 'mode', "1")
|
||||
this.$set(this.formData, 'sex', user.sex)
|
||||
this.$set(this.formData, 'unitId', user.unit.id)
|
||||
this.$set(this.formData, 'unitName', user.unit.name)
|
||||
this.$set(this.formData, 'unionId', user.union.id)
|
||||
this.$set(this.formData, 'unionName', user.union.name)
|
||||
this.$set(this.formData, 'unitId', (user.unit || {}).id || user.unitId || null)
|
||||
this.$set(this.formData, 'unitName', (user.unit || {}).name || '')
|
||||
this.$set(this.formData, 'unionId', (user.union || {}).id || (user.unit || {}).unionId || null)
|
||||
this.$set(this.formData, 'unionName', (user.union || {}).name || '')
|
||||
this.$set(this.formData, 'yearIncome', null)
|
||||
this.$set(this.formData, 'birthday', user.birthday)
|
||||
this.$set(this.formData, 'idCard', user.idCard)
|
||||
@@ -602,10 +621,10 @@ layout("/layouts/platform.html"){
|
||||
return { status: 200, msg: "卡号有效。" };
|
||||
},
|
||||
async getIsCanPlay() {
|
||||
this.$axios.post('/platform/difficultHelp/apply/getIsCanPlay').then(res => {
|
||||
return this.$axios.post('/platform/difficultHelp/apply/getIsCanPlay').then(res => {
|
||||
if (res.code === 0) {
|
||||
// 新增申请进入页面时,优先校验当前登录人本年度是否已经申请过,已申请则直接拦截新增。
|
||||
if (!this.bizId && res.data.hasCurrentYearApply) {
|
||||
if (!this.bizId && res.data.hasCurrentYearApply && !this.$auth.hasRoleOr('BRANCH_UNION_CHAIRMAN')) {
|
||||
this.isShow = false
|
||||
this.$set(this, 'blockMessage', '抱歉,您本年度已申请困难帮扶,不能重复申请。')
|
||||
} else {
|
||||
@@ -616,16 +635,25 @@ layout("/layouts/platform.html"){
|
||||
if (res.data.applyCount !== null && res.data.applyCount !== undefined && res.data.applyCount !== 0) {
|
||||
this.$set(this.formData, 'applyCount', res.data.applyCount)
|
||||
}
|
||||
} else {
|
||||
throw new Error(res.msg || '申请资格加载失败,请刷新页面重试')
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
await this.getIsCanPlay();
|
||||
if (this.bizId) {
|
||||
this.findOne(this.bizId)
|
||||
} else {
|
||||
this.modeChange("1")
|
||||
try {
|
||||
await this.getIsCanPlay();
|
||||
if (this.bizId) {
|
||||
await this.findOne(this.bizId)
|
||||
} else {
|
||||
this.modeChange("1")
|
||||
}
|
||||
} catch (error) {
|
||||
this.isShow = false
|
||||
this.blockMessage = error.message || '申请信息加载失败,请刷新页面重试'
|
||||
} finally {
|
||||
this.pageLoading = false
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
+14
-4
@@ -1,8 +1,11 @@
|
||||
<div id="difficult_help_branch_union_approval_form">
|
||||
<el-form :model="formData" ref="formRef" label-width="0" label-suffix=":" class="flow-task-form">
|
||||
<el-form :model="formData" ref="formRef" label-width="100px" label-suffix=":">
|
||||
<el-form-item label="审批意见" prop="tf_opinion" :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
|
||||
</el-form-item>
|
||||
<el-form-item label="签字" prop="tf_sign" :rules="[{required:true,message:'请完成审批签字',trigger:['change','blur']}]">
|
||||
<pc-signature v-model="formData.tf_sign" :key="formData.processTaskId"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<snaker-flow-task-form-action @task-action="handleTaskAction" @cancel="handleCancel"></snaker-flow-task-form-action>
|
||||
</div>
|
||||
@@ -14,14 +17,21 @@
|
||||
return {
|
||||
businessId: GetQueryString("businessId"),
|
||||
formData: {
|
||||
tf_opinion: ""
|
||||
tf_sign: "", tf_opinion: ""
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleTaskAction(val) {
|
||||
async handleTaskAction(val) {
|
||||
try {
|
||||
const valid = await this.$refs.formRef.validate()
|
||||
if (!valid) return
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
|
||||
console.log(val)
|
||||
this.$axios.post("/flow/common/executeTask", {
|
||||
this.$axios.post("/platform/difficultHelp/approval/executeTask", {
|
||||
data: JSON.stringify({
|
||||
...val,
|
||||
...this.formData
|
||||
|
||||
+45
-10
@@ -82,18 +82,32 @@ layout("/layouts/platform.html"){
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
|
||||
<el-dialog title="设置帮扶审批信息" :visible.sync="batchVisible" width="760px">
|
||||
<el-form :model="batchForm" ref="batchFormRef" label-width="130px">
|
||||
<el-form-item label="审批意见" prop="tf_opinion" :rules="[{required:true,whitespace:true,message:'请填写审批意见',trigger:['change','blur']}]">
|
||||
<user-opinion-textarea v-model="batchForm.tf_opinion"></user-opinion-textarea>
|
||||
</el-form-item>
|
||||
<el-form-item label="签字" prop="tf_sign" :rules="[{required:true,message:'请完成审批签字',trigger:['change','blur']}]">
|
||||
<pc-signature v-model="batchForm.tf_sign" :key="batchForm.processTaskId"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer"><el-button @click="batchVisible = false">取消</el-button><el-button type="primary" @click="submitBatch">确定</el-button></span>
|
||||
</el-dialog>
|
||||
|
||||
<template #edit>
|
||||
<info ref="infoRef">
|
||||
<div v-if="showApprovalForm">
|
||||
<div class="process-title">
|
||||
{{formData.taskName}}
|
||||
</div>
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="0" label-suffix=":"
|
||||
class="flow-task-form">
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="100px" label-suffix=":">
|
||||
<el-form-item label="审批意见" prop="tf_opinion"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
|
||||
</el-form-item>
|
||||
<el-form-item label="签字" prop="tf_sign" :rules="[{required:true,message:'请完成审批签字',trigger:['change','blur']}]">
|
||||
<pc-signature v-model="formData.tf_sign" :key="formData.processTaskId"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row type="flex" justify="end">
|
||||
<el-button @click="handleTaskAction(1)" size="small" type="primary">同意申请</el-button>
|
||||
@@ -132,13 +146,15 @@ layout("/layouts/platform.html"){
|
||||
{ prop: "subsidyStandards", label: "困难类型", sortable: true },
|
||||
{ prop: "applyTime", label: "申请时间", sortable: true },
|
||||
{ prop: "applyCount", label: "申请次数", sortable: true },
|
||||
{ prop: "taskName", label: "当前节点" },
|
||||
{ prop: "curTaskName", label: "当前节点" },
|
||||
{ prop: "instanceState", label: "流程状态" }
|
||||
],
|
||||
unions: [],
|
||||
units: [],
|
||||
|
||||
formData: {},
|
||||
batchVisible: false,
|
||||
batchForm: {tf_sign: "", tf_opinion: ""},
|
||||
showApprovalForm: false,
|
||||
selectData: []
|
||||
}
|
||||
@@ -168,12 +184,23 @@ layout("/layouts/platform.html"){
|
||||
return;
|
||||
}
|
||||
|
||||
this.batchForm = {tf_sign: "", tf_opinion: ""}
|
||||
this.batchVisible = true
|
||||
},
|
||||
async submitBatch() {
|
||||
try {
|
||||
const valid = await this.$refs.batchFormRef.validate()
|
||||
if (!valid) return
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
const message = '确定要一键审核这 ' + this.selectData.length + ' 条记录吗?';
|
||||
this.$confirm(message, '批量审核确认', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.batchVisible = false;
|
||||
this.batchApprove(this.selectData);
|
||||
}).catch(() => {
|
||||
|
||||
@@ -221,10 +248,10 @@ layout("/layouts/platform.html"){
|
||||
|
||||
approveSingleItem(item) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$axios.post("/flow/common/executeTask", {
|
||||
this.$axios.post("/platform/difficultHelp/approval/executeTask", {
|
||||
data: JSON.stringify({
|
||||
processTaskId: item.taskId,
|
||||
tf_opinion: '审核通过',
|
||||
...this.batchForm,
|
||||
submitType: 1
|
||||
})
|
||||
}).then((res) => {
|
||||
@@ -243,19 +270,27 @@ layout("/layouts/platform.html"){
|
||||
this.showApprovalForm = true
|
||||
this.formData = {
|
||||
processTaskId: row.taskId,
|
||||
taskName: row.curTaskName
|
||||
taskName: row.curTaskName,
|
||||
tf_sign: "", tf_opinion: ""
|
||||
}
|
||||
this.$refs.infoRef.onOpen(row)
|
||||
})
|
||||
},
|
||||
|
||||
handleTaskAction(val) {
|
||||
async handleTaskAction(val) {
|
||||
try {
|
||||
const valid = await this.$refs.formRef.validate()
|
||||
if (!valid) return
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/flow/common/executeTask", {
|
||||
this.$axios.post("/platform/difficultHelp/approval/executeTask", {
|
||||
data: JSON.stringify({
|
||||
...this.formData,
|
||||
submitType: val
|
||||
@@ -289,7 +324,7 @@ layout("/layouts/platform.html"){
|
||||
if (this.$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')) {
|
||||
this.units = await this.$businessTool.listUnit(this.pageForm.unionId)
|
||||
} else {
|
||||
this.units = await this.$businessTool.listUnit(this.$store.state.user.union.id)
|
||||
this.units = await this.$businessTool.listUnit((this.$store.state.user.union || {}).id || this.pageForm.unionId)
|
||||
}
|
||||
},
|
||||
handleSelectionChange: function (val) {
|
||||
@@ -301,7 +336,7 @@ layout("/layouts/platform.html"){
|
||||
if (this.$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')) {
|
||||
this.unions = await this.$businessTool.listUnion()
|
||||
} else {
|
||||
this.unions = await this.$businessTool.listUnion(this.$store.state.user.union.id)
|
||||
this.unions = await this.$businessTool.listUnion((this.$store.state.user.union || {}).id)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -6,6 +6,7 @@ const INFO = {
|
||||
</div>
|
||||
<el-descriptions :column="3" border>
|
||||
<el-descriptions-item label="填写人姓名">{{ viewData.proxyUserName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="申请金额(元)">{{ viewData.applyMoney }}</el-descriptions-item>
|
||||
<el-descriptions-item label="性别">{{ viewData.sex }}</el-descriptions-item>
|
||||
<el-descriptions-item label="填写人工号">{{ viewData.proxyLoginName }}</el-descriptions-item>
|
||||
<!--\t\t<el-descriptions-item label="申请模式">{{ viewData.mode == 1 ? '本人申请' : '替他人申请' }}</el-descriptions-item>-->
|
||||
@@ -87,12 +88,15 @@ const INFO = {
|
||||
:value="task.ext.submitType"></dict-tag>
|
||||
</el-descriptions-item>
|
||||
|
||||
<template v-if="task.displayName == '校工会审核'">
|
||||
<el-descriptions-item label="审批级别">{{ viewData.level }}</el-descriptions-item>
|
||||
<el-descriptions-item label="审批金额">{{ '¥' + viewData.money }}</el-descriptions-item>
|
||||
<template v-if="task.taskFormData.level != null">
|
||||
<el-descriptions-item label="审批级别">{{ task.taskFormData.level }}</el-descriptions-item>
|
||||
<el-descriptions-item label="帮扶金额(元)">{{ task.taskFormData.money }}</el-descriptions-item>
|
||||
</template>
|
||||
|
||||
|
||||
<el-descriptions-item label="审批签字" :span="3" v-if="task.taskFormData && task.taskFormData.sign">
|
||||
<el-image :src="task.taskFormData.sign" style="height: 80px" fit="contain"></el-image>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="办理意见" :span="3" v-if="!task.ext.isFirstTaskNode">{{
|
||||
task.taskFormData.opinion }}
|
||||
</el-descriptions-item>
|
||||
|
||||
@@ -64,16 +64,16 @@ layout("/layouts/platform.html"){
|
||||
size="small"></enum-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="300px">
|
||||
<el-table-column label="操作" fixed="right" width="300px" class-name="difficult-help-mine-actions">
|
||||
<template slot-scope="{row}">
|
||||
<el-button @click="openView(row)" size="mini" type="primary">查看</el-button>
|
||||
<el-button v-if="row.taskKey === 'startTask' || !row.instanceId" @click="onEdit(row)" size="mini" type="primary">
|
||||
<el-button v-if="row.createdBy === $store.state.user.id && (row.taskKey === 'startTask' || !row.instanceId)" @click="onEdit(row)" size="mini" type="primary">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-if="row.canRevoke" @click="onRevoke(row)" size="mini" type="danger">撤回
|
||||
<el-button v-if="row.createdBy === $store.state.user.id && row.canRevoke" @click="onRevoke(row)" size="mini" type="danger">撤回
|
||||
</el-button>
|
||||
<el-button @click="doExportApply(row)" size="mini" type="primary">打印</el-button>
|
||||
<el-button v-if="row.taskKey === 'startTask' || !row.instanceId" @click="onDelete(row.id)" size="mini" type="danger">删除</el-button>
|
||||
<el-button v-if="row.createdBy === $store.state.user.id && row.instanceState == 20" @click="doExportApply(row)" size="mini" type="primary">导出</el-button>
|
||||
<el-button v-if="row.createdBy === $store.state.user.id && (row.taskKey === 'startTask' || !row.instanceId)" @click="onDelete(row.id)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -87,6 +87,18 @@ layout("/layouts/platform.html"){
|
||||
|
||||
</div>
|
||||
|
||||
<style nonce="${cspNonce!}">
|
||||
#app .difficult-help-mine-actions .cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
}
|
||||
#app .difficult-help-mine-actions .cell > .el-button {
|
||||
margin-left: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include("../common/info.js"){}#-->
|
||||
|
||||
@@ -107,6 +119,7 @@ layout("/layouts/platform.html"){
|
||||
{ prop: "unitName", label: "所属单位", sortable: true },
|
||||
{ prop: "mobile", label: "联系方式", sortable: true },
|
||||
{ prop: "subsidyStandards", label: "困难类型", sortable: true },
|
||||
{ prop: "applyMoney", label: "申请金额", sortable: true, width: "135"},
|
||||
{ prop: "money", label: "实际帮扶金额", sortable: true, width: "135"},
|
||||
{ prop: "applyTime", label: "申请时间", sortable: true },
|
||||
{ prop: "applyCount", label: "申请次数", sortable: true },
|
||||
@@ -165,11 +178,11 @@ layout("/layouts/platform.html"){
|
||||
if (this.$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')) {
|
||||
this.units = await this.$businessTool.listUnit(this.pageForm.unionId)
|
||||
} else {
|
||||
this.units = await this.$businessTool.listUnit(this.$store.state.user.union.id)
|
||||
this.units = await this.$businessTool.listUnit((this.$store.state.user.union || {}).id || this.pageForm.unionId)
|
||||
}
|
||||
},
|
||||
doExportApply(row) {
|
||||
this.$downLoad('/platform/difficultHelp/reading/doExportApply?id=' + row.id + '&print=true')
|
||||
this.$downLoad('/platform/difficultHelp/reading/doExportApply?id=' + row.id + '&print=false')
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
@@ -177,7 +190,7 @@ layout("/layouts/platform.html"){
|
||||
if (this.$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')) {
|
||||
this.unions = await this.$businessTool.listUnion()
|
||||
} else {
|
||||
this.unions = await this.$businessTool.listUnion(this.$store.state.user.union.id)
|
||||
this.unions = await this.$businessTool.listUnion((this.$store.state.user.union || {}).id)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
+2
-10
@@ -178,11 +178,7 @@ layout("/layouts/platform.html"){
|
||||
},
|
||||
async flushUnits(){
|
||||
this.$set(this.pageForm, "unitId", null)
|
||||
if (this.$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')) {
|
||||
this.units = await this.$businessTool.listUnit(this.pageForm.unionId)
|
||||
} else {
|
||||
this.units = await this.$businessTool.listUnit(this.$store.state.user.union.id)
|
||||
}
|
||||
this.units = await this.$businessTool.listUnit(this.pageForm.unionId)
|
||||
},
|
||||
exportYearPayRecord(){
|
||||
this.$downLoad('/platform/difficultHelp/reading/exportYearPayRecord', this.pageForm)
|
||||
@@ -204,11 +200,7 @@ layout("/layouts/platform.html"){
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
if (this.$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')) {
|
||||
this.unions = await this.$businessTool.listUnion()
|
||||
} else {
|
||||
this.unions = await this.$businessTool.listUnion(this.$store.state.user.union.id)
|
||||
}
|
||||
this.unions = await this.$businessTool.listUnion()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
+14
-9
@@ -1,11 +1,11 @@
|
||||
<div id="difficult_help_school_union_approval_form">
|
||||
<el-form :model="formData" ref="formRef" label-width="0" label-suffix=":" class="flow-task-form">
|
||||
<el-form-item label="审核金额" prop="tf_money" :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-input-number placeholder="请输入金额" v-model="formData.tf_money"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="审批意见" prop="tf_opinion" :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-form :model="formData" ref="formRef" label-width="100px" label-suffix=":">
|
||||
<el-form-item label="审批意见" prop="tf_opinion" :rules="[{required:true,whitespace:true,message:'请填写审批意见',trigger:['change','blur']}]">
|
||||
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
|
||||
</el-form-item>
|
||||
<el-form-item label="签字" prop="tf_sign" :rules="[{required:true,message:'请完成审批签字',trigger:['change','blur']}]">
|
||||
<pc-signature v-model="formData.tf_sign" :key="formData.processTaskId"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<snaker-flow-task-form-action @task-action="handleTaskAction" @cancel="handleCancel"></snaker-flow-task-form-action>
|
||||
</div>
|
||||
@@ -17,15 +17,20 @@
|
||||
return {
|
||||
businessId: GetQueryString("businessId"),
|
||||
formData: {
|
||||
tf_money: 0,
|
||||
tf_opinion: "",
|
||||
tf_sign: "", tf_opinion: "",
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleTaskAction(val) {
|
||||
async handleTaskAction(val) {
|
||||
try {
|
||||
const valid = await this.$refs.formRef.validate()
|
||||
if (!valid) return
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
console.log(val)
|
||||
this.$axios.post("/flow/common/executeTask", {
|
||||
this.$axios.post("/platform/difficultHelp/approval/executeTask", {
|
||||
data: JSON.stringify({
|
||||
...val,
|
||||
...this.formData
|
||||
|
||||
+35
-84
@@ -83,11 +83,11 @@ layout("/layouts/platform.html"){
|
||||
|
||||
<el-dialog title="设置审核信息" :visible.sync="dialogVisible" width="30%" center>
|
||||
<el-form :model="formData" ref="formData" label-width="100px">
|
||||
<el-form-item label="级别" prop="level" :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<dict-select v-model="formData.level" code="DIFFICULT_LEVEL" style="width: 100%" placeholder="请选择级别"></dict-select>
|
||||
<el-form-item label="审批意见" prop="tf_opinion" :rules="[{required:true,whitespace:true,message:'请填写审批意见',trigger:['change','blur']}]">
|
||||
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核金额" prop="money" :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-input-number placeholder="请输入金额" v-model="formData.money" style="width: 100%" :precision="2" :min="0"></el-input-number>
|
||||
<el-form-item label="签字" prop="tf_sign" :rules="[{required:true,message:'请完成审批签字',trigger:['change','blur']}]">
|
||||
<pc-signature v-model="formData.tf_sign" :key="formData.processTaskId"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
@@ -103,25 +103,13 @@ layout("/layouts/platform.html"){
|
||||
{{formData.taskName}}
|
||||
</div>
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="100px" label-suffix=":">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="级别" prop="level" :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<search-item>
|
||||
<dict-select v-model="formData.level" code="DIFFICULT_LEVEL" style="width: 100%" placeholder="请选择级别"></dict-select>
|
||||
</search-item>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="审核金额" prop="money" :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-input-number placeholder="请输入金额" v-model="formData.money" style="width: 100%" :precision="2"
|
||||
:min="0" ></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="审批意见" prop="tf_opinion"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
:rules="[{required:true,whitespace:true,message:'请填写审批意见',trigger:['change','blur']}]">
|
||||
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
|
||||
</el-form-item>
|
||||
<el-form-item label="签字" prop="tf_sign" :rules="[{required:true,message:'请完成审批签字',trigger:['change','blur']}]">
|
||||
<pc-signature v-model="formData.tf_sign" :key="formData.processTaskId"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row type="flex" justify="end">
|
||||
<el-button @click="handleTaskAction(1)" size="small" type="primary">同意申请</el-button>
|
||||
@@ -166,14 +154,10 @@ layout("/layouts/platform.html"){
|
||||
units: [],
|
||||
|
||||
formData: {
|
||||
level: '',
|
||||
money: 0,
|
||||
tf_opinion: "",
|
||||
tf_sign: "", tf_opinion: "",
|
||||
},
|
||||
showApprovalForm: false,
|
||||
auditForm: {
|
||||
level: '',
|
||||
money: 0
|
||||
},
|
||||
dialogVisible: false
|
||||
}
|
||||
@@ -254,39 +238,17 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
|
||||
approveSingleItem(item) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$axios.post("/platform/difficultHelp/schoolUnionApproval/save", {
|
||||
data: JSON.stringify({
|
||||
...this.formData,
|
||||
id: item.id
|
||||
})
|
||||
}).then((saveRes) => {
|
||||
if (saveRes.code !== 0) {
|
||||
throw new Error(saveRes.msg || '保存失败');
|
||||
}
|
||||
return this.$axios.post("/flow/common/executeTask", {
|
||||
data: JSON.stringify({
|
||||
processTaskId: item.taskId,
|
||||
tf_opinion: '审核通过',
|
||||
submitType: 1,
|
||||
})
|
||||
});
|
||||
}).then((taskRes) => {
|
||||
if (taskRes.code === 0) {
|
||||
resolve(taskRes);
|
||||
} else {
|
||||
throw new Error(taskRes.msg || '审批失败');
|
||||
}
|
||||
}).catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
async approveSingleItem(item) {
|
||||
const res = await this.$axios.post("/platform/difficultHelp/approval/executeTask", {
|
||||
data: JSON.stringify({processTaskId: item.taskId, tf_opinion: this.formData.tf_opinion, tf_sign: this.formData.tf_sign, submitType: 1})
|
||||
})
|
||||
if (res.code !== 0) throw new Error(res.msg || '审批失败')
|
||||
},
|
||||
openAudit(row) {
|
||||
this.$refs.guava.edit(()=>{
|
||||
this.showApprovalForm = true
|
||||
this.formData = {
|
||||
tf_sign: "",
|
||||
processTaskId: row.taskId,
|
||||
taskName: row.curTaskName,
|
||||
id: row.id
|
||||
@@ -295,35 +257,24 @@ layout("/layouts/platform.html"){
|
||||
})
|
||||
},
|
||||
|
||||
handleTaskAction(val) {
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/difficultHelp/schoolUnionApproval/save", {
|
||||
data: JSON.stringify({
|
||||
...this.formData,
|
||||
})
|
||||
}).then((saveRes) => {
|
||||
if (saveRes.code === 0) {
|
||||
this.$axios.post("/flow/common/executeTask", {
|
||||
data: JSON.stringify({
|
||||
...this.formData,
|
||||
submitType: val
|
||||
})
|
||||
}).then((taskRes) => {
|
||||
if (taskRes.code === 0) {
|
||||
this.$message.success('操作成功');
|
||||
this.$refs.guava.index();
|
||||
this.doSearch();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
async handleTaskAction(val) {
|
||||
try {
|
||||
const valid = await this.$refs.formRef.validate()
|
||||
if (!valid) return
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
this.$confirm("您确定要提交吗?", "提示", {type: "warning"}).then(() => {
|
||||
this.$axios.post("/platform/difficultHelp/approval/executeTask", {
|
||||
data: JSON.stringify({...this.formData, submitType: val})
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success('操作成功')
|
||||
this.$refs.guava.index()
|
||||
this.doSearch()
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
},
|
||||
|
||||
onRevoke(row) {
|
||||
@@ -345,7 +296,7 @@ layout("/layouts/platform.html"){
|
||||
if (this.$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')) {
|
||||
this.units = await this.$businessTool.listUnit(this.pageForm.unionId)
|
||||
} else {
|
||||
this.units = await this.$businessTool.listUnit(this.$store.state.user.union.id)
|
||||
this.units = await this.$businessTool.listUnit((this.$store.state.user.union || {}).id || this.pageForm.unionId)
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -354,7 +305,7 @@ layout("/layouts/platform.html"){
|
||||
if (this.$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')) {
|
||||
this.unions = await this.$businessTool.listUnion()
|
||||
} else {
|
||||
this.unions = await this.$businessTool.listUnion(this.$store.state.user.union.id)
|
||||
this.unions = await this.$businessTool.listUnion((this.$store.state.user.union || {}).id)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
+22
-4
@@ -1,8 +1,18 @@
|
||||
<div id="difficult_help_branch_union_approval_form">
|
||||
<el-form :model="formData" ref="formRef" label-width="0" label-suffix=":" class="flow-task-form">
|
||||
<el-form :model="formData" ref="formRef" label-width="100px" label-suffix=":">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="帮扶金额" prop="money" :rules="[{required:true,message:'请填写帮扶金额',trigger:['change','blur']}]">
|
||||
<el-input-number v-model="formData.money" style="width: 100%" :precision="2" :min="0" placeholder="请输入帮扶金额"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="审批意见" prop="tf_opinion" :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
|
||||
</el-form-item>
|
||||
<el-form-item label="签字" prop="tf_sign" :rules="[{required:true,message:'请完成审批签字',trigger:['change','blur']}]">
|
||||
<pc-signature v-model="formData.tf_sign" :key="formData.processTaskId"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<snaker-flow-task-form-action @task-action="handleTaskAction" @cancel="handleCancel"></snaker-flow-task-form-action>
|
||||
</div>
|
||||
@@ -14,14 +24,22 @@
|
||||
return {
|
||||
businessId: GetQueryString("businessId"),
|
||||
formData: {
|
||||
tf_opinion: ""
|
||||
money: undefined,
|
||||
tf_sign: "", tf_opinion: ""
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleTaskAction(val) {
|
||||
async handleTaskAction(val) {
|
||||
try {
|
||||
const valid = await this.$refs.formRef.validate()
|
||||
if (!valid) return
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
|
||||
console.log(val)
|
||||
this.$axios.post("/flow/common/executeTask", {
|
||||
this.$axios.post("/platform/difficultHelp/approval/executeTask", {
|
||||
data: JSON.stringify({
|
||||
...val,
|
||||
...this.formData
|
||||
|
||||
+59
-9
@@ -81,18 +81,46 @@ layout("/layouts/platform.html"){
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
|
||||
<el-dialog title="设置帮扶审批信息" :visible.sync="batchVisible" width="760px">
|
||||
<el-form :model="batchForm" ref="batchFormRef" label-width="130px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="帮扶金额(元)" prop="money" :rules="[{required:true,message:'请填写帮扶金额',trigger:['change','blur']}]">
|
||||
<el-input-number v-model="batchForm.money" style="width: 100%" :precision="2" :min="0" placeholder="请输入帮扶金额"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="审批意见" prop="tf_opinion" :rules="[{required:true,whitespace:true,message:'请填写审批意见',trigger:['change','blur']}]">
|
||||
<user-opinion-textarea v-model="batchForm.tf_opinion"></user-opinion-textarea>
|
||||
</el-form-item>
|
||||
<el-form-item label="签字" prop="tf_sign" :rules="[{required:true,message:'请完成审批签字',trigger:['change','blur']}]">
|
||||
<pc-signature v-model="batchForm.tf_sign" :key="batchForm.processTaskId"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer"><el-button @click="batchVisible = false">取消</el-button><el-button type="primary" @click="submitBatch">确定</el-button></span>
|
||||
</el-dialog>
|
||||
|
||||
<template #edit>
|
||||
<info ref="infoRef">
|
||||
<div v-if="showApprovalForm">
|
||||
<div class="process-title">
|
||||
{{formData.taskName}}
|
||||
</div>
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="0" label-suffix=":"
|
||||
class="flow-task-form">
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="100px" label-suffix=":">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="帮扶金额" prop="money" :rules="[{required:true,message:'请填写帮扶金额',trigger:['change','blur']}]">
|
||||
<el-input-number v-model="formData.money" style="width: 100%" :precision="2" :min="0" placeholder="请输入帮扶金额"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="审批意见" prop="tf_opinion"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
|
||||
</el-form-item>
|
||||
<el-form-item label="签字" prop="tf_sign" :rules="[{required:true,message:'请完成审批签字',trigger:['change','blur']}]">
|
||||
<pc-signature v-model="formData.tf_sign" :key="formData.processTaskId"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row type="flex" justify="end">
|
||||
<el-button @click="handleTaskAction(1)" size="small" type="primary">同意申请</el-button>
|
||||
@@ -138,6 +166,8 @@ layout("/layouts/platform.html"){
|
||||
units: [],
|
||||
|
||||
formData: {},
|
||||
batchVisible: false,
|
||||
batchForm: {money: undefined, tf_sign: "", tf_opinion: ""},
|
||||
showApprovalForm: false,
|
||||
selectData: [],
|
||||
}
|
||||
@@ -161,12 +191,23 @@ layout("/layouts/platform.html"){
|
||||
this.$message.warning('请勾选待审核数据!');
|
||||
return;
|
||||
}
|
||||
this.batchForm = {money: undefined, tf_sign: "", tf_opinion: ""}
|
||||
this.batchVisible = true
|
||||
},
|
||||
async submitBatch() {
|
||||
try {
|
||||
const valid = await this.$refs.batchFormRef.validate()
|
||||
if (!valid) return
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
const message = '确定要一键审核这 ' + this.selectData.length + ' 条记录吗?';
|
||||
this.$confirm(message, '批量审核确认', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.batchVisible = false;
|
||||
this.batchApprove(this.selectData);
|
||||
}).catch(() => {
|
||||
|
||||
@@ -214,10 +255,10 @@ layout("/layouts/platform.html"){
|
||||
|
||||
approveSingleItem(item) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$axios.post("/flow/common/executeTask", {
|
||||
this.$axios.post("/platform/difficultHelp/approval/executeTask", {
|
||||
data: JSON.stringify({
|
||||
processTaskId: item.taskId,
|
||||
tf_opinion: '审核通过',
|
||||
...this.batchForm,
|
||||
submitType: 1
|
||||
})
|
||||
}).then((res) => {
|
||||
@@ -236,19 +277,28 @@ layout("/layouts/platform.html"){
|
||||
this.showApprovalForm = true
|
||||
this.formData = {
|
||||
processTaskId: row.taskId,
|
||||
taskName: row.curTaskName
|
||||
taskName: row.curTaskName,
|
||||
money: undefined,
|
||||
tf_sign: "", tf_opinion: ""
|
||||
}
|
||||
this.$refs.infoRef.onOpen(row)
|
||||
})
|
||||
},
|
||||
|
||||
handleTaskAction(val) {
|
||||
async handleTaskAction(val) {
|
||||
try {
|
||||
const valid = await this.$refs.formRef.validate()
|
||||
if (!valid) return
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/flow/common/executeTask", {
|
||||
this.$axios.post("/platform/difficultHelp/approval/executeTask", {
|
||||
data: JSON.stringify({
|
||||
...this.formData,
|
||||
submitType: val
|
||||
@@ -282,7 +332,7 @@ layout("/layouts/platform.html"){
|
||||
if (this.$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')) {
|
||||
this.units = await this.$businessTool.listUnit(this.pageForm.unionId)
|
||||
} else {
|
||||
this.units = await this.$businessTool.listUnit(this.$store.state.user.union.id)
|
||||
this.units = await this.$businessTool.listUnit((this.$store.state.user.union || {}).id || this.pageForm.unionId)
|
||||
}
|
||||
},
|
||||
handleSelectionChange: function (val) {
|
||||
@@ -294,7 +344,7 @@ layout("/layouts/platform.html"){
|
||||
if (this.$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')) {
|
||||
this.unions = await this.$businessTool.listUnion()
|
||||
} else {
|
||||
this.unions = await this.$businessTool.listUnion(this.$store.state.user.union.id)
|
||||
this.unions = await this.$businessTool.listUnion((this.$store.state.user.union || {}).id)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
<el-descriptions-item label="申请模式">{{ viewData.mode == 1 ? '本人申请' : '替他人申请' }}</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="受助人">{{ viewData.userName + '(' + viewData.loginName + ')' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="性别">{{ viewData.sex }}</el-descriptions-item>
|
||||
<el-descriptions-item label="申请金额(元)">{{ viewData.applyMoney }}</el-descriptions-item>
|
||||
<el-descriptions-item label="性别">{{ viewData.sex }}</el-descriptions-item>
|
||||
<el-descriptions-item label="出生年月">{{ viewData.birthday }}</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="所属工会">{{ viewData.unionName }}</el-descriptions-item>
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<el-descriptions-item label="慰问类型" :span="2">
|
||||
<el-form-item label="慰问类型" prop="type">
|
||||
<el-select v-model="formData.type" filterable @change="typeChange" style="width:100%" placeholder="请选择慰问类型">
|
||||
<el-option v-for="t in typeOptions" :key="t.id" :value="t.id" :label="t.name"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="慰问金额" :span="2">
|
||||
<el-form-item label="慰问金额" prop="perMoney" :rules="recipientRules.money">
|
||||
<el-input v-model="formData.perMoney" readonly style="width:100%" placeholder="根据慰问类型自动带出"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="慰问时间" :span="2">
|
||||
<el-form-item label="慰问时间" prop="occurTime" :rules="recipientRules.occurTime">
|
||||
<el-date-picker v-model="formData.occurTime" type="date" value-format="yyyy-MM-dd" style="width:100%" placeholder="请选择慰问时间"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
+322
@@ -0,0 +1,322 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style nonce="${cspNonce!}">
|
||||
<!--#include('recipients.css'){}#-->
|
||||
</style>
|
||||
<div id="app" class="special-condolence-apply" v-cloak>
|
||||
<el-card shadow="never">
|
||||
<snaker-start slot="header" label="特殊慰问" define_key="TSWW"></snaker-start>
|
||||
<el-form size="small" :model="formData" ref="formRef" :rules="formRules" label-width="0" label-suffix=":"
|
||||
class="flow-task-form">
|
||||
<el-tabs v-model="activeApplicationTab">
|
||||
<el-tab-pane label="基础信息" name="form">
|
||||
<el-descriptions :column="6" border size="small">
|
||||
<el-descriptions-item label="事项" :span="2"><el-form-item prop="subject" label="事项"><el-input v-model="formData.subject" maxlength="200" show-word-limit placeholder="请输入特殊慰问事项"></el-input></el-form-item></el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="申请人姓名" :span="2">{{formData.applyUserName}}</el-descriptions-item>
|
||||
<el-descriptions-item label="申请人工号" :span="2">{{formData.applyLoginName}}</el-descriptions-item>
|
||||
|
||||
|
||||
<!--#include('config.html'){}#-->
|
||||
<el-descriptions-item label="申请人单位" :span="2">{{formData.applyUnitName}}</el-descriptions-item>
|
||||
<el-descriptions-item label="申请人工会" :span="2">{{formData.applyUnionName}}</el-descriptions-item>
|
||||
<el-descriptions-item label="" :span="2"><span></span></el-descriptions-item>
|
||||
<el-descriptions-item label="申请事由" :span="6">
|
||||
<el-form-item prop="remark" label="申请事由">
|
||||
<el-input maxlength="500" v-model="formData.remark" placeholder="请填写申请事由"
|
||||
type="textarea" :rows="3" resize="none"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item :span="6" v-if="chooseType.isUploadFile === true">
|
||||
<template slot="label">
|
||||
附件
|
||||
<el-tooltip class="item" effect="dark" :content="'上传附件说明:' + chooseType.uploadFileDesc"
|
||||
placement="top-start"
|
||||
v-if="chooseType.isUploadFile && chooseType.uploadFileDesc">
|
||||
<i class="el-icon-question"></i>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-form-item prop="files" label="附件">
|
||||
<file-upload
|
||||
:value.sync="formData.files"
|
||||
:upload_number="5"
|
||||
upload_result_category="array"
|
||||
complete_result
|
||||
upload_mode="drag"
|
||||
></file-upload>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="签字" :span="6">
|
||||
<el-form-item prop="signature" label="签字" class="special-condolence-signature-item">
|
||||
<pc-signature v-model="formData.signature"></pc-signature>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="慰问对象" name="recipients" :lazy="false">
|
||||
<!--#include('recipients.html'){}#-->
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-form>
|
||||
<el-row type="flex" justify="end" class="special-condolence-actions">
|
||||
<el-button type="primary" plain @click="onSave">保存申请</el-button>
|
||||
<el-button type="primary" @click="onSubmit" v-if="!taskId">提交申请</el-button>
|
||||
<el-button type="primary" @click="onFinishTask" v-else>提交申请</el-button>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include('recipients.js'){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
store,
|
||||
mixins: [specialCondolenceRecipients],
|
||||
components: {
|
||||
ElDatePicker: {
|
||||
extends: ELEMENT.DatePicker,
|
||||
mounted() {
|
||||
// 手动输入触发 change 前初始化日期面板,避免 picker 尚未创建。
|
||||
if (!this.picker) this.mountPicker()
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
bizId: GetQueryString("bizId"),
|
||||
taskId: GetQueryString("taskId"),
|
||||
formData: { recipients: [] },
|
||||
formRules: {
|
||||
subject: [{ required: true, whitespace: true, message: "请填写事项", trigger: ["blur", "change"] }, { max: 200, message: "事项最多200字", trigger: "blur" }],
|
||||
recipients: [{ validator: (rule, value, callback) => callback(Array.isArray(value) && value.length > 0 ? undefined : new Error("请至少添加一位慰问对象")), trigger: "change" }],
|
||||
helpUserId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
payUserId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
type: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
way: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
money: [
|
||||
{ required: true, message: "请填写慰问金额", trigger: ["change", "blur"] },
|
||||
{ validator: (rule, value, callback) => callback(this.validateMoney(value) ? undefined : new Error("慰问金额须大于0且不超过10000元,最多两位小数")), trigger: ["change", "blur"] }
|
||||
],
|
||||
occurTime: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
child: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
hospital: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
hospitalHouseNum: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
hospitalHouseBedNum: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
hospitalBy: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
deadImmediateFamily: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
remark: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
files: [{ required: true, type: "array", min: 1, max: 5, message: "请上传1至5个附件", trigger: ["change", "blur"] }],
|
||||
signature: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
handlerUserId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
// certifierUserId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
bankCardNumber: [
|
||||
{ required: true, message: "请填写银行卡号或对公账户号", trigger: ["change", "blur"] },
|
||||
{ pattern: /^[0-9]{6,30}$/, message: "收款账户须为6至30位数字(银行卡号或对公账户号)", trigger: ["change", "blur"] }
|
||||
],
|
||||
bankUserName: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
bankOfDeposit: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
thisYearHospitalizationNum: [
|
||||
{ required: true, message: "必填", trigger: ["change", "blur"] },
|
||||
{ type: "integer", min: 0, max: 10000, message: "住院次数须为0至10000的整数", trigger: ["change", "blur"] }
|
||||
],
|
||||
leaveHospitalTime: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
hospitalizationTime: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
},
|
||||
chooseType: {},
|
||||
payUserOptions: [],
|
||||
helpUserOptions: [],
|
||||
typeOptions: [],
|
||||
|
||||
handlerUserOptions: [],
|
||||
certifierUserOptions: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
validateMoney(value) {
|
||||
return /^(0|[1-9][0-9]*)(\.[0-9]{1,2})?$/.test(String(value)) && Number(value) > 0 && Number(value) <= 10000
|
||||
},
|
||||
createRemoteMethod(options) {
|
||||
return (keyword) => {
|
||||
this.selectQueryUser(keyword, options)
|
||||
}
|
||||
},
|
||||
selectQueryUser(keyword, options) {
|
||||
options.length = 0
|
||||
this.$axios.post("/platform/special_condolence/apply/listUser", { keyword: keyword }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
options.push(...res.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
helpUserChange(val) {
|
||||
const user = this.helpUserOptions.find(o => o.id === val)
|
||||
if (user) {
|
||||
const { userName, loginName, unitId, unitName, unionId, unionName } = user
|
||||
this.$set(this.formData, "helpUserName", userName)
|
||||
this.$set(this.formData, "helpLoginName", loginName)
|
||||
this.$set(this.formData, "helpUnitId", unitId)
|
||||
this.$set(this.formData, "helpUnitName", unitName)
|
||||
this.$set(this.formData, "helpUnionId", unionId)
|
||||
this.$set(this.formData, "helpUnionName", unionName)
|
||||
}
|
||||
},
|
||||
handlerUserChange(val) {
|
||||
const user = this.handlerUserOptions.find(o => o.id === val)
|
||||
if (user) {
|
||||
const { userName, loginName, unitId, unitName, unionId, unionName } = user
|
||||
this.$set(this.formData, "handlerUserName", userName)
|
||||
this.$set(this.formData, "handlerLoginName", loginName)
|
||||
this.$set(this.formData, "handlerUnitId", unitId)
|
||||
this.$set(this.formData, "handlerUnitName", unitName)
|
||||
this.$set(this.formData, "handlerUnionId", unionId)
|
||||
this.$set(this.formData, "handlerUnionName", unionName)
|
||||
}
|
||||
},
|
||||
certifierUserChange(val) {
|
||||
const user = this.certifierUserOptions.find(o => o.id === val)
|
||||
if (user) {
|
||||
const { userName, loginName, unitId, unitName, unionId, unionName } = user
|
||||
this.$set(this.formData, "certifierUserName", userName)
|
||||
this.$set(this.formData, "certifierLoginName", loginName)
|
||||
this.$set(this.formData, "certifierUnitId", unitId)
|
||||
this.$set(this.formData, "certifierUnitName", unitName)
|
||||
this.$set(this.formData, "certifierUnionId", unionId)
|
||||
this.$set(this.formData, "certifierUnionName", unionName)
|
||||
}
|
||||
},
|
||||
payUserChange(val) {
|
||||
const user = this.payUserOptions.find(o => o.id === val)
|
||||
if (user) {
|
||||
const { userName, loginName } = user
|
||||
this.$set(this.formData, "payUserName", userName)
|
||||
this.$set(this.formData, "payLoginName", loginName)
|
||||
}
|
||||
},
|
||||
typeChange(id) {
|
||||
this.chooseType = this.typeOptions.find(o => o.id === id)
|
||||
if (this.chooseType) {
|
||||
this.$set(this.formData, "perMoney", this.chooseType.money)
|
||||
this.$set(this.formData, "way", this.chooseType.way)
|
||||
this.$set(this.formData, "typeCode", this.chooseType.code)
|
||||
}
|
||||
},
|
||||
onSave() {
|
||||
this.$confirm("您确定保存吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/special_condolence/apply/save", { data: JSON.stringify(this.formData) }).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
window.location.replace("/platform/special_condolence/mine")
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
async validateApplication(callback) {
|
||||
const form = this.$refs.formRef
|
||||
const fields = form.fields.filter(field => field.prop && !field.prop.startsWith('recipients'))
|
||||
const results = await Promise.all(fields.map(field => new Promise(resolve => {
|
||||
field.validate('', message => resolve(!message))
|
||||
})))
|
||||
if (results.some(valid => !valid)) {
|
||||
this.activeApplicationTab = 'form'
|
||||
this.$message.error('请完善基础信息的必填信息')
|
||||
return
|
||||
}
|
||||
if (!this.ensureApplicationRecipients()) return
|
||||
form.validate(callback)
|
||||
},
|
||||
onSubmit() {
|
||||
this.validateApplication((valid, invalidFields) => {
|
||||
if (!valid) { this.showInvalidApplicationTab(invalidFields); return }
|
||||
if (valid) {
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/special_condolence/apply/submit", {
|
||||
data: JSON.stringify(this.formData)
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
window.location.replace("/platform/special_condolence/mine")
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
onFinishTask() {
|
||||
this.validateApplication((valid, invalidFields) => {
|
||||
if (!valid) { this.showInvalidApplicationTab(invalidFields); return }
|
||||
if (valid) {
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/special_condolence/apply/submitAgain", {
|
||||
data: JSON.stringify(this.formData),
|
||||
taskId: GetQueryString("taskId")
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
window.location.replace("/platform/special_condolence/mine")
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
init() {
|
||||
if (this.bizId) {
|
||||
this.$axios.post("/platform/special_condolence/mine/info", { id: this.bizId }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.formData = res.data
|
||||
this.initRecipients()
|
||||
this.selectQueryUser(this.formData.helpLoginName, this.helpUserOptions)
|
||||
this.selectQueryUser(this.formData.certifierLoginName, this.certifierUserOptions)
|
||||
this.selectQueryUser(this.formData.handlerLoginName, this.handlerUserOptions)
|
||||
this.chooseType = this.typeOptions.find(o => o.id === this.formData.type) || {}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const { username, loginname, id, unit, union, mobile } = this.$store.state.user
|
||||
this.formData = {
|
||||
recipients: [this.newRecipient()],
|
||||
perMoney: undefined,
|
||||
occurTime: this.$moment().format('YYYY-MM-DD'),
|
||||
applyUserName: username,
|
||||
applyLoginName: loginname,
|
||||
applyUserId: id,
|
||||
applyUnitId: unit?.id,
|
||||
applyUnitName: unit?.name,
|
||||
applyUnionId: union?.id,
|
||||
applyUnionName: union?.name
|
||||
}
|
||||
}
|
||||
},
|
||||
querySpecialCondolenceType() {
|
||||
this.$axios.post("/platform/special_condolence/type/querySpecialCondolenceType")
|
||||
.then((resp) => {
|
||||
this.typeOptions = resp.data
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.querySpecialCondolenceType()
|
||||
this.init()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user