Authored by zhengyouwei

db work

@@ -137,14 +137,14 @@ public class HttpUriContants { @@ -137,14 +137,14 @@ public class HttpUriContants {
137 public static final String GET_RELEASEWORKJOBS = "/releaseWork/getReleaseWorkJobs"; 137 public static final String GET_RELEASEWORKJOBS = "/releaseWork/getReleaseWorkJobs";
138 public static final String GET_RELEASEWORKJOB_ID = "/releaseWork/getReleaseWorkJob"; 138 public static final String GET_RELEASEWORKJOB_ID = "/releaseWork/getReleaseWorkJob";
139 public static final String CREATE_RELEASEWORKJOB = "/releaseWork/createReleaseWorkJob"; 139 public static final String CREATE_RELEASEWORKJOB = "/releaseWork/createReleaseWorkJob";
  140 + public static final String CHECK_RELEASE_ROLE = "/releaseWork/checkRole";
  141 + public static final String GET_DBWORKJOB_ID = "/dbWork/getDBWorkJob";
  142 + public static final String CREATE_DBWORKJOB = "/dbWork/createDBWorkJob";
  143 + public static final String CHECK_DB_ROLE = "/dbWork/checkRole";
140 public static final String GET_HANDLED_JOBS = "/handledWork/getHandledJobs"; 144 public static final String GET_HANDLED_JOBS = "/handledWork/getHandledJobs";
141 public static final String HANDLE_JOB = "/handledWork/dealWorkJob"; 145 public static final String HANDLE_JOB = "/handledWork/dealWorkJob";
142 public static final String GET_PENDING_JOBS = "/pendingWork/getPendingJobs"; 146 public static final String GET_PENDING_JOBS = "/pendingWork/getPendingJobs";
143 public static final String GET_PENDING_JOB_BYUSER = "/pendingWork/getPendingJobByUser"; 147 public static final String GET_PENDING_JOB_BYUSER = "/pendingWork/getPendingJobByUser";
144 - public static final String CHECK_RELEASE_ROLE = "/releaseWork/checkRole";  
145 public static final String GET_WORKJOBS = "/works/getWorkJobs"; 148 public static final String GET_WORKJOBS = "/works/getWorkJobs";
146 - public static final String GET_WORKJOB_ID = "/works/getWorkJob";  
147 -  
148 -  
149 149
150 } 150 }
  1 +package com.ui.model.req;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * Created by zhengyouwei on 2016/9/2.
  9 + *
  10 + * 发布工单
  11 + */
  12 +@Data
  13 +public class DBWorkJob {
  14 +
  15 + /**
  16 + * id
  17 + */
  18 + private String id;
  19 +
  20 + /**
  21 + * 主题
  22 + */
  23 + private String title;
  24 +
  25 + /**
  26 + * 内容
  27 + */
  28 + private String text;
  29 +
  30 + /**
  31 + * 开发
  32 + */
  33 + private String develop;
  34 +
  35 + /**
  36 + * dba
  37 + */
  38 + private String dba;
  39 +
  40 + /**
  41 + * WorkStatus 详见
  42 + *
  43 + */
  44 + private int status;
  45 +
  46 + /**
  47 + * 工单操作记录
  48 + */
  49 + private List<HandledJob> handleList;
  50 +
  51 + private String createTime;
  52 +
  53 + private String updateTime;
  54 +
  55 +}
@@ -77,8 +77,13 @@ public class WorkSystemCtrl { @@ -77,8 +77,13 @@ public class WorkSystemCtrl {
77 BaseResponse response = httpRestClient.defaultGet(HttpUriContants.GET_RELEASEWORKJOB_ID + "?id=" + workid, BaseResponse.class); 77 BaseResponse response = httpRestClient.defaultGet(HttpUriContants.GET_RELEASEWORKJOB_ID + "?id=" + workid, BaseResponse.class);
78 model.addAttribute("workJob", response.getData()); 78 model.addAttribute("workJob", response.getData());
79 return new ModelAndView("worksystem/releaseWork"); 79 return new ModelAndView("worksystem/releaseWork");
  80 + }else if ("db".equals(type)){
  81 + BaseResponse response = httpRestClient.defaultGet(HttpUriContants.GET_DBWORKJOB_ID + "?id=" + workid, BaseResponse.class);
  82 + model.addAttribute("workJob", response.getData());
  83 + return new ModelAndView("worksystem/dbWork");
80 } 84 }
81 - return new ModelAndView("worksystem/releaseWork"); 85 +
  86 + return new ModelAndView("worksystem/workList");
