Authored by zhengyouwei

db work

... ... @@ -137,14 +137,14 @@ public class HttpUriContants {
public static final String GET_RELEASEWORKJOBS = "/releaseWork/getReleaseWorkJobs";
public static final String GET_RELEASEWORKJOB_ID = "/releaseWork/getReleaseWorkJob";
public static final String CREATE_RELEASEWORKJOB = "/releaseWork/createReleaseWorkJob";
public static final String CHECK_RELEASE_ROLE = "/releaseWork/checkRole";
public static final String GET_DBWORKJOB_ID = "/dbWork/getDBWorkJob";
public static final String CREATE_DBWORKJOB = "/dbWork/createDBWorkJob";
public static final String CHECK_DB_ROLE = "/dbWork/checkRole";
public static final String GET_HANDLED_JOBS = "/handledWork/getHandledJobs";
public static final String HANDLE_JOB = "/handledWork/dealWorkJob";
public static final String GET_PENDING_JOBS = "/pendingWork/getPendingJobs";
public static final String GET_PENDING_JOB_BYUSER = "/pendingWork/getPendingJobByUser";
public static final String CHECK_RELEASE_ROLE = "/releaseWork/checkRole";
public static final String GET_WORKJOBS = "/works/getWorkJobs";
public static final String GET_WORKJOB_ID = "/works/getWorkJob";
}
... ...
package com.ui.model.req;
import lombok.Data;
import java.util.List;
/**
* Created by zhengyouwei on 2016/9/2.
*
* 发布工单
*/
@Data
public class DBWorkJob {
/**
* id
*/
private String id;
/**
* 主题
*/
private String title;
/**
* 内容
*/
private String text;
/**
* 开发
*/
private String develop;
/**
* dba
*/
private String dba;
/**
* WorkStatus 详见
*
*/
private int status;
/**
* 工单操作记录
*/
private List<HandledJob> handleList;
private String createTime;
private String updateTime;
}
... ...
... ... @@ -77,8 +77,13 @@ public class WorkSystemCtrl {
BaseResponse response = httpRestClient.defaultGet(HttpUriContants.GET_RELEASEWORKJOB_ID + "?id=" + workid, BaseResponse.class);
model.addAttribute("workJob", response.getData());
return new ModelAndView("worksystem/releaseWork");
}else if ("db".equals(type)){
BaseResponse response = httpRestClient.defaultGet(HttpUriContants.GET_DBWORKJOB_ID + "?id=" + workid, BaseResponse.class);
model.addAttribute("workJob", response.getData());
return new ModelAndView("worksystem/dbWork");
}
return new ModelAndView("worksystem/releaseWork");
return new ModelAndView("worksystem/workList");
}
@RequestMapping("/getProjectsByPlatform")
... ... @@ -102,6 +107,9 @@ public class WorkSystemCtrl {
if ("release".equals(type)) {//项目发布
BaseResponse<Integer> baseResponse = httpRestClient.defaultGet(HttpUriContants.CHECK_RELEASE_ROLE + "?role=" + user.getRole(), BaseResponse.class);
return baseResponse.getData();
}else if ("db".equals(type)){
BaseResponse<Integer> baseResponse = httpRestClient.defaultGet(HttpUriContants.CHECK_DB_ROLE + "?role=" + user.getRole(), BaseResponse.class);
return baseResponse.getData();
}
return 0;
}
... ... @@ -116,7 +124,14 @@ public class WorkSystemCtrl {
BaseResponse<Integer> baseResponse = httpRestClient.defaultPost(HttpUriContants.CREATE_RELEASEWORKJOB, releaseWorkJob, BaseResponse.class);
return baseResponse.getData();
}
@RequestMapping("/createDBWorkJob")
@ResponseBody
public int createDBWorkJob(@RequestBody DBWorkJob dbWorkJob, HttpSession session) {
User user = (User) session.getAttribute("user");
dbWorkJob.setDevelop(user.getName());
BaseResponse<Integer> baseResponse = httpRestClient.defaultPost(HttpUriContants.CREATE_DBWORKJOB, dbWorkJob, BaseResponse.class);
return baseResponse.getData();
}
@RequestMapping("/getHandledJobs")
@ResponseBody
public BaseResponse getHandledJobs(HttpSession session, PageRequest req) {
... ...
... ... @@ -142,6 +142,7 @@
<option value="develop" selected="selected">develop</option>
<option value="test">test</option>
<option value="operator">operator</option>
<option value="dba">dba</option>
<option value="leader">leader</option>
<option value="other">other</option>
</select>
... ...
... ... @@ -44,6 +44,9 @@
<div class="form-inline">
<a href="#" id="toAddUser" class="btn btn-success"
style="margin-top: 12px;margin-left: 0px;" onclick="toAddReleaseWork()">新建发布工单</a>
&nbsp;
<a href="#" id="toAddDBJob" class="btn btn-success"
style="margin-top: 12px;margin-left: 0px;" onclick="toAddDBJob()">新建数据库工单</a>
</div>
</div>
</div>
... ... @@ -122,6 +125,37 @@
<!-- form-group -->
</form>
</div>
<div id="dbWorkDiv" style="display: none">
<form class="form-horizontal form-bordered">
<div class="form-group">
<label class="col-sm-1 control-label"><strong>主题: </strong></label>
<div class="col-sm-8">
<input type="text" id="dbtitle" name="dbtitle" class="form-control" placeholder="ex:2016.09.08_sql"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label"><strong>内容: </strong></label>
<div class="col-sm-8">
<textarea name="dbtext" id="dbtext" class="form-control" rows="10"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label"><strong>操作: </strong></label>
<div class="col-sm-8">
<button type="button" class="btn btn-primary" onclick="addDBJob()">提交</button>
</div>
</div>
<!-- form-group -->
</form>
</div>
</div>
</div>
</div>
... ... @@ -147,6 +181,7 @@
if (data != 1) {
localAlert("权限不够", "你不能发起该工单");
} else {
$("#dbWorkDiv").hide();
$("#releaseWorkDiv").show();
}
},
... ... @@ -156,6 +191,24 @@
});
}
function toAddDBJob() {
$.ajax({
url: contextPath + 'workSystem/checkRole?type=db',
type: 'POST',
success: function (data) {
if (data != 1) {
localAlert("权限不够", "你不能发起该工单");
} else {
$("#releaseWorkDiv").hide();
$("#dbWorkDiv").show();
}
},
error: function (e) {
console.log(e);
}
});
}
function changePlatform() {
var platform = $('input:radio[name=platform]:checked').val();
$.ajax({
... ... @@ -181,6 +234,45 @@
}
/**
*添加DB工单
*/
function addDBJob() {
var title = $("input[name='dbtitle']").val();
var text = $("textarea[name='dbtext']").val();
if (title == null || title == "") {
localAlert("参数错误", "请输入标题");
return;
}
if (text == null || text == "") {
localAlert("参数错误", "请输入需求");
return;
}
var param = {
title: title,
text: text
};
$.ajax({
url: contextPath + "/workSystem/createDBWorkJob",
type: 'post',
data: JSON.stringify(param),
dataType: "json",
contentType: "application/json",
success: function (data) {
if (data < 0) {
localAlert('添加失败', data.message);
} else {
window.location.href = contextPath + "/workSystem/toHandledWork";
}
},
error: function (e) {
console.log(e);
}
});
}
/**
*添加项目发布工单
*/
function addReleaseJob() {
... ... @@ -248,7 +340,6 @@
}
});
}
</script>
</body>
</html>
... ...
<%@page language="java" contentType="text/html;charset=utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>工单</title>
<link rel="stylesheet" href="<%=basePath %>css/unicorn.main.css"/>
<link rel="stylesheet" href="<%=basePath %>css/unicorn.grey.css"/>
<link rel="stylesheet" href="<%=basePath %>css/bootstrap.min.css"/>
<link href="<%=basePath%>css/style.default.css" rel="stylesheet">
<link href="<%=basePath%>css/morris.css" rel="stylesheet">
<link href="<%=basePath%>css/select2.css" rel="stylesheet"/>
<script>
var contextPath = '<%=basePath %>';
</script>
</head>
<body style="background-color: #444444;font-size: 14px">
<!-- 头部 -->
<div id="head">
</div>
<div id="content" style="background-color: white">
<div id="breadcrumb">
<a href="#" title="Go to Home" class="tip-bottom"><i
class="icon-home"></i> Home</a> <a href="#" class="current">工单详情</a>
</div>
<div>
<form class="form-horizontal form-bordered">
<div class="form-group">
<label class="col-sm-6 control-label"><strong>工单ID: </strong></label>
<div class="col-sm-8">
<input type="text" class="form-control" value=" ${workJob.id}"
style='border-left:0px;border-top:0px;border-right:0px;border-bottom:1px '
readonly="readonly"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-6 control-label"><strong>发布时间: </strong></label>
<div class="col-sm-8">
<input type="text" class="form-control" value=" ${workJob.createTime}"
style='border-left:0px;border-top:0px;border-right:0px;border-bottom:1px '
readonly="readonly"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-6 control-label"><strong>主题: </strong></label>
<div class="col-sm-8">
<input type="text" class="form-control" value=" ${workJob.title}"
style='border-left:0px;border-top:0px;border-right:0px;border-bottom:1px '
readonly="readonly"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-6 control-label"><strong>内容: </strong></label>
<div class="col-sm-8">
<textarea id="autoResizeTA" class="form-control" rows="10"
readonly="readonly">${workJob.text}</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-6 control-label"><strong>审批过程: </strong></label>
<div class="col-sm-8">
<table class="table table-striped mb30" style="width: 778px">
<thead>
<tr>
<th>职责</th>
<th>操作人</th>
<th>操作</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<c:forEach items="${workJob.handleList }" var="handledJob">
<tr>
<td align="center">${handledJob.handlerRole}</td>
<td align="center">${handledJob.handler}</td>
<td align="center">${handledJob.handlecType}</td>
<td align="center">${handledJob.createTime}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
<c:if test="${count > 0}">
<div class="form-group">
<label class="col-sm-6 control-label"><strong>操作: </strong></label>
<div class="col-sm-8">
<c:choose>
<c:when test="${pendingJob.status == 0}">
<button type="button" class="btn btn-success" onclick="editWork(${pendingJob.id},'${pendingJob.type}',2)">发起</button>
</c:when>
<c:otherwise>
<button type="button" class="btn btn-success" onclick="editWork(${pendingJob.id},'${pendingJob.type}',2)">通过</button>
<button type="button" class="btn btn-primary" onclick="editWork(${pendingJob.id},'${pendingJob.type}',3)">拒绝</button>
</c:otherwise>
</c:choose>
<button type="button" class="btn btn-danger" onclick="editWork(${pendingJob.id},'${pendingJob.type}',-1)">关闭</button>
</div>
</div>
</c:if>
<!-- form-group -->
</form>
</div>
</div>
</div>
<script src="<%=basePath%>js/jquery-2.1.4.min.js"></script>
<script src="<%=basePath%>js/bootstrap.min.js"></script>
<script src="<%=basePath%>js/select2.min.js"></script>
<script src="<%=basePath%>js/custom.js"></script>
<script src="<%=basePath %>/js/unicorn.js"></script>
<script src="<%=basePath %>script/common/genarate_left_panel.js"></script>
<script type="text/javascript">
$("#li_worksystem").addClass("active open");
/**
* 工单操作
* @param id
* @param handleType
*/
function editWork(id,type, handleType) {
var param = {
id: id,
type:type,
handleType: handleType
};
$.ajax({
url: contextPath + "/workSystem/handleJobsJobs",
type: 'post',
data: JSON.stringify(param),
dataType: "json",
contentType: "application/json",
success: function (data) {
if (data != 1) {
localAlert('处理结果', "处理失败");
} else {
window.location.href = contextPath + "/workSystem/toHandledWork";
}
},
error: function (e) {
console.log(e);
}
});
}
</script>
</body>
</html>
... ...
... ... @@ -107,6 +107,8 @@
formatter: function (value, rowData, rowIndex) {
if (value == 'release') {
return '项目发布';
}else if(value == 'db'){
return '数据库';
} else {
return '其他';
}
... ...
... ... @@ -107,6 +107,8 @@
formatter: function (value, rowData, rowIndex) {
if (value == 'release') {
return '项目发布';
}else if(value == 'db'){
return '数据库';
} else {
return '其他';
}
... ...
... ... @@ -135,6 +135,8 @@
formatter : function(value, rowData, rowIndex) {
if(value == 'release'){
return '项目发布';
}else if(value == 'db'){
return '数据库';
} else{
return '其他';
}
... ...