全部开发者教程

企业级在线办公系统

在WorkFlowServiceImpl类中添加下面代码

@Service
public class WorkflowServiceImpl implements WorkflowService {
    @Override
    public void approvalTask(HashMap param) {
        String taskId = MapUtil.getStr(param, "taskId");
        String approval = MapUtil.getStr(param, "approval");
        taskService.setVariableLocal(taskId, "result", approval);
        taskService.complete(taskId);
    }

    @Override
    public void archiveTask(HashMap param) {
        String taskId = MapUtil.getStr(param, "taskId");
        int userId = MapUtil.getInt(param, "userId");
        JSONArray files = (JSONArray) param.get("files");
        taskService.setVariable(taskId, "files", files); //把归档文件信息存储在工作流实例中
        taskService.setVariable(taskId,"filing",false);
        //认领该任务,否则查询不到我审批过该记录
        taskService.setOwner(taskId, userId + "");
        taskService.setAssignee(taskId, userId + "");
        taskService.complete(taskId);
    }


    @Override
    public boolean searchProcessStatus(String instanceId) {
        ProcessInstance instance = runtimeService.createProcessInstanceQuery().processInstanceId(instanceId).singleResult();
        if (instance != null) {
            //工作流未结束
            return false;
        } else {
            //工作流已经结束
            return true;
        }
    }

    @Override
    public void deleteProcessById(String uuid, String instanceId, String type, String reason) {
        long count = runtimeService.createProcessInstanceQuery().processInstanceId(instanceId).count();
        if (count > 0) {
            runtimeService.deleteProcessInstance(instanceId, reason);    //删除工作流
        }
        count = historyService.createHistoricProcessInstanceQuery().processInstanceId(instanceId).count();
        if (count > 0) {
            historyService.deleteHistoricProcessInstance(instanceId);   //删除工作流历史
        }
        //判断是否是会议工作流,然后删除定时器
        if (type.equals("会议申请")) {
            quartzUtil.deleteJob(uuid, "会议开始任务组");
            quartzUtil.deleteJob(uuid, "会议结束任务组");
            quartzUtil.deleteJob(uuid, "会议工作流组");
            quartzUtil.deleteJob(uuid, "创建会议室ID任务组");
        }
    }
        @Override
    public String startLeaveProcess(HashMap param) {
        String instanceId = runtimeService.startProcessInstanceByKey("leave", param).getProcessInstanceId(); //启动工作流
        return instanceId;
    }

    @Override
    public String startReimProcess(HashMap param) {
        String instanceId = runtimeService.startProcessInstanceByKey("reim", param).getProcessInstanceId(); //启动工作流
        return instanceId;
    }
}

创建MeetingService接口,代码如下:

public interface MeetingService {
    public HashMap searchMeetingByInstanceId(String instanceId);

    public HashMap searchMeetingByUUID(String uuid);

    public Long searchRoomIdByUUID(String uuid);

    public List<String> searchUserMeetingInMonth(HashMap param);

    public void updateMeetingStatus(HashMap param);

    public ArrayList<Integer> searchMeetingUnpresent(String uuid);

    public int updateMeetingUnpresent(HashMap param);
}

创建MeetingServiceImpl类,代码如下:

package com.example.emos.workflow.service.impl;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.example.emos.workflow.db.dao.TbMeetingDao;
import com.example.emos.workflow.exception.EmosException;
import com.example.emos.workflow.service.MeetingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

@Service
public class MeetingServiceImpl implements MeetingService {
    @Autowired
    private TbMeetingDao meetingDao;

    @Autowired
    @Qualifier(value = "redisTemplate")
    private RedisTemplate redisTemplate;


    public HashMap searchMeetingByInstanceId(String instanceId) {
        HashMap map = meetingDao.searchMeetingByInstanceId(instanceId);
        String date = map.get("date").toString();
        String start = map.get("start").toString();
        DateTime startDate = DateUtil.parse(date + " " + start, "yyyy-MM-dd HH:mm");
        String end = map.get("end").toString();
        DateTime endDate = DateUtil.parse(date + " " + end, "yyyy-MM-dd HH:mm");
        long hours = DateUtil.between(endDate, startDate, DateUnit.HOUR, true);
        map.put("hours", hours);
        return map;
    }