82 } 87 }
83 88
84 @RequestMapping("/getProjectsByPlatform") 89 @RequestMapping("/getProjectsByPlatform")
@@ -102,6 +107,9 @@ public class WorkSystemCtrl { @@ -102,6 +107,9 @@ public class WorkSystemCtrl {
102 if ("release".equals(type)) {//项目发布 107 if ("release".equals(type)) {//项目发布
103 BaseResponse<Integer> baseResponse = httpRestClient.defaultGet(HttpUriContants.CHECK_RELEASE_ROLE + "?role=" + user.getRole(), BaseResponse.class); 108 BaseResponse<Integer> baseResponse = httpRestClient.defaultGet(HttpUriContants.CHECK_RELEASE_ROLE + "?role=" + user.getRole(), BaseResponse.class);
104 return baseResponse.getData(); 109 return baseResponse.getData();
  110 + }else if ("db".equals(type)){
  111 + BaseResponse<Integer> baseResponse = httpRestClient.defaultGet(HttpUriContants.CHECK_DB_ROLE + "?role=" + user.getRole(), BaseResponse.class);
  112 + return baseResponse.getData();
105 } 113 }
106 return 0; 114 return 0;
107 } 115 }
@@ -116,7 +124,14 @@ public class WorkSystemCtrl { @@ -116,7 +124,14 @@ public class WorkSystemCtrl {
116 BaseResponse<Integer> baseResponse = httpRestClient.defaultPost(HttpUriContants.CREATE_RELEASEWORKJOB, releaseWorkJob, BaseResponse.class); 124 BaseResponse<Integer> baseResponse = httpRestClient.defaultPost(HttpUriContants.CREATE_RELEASEWORKJOB, releaseWorkJob, BaseResponse.class);
117 return baseResponse.getData(); 125 return baseResponse.getData();
118 } 126 }
119 - 127 + @RequestMapping("/createDBWorkJob")
  128 + @ResponseBody
  129 + public int createDBWorkJob(@RequestBody DBWorkJob dbWorkJob, HttpSession session) {
  130 + User user = (User) session.getAttribute("user");
  131 + dbWorkJob.setDevelop(user.getName());
  132 + BaseResponse<Integer> baseResponse = httpRestClient.defaultPost(HttpUriContants.CREATE_DBWORKJOB, dbWorkJob, BaseResponse.class);
  133 + return baseResponse.getData();
  134 + }
