官方流程

This commit is contained in:
qimingjin 2022-01-03 21:01:32 +08:00
parent 9a5dd531b0
commit adbcd26640
52 changed files with 511 additions and 369 deletions

View File

@ -13,6 +13,11 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.scheduling.annotation.AsyncConfigurerSupport;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
/**
* 启动程序
@ -31,20 +36,28 @@ import org.springframework.context.annotation.FilterType;
"org.flowable.ui",
"org.jeecg.modules.jmreport"
}, excludeFilters= @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {RemoteAccountResource.class}))
public class SnowApplication
{
public static void main(String[] args)
{
// System.setProperty("spring.devtools.restart.enabled", "false");
//SpringApplication.run(SnowApplication.class, args);
@EnableAsync
public class SnowApplication extends AsyncConfigurerSupport {
public static void main(String[] args) {
ApplicationContext context=SpringApplication.run(SnowApplication.class, args);
SpringContextUtil.setApplicationContext(context);
}
@Bean
public FlowableModelerAppProperties flowableModelerAppProperties() {
FlowableModelerAppProperties flowableModelerAppProperties=new FlowableModelerAppProperties();
return flowableModelerAppProperties;
}
@Override
public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(2);
executor.setMaxPoolSize(2);
executor.setQueueCapacity(500);
executor.setThreadNamePrefix("DingFlowThread-");
executor.initialize();
return executor;
}
}

View File

@ -19,7 +19,7 @@ import com.snow.flowable.domain.customer.SysOaCustomerForm;
import com.snow.flowable.service.FlowableService;
import com.snow.flowable.service.FlowableTaskService;
import com.snow.framework.util.ShiroUtils;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.common.core.domain.MessageEventRequest;
import com.snow.system.domain.SysOaCustomer;
import com.snow.system.domain.SysOaCustomerVisitLog;
import com.snow.system.domain.SysOaRegion;
@ -308,7 +308,7 @@ public class SysOaCustomerController extends BaseController
//加入消息通知
if(StringUtils.isNotNull(sysOaCustomerVisitLog.getAcceptUser())){
SysOaCustomer sysOaCustomer = sysOaCustomerService.selectSysOaCustomerByCustomerNo(sysOaCustomerVisitLog.getCustomerNo());
MessageEventDTO messageEventDTO=new MessageEventDTO(MessageEventType.SEND_VISIT_LOG.getCode());
MessageEventRequest messageEventDTO=new MessageEventRequest(MessageEventType.SEND_VISIT_LOG.getCode());
messageEventDTO.setProducerId(String.valueOf(sysUser.getUserId()));
messageEventDTO.setConsumerIds(Sets.newHashSet(sysOaCustomerVisitLog.getAcceptUser()));
messageEventDTO.setMessageEventType(MessageEventType.SEND_VISIT_LOG);
@ -375,7 +375,7 @@ public class SysOaCustomerController extends BaseController
SysOaCustomerVisitLog sysOaCustomerVisitLog=sysOaCustomerVisitLogService.selectSysOaCustomerVisitLogById(id);
SysOaCustomer sysOaCustomer = sysOaCustomerService.selectSysOaCustomerByCustomerNo(sysOaCustomerVisitLog.getCustomerNo());
//已读监听
MessageEventDTO messageEventDTO=new MessageEventDTO(MessageEventType.MARK_READED.getCode());
MessageEventRequest messageEventDTO=new MessageEventRequest(MessageEventType.MARK_READED.getCode());
messageEventDTO.setConsumerIds(Sets.newHashSet(String.valueOf(sysUser.getUserId())));
messageEventDTO.setMessageOutsideId(String.valueOf(id));
messageEventDTO.setMessageEventType(MessageEventType.SEND_VISIT_LOG);

View File

@ -15,7 +15,7 @@ import com.snow.common.enums.MessageEventType;
import com.snow.common.enums.SysEmailSearchType;
import com.snow.common.utils.StringUtils;
import com.snow.framework.util.ShiroUtils;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.common.core.domain.MessageEventRequest;
import com.snow.system.domain.*;
import com.snow.system.service.ISysOaEmailService;
import com.snow.system.service.ISysSequenceService;
@ -281,7 +281,7 @@ public class SysOaEmailController extends BaseController
String newSequenceNo=sysOaEmail.getEmailNo();
//只有发送状态下才能发送
if(sysOaEmail.getEmailStatus().intValue()==SysEmailSearchType.COMMON.getCode()){
MessageEventDTO messageEventDTO=new MessageEventDTO(MessageEventType.SEND_EMAIL.getCode());
MessageEventRequest messageEventDTO=new MessageEventRequest(MessageEventType.SEND_EMAIL.getCode());
messageEventDTO.setProducerId(String.valueOf(sysUser.getUserId()));
messageEventDTO.setConsumerIds(Sets.newHashSet(sysOaEmail.getEmailTo()));
messageEventDTO.setMessageEventType(MessageEventType.SEND_EMAIL);
@ -325,7 +325,7 @@ public class SysOaEmailController extends BaseController
sysOaEmail.setEmailFromUser(sysUserService.selectUserById(Long.parseLong(sysMessageTransitions.get(0).getProducerId())));
//sysOaEmail.setEmailToUser(sysMessageTransitions.stream().map(get));
}
MessageEventDTO messageEventDTO=new MessageEventDTO(MessageEventType.MARK_READED.getCode());
MessageEventRequest messageEventDTO=new MessageEventRequest(MessageEventType.MARK_READED.getCode());
messageEventDTO.setConsumerIds(Sets.newHashSet(String.valueOf(sysUser.getUserId())));
messageEventDTO.setMessageOutsideId(sysOaEmail.getEmailNo());
messageEventDTO.setMessageEventType(MessageEventType.SEND_EMAIL);

View File

@ -11,7 +11,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import com.snow.common.constant.MessageConstants;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.common.core.domain.MessageEventRequest;
import com.snow.common.enums.DingFlowTaskType;
import com.snow.common.enums.DingTalkListenerType;
import com.snow.common.enums.MessageEventType;
@ -242,7 +242,7 @@ public class SysOaTaskController extends BaseController
* @param sysOaTaskDistribute 参数
*/
private void sendInnerMessage(SysOaTaskDistribute sysOaTaskDistribute){
MessageEventDTO messageEventDTO=new MessageEventDTO(MessageEventType.INNER_SYS_TASK_COMPLETE.getCode());
MessageEventRequest messageEventDTO=new MessageEventRequest(MessageEventType.INNER_SYS_TASK_COMPLETE.getCode());
messageEventDTO.setProducerId(sysOaTaskDistribute.getCreateBy());
messageEventDTO.setConsumerIds(Sets.newHashSet(sysOaTaskDistribute.getTaskDistributeId()));
messageEventDTO.setMessageEventType(MessageEventType.INNER_SYS_TASK_COMPLETE);

View File

@ -6,7 +6,7 @@ import com.google.common.collect.Sets;
import com.snow.common.constant.MessageConstants;
import com.snow.common.constant.UserConstants;
import com.snow.common.enums.MessageEventType;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.common.core.domain.MessageEventRequest;
import com.snow.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@ -76,8 +76,8 @@ public class SysRegisterController extends BaseController
SysUser sysUser = userService.selectUserByLoginName(user.getLoginName());
//分配角色
userService.insertUserAuth(sysUser.getUserId(), new Long[]{UserConstants.FRONT_ROLE_TYPE_ID});
//注册成功后发送站内信 TODO 改成异步的形式
MessageEventDTO messageEventDTO=new MessageEventDTO(MessageEventType.REGISTER_ACCOUNT_SUCCESS.getCode());
//注册成功后发送站内信
MessageEventRequest messageEventDTO=new MessageEventRequest(MessageEventType.REGISTER_ACCOUNT_SUCCESS.getCode());
messageEventDTO.setConsumerIds(Sets.newHashSet(String.valueOf(sysUser.getUserId())));
messageEventDTO.setMessageOutsideId(String.valueOf(sysUser.getUserId()));
messageEventDTO.setMessageEventType(MessageEventType.REGISTER_ACCOUNT_SUCCESS);

View File

@ -7,7 +7,7 @@ spring:
# 主库数据源
master:
url: jdbc:mysql://rm-bp1j1554xv1qs04295o.mysql.rds.aliyuncs.com:3306/snow-dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
username: cloudoot
username: cloud_root
password: VXTvn41xh0+92G8KAdvjQct2ZZ+IhRGm2MqTA38kayy48QwO/vSbTnTeTMVQ6s3axHWhQi9l1ZD5dyJUOenyNA==
# 从库数据源
slave:

View File

@ -255,6 +255,7 @@
},
phonenumber:{
required:true,
phone:true,
remote: {
url: "/system/user/checkPhoneUnique",
type: "post",

View File

@ -3,8 +3,8 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>注册若依系统</title>
<meta name="description" content="若依后台管理框架">
<title>DingFlow系统</title>
<meta name="description" content="DingFlow系统">
<link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
<link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
<link href="../static/css/style.css" th:href="@{/css/style.css}" rel="stylesheet"/>

View File

@ -15,8 +15,7 @@ import java.util.Set;
* @create: 2021-03-30 13:46
**/
@Data
public class MessageEventDTO extends ApplicationEvent implements Serializable {
public class MessageEventRequest extends ApplicationEvent implements Serializable {
private static final long serialVersionUID = -8404237283199119018L;
@ -69,7 +68,7 @@ public class MessageEventDTO extends ApplicationEvent implements Serializable {
*/
private Integer messageShow;
public MessageEventDTO(Object source) {
public MessageEventRequest(Object source) {
super(source);
}
}

View File

@ -6,7 +6,7 @@ package com.snow.common.enums;
* @Description:
* @date 2021/11/19 15:34
*/
public enum FormFieldTypeEnums {
public enum FormFieldTypeEnum {
INPUT("input","TextField","文本输入框"),
PASSWORD("password","","密码输入框"),
@ -53,7 +53,7 @@ public enum FormFieldTypeEnums {
//组件信息
private final String info;
FormFieldTypeEnums(String code,String dingTalkCode,String info)
FormFieldTypeEnum(String code, String dingTalkCode, String info)
{
this.code = code;
this.dingTalkCode = dingTalkCode;
@ -74,8 +74,8 @@ public enum FormFieldTypeEnums {
return dingTalkCode;
}
public static FormFieldTypeEnums getInfo(String info) {
for (FormFieldTypeEnums formFieldTypeEnums:FormFieldTypeEnums.values()){
public static FormFieldTypeEnum getInfo(String info) {
for (FormFieldTypeEnum formFieldTypeEnums: FormFieldTypeEnum.values()){
if(formFieldTypeEnums.getInfo().equals(info)){
return formFieldTypeEnums;
}
@ -83,8 +83,8 @@ public enum FormFieldTypeEnums {
return null;
}
public static FormFieldTypeEnums getCode(String code) {
for (FormFieldTypeEnums formFieldTypeEnum:FormFieldTypeEnums.values()){
public static FormFieldTypeEnum getCode(String code) {
for (FormFieldTypeEnum formFieldTypeEnum: FormFieldTypeEnum.values()){
if(formFieldTypeEnum.getCode().equals(code)){
return formFieldTypeEnum;
}
@ -92,8 +92,8 @@ public enum FormFieldTypeEnums {
return null;
}
public static FormFieldTypeEnums getDingTalkCode(String dingTalkCode) {
for (FormFieldTypeEnums formFieldTypeEnum:FormFieldTypeEnums.values()){
public static FormFieldTypeEnum getDingTalkCode(String dingTalkCode) {
for (FormFieldTypeEnum formFieldTypeEnum: FormFieldTypeEnum.values()){
if(formFieldTypeEnum.getDingTalkCode().equals(dingTalkCode)){
return formFieldTypeEnum;
}

View File

@ -147,10 +147,15 @@ public class BaseConstantUrl {
public static final String GET_PROCESS_TEMPLATE_MANAGE="https://oapi.dingtalk.com/topapi/process/template/manage/get";
/**
* 发起流程实例
* 发起流程实例钉钉官方
*/
public static final String START_PROCESS_INSTANCE="https://oapi.dingtalk.com/topapi/processinstance/create";
/**
* 发起流程审批实例自有流程
*/
public static final String START_FAKE_PROCESS_INSTANCE="https://oapi.dingtalk.com/topapi/process/workrecord/create";
/**
* 执行流程
*/

View File

@ -8,7 +8,7 @@ import com.snow.common.utils.spring.SpringUtils;
import com.snow.dingtalk.model.request.WorkrecordAddRequest;
import com.snow.dingtalk.service.impl.MessageServiceImpl;
import com.snow.dingtalk.service.impl.WorkRecodeServiceImpl;
import com.snow.framework.web.domain.common.SysSendMessageDTO;
import com.snow.framework.web.domain.common.SysSendMessageRequest;
import com.snow.system.domain.SysOaTask;
import com.snow.system.domain.SysOaTaskDistribute;
import com.snow.system.event.SyncEvent;
@ -64,7 +64,7 @@ public class WorkRecodeEventService implements ISyncDingTalkInfo {
}
//钉钉发送普通消息
if(code.equals(DingTalkListenerType.ASYNCSEND_V2.getCode())){
SysSendMessageDTO sysSendMessageDTO=(SysSendMessageDTO)syncEvent.getSource();
SysSendMessageRequest sysSendMessageDTO=(SysSendMessageRequest)syncEvent.getSource();
log.info("@@发送钉钉工作通知消息传入的参数:{}",JSON.toJSONString(sysSendMessageDTO));
messageService.sendWorkNotice(sysSendMessageDTO);
}

View File

@ -1,6 +1,6 @@
package com.snow.dingtalk.model.request;
import com.snow.common.enums.FormFieldTypeEnums;
import com.snow.common.enums.FormFieldTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -131,7 +131,7 @@ public class DepartmentCreateRequest {
private String templateEditUrl;
private FormFieldTypeEnums formComponentType;
private FormFieldTypeEnum formComponentType;
@Data
public static class FormComponentVo implements Serializable {

View File

@ -1,6 +1,5 @@
package com.snow.dingtalk.model.request;
import com.snow.common.enums.FormFieldTypeEnums;
import lombok.Data;
import java.io.Serializable;

View File

@ -0,0 +1,70 @@
package com.snow.dingtalk.model.request;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author Agee
* @Title: 自有OA发起实例实体
* @Description:
* @date 2021/12/31 13:51
*/
@Data
public class StartFakeProcessInstanceRequest implements Serializable {
private static final long serialVersionUID = 4626303348055459013L;
/**
* 审批实例接收人的userid
*/
private String originatorUserId;
/**
* 审批模板唯一码
*/
private String processCode;
/**
* 实例标题
*/
private String title;
/**
* 实例在审批应用里的跳转url需要同时适配移动端和pc端
*/
private String url;
/**
* 备注
*/
private String remark;
/**
* 表单参数列表
*/
private List<FormComponentValueVo> formComponentValueVoList;
@Data
public static class FormComponentValueVo implements Serializable{
private static final long serialVersionUID = 8413434955965098858L;
/**
* 表单名称表单每一栏的名称对应表单组件的label字段
*/
private String name;
/**
*
* 表单值
*/
private String value;
/**
*
* 表单额外值
*/
private String extValue;
}
}

View File

@ -23,11 +23,13 @@ public interface DingOfficialFlowService {
String saveProcess(SaveProcessRequest saveFlowRequest);
/**
* 发起审批实例
* 发起审批实例官方
* @return
*/
String startProcessInstance(StartFlowRequest startFlowRequest);
/**
* 获取当前企业所有可管理的模版
* @param userId
@ -66,7 +68,11 @@ public interface DingOfficialFlowService {
Boolean terminateProcessInstance(FlowTerminateProcessInstanceRequest flowTerminateProcessInstanceRequest);
void bpmsInstanceChange();
/**
* 发起流程实例自有OA)
* @return
*/
String saveFakeProcessInstance(StartFakeProcessInstanceRequest startFakeProcessInstanceRequest);
void bpmsTaskChange();

View File

@ -1,6 +1,6 @@
package com.snow.dingtalk.service;
import com.snow.framework.web.domain.common.SysSendMessageDTO;
import com.snow.framework.web.domain.common.SysSendMessageRequest;
/**
* @author qimingjin
@ -15,6 +15,6 @@ public interface MessageService {
* @param sysSendMessageDTO 请求参数
* @return 任务id
*/
Long sendWorkNotice(SysSendMessageDTO sysSendMessageDTO);
Long sendWorkNotice(SysSendMessageRequest sysSendMessageDTO);
}

View File

@ -13,10 +13,7 @@ import com.snow.common.utils.StringUtils;
import com.snow.common.utils.bean.BeanUtils;
import com.snow.dingtalk.common.BaseConstantUrl;
import com.snow.dingtalk.common.BaseService;
import com.snow.dingtalk.model.request.FlowExecuteTaskRequest;
import com.snow.dingtalk.model.request.FlowTerminateProcessInstanceRequest;
import com.snow.dingtalk.model.request.SaveProcessRequest;
import com.snow.dingtalk.model.request.StartFlowRequest;
import com.snow.dingtalk.model.request.*;
import com.snow.dingtalk.service.DingOfficialFlowService;
import com.snow.system.service.impl.SysConfigServiceImpl;
import com.taobao.api.ApiException;
@ -24,8 +21,11 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import static com.dingtalk.api.request.OapiProcessWorkrecordCreateRequest.*;
/**
* @program: snow
* @description 钉钉官方工作流服务
@ -206,10 +206,37 @@ public class DingOfficialFlowServiceImpl extends BaseService implements DingOffi
}
@Override
public void bpmsInstanceChange() {
public String saveFakeProcessInstance(StartFakeProcessInstanceRequest startFakeProcessInstanceRequest) {
DingTalkClient client = new DefaultDingTalkClient(BaseConstantUrl.START_FAKE_PROCESS_INSTANCE);
OapiProcessWorkrecordCreateRequest req = new OapiProcessWorkrecordCreateRequest();
SaveFakeProcessInstanceRequest saveFakeProcessInstanceRequest = new SaveFakeProcessInstanceRequest();
//获取钉钉配置agentId
Object agentId = CacheUtils.getSysConfig(CacheConstants.AGENT_ID, sysConfigService.selectConfigByKey(Constants.AGENT_ID));
saveFakeProcessInstanceRequest.setAgentid(Long.parseLong(String.valueOf(agentId)));
saveFakeProcessInstanceRequest.setProcessCode(startFakeProcessInstanceRequest.getProcessCode());
saveFakeProcessInstanceRequest.setOriginatorUserId(startFakeProcessInstanceRequest.getOriginatorUserId());
saveFakeProcessInstanceRequest.setTitle(startFakeProcessInstanceRequest.getTitle());
saveFakeProcessInstanceRequest.setUrl(startFakeProcessInstanceRequest.getUrl());
saveFakeProcessInstanceRequest.setRemark(startFakeProcessInstanceRequest.getRemark());
List<FormComponentValueVo> formComponentValueVoList = BeanUtils.transformList(startFakeProcessInstanceRequest.getFormComponentValueVoList(),FormComponentValueVo.class);
saveFakeProcessInstanceRequest.setFormComponentValues(formComponentValueVoList);
req.setRequest(saveFakeProcessInstanceRequest);
try {
OapiProcessWorkrecordCreateResponse response = client.execute(req, getDingTalkToken());
if (response.getErrcode() != 0) {
throw new SyncDataException(JSON.toJSONString(req), response.getErrmsg());
}
return response.getResult().getProcessInstanceId();
} catch (ApiException e) {
log.error("创建实例saveFakeProcessInstance异常{}", e.getMessage());
throw new SyncDataException(JSON.toJSONString(req), e.getErrMsg());
}
}
@Override
public void bpmsTaskChange() {

View File

@ -15,7 +15,7 @@ import com.snow.dingtalk.common.BaseConstantUrl;
import com.snow.dingtalk.common.BaseService;
import com.snow.dingtalk.service.MessageService;
import com.snow.framework.util.FreemarkUtils;
import com.snow.framework.web.domain.common.SysSendMessageDTO;
import com.snow.framework.web.domain.common.SysSendMessageRequest;
import com.snow.system.domain.SysMessageTemplate;
import com.snow.system.service.ISysMessageTemplateService;
import com.snow.system.service.impl.SysConfigServiceImpl;
@ -40,7 +40,7 @@ public class MessageServiceImpl extends BaseService implements MessageService {
@Override
@SyncLog(dingTalkLogType = DingTalkLogType.ASYNCSEND_V2,dingTalkUrl=BaseConstantUrl.ASYNCSEND_V2)
public Long sendWorkNotice(SysSendMessageDTO sysSendMessageDTO) {
public Long sendWorkNotice(SysSendMessageRequest sysSendMessageDTO) {
SysMessageTemplate sysMessageTemplate= sysMessageTemplateService.getSysMessageTemplateByCode(sysSendMessageDTO.getTemplateByCode());
DingTalkClient client = new DefaultDingTalkClient(BaseConstantUrl.ASYNCSEND_V2);
OapiMessageCorpconversationAsyncsendV2Request request = new OapiMessageCorpconversationAsyncsendV2Request();

View File

@ -1,6 +1,5 @@
package com.snow.flowable.listener.common;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.BetweenFormater;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
@ -14,7 +13,7 @@ import com.snow.flowable.common.constants.FlowConstants;
import com.snow.flowable.common.enums.FlowDefEnum;
import com.snow.flowable.common.enums.FlowTypeEnum;
import com.snow.flowable.service.FlowableService;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.common.core.domain.MessageEventRequest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent;
@ -86,7 +85,7 @@ public class ProcessEndListener implements FlowableEventListener {
}
private void sendInnerMessage(HistoricProcessInstance processInstance){
MessageEventDTO messageEventDTO=new MessageEventDTO(MessageEventType.INNER_PROCESS_END.getCode());
MessageEventRequest messageEventDTO=new MessageEventRequest(MessageEventType.INNER_PROCESS_END.getCode());
messageEventDTO.setProducerId(String.valueOf(0));
messageEventDTO.setConsumerIds(Sets.newHashSet(String.valueOf(processInstance.getStartUserId())));
messageEventDTO.setMessageEventType(MessageEventType.INNER_PROCESS_END);

View File

@ -17,7 +17,7 @@ import com.snow.flowable.common.enums.FlowDefEnum;
import com.snow.flowable.listener.AbstractEventListener;
import com.snow.flowable.service.FlowableService;
import com.snow.flowable.service.impl.FlowableUserServiceImpl;
import com.snow.framework.web.domain.common.SysSendMessageDTO;
import com.snow.framework.web.domain.common.SysSendMessageRequest;
import com.snow.framework.web.service.MailMessageService;
import com.snow.framework.web.service.NewsTriggerService;
import com.snow.system.domain.SysUser;
@ -197,7 +197,7 @@ public class SendMessageEventLister extends AbstractEventListener {
map.put("processInstance", processInstance.getProcessDefinitionName());
map.put("url", CacheUtils.getSysConfig(CacheConstants.SYS_DOMAIN,"http://localhost")+"/flow/getMyHistoricProcessInstance");
map.put("datetime", DateUtil.formatDateTime(new Date()));
SysSendMessageDTO sysSendMessageDTO = SysSendMessageDTO.builder().templateByCode(MessageConstants.PROCESS_STARTED_CODE)
SysSendMessageRequest sysSendMessageDTO = SysSendMessageRequest.builder().templateByCode(MessageConstants.PROCESS_STARTED_CODE)
.receiver(getUserInfo(processInstance.getStartUserId()).getEmail())
.paramMap(map)
.build();
@ -237,7 +237,7 @@ public class SendMessageEventLister extends AbstractEventListener {
map.put("processInstance", processDefinition.getName());
map.put("url", CacheUtils.getSysConfig(CacheConstants.SYS_DOMAIN,"http://localhost")+"/flow/findTasksByUserId");
map.put("datetime", DateUtil.formatDateTime(new Date()));
SysSendMessageDTO sysSendMessageDTO = SysSendMessageDTO.builder().templateByCode(MessageConstants.TASK_CREATED_CODE)
SysSendMessageRequest sysSendMessageDTO = SysSendMessageRequest.builder().templateByCode(MessageConstants.TASK_CREATED_CODE)
.receiver(t.getEmail())
.paramMap(map)
.build();
@ -274,7 +274,7 @@ public class SendMessageEventLister extends AbstractEventListener {
map.put("url", CacheUtils.getSysConfig(CacheConstants.SYS_DOMAIN,"http://localhost")+"/flow/getMyHistoricProcessInstance");
map.put("datetime", DateUtil.formatDateTime(new Date()));
SysSendMessageDTO sysSendMessageDTO = SysSendMessageDTO.builder().templateByCode(MessageConstants.PROCESS_STARTED_CODE)
SysSendMessageRequest sysSendMessageDTO = SysSendMessageRequest.builder().templateByCode(MessageConstants.PROCESS_STARTED_CODE)
.receiverSet(Sets.newHashSet(getUserInfo(processInstance.getStartUserId()).getDingUserId()))
.paramMap(map)
.dingTalkMessageType(DingTalkMessageType.TEXT)
@ -301,7 +301,7 @@ public class SendMessageEventLister extends AbstractEventListener {
executor.execute(() -> {
HistoricProcessInstance hisProcessInstance = getHisProcessInstance(event.getProcessInstanceId());
Map<String, Object> map = buildSendProcessCompletedParam(hisProcessInstance);
SysSendMessageDTO sysSendMessageDTO = SysSendMessageDTO.builder().templateByCode(MessageConstants.PROCESS_COMPLETED_CODE)
SysSendMessageRequest sysSendMessageDTO = SysSendMessageRequest.builder().templateByCode(MessageConstants.PROCESS_COMPLETED_CODE)
.receiver(getUserInfo(hisProcessInstance.getStartUserId()).getEmail())
.paramMap(map)
.build();
@ -327,7 +327,7 @@ public class SendMessageEventLister extends AbstractEventListener {
HistoricProcessInstance hisProcessInstance = getHisProcessInstance(event.getProcessInstanceId());
Map<String, Object> map = buildSendProcessCompletedParam(hisProcessInstance);
SysSendMessageDTO sysSendMessageDTO = SysSendMessageDTO.builder().templateByCode(MessageConstants.PROCESS_COMPLETED_CODE)
SysSendMessageRequest sysSendMessageDTO = SysSendMessageRequest.builder().templateByCode(MessageConstants.PROCESS_COMPLETED_CODE)
.receiverSet(Sets.newHashSet(getUserInfo(hisProcessInstance.getStartUserId()).getDingUserId()))
.paramMap(map)
.dingTalkMessageType(DingTalkMessageType.TEXT)

View File

@ -9,7 +9,7 @@ import com.snow.common.enums.MessageEventType;
import com.snow.flowable.common.enums.FlowDefEnum;
import com.snow.flowable.service.FlowableService;
import com.snow.flowable.service.impl.FlowableUserServiceImpl;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.common.core.domain.MessageEventRequest;
import com.snow.system.domain.SysUser;
import com.snow.system.service.impl.SysUserServiceImpl;
import lombok.RequiredArgsConstructor;
@ -84,7 +84,7 @@ public class TaskCreateListener implements FlowableEventListener {
private void sendInnerMessage(SysUser toUsers,TaskEntity entity, HistoricProcessInstance processInstance){
SysUser startSysUser = sysUserServiceImpl.selectUserById(Long.parseLong(processInstance.getStartUserId()));
MessageEventDTO messageEventDTO=new MessageEventDTO(MessageEventType.INNER_TASK_TODO.getCode());
MessageEventRequest messageEventDTO=new MessageEventRequest(MessageEventType.INNER_TASK_TODO.getCode());
messageEventDTO.setProducerId(String.valueOf(0));
messageEventDTO.setConsumerIds(Sets.newHashSet(String.valueOf(toUsers.getUserId())));
messageEventDTO.setMessageEventType(MessageEventType.INNER_TASK_TODO);

View File

@ -18,7 +18,7 @@ import java.util.Set;
@NoArgsConstructor
@ToString
@Builder
public class SysSendEmailDTO implements Serializable {
public class SysSendEmailRequest implements Serializable {
private static final long serialVersionUID = -3505555356014745742L;
private String templateByCode;

View File

@ -20,12 +20,12 @@ import java.util.Set;
@NoArgsConstructor
@ToString
@Builder
public class SysSendMessageDTO implements Serializable {
public class SysSendMessageRequest implements Serializable {
private static final long serialVersionUID = 9148998626002082665L;
/**
* 模板code
* 模板code(
*/
private String templateByCode;

View File

@ -1,6 +1,6 @@
package com.snow.framework.web.message;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.common.core.domain.MessageEventRequest;
/**
* @program: snow
@ -16,7 +16,7 @@ public class MessageEventContext {
this.strategy = strategy;
}
public void messageHandle(MessageEventDTO messageEventDTO) {
public void messageHandle(MessageEventRequest messageEventDTO) {
this.strategy.messageHandle(messageEventDTO);
}
}

View File

@ -1,12 +1,13 @@
package com.snow.framework.web.message;
import com.snow.common.utils.StringUtils;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.common.core.domain.MessageEventRequest;
import com.snow.framework.web.message.consumer.SysMarkReadedStrategy;
import com.snow.framework.web.message.producer.InnerMessageStrategy;
import com.snow.framework.web.message.producer.SendMessageCenterStrategy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
/**
@ -17,10 +18,11 @@ import org.springframework.stereotype.Component;
**/
@Component
@Slf4j
public class MessageEventHandler implements ApplicationListener<MessageEventDTO> {
public class MessageEventHandler implements ApplicationListener<MessageEventRequest> {
@Override
public void onApplicationEvent(MessageEventDTO messageEvent) {
@Async
public void onApplicationEvent(MessageEventRequest messageEvent) {
String messageEventType=String.valueOf(messageEvent.getSource());
// MessageEventType messageEventType = messageEvent.getMessageEventType();
if(StringUtils.isNull(messageEventType)){

View File

@ -1,6 +1,6 @@
package com.snow.framework.web.message;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.common.core.domain.MessageEventRequest;
/**
* @program: snow
@ -13,5 +13,5 @@ public interface MessageEventStrategy {
/**
* 消息处理
*/
void messageHandle(MessageEventDTO messageEventDTO);
void messageHandle(MessageEventRequest messageEventDTO);
}

View File

@ -3,7 +3,7 @@ package com.snow.framework.web.message;
import cn.hutool.core.bean.BeanUtil;
import com.snow.common.enums.MessageEventType;
import com.snow.common.utils.spring.SpringUtils;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.common.core.domain.MessageEventRequest;
import com.snow.system.domain.SysMessageTransition;
import com.snow.system.service.ISysMessageTransitionService;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,7 +25,7 @@ public class TaskTodoStrategy implements MessageEventStrategy {
private ISysMessageTransitionService messageTransitionService=SpringUtils.getBean(ISysMessageTransitionService.class);
@Override
public void messageHandle(MessageEventDTO messageEvent) {
public void messageHandle(MessageEventRequest messageEvent) {
SysMessageTransition sysMessageTransition=new SysMessageTransition();
BeanUtil.copyProperties(messageEvent,sysMessageTransition);
sysMessageTransition.setMessageType(MessageEventType.TASK_TODO.getCode());

View File

@ -2,7 +2,7 @@ package com.snow.framework.web.message.consumer;
import cn.hutool.core.bean.BeanUtil;
import com.snow.common.utils.spring.SpringUtils;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.common.core.domain.MessageEventRequest;
import com.snow.framework.web.message.MessageEventStrategy;
import com.snow.system.domain.SysMessageTransition;
import com.snow.system.service.ISysMessageTransitionService;
@ -13,19 +13,18 @@ import java.util.Set;
/**
* @program: snow 标记已读针对消费者
* @description 系统发送邮件
* @description 标记站内信已读
* @author: 没用的阿吉
* @create: 2021-03-30 14:11
**/
@Component
public class SysMarkReadedStrategy implements MessageEventStrategy {
@Autowired
private ISysMessageTransitionService messageTransitionService=SpringUtils.getBean(ISysMessageTransitionService.class);
@Override
public void messageHandle(MessageEventDTO messageEvent) {
public void messageHandle(MessageEventRequest messageEvent) {
SysMessageTransition sysMessageTransition=new SysMessageTransition();
BeanUtil.copyProperties(messageEvent,sysMessageTransition);
sysMessageTransition.setMessageType(messageEvent.getMessageEventType().getCode());

View File

@ -1,8 +1,8 @@
package com.snow.framework.web.message.producer;
import com.snow.common.utils.spring.SpringUtils;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.framework.web.domain.common.SysSendMessageDTO;
import com.snow.common.core.domain.MessageEventRequest;
import com.snow.framework.web.domain.common.SysSendMessageRequest;
import com.snow.framework.web.message.MessageEventStrategy;
import com.snow.framework.web.service.InnerMessageService;
import org.springframework.stereotype.Component;
@ -16,8 +16,8 @@ public class InnerMessageStrategy implements MessageEventStrategy {
private InnerMessageService innerMessageService= SpringUtils.getBean(InnerMessageService.class);
@Override
public void messageHandle(MessageEventDTO messageEventDTO) {
SysSendMessageDTO sysSendMessageDTO= SysSendMessageDTO.builder().from(messageEventDTO.getProducerId())
public void messageHandle(MessageEventRequest messageEventDTO) {
SysSendMessageRequest sysSendMessageDTO= SysSendMessageRequest.builder().from(messageEventDTO.getProducerId())
.receiverSet(messageEventDTO.getConsumerIds())
.paramMap(messageEventDTO.getParamMap())
.appUrl(messageEventDTO.getAppUrl())

View File

@ -2,7 +2,7 @@ package com.snow.framework.web.message.producer;
import cn.hutool.core.bean.BeanUtil;
import com.snow.common.utils.spring.SpringUtils;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.common.core.domain.MessageEventRequest;
import com.snow.framework.web.message.MessageEventStrategy;
import com.snow.system.domain.SysMessageTransition;
import com.snow.system.service.ISysMessageTransitionService;
@ -21,7 +21,7 @@ public class SendMessageCenterStrategy implements MessageEventStrategy {
private ISysMessageTransitionService messageTransitionService= SpringUtils.getBean(ISysMessageTransitionService.class);
@Override
public void messageHandle(MessageEventDTO messageEventDTO) {
public void messageHandle(MessageEventRequest messageEventDTO) {
SysMessageTransition sysMessageTransition=new SysMessageTransition();
BeanUtil.copyProperties(messageEventDTO,sysMessageTransition);
sysMessageTransition.setMessageType(messageEventDTO.getMessageEventType().getCode());

View File

@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.snow.common.constant.UserConstants;
import com.snow.common.utils.StringUtils;
import com.snow.framework.util.FreemarkUtils;
import com.snow.framework.web.domain.common.SysSendMessageDTO;
import com.snow.framework.web.domain.common.SysSendMessageRequest;
import com.snow.system.domain.SysMessageTemplate;
import com.snow.system.domain.SysMessageTransition;
import com.snow.system.service.ISysConfigService;
@ -39,7 +39,7 @@ public class InnerMessageService {
* 发送站内信息
* @param sysSendMessageDTO
*/
public void sendInnerMessage(SysSendMessageDTO sysSendMessageDTO) {
public void sendInnerMessage(SysSendMessageRequest sysSendMessageDTO) {
SysMessageTransition message = new SysMessageTransition();
SysMessageTemplate sysMessageTemplate= sysMessageTemplateService.getSysMessageTemplateByCode(sysSendMessageDTO.getTemplateByCode());
if(ObjectUtil.isNull(sysMessageTemplate)){

View File

@ -1,10 +1,11 @@
package com.snow.framework.web.service;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import com.snow.common.utils.StringUtils;
import com.snow.framework.util.FreemarkUtils;
import com.snow.framework.web.domain.common.SysSendEmailDTO;
import com.snow.framework.web.domain.common.SysSendMessageDTO;
import com.snow.framework.web.domain.common.SysSendEmailRequest;
import com.snow.framework.web.domain.common.SysSendMessageRequest;
import com.snow.system.domain.SysMessageTemplate;
import com.snow.system.service.ISysMessageTemplateService;
import com.snow.system.service.impl.SysOaEmailServiceImpl;
@ -49,10 +50,10 @@ public class MailMessageService {
* 简单文本邮件
* @param sysSendMessageDTO 对象
*/
public void sendTemplateSimpleMail(SysSendMessageDTO sysSendMessageDTO) {
public void sendTemplateSimpleMail(SysSendMessageRequest sysSendMessageDTO) {
SysMessageTemplate sysMessageTemplate= sysMessageTemplateService.getSysMessageTemplateByCode(sysSendMessageDTO.getTemplateByCode());
if(ObjectUtil.isNull(sysMessageTemplate)){
log.error("@发送站内信是模板code不正确...");
log.error("@发送邮件的模板code不正确...");
throw new RuntimeException("模板code不正确");
}
Set<String> receiverSet = sysSendMessageDTO.getReceiverSet();
@ -87,9 +88,11 @@ public class MailMessageService {
* HTML 文本邮件
* @param sysSendMessageDTO
*/
public void sendTemplateHtmlMail(SysSendMessageDTO sysSendMessageDTO) {
public void sendTemplateHtmlMail(SysSendMessageRequest sysSendMessageDTO) {
SysMessageTemplate sysMessageTemplate= sysMessageTemplateService.getSysMessageTemplateByCode(sysSendMessageDTO.getTemplateByCode());
//接收人set
Set<String> receiverSet = sysSendMessageDTO.getReceiverSet();
//抄送人
Set<String> ccSet = sysSendMessageDTO.getCCSet();
try {
MimeMessage message = mailSender.createMimeMessage();
@ -99,7 +102,8 @@ public class MailMessageService {
}
helper.setSubject(sysMessageTemplate.getTemplateName());
if (CollectionUtils.isNotEmpty(sysSendMessageDTO.getReceiverSet())) {
helper.setTo(receiverSet.toArray(new String[0]));
Convert.toStrArray(sysSendMessageDTO.getReceiverSet());
helper.setTo(Convert.toStrArray(receiverSet));
}
if(CollectionUtils.isNotEmpty(ccSet)){
helper.setCc(ccSet.toArray(new String[0]));
@ -116,13 +120,12 @@ public class MailMessageService {
//todo 消息发送失败记录日志
}
}
/**
* 附件邮件
* @param sysSendMessageDTO 接收者邮件
* @throws MessagingException
*/
public void sendTemplateAttachmentsMail(SysSendMessageDTO sysSendMessageDTO) {
public void sendTemplateAttachmentsMail(SysSendMessageRequest sysSendMessageDTO) {
SysMessageTemplate sysMessageTemplate= sysMessageTemplateService.getSysMessageTemplateByCode(sysSendMessageDTO.getTemplateByCode());
Set<String> receiverSet = sysSendMessageDTO.getReceiverSet();
Set<String> ccSet = sysSendMessageDTO.getCCSet();
@ -161,7 +164,7 @@ public class MailMessageService {
* @param SysSendEmailDTO
*/
@Deprecated
public void sendHtmlMail(SysSendEmailDTO SysSendEmailDTO) {
public void sendHtmlMail(SysSendEmailRequest SysSendEmailDTO) {
Set<String> receiverSet = SysSendEmailDTO.getReceiverSet();
Set<String> ccSet = SysSendEmailDTO.getCCSet();
try {

View File

@ -25,11 +25,14 @@
<artifactId>snow-flowable</artifactId>
</dependency>
<dependency>
<groupId>com.snow</groupId>
<artifactId>snow-common</artifactId>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.4.0</version>
</dependency>
</dependencies>

View File

@ -4,7 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.extra.qrcode.QrConfig;
@ -15,7 +14,7 @@ import com.snow.common.annotation.RepeatSubmit;
import com.snow.common.constant.CacheConstants;
import com.snow.common.constant.SequenceConstants;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.enums.FormFieldTypeEnums;
import com.snow.common.enums.FormFieldTypeEnum;
import com.snow.common.utils.CacheUtils;
import com.snow.common.utils.StringUtils;
import com.snow.flowable.common.constants.FlowConstants;
@ -386,7 +385,7 @@ public class FormController{
for(int i=0;i<formDataArray.size();i++){
JSONObject fieldObject=formDataArray.getJSONObject(i);
//一行多列布局
if(fieldObject.getString("tag").equals(FormFieldTypeEnums.GRID.getCode())){
if(fieldObject.getString("tag").equals(FormFieldTypeEnum.GRID.getCode())){
JSONObject gridObject = formDataArray.getJSONObject(i);
JSONArray columnArray= gridObject.getJSONArray("columns");
for(int j=0;j<columnArray.size();j++){

View File

@ -1,5 +1,7 @@
package com.snow.from.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.snow.common.core.domain.BaseEntity;
import lombok.Data;
@ -15,6 +17,7 @@ public class SysFormDataRecord extends BaseEntity
private static final long serialVersionUID = 1L;
/** 主键ID */
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
@ -51,6 +54,11 @@ public class SysFormDataRecord extends BaseEntity
/** 表单操作人所属人id */
private String belongUserId;
/**
* 钉钉流程实例id
*/
private String dingProcessInstanceId;
/** 版本号 */
private Integer version;

View File

@ -1,5 +1,7 @@
package com.snow.from.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.snow.common.core.domain.BaseEntity;
import lombok.Data;
@ -15,6 +17,7 @@ public class SysFormField extends BaseEntity
private static final long serialVersionUID = 1L;
/** 主键ID */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 字段标识 */

View File

@ -1,5 +1,7 @@
package com.snow.from.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.snow.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.common.core.domain.BaseEntity;
@ -14,11 +16,12 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* @date 2021-03-21
*/
@Data
public class SysFormInstance extends BaseEntity
{
private static final long serialVersionUID = 1L;
public class SysFormInstance extends BaseEntity {
private static final long serialVersionUID = 8560918871627767075L;
/** 主键ID */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 表单定义code */
@ -34,6 +37,11 @@ public class SysFormInstance extends BaseEntity
*/
private String processKey;
/**
* 钉钉流程模板code
*/
private String dingProcessCode;
/**
* 表单内容
*/

View File

@ -2,6 +2,7 @@ package com.snow.from.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.snow.from.domain.SysFormDataRecord;
/**
@ -10,8 +11,7 @@ import com.snow.from.domain.SysFormDataRecord;
* @author 阿吉
* @date 2021-11-21
*/
public interface SysFormDataRecordMapper
{
public interface SysFormDataRecordMapper extends BaseMapper<SysFormDataRecord> {
/**
* 查询单数据记录
*

View File

@ -1,5 +1,6 @@
package com.snow.from.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.snow.from.domain.SysFormField;
import java.util.List;
@ -10,8 +11,7 @@ import java.util.List;
* @author 没用的阿吉
* @date 2021-03-21
*/
public interface SysFormFieldMapper
{
public interface SysFormFieldMapper extends BaseMapper<SysFormField> {
/**
* 查询单字段
*

View File

@ -1,5 +1,6 @@
package com.snow.from.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.snow.from.domain.SysFormInstance;
import java.util.List;
@ -10,67 +11,6 @@ import java.util.List;
* @author 没用的阿吉
* @date 2021-03-21
*/
public interface SysFormInstanceMapper
{
/**
* 查询单实例
*
* @param id 单实例ID
* @return 单实例
*/
public SysFormInstance selectSysFormInstanceById(Long id);
public interface SysFormInstanceMapper extends BaseMapper<SysFormInstance> {
/**
* 查询单实例
* @param fromCode
* @return
*/
public SysFormInstance selectSysFormInstanceByFormCode(String fromCode);
/**
* 查询单实例
* @param fromName
* @return
*/
public SysFormInstance selectSysFormInstanceByFormName(String fromName);
/**
* 查询单实例列表
*
* @param sysFormInstance 单实例
* @return 单实例集合
*/
public List<SysFormInstance> selectSysFormInstanceList(SysFormInstance sysFormInstance);
/**
* 新增单实例
*
* @param sysFormInstance 单实例
* @return 结果
*/
public int insertSysFormInstance(SysFormInstance sysFormInstance);
/**
* 修改单实例
*
* @param sysFormInstance 单实例
* @return 结果
*/
public int updateSysFormInstance(SysFormInstance sysFormInstance);
/**
* 删除单实例
*
* @param id 单实例ID
* @return 结果
*/
public int deleteSysFormInstanceById(Long id);
/**
* 批量删除单实例
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysFormInstanceByIds(String[] ids);
}

View File

@ -0,0 +1,19 @@
package com.snow.from.service;
public interface IDingTalkProcessService {
/**
* 新增或者更新流程钉钉模板
* @param formCode 系统表单code
* @return
*/
String saveOrUpdateDingTalkProcess(String formCode);
/**
* 发起自有工作流程流程实例
* @param fromNo 表单编号
* @return
*/
String SaveFakeProcessInstance(String fromNo);
}

View File

@ -1,5 +1,6 @@
package com.snow.from.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.snow.from.domain.SysFormDataRecord;
import java.util.List;
@ -10,7 +11,7 @@ import java.util.List;
* @author 阿吉
* @date 2021-11-21
*/
public interface ISysFormDataRecordService
public interface ISysFormDataRecordService extends IService<SysFormDataRecord>
{
/**
* 查询单数据记录

View File

@ -1,5 +1,6 @@
package com.snow.from.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.snow.from.domain.SysFormField;
import java.util.List;
@ -10,8 +11,7 @@ import java.util.List;
* @author 没用的阿吉
* @date 2021-03-21
*/
public interface ISysFormFieldService
{
public interface ISysFormFieldService extends IService<SysFormField> {
/**
* 查询单字段
*

View File

@ -1,5 +1,6 @@
package com.snow.from.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.snow.from.domain.SysFormInstance;
import java.util.List;
@ -10,8 +11,7 @@ import java.util.List;
* @author 没用的阿吉
* @date 2021-03-21
*/
public interface ISysFormInstanceService
{
public interface ISysFormInstanceService extends IService<SysFormInstance> {
/**
* 查询单实例
*

View File

@ -0,0 +1,123 @@
package com.snow.from.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.snow.common.enums.FormFieldTypeEnum;
import com.snow.common.utils.StringUtils;
import com.snow.dingtalk.model.request.SaveProcessRequest;
import com.snow.dingtalk.model.request.StartFakeProcessInstanceRequest;
import com.snow.dingtalk.service.DingOfficialFlowService;
import com.snow.from.domain.SysFormDataRecord;
import com.snow.from.domain.SysFormField;
import com.snow.from.domain.SysFormInstance;
import com.snow.from.service.IDingTalkProcessService;
import com.snow.from.service.ISysFormDataRecordService;
import com.snow.from.service.ISysFormFieldService;
import com.snow.from.service.ISysFormInstanceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @author agee
* @Title:
* @Description:
* @date 2022/1/1 10:19
*/
@Slf4j
@Service
public class DingTalkProcessServiceImpl implements IDingTalkProcessService {
@Resource
private DingOfficialFlowService dingOfficialFlowService;
@Resource
private ISysFormInstanceService formInstanceService;
@Resource
private ISysFormFieldService formFieldService;
@Resource
private ISysFormDataRecordService formDataRecordService;
@Override
public String saveOrUpdateDingTalkProcess(String formCode) {
SysFormInstance sysFormInstance = formInstanceService.selectSysFormInstanceByFormCode(formCode);
SysFormField sysFormField=new SysFormField();
sysFormField.setFromId(sysFormInstance.getId());
List<SysFormField> sysFormFields = formFieldService.selectSysFormFieldList(sysFormField);
SaveProcessRequest saveProcessRequest=new SaveProcessRequest();
saveProcessRequest.setName(sysFormInstance.getFormName());
saveProcessRequest.setDescription(sysFormInstance.getFormName());
saveProcessRequest.setFormComponentList(warpFormComponentVoList(sysFormFields));
if(StringUtils.isNotEmpty(sysFormInstance.getDingProcessCode())){
saveProcessRequest.setProcessCode(sysFormInstance.getDingProcessCode());
}
String processCode= dingOfficialFlowService.saveProcess(saveProcessRequest);
//更新表单实例表的formCode
SysFormInstance updateFormInstance=new SysFormInstance();
updateFormInstance.setId(sysFormInstance.getId());
updateFormInstance.setDingProcessCode(processCode);
formInstanceService.updateSysFormInstance(updateFormInstance);
log.info("@@创建钉钉模板返回的流程code:{}",processCode);
return processCode;
}
@Override
public String SaveFakeProcessInstance(String fromNo) {
SysFormDataRecord sysFormDataRecord = formDataRecordService.selectSysFormDataRecordByFormNo(fromNo);
SysFormInstance sysFormInstance = formInstanceService.selectSysFormInstanceById(Long.parseLong(sysFormDataRecord.getFormId()));
StartFakeProcessInstanceRequest startFakeProcessInstanceRequest=new StartFakeProcessInstanceRequest();
startFakeProcessInstanceRequest.setTitle(sysFormInstance.getFormName());
startFakeProcessInstanceRequest.setProcessCode(sysFormInstance.getDingProcessCode());
List<StartFakeProcessInstanceRequest.FormComponentValueVo> formComponentValueVoList=Lists.newArrayList();
//把表单的key value 赋值到请求参数里面
JSONObject formFieldJSONObject = JSON.parseObject(sysFormDataRecord.getFormField());
for (Map.Entry<String, Object> entry : formFieldJSONObject.entrySet()) {
StartFakeProcessInstanceRequest.FormComponentValueVo formComponentValueVo=new StartFakeProcessInstanceRequest.FormComponentValueVo();
formComponentValueVo.setName(entry.getKey());
formComponentValueVo.setValue(String.valueOf(entry.getValue()));
formComponentValueVoList.add(formComponentValueVo);
}
startFakeProcessInstanceRequest.setFormComponentValueVoList(formComponentValueVoList);
String processInstanceId= dingOfficialFlowService.saveFakeProcessInstance(startFakeProcessInstanceRequest);
SysFormDataRecord updateFormDataRecord=new SysFormDataRecord();
updateFormDataRecord.setId(sysFormDataRecord.getId());
updateFormDataRecord.setDingProcessInstanceId(processInstanceId);
formDataRecordService.updateSysFormDataRecord(updateFormDataRecord);
log.info("@@发起自有OA钉钉流程id:{}",processInstanceId);
return processInstanceId;
}
/**
* 组装 List<SaveProcessRequest.FormComponentVo>
* @param sysFormFields 系统表单属性集合
* @return 钉钉表单
*/
private List<SaveProcessRequest.FormComponentVo> warpFormComponentVoList(List<SysFormField> sysFormFields){
//返回参数集合
List<SaveProcessRequest.FormComponentVo> formComponentVoList= Lists.newArrayList();
//循环组装请求钉钉接口所需参数
sysFormFields.stream().filter(sysFormField ->
ObjectUtil.isNull(FormFieldTypeEnum.getCode(sysFormField.getFieldType()))
).forEach(t->{
SaveProcessRequest.FormComponentVo formComponentVo=new SaveProcessRequest.FormComponentVo();
FormFieldTypeEnum formFieldTypeEnum = FormFieldTypeEnum.getCode(t.getFieldType());
formComponentVo.setComponentName(formFieldTypeEnum.getDingTalkCode());
SaveProcessRequest.FormComponentPropVo formComponentPropVo=new SaveProcessRequest.FormComponentPropVo();
formComponentPropVo.setId(t.getFieldKey());
formComponentPropVo.setLabel(t.getFieldName());
formComponentPropVo.setPlaceholder(t.getPlaceholder());
formComponentPropVo.setRequired(t.isRequired());
formComponentVo.setProps(formComponentPropVo);
formComponentVoList.add(formComponentVo);
});
return formComponentVoList;
}
}

View File

@ -1,5 +1,10 @@
package com.snow.from.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.snow.common.core.text.Convert;
import com.snow.common.utils.DateUtils;
import com.snow.from.domain.SysFormDataRecord;
@ -17,13 +22,10 @@ import java.util.List;
* @date 2021-11-21
*/
@Service
public class SysFormDataRecordServiceImpl implements ISysFormDataRecordService
{
@Autowired
private SysFormDataRecordMapper sysFormDataRecordMapper;
public class SysFormDataRecordServiceImpl extends ServiceImpl<SysFormDataRecordMapper,SysFormDataRecord> implements ISysFormDataRecordService {
@Autowired
private SysFormInstanceServiceImpl sysFormInstanceService;
private SysFormDataRecordMapper sysFormDataRecordMapper;
/**
* 查询单数据记录
@ -32,9 +34,8 @@ public class SysFormDataRecordServiceImpl implements ISysFormDataRecordService
* @return 单数据记录
*/
@Override
public SysFormDataRecord selectSysFormDataRecordById(Integer id)
{
return sysFormDataRecordMapper.selectSysFormDataRecordById(id);
public SysFormDataRecord selectSysFormDataRecordById(Integer id) {
return sysFormDataRecordMapper.selectById(id);
}
/**
@ -59,10 +60,16 @@ public class SysFormDataRecordServiceImpl implements ISysFormDataRecordService
* @return 单数据记录
*/
@Override
public List<SysFormDataRecord> selectSysFormDataRecordList(SysFormDataRecord sysFormDataRecord)
{
List<SysFormDataRecord> sysFormDataRecordList=sysFormDataRecordMapper.selectSysFormDataRecordList(sysFormDataRecord);
return sysFormDataRecordList;
public List<SysFormDataRecord> selectSysFormDataRecordList(SysFormDataRecord sysFormDataRecord) {
LambdaQueryWrapper<SysFormDataRecord> lambda = new QueryWrapper<SysFormDataRecord>().lambda();
lambda.like(StrUtil.isNotBlank(sysFormDataRecord.getFormNo()),SysFormDataRecord::getFormNo,sysFormDataRecord.getFormNo());
lambda.like(StrUtil.isNotBlank(sysFormDataRecord.getBelongUserId()),SysFormDataRecord::getBelongUserId,sysFormDataRecord.getBelongUserId());
lambda.eq(ObjectUtil.isNotEmpty(sysFormDataRecord.getId()),SysFormDataRecord::getId,sysFormDataRecord.getId());
lambda.eq(ObjectUtil.isNotEmpty(sysFormDataRecord.getFormId()),SysFormDataRecord::getFormId,sysFormDataRecord.getFormId());
lambda.eq(ObjectUtil.isNotEmpty(sysFormDataRecord.getFormStatus()),SysFormDataRecord::getFormStatus,sysFormDataRecord.getFormStatus());
lambda.eq(ObjectUtil.isNotEmpty(sysFormDataRecord.getDingProcessInstanceId()),SysFormDataRecord::getDingProcessInstanceId,sysFormDataRecord.getDingProcessInstanceId());
lambda.orderByDesc(SysFormDataRecord::getCreateTime);
return sysFormDataRecordMapper.selectList(lambda);
}
/**
@ -75,7 +82,7 @@ public class SysFormDataRecordServiceImpl implements ISysFormDataRecordService
public int insertSysFormDataRecord(SysFormDataRecord sysFormDataRecord)
{
sysFormDataRecord.setCreateTime(DateUtils.getNowDate());
return sysFormDataRecordMapper.insertSysFormDataRecord(sysFormDataRecord);
return sysFormDataRecordMapper.insert(sysFormDataRecord);
}
/**
@ -85,10 +92,9 @@ public class SysFormDataRecordServiceImpl implements ISysFormDataRecordService
* @return 结果
*/
@Override
public int updateSysFormDataRecord(SysFormDataRecord sysFormDataRecord)
{
public int updateSysFormDataRecord(SysFormDataRecord sysFormDataRecord) {
sysFormDataRecord.setUpdateTime(DateUtils.getNowDate());
return sysFormDataRecordMapper.updateSysFormDataRecord(sysFormDataRecord);
return sysFormDataRecordMapper.updateById(sysFormDataRecord);
}
@Override
@ -104,9 +110,8 @@ public class SysFormDataRecordServiceImpl implements ISysFormDataRecordService
* @return 结果
*/
@Override
public int deleteSysFormDataRecordByIds(String ids)
{
return sysFormDataRecordMapper.deleteSysFormDataRecordByIds(Convert.toStrArray(ids));
public int deleteSysFormDataRecordByIds(String ids) {
return sysFormDataRecordMapper.deleteBatchIds(Convert.toStrList(ids));
}
/**
@ -116,8 +121,7 @@ public class SysFormDataRecordServiceImpl implements ISysFormDataRecordService
* @return 结果
*/
@Override
public int deleteSysFormDataRecordById(Integer id)
{
return sysFormDataRecordMapper.deleteSysFormDataRecordById(id);
public int deleteSysFormDataRecordById(Integer id) {
return sysFormDataRecordMapper.deleteById(id);
}
}

View File

@ -1,13 +1,14 @@
package com.snow.from.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.snow.common.core.text.Convert;
import com.snow.common.utils.DateUtils;
import com.snow.from.domain.SysFormField;
import com.snow.from.mapper.SysFormFieldMapper;
import com.snow.from.service.ISysFormFieldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
@ -17,9 +18,9 @@ import java.util.List;
* @date 2021-03-21
*/
@Service
public class SysFormFieldServiceImpl implements ISysFormFieldService
{
@Autowired
public class SysFormFieldServiceImpl extends ServiceImpl<SysFormFieldMapper,SysFormField> implements ISysFormFieldService {
@Resource
private SysFormFieldMapper sysFormFieldMapper;
/**
@ -31,7 +32,7 @@ public class SysFormFieldServiceImpl implements ISysFormFieldService
@Override
public SysFormField selectSysFormFieldById(Long id)
{
return sysFormFieldMapper.selectSysFormFieldById(id);
return sysFormFieldMapper.selectById(id);
}
/**
@ -41,8 +42,7 @@ public class SysFormFieldServiceImpl implements ISysFormFieldService
* @return 单字段
*/
@Override
public List<SysFormField> selectSysFormFieldList(SysFormField sysFormField)
{
public List<SysFormField> selectSysFormFieldList(SysFormField sysFormField) {
return sysFormFieldMapper.selectSysFormFieldList(sysFormField);
}
@ -53,10 +53,9 @@ public class SysFormFieldServiceImpl implements ISysFormFieldService
* @return 结果
*/
@Override
public int insertSysFormField(SysFormField sysFormField)
{
public int insertSysFormField(SysFormField sysFormField) {
sysFormField.setCreateTime(DateUtils.getNowDate());
return sysFormFieldMapper.insertSysFormField(sysFormField);
return sysFormFieldMapper.insert(sysFormField);
}
/**
@ -66,10 +65,9 @@ public class SysFormFieldServiceImpl implements ISysFormFieldService
* @return 结果
*/
@Override
public int updateSysFormField(SysFormField sysFormField)
{
public int updateSysFormField(SysFormField sysFormField) {
sysFormField.setUpdateTime(DateUtils.getNowDate());
return sysFormFieldMapper.updateSysFormField(sysFormField);
return sysFormFieldMapper.updateById(sysFormField);
}
/**
@ -79,9 +77,8 @@ public class SysFormFieldServiceImpl implements ISysFormFieldService
* @return 结果
*/
@Override
public int deleteSysFormFieldByIds(String ids)
{
return sysFormFieldMapper.deleteSysFormFieldByIds(Convert.toStrArray(ids));
public int deleteSysFormFieldByIds(String ids) {
return sysFormFieldMapper.deleteBatchIds(Convert.toStrList(ids));
}
/**
@ -91,8 +88,7 @@ public class SysFormFieldServiceImpl implements ISysFormFieldService
* @return 结果
*/
@Override
public int deleteSysFormFieldById(Long id)
{
return sysFormFieldMapper.deleteSysFormFieldById(id);
public int deleteSysFormFieldById(Long id) {
return sysFormFieldMapper.deleteById(id);
}
}

View File

@ -1,13 +1,18 @@
package com.snow.from.service.impl;
import java.util.List;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.snow.common.core.text.Convert;
import com.snow.common.utils.DateUtils;
import com.snow.from.domain.SysFormInstance;
import com.snow.from.mapper.SysFormInstanceMapper;
import com.snow.from.service.ISysFormInstanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.snow.common.core.text.Convert;
import javax.annotation.Resource;
import java.util.List;
/**
* 单实例Service业务层处理
@ -16,91 +21,92 @@ import com.snow.common.core.text.Convert;
* @date 2021-03-21
*/
@Service
public class SysFormInstanceServiceImpl implements ISysFormInstanceService
{
@Autowired
public class SysFormInstanceServiceImpl extends ServiceImpl<SysFormInstanceMapper,SysFormInstance> implements ISysFormInstanceService {
@Resource
private SysFormInstanceMapper sysFormInstanceMapper;
/**
* 查询单实例
* 查询单实例
*
* @param id 单实例ID
* @return 单实例
* @param id 单实例ID
* @return 单实例
*/
@Override
public SysFormInstance selectSysFormInstanceById(Long id)
{
return sysFormInstanceMapper.selectSysFormInstanceById(id);
public SysFormInstance selectSysFormInstanceById(Long id) {
return sysFormInstanceMapper.selectById(id);
}
@Override
public SysFormInstance selectSysFormInstanceByFormCode(String fromCode) {
return sysFormInstanceMapper.selectSysFormInstanceByFormCode(fromCode);
LambdaQueryWrapper<SysFormInstance> lambda = new QueryWrapper<SysFormInstance>().lambda();
return sysFormInstanceMapper.selectOne(lambda.eq(SysFormInstance::getFormCode,fromCode));
}
@Override
public SysFormInstance selectSysFormInstanceByFormName(String fromName) {
return sysFormInstanceMapper.selectSysFormInstanceByFormName(fromName);
LambdaQueryWrapper<SysFormInstance> lambda = new QueryWrapper<SysFormInstance>().lambda();
return sysFormInstanceMapper.selectOne(lambda.eq(SysFormInstance::getFormCode,fromName));
}
/**
* 查询单实例列表
* 查询单实例列表
*
* @param sysFormInstance 单实例
* @return 单实例
* @param sysFormInstance 单实例
* @return 单实例
*/
@Override
public List<SysFormInstance> selectSysFormInstanceList(SysFormInstance sysFormInstance)
{
return sysFormInstanceMapper.selectSysFormInstanceList(sysFormInstance);
public List<SysFormInstance> selectSysFormInstanceList(SysFormInstance sysFormInstance) {
LambdaQueryWrapper<SysFormInstance> lambda = new QueryWrapper<SysFormInstance>().lambda();
lambda.like(StrUtil.isNotBlank(sysFormInstance.getFormCode()),SysFormInstance::getFormCode,sysFormInstance.getFormCode());
lambda.like(StrUtil.isNotBlank(sysFormInstance.getFormName()),SysFormInstance::getFormName,sysFormInstance.getFormName());
lambda.orderByDesc(SysFormInstance::getCreateTime);
return sysFormInstanceMapper.selectList(lambda);
}
/**
* 新增单实例
* 新增单实例
*
* @param sysFormInstance 单实例
* @param sysFormInstance 单实例
* @return 结果
*/
@Override
public int insertSysFormInstance(SysFormInstance sysFormInstance)
{
public int insertSysFormInstance(SysFormInstance sysFormInstance) {
sysFormInstance.setCreateTime(DateUtils.getNowDate());
return sysFormInstanceMapper.insertSysFormInstance(sysFormInstance);
return sysFormInstanceMapper.insert(sysFormInstance);
}
/**
* 修改单实例
* 修改单实例
*
* @param sysFormInstance 单实例
* @param sysFormInstance 单实例
* @return 结果
*/
@Override
public int updateSysFormInstance(SysFormInstance sysFormInstance)
{
public int updateSysFormInstance(SysFormInstance sysFormInstance) {
sysFormInstance.setUpdateTime(DateUtils.getNowDate());
return sysFormInstanceMapper.updateSysFormInstance(sysFormInstance);
return sysFormInstanceMapper.updateById(sysFormInstance);
}
/**
* 删除单实例对象
* 删除单实例对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSysFormInstanceByIds(String ids) {
return sysFormInstanceMapper.deleteSysFormInstanceByIds(Convert.toStrArray(ids));
return sysFormInstanceMapper.deleteBatchIds(Convert.toStrList(ids));
}
/**
* 删除单实例信息
* 删除单实例信息
*
* @param id 单实例ID
* @param id 单实例ID
* @return 结果
*/
@Override
public int deleteSysFormInstanceById(Long id)
{
return sysFormInstanceMapper.deleteSysFormInstanceById(id);
public int deleteSysFormInstanceById(Long id) {
return sysFormInstanceMapper.deleteById(id);
}
}

View File

@ -4,7 +4,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.snow.common.enums.FormFieldTypeEnums;
import com.snow.common.enums.FormFieldTypeEnum;
import com.snow.common.exception.BusinessException;
import com.snow.from.domain.field.InputField;
@ -35,7 +35,7 @@ public class FormUtils {
for(int i=0;i<formDataArray.size();i++){
JSONObject fieldObject=formDataArray.getJSONObject(i);
//一行多列布局
if(fieldObject.getString("tag").equals(FormFieldTypeEnums.GRID.getCode())){
if(fieldObject.getString("tag").equals(FormFieldTypeEnum.GRID.getCode())){
JSONObject gridObject = formDataArray.getJSONObject(i);
JSONArray columnArray= gridObject.getJSONArray("columns");
for(int j=0;j<columnArray.size();j++){
@ -61,20 +61,20 @@ public class FormUtils {
private static void fillValueField(String tag,JSONObject listObject,JSONObject formFieldObject){
if(isDefaultValue(tag)){
warpDefaultValueField(listObject,formFieldObject);
} else if(tag.equals(FormFieldTypeEnums.SWITCH.getCode())){
} else if(tag.equals(FormFieldTypeEnum.SWITCH.getCode())){
warpSwitchValueField(listObject,formFieldObject);
} else if(tag.equals(FormFieldTypeEnums.SIGN.getCode())){
} else if(tag.equals(FormFieldTypeEnum.SIGN.getCode())){
warpDateField(listObject,formFieldObject);
} else if(tag.equals(FormFieldTypeEnums.DATE.getCode())){
} else if(tag.equals(FormFieldTypeEnum.DATE.getCode())){
warpDateDefaultValueField(listObject,formFieldObject);
}else if(tag.equals(FormFieldTypeEnums.DATE_RANGE.getCode())){
}else if(tag.equals(FormFieldTypeEnum.DATE_RANGE.getCode())){
warpDateRangeDefaultValueField(listObject,formFieldObject);
}else if(tag.equals(FormFieldTypeEnums.CHECKBOX.getCode())){
}else if(tag.equals(FormFieldTypeEnum.CHECKBOX.getCode())){
warpCheckBoxValueField(listObject,formFieldObject);
}else if(tag.equals(FormFieldTypeEnums.RADIO.getCode())){
warpCheckedValueField(listObject,formFieldObject,FormFieldTypeEnums.RADIO);
}else if(tag.equals(FormFieldTypeEnums.SELECT.getCode())){
warpCheckedValueField(listObject,formFieldObject,FormFieldTypeEnums.SELECT);
}else if(tag.equals(FormFieldTypeEnum.RADIO.getCode())){
warpCheckedValueField(listObject,formFieldObject, FormFieldTypeEnum.RADIO);
}else if(tag.equals(FormFieldTypeEnum.SELECT.getCode())){
warpCheckedValueField(listObject,formFieldObject, FormFieldTypeEnum.SELECT);
}else {
throw new BusinessException(StrUtil.format("暂不支持的组件:{}",tag));
}
@ -86,10 +86,10 @@ public class FormUtils {
* @return 是否
*/
private static boolean isDefaultValue(String tag){
return tag.equals(FormFieldTypeEnums.INPUT.getCode()) || tag.equals(FormFieldTypeEnums.TEXTAREA.getCode()) || tag.equals(FormFieldTypeEnums.PASSWORD.getCode())
|| tag.equals(FormFieldTypeEnums.NUMBER_INPUT.getCode()) || tag.equals(FormFieldTypeEnums.RATE.getCode()) || tag.equals(FormFieldTypeEnums.CRON.getCode())
|| tag.equals(FormFieldTypeEnums.FILE.getCode()) ||tag.equals(FormFieldTypeEnums.IMAGE.getCode()) ||tag.equals(FormFieldTypeEnums.COLOR_PICKER.getCode())
||tag.equals(FormFieldTypeEnums.ICON_PICKER.getCode()) ||tag.equals(FormFieldTypeEnums.SLIDER.getCode());
return tag.equals(FormFieldTypeEnum.INPUT.getCode()) || tag.equals(FormFieldTypeEnum.TEXTAREA.getCode()) || tag.equals(FormFieldTypeEnum.PASSWORD.getCode())
|| tag.equals(FormFieldTypeEnum.NUMBER_INPUT.getCode()) || tag.equals(FormFieldTypeEnum.RATE.getCode()) || tag.equals(FormFieldTypeEnum.CRON.getCode())
|| tag.equals(FormFieldTypeEnum.FILE.getCode()) ||tag.equals(FormFieldTypeEnum.IMAGE.getCode()) ||tag.equals(FormFieldTypeEnum.COLOR_PICKER.getCode())
||tag.equals(FormFieldTypeEnum.ICON_PICKER.getCode()) ||tag.equals(FormFieldTypeEnum.SLIDER.getCode());
}
//输入框
@ -132,9 +132,9 @@ public class FormUtils {
}
//下拉和单选
public static void warpCheckedValueField(JSONObject fieldObject,JSONObject formFieldObject,FormFieldTypeEnums formFieldTypeEnums){
public static void warpCheckedValueField(JSONObject fieldObject, JSONObject formFieldObject, FormFieldTypeEnum formFieldTypeEnums){
String value = formFieldObject.getString(fieldObject.getString("id"));
if(formFieldTypeEnums.getCode().equals(FormFieldTypeEnums.SELECT.getCode())){
if(formFieldTypeEnums.getCode().equals(FormFieldTypeEnum.SELECT.getCode())){
fieldObject.put("remoteDefaultValue",value);
}
JSONArray optionsArray= fieldObject.getJSONArray("options");

View File

@ -5,116 +5,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.snow.from.mapper.SysFormInstanceMapper">
<resultMap type="SysFormInstance" id="SysFormInstanceResult">
<result property="id" column="id_" />
<result property="formCode" column="form_code_" />
<result property="formName" column="form_name_" />
<result property="fromUrl" column="from_url_" />
<result property="id" column="id" />
<result property="formCode" column="form_code" />
<result property="formName" column="form_name" />
<result property="fromUrl" column="from_url" />
<result property="processKey" column="process_key" />
<result property="dingProcessCode" column="ding_process_code" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="rev" column="rev_" />
<result property="rev" column="rev" />
<result property="isDelete" column="is_delete" />
<result property="tenantId" column="tenant_id_" />
<result property="fromContentHtml" column="from_content_html_" />
<result property="tenantId" column="tenant_id" />
<result property="fromContentHtml" column="from_content_html" />
</resultMap>
<sql id="selectSysFormInstanceVo">
select id_, form_code_, form_name_, from_url_,process_key, create_by, from_content_html_,create_time, update_time, update_by, rev_, is_delete, tenant_id_ from sys_form_instance
select id, form_code, form_name, from_url,process_key, create_by, from_content_html_,create_time, update_time, update_by, rev, is_delete, tenant_id from sys_form_instance
</sql>
<select id="selectSysFormInstanceList" parameterType="SysFormInstance" resultMap="SysFormInstanceResult">
<include refid="selectSysFormInstanceVo"/>
<where>
<if test="formCode != null and formCode != ''"> and form_code_ like concat('%', #{formCode}, '%')</if>
<if test="formName != null and formName != ''"> and form_name_ like concat('%', #{formName}, '%')</if>
<if test="processKey != null and processKey != ''"> and process_key like concat('%', #{processKey}, '%')</if>
<if test="rev != null "> and rev_ = #{rev}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id_ = #{tenantId}</if>
</where>
</select>
<select id="selectSysFormInstanceById" parameterType="Long" resultMap="SysFormInstanceResult">
<include refid="selectSysFormInstanceVo"/>
where id_ = #{id}
</select>
<select id="selectSysFormInstanceByFormCode" parameterType="String" resultMap="SysFormInstanceResult">
<include refid="selectSysFormInstanceVo"/>
where form_code_ = #{formCode}
</select>
<select id="selectSysFormInstanceByFormName" parameterType="String" resultMap="SysFormInstanceResult">
<include refid="selectSysFormInstanceVo"/>
where form_name_ = #{formName}
</select>
<insert id="insertSysFormInstance" parameterType="SysFormInstance" useGeneratedKeys="true" keyProperty="id">
insert into sys_form_instance
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="formCode != null and formCode != ''">form_code_,</if>
<if test="formName != null and formName != ''">form_name_,</if>
<if test="fromUrl != null and fromUrl != ''">from_url_,</if>
<if test="processKey != null and processKey != ''">process_key,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="rev != null">rev_,</if>
<if test="isDelete != null">is_delete,</if>
<if test="tenantId != null">tenant_id_,</if>
<if test="fromContentHtml != null">from_content_html_,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="formCode != null and formCode != ''">#{formCode},</if>
<if test="formName != null and formName != ''">#{formName},</if>
<if test="fromUrl != null and fromUrl != ''">#{fromUrl},</if>
<if test="processKey != null and processKey != ''">#{processKey},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="rev != null">#{rev},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="fromContentHtml != null">#{fromContentHtml},</if>
</trim>
</insert>
<update id="updateSysFormInstance" parameterType="SysFormInstance">
update sys_form_instance
<trim prefix="SET" suffixOverrides=",">
<if test="formCode != null and formCode != ''">form_code_ = #{formCode},</if>
<if test="formName != null and formName != ''">form_name_ = #{formName},</if>
<if test="fromUrl != null and fromUrl != ''">from_url_ = #{fromUrl},</if>
<if test="processKey != null and processKey != ''">process_key=#{processKey},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="rev != null">rev_ = #{rev},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="tenantId != null">tenant_id_ = #{tenantId},</if>
<if test="fromContentHtml != null">from_content_html_=#{fromContentHtml},</if>
</trim>
where id_ = #{id}
</update>
<delete id="deleteSysFormInstanceById" parameterType="Long">
delete from sys_form_instance where id_ = #{id}
</delete>
<delete id="deleteSysFormInstanceByIds" parameterType="String">
delete from sys_form_instance where id_ in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -1,11 +1,10 @@
package com.snow.system.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.BetweenFormater;
import cn.hutool.core.date.DateUtil;
import com.snow.common.constant.MessageConstants;
import com.snow.common.constant.SequenceConstants;
import com.snow.common.core.domain.MessageEventDTO;
import com.snow.common.core.domain.MessageEventRequest;
import com.snow.common.core.text.Convert;
import com.snow.common.enums.DingFlowTaskType;
import com.snow.common.enums.DingTalkListenerType;
@ -176,7 +175,7 @@ public class SysOaTaskServiceImpl implements ISysOaTaskService
* @param sysOaTaskDistribute 参数
*/
private void sendInnerMessage(SysOaTaskDistribute sysOaTaskDistribute){
MessageEventDTO messageEventDTO=new MessageEventDTO(MessageEventType.INNER_SYS_TODO_TASK.getCode());
MessageEventRequest messageEventDTO=new MessageEventRequest(MessageEventType.INNER_SYS_TODO_TASK.getCode());
messageEventDTO.setProducerId(sysOaTaskDistribute.getCreateBy());
messageEventDTO.setConsumerIds(Sets.newHashSet(sysOaTaskDistribute.getTaskDistributeId()));
messageEventDTO.setMessageEventType(MessageEventType.INNER_SYS_TODO_TASK);