    @Override
    public HashMap searchMeetingByUUID(String uuid) {
        HashMap meeting = meetingDao.searchMeetingByUUID(uuid);
        return meeting;
    }


    @Override
    public Long searchRoomIdByUUID(String uuid) {
        Object temp = redisTemplate.opsForValue().get(uuid);
        long roomId = Long.parseLong(temp.toString());
        return roomId;
    }

    @Override
    public List<String> searchUserMeetingInMonth(HashMap param) {
        List list = meetingDao.searchUserMeetingInMonth(param);
        return list;
    }

    @Override
    public void updateMeetingStatus(HashMap param) {
        int row = meetingDao.updateMeetingStatus(param);
        if (row != 1) {
            throw new EmosException("会议状态更新失败");
        }
    }

    @Override
    public ArrayList<Integer> searchMeetingUnpresent(String uuid) {
        ArrayList<Integer> list=meetingDao.searchMeetingUnpresent(uuid);
        return list;
    }

    @Override
    public int updateMeetingUnpresent(HashMap param) {
        int rows=meetingDao.updateMeetingUnpresent(param);
        return rows;
    }
}

创建NotifyMeetingService.java类

@Slf4j
@Component
public class NotifyMeetingService implements JavaDelegate {
    @Autowired
    private QuartzUtil quartzUtil;

    @Autowired
    private MeetingService meetingService;

    @Override
    public void execute(DelegateExecution delegateExecution) {
        Map map = delegateExecution.getVariables();
        String uuid = MapUtil.getStr(map, "uuid");
        String url = MapUtil.getStr(map, "url");
        String result = MapUtil.getStr(map, "result");
        HashMap data = meetingService.searchMeetingByUUID(uuid);
        String title = MapUtil.getStr(data, "title");
        String date = MapUtil.getStr(data, "date");
        String start = MapUtil.getStr(data, "start");
        String end = MapUtil.getStr(data, "end");
        if (result.equals("同意")) {
            meetingService.updateMeetingStatus(new HashMap() {{
                put("uuid", uuid);
                put("status", 3);
            }});

            String meetingType = delegateExecution.getVariable("meetingType", String.class);
            //线上会议要创建视频会议室
            if (meetingType.equals("线上会议")) {
                JobDetail jobDetail = JobBuilder.newJob(MeetingRoomJob.class).build();
                Map param = jobDetail.getJobDataMap();
                param.put("uuid", uuid);
                Date expire = DateUtil.parse(date + " " + end, "yyyy-MM-dd HH:mm");
                param.put("expire", expire);
                //会议开始前15分钟,计算roomID
                Date executeDate = DateUtil.parse(date + " " + start, "yyyy-MM-dd HH:mm").offset(DateField.MINUTE, -15);

                quartzUtil.addJob(jobDetail, uuid, "创建会议室ID任务组", executeDate);
            }
        } 
        quartzUtil.deleteJob(uuid, "会议工作流组");
        JSONObject json = new JSONObject();
        String processId = delegateExecution.getProcessInstanceId();
        json.set("processId", processId);
    }
}

创建NotifyLeaveService.java类

@Component
public class NotifyLeaveService implements JavaDelegate {
    @Autowired
    private HistoryService historyService;

    @Autowired
    private TbLeaveDao leaveDao;

    @Autowired
    private TbUserDao userDao;

    @Autowired
    private EmailTask emailTask;

