Authored by mlge

数据库工单 流程修改:新增 审核步骤

... ... @@ -52,4 +52,6 @@ public class DBWorkJob {
private String updateTime;
private String verifier;//工单审核人 --新增
}
... ...
... ... @@ -47,7 +47,7 @@ public class HandledJob {
*/
private String handlerRole;
/**
* 处理类型 1 发起 2 通过 3 驳回 -1 close
* 处理类型 1 发起 2 通过 3 驳回 -1 close 4 审核通过
*/
private int handleType;
... ...
... ... @@ -13,6 +13,7 @@ public class HandleType {
public static final int CLOSE = -1;
public static final int VERIFYPASS = 4;
public static String getCtype(int type){
switch (type){
case CREATE:
... ... @@ -23,6 +24,8 @@ public class HandleType {
return "拒绝";
case CLOSE:
return "关闭";
case VERIFYPASS:
return "审核通过";
default:
return "其他";
... ...
... ... @@ -61,6 +61,13 @@ public class WorkStatus {
*/
public static final int DBA_CHECK_PASS = 9;
/**
*新增状态
* 待审核人审核*/
public static final int PUBLISH_UNCHECK = 10;
public static final int PUBLISH_CHECKED = 11;
public static String getCstatus(int type){
switch (type){
... ... @@ -84,6 +91,10 @@ public class WorkStatus {
return "测试验收失败";
case AUTO_ROLLBACK:
return "自动回滚";
case PUBLISH_UNCHECK:
return "发起,待审核";
case PUBLISH_CHECKED:
return "审核通过";
default:
return "其他";
... ...
... ... @@ -77,7 +77,12 @@ public class DBServiceImpl implements DBService {
dbWorkJob.setId(workId);
//插入发布工单表
dbWorkJob.setStatus(WorkStatus.PUBLISH);
if(dbWorkJob.getVerifier() == null ||"".equals(dbWorkJob.getVerifier())){//未选择审核人,不需要被审核
dbWorkJob.setStatus(WorkStatus.PUBLISH);
}else{
dbWorkJob.setStatus(WorkStatus.PUBLISH_UNCHECK);//选择审核人,待审核状态
}
int result = dbWorkJobMapper.insert(dbWorkJob);
if (result < 1) {
return -1;
... ... @@ -88,8 +93,14 @@ public class DBServiceImpl implements DBService {
handledJobMapper.insert(handledJob);
//插入用户待处理工单表
PendingJob pendingJob = new PendingJob(WorkType.DB_PROJECT, dbWorkJob.getId(), dbWorkJob.getTitle(), null, HandlerRole.DBA, WorkStatus.PUBLISH);
workSystemSupport.addPendingByRole(pendingJob, false);
if("".equals(dbWorkJob.getVerifier())){//未选择工单审核人,则按照旧的流程走
PendingJob pendingJob = new PendingJob(WorkType.DB_PROJECT, dbWorkJob.getId(), dbWorkJob.getTitle(), null, HandlerRole.DBA, WorkStatus.PUBLISH);
workSystemSupport.addPendingByRole(pendingJob, false);
}else{//选择审核人,则只有当前审核人来处理该工单
PendingJob pendingJob = new PendingJob(WorkType.DB_PROJECT, dbWorkJob.getId(), dbWorkJob.getTitle(),dbWorkJob.getVerifier(),"verifier",WorkStatus.PUBLISH_UNCHECK);
workSystemSupport.addPendingJob(pendingJob,false);
}
return result;
}
... ... @@ -122,7 +133,7 @@ public class DBServiceImpl implements DBService {
return 1;
}
int currentStatus = pendingJob.getCurrentStatus();
if (currentStatus == WorkStatus.PUBLISH) {
if (currentStatus == WorkStatus.PUBLISH || currentStatus == WorkStatus.PUBLISH_CHECKED) {//发布状态或者 发布后审核通过状态,按照之前的流程走
dbWorkJob.setDba(handledJob.getHandler());
if (handleType == HandleType.PASS) {//通过
if (StringUtils.equals("true", handledJob.getDbNeedTest())) {//需要测试
... ... @@ -160,6 +171,21 @@ public class DBServiceImpl implements DBService {
dbWorkJob.setStatus(WorkStatus.EXE_FAILE);//发布失败
workSystemSupport.workend(dbWorkJob.getId(), WorkType.DB_PROJECT, dbWorkJob.getTitle(), WorkStatus.getCstatus(WorkStatus.EXE_FAILE));
}
}else if(currentStatus == WorkStatus.PUBLISH_UNCHECK ){//发布待审核状态
dbWorkJob.setDba(handledJob.getHandler());
if (handleType == HandleType.VERIFYPASS) {//通过(默认不需要测试)
dbWorkJob.setStatus(WorkStatus.PUBLISH_CHECKED);
dbWorkJobMapper.update(dbWorkJob);//更新,下一步需要 重新查询
//给审核人及领导发送审核通过通知
workSystemSupport.workend(dbWorkJob.getId(), WorkType.DB_PROJECT, dbWorkJob.getTitle(), WorkStatus.getCstatus(WorkStatus.PUBLISH_CHECKED));
//给dba发送审核通知---参照旧流程
PendingJob p = new PendingJob(WorkType.DB_PROJECT, dbWorkJob.getId(), dbWorkJob.getTitle(), null, HandlerRole.DBA, WorkStatus.PUBLISH_CHECKED);
workSystemSupport.addPendingByRole(p, false);
}else{//拒绝(默认不需要测试)
dbWorkJob.setStatus(WorkStatus.EXE_FAILE);
workSystemSupport.workend(dbWorkJob.getId(), WorkType.DB_PROJECT, dbWorkJob.getTitle(), WorkStatus.getCstatus(WorkStatus.EXE_FAILE));
}
}
dbWorkJobMapper.update(dbWorkJob);//填写工单结果
return 1;
... ...
... ... @@ -181,6 +181,24 @@ public class WorkSystemSupport {
}
}
/**
* 数据库工单--审核人 待办工单
*
* @param pendingJob
*/
public void addPendingJob(PendingJob pendingJob, boolean sendLeader) {
pendingJobMapper.insert(pendingJob);
User user = userMapper.selectByName(pendingJob.getHandler());
Mail.Builder builder = Mail.Builder(pendingJob.getType() + "_工单待办");
DBWorkJob dbWorkJob = dbWorkJobMapper.selectById(pendingJob.getWorkId());
StringBuilder mobileBuilder = new StringBuilder();
mobileBuilder.append(user.getMobile()).append(",");
builder.receiver(user.getEmail());
dbSmsAndMail(mobileBuilder.toString().substring(0, mobileBuilder.toString().length() - 1), builder, dbWorkJob, sendLeader);
}
/**
* 发送短信和邮件
*/
... ... @@ -307,4 +325,7 @@ public class WorkSystemSupport {
}
}
... ...