120 @RequestMapping("/getHandledJobs") 135 @RequestMapping("/getHandledJobs")
121 @ResponseBody 136 @ResponseBody
122 public BaseResponse getHandledJobs(HttpSession session, PageRequest req) { 137 public BaseResponse getHandledJobs(HttpSession session, PageRequest req) {
@@ -142,6 +142,7 @@ @@ -142,6 +142,7 @@
142 <option value="develop" selected="selected">develop</option> 142 <option value="develop" selected="selected">develop</option>
143 <option value="test">test</option> 143 <option value="test">test</option>
144 <option value="operator">operator</option> 144 <option value="operator">operator</option>
  145 + <option value="dba">dba</option>
145 <option value="leader">leader</option> 146 <option value="leader">leader</option>
146 <option value="other">other</option> 147 <option value="other">other</option>
147 </select> 148 </select>
@@ -44,6 +44,9 @@ @@ -44,6 +44,9 @@
44 <div class="form-inline"> 44 <div class="form-inline">
45 <a href="#" id="toAddUser" class="btn btn-success" 45 <a href="#" id="toAddUser" class="btn btn-success"
46 style="margin-top: 12px;margin-left: 0px;" onclick="toAddReleaseWork()">新建发布工单</a> 46 style="margin-top: 12px;margin-left: 0px;" onclick="toAddReleaseWork()">新建发布工单</a>
  47 + &nbsp;
  48 + <a href="#" id="toAddDBJob" class="btn btn-success"
  49 + style="margin-top: 12px;margin-left: 0px;" onclick="toAddDBJob()">新建数据库工单</a>
47 </div> 50 </div>
48 </div> 51 </div>
49 </div> 52 </div>
@@ -122,6 +125,37 @@ @@ -122,6 +125,37 @@
122 <!-- form-group --> 125 <!-- form-group -->
123 </form> 126 </form>
124 </div> 127 </div>
  128 +
  129 + <div id="dbWorkDiv" style="display: none">
  130 + <form class="form-horizontal form-bordered">
  131 +
  132 + <div class="form-group">
  133 + <label class="col-sm-1 control-label"><strong>主题: </strong></label>
  134 +
  135 + <div class="col-sm-8">
  136 + <input type="text" id="dbtitle" name="dbtitle" class="form-control" placeholder="ex:2016.09.08_sql"/>
  137 + </div>
  138 + </div>
  139 +
  140 + <div class="form-group">
  141 + <label class="col-sm-1 control-label"><strong>内容: </strong></label>
  142 +
  143 + <div class="col-sm-8">
  144 + <textarea name="dbtext" id="dbtext" class="form-control" rows="10"></textarea>
  145 + </div>
  146 + </div>
  147 +
  148 + <div class="form-group">
  149 + <label class="col-sm-1 control-label"><strong>操作: </strong></label>
  150 +
  151 + <div class="col-sm-8">
  152 + <button type="button" class="btn btn-primary" onclick="addDBJob()">提交</button>
  153 + </div>
  154 + </div>
  155 + <!-- form-group -->
  156 + </form>
  157 + </div>
  158 +
125 </div> 159 </div>
126 </div> 160 </div>
127 </div> 161 </div>
@@ -147,6 +181,7 @@ @@ -147,6 +181,7 @@
147 if (data != 1) { 181 if (data != 1) {
148 localAlert("权限不够", "你不能发起该工单"); 182 localAlert("权限不够", "你不能发起该工单");
149 } else { 183 } else {
  184 + $("#dbWorkDiv").hide();
150 $("#releaseWorkDiv").show(); 185 $("#releaseWorkDiv").show();
151 } 186 }
152 }, 187 },
@@ -156,6 +191,24 @@ @@ -156,6 +191,24 @@
156 }); 191 });
157 } 192 }
158 193
  194 + function toAddDBJob() {
  195 + $.ajax({
  196 + url: contextPath + 'workSystem/checkRole?type=db',
  197 + type: 'POST',
  198 + success: function (data) {
  199 + if (data != 1) {
  200 + localAlert("权限不够", "你不能发起该工单");
  201 + } else {
  202 + $("#releaseWorkDiv").hide();
  203 + $("#dbWorkDiv").show();
  204 + }
  205 + },
  206 + error: function (e) {
  207 + console.log(e);
  208 + }
  209 + });
  210 + }
  211 +
