完成队列管理页面

This commit is contained in:
kingsfighter 2020-09-11 20:49:55 +08:00
parent 147afd7258
commit 47e43fb296
9 changed files with 450 additions and 71 deletions

View File

@ -4,6 +4,9 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.dfm.constant.UserConstants; import com.ruoyi.dfm.constant.UserConstants;
import com.ruoyi.dfm.pojo.*; import com.ruoyi.dfm.pojo.*;
import com.ruoyi.dfm.service.FileService; import com.ruoyi.dfm.service.FileService;
@ -13,9 +16,11 @@ import com.ruoyi.dfm.util.PropertiesUtils;
import com.ruoyi.dfm.util.TimeUtil; import com.ruoyi.dfm.util.TimeUtil;
import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.framework.util.ShiroUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.aspectj.weaver.loadtime.Aj;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -41,9 +46,13 @@ import java.util.Map;
@Controller @Controller
@RequestMapping("/project.do") @RequestMapping("/project.do")
public class ProjectController extends BaseController public class ProjectController extends com.ruoyi.common.core.controller.BaseController
{ {
private static final Logger logger = LoggerFactory.getLogger(ProjectController.class); private static final Logger logger = LoggerFactory.getLogger(ProjectController.class);
@Value("${wait.time:10}")
private Integer waitTime;
@Autowired @Autowired
private ProjectService projectService; private ProjectService projectService;
@Autowired @Autowired
@ -239,7 +248,7 @@ public class ProjectController extends BaseController
{ {
page.setCurrentPage(Integer.parseInt(currentPage)); page.setCurrentPage(Integer.parseInt(currentPage));
} }
UserInfo user = getUserInfo(req); UserInfo user = ShiroUtils.getLoginUser();
List<Project> projects = null; List<Project> projects = null;
Project pre = null; Project pre = null;
Project next = null; Project next = null;
@ -295,7 +304,7 @@ public class ProjectController extends BaseController
users = depUsers; users = depUsers;
} }
Integer waitTime = Integer.parseInt(PropertiesUtils.getProperties().getProperty("wait.time", "10")); // Integer waitTime = Integer.parseInt(PropertiesUtils.getProperties().getProperty("wait.time", "10"));
if(null != projects && !projects.isEmpty()) { if(null != projects && !projects.isEmpty()) {
//融合实际排序 //融合实际排序
@ -316,77 +325,90 @@ public class ProjectController extends BaseController
req.setAttribute("projects", projects); req.setAttribute("projects", projects);
req.setAttribute("page", page); req.setAttribute("page", page);
req.setAttribute("users", users); req.setAttribute("users", users);
return new ModelAndView("queueManage"); return new ModelAndView("dfm/queueManage");
} }
@RequestMapping("/pause") @RequestMapping("/pause")
public void pause(HttpServletRequest req, HttpServletResponse res) @ResponseBody
public AjaxResult pause(HttpServletRequest req, HttpServletResponse res)
throws Exception throws Exception
{ {
try try
{ {
String pid = req.getParameter("pid"); String pid = req.getParameter("ids");
String[] pids = pid.split(","); String[] pids = pid.split(",");
String currentPage = req.getParameter("currentPage"); // String currentPage = req.getParameter("currentPage");
this.projectService.pauseProject(pids); this.projectService.pauseProject(pids);
outputMsg(res, "<script>document.location.href='project.do?method=queueManage&currentPage=" + currentPage + "';</script>"); return toAjax(1);
// outputMsg(res, "<script>document.location.href='project.do?method=queueManage&currentPage=" + currentPage + "';</script>");
} catch (Exception e) { } catch (Exception e) {
logger.error("暂停项目失败!", e); logger.error("暂停项目失败!", e);
outputMsg(res, "<script>alert('暂停项目失败,请联系管理员!');window.history.go(-1);</script>"); return toAjax(0);
// outputMsg(res, "<script>alert('暂停项目失败,请联系管理员!');window.history.go(-1);</script>");
} }
} }
@RequestMapping("/start") @RequestMapping("/start")
public void start(HttpServletRequest req, HttpServletResponse res) @ResponseBody
public AjaxResult start(HttpServletRequest req, HttpServletResponse res)
throws Exception throws Exception
{ {
try try
{ {
String pid = req.getParameter("pid"); String pid = req.getParameter("ids");
String[] pids = pid.split(","); String[] pids = pid.split(",");
String currentPage = req.getParameter("currentPage"); // String currentPage = req.getParameter("currentPage");
this.projectService.startProject(pids); this.projectService.startProject(pids);
outputMsg(res, "<script>document.location.href='project.do?method=queueManage&currentPage=" + currentPage + "';</script>"); // outputMsg(res, "<script>document.location.href='project.do?method=queueManage&currentPage=" + currentPage + "';</script>");
return toAjax(1);
} catch (Exception e) { } catch (Exception e) {
logger.error("批量开始项目失败!", e); logger.error("批量开始项目失败!", e);
outputMsg(res, "<script>alert('暂停开始失败,请联系管理员!');window.history.go(-1);</script>"); return toAjax(0);
// outputMsg(res, "<script>alert('暂停开始失败,请联系管理员!');window.history.go(-1);</script>");
} }
} }
@RequestMapping("/restore") @RequestMapping("/restore")
public void restore(HttpServletRequest req, HttpServletResponse res) throws Exception @ResponseBody
public AjaxResult restore(HttpServletRequest req, HttpServletResponse res) throws Exception
{ {
try try
{ {
String pid = req.getParameter("pid"); String pid = req.getParameter("pid");
String currentPage = req.getParameter("currentPage"); // String currentPage = req.getParameter("currentPage");
this.projectService.restoreProject(pid); this.projectService.restoreProject(pid);
outputMsg(res, "<script>document.location.href='project.do?method=queueManage&currentPage=" + currentPage + "';</script>"); return toAjax(1);
// outputMsg(res, "<script>document.location.href='project.do?method=queueManage&currentPage=" + currentPage + "';</script>");
} catch (Exception e) { } catch (Exception e) {
logger.error("恢复项目失败!", e); logger.error("恢复项目失败!", e);
outputMsg(res, "<script>alert('恢复项目失败,请联系管理员!');window.history.go(-1);</script>"); // outputMsg(res, "<script>alert('恢复项目失败,请联系管理员!');window.history.go(-1);</script>");
return toAjax(0);
} }
} }
@RequestMapping("/delete") @RequestMapping("/delete")
public void delete(HttpServletRequest req, HttpServletResponse res) throws Exception @ResponseBody
public AjaxResult delete(HttpServletRequest req, HttpServletResponse res) throws Exception
{ {
try try
{ {
String source = req.getParameter("source"); // String source = req.getParameter("source");
String pid = req.getParameter("pid"); String pid = req.getParameter("ids");
String[] pids = pid.split(","); String[] pids = pid.split(",");
this.projectService.deleteProject(pids); this.projectService.deleteProject(pids);
String currentPage = req.getParameter("currentPage"); // String currentPage = req.getParameter("currentPage");
outputMsg(res, "<script>alert('删除成功,确定跳转到队列管理!');document.location.href='project.do?method=" + source + "&currentPage=" + currentPage + "';</script>"); return toAjax(1);
// outputMsg(res, "<script>alert('删除成功,确定跳转到队列管理!');document.location.href='project.do?method=" + source + "&currentPage=" + currentPage + "';</script>");
} catch (Exception e) { } catch (Exception e) {
logger.error("删除项目失败!", e); logger.error("删除项目失败!", e);
outputMsg(res, "<script>alert('删除失败,确定跳转到队列管理!');window.history.go(-1);</script>"); // outputMsg(res, "<script>alert('删除失败,确定跳转到队列管理!');window.history.go(-1);</script>");
return toAjax(0);
} }
} }
@ -412,7 +434,7 @@ public class ProjectController extends BaseController
page.setCurrentPage(Integer.parseInt(currentPage)); page.setCurrentPage(Integer.parseInt(currentPage));
} }
UserInfo user = getUserInfo(req); UserInfo user = ShiroUtils.getLoginUser();
List projects = null; List projects = null;
List users = null; List users = null;
@ -594,7 +616,7 @@ public class ProjectController extends BaseController
String fid = req.getParameter("fid"); String fid = req.getParameter("fid");
FileInfo fileInfo = fileService.getById(Integer.parseInt(fid)); FileInfo fileInfo = fileService.getById(Integer.parseInt(fid));
UserInfo currentUser = getUserInfo(req); UserInfo currentUser = ShiroUtils.getLoginUser();
if (currentUser.getGroupId() == UserConstants.USER_LEVEL_NORMAL if (currentUser.getGroupId() == UserConstants.USER_LEVEL_NORMAL
&& currentUser.getId() != fileInfo.getUploadUser()) { && currentUser.getId() != fileInfo.getUploadUser()) {
outputMsg(response, "{\"success\":false,\"message\":\"该文件没有权限下载,请联系管理员!\"}"); outputMsg(response, "{\"success\":false,\"message\":\"该文件没有权限下载,请联系管理员!\"}");
@ -616,9 +638,11 @@ public class ProjectController extends BaseController
@RequestMapping("/queryProject") @RequestMapping("/queryProject")
public ModelAndView queryProject(HttpServletRequest req, HttpServletResponse res) @ResponseBody
public TableDataInfo queryProject(HttpServletRequest req, HttpServletResponse res)
throws Exception throws Exception
{ {
startPage();
String queryType = req.getParameter("queryType"); String queryType = req.getParameter("queryType");
String projectName = req.getParameter("projectName"); String projectName = req.getParameter("projectName");
String username = req.getParameter("username"); String username = req.getParameter("username");
@ -633,20 +657,26 @@ public class ProjectController extends BaseController
queryBean.setState(state); queryBean.setState(state);
queryBean.setUsername(username); queryBean.setUsername(username);
String currentPage = req.getParameter("currentPage"); // String currentPage = req.getParameter("currentPage");
Page page = new Page(); Page page = new Page();
if ((currentPage == null) || ("".equals(currentPage.trim()))) PageDomain pageDomain = TableSupport.getPageDomain();
{ page.setCurrentPage(pageDomain.getPageNum());
page.setCurrentPage(1); page.setPageSize(pageDomain.getPageSize());
}
else
{
page.setCurrentPage(Integer.parseInt(currentPage)); // if ((currentPage == null) || ("".equals(currentPage.trim())))
} // {
// page.setCurrentPage(1);
// }
// else
// {
// page.setCurrentPage(Integer.parseInt(currentPage));
// }
String[] states = new String[3]; String[] states = new String[3];
List<Project> projects = null; List<Project> projects = null;
UserInfo user = getUserInfo(req); UserInfo user = ShiroUtils.getLoginUser();
List users = null; List users = null;
if ("resultDownload".equals(queryType)) if ("resultDownload".equals(queryType))
{ {
@ -692,7 +722,9 @@ public class ProjectController extends BaseController
// req.setAttribute("queryParam", JSONObject.fromObject(queryBean)); // req.setAttribute("queryParam", JSONObject.fromObject(queryBean));
req.setAttribute("queryParam", JSON.toJSONString(queryBean)); req.setAttribute("queryParam", JSON.toJSONString(queryBean));
req.setAttribute("loadType", "query"); req.setAttribute("loadType", "query");
return new ModelAndView("resultDownload"); //FIXME 修改返回类型
// return new ModelAndView("resultDownload");
return null;
} }
if ("queueManage".equals(queryType)) if ("queueManage".equals(queryType))
{ {
@ -704,35 +736,56 @@ public class ProjectController extends BaseController
Page tempPage = new Page(); Page tempPage = new Page();
tempPage.setCurrentPage(1); tempPage.setCurrentPage(1);
tempPage.setPageSize(999999); tempPage.setPageSize(999999);
Project pre = null;
Project next = null;
//查询所有的项目按照优先级排序 //查询所有的项目按照优先级排序
List<Project> totalByStates = projectService.getProjectByStates(states, tempPage, null); List<Project> totalByStates = projectService.getProjectByStates(states, tempPage, null);
if (UserConstants.USER_LEVEL_ADMIN == user.getGroupId()) if (UserConstants.USER_LEVEL_ADMIN == user.getGroupId())
{ {
projects = this.projectService.getProjectByStates(states, page, queryBean); projects = this.projectService.getProjectByStates(states, page, queryBean);
if ((projects != null) && (!(projects.isEmpty())))
{
pre = this.projectService.getByPriState("up", ((Project)projects.get(0)).getId(), null, "待查");
next = this.projectService.getByPriState("down", ((Project)projects.get(projects.size() - 1)).getId(), null, "待查");
}
users = this.userService.getAllUser(); users = this.userService.getAllUser();
} }
else if (UserConstants.USER_LEVEL_NORMAL == user.getGroupId() || UserConstants.USER_LEVEL_SUPER_USER == user.getGroupId()) else if (UserConstants.USER_LEVEL_NORMAL == user.getGroupId() || UserConstants.USER_LEVEL_SUPER_USER == user.getGroupId())
{ {
projects = this.projectService.getProjectByStates(states, new int[]{user.getId()}, page, queryBean); projects = this.projectService.getProjectByStates(states, new int[]{user.getId()}, page, queryBean);
if ((projects != null) && (!(projects.isEmpty())))
{
pre = this.projectService.getByPriState("up", ((Project)projects.get(0)).getId(), new int[]{user.getId()}, "待查");
next = this.projectService.getByPriState("down", ((Project)projects.get(projects.size() - 1)).getId(), new int[]{user.getId()}, "待查");
}
users = Arrays.asList(user); users = Arrays.asList(user);
} }
//部门管理员可以查看部门所有人的项目 //部门管理员可以查看部门所有人的项目
else if (UserConstants.USER_LEVEL_DEP_ADMIN == user.getGroupId()) else if (UserConstants.USER_LEVEL_DEP_ADMIN == user.getGroupId())
{ {
String department = user.getDepartment(); String department = user.getDepartment();
//根据部门查询部门所有用户
List<UserInfo> depUsers = userService.getByDepartment(department); List<UserInfo> depUsers = userService.getByDepartment(department);
int[] uids = new int [depUsers.size()]; int[] uids = new int [depUsers.size()];
for (int i=0;i<uids.length;i++) { for (int i=0;i<uids.length;i++) {
uids[i] = depUsers.get(i).getId(); uids[i] = depUsers.get(i).getId();
} }
//根据部门用户查询出所有部门的项目
projects = this.projectService.getProjectByStates(states, uids, page, queryBean); projects = this.projectService.getProjectByStates(states, uids, page, queryBean);
if ((projects != null) && (!(projects.isEmpty())))
{
pre = this.projectService.getByPriState("up", ((Project)projects.get(0)).getId(), uids, "待查");
next = this.projectService.getByPriState("down", ((Project)projects.get(projects.size() - 1)).getId(), uids, "待查");
}
users = depUsers; users = depUsers;
} }
Integer waitTime = Integer.parseInt(PropertiesUtils.getProperties().getProperty("wait.time", "10")); // Integer waitTime = Integer.parseInt(PropertiesUtils.getProperties().getProperty("wait.time", "10"));
if(null != projects && !projects.isEmpty()) { if(null != projects && !projects.isEmpty()) {
//融合实际排序 //融合实际排序
for(Project project : projects) { for(Project project : projects) {
project.setHasNext(null != next);
project.setHasPre(null != pre);
for(int i=0;i<totalByStates.size();i++) { for(int i=0;i<totalByStates.size();i++) {
Project projectOrder = totalByStates.get(i); Project projectOrder = totalByStates.get(i);
if(project.getId() == projectOrder.getId()) { if(project.getId() == projectOrder.getId()) {
@ -744,17 +797,21 @@ public class ProjectController extends BaseController
} }
} }
req.setAttribute("projects", projects); // req.setAttribute("projects", projects);
req.setAttribute("page", page); // req.setAttribute("page", page);
req.setAttribute("users", users); // req.setAttribute("users", users);
return new ModelAndView("queueManage"); // req.setAttribute("hasPre", null != pre);
// req.setAttribute("hasNext", null != next);
// return new ModelAndView("queueManage");
return getDataTable(projects, page.getTotalCount());
} }
return null; return null;
} }
@ResponseBody
@RequestMapping("/changePri") @RequestMapping("/changePri")
public void changePri(HttpServletRequest req, HttpServletResponse res) public AjaxResult changePri(HttpServletRequest req, HttpServletResponse res)
throws Exception throws Exception
{ {
try try
@ -762,16 +819,17 @@ public class ProjectController extends BaseController
String pid = req.getParameter("pid"); String pid = req.getParameter("pid");
String change = req.getParameter("change"); String change = req.getParameter("change");
String currentPage = req.getParameter("currentPage"); // String currentPage = req.getParameter("currentPage");
int uids[] = null; int uids[] = null;
if (UserConstants.USER_LEVEL_NORMAL == getUserInfo(req).getGroupId()) UserInfo loginUser = ShiroUtils.getLoginUser();
if (UserConstants.USER_LEVEL_NORMAL == loginUser.getGroupId())
{ {
uids = new int[]{getUserInfo(req).getId()}; uids = new int[]{loginUser.getId()};
} }
else if (UserConstants.USER_LEVEL_DEP_ADMIN == getUserInfo(req).getGroupId()) else if (UserConstants.USER_LEVEL_DEP_ADMIN == loginUser.getGroupId())
{ {
//根据部门查询部门所有用户 //根据部门查询部门所有用户
String department = getUserInfo(req).getDepartment(); String department = loginUser.getDepartment();
List<UserInfo> depUsers = userService.getByDepartment(department); List<UserInfo> depUsers = userService.getByDepartment(department);
uids = new int [depUsers.size()]; uids = new int [depUsers.size()];
for (int i=0;i<uids.length;i++) { for (int i=0;i<uids.length;i++) {
@ -779,11 +837,13 @@ public class ProjectController extends BaseController
} }
} }
this.projectService.changePri(pid, uids, change); this.projectService.changePri(pid, uids, change);
outputMsg(res, "<script>document.location.href='project.do?method=queueManage&currentPage=" + currentPage + "';</script>"); return toAjax(1);
// outputMsg(res, "<script>document.location.href='project.do?method=queueManage&currentPage=" + currentPage + "';</script>");
} }
catch (Exception e) { catch (Exception e) {
logger.error("调整优先级失败!", e); logger.error("调整优先级失败!", e);
outputMsg(res, "<script>alert('调整优先级失败,请联系管理员!');window.history.go(-1);</script>"); // outputMsg(res, "<script>alert('调整优先级失败,请联系管理员!');window.history.go(-1);</script>");
return toAjax(0);
} }
} }

View File

@ -137,4 +137,10 @@ swagger:
enabled: true enabled: true
#上传文件根路径 #上传文件根路径
FILE_PHYSICAL_ROOT: E:/FileRoot/ FILE_PHYSICAL_ROOT: E:/FileRoot/
FILE_WEB_ROOT: http://localhost:8080/FileRoot/uploadfile
wait:
time: 10
task:
result:
inquire=admin: admin

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

View File

@ -1000,19 +1000,50 @@ var table = {
// 删除信息 // 删除信息
pauseUser: function(uid, state) { pauseUser: function(uid, state) {
table.set(); table.set();
// $.modal.confirm("确定删除该条" + table.options.modalName + "信息吗?", function() {
// var url = $.common.isEmpty(id) ? table.options.removeUrl : table.options.removeUrl.replace("{id}", id);
// if(table.options.type == table_type.bootstrapTreeTable) {
// $.operate.get(url);
// } else {
// var data = { "ids": id };
// $.operate.submit(url, "post", "json", data);
// }
// });
var data = { "uid": uid, "state": state }; var data = { "uid": uid, "state": state };
$.operate.submit(table.options.pauseUrl, "post", "json", data); $.operate.submit(table.options.pauseUrl, "post", "json", data);
}, },
changeProjectPri: function(pid, change) {
table.set();
var data = { "pid": pid, "change": change };
$.operate.submit(table.options.changePriUrl, "post", "json", data);
},
pauseProject: function(pid) {
if(-1 == pid) {
var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$.modal.confirm("确认要暂停选中的" + rows.length + "条数据吗?", function() {
var url = table.options.pauseUrl;
var data = { "ids": rows.join() };
$.operate.submit(url, "post", "json", data);
});
} else {
table.set();
var data = { "ids": pid};
$.operate.submit(table.options.pauseUrl, "post", "json", data);
}
},
restoreProject: function(pid) {
table.set();
var data = { "pid": pid};
$.operate.submit(table.options.restoreUrl, "post", "json", data);
},
startAllProjects: function() {
table.set();
var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$.modal.confirm("确认要开始选中的" + rows.length + "条数据吗?", function() {
var url = table.options.startUrl;
var data = { "ids": rows.join() };
$.operate.submit(url, "post", "json", data);
});
},
// 批量删除信息 // 批量删除信息
removeAll: function() { removeAll: function() {
table.set(); table.set();

View File

@ -0,0 +1,257 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('队列管理')" />
<th:block th:include="include :: select2-css" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: layout-latest-css" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="role-form">
<div class="select-list">
<ul>
<li>
项目名:<input type="text" name="projectName"/>
</li>
<li>
上传人:
<select name="status" class="form-control m-b">
<option value="">--请选择--</option>
<option th:each="user : ${users}" th:text="${user.username}" th:value="${user.username}"></option>
</select>
</li>
<li>
状态:
<select name="state" class="form-control m-b">
<option value="">--请选择--</option>
<option value="在查">在查</option>
<option value="待查">待查</option>
<option value="暂停">暂停</option>
</select>
</li>
<li class="select-time">
上传时间:
<div>
<input type="text" class="time-input" id="startSubmitTime" placeholder="开始时间" name="params[startSubmitTime]" readOnly/>
<span>-</span>
<input type="text" class="time-input" id="endSubmitTime" placeholder="结束时间" name="params[endSubmitTime]" readOnly/>
</div>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<!--<a class="btn btn-success" onclick="$.operate.addTab()" >-->
<!--<i class="fa fa-plus"></i> 新增-->
<!--</a>-->
<a class="btn btn-danger multiple disabled" onclick="$.operate.pauseProject(-1)" >
<i class="fa fa-edit"></i> 暂停
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" >
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.startAllProjects()" >
<i class="fa fa-play"></i> 开始
</a>
<!--<a class="btn btn-warning" onclick="$.table.exportExcel()" >-->
<!--<i class="fa fa-download"></i> 导出-->
<!--</a>-->
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "project.do";
$(function() {
var options = {
url: prefix + "/queryProject?queryType=queueManage",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit?uid={id}",
removeUrl: prefix + "/delete",
exportUrl: prefix + "/export",
pauseUrl: prefix + "/pause",
restoreUrl: prefix + "/restore",
startUrl: prefix + "/start",
changePriUrl : prefix + "/changePri",
sortName: "roleSort",
modalName: "用户",
columns: [
{
checkbox: true
},
{
field: 'id',
visible: false
},
{
field: 'realOrder',
title: '任务编号',
sortable: false
},
{
field: 'projectName',
title: '项目名',
sortable: true
},
{
field: 'version',
title: '版本',
sortable: true
},
{
field: 'submitUserName',
title: '上传人',
sortable: true
},
{
field: 'pcbFile',
title: '文件名',
sortable: false,
formatter: function (value, row, index) {
var html="";
html += "<span>PCB文件:</span><A href='javascript:getFile(\""+ row.pcbFile + "\");'>"+ row.pcbFileName +"</A></br>";
html += "<span>BOM文件:</span><A href='javascript:getFile(\""+ row.bomFile + "\");'>"+ row.bomFileName +"</A></br>";
var fid;
if(0 != row.pcbFile) {
fid = row.pcbFile;
} else if(0 != row.bomFile) {
fid = row.bomFile;
}
var paramFile = row.projectName + "_" + row.version + ".param";
html += "<span >参数文件:</span><A href=\"javascript:getParamFile(" + fid +",'" + paramFile +"');\">"+ paramFile +"</A>";
return html;
}
},
{
field: 'submitTime',
title: '上传时间',
sortable: true
},
{
field: 'state',
title: '状态',
sortable: true
},{
field: 'waitTime',
title: '预估等待时间(分钟)',
sortable: true
},{
field: 'pri',
title: '优先级调整',
sortable: false,
formatter: function (value, row, index) {
var PROJECT_STATE_DAICHA = '待查';
if(PROJECT_STATE_DAICHA != row.state) {
return "";
}
var hasPre = row.hasPre;
var hasNext = row.hasNext;
var html = "";
//获取列表中所有数据
var rows = $('#bootstrap-table').bootstrapTable('getData',{useCurrentPage:true,includeHiddenRows:true});
var upImg = "/img/up.gif";
var downImg = "/img/down.gif";
if(index == 0) {
if(hasPre) {
html += "<a href=\"javascript:changePri("+ row.id +",'up');\"><img style=\"border:0px;\"src=\""+ upImg +"\" /></a>";
}
} else {
if(PROJECT_STATE_DAICHA == rows[index-1].state)
{
html += "<a href=\"javascript:changePri("+ row.id +",'up');\"><img style=\"border:0px;\"src=\""+ upImg + "\" /></a>";
}
}
if(index == rows.length-1) {
if(hasNext) {
html += "<a href=\"javascript:changePri("+ row.id +",'down');\"><img style=\"border:0px;\"src=\"/img/down.gif\" /></a>";
}
} else {
if(PROJECT_STATE_DAICHA == rows[index+1].state)
{
html += "<a href=\"javascript:changePri("+ row.id +",'down');\"><img style=\"border:0px;\"src=\"/img/down.gif\" /></a>";
}
}
return html;
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
var pauseOperType = "";
if("暂停" == row.state) {
pauseOperType = "继续";
} else {
pauseOperType = "暂停";
}
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.roleId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(' + row.id + ')"><i class="fa fa-remove"></i>删除</a> ');
if("继续" == pauseOperType) {
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.restoreProject(' + row.id + ')"><i class="fa fa-edit"></i>' + pauseOperType + '</a> ');
} else if("暂停" == pauseOperType) {
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.pauseProject(' + row.id + ')"><i class="fa fa-edit"></i>' + pauseOperType + '</a> ');
}
// var more = [];
// more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authDataScope(" + row.roleId + ")'><i class='fa fa-check-square-o'></i>数据权限</a> ");
// more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authUser(" + row.roleId + ")'><i class='fa fa-user'></i>分配用户</a>");
// actions.push('<a tabindex="0" class="btn btn-info btn-xs" role="button" data-container="body" data-placement="left" data-toggle="popover" data-html="true" data-trigger="hover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');
return actions.join('');
}
}
]
};
$.table.init(options);
});
//下载文件
function getFile(fid)
{
// document.location.href='file.do/download?fid=' + fid;
var url = ctx + 'file.do/download?fid=' + fid;
window.location.href = url;
}
//下载参数文件
function getParamFile(fid,fname)
{
// document.location.href='project.do/downloadParamFile&fid=' + fid + '&fname=' + encodeURI(fname);
var url = ctx + 'project.do/downloadParamFile?fid=' + fid + '&fname=' + encodeURI(fname);
window.location.href = url;
}
//上调优先级
function changePri( pid,change )
{
$.operate.changeProjectPri(pid, change);
// document.location.href='project.do/changePri?pid='
// + pid +
// '&change='+change +
// '&currentPage=<%=myPage.getCurrentPage()%>';
}
</script>
</body>
</html>

View File

@ -199,7 +199,9 @@ public class BaseController
{ {
PrintWriter out = res.getWriter(); PrintWriter out = res.getWriter();
res.setContentType("text/html"); res.setContentType("text/html");
res.setHeader("Content-Type","text/json;charset=utf8");
res.setCharacterEncoding("utf-8"); res.setCharacterEncoding("utf-8");
res.setContentType("text/json;charset=utf8");
out.write(msg); out.write(msg);
out.flush(); out.flush();
out.close(); out.close();
@ -209,9 +211,12 @@ public class BaseController
{ {
PrintWriter out = res.getWriter(); PrintWriter out = res.getWriter();
res.setContentType("text/json"); res.setContentType("text/json");
res.setHeader("Content-Type","text/json;charset=utf8");
res.setCharacterEncoding("utf-8"); res.setCharacterEncoding("utf-8");
res.setContentType("text/json;charset=utf8");
out.write(msg); out.write(msg);
out.flush(); out.flush();
out.close(); out.close();
} }
} }

View File

@ -116,7 +116,7 @@ public class ProjectDAO extends JdbcBaseDao
sql = sql + " ORDER BY T.F_END_TIME DESC limit ?,?"; sql = sql + " ORDER BY T.F_END_TIME DESC limit ?,?";
break; break;
} }
if (!("在查".equals(state))) if (!(ProjectConstants.PROJECT_STATE_ZAICHA.equals(state)))
{ {
continue; continue;
} }
@ -127,7 +127,7 @@ public class ProjectDAO extends JdbcBaseDao
params.add(Integer.valueOf(start)); params.add(Integer.valueOf(start));
params.add(Integer.valueOf(page.getPageSize())); params.add(Integer.valueOf(page.getPageSize()));
List<Project> list = getJdbcTemplate().queryForList(sql, params.toArray(), Project.class); List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql, params.toArray());
List<Project> rs = null; List<Project> rs = null;
if ((list == null) || (list.size() <= 0)) { if ((list == null) || (list.size() <= 0)) {
return rs; return rs;
@ -135,12 +135,12 @@ public class ProjectDAO extends JdbcBaseDao
rs = new ArrayList(); rs = new ArrayList();
for (int k = 0; k < list.size(); ++k) for (int k = 0; k < list.size(); ++k)
{ {
Map map = (Map)list.get(k); Map map = list.get(k);
((List)rs).add(map2Bean(map)); rs.add(map2Bean(map));
} }
PageUtil.constructPage(page, totalCount); PageUtil.constructPage(page, totalCount);
return ((List<Project>)rs); return rs;
} }
private int getCountByStates(String[] states, ProjectQueryBean queryBean) private int getCountByStates(String[] states, ProjectQueryBean queryBean)
@ -199,7 +199,9 @@ public class ProjectDAO extends JdbcBaseDao
project.setDirectionBotFs((map.get("F_Direction_Bot_Fs") == null) ? 0 : Integer.parseInt(map.get("F_Direction_Bot_Fs").toString())); project.setDirectionBotFs((map.get("F_Direction_Bot_Fs") == null) ? 0 : Integer.parseInt(map.get("F_Direction_Bot_Fs").toString()));
project.setDensity((map.get("F_Density") == null) ? "" : map.get("F_Density").toString()); project.setDensity((map.get("F_Density") == null) ? "" : map.get("F_Density").toString());
project.setSubmitUser((map.get("F_SUBMIT_USER") == null) ? 0 : Integer.parseInt(map.get("F_SUBMIT_USER").toString())); project.setSubmitUser((map.get("F_SUBMIT_USER") == null) ? 0 : Integer.parseInt(map.get("F_SUBMIT_USER").toString()));
project.setSubmitTime((map.get("F_SUBMIT_TIME") == null) ? "" : map.get("F_SUBMIT_TIME").toString()); String submitTime = (map.get("F_SUBMIT_TIME") == null) ? "" : map.get("F_SUBMIT_TIME").toString();
//project.setSubmitTime();
project.setSubmitTime(TimeUtil.getDateStrByFormat(submitTime,"yyyy-MM-dd HH:mm:ss"));
project.setEndTime((map.get("F_END_TIME") == null) ? "" : map.get("F_END_TIME").toString()); project.setEndTime((map.get("F_END_TIME") == null) ? "" : map.get("F_END_TIME").toString());
project.setState((map.get("F_STATE") == null) ? "" : map.get("F_STATE").toString()); project.setState((map.get("F_STATE") == null) ? "" : map.get("F_STATE").toString());
project.setTaskNum((map.get("T_TASK_NUM") == null) ? 0 : Integer.parseInt(map.get("T_TASK_NUM").toString())); project.setTaskNum((map.get("T_TASK_NUM") == null) ? 0 : Integer.parseInt(map.get("T_TASK_NUM").toString()));

View File

@ -57,9 +57,27 @@ public class Project implements Serializable {
private Integer waitTime; private Integer waitTime;
//备注 //备注
private String remark; private String remark;
private boolean hasPre;
public String getRunTime() { private boolean hasNext;
public boolean isHasPre() {
return hasPre;
}
public void setHasPre(boolean hasPre) {
this.hasPre = hasPre;
}
public boolean isHasNext() {
return hasNext;
}
public void setHasNext(boolean hasNext) {
this.hasNext = hasNext;
}
public String getRunTime() {
return this.runTime; return this.runTime;
} }