    @Override
    public void execute(DelegateExecution delegateExecution) {
        //查找该任务流中最后一个人的审批任务
        HistoricTaskInstance taskInstance = historyService.createHistoricTaskInstanceQuery().includeProcessVariables()
                .includeTaskLocalVariables().processInstanceId(delegateExecution.getProcessInstanceId())
                .orderByHistoricTaskInstanceEndTime().list().get(0);
        //获取最后的审批人的审批结果
        String result = taskInstance.getTaskLocalVariables().get("result").toString();
        delegateExecution.setVariable("result", result);
        String instanceId = delegateExecution.getProcessInstanceId();
        //修改请假状态
        HashMap param = new HashMap() {{
            put("status", "同意".equals(result) ? 3 : 2);
            put("instanceId", instanceId);
        }};

        int rows = leaveDao.updateLeaveStatus(param);
        if (rows != 1) {
            throw new EmosException("更新请假记录状态失败");
        }
        
    }
}

创建NotifyReimService.java类

@Component("notifyReimService")
public class NotifyReimService implements JavaDelegate {

    @Autowired
    private HistoryService historyService;

    @Autowired
    private TbUserDao userDao;

    @Autowired
    private TbReimDao reimDao;

    @Autowired
    private EmailTask emailTask;


    @Override
    public void execute(DelegateExecution delegateExecution) {
        //查找该任务流中最后一个人的审批任务
        HistoricTaskInstance taskInstance = historyService.createHistoricTaskInstanceQuery().includeProcessVariables()
                .includeTaskLocalVariables().processInstanceId(delegateExecution.getProcessInstanceId())
                .orderByHistoricTaskInstanceEndTime().list().get(0);
        //获取最后的审批人的审批结果
        String result = taskInstance.getTaskLocalVariables().get("result").toString();
        delegateExecution.setVariable("result", result);
        String instanceId = delegateExecution.getProcessInstanceId();
        //修改请假状态
        HashMap param = new HashMap() {{
            put("status", "同意".equals(result) ? 3 : 2);
            put("instanceId", instanceId);
        }};

        int rows = reimDao.updateReimStatus(param);
        if (rows != 1) {
            throw new EmosException("更新报销记录状态失败");
        }

    }
}

创建TbAmectDao.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.emos.workflow.db.dao.TbAmectDao">
    <insert id="insert" parameterType="com.example.emos.workflow.db.pojo.TbAmect">
        INSERT INTO tb_amect
        SET uuid = #{uuid},
            user_id = #{userId},
            amount = #{amount},
            type_id = #{typeId},
            reason = #{reason},
            prepay_id = #{prepayId},
            `status` = 1
    </insert>
</mapper>

创建TbAmectTypeDao.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.emos.workflow.db.dao.TbAmectTypeDao">
    <select id="searchByType" parameterType="String" resultType="HashMap">
        SELECT id, money FROM tb_amect_type WHERE type=#{type}
    </select>
</mapper>

创建TbLeaveDao.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.emos.workflow.db.dao.TbLeaveDao">
    <select id="searchLeaveByInstanceId" parameterType="String" resultType="HashMap">
        SELECT
            u.`name`,
            l.reason,
            u.id AS userId,
            DATE_FORMAT( l.`start`, '%Y-%m-%d %H:%i' ) AS `start`,
            DATE_FORMAT( l.`end`, '%Y-%m-%d %H:%i' ) AS `end`,
            l.days,
            l.type,
            l.`status`
        FROM
            tb_leave l
        JOIN tb_user u ON l.user_id = u.id
        WHERE l.instance_id=#{instanceId}
    </select>
    <update id="updateLeaveStatus" parameterType="HashMap">
        UPDATE tb_leave SET status=#{status} WHERE instance_id=#{instanceId}
    </update>

</mapper>