159 function changePlatform() { 212 function changePlatform() {
160 var platform = $('input:radio[name=platform]:checked').val(); 213 var platform = $('input:radio[name=platform]:checked').val();
161 $.ajax({ 214 $.ajax({
@@ -181,6 +234,45 @@ @@ -181,6 +234,45 @@
181 } 234 }
182 235
183 /** 236 /**
  237 + *添加DB工单
  238 + */
  239 + function addDBJob() {
  240 + var title = $("input[name='dbtitle']").val();
  241 + var text = $("textarea[name='dbtext']").val();
  242 +
  243 + if (title == null || title == "") {
  244 + localAlert("参数错误", "请输入标题");
  245 + return;
  246 + }
  247 + if (text == null || text == "") {
  248 + localAlert("参数错误", "请输入需求");
  249 + return;
  250 + }
  251 + var param = {
  252 + title: title,
  253 + text: text
  254 + };
  255 +
  256 + $.ajax({
  257 + url: contextPath + "/workSystem/createDBWorkJob",
  258 + type: 'post',
  259 + data: JSON.stringify(param),
  260 + dataType: "json",
  261 + contentType: "application/json",
  262 + success: function (data) {
  263 + if (data < 0) {
  264 + localAlert('添加失败', data.message);
  265 + } else {
  266 + window.location.href = contextPath + "/workSystem/toHandledWork";
  267 + }
  268 + },
  269 + error: function (e) {
  270 + console.log(e);
  271 + }
  272 + });
  273 + }
  274 +
  275 + /**
184 *添加项目发布工单 276 *添加项目发布工单
185 */ 277 */
186 function addReleaseJob() { 278 function addReleaseJob() {
@@ -248,7 +340,6 @@ @@ -248,7 +340,6 @@
248 } 340 }
249 }); 341 });
250 } 342 }
251 -  
252 </script> 343 </script>
253 </body> 344 </body>
254 </html> 345 </html>
  1 +<%@page language="java" contentType="text/html;charset=utf-8" %>
  2 +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  3 +
  4 +<%
  5 + String path = request.getContextPath();
  6 + String basePath = request.getScheme() + "://"
  7 + + request.getServerName() + ":" + request.getServerPort()
  8 + + path + "/";
  9 +%>
  10 +
  11 +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  12 +<html lang="en">
  13 +<head>
  14 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  15 +
  16 + <title>工单</title>
  17 + <link rel="stylesheet" href="<%=basePath %>css/unicorn.main.css"/>
  18 + <link rel="stylesheet" href="<%=basePath %>css/unicorn.grey.css"/>
  19 + <link rel="stylesheet" href="<%=basePath %>css/bootstrap.min.css"/>
  20 + <link href="<%=basePath%>css/style.default.css" rel="stylesheet">
  21 + <link href="<%=basePath%>css/morris.css" rel="stylesheet">
  22 + <link href="<%=basePath%>css/select2.css" rel="stylesheet"/>
  23 + <script>
  24 + var contextPath = '<%=basePath %>';
  25 + </script>
  26 +</head>
  27 +
  28 +<body style="background-color: #444444;font-size: 14px">
  29 +
  30 +<!-- 头部 -->
  31 +<div id="head">
  32 +</div>
  33 +<div id="content" style="background-color: white">
  34 + <div id="breadcrumb">
  35 + <a href="#" title="Go to Home" class="tip-bottom"><i
  36 + class="icon-home"></i> Home</a> <a href="#" class="current">工单详情</a>
  37 + </div>
  38 + <div>
  39 + <form class="form-horizontal form-bordered">
  40 + <div class="form-group">
  41 + <label class="col-sm-6 control-label"><strong>工单ID: </strong></label>
  42 +
  43 + <div class="col-sm-8">
  44 + <input type="text" class="form-control" value=" ${workJob.id}"
  45 + style='border-left:0px;border-top:0px;border-right:0px;border-bottom:1px '
  46 + readonly="readonly"/>
  47 + </div>
  48 + </div>
  49 +
  50 + <div class="form-group">
  51 + <label class="col-sm-6 control-label"><strong>发布时间: </strong></label>
  52 +
  53 + <div class="col-sm-8">
  54 + <input type="text" class="form-control" value=" ${workJob.createTime}"
  55 + style='border-left:0px;border-top:0px;border-right:0px;border-bottom:1px '
  56 + readonly="readonly"/>
  57 + </div>
  58 + </div>
  59 +
  60 + <div class="form-group">
  61 + <label class="col-sm-6 control-label"><strong>主题: </strong></label>
  62 +
  63 + <div class="col-sm-8">
  64 + <input type="text" class="form-control" value=" ${workJob.title}"
  65 + style='border-left:0px;border-top:0px;border-right:0px;border-bottom:1px '
  66 + readonly="readonly"/>
  67 + </div>
  68 + </div>
  69 +
  70 + <div class="form-group">
  71 + <label class="col-sm-6 control-label"><strong>内容: </strong></label>
  72 +
  73 + <div class="col-sm-8">
  74 + <textarea id="autoResizeTA" class="form-control" rows="10"
  75 + readonly="readonly">${workJob.text}</textarea>
  76 + </div>
  77 + </div>
  78 +
  79 + <div class="form-group">
  80 + <label class="col-sm-6 control-label"><strong>审批过程: </strong></label>
  81 +
  82 + <div class="col-sm-8">
  83 + <table class="table table-striped mb30" style="width: 778px">
  84 + <thead>
  85 + <tr>
  86 + <th>职责</th>
  87 + <th>操作人</th>
  88 + <th>操作</th>
  89 + <th>时间</th>
  90 + </tr>
  91 + </thead>
  92 + <tbody>
  93 + <c:forEach items="${workJob.handleList }" var="handledJob">
  94 + <tr>
  95 + <td align="center">${handledJob.handlerRole}</td>
  96 + <td align="center">${handledJob.handler}</td>
  97 + <td align="center">${handledJob.handlecType}</td>
  98 + <td align="center">${handledJob.createTime}</td>
  99 + </tr>
  100 + </c:forEach>
  101 + </tbody>
  102 + </table>
  103 + </div>
  104 + </div>
  105 +
  106 + <c:if test="${count > 0}">
  107 + <div class="form-group">
  108 + <label class="col-sm-6 control-label"><strong>操作: </strong></label>
  109 +
  110 + <div class="col-sm-8">
  111 + <c:choose>
  112 + <c:when test="${pendingJob.status == 0}">
  113 + <button type="button" class="btn btn-success" onclick="editWork(${pendingJob.id},'${pendingJob.type}',2)">发起</button>
  114 + </c:when>
  115 + <c:otherwise>
  116 + <button type="button" class="btn btn-success" onclick="editWork(${pendingJob.id},'${pendingJob.type}',2)">通过</button>
  117 + <button type="button" class="btn btn-primary" onclick="editWork(${pendingJob.id},'${pendingJob.type}',3)">拒绝</button>
  118 + </c:otherwise>
  119 + </c:choose>
  120 + <button type="button" class="btn btn-danger" onclick="editWork(${pendingJob.id},'${pendingJob.type}',-1)">关闭</button>
  121 + </div>
  122 + </div>
  123 + </c:if>
  124 + <!-- form-group -->
  125 + </form>
  126 + </div>
  127 +</div>
  128 +
  129 +</div>
  130 +
  131 +<script src="<%=basePath%>js/jquery-2.1.4.min.js"></script>
  132 +<script src="<%=basePath%>js/bootstrap.min.js"></script>
  133 +<script src="<%=basePath%>js/select2.min.js"></script>
  134 +<script src="<%=basePath%>js/custom.js"></script>
  135 +<script src="<%=basePath %>/js/unicorn.js"></script>
  136 +<script src="<%=basePath %>script/common/genarate_left_panel.js"></script>
  137 +<script type="text/javascript">
  138 + $("#li_worksystem").addClass("active open");
  139 +
  140 + /**
  141 + * 工单操作
  142 + * @param id
  143 + * @param handleType
  144 + */
  145 + function editWork(id,type, handleType) {
  146 + var param = {
  147 + id: id,
  148 + type:type,
  149 + handleType: handleType
  150 + };
  151 +
  152 + $.ajax({
  153 + url: contextPath + "/workSystem/handleJobsJobs",
  154 + type: 'post',
  155 + data: JSON.stringify(param),
  156 + dataType: "json",
  157 + contentType: "application/json",
  158 + success: function (data) {
  159 + if (data != 1) {
  160 + localAlert('处理结果', "处理失败");
  161 + } else {
  162 + window.location.href = contextPath + "/workSystem/toHandledWork";
  163 + }
  164 + },
  165 + error: function (e) {
  166 + console.log(e);
  167 + }
  168 + });
  169 + }
  170 +</script>
  171 +</body>
  172 +</html>
