|
|
@@ -13,6 +13,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.db.Session;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
@@ -33,8 +34,10 @@ import com.xjrsoft.common.exception.MyException;
|
|
|
import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
|
+import com.xjrsoft.common.utils.LocalDateTimeUtil;
|
|
|
import com.xjrsoft.common.utils.RedisUtil;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
+import com.xjrsoft.common.utils.WeChatUtil;
|
|
|
import com.xjrsoft.config.CommonPropertiesConfig;
|
|
|
import com.xjrsoft.module.form.dto.FormExecuteWorkflowAddDto;
|
|
|
import com.xjrsoft.module.form.dto.FormExecuteWorkflowUpdateDto;
|
|
|
@@ -5492,6 +5495,7 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
|
|
|
// addProcessRecord(task, schemaId, message);
|
|
|
} else {
|
|
|
List<WorkflowCirculated> newList = new ArrayList<>();
|
|
|
+
|
|
|
for (Long userId : appendUserTaskCirculated) {
|
|
|
WorkflowCirculated workflowCirculated = BeanUtil.toBean(circulatedList.get(0), WorkflowCirculated.class);
|
|
|
workflowCirculated.setCirculatedUserId(userId);
|
|
|
@@ -5511,6 +5515,44 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
|
|
|
circulateMessage = "【" + user.getName() + "】添加了传阅人【" + circulatedName + "】,当前传阅人【" + addCirculatedName + "】";
|
|
|
}
|
|
|
}
|
|
|
+ if(!appendUserTaskCirculated.isEmpty()){
|
|
|
+ WeChatUtil weChatUtil = SpringUtil.getBean(WeChatUtil.class);
|
|
|
+ CommonPropertiesConfig cpConfig = SpringUtil.getBean(CommonPropertiesConfig.class);
|
|
|
+ Map<Long, User> userMap = userService.listByIds(appendUserTaskCirculated).stream().filter(x -> StrUtil.isNotEmpty(x.getOpenId())).collect(Collectors.toMap(User::getId, x -> x));
|
|
|
+ for (Long userId : appendUserTaskCirculated) {
|
|
|
+ if(!userMap.containsKey(userId)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ User appendUser = userMap.get(userId);
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
+ // 任务名称
|
|
|
+ data.put("thing8", new JSONObject() {{
|
|
|
+ put("value", "传阅消息");
|
|
|
+ }});
|
|
|
+ // 事项名称
|
|
|
+ data.put("thing2", new JSONObject() {{
|
|
|
+ put("value", workflowSchemaConfig.getProcessConfig().getName());
|
|
|
+ }});
|
|
|
+ // 申请人
|
|
|
+ data.put("thing6", new JSONObject() {{
|
|
|
+ put("value", appendUser.getName());
|
|
|
+ }});
|
|
|
+ // 时间
|
|
|
+ data.put("time3", new JSONObject() {{
|
|
|
+ put("value", LocalDateTimeUtil.format(LocalDateTime.now(), LocalDateTimeUtil.LOCAL_DATE_TIME_FORMAT));
|
|
|
+ }});
|
|
|
+
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ object.put("touser", appendUser.getOpenId());
|
|
|
+ object.put("template_id", "sHsmz7LRj7HLd7GSTS3r2jCLvK-4Wp19iGzEvYK8n_I");
|
|
|
+ object.put("url", StrUtil.format("{}/xjrsoft/pages/workflow/approval?taskId={}&processId={}&type=todo", cpConfig.getDomainApp(), task.getId(), task.getProcessInstanceId()));
|
|
|
+ object.put("client_msg_id", task.getId());
|
|
|
+ object.put("data", data);
|
|
|
+ weChatUtil.sendTemplateMessage(object);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return circulateMessage;
|
|
|
}
|
|
|
|