创建TbMeetingDao.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.emos.workflow.db.dao.TbMeetingDao">
    <select id="searchMeetingByInstanceId" parameterType="String" resultType="HashMap">
        SELECT
            m.id,
            m.uuid,
            u.name,
            u.photo,
            m.`desc`,
            m.place,
            m.type,
            m.date,
            DATE_FORMAT( m.START, '%H:%i' ) AS start,
            DATE_FORMAT( m.END, '%H:%i' ) AS end,
            (
                SELECT GROUP_CONCAT( u.name SEPARATOR "、") FROM tb_user u
                WHERE u.status = 1 AND JSON_CONTAINS ( m.members, CONVERT ( u.id, CHAR ))
            ) AS members
        FROM tb_meeting m
        JOIN tb_user u ON m.creator_id=u.id
        WHERE instance_id=#{instanceId};
    </select>
    <select id="searchMeetingMembersInSameDept" parameterType="String" resultType="boolean">
        SELECT
            IF(COUNT(DISTINCT u.dept_id)=1,TRUE,FALSE ) AS bool
        FROM
            tb_meeting m
                JOIN tb_user u ON JSON_CONTAINS ( m.members, CAST( u.id AS CHAR ) )
        WHERE m.uuid=#{uuid} AND u.status = 1
    </select>
    <select id="searchMeetingByUUID" parameterType="String" resultType="HashMap">
        SELECT
            m.uuid,
            m.title,
            u.name,
            DATE_FORMAT( m.date, '%Y-%m-%d' ) AS date,
			m.place,
			DATE_FORMAT( m.START, '%H:%i' ) AS start,
            DATE_FORMAT( m.END, '%H:%i' ) AS end,
			m.type,
			m.status,
			m.desc
		FROM
			tb_meeting m
		JOIN tb_user u ON m.creator_id = u.id
		WHERE m.uuid =#{uuid} AND u.status = 1
    </select>
    <select id="searchUserMeetingInMonth" parameterType="Map" resultType="String">
        SELECT
            DISTINCT DATE_FORMAT( m.date, '%Y/%m/%d' ) AS date
        FROM
            tb_meeting m
            JOIN tb_user u ON JSON_CONTAINS ( m.members, CAST( u.id AS CHAR ) )
        WHERE u.id = #{userId}
          AND u.status = 1
          AND m.status IN(3,4)
          AND DATE_FORMAT(m.date,'%Y/%m')=#{express}
    </select>
    <select id="searchMeetingUnpresent" parameterType="String" resultType="Integer">
        SELECT u.id
        FROM tb_meeting m JOIN tb_user u ON JSON_CONTAINS ( m.members, CONVERT ( u.id, CHAR ) )
             AND NOT JSON_CONTAINS ( IFNULL(m.present,JSON_ARRAY()), CONVERT ( u.id, CHAR ) )
        WHERE u.`status`=1 AND m.uuid=#{uuid}
    </select>
    <update id="updateMeetingStatus" parameterType="HashMap">
        UPDATE tb_meeting
        SET `status`=#{status}
        WHERE uuid=#{uuid}
    </update>
    <update id="updateMeetingUnpresent" parameterType="HashMap">
        UPDATE tb_meeting
        SET unpresent=#{unpresent}
        WHERE uuid=#{uuid}
    </update>
</mapper>

创建TbReimDao.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.emos.workflow.db.dao.TbReimDao">
    <select id="searchReimByInstanceId" parameterType="String" resultType="HashMap">
        SELECT r.id,
               u.`name`,
               d.dept_name AS deptId,
               r.content,
               r.amount,
               r.anleihen,
               r.balance,
               r.type_id AS typeId,
               r.`status`
        FROM tb_reim r
        JOIN tb_user u ON r.user_id = u.id
        JOIN tb_dept d ON u.dept_id = d.id
        WHERE instance_id = #{instanceId}
    </select>
    <update id="updateReimStatus" parameterType="HashMap">
        UPDATE tb_reim
        SET status = #{status}
        WHERE instance_id = #{instanceId}
    </update>
</mapper>

创建TbUserDao.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.emos.workflow.db.dao.TbUserDao">
    <select id="searchEmailByIds" resultType="String">
        SELECT email FROM tb_user
        WHERE id IN
        <foreach collection="array" open="(" close=")" item="one" separator=",">
            #{one}
        </foreach>
    </select>
    <select id="searchEmailByRoles" resultType="String">
        SELECT u.email
        FROM tb_user u
        JOIN tb_role r ON JSON_CONTAINS ( u.role, CONVERT ( r.id, CHAR ) )
        WHERE u.`status`=1
        AND r.role_name IN
        <foreach collection="array" open="(" close=")" item="one" separator=",">
            #{one}
        </foreach>
    </select>