@@ -107,6 +107,8 @@ @@ -107,6 +107,8 @@
107 formatter: function (value, rowData, rowIndex) { 107 formatter: function (value, rowData, rowIndex) {
108 if (value == 'release') { 108 if (value == 'release') {
109 return '项目发布'; 109 return '项目发布';
  110 + }else if(value == 'db'){
  111 + return '数据库';
110 } else { 112 } else {
111 return '其他'; 113 return '其他';
112 } 114 }
@@ -107,6 +107,8 @@ @@ -107,6 +107,8 @@
107 formatter: function (value, rowData, rowIndex) { 107 formatter: function (value, rowData, rowIndex) {
108 if (value == 'release') { 108 if (value == 'release') {
109 return '项目发布'; 109 return '项目发布';
  110 + }else if(value == 'db'){
  111 + return '数据库';
110 } else { 112 } else {
111 return '其他'; 113 return '其他';
112 } 114 }
@@ -135,6 +135,8 @@ @@ -135,6 +135,8 @@
135 formatter : function(value, rowData, rowIndex) { 135 formatter : function(value, rowData, rowIndex) {
136 if(value == 'release'){ 136 if(value == 'release'){
137 return '项目发布'; 137 return '项目发布';
  138 + }else if(value == 'db'){
  139 + return '数据库';
138 } else{ 140 } else{
139 return '其他'; 141 return '其他';
140 } 142 }