diff --git a/src/main/java/io/v/nutz/base/utils/Html2Text.java b/src/main/java/io/v/nutz/base/utils/Html2Text.java index 64cbd0d..e6e6389 100644 --- a/src/main/java/io/v/nutz/base/utils/Html2Text.java +++ b/src/main/java/io/v/nutz/base/utils/Html2Text.java @@ -67,4 +67,16 @@ public class Html2Text extends HTMLEditorKit.ParserCallback { String result = StringEscapeUtils.unescapeHtml(plainText.trim()); return result; } + + public static String normalizeHtml(String html, double fontSizePt, double lineHeight) { + if (html == null || html.isEmpty()) return ""; + String cleaned = html + .replaceAll("font-size\\s*:[^;]+;?", "") + .replaceAll("line-height\\s*:[^;]+;?", ""); + // 🔑 10.5pt = 五号字 + return String.format( + "
%s
", + fontSizePt, lineHeight, cleaned + ); + } } diff --git a/src/main/java/io/v/nutz/base/utils/MsgApi.java b/src/main/java/io/v/nutz/base/utils/MsgApi.java index 1469d31..4dffe1e 100644 --- a/src/main/java/io/v/nutz/base/utils/MsgApi.java +++ b/src/main/java/io/v/nutz/base/utils/MsgApi.java @@ -10,6 +10,7 @@ import com.google.gson.JsonObject; import io.v.nutz.base.enums.Env; import io.v.nutz.web.commons.base.Globals; import io.v.nutz.web.commons.slog.annotation.SLog; +import io.v.nutz.zhgh.msgNotify.service.MsgNotifyService; import io.v.nutz.zhgh.staffmanage.birthday.model.UserBirthdayMsgLog; import io.v.nutz.zhgh.staffmanage.birthday.service.UserBirthdayMsgLogService; import lombok.extern.slf4j.Slf4j; @@ -54,6 +55,8 @@ public class MsgApi { private RedisService redisService; @Inject private UserBirthdayMsgLogService userBirthdayMsgLogService; + @Inject + private MsgNotifyService msgNotifyService; /** @@ -78,7 +81,7 @@ public class MsgApi { .filter(s -> !s.isEmpty()) .collect(Collectors.toList()); - sendMsgInternal(channels, loginNamesList, mtype, title, content, imageUrl, link, null); + sendMsgInternal(channels, loginNamesList, mtype, title, content, imageUrl, link, null,null); } /** @@ -93,20 +96,25 @@ public class MsgApi { */ @SLog(type = "api", tag = "消息发送", msg = "推送消息", param = true, result = true) public void sendMsg(List channels, List loginNameList, Integer mtype, String title, String content, String imageUrl, String link) { - sendMsgInternal(channels, loginNameList, mtype, title, content, imageUrl, link, null); + sendMsgInternal(channels, loginNameList, mtype, title, content, imageUrl, link, "other",null); + } + + @SLog(type = "api", tag = "消息发送", msg = "推送消息", param = true, result = true) + public void sendMsgInsertLog(List channels, List loginNameList, Integer mtype, String title, String content, String imageUrl, String link,String apiModule) { + sendMsgInternal(channels, loginNameList, mtype, title, content, imageUrl, link, "api",apiModule); } @SLog(type = "api", tag = "消息发送", msg = "推送消息", param = true, result = true) public void sendMsgByBirthday(List channels, List loginNameList, Integer mtype, String title, String content, String imageUrl, String link) { - sendMsgInternal(channels, loginNameList, mtype, title, content, imageUrl, link, "birthday"); + sendMsgInternal(channels, loginNameList, mtype, title, content, imageUrl, link, "birthday",null); } /** * 核心私有方法:统一处理消息发送逻辑 */ - private void sendMsgInternal(List channels, List loginNameList, Integer mtype, String title, String content, String imageUrl, String link, String type) { + private void sendMsgInternal(List channels, List loginNameList, Integer mtype, String title, String content, String imageUrl, String link, String type,String apiModule) { try { if (!Globals.MyConfig.getBoolean("SendMsg")) { log.info("发送失败,消息暂未开启!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); @@ -138,6 +146,8 @@ public class MsgApi { if ("birthday".equals(type)) { userBirthdayMsgLogService.insertLog(loginNameList, title, content, imageUrl, link); + } else if ("api".equals(type)) { + msgNotifyService.insertLog(loginNameList, title, content, link,apiModule); } } else { diff --git a/src/main/java/io/v/nutz/sys/controllers/platform/sys/club/applyIn/ClubApplyInController.java b/src/main/java/io/v/nutz/sys/controllers/platform/sys/club/applyIn/ClubApplyInController.java index aa56b81..c692186 100644 --- a/src/main/java/io/v/nutz/sys/controllers/platform/sys/club/applyIn/ClubApplyInController.java +++ b/src/main/java/io/v/nutz/sys/controllers/platform/sys/club/applyIn/ClubApplyInController.java @@ -1,9 +1,7 @@ package io.v.nutz.sys.controllers.platform.sys.club.applyIn; -import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.base.Result; -import cn.wizzer.framework.page.Pagination; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.service.BaseService; import io.v.nutz.base.utils.DateUtil; @@ -18,6 +16,7 @@ import io.v.nutz.sys.models.Sys_club_user; import io.v.nutz.sys.models.Sys_user; import io.v.nutz.sys.services.SysClubService; import io.v.nutz.sys.services.SysClubUserService; +import io.v.nutz.web.commons.base.Globals; import io.v.nutz.web.commons.utils.ShiroUtil; import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -27,7 +26,6 @@ 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.sql.SqlCallback; import org.nutz.dao.util.Daos; import org.nutz.dao.util.cri.SqlExpressionGroup; import org.nutz.dao.util.cri.Static; @@ -88,24 +86,24 @@ public class ClubApplyInController { @Param(value = "pageOrderBy", required = false) String pageOrderBy, @Param(value = "clubType", required = false) String clubType) { Sql sql = Sqls.create(""" - SELECT - club.*, - fzr.username fzrname, - unit.`name` fzr_unit_name, - (select yearAuditStatus from sys_club_user where clubid = club.id and userid = @userid and year(yearAudit) = @year and isNormal = true and yearAuditStatus is not null) as yearAuditStatus, - (select GROUP_CONCAT(username) from sys_user where id in (select userid from sys_club_user u where u.clubid=club.id and u.sf=1 and isNormal = true)) as hz, - (SELECT count( 1 ) FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.`status` = 5 and isNormal = true ) cynum, - (SELECT count( 1 ) FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.`status` in (1, 3) and isNormal = true) approvalnum, - (SELECT status FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.userid = @userid and isNormal = true) status, - (SELECT invite FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.userid = @userid and isNormal = true) invite, - (select count(*) from sys_user where userState='在职' and id in (select userid from sys_club_user where clubid = club.id and `status` = 5 and isNormal = true)) as worknum, - (select count(*) from sys_user where userState='退休' and id in (select userid from sys_club_user where clubid = club.id and `status` = 5 and isNormal = true)) as outnum - FROM - `sys_club` club - LEFT JOIN sys_user fzr ON club.concatPerson = fzr.id - LEFT JOIN sys_unit unit ON fzr.unitid = unit.id - $condition - """) + SELECT + club.*, + fzr.username fzrname, + unit.`name` fzr_unit_name, + (select yearAuditStatus from sys_club_user where clubid = club.id and userid = @userid and year(yearAudit) = @year and isNormal = true and yearAuditStatus is not null) as yearAuditStatus, + (select GROUP_CONCAT(username) from sys_user where id in (select userid from sys_club_user u where u.clubid=club.id and u.sf=1 and isNormal = true)) as hz, + (SELECT count( 1 ) FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.`status` = 5 and isNormal = true ) cynum, + (SELECT count( 1 ) FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.`status` in (1, 3) and isNormal = true) approvalnum, + (SELECT status FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.userid = @userid and isNormal = true) status, + (SELECT invite FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.userid = @userid and isNormal = true) invite, + (select count(*) from sys_user where userState='在职' and id in (select userid from sys_club_user where clubid = club.id and `status` = 5 and isNormal = true)) as worknum, + (select count(*) from sys_user where userState='退休' and id in (select userid from sys_club_user where clubid = club.id and `status` = 5 and isNormal = true)) as outnum + FROM + `sys_club` club + LEFT JOIN sys_user fzr ON club.concatPerson = fzr.id + LEFT JOIN sys_unit unit ON fzr.unitid = unit.id + $condition + """) .setParam("userid", ShiroUtil.getPrincipalProperty("id")) .setParam("year", cn.hutool.core.date.DateUtil.thisYear()); Cnd cnd = Cnd.NEW(); @@ -147,12 +145,12 @@ public class ClubApplyInController { public Object validApply() { //查询是否是会员 Sys_user sysUser = dao.fetch(Sys_user.class, ShiroUtil.getUserId()); - if(sysUser.getMember() != 1) { + if (sysUser.getMember() != 1) { return Result.error("您当前不是会员,无法申请"); } int count = dao.count(Sys_club_user.class, Cnd.where("userid", "=", ShiroUtil.getUserId()) .and("isNormal", "=", true).and("`status`", "in", List.of(1, 3, 5))); - if(count >= 3) { + if (count >= 3) { return Result.error("您已参与3个协会,无法申请"); } return Result.success(); @@ -166,7 +164,7 @@ public class ClubApplyInController { Sys_club sysClub = dao.fetch(Sys_club.class, sys_club_user.getClubid()); Sys_club_user sysClubUser = dao.fetch(Sys_club_user.class, Cnd.where("clubid", "=", sys_club_user.getClubid()).and("userid", "=", ShiroUtil.getUserId())); - if(sysClubUser == null) { + if (sysClubUser == null) { sys_club_user.setInvite(false); } else { sys_club_user.setInvite(sysClubUser.getInvite()); @@ -185,7 +183,7 @@ public class ClubApplyInController { sys_club_user.setGiveMoney(true); Sys_club_user clubUser = sysClubUserService.insert(sys_club_user); - if(!isInvite && sys_club_user.getStatus() != 5) { + if (!isInvite && sys_club_user.getStatus() != 5) { //插入后,发起待办流程 ClubUserApplyToDoHandler.START_PROCESS.exec(clubUser); //发任务给协会会长 @@ -195,21 +193,21 @@ public class ClubApplyInController { //根据协会id查询协会负责人,发短信 Sql sql = Sqls.create(""" - SELECT - u.loginname as loginName, - u.username as userName, - u.unitid as unitId, - u.unitname as unitName, - u.mobile, - c.`name` - FROM - sys_user_role r - LEFT JOIN - `user` u ON r.userId = u.id - LEFT JOIN - sys_club c ON c.id = r.stid - $condition - """); + SELECT + u.loginname as loginName, + u.username as userName, + u.unitid as unitId, + u.unitname as unitName, + u.mobile, + c.`name` + FROM + sys_user_role r + LEFT JOIN + `user` u ON r.userId = u.id + LEFT JOIN + sys_club c ON c.id = r.stid + $condition + """); Cnd cnd = Cnd.NEW(); cnd.and("stid", "=", sys_club_user.getClubid()); cnd.and("roleId", "in", Lang.array(Roles.club01, Roles.club02, Roles.club03, Roles.club04)); @@ -219,9 +217,9 @@ public class ClubApplyInController { String platformUsername = ShiroUtil.getPlatformUsername(); list.forEach(item -> { - String content = "%s老师您好,%s老师于%s申请加入%s,请登陆智慧工会进行审核!".formatted(item.getString("userName") - , platformUsername, dateTime, item.getString("name")); - //msgApi.sendWxMsg(person, content); + String content = "%s老师于%s申请加入%s,点击前往审核!".formatted(platformUsername, dateTime, item.getString("name")); + String link = Globals.AppDomain + "/platform/sys/club/sh/mobile"; + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(item.getString("loginName")), 2, "协会入会", content, null, link, "协会管理"); }); } return null; @@ -279,9 +277,9 @@ public class ClubApplyInController { String platformUsername = ShiroUtil.getPlatformUsername(); list.forEach(item -> { - String content = "%s老师您好,%s老师于%s撤销加入%s的申请!".formatted(item.getString("userName") + String content = "%s老师于%s撤销加入%s的申请!".formatted(item.getString("userName") , platformUsername, DateUtil.getDateTime(), item.getString("name")); - //msgApi.sendWxMsg(person, content); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(item.getString("loginName")), 1, "协会入会", content, null, null, "协会管理"); }); return null; } @@ -329,10 +327,10 @@ public class ClubApplyInController { WHERE c.id = @id """).setParam("id", id); NutMap map = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map()); - if(StrUtil.isNotBlank(map.getString("clubAuditId"))) { + if (StrUtil.isNotBlank(map.getString("clubAuditId"))) { map.put("clubAudit", dao.fetch(Audit.class, map.getString("clubAuditId"))); } - if(StrUtil.isNotBlank(map.getString("yearClubAuditId"))) { + if (StrUtil.isNotBlank(map.getString("yearClubAuditId"))) { map.put("yearAudit", dao.fetch(Audit.class, map.getString("yearClubAuditId"))); } return map; @@ -343,7 +341,7 @@ public class ClubApplyInController { @Aop(TransAop.READ_COMMITTED) @RequiresPermissions("sys.club.sq") public Object yearAudit(String id) { - if(StrUtil.isBlank(id)) { + if (StrUtil.isBlank(id)) { return Result.error("参数错误"); } dao.update(Sys_club_user.class, Chain.make("yearAudit", cn.hutool.core.date.DateUtil.now()).add("yearAuditStatus", 1), diff --git a/src/main/java/io/v/nutz/sys/controllers/platform/sys/club/regist/ClubMyApplyController.java b/src/main/java/io/v/nutz/sys/controllers/platform/sys/club/regist/ClubMyApplyController.java index 2d8a101..2549aeb 100644 --- a/src/main/java/io/v/nutz/sys/controllers/platform/sys/club/regist/ClubMyApplyController.java +++ b/src/main/java/io/v/nutz/sys/controllers/platform/sys/club/regist/ClubMyApplyController.java @@ -216,7 +216,7 @@ public class ClubMyApplyController { Sys_user sysUser = userMap.get(user); String content = "%s老师您好,欢迎加入%s,请进入入会申请进行确认!".formatted(sysUser.getUsername(), sysClub.getName()); String link = Globals.AppDomain + "/platform/sys/club/sq/mobile"; - msgApi.sendMsg(List.of("DingTalk"), user, 2, "协会入会邀请", content, "", link); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(sysUser.getLoginname()), 2, "协会入会邀请", content, "", link,"协会管理"); dao.update( Sys_club_user.class, diff --git a/src/main/java/io/v/nutz/sys/controllers/platform/sys/club/regist/ClubXghReplyController.java b/src/main/java/io/v/nutz/sys/controllers/platform/sys/club/regist/ClubXghReplyController.java index 00e8e72..89d1b7f 100644 --- a/src/main/java/io/v/nutz/sys/controllers/platform/sys/club/regist/ClubXghReplyController.java +++ b/src/main/java/io/v/nutz/sys/controllers/platform/sys/club/regist/ClubXghReplyController.java @@ -133,7 +133,7 @@ public class ClubXghReplyController { if(sysClubUser != null) { Sys_user sysUser = dao.fetch(Sys_user.class, sysClubUser.getUserid()); String content = "%s老师您好,您申请注册的%s已经审核通过。".formatted(sysUser.getUsername(), club.getName()); - msgApi.sendMsg(List.of("DingTalk"), sysUser.getLoginname(), 1, "协会注册", content, "", ""); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(sysUser.getLoginname()), 1, "协会注册", content, "", "","协会管理"); } } club.setXghAuditId(audit.getId()); diff --git a/src/main/java/io/v/nutz/task/job/sourcechange/SourceChangeJob.java b/src/main/java/io/v/nutz/task/job/sourcechange/SourceChangeJob.java index cd165c3..4d745c6 100644 --- a/src/main/java/io/v/nutz/task/job/sourcechange/SourceChangeJob.java +++ b/src/main/java/io/v/nutz/task/job/sourcechange/SourceChangeJob.java @@ -57,7 +57,7 @@ public class SourceChangeJob implements Job { }).collect(Collectors.joining(",")); String content = "智慧工会" + today + "数据更新汇总:" + updateDataStr; - msgApi.sendMsg(List.of("DingTalk"), "2004000022", 1, "数据更新汇总", content, "", ""); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of("2004000022"), 1, "数据更新汇总", content, "", "","人员管理"); } } } diff --git a/src/main/java/io/v/nutz/task/job/trainSingUp/SendMsgBeforeClassJob.java b/src/main/java/io/v/nutz/task/job/trainSingUp/SendMsgBeforeClassJob.java index 49e2798..017a9c5 100644 --- a/src/main/java/io/v/nutz/task/job/trainSingUp/SendMsgBeforeClassJob.java +++ b/src/main/java/io/v/nutz/task/job/trainSingUp/SendMsgBeforeClassJob.java @@ -90,9 +90,7 @@ public class SendMsgBeforeClassJob implements Job { item.getString("courseLocation") ); } - msgApi.sendMsg(List.of("DingTalk"), item.getString("loginname"), 1, "活动开始通知", content, "", ""); -// msgApi.sendWxMsg("温馨提醒","","text",content,List.of(item.getString("loginname")),""); -// sendMsg.pushWeChatMsg("温馨提醒", content, item.getString("loginname")); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(item.getString("loginname")), 1, "活动开始通知", content, "", "","心理咨询"); }); } diff --git a/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/controller/SuggestionBoxAdminController.java b/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/controller/SuggestionBoxAdminController.java new file mode 100644 index 0000000..85981f2 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/controller/SuggestionBoxAdminController.java @@ -0,0 +1,112 @@ +package io.v.nutz.zhgh.mobile.suggestionBox.controller; + +import cn.hutool.core.util.StrUtil; +import cn.wizzer.framework.base.Result; +import io.v.nutz.base.page.Pagination; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.mobile.suggestionBox.models.SuggestionBox; +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.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import java.time.LocalDateTime; +import java.util.Map; + +@IocBean +@At("/platform/suggestionBox/admin") +@Ok("json:full") +public class SuggestionBoxAdminController { + + @Inject + private Dao dao; + @Inject + private BaseService baseService; + + @At("/h5") + @Ok("beetl:/mobile/suggestionBox/admin.html") + public void h5() { + + } + + /** + * 分页数据 + * + * @param pageForm 分页 + * @param status 状态 是否回复 + * @param timeRange 时间范围 今日 本周 本月 + * @return + */ + @At("/pageData") + public Result pageData(PageForm pageForm, Integer status, String timeRange, String keyword) { + Sql sql = Sqls.create("select * from suggestion_box $condition"); + Cnd cnd = Cnd.NEW(); + cnd.andEX("isReply", "=", status); + if (StrUtil.isNotBlank(timeRange)) { + switch (timeRange) { + case "today": + cnd.and(new Static("DATE(submitTime) = CURDATE()")); + break; + case "week": + cnd.and(new Static("WEEKOFYEAR(submitTime) = WEEKOFYEAR(CURDATE())")); + break; + case "month": + cnd.and(new Static("MONTH(submitTime) = MONTH(CURDATE())")); + break; + default: + break; + } + } + if (StrUtil.isNotBlank(keyword)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.orLike("submitterName", keyword); + seg.orLike("content", keyword); + seg.orLike("title", keyword); + cnd.and(seg); + } + cnd.desc("submitTime"); + sql.setCondition(cnd); + Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return Result.success(pagination); + } + + /** + * 统计 + */ + @At("/getStats") + public Result stats() { + // 查询总意见数 + int total = dao.count(SuggestionBox.class); + // 待回复数 + int pending = dao.count(SuggestionBox.class, Cnd.where("isReply", "=", 0)); + // 已回复数 + int replied = dao.count(SuggestionBox.class, Cnd.where("isReply", "=", 1)); + // 今日新增 + int today = dao.count(SuggestionBox.class, Cnd.NEW().and(new Static("DATE(submitTime) = CURDATE()"))); + return Result.success(Map.of("total", total, "pending", pending, "replied", replied, "today", today)); + } + + /** + * 答复 + */ + @At + public Result reply(@Param("reply") SuggestionBox suggestionBox) { + suggestionBox.setIsReply(true); + suggestionBox.setReplyTime(LocalDateTime.now()); + suggestionBox.setReplyUserId(ShiroUtil.getUserId()); + suggestionBox.setReplyUserName((String) ShiroUtil.getPrincipalProperty("username")); + dao.update(suggestionBox,"isReply|replyContent|replyTime|replyUserId|replyUserName"); + return Result.success(); + } + + +} diff --git a/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/controller/SuggestionBoxController.java b/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/controller/SuggestionBoxController.java new file mode 100644 index 0000000..8a81c4f --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/controller/SuggestionBoxController.java @@ -0,0 +1,84 @@ +package io.v.nutz.zhgh.mobile.suggestionBox.controller; + +import cn.wizzer.framework.base.Result; +import io.v.nutz.base.page.Pagination; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.base.utils.MsgApi; +import io.v.nutz.web.commons.base.Globals; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.mobile.suggestionBox.models.SuggestionBox; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.ioc.loader.annotation.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.time.LocalDateTime; +import java.util.List; + +@IocBean +@At("/platform/suggestionBox") +@Ok("json:full") +public class SuggestionBoxController { + + @Inject + private Dao dao; + @Inject + private BaseService baseService; + + @Inject + private MsgApi msgApi; + + @At("/h5") + @Ok("beetl:/mobile/suggestionBox/index.html") + public void h5Index() { + + } + + @At("/h5/write") + @Ok("beetl:/mobile/suggestionBox/write.html") + public void h5Write() { + + } + + @At("/h5/mine") + @Ok("beetl:/mobile/suggestionBox/mine.html") + public void h5Mine() { + + } + + @At + public Result submit(@Param("suggestion") SuggestionBox suggestionBox) { + suggestionBox.setSubmitTime(LocalDateTime.now()); + dao.insert(suggestionBox); + String link = Globals.AppDomain + "/platform/suggestionBox/admin/h5"; + msgApi.sendMsgInsertLog(List.of("DingTalk"),List.of("2004000022"),2,"建言献策",ShiroUtil.getPlatformUsername()+"提交了一条建言献策待您回复","",link,"建言献策"); + return Result.success(); + } + + @At + public Result delete(@Param("id") String id) { + dao.delete(SuggestionBox.class, id); + return Result.success(); + } + + /** + * 我的意见列表 + */ + @At + public Result pageData(PageForm pageForm) { + Sql sql = Sqls.create("select * from suggestion_box $condition"); + Cnd cnd = Cnd.NEW(); + cnd.and("submitterId","=", ShiroUtil.getUserId()); + cnd.desc("submitTime"); + sql.setCondition(cnd); + Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return Result.success(pagination); + } + +} diff --git a/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/models/SuggestionBox.java b/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/models/SuggestionBox.java new file mode 100644 index 0000000..f32d79a --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/models/SuggestionBox.java @@ -0,0 +1,116 @@ +package io.v.nutz.zhgh.mobile.suggestionBox.models; + +import cn.wizzer.framework.base.model.BaseModel; +import io.v.nutz.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.time.LocalDateTime; +import java.util.List; + +@EqualsAndHashCode(callSuper = true) +@Table("suggestion_box") +@Comment("意见箱") +@Data +public class SuggestionBox extends BaseModel { + + @Name + @Comment("ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + @PrevInsert(uu32 = true) + private String id; + + @Column + @Comment("提交人ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String submitterId; + + @Column + @Comment("提交人姓名") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String submitterName; + + @Column + @Comment("提交人工号") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String submitterLoginName; + + @Column + @Comment("提交人单位ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String submitterUnitId; + + @Column + @Comment("提交人单位名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String submitterUnitName; + + @Column + @Comment("提交人分工会ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String submitterUnionId; + + @Column + @Comment("提交人分工会名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String submitterUnionName; + + @Column + @Comment("提交时间") + @ColDefine(type = ColType.DATETIME) + private LocalDateTime submitTime; + + @Column + @Comment("意见名称") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String title; + + @Column + @Comment("意见内容") + @ColDefine(type = ColType.TEXT) + private String content; + + @Column + @Comment("附件") + @ColDefine(type = ColType.MYSQL_JSON) + private List attachments; + + @Column + @Comment("联系方式") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String concat; + + @Column + @Comment("回复状态") + @ColDefine(type = ColType.BOOLEAN) + @Default("0") + private Boolean isReply; + + @Column + @Comment("回复内容") + @ColDefine(type = ColType.TEXT) + private String replyContent; + + @Column + @Comment("回复时间") + @ColDefine(type = ColType.DATETIME) + private LocalDateTime replyTime; + + @Column + @Comment("回复人ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String replyUserId; + + @Column + @Comment("回复人姓名") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String replyUserName; + + @Column + @Comment("回复附件") + @ColDefine(type = ColType.MYSQL_JSON) + private List replyAttachments; + +} diff --git a/src/main/java/io/v/nutz/zhgh/msgNotify/MsgNotifyController.java b/src/main/java/io/v/nutz/zhgh/msgNotify/MsgNotifyController.java index 9e6a7f0..48add0c 100644 --- a/src/main/java/io/v/nutz/zhgh/msgNotify/MsgNotifyController.java +++ b/src/main/java/io/v/nutz/zhgh/msgNotify/MsgNotifyController.java @@ -173,24 +173,23 @@ public class MsgNotifyController { if (msgNotify.getSendMode().equals("one")) { List list = msgNotifyService.getUserByRoleIds(msgNotify.getModule(), msgNotify.getTeacherMeetingId(), msgNotify.getRoleIds()); if (flag) { - msgNotifyService.sendMsg(msgNotify.getSendTypes(), list, msgNotify.getContent()); + List loginNames = list.stream().map(v -> v.getString("loginName")).toList(); + msgNotifyService.sendMsg2(msgNotify.getSendTypes(), loginNames, msgNotify.getContent(),msgNotify.getUrl(),msgNotify.getTitle()); } list.forEach(v -> { if (flag) { msgNotify.setSendTime(DateUtil.getDateTime()); - } msgNotifyUser.setUserId(v.getString("id")); msgNotifyUser.setTitleId(msgNotify.getId()); - dao.insert(msgNotifyUser); - }); + dao.insert(msgNotifyUser); } else if (msgNotify.getSendMode().equals("two")) { List userScopes = msgNotifyService.getUserScopes(msgNotify.getActivityGroupId()); if (flag) { List loginNames = userScopes.stream().map(v -> v.getString("loginName")).toList(); - msgNotifyService.sendMsg2(msgNotify.getSendTypes(), loginNames, msgNotify.getContent()); + msgNotifyService.sendMsg2(msgNotify.getSendTypes(), loginNames, msgNotify.getContent(),msgNotify.getUrl(),msgNotify.getTitle()); } userScopes.forEach(v -> { if (flag) { @@ -198,13 +197,13 @@ public class MsgNotifyController { } msgNotifyUser.setUserId(v.getString("id")); msgNotifyUser.setTitleId(msgNotify.getId()); - dao.insert(msgNotifyUser); }); + dao.insert(msgNotifyUser); } else if (msgNotify.getSendMode().equals("three")) { if (flag) { List user = dao.query(User.class, Cnd.where("id", "in", users)); List loginNames = user.stream().map(User::getLoginname).toList(); - msgNotifyService.sendMsg2(msgNotify.getSendTypes(), loginNames, msgNotify.getContent()); + msgNotifyService.sendMsg2(msgNotify.getSendTypes(), loginNames, msgNotify.getContent(),msgNotify.getUrl(),msgNotify.getTitle()); } for (String u : users) { if (flag) { @@ -212,23 +211,21 @@ public class MsgNotifyController { } msgNotifyUser.setUserId(u); msgNotifyUser.setTitleId(msgNotify.getId()); - dao.insert(msgNotifyUser); } + dao.insert(msgNotifyUser); } else if (msgNotify.getSendMode().equals("four")) { if (StrUtil.isNotBlank(existsLoginNameRedisKey)) { List loginNames = redisService.lrange(existsLoginNameRedisKey, 0, -1); List userList = dao.query(User.class, Cnd.where("loginname", "in", loginNames)); - List map = new ArrayList<>(); - for (User u : userList) { - map.add(NutMap.NEW().addv("userId", u.getLoginname()).addv("mobile", u.getMobile())); - } - msgNotifyService.sendMsg(msgNotify.getSendTypes(), map, msgNotify.getContent()); + + msgNotifyService.sendMsg2(msgNotify.getSendTypes(), loginNames, msgNotify.getContent(),msgNotify.getUrl(),msgNotify.getTitle()); + msgNotify.setSendTime(DateUtil.getDateTime()); for (User u : userList) { msgNotifyUser.setUserId(u.getId()); msgNotifyUser.setTitleId(msgNotify.getId()); - dao.insert(msgNotifyUser); } + dao.insert(msgNotifyUser); } } diff --git a/src/main/java/io/v/nutz/zhgh/msgNotify/MsgNotifyListController.java b/src/main/java/io/v/nutz/zhgh/msgNotify/MsgNotifyListController.java index 270af1c..3524671 100644 --- a/src/main/java/io/v/nutz/zhgh/msgNotify/MsgNotifyListController.java +++ b/src/main/java/io/v/nutz/zhgh/msgNotify/MsgNotifyListController.java @@ -1,8 +1,10 @@ package io.v.nutz.zhgh.msgNotify; import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.PageUtil; import io.v.nutz.zhgh.msgNotify.models.MsgNotify; import io.v.nutz.zhgh.msgNotify.models.MsgNotifyUser; import io.v.nutz.base.service.ViService; @@ -45,7 +47,7 @@ public class MsgNotifyListController { @ViReturn @RequiresPermissions("msgNotify.sendList") public Object pageData(PageForm pageForm, - @Param(value = "titleId", required = false)String titleId, + @Param(value = "titleId", required = false) String titleId, @Param(value = "dateRange", required = false) String[] dateRange, @Param(value = "unitId", required = false) String unitId, @Param(value = "unionId", required = false) String unionId, @@ -59,15 +61,12 @@ public class MsgNotifyListController { u.unionname, u.unitname, mnu.*, - mn.title, mn.activityGroupId, mn.module, mn.teacherMeetingId, mn.type, mn.roleIds, mn.sendTypes, - mn.content, - mn.sendTime, mn.hold FROM `msg_notify_user` mnu @@ -77,7 +76,7 @@ public class MsgNotifyListController { """); cnd.andEX("u.unionid", "=", unionId); cnd.andEX("u.unitid", "=", unitId); - cnd.andEX("mn.hold", "=", 1); + cnd.and("mnu.sendTime", "is not", null); cnd.andEX("mn.id", "=", titleId); if (!ShiroUtil.hasRole("sysadmin")) { cnd.and("mnu.userId", "=", ShiroUtil.getUserId()); @@ -96,8 +95,12 @@ public class MsgNotifyListController { cnd.and("mn.sendTime", "<=", dateRange[1]); } - cnd.desc("mn.sendTime"); - cnd.desc("u.unitname"); + if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) { + cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy())); + } else { + cnd.desc("mnu.sendTime").desc("u.unitname"); + } + sql.setCondition(cnd); return notifyViService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); } diff --git a/src/main/java/io/v/nutz/zhgh/msgNotify/models/MsgNotify.java b/src/main/java/io/v/nutz/zhgh/msgNotify/models/MsgNotify.java index a74f6f9..237b8b3 100644 --- a/src/main/java/io/v/nutz/zhgh/msgNotify/models/MsgNotify.java +++ b/src/main/java/io/v/nutz/zhgh/msgNotify/models/MsgNotify.java @@ -28,6 +28,11 @@ public class MsgNotify { @ColDefine(type = ColType.VARCHAR, width = 30) private String title; + @Column + @Comment("发送Url") + @ColDefine(type = ColType.VARCHAR, width = 30) + private String url; + @Column @Comment("发送对象") @ColDefine(type = ColType.VARCHAR, width = 32) @@ -70,6 +75,11 @@ public class MsgNotify { @ColDefine(type = ColType.VARCHAR, width = 1000) private String content; + @Column + @Comment("发送URL") + @ColDefine(type = ColType.VARCHAR, width = 500) + private String link; + @Column @Comment("创建时间") @ColDefine(type = ColType.VARCHAR, width = 1000) @@ -80,6 +90,7 @@ public class MsgNotify { @ColDefine(type = ColType.VARCHAR, width = 1000) private String sendTime; + @Column @Comment("是否保存") @ColDefine(type = ColType.BOOLEAN) diff --git a/src/main/java/io/v/nutz/zhgh/msgNotify/models/MsgNotifyUser.java b/src/main/java/io/v/nutz/zhgh/msgNotify/models/MsgNotifyUser.java index c6dbe15..8dfb2f0 100644 --- a/src/main/java/io/v/nutz/zhgh/msgNotify/models/MsgNotifyUser.java +++ b/src/main/java/io/v/nutz/zhgh/msgNotify/models/MsgNotifyUser.java @@ -36,11 +36,34 @@ public class MsgNotifyUser { @ColDefine(type = ColType.VARCHAR, width = 50) private String sendUser; - - @Column @Comment("标题id") @ColDefine(type = ColType.VARCHAR, width = 32) private String titleId; + @Column + @Comment("标题") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String title; + + @Column + @Comment("发送内容") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String content; + + @Column + @Comment("发送URL") + @ColDefine(type = ColType.VARCHAR, width = 500) + private String link; + + @Column + @Comment("发送时间") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String sendTime; + + @Column + @Comment("发送模块") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String apiModule; + } diff --git a/src/main/java/io/v/nutz/zhgh/msgNotify/service/MsgNotifyService.java b/src/main/java/io/v/nutz/zhgh/msgNotify/service/MsgNotifyService.java index ba521f0..371c029 100644 --- a/src/main/java/io/v/nutz/zhgh/msgNotify/service/MsgNotifyService.java +++ b/src/main/java/io/v/nutz/zhgh/msgNotify/service/MsgNotifyService.java @@ -49,7 +49,7 @@ public interface MsgNotifyService { */ void sendMsg(List sendTypes, List receivers, String content); - void sendMsg2(List sendTypes, List loginNames, String content); + void sendMsg2(List sendTypes, List loginNames, String content,String title,String url); /** @@ -73,4 +73,14 @@ public interface MsgNotifyService { List addMsgNotifyUser(MsgNotify msgNotify, String[] users); + /** + * 添加发送记录 + * @param loginNameList + * @param title + * @param content + * @param link + */ + void insertLog (List loginNameList, String title, String content, String link,String apiModule); + + } diff --git a/src/main/java/io/v/nutz/zhgh/msgNotify/service/impl/MsgNotifyServiceImpl.java b/src/main/java/io/v/nutz/zhgh/msgNotify/service/impl/MsgNotifyServiceImpl.java index be1193d..12d06bf 100644 --- a/src/main/java/io/v/nutz/zhgh/msgNotify/service/impl/MsgNotifyServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/msgNotify/service/impl/MsgNotifyServiceImpl.java @@ -1,6 +1,7 @@ package io.v.nutz.zhgh.msgNotify.service.impl; import cn.hutool.core.net.URLEncodeUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.URLUtil; import io.v.nutz.base.service.impl.ViServiceImpl; import io.v.nutz.base.utils.DateUtil; @@ -148,11 +149,9 @@ public class MsgNotifyServiceImpl extends ViServiceImpl implements Ms } @Override - public void sendMsg2(List sendTypes, List loginNames, String content) { + public void sendMsg2(List sendTypes, List loginNames, String content, String title, String url) { if (sendTypes.contains("DingTalk")) { - String url = URLUtil.encode("/file_server/fileStreamPreview?id=fa777e529921481c903c259115cc79e7"); - String link = Globals.AppDomain + "/assets/platform/plugins/pdfJs/web/viewer.html?file="+url; -// msgApi.sendMsg(sendTypes, loginNames, 2, "祝贺您获得家情共话观影券,请查收观影指南!", "电影券已发放,请查收指南!",null ,link); + msgApi.sendMsg(sendTypes, loginNames, StrUtil.isNotBlank(url) ? 2 : 1, title, content, null, url); } } @@ -269,5 +268,23 @@ public class MsgNotifyServiceImpl extends ViServiceImpl implements Ms return msgNotifyUserList; } + @Override + public void insertLog(List loginNameList, String title, String content, String link,String apiModule) { + List userList = dao().query(User.class, Cnd.where("loginname", "in", loginNameList)); + List msgNotifyUserList = new ArrayList<>(); + for (User v : userList) { + MsgNotifyUser msgNotifyUser = new MsgNotifyUser(); + msgNotifyUser.setSendUser(ShiroUtil.getUserId()); + msgNotifyUser.setUserId(v.getId()); + msgNotifyUser.setTitle(title); + msgNotifyUser.setLink(link); + msgNotifyUser.setContent(content); + msgNotifyUser.setSendTime(DateUtil.getDateTime()); + msgNotifyUser.setApiModule(apiModule); + msgNotifyUserList.add(msgNotifyUser); + } + dao().insert(msgNotifyUserList); + } + } diff --git a/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalBranchLeaderSuffixAuditController.java b/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalBranchLeaderSuffixAuditController.java index ae4380a..82233bd 100644 --- a/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalBranchLeaderSuffixAuditController.java +++ b/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalBranchLeaderSuffixAuditController.java @@ -331,11 +331,10 @@ public class ProposalBranchLeaderSuffixAuditController { if(user == null) { continue; } - String loginname = user.getLoginname(); if(content.contains("****") && StrUtil.isBlank(proposalId)) { content = content.replace("****", undertake.getUnitName()); } - msgApi.sendMsg(List.of("DingTalk"), loginname, 2, title, content, "", linkUrl); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(user.getLoginname()), 2, title, content, "", linkUrl,"提案管理"); } } return Result.success(); diff --git a/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalFeedbackScoreController.java b/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalFeedbackScoreController.java index fb8b5d4..c4b7e69 100644 --- a/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalFeedbackScoreController.java +++ b/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalFeedbackScoreController.java @@ -148,13 +148,13 @@ public class ProposalFeedbackScoreController { SqlExpressionGroup seg2 = new SqlExpressionGroup(); seg2.or("info.stateCode", ">=", ProposalState.FEEDBACKSCORE); - seg2.orGT("(select count(1) from proposal_reply pr where pr.proposalId = info.id and pr.undertakeType = 1)", 1); + seg2.orGT("(select count(1) from proposal_feedback pf where pf.proposalId = info.id = 1)", 1); cnd.and(Cnd.exps(seg).or(seg2)); } else if (search.getIsAudit().equals("true")) { SqlExpressionGroup seg = new SqlExpressionGroup(); - seg.or("info.stateCode", ">=", ProposalState.FEEDBACKSCORE); - seg.orGT("(select count(1) from proposal_reply pr where pr.proposalId = info.id and pr.undertakeType = 1)", 1); + seg.or("info.stateCode", ">", ProposalState.FEEDBACKSCORE); + seg.orGT("(select count(1) from proposal_feedback pf where pf.proposalId = info.id = 1)", 1); cnd.and(seg); } else if (search.getIsAudit().equals("false")) { cnd.and("info.stateCode", "=", ProposalState.FEEDBACKSCORE); @@ -444,9 +444,8 @@ public class ProposalFeedbackScoreController { String linkUrl = Globals.AppDomain + "/platform/proposal/transact/feedback"; for (NutMap user : list) { - String loginname = user.getString("loginname"); System.out.println(JSONUtil.toJsonStr(user)); - msgApi.sendMsg(List.of("DingTalk"), loginname, 2, title, content, "", linkUrl); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(user.getString("loginname")), 2, title, content, "", linkUrl,"提案管理"); } return Result.success(); } catch (Exception e) { diff --git a/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalMineController.java b/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalMineController.java index aedf3c8..bd986d1 100644 --- a/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalMineController.java +++ b/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalMineController.java @@ -244,7 +244,7 @@ public class ProposalMineController { String template = "{}代表,您好,{}代表的提案《{}》邀请您作为附议人,请您点击此消息或登录“智慧工会”系统进行附议,感谢您对教代会提案工作的大力支持!"; String content = StrUtil.format(template, user.getUsername(), sysUser.getUsername(), proposalInfo.getProposalName()); System.out.println(content); - msgApi.sendMsg(List.of("DingTalk"), user.getLoginname(), 2, "提案附议邀请", content, "", linkUrl); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(user.getLoginname()), 2, "提案附议邀请", content, "", linkUrl,"提案管理"); } ProposalToDoHandler.CREATE_SECONDED_TASK.exec(proposalId, NutMap.NEW().addv("secondedList", secondedList)); @@ -548,7 +548,7 @@ public class ProposalMineController { String template = "{}代表,您好,您附议的提案《{}》已被{}代表(起草人)撤回重新修改,特此告知,烦请知悉。感谢您对教代会提案工作的大力支持!"; String content = StrUtil.format(template, map.getString("username"), userMap.getString("proposalName"), userMap.getString("username")); - msgApi.sendMsg(List.of("DingTalk"), map.getString("loginname"), 1, "提案重新起草通知", content, "", ""); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(map.getString("loginname")), 1, "提案重新起草通知", content, "", "","提案管理"); } } @@ -557,7 +557,7 @@ public class ProposalMineController { String template = "{}代表,您好,您附议的提案《{}》已被{}代表(起草人)撤回重新修改,您已无需附议。特此告知,烦请知悉。感谢您对教代会提案工作的大力支持!"; String content = StrUtil.format(template, map.getString("username"), userMap.getString("proposalName"), userMap.getString("username")); - msgApi.sendMsg(List.of("DingTalk"), map.getString("loginname"), 1, "提案无需附议通知", content, "", ""); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(map.getString("loginname")), 1, "提案无需附议通知", content, "", "","提案管理"); } } diff --git a/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalReplyController.java b/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalReplyController.java index 29aba0a..5319e14 100644 --- a/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalReplyController.java +++ b/src/main/java/io/v/nutz/zhgh/proposal/controller/transact/ProposalReplyController.java @@ -245,7 +245,7 @@ public class ProposalReplyController { for (NutMap reply : replyList) { String loginname = reply.getString("loginname"); System.out.println(JSONUtil.toJsonStr(reply)); - msgApi.sendMsg(List.of("DingTalk"), loginname, 2, title, content, "", linkUrl); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(loginname), 2, title, content, "", linkUrl,"提案管理"); } return Result.success(); } catch (Exception e) { @@ -292,7 +292,7 @@ public class ProposalReplyController { // 发送消息提醒 Sys_user proxyUser = dao.fetch(Sys_user.class, proxyUserId); String msgContent = "{}您好!您有一条转交的提案待办理,请点击消息办理。"; - msgApi.sendMsg(List.of("DingTalk"), proxyUser.getLoginname(), 2, "提案转交办理", StrUtil.format(msgContent, proxyUser.getUsername()), "", Globals.AppDomain + "/platform/proposal/transact/reply"); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(proxyUser.getLoginname()), 2, "提案转交办理", StrUtil.format(msgContent, proxyUser.getUsername()), "", Globals.AppDomain + "/platform/proposal/transact/reply","提案管理"); ProposalToDoHandler.CREATE_UNDERTAKE_PROXY_TASK.exec(proposalId, NutMap.NEW().addv("reply_forward", replyForward)); diff --git a/src/main/java/io/v/nutz/zhgh/proposal/services/impl/ProposalExportServiceImpl.java b/src/main/java/io/v/nutz/zhgh/proposal/services/impl/ProposalExportServiceImpl.java index 13f8d8c..d64816a 100644 --- a/src/main/java/io/v/nutz/zhgh/proposal/services/impl/ProposalExportServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/proposal/services/impl/ProposalExportServiceImpl.java @@ -8,12 +8,15 @@ import com.deepoove.poi.policy.HackLoopTableRenderPolicy; import io.v.nutz.base.service.impl.BaseServiceImpl; import io.v.nutz.base.utils.Html2Text; import io.v.nutz.base.utils.OfficeTemplateUtil; +import io.v.nutz.base.utils.Vi; import io.v.nutz.zhgh.proposal.services.ProposalExportService; import io.v.nutz.zhgh.proposal.services.ProposalInfoService; import io.v.nutz.sys.models.Sys_signature; import io.v.nutz.web.commons.base.Globals; import lombok.extern.slf4j.Slf4j; import org.ddr.poi.html.HtmlRenderPolicy; +import org.ddr.poi.html.util.CSSLength; +import org.ddr.poi.html.util.CSSLengthUnit; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; @@ -26,6 +29,7 @@ import org.nutz.json.Json; import org.nutz.lang.Lang; import org.nutz.lang.Strings; import org.nutz.lang.util.NutMap; + import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @@ -158,7 +162,7 @@ public class ProposalExportServiceImpl extends BaseServiceImpl implements Propos LEFT JOIN sys_signature sign ON sign.id = pa.signId LEFT JOIN sys_dict dict ON pa.other = dict.`code` $condition - """); + """); delegationCnd.where().andIn("pa.id", delegationAuditIds); delegationAuditSql.setCondition(delegationCnd); delegationAuditList = proposalInfoService.listMap(delegationAuditSql); @@ -176,14 +180,14 @@ public class ProposalExportServiceImpl extends BaseServiceImpl implements Propos List oneAuditRecordList = new ArrayList<>(); if (StrUtil.isNotBlank(nutMap.getString("caseAuditId"))) { Sql oneAuditRecordSql = Sqls.create(""" - SELECT - pa.*, - sign.`data` auditSign - FROM - proposal_audit pa - LEFT JOIN sys_signature sign ON sign.id = pa.signId - where pa.id in (@id) - """).setParam("id", Json.fromJsonAsList(String.class, nutMap.getString("caseAuditId"))); + SELECT + pa.*, + sign.`data` auditSign + FROM + proposal_audit pa + LEFT JOIN sys_signature sign ON sign.id = pa.signId + where pa.id in (@id) + """).setParam("id", Json.fromJsonAsList(String.class, nutMap.getString("caseAuditId"))); oneAuditRecordList = proposalInfoService.listMap(oneAuditRecordSql); if (Lang.isNotEmpty(oneAuditRecordList)) { oneAuditRecordList.forEach(v -> { @@ -218,7 +222,7 @@ public class ProposalExportServiceImpl extends BaseServiceImpl implements Propos LEFT JOIN sys_signature sign ON sign.id = pa.signId LEFT JOIN sys_dict dict ON pa.other = dict.`code` WHERE pa.id in (@ids) - """).setParam("ids", branchCaseArray); + """).setParam("ids", branchCaseArray); replyAuditList = proposalInfoService.listMap(replyAuditSql); } @@ -377,21 +381,31 @@ public class ProposalExportServiceImpl extends BaseServiceImpl implements Propos if (Lang.isNotEmpty(feedbackList)) { for (NutMap map : feedbackList) { if (map.getString("feedbackResult").equals("满意")) { - map.setv("feedbackResult", "1.满意(√)2.较满意()3.不满意()"); + map.setv("feedbackResult", "1.满意(√)2.比较满意()3.基本满意()4.不满意()"); } else if (map.getString("feedbackResult").equals("比较满意")) { - map.setv("feedbackResult", "1.满意()2.较满意(√)3.不满意()"); + map.setv("feedbackResult", "1.满意()2.比较满意(√)3.基本满意()4.不满意()"); + } else if (map.getString("feedbackResult").equals("基本满意")) { + map.setv("feedbackResult", "1.满意()2.比较满意()3.基本满意(√)4.不满意()"); } else { - map.setv("feedbackResult", "1.满意()2.较满意()3.不满意(√)"); + map.setv("feedbackResult", "1.满意()2.比较满意()3.基本满意()4.不满意(√)"); } map.setv("feedbackOpinion", Html2Text.toPlainText(map.getString("feedbackOpinion"))); } } + nutMap.setv("brief", Html2Text.normalizeHtml(nutMap.getString("brief"), 10.5, 1.2)); + nutMap.setv("measures", Html2Text.normalizeHtml(nutMap.getString("measures"), 10.5, 1.2)); HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy(); HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy(); htmlRenderPolicy.getConfig().setShowDefaultTableBorderInTableCell(true); + htmlRenderPolicy.getConfig().setGlobalFontSize(new CSSLength(10.5, CSSLengthUnit.PT)); + htmlRenderPolicy.getConfig().setGlobalFont("宋体"); - Configure config = Configure.newBuilder().bind("secondedList", policy).bind("proposal.brief", htmlRenderPolicy).bind("proposal.measures", htmlRenderPolicy).build(); + Configure poiConfig = Configure.newBuilder() + .bind("secondedList", policy) + .bind("proposal.brief", htmlRenderPolicy) + .bind("proposal.measures", htmlRenderPolicy) + .build(); HashMap map = new HashMap<>(); map.put("proposal", nutMap); map.put("schoolName", Globals.MyConfig.getString("GxName")); @@ -408,7 +422,7 @@ public class ProposalExportServiceImpl extends BaseServiceImpl implements Propos String templateUrl = StrUtil.isBlank(nutMap.getString("hostUnitName")) ? officeTemplateUtil.getPath("proposal_info") : officeTemplateUtil.getPath("proposal_host_help_unit"); - XWPFTemplate.compile(templateUrl, config).render(map).writeAndClose(outputStream); + XWPFTemplate.compile(templateUrl, poiConfig).render(map).writeAndClose(outputStream); } private PictureRenderData getImg(String base64) throws IOException { @@ -416,4 +430,6 @@ public class ProposalExportServiceImpl extends BaseServiceImpl implements Propos byte[] bytes = Base64.getDecoder().decode(s); return new PictureRenderData(70, 30, ".png", bytes); } + + } diff --git a/src/main/java/io/v/nutz/zhgh/proposal/services/impl/ProposalReplyServiceImpl.java b/src/main/java/io/v/nutz/zhgh/proposal/services/impl/ProposalReplyServiceImpl.java index 76443d8..631cb68 100644 --- a/src/main/java/io/v/nutz/zhgh/proposal/services/impl/ProposalReplyServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/proposal/services/impl/ProposalReplyServiceImpl.java @@ -340,7 +340,7 @@ public class ProposalReplyServiceImpl extends ViServiceImpl imple // 提醒一把手 List underTakeLeader = proposalCommonService.getUnderTakeLeader(reply.getReplyUnitId()); String msgContent = "您转交的提案已由转交人办理完成,请您及时提交提案办理内容!"; - msgApi.sendMsg(List.of("DingTalk"),underTakeLeader, 2, "转交答复完成", msgContent, "", Globals.AppDomain + "/platform/proposal/transact/reply"); + msgApi.sendMsgInsertLog(List.of("DingTalk"),underTakeLeader, 2, "转交答复完成", msgContent, "", Globals.AppDomain + "/platform/proposal/transact/reply","提案管理"); return; @@ -378,7 +378,7 @@ public class ProposalReplyServiceImpl extends ViServiceImpl imple // 发送短信 List underTakeSchoolLeader = proposalCommonService.getUnderTakeSchoolLeader(leaderSuffixAudit.getUnderTakeId()); String msgContent = "校领导,您分管部门承办的提案(建议)已提交办理结果,请您审核!"; - msgApi.sendMsg(List.of("DingTalk"), underTakeSchoolLeader, 2, "提案校领导审批", msgContent, "", Globals.AppDomain + "/platform/proposal/transact/branchLeaderSuffixAudit"); + msgApi.sendMsgInsertLog(List.of("DingTalk"), underTakeSchoolLeader, 2, "提案校领导审批", msgContent, "", Globals.AppDomain + "/platform/proposal/transact/branchLeaderSuffixAudit","提案管理"); } else { proposalInfo.setStateCode(ProposalState.FINISH); //流程完结 diff --git a/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/apply/MemberApplyBranchUnionAuditController.java b/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/apply/MemberApplyBranchUnionAuditController.java index 0551a70..6811629 100644 --- a/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/apply/MemberApplyBranchUnionAuditController.java +++ b/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/apply/MemberApplyBranchUnionAuditController.java @@ -184,7 +184,7 @@ public class MemberApplyBranchUnionAuditController { String content = "亲爱的%s老师:欢迎您加入杭州医学院大家庭!您的工会关系在%s,愿您在这个充满活力的集体中,感受“家”的温馨,汇聚“爱”的力量。学校工会将始终陪伴在您身边,竭诚为您服务,期待与您携手同行,共同书写属于“杭医人”的精彩!" .formatted(user.getUsername(), union.getUnionname()); System.out.println(content); - msgApi.sendMsg(List.of("DingTalk"), record.getLoginname(), 1, "", content, "", ""); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(record.getLoginname()), 1, "", content, "", "","人员管理"); } else { // 杭州医学院,分工会拒绝接收,还要去创建校工会的审核任务 MemberApplyToDoHandler.REFUSE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会拒绝接收")); @@ -193,7 +193,7 @@ public class MemberApplyBranchUnionAuditController { .formatted(union.getUnionname(), record.getUsername(), audit.getAuditOpinion()); String linkUrl = Globals.AppDomain + "/platform/member/apply/schoolUnion/audit/h5"; System.out.println(content); - msgApi.sendMsg(List.of("DingTalk"), record.getLoginname(), 2, "入会结果通知", content, "", linkUrl); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(record.getLoginname()), 2, "入会结果通知", content, "", linkUrl,"人员管理"); } return null; } diff --git a/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/apply/MemberApplyController.java b/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/apply/MemberApplyController.java index c449806..aa953e4 100644 --- a/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/apply/MemberApplyController.java +++ b/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/apply/MemberApplyController.java @@ -144,7 +144,7 @@ public class MemberApplyController { String content = "%s老师正申请加入工会,请您点击此条消息或登录“智慧工会”进行审核".formatted(record.getUsername()); String linkUrl = Globals.AppDomain + "/platform/member/apply/schoolUnion/audit/h5"; - msgApi.sendMsg(List.of("DingTalk"), schoolLoginNameListStr, 2, "入会审核通知", content, "", linkUrl); + msgApi.sendMsgInsertLog(List.of("DingTalk"), schoolLoginNameList, 2, "入会审核通知", content, "", linkUrl,"人员管理"); return null; } diff --git a/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/apply/MemberApplySchoolUnionAuditController.java b/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/apply/MemberApplySchoolUnionAuditController.java index d90fac9..1674e20 100644 --- a/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/apply/MemberApplySchoolUnionAuditController.java +++ b/src/main/java/io/v/nutz/zhgh/staffmanage/member/controller/apply/MemberApplySchoolUnionAuditController.java @@ -156,7 +156,7 @@ public class MemberApplySchoolUnionAuditController { String content = "%s,%s老师的入会申请已经通过校工会审核,现将工会关系转入您处,请点击此消息或登录“智慧工会”办理新会员接收手续。" .formatted(unionname, record.getUsername()); System.out.println(content); - msgApi.sendMsg(List.of("DingTalk"), map.getString("loginname"), 2, "会员入会审核通知", content, "", linkUrl); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(map.getString("loginname")), 2, "会员入会审核通知", content, "", linkUrl,"人员管理"); } } } else { @@ -164,7 +164,7 @@ public class MemberApplySchoolUnionAuditController { // 短信通知 String content = "尊敬的%s老师,您的入会申请未被通过,若有疑问请联系校工会,联系电话87692636".formatted(record.getUsername()); System.out.println(content); - msgApi.sendMsg(List.of("DingTalk"), record.getLoginname(), 1, "会员入会结果通知", content, "", ""); + msgApi.sendMsgInsertLog(List.of("DingTalk"), List.of(record.getLoginname()), 1, "会员入会结果通知", content, "", "","人员管理"); } return null; } diff --git a/src/main/java/io/v/nutz/zhgh/staffmanage/sourcechange/service/impl/SourceChangeManageServiceImpl.java b/src/main/java/io/v/nutz/zhgh/staffmanage/sourcechange/service/impl/SourceChangeManageServiceImpl.java index f7134a5..31321a3 100644 --- a/src/main/java/io/v/nutz/zhgh/staffmanage/sourcechange/service/impl/SourceChangeManageServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/staffmanage/sourcechange/service/impl/SourceChangeManageServiceImpl.java @@ -286,7 +286,7 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl userList = listService.listMap(sql); - Set loginNameList = userList.stream().map(user -> user.getString("loginname")).collect(Collectors.toSet()); - String loginNames = String.join(",", loginNameList); + List loginNameList = userList.stream() + .map(user -> user.getString("loginname")) + .distinct() + .toList(); // WelfareProject project = dao.fetch(WelfareProject.class, projectId); String link = Globals.AppDomain + "/mobile/welfare/list/receive?projectId=%s".formatted(projectId); // String imageUrl = Globals.AppDomain + "/file_server/fileStreamPreview?id=" + project.getCover(); // msgApi.sendMsg(List.of("DingTalk"), loginNames, 2, "职工福利", sendMsgValue, "", link); if ("51e3449b5f234dd58757de63142d6b48".equals(projectId)) { - msgApi.sendMsg(List.of("DingTalk"), loginNames, 2, "答题纪念品!点开有惊喜!", sendMsgValue, "", link); + msgApi.sendMsgInsertLog(List.of("DingTalk"), loginNameList, 2, "答题纪念品!点开有惊喜!", sendMsgValue, "", link,"职工福利"); } else { - msgApi.sendMsg(List.of("DingTalk"), loginNames, 2, title, sendMsgValue, "", link); + msgApi.sendMsgInsertLog(List.of("DingTalk"), loginNameList, 2, title, sendMsgValue, "", link,"职工福利"); } return null; } diff --git a/src/main/java/io/v/nutz/zhgh/welfare/controller/evaluate/WelfareEvaluateActivityController.java b/src/main/java/io/v/nutz/zhgh/welfare/controller/evaluate/WelfareEvaluateActivityController.java index f81009a..4ccac2d 100644 --- a/src/main/java/io/v/nutz/zhgh/welfare/controller/evaluate/WelfareEvaluateActivityController.java +++ b/src/main/java/io/v/nutz/zhgh/welfare/controller/evaluate/WelfareEvaluateActivityController.java @@ -245,7 +245,7 @@ public class WelfareEvaluateActivityController { System.out.println(loginNames); String link = Globals.AppDomain + "/platform/h5/welfare/evaluate?id=%s&type=welfare".formatted(activityId); - msgApi.sendMsg(List.of("DingTalk"), loginNames, 2, title, sendMsgValue, "", link); + msgApi.sendMsgInsertLog(List.of("DingTalk"), loginNames, 2, title, sendMsgValue, "", link,"职工福利"); return Result.success(); } catch (Exception e) { e.printStackTrace(); diff --git a/src/main/resources/static/components/msgNotify/msgNotify.vue b/src/main/resources/static/components/msgNotify/msgNotify.vue index 04bf3da..639f2ff 100644 --- a/src/main/resources/static/components/msgNotify/msgNotify.vue +++ b/src/main/resources/static/components/msgNotify/msgNotify.vue @@ -1,12 +1,12 @@