</mapper>

创建TbAmectDao

@Mapper
public interface TbAmectDao {
    public int insert(TbAmect amect);
}

创建TbAmectTypeDao

@Mapper
public interface TbAmectTypeDao {
    public HashMap searchByType(String type);
}

创建TbLeaveDao

@Mapper
public interface TbLeaveDao {
    public HashMap searchLeaveByInstanceId(String instanceId);

    public int updateLeaveStatus(HashMap param);
}

创建TbMeetingDao

@Mapper
public interface TbMeetingDao {
    public HashMap searchMeetingByInstanceId(String instanceId);

    public boolean searchMeetingMembersInSameDept(String uuid);

    public HashMap searchMeetingByUUID(String uuid);

    public List<String> searchUserMeetingInMonth(HashMap param);

    public int updateMeetingStatus(HashMap param);

    public ArrayList<Integer> searchMeetingUnpresent(String uuid);

    public int updateMeetingUnpresent(HashMap param);
}

创建TbReimDao

@Mapper
public interface TbReimDao {
    public HashMap searchReimByInstanceId(String instanceId);

    public int updateReimStatus(HashMap param);
}

创建TbUserDao

@Mapper
public interface TbUserDao {
    public ArrayList<String> searchEmailByIds(int[] ids);

    public ArrayList<String> searchEmailByRoles(String[] roles);
}

创建Approval

@Data
public class Approval {
    private String processId;
    private String taskId;
    private String title;
    private String type;
    private String creatorName;
    private String createDate;
    private String status;
    private String result;
    private boolean filing;
}

创建TbAmect

@Data
public class TbAmect {
    private Integer id;
    private String uuid;
    private Integer userId;
    private BigDecimal amount;
    private Integer typeId;
    private String reason;
    private String prepayId;
    private Byte status;
    private Date createTime;
}

创建TbAmectType

@Data
public class TbAmectType {
    private Integer id;
    private String type;
    private BigDecimal money;
    private Boolean systemic;
}

创建TbLeave

@Data
public class TbLeave {
    private Integer id;
    private Integer userId;
    private String reason;
    private String start;
    private String end;
    private String days;
    private Byte type;
    private Byte status;
    private String instanceId;
    private Date createTime;
}

创建TbMeeting

@Data
public class TbMeeting implements Serializable {
    /**
     * 主键
     */
    private Long id;

    /**
     * UUID
     */
    private String uuid;

    /**
     * 会议题目
     */
    private String title;

    /**
     * 创建人ID
     */
    private Long creatorId;

    /**
     * 日期
     */
    private String date;

    /**
     * 开会地点
     */
    private String place;

    /**
     * 开始时间
     */
    private String start;

    /**
     * 结束时间
     */
    private String end;

    /**
     * 会议类型(1在线会议,2线下会议)
     */
    private Short type;

    /**
     * 参与者
     */
    private String members;

    /**
     * 会议内容
     */
    private String desc;

    /**
     * 工作流实例ID
     */
    private String instanceId;

    private String present;

    private String unpresent;

    /**
     * 状态(1未开始,2进行中,3已结束)
     */
    private Short status;

    /**
     * 创建时间
     */
    private Date createTime;

    private static final long serialVersionUID = 1L;
}

创建TbReim

@Data
public class TbReim {
    private Integer id;
    private Integer userId;
    private String content;
    private BigDecimal amount;
    private BigDecimal anleihen;
    private BigDecimal balance;
    private Byte typeId;
    private Byte status;
    private String instanceId;
    private Date createTime;
}

创建TbUser

@Data
public class TbUser implements Serializable {
    /**
     * 主键
     */
    private Integer id;

    /**
     * 用户名
     */
    private String username;


    /**
     * 密码
     */
    private String password;

    /**
     * 长期授权字符串
     */
    private String openId;

    /**
     * 昵称
     */
    private String nickname;

    /**
     * 头像网址
     */
    private String photo;

    /**
     * 姓名
     */
    private String name;

    /**
     * 性别
     */
    private Object sex;

