|
@@ -26,9 +26,21 @@ import org.apache.groovy.util.Maps;
|
|
|
* @since 2024/7/26
|
|
|
*/
|
|
|
public final class TaskImUtil{
|
|
|
- private static final String appId = "taskInfo";
|
|
|
+ private static final String TaskInfoAppId = "taskInfo";
|
|
|
|
|
|
- private static final String appName = "检察工作任务";
|
|
|
+ private static final String TaskInfoAppName = "检察工作任务";
|
|
|
+
|
|
|
+ private static final String TaskExpireAppId = "taskExpire";
|
|
|
+
|
|
|
+ private static final String TaskExpireAppName = "即将超期";
|
|
|
+
|
|
|
+ private static final String TaskOverdueAppId = "taskOverdue";
|
|
|
+
|
|
|
+ private static final String TaskOverdueAppName = "未完成";
|
|
|
+
|
|
|
+ private static final String TaskLeaderInstructionAppId = "taskLeaderInstruction";
|
|
|
+
|
|
|
+ private static final String TaskLeaderInstructionAppName = "领导批示";
|
|
|
|
|
|
private static IWorkProService workProService;
|
|
|
|
|
@@ -52,31 +64,106 @@ public final class TaskImUtil{
|
|
|
return orgManager;
|
|
|
}
|
|
|
|
|
|
- public static void sendMessage(TaskSummaryBean taskSummary, Date sendTime, String content, Long[] personIds){
|
|
|
- List<OrgPersonBean> persons = getOrgManager().findPersonsById(List.of(personIds));
|
|
|
- sendMessage(taskSummary, sendTime, content, persons);
|
|
|
+ public static void sendTaskInfoMessage(TaskSummaryBean taskSummary, Date sendTime, String content, Long personId){
|
|
|
+ OrgPersonBean person = getOrgManager().findPersonById(personId);
|
|
|
+ sendTaskInfoMessage(taskSummary, sendTime, content, person);
|
|
|
}
|
|
|
|
|
|
- public static void sendMessage(TaskSummaryBean taskSummary, Date sendTime, String content,
|
|
|
- List<OrgPersonBean> persons){
|
|
|
- for(OrgPersonBean e : persons){
|
|
|
- sendMessage(taskSummary, sendTime, content, e);
|
|
|
- }
|
|
|
+ public static void sendTaskInfoMessage(TaskSummaryBean taskSummary, Date sendTime, String content,
|
|
|
+ OrgPersonBean person){
|
|
|
+ String url = taskDetailUrl(taskSummary.getId(), person.getId());
|
|
|
+ List<Map<String, String>> recver = List.of(
|
|
|
+ Maps.of("id", String.valueOf(person.getId()), "name", person.getPname()));
|
|
|
+ Map<String, String> refer = Maps.of("id", TaskInfoAppId, "name", TaskInfoAppName, "avatar",
|
|
|
+ getBaseUrl() + "/org/corp/" + person.getOrgCorporationId() + "/?m=cicon");
|
|
|
+ Map<String, Object> extdata = new HashMap<>();
|
|
|
+ extdata.put("header", List.of(Maps.of("title", "任务通知")));
|
|
|
+ // extdata.put("header", List.of(Maps.of("title", "任务通知"),
|
|
|
+ // Maps.of("title", "2016-1-1 12:12:12", "color", "#999999", "size", "s")));
|
|
|
+ extdata.put("body",
|
|
|
+ List.of(Maps.of("title", content), Maps.of("title", DateUtil.format(sendTime, "yyyy-MM-dd HH:mm:ss"))));
|
|
|
+ // extdata.put("body", List.of(Maps.of("title", content), Maps.of("label", "取件码", "title", "111111"),
|
|
|
+ // Maps.of("label", "快递公司", "title", "申通快递")));
|
|
|
+ extdata.put("footer", Maps.of("title", "查看详情"));
|
|
|
+ extdata.put("target", Maps.of("url_mobile", url, "url_pc", url, "opentype", "1"));
|
|
|
+ extdata.put("obj", Maps.of("type", "oa", "id", "1111", "s_type", "", "create_uid", ""));
|
|
|
+
|
|
|
+ MessageSendMsgFormview formview = new MessageSendMsgFormview(recver, "3", refer, "2", content, extdata);
|
|
|
+ getWorkProService().callApi(formview);
|
|
|
}
|
|
|
|
|
|
- public static void sendMessage(TaskSummaryBean taskSummary, Date sendTime, String content, Long personId){
|
|
|
+ public static void sendTaskExpireMessage(TaskSummaryBean taskSummary, Date sendTime, String content, Long personId){
|
|
|
OrgPersonBean person = getOrgManager().findPersonById(personId);
|
|
|
- sendMessage(taskSummary, sendTime, content, person);
|
|
|
+ sendTaskExpireMessage(taskSummary, sendTime, content, person);
|
|
|
}
|
|
|
|
|
|
- public static void sendMessage(TaskSummaryBean taskSummary, Date sendTime, String content, OrgPersonBean person){
|
|
|
+ public static void sendTaskExpireMessage(TaskSummaryBean taskSummary, Date sendTime, String content,
|
|
|
+ OrgPersonBean person){
|
|
|
String url = taskDetailUrl(taskSummary.getId(), person.getId());
|
|
|
List<Map<String, String>> recver = List.of(
|
|
|
Maps.of("id", String.valueOf(person.getId()), "name", person.getPname()));
|
|
|
- Map<String, String> refer = Maps.of("id", appId, "name", appName, "avatar",
|
|
|
- getBaseUrl() + "/org/corp/" + person.getOrgCorporationId() + "/?m=cicon");
|
|
|
+ Map<String, String> refer = Maps.of("id", TaskExpireAppId, "name", TaskExpireAppName, "avatar",
|
|
|
+ getBaseUrl() + "/tc_suite/hintlamp/yellow1.png");
|
|
|
Map<String, Object> extdata = new HashMap<>();
|
|
|
- extdata.put("header", List.of(Maps.of("title", "任务通知")));
|
|
|
+ extdata.put("header", List.of(Maps.of("title", "任务即将超期通知")));
|
|
|
+ // extdata.put("header", List.of(Maps.of("title", "任务通知"),
|
|
|
+ // Maps.of("title", "2016-1-1 12:12:12", "color", "#999999", "size", "s")));
|
|
|
+ extdata.put("body",
|
|
|
+ List.of(Maps.of("title", content), Maps.of("title", DateUtil.format(sendTime, "yyyy-MM-dd HH:mm:ss"))));
|
|
|
+ // extdata.put("body", List.of(Maps.of("title", content), Maps.of("label", "取件码", "title", "111111"),
|
|
|
+ // Maps.of("label", "快递公司", "title", "申通快递")));
|
|
|
+ extdata.put("footer", Maps.of("title", "查看详情"));
|
|
|
+ extdata.put("target", Maps.of("url_mobile", url, "url_pc", url, "opentype", "1"));
|
|
|
+ extdata.put("obj", Maps.of("type", "oa", "id", "1111", "s_type", "", "create_uid", ""));
|
|
|
+
|
|
|
+ MessageSendMsgFormview formview = new MessageSendMsgFormview(recver, "3", refer, "2", content, extdata);
|
|
|
+ getWorkProService().callApi(formview);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void sendTaskOverdueMessage(TaskSummaryBean taskSummary, Date sendTime, String content,
|
|
|
+ Long personId){
|
|
|
+ OrgPersonBean person = getOrgManager().findPersonById(personId);
|
|
|
+ sendTaskOverdueMessage(taskSummary, sendTime, content, person);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void sendTaskOverdueMessage(TaskSummaryBean taskSummary, Date sendTime, String content,
|
|
|
+ OrgPersonBean person){
|
|
|
+ String url = taskDetailUrl(taskSummary.getId(), person.getId());
|
|
|
+ List<Map<String, String>> recver = List.of(
|
|
|
+ Maps.of("id", String.valueOf(person.getId()), "name", person.getPname()));
|
|
|
+ Map<String, String> refer = Maps.of("id", TaskOverdueAppId, "name", TaskOverdueAppName, "avatar",
|
|
|
+ getBaseUrl() + "/tc_suite/hintlamp/red1.png");
|
|
|
+ Map<String, Object> extdata = new HashMap<>();
|
|
|
+ extdata.put("header", List.of(Maps.of("title", "任务超期未完成通知")));
|
|
|
+ // extdata.put("header", List.of(Maps.of("title", "任务通知"),
|
|
|
+ // Maps.of("title", "2016-1-1 12:12:12", "color", "#999999", "size", "s")));
|
|
|
+ extdata.put("body",
|
|
|
+ List.of(Maps.of("title", content), Maps.of("title", DateUtil.format(sendTime, "yyyy-MM-dd HH:mm:ss"))));
|
|
|
+ // extdata.put("body", List.of(Maps.of("title", content), Maps.of("label", "取件码", "title", "111111"),
|
|
|
+ // Maps.of("label", "快递公司", "title", "申通快递")));
|
|
|
+ extdata.put("footer", Maps.of("title", "查看详情"));
|
|
|
+ extdata.put("target", Maps.of("url_mobile", url, "url_pc", url, "opentype", "1"));
|
|
|
+ extdata.put("obj", Maps.of("type", "oa", "id", "1111", "s_type", "", "create_uid", ""));
|
|
|
+
|
|
|
+ MessageSendMsgFormview formview = new MessageSendMsgFormview(recver, "3", refer, "2", content, extdata);
|
|
|
+ getWorkProService().callApi(formview);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void sendTaskLeaderInstructionMessage(TaskSummaryBean taskSummary, Date sendTime, String content,
|
|
|
+ Long personId){
|
|
|
+ OrgPersonBean person = getOrgManager().findPersonById(personId);
|
|
|
+ sendTaskLeaderInstructionMessage(taskSummary, sendTime, content, person);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void sendTaskLeaderInstructionMessage(TaskSummaryBean taskSummary, Date sendTime, String content,
|
|
|
+ OrgPersonBean person){
|
|
|
+ String url = taskDetailUrl(taskSummary.getId(), person.getId());
|
|
|
+ List<Map<String, String>> recver = List.of(
|
|
|
+ Maps.of("id", String.valueOf(person.getId()), "name", person.getPname()));
|
|
|
+ Map<String, String> refer = Maps.of("id", TaskLeaderInstructionAppId, "name", TaskLeaderInstructionAppName,
|
|
|
+ "avatar", getBaseUrl() + "/tc_suite/hintlamp/blue1.png");
|
|
|
+ Map<String, Object> extdata = new HashMap<>();
|
|
|
+ extdata.put("header", List.of(Maps.of("title", "领导批示通知")));
|
|
|
// extdata.put("header", List.of(Maps.of("title", "任务通知"),
|
|
|
// Maps.of("title", "2016-1-1 12:12:12", "color", "#999999", "size", "s")));
|
|
|
extdata.put("body",
|
|
@@ -91,10 +178,8 @@ public final class TaskImUtil{
|
|
|
getWorkProService().callApi(formview);
|
|
|
}
|
|
|
|
|
|
- public static String taskDetailUrl(Long taskId, Long userId){
|
|
|
+ private static String taskDetailUrl(Long taskId, Long userId){
|
|
|
String taskUrl = MessageFormat.format("/taskmt/?m=taskDetail&id={0}", String.valueOf(taskId));
|
|
|
- //String wrapperUrl = MessageFormat.format("{0}/general/wrapper?redirect_uri={1}",getBaseUrl(),
|
|
|
- // URLEncoder.encode(taskUrl,StandardCharsets.UTF_8));
|
|
|
return MessageFormat.format("{0}/workpro/sso?userId={1}&url={2}", getBaseUrl(), String.valueOf(userId),
|
|
|
URLEncoder.encode(taskUrl, StandardCharsets.UTF_8));
|
|
|
}
|