    /**
     * 手机号码
     */
    private String tel;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 入职日期
     */
    private Date hiredate;

    /**
     * 角色
     */
    private Object role;

    /**
     * 是否是超级管理员
     */
    private Boolean root;

    /**
     * 部门编号
     */
    private Integer deptId;

    /**
     * 状态
     */
    private Byte status;

    /**
     * 创建时间
     */
    private Date createTime;

    private static final long serialVersionUID = 1L;
}

创建AmectServiceImpl

@Service
public class AmectServiceImpl implements AmectService {
    @Autowired
    private TbAmectDao amectDao;

    @Override
    public int insert(TbAmect amect) {
        int rows = amectDao.insert(amect);
        return rows;
    }
}

创建AmectTypeServiceImpl

@Service
public class AmectTypeServiceImpl implements AmectTypeService {
    @Autowired
    private TbAmectTypeDao amectTypeDao;

    @Override
    public HashMap searchByType(String type) {
        HashMap map= amectTypeDao.searchByType(type);
        return map;
    }
}

创建LeaveServiceImpl

@Service
public class LeaveServiceImpl implements LeaveService {
    @Autowired
    private TbLeaveDao leaveDao;

    @Override
    public HashMap searchLeaveByInstanceId(String instanceId) {
        HashMap map = leaveDao.searchLeaveByInstanceId(instanceId);
        return map;
    }
}

创建MeetingServiceImpl

@Service
public class MeetingServiceImpl implements MeetingService {
    @Autowired
    private TbMeetingDao meetingDao;

    @Autowired
    @Qualifier(value = "redisTemplate")
    private RedisTemplate redisTemplate;

    @Override
    public HashMap searchMeetingByUUID(String uuid) {
        HashMap meeting = meetingDao.searchMeetingByUUID(uuid);
        return meeting;
    }


    @Override
    public Long searchRoomIdByUUID(String uuid) {
        Object temp = redisTemplate.opsForValue().get(uuid);
        long roomId = Long.parseLong(temp.toString());
        return roomId;
    }

    @Override
    public List<String> searchUserMeetingInMonth(HashMap param) {
        List list = meetingDao.searchUserMeetingInMonth(param);
        return list;
    }

    @Override
    public void updateMeetingStatus(HashMap param) {
        int row = meetingDao.updateMeetingStatus(param);
        if (row != 1) {
            throw new EmosException("会议状态更新失败");
        }
    }

    @Override
    public ArrayList<Integer> searchMeetingUnpresent(String uuid) {
        ArrayList<Integer> list=meetingDao.searchMeetingUnpresent(uuid);
        return list;
    }

    @Override
    public int updateMeetingUnpresent(HashMap param) {
        int rows=meetingDao.updateMeetingUnpresent(param);
        return rows;
    }
}

创建ReimServiceImpl


@Service
public class ReimServiceImpl implements ReimService {

    @Autowired
    private TbReimDao reimDao;

    @Override
    public HashMap searchReimByInstanceId(String instanceId) {
        HashMap map = reimDao.searchReimByInstanceId(instanceId);
        return map;
    }
}

创建SearchApprovalBpmnForm

@Data
public class SearchApprovalBpmnForm {
    @NotBlank(message = "instanceId不能为空")
    private String instanceId;

    @NotBlank(message = "code不能为空")
    private String code;

    @NotBlank(message = "tcode不能为空")
    @Pattern(regexp = "^[0-9]{6}$",message = "tcode必须是6位数字")
    private String tcode;
}

创建ApprovalTaskForm

public class ApprovalTaskForm {

    @NotBlank(message = "taskId不能为空")
    private String taskId;

    @NotBlank(message = "approval不能为空")
    @Pattern(regexp = "^同意$|^不同意$", message = "approval内容不正确")
    private String approval;

    @NotBlank(message = "code不能为空")
    private String code;

    @NotBlank(message = "tcode不能为空")
    @Pattern(regexp = "^[0-9]{6}$",message = "tcode必须是6位数字")
    private String tcode;

}
索引目录