初始,可启动版本提交

This commit is contained in:
kingsfighter 2020-08-30 13:31:51 +08:00
parent 541d2bac9b
commit 85767d9453
105 changed files with 6398 additions and 261 deletions

7
doc/工作计划 Normal file
View File

@ -0,0 +1,7 @@
2020-08-30
计划:
1.菜单使用DFM数据
2.完成用户列表的迁移
3.熟悉
实际:

View File

@ -1,8 +1,10 @@
package com.ruoyi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* 启动程序
@ -12,11 +14,12 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication
{
public static void main(String[] args)
{
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
System.out.println("(♥◠‿◠)ノ゙ DFM启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
@ -27,4 +30,5 @@ public class RuoYiApplication
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}

View File

@ -0,0 +1,22 @@
package com.ruoyi.dfm.constant;
public class ProjectConstants {
public final static String PROJECT_STATE_DAICHA = "待查";
public final static String PROJECT_STATE_ZANTING = "暂停";
public final static String PROJECT_STATE_ZAICHA = "在查";
public final static String PROJECT_STATE_WANCHENG = "完成";
public final static String PROJECT_STATE_CHUCUO = "出错";
public final static String PROJECT_STATE_ZHONGDUAN = "中断";
public final static String VERSION_PRE = "Ver";
public final static int DAFAULT_PRI = 1;
public final static int ZANTING_PRI = 10000;
public final static String TASK_RESULT_INQUIRE_USER = "user";
public final static String TASK_RESULT_INQUIRE_ADMIN = "admin";
}

View File

@ -0,0 +1,5 @@
package com.ruoyi.dfm.constant;
public interface RequestConstants {
public final static String UPLOAD_RELATIVE_PATH = "/upload/";
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.dfm.constant;
public interface UserConstants {
int USER_LEVEL_UNKOWN = 0;
int USER_LEVEL_ADMIN = 1;
int USER_LEVEL_NORMAL = 2;
//部门管理员
int USER_LEVEL_DEP_ADMIN = 3;
//超级用户
int USER_LEVEL_SUPER_USER = 4;
int USER_STATUS_QIYONG = 0;
int USER_STATUS_ZANTING = 1;
}

View File

@ -0,0 +1,39 @@
package com.ruoyi.dfm.controller;
import com.ruoyi.dfm.pojo.UserInfo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
public class BaseController {
protected void outputMsg(HttpServletResponse res , String msg) throws Exception
{
PrintWriter out = res.getWriter();
res.setContentType("text/html");
res.setCharacterEncoding("utf-8");
out.write(msg);
out.flush();
out.close();
}
protected void outputJson(HttpServletResponse res , String msg) throws Exception
{
PrintWriter out = res.getWriter();
res.setContentType("text/json");
res.setCharacterEncoding("utf-8");
out.write(msg);
out.flush();
out.close();
}
protected UserInfo getUserInfo(HttpServletRequest req)
{
UserInfo user = null;
user = (UserInfo)req.getSession().getAttribute("user");
return user;
}
}

View File

@ -0,0 +1,272 @@
package com.ruoyi.dfm.controller;
import com.alibaba.fastjson.JSON;
import com.ruoyi.dfm.constant.UserConstants;
import com.ruoyi.dfm.pojo.DataAnalysisBean;
import com.ruoyi.dfm.pojo.Result;
import com.ruoyi.dfm.pojo.UserInfo;
import com.ruoyi.dfm.service.DataAnalysisService;
import com.ruoyi.dfm.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
/**
* 数据分析控制器
* @author Administrator
*
*/
@Controller
@RequestMapping("/dataAnalysis.do")
public class DataAnalysisController extends BaseController{
private static final Logger logger = LoggerFactory.getLogger(DataAnalysisController.class);
private static final String ANALYSIS_TYPE_USER = "submitUser";
private static final String ANALYSIS_TYPE_PROJECT = "submitProject";
private static final String ANALYSIS_TYPE_ALL_USER = "allUser";
private static final String ANALYSIS_TYPE_ALL_ISSUE = "allIssue";
//数据分析服务
@Autowired
private DataAnalysisService dataAnalysisService;
//用户服务
@Autowired
private UserService userService;
/**
* 用户管理控制器默认打开个人资料方法
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/")
public ModelAndView defaultHandle(HttpServletRequest req,
HttpServletResponse res) throws Exception {
req.setAttribute("users", getSubmitUsers(req));
return new ModelAndView("dataAnalysis");
}
/**
* 根据当前登陆用户获取查询条件的上传人
* @param req
* @return
*/
private List<UserInfo> getSubmitUsers(HttpServletRequest req){
UserInfo user = getUserInfo(req);
//获取上传人下拉列表
List<UserInfo> users = null;
if (UserConstants.USER_LEVEL_ADMIN == user.getGroupId())
{
users = this.userService.getAllUser();
}
else if (UserConstants.USER_LEVEL_NORMAL == user.getGroupId())
{
users = Arrays.asList(user);
}
//如果是部门管理员则可以查看部门所有的项目
else if (UserConstants.USER_LEVEL_DEP_ADMIN == user.getGroupId())
{
//根据部门查询部门所有用户
String department = user.getDepartment();
users = userService.getByDepartment(department);
}
return users;
}
/**
* 打开数据分析页面
*
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/dataAnalysis")
public ModelAndView dataAnalysis(HttpServletRequest req, HttpServletResponse res) throws Exception {
req.setAttribute("users", getSubmitUsers(req));
return new ModelAndView("dataAnalysis");
}
/**
* 检查当前需要分析的projectName是否属于当前登陆用户的可见范围
*
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/checkProjectNameByLoginUser")
public Result checkProjectNameByLoginUser(HttpServletRequest req, HttpServletResponse res) throws Exception {
String projectName = req.getParameter("projectName");
UserInfo user = getUserInfo(req);
boolean checkResult = false;
Result result = new Result();
if (UserConstants.USER_LEVEL_ADMIN == user.getGroupId())
{
result.setSuccess(true);
result.setMessage("分析成功");
}
else if (UserConstants.USER_LEVEL_NORMAL == user.getGroupId())
{
List<UserInfo> submitUsers = getSubmitUsers(req);
checkResult = userService.checkProjectAndUsers(projectName, submitUsers);
if(checkResult) {
result.setSuccess(true);
} else {
result.setSuccess(false);
result.setMessage("当前项目不属于当前用户");
}
}
//如果是部门管理员则可以查看部门所有的项目
else if (UserConstants.USER_LEVEL_DEP_ADMIN == user.getGroupId())
{
List<UserInfo> submitUsers = getSubmitUsers(req);
checkResult = userService.checkProjectAndUsers(projectName, submitUsers);
if(checkResult) {
result.setSuccess(true);
} else {
result.setSuccess(false);
result.setMessage("当前项目不属于当前部门管理员");
}
}
return result;
}
/**
* 分析数据
*
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/analysis")
public void analysis(HttpServletRequest req, HttpServletResponse res) throws Exception {
String projectName = req.getParameter("projectName");
String submitUser = req.getParameter("submitUser");
String startSubmitTime = req.getParameter("startSubmitTime");
String endSubmitTime = req.getParameter("endSubmitTime");
String analysisType = req.getParameter("analysisType");
//List<DataAnalysisBean> data = null;
Map<String, Object> data = new TreeMap<>();
UserInfo currentUser = getUserInfo(req);
//获取当前登陆用户的用户组
//分析原则系统管理员分析所有的部门管理员只能分析本部门的普通用户只能分析自己的
if(ANALYSIS_TYPE_PROJECT.equals(analysisType)) {
//校验projectName是否是当前用户可以看到的
Result checkResult = checkProjectNameByLoginUser(req, res);
if(null == checkResult || !checkResult.isSuccess()) {
outputJson(res, JSON.toJSONString(checkResult));
}
List<DataAnalysisBean> result = dataAnalysisService.analysisByProject(projectName, startSubmitTime, endSubmitTime);
//data.put("result", result);
if(null != result && result.size() > 0) {
//构造版本集合
TreeSet<Integer> versions = new TreeSet<>();
for(DataAnalysisBean b : result) {
versions.add(b.getVersion());
}
data.put("versions", versions);
//按照问题种类对结果集进行分组
Map<String, List<DataAnalysisBean>> issues = new HashMap<>();
for(DataAnalysisBean b : result) {
String key = b.getIssueDescription();
if(!issues.containsKey(key)) {
List<DataAnalysisBean> list = new ArrayList<>();
issues.put(key, list);
}
issues.get(key).add(b);
}
//按照版本进行填充
Integer [] versionArr = versions.toArray(new Integer[] {});
Iterator<String> it = issues.keySet().iterator();
while(it.hasNext()) {
String key = it.next();
List<DataAnalysisBean> list = issues.get(key);
Collections.sort(list, new Comparator<DataAnalysisBean>() {
@Override
public int compare(DataAnalysisBean o1, DataAnalysisBean o2) {
return o1.getVersion() - o2.getVersion();
}
});
for(int i = 0;i<list.size();i++) {
if(list.get(i).getVersion() != versionArr[i].intValue()) {
//如果没有版本的补全版本
DataAnalysisBean b = new DataAnalysisBean();
b.setVersion(versionArr[i].intValue());
b.setIssueQty(0);
list.add(i, b);
}
}
if(list.size() < versionArr.length) {
for(int i=list.size();i<versionArr.length;i++) {
//如果没有版本的补全版本
DataAnalysisBean b = new DataAnalysisBean();
b.setVersion(versionArr[i].intValue());
b.setIssueQty(0);
list.add(b);
}
}
}
data.put("result", issues);
}
}
else if(ANALYSIS_TYPE_USER.equals(analysisType)) {
List<DataAnalysisBean> result = dataAnalysisService.analysisByUser(submitUser, startSubmitTime, endSubmitTime);
data.put("result", result);
}
else {
List<UserInfo> submitUsers = getSubmitUsers(req);
if(ANALYSIS_TYPE_ALL_USER.equals(analysisType)) {
List<DataAnalysisBean> result = dataAnalysisService.analysisByAllUser(startSubmitTime, endSubmitTime, submitUsers);
data.put("result", result);
}
else if(ANALYSIS_TYPE_ALL_ISSUE.equals(analysisType)) {
List<DataAnalysisBean> result = dataAnalysisService.analysisByAllIssue(startSubmitTime, endSubmitTime, submitUsers);
data.put("result", result);
}
else {
Result result = new Result();
result.setSuccess(false);
result.setMessage("分析失败,未选择分析类型!");
outputJson(res, JSON.toJSONString(result));
return;
}
}
logger.info("分析数据");
Result result = new Result();
result.setSuccess(true);
result.setMessage("分析成功");
result.setData(data);
outputJson(res, JSON.toJSONString(result));
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.dfm.controller;
import com.ruoyi.dfm.pojo.FileInfo;
import com.ruoyi.dfm.service.FileService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;
@Controller
@RequestMapping("/file.do")
public class FileController extends BaseController{
private static final Logger log = LoggerFactory.getLogger(FileController.class);
@Autowired
private FileService fileService;
@RequestMapping("/download")
public void download(HttpServletRequest request,
HttpServletResponse response) throws Exception{
String fid = request.getParameter("fid");
FileInfo fileInfo = fileService.getById(Integer.parseInt(fid));
File file = fileService.getPhysicFile(fileInfo);
if(null == file){
outputMsg(response, "<script>alert('该文件不存在,下载失败,请联系管理员!');window.history.go(-1);</script>");
return ;
}
//重命名文件为之前存储的名字
String fname = fileInfo.getFileName();
try {
fname = new String(fname.getBytes("utf-8"),"iso8859-1");
response.setHeader("Location", fname);
response.setHeader("Cache-Control", "max-age=" + "");
response.setHeader("Content-Disposition", "attachment; filename=" + fname);
response.setContentLength((int) file.length());
OutputStream outputStream = response.getOutputStream();
InputStream inputStream = new FileInputStream(file);
byte[] buffer = new byte[1024];
int i = -1;
while ((i = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, i);
}
outputStream.flush();
outputStream.close();
inputStream.close();
outputStream = null;
} catch (Exception e) {
log.error("下载文件"+fname+"失败!" , e);
outputMsg(response, "<script>alert('下载文件失败,请联系管理员!');window.history.go(-1);</script>");
}
}
}

View File

@ -0,0 +1,83 @@
package com.ruoyi.dfm.controller;
import com.ruoyi.dfm.constant.UserConstants;
import com.ruoyi.dfm.pojo.MenuInfo;
import com.ruoyi.dfm.pojo.UserInfo;
import com.ruoyi.dfm.service.LoginService;
import com.ruoyi.dfm.service.MenuService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 登录控制器
* @author Kfighter
*
*/
@Controller
@RequestMapping("/login.do")
public class LoginController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(LoginController.class);
@Autowired
private LoginService loginService;
@Autowired
private MenuService menuService;
/**
* 获取登录界面
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/")
public ModelAndView defaultHandle(HttpServletRequest req,
HttpServletResponse res) throws Exception {
logger.debug("请求登录");
return new ModelAndView("login");
}
@RequestMapping("/login")
public ModelAndView login(HttpServletRequest req,
HttpServletResponse res) throws Exception {
logger.debug("有用户登录……");
String username = req.getParameter("username");
String pwd = req.getParameter("password");
if(username == null || pwd == null || "".equals(username.trim()) || "".equals(pwd.trim()))
{
outputMsg(res, "<script>alert('对不起,用户名或密码不能为空,请重新登录!');document.location.href='login.do';</script>");
return null;
}
UserInfo user = loginService.checkUser(username, pwd);
if(null != user)
{
if(UserConstants.USER_STATUS_ZANTING == user.getStatus())
{
outputMsg(res, "<script>alert('对不起,您的帐户已被暂停,请联系管理员!');document.location.href='login.do';</script>");
return null;
}
logger.debug("用户:" + user.getUsername() + " 登录成功!");
req.getSession().setAttribute("user", user);
List<MenuInfo> menus = menuService.getMenuByUser(user);
req.getSession().setAttribute("menus", menus);
return new ModelAndView("index");
}
else
{
outputMsg(res, "<script>alert('对不起,您的用户名或密码有误,请重新登录!');document.location.href='login.do';</script>");
return null;
}
}
}

View File

@ -0,0 +1,930 @@
package com.ruoyi.dfm.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.dfm.constant.UserConstants;
import com.ruoyi.dfm.pojo.*;
import com.ruoyi.dfm.service.FileService;
import com.ruoyi.dfm.service.ProjectService;
import com.ruoyi.dfm.service.UserService;
import com.ruoyi.dfm.util.PropertiesUtils;
import com.ruoyi.dfm.util.TimeUtil;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.MultipartResolver;
//import org.springframework.web.multipart.cos.CosMultipartResolver;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/project.do")
public class ProjectController extends BaseController
{
private static final Logger logger = LoggerFactory.getLogger(ProjectController.class);
@Autowired
private ProjectService projectService;
@Autowired
private FileService fileService;
@Autowired
private UserService userService;
@RequestMapping("/")
public ModelAndView defaultHandle(HttpServletRequest req, HttpServletResponse res)
throws Exception
{
return new ModelAndView("addProject");
}
@RequestMapping("/getAddPage")
public ModelAndView getAddPage(HttpServletRequest req, HttpServletResponse res)
throws Exception
{
return new ModelAndView("addProject");
}
@RequestMapping("/add")
public ModelAndView add(HttpServletRequest request, HttpServletResponse res)
throws Exception
{
try
{
//FIXME 修改上传文件
MultipartResolver cmr = null;//new CosMultipartResolver(request.getSession().getServletContext());
MultipartHttpServletRequest req = cmr.resolveMultipart(request);
String projectName = req.getParameter("projectName");
String[] dfmCheckArr = req.getParameterValues("dfmCheck");
String dfmCheck = "";
if (dfmCheckArr != null)
{
for (String check : dfmCheckArr)
{
dfmCheck = dfmCheck + check + ",";
}
}
int version = (req.getParameter("version").trim() == "") ? 0 : Integer.parseInt(req.getParameter("version").trim());
int pri = (req.getParameter("pri").trim() == "") ? 0 : Integer.parseInt(req.getParameter("pri").trim());
int checkType = (req.getParameter("checkType").trim() == "") ? 0 : Integer.parseInt(req.getParameter("checkType").trim());
int pcbType = (req.getParameter("pcbType").trim() == "") ? 0 : Integer.parseInt(req.getParameter("pcbType").trim());
int hdiModel = (req.getParameter("hdiModel").trim() == "") ? 0 : Integer.parseInt(req.getParameter("hdiModel").trim());
int panelModel = (req.getParameter("panelModel").trim() == "") ? 0 : Integer.parseInt(req.getParameter("panelModel").trim());
float boardThickness = (req.getParameter("boardThickness").trim() == "") ? 0.0F : Float.parseFloat(req.getParameter("boardThickness").trim());
float maxHeightTop = (req.getParameter("maxHeightTop").trim() == "") ? 0.0F : Float.parseFloat(req.getParameter("maxHeightTop").trim());
int railwayPosition = (req.getParameter("railwayPosition").trim() == "") ? 0 : Integer.parseInt(req.getParameter("railwayPosition").trim());
float maxHeightBot = (req.getParameter("maxHeightBot").trim() == "") ? 0.0F : Float.parseFloat(req.getParameter("maxHeightBot").trim());
int assemblyProcessTop = (req.getParameter("assemblyProcessTop").trim() == "") ? 0 : Integer.parseInt(req.getParameter("assemblyProcessTop").trim());
int subPcbNum = (req.getParameter("subPcbNum").trim() == "") ? 0 : Integer.parseInt(req.getParameter("subPcbNum").trim());
int havePb = (req.getParameter("havePb").trim() == "") ? 0 : Integer.parseInt(req.getParameter("havePb").trim());
int assemblyProcessBot = (req.getParameter("assemblyProcessBot").trim() == "") ? 0 : Integer.parseInt(req.getParameter("assemblyProcessBot").trim());
int surfaceProcess = (req.getParameter("surfaceProcess").trim() == "") ? 0 : Integer.parseInt(req.getParameter("surfaceProcess").trim());
int directionTop = (req.getParameter("directionTop").trim() == "") ? 0 : Integer.parseInt(req.getParameter("directionTop").trim());
int primarySide = (req.getParameter("primarySide").trim() == "") ? 0 : Integer.parseInt(req.getParameter("primarySide").trim());
int directionBot = (req.getParameter("directionBot").trim() == "") ? 0 : Integer.parseInt(req.getParameter("directionBot").trim());
int directionBotFs = (req.getParameter("directionBotFs").trim() == "") ? 0 : Integer.parseInt(req.getParameter("directionBotFs").trim());
String density = req.getParameter("density");
String lastVersion = null == req.getParameter("lastVersion") ? "" : req.getParameter("lastVersion").trim();
String CCtoOther = null == req.getParameter("CCtoOther") ? "" : req.getParameter("CCtoOther").trim();
String reportLanguage = null == req.getParameter("reportLanguage") ? "中文" : req.getParameter("reportLanguage").trim();
Project project = new Project();
project.setPri(pri);
project.setAssemblyProcessBot(assemblyProcessBot);
project.setAssemblyProcessTop(assemblyProcessTop);
project.setBoardThickness(boardThickness);
project.setCheckType(checkType);
project.setDfmCheck(dfmCheck);
project.setDirectionBot(directionBot);
project.setDirectionTop(directionTop);
project.setHavePb(havePb);
project.setHdiModel(hdiModel);
project.setMaxHeightBot(maxHeightBot);
project.setMaxHeightTop(maxHeightTop);
project.setPcbType(pcbType);
project.setPrimarySide(primarySide);
project.setProjectName(projectName);
project.setRailwayPosition(railwayPosition);
project.setSubPcbNum(subPcbNum);
project.setSurfaceProcess(surfaceProcess);
project.setVersion(version);
project.setPanelModel(panelModel);
project.setDirectionBotFs(directionBotFs);
project.setDensity(density);
project.setLastVersion(lastVersion);
project.setReportLanguage(reportLanguage);
UserInfo user = getUserInfo(req);
project.setSubmitUser(user.getId());
project.setSubmitUserName(user.getUsername());
project.setSubmitTime(TimeUtil.getNowChar14());
//拼装抄送邮件
String userCC = user.getCcEmail();
String ccEmail = "";
if(StringUtils.isEmpty(userCC)) {
ccEmail = CCtoOther;
}
else {
if(userCC.endsWith(";")) {
ccEmail = userCC + CCtoOther;
} else {
ccEmail = userCC + ";" + CCtoOther;
}
}
project.setCCtoOther(ccEmail);
this.projectService.addProject(req, project);
outputMsg(res, "<script>alert('添加项目成功,点击确定继续添加!');document.location.href='project.do?method=getAddPage';</script>");
return null;
} catch (Exception e) {
logger.error("添加项目失败", e);
outputMsg(res, "<script>alert('添加项目失败,请检查数据正确性,重新添加!');document.location.href='project.do?method=getAddPage';</script>"); }
return null;
}
@RequestMapping("/getLastVersion")
public void getLastVersion(HttpServletRequest req, HttpServletResponse res)
throws Exception
{
int uid = getUserInfo(req).getId();
String projectName = req.getParameter("projectName");
Project project = this.projectService.getLastVersion(uid, projectName);
String msg = "";
if (project != null)
{
//msg = JSONObject.fromObject(project).toString();
msg = JSON.toJSONString(project);
}
outputJson(res, msg);
}
@RequestMapping("/getAttrValue")
public void getAttrValue(HttpServletRequest req, HttpServletResponse res) throws Exception
{
String attrName = req.getParameter("attrName");
List list = this.projectService.getAttrValue(attrName);
String msg = "";
if ((list != null) || (!(list.isEmpty())))
{
JSONArray arr = new JSONArray();
for (int i = 0; i < list.size(); ++i)
{
JSONObject obj = new JSONObject();
obj.put("text", ((Map)list.get(i)).get("F_ATTR_VALUE"));
obj.put("value", ((Map)list.get(i)).get("F_ID"));
obj.put("isDefault", ((Map)list.get(i)).get("F_IS_DEFAULT"));
arr.add(obj);
}
msg = arr.toString();
}
outputJson(res, msg);
}
@RequestMapping("/queueManage")
public ModelAndView queueManage(HttpServletRequest req, HttpServletResponse res)
throws Exception
{
String[] states = new String[3];
states[0] = "待查";
states[1] = "在查";
states[2] = "暂停";
String currentPage = req.getParameter("currentPage");
Page page = new Page();
if ((currentPage == null) || ("".equals(currentPage.trim())))
{
page.setCurrentPage(1);
}
else
{
page.setCurrentPage(Integer.parseInt(currentPage));
}
UserInfo user = getUserInfo(req);
List<Project> projects = null;
Project pre = null;
Project next = null;
List users = null;
//查询排序
Page tempPage = new Page();
tempPage.setCurrentPage(1);
tempPage.setPageSize(999999);
//查询所有的项目按照优先级排序
List<Project> totalByStates = projectService.getProjectByStates(states, tempPage, null);
if (UserConstants.USER_LEVEL_ADMIN == user.getGroupId() )
{
projects = this.projectService.getProjectByStates(states, page, null);
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();
}
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, null);
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);
}
//如果是部门管理员则可以查看部门所有的项目
else if (UserConstants.USER_LEVEL_DEP_ADMIN == user.getGroupId())
{
//根据部门查询部门所有用户
String department = user.getDepartment();
List<UserInfo> depUsers = userService.getByDepartment(department);
//if(null == depUsers || depUsers.isEmpty()) {}
int[] uids = new int [depUsers.size()];
for (int i=0;i<uids.length;i++) {
uids[i] = depUsers.get(i).getId();
}
//根据部门用户查询出所有部门的项目
projects = this.projectService.getProjectByStates(states, uids, page, null);
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;
}
Integer waitTime = Integer.parseInt(PropertiesUtils.getProperties().getProperty("wait.time", "10"));
if(null != projects && !projects.isEmpty()) {
//融合实际排序
for(Project project : projects) {
for(int i=0;i<totalByStates.size();i++) {
Project projectOrder = totalByStates.get(i);
if(project.getId() == projectOrder.getId()) {
project.setRealOrder(i+1);
project.setWaitTime(i*waitTime);
break;
}
}
}
}
req.setAttribute("pre", pre);
req.setAttribute("next", next);
req.setAttribute("projects", projects);
req.setAttribute("page", page);
req.setAttribute("users", users);
return new ModelAndView("queueManage");
}
@RequestMapping("/pause")
public void pause(HttpServletRequest req, HttpServletResponse res)
throws Exception
{
try
{
String pid = req.getParameter("pid");
String[] pids = pid.split(",");
String currentPage = req.getParameter("currentPage");
this.projectService.pauseProject(pids);
outputMsg(res, "<script>document.location.href='project.do?method=queueManage&currentPage=" + currentPage + "';</script>");
} catch (Exception e) {
logger.error("暂停项目失败!", e);
outputMsg(res, "<script>alert('暂停项目失败,请联系管理员!');window.history.go(-1);</script>");
}
}
@RequestMapping("/start")
public void start(HttpServletRequest req, HttpServletResponse res)
throws Exception
{
try
{
String pid = req.getParameter("pid");
String[] pids = pid.split(",");
String currentPage = req.getParameter("currentPage");
this.projectService.startProject(pids);
outputMsg(res, "<script>document.location.href='project.do?method=queueManage&currentPage=" + currentPage + "';</script>");
} catch (Exception e) {
logger.error("批量开始项目失败!", e);
outputMsg(res, "<script>alert('暂停开始失败,请联系管理员!');window.history.go(-1);</script>");
}
}
@RequestMapping("/restore")
public void restore(HttpServletRequest req, HttpServletResponse res) throws Exception
{
try
{
String pid = req.getParameter("pid");
String currentPage = req.getParameter("currentPage");
this.projectService.restoreProject(pid);
outputMsg(res, "<script>document.location.href='project.do?method=queueManage&currentPage=" + currentPage + "';</script>");
} catch (Exception e) {
logger.error("恢复项目失败!", e);
outputMsg(res, "<script>alert('恢复项目失败,请联系管理员!');window.history.go(-1);</script>");
}
}
@RequestMapping("/delete")
public void delete(HttpServletRequest req, HttpServletResponse res) throws Exception
{
try
{
String source = req.getParameter("source");
String pid = req.getParameter("pid");
String[] pids = pid.split(",");
this.projectService.deleteProject(pids);
String currentPage = req.getParameter("currentPage");
outputMsg(res, "<script>alert('删除成功,确定跳转到队列管理!');document.location.href='project.do?method=" + source + "&currentPage=" + currentPage + "';</script>");
} catch (Exception e) {
logger.error("删除项目失败!", e);
outputMsg(res, "<script>alert('删除失败,确定跳转到队列管理!');window.history.go(-1);</script>");
}
}
@RequestMapping("/resultDownload")
public ModelAndView resultDownload(HttpServletRequest req, HttpServletResponse res)
throws Exception
{
String[] states = new String[3];
states[0] = "完成";
states[1] = "出错";
states[2] = "中断";
String currentPage = req.getParameter("currentPage");
Page page = new Page();
page.setOrderCase(" ORDER BY F_END_TIME DESC ");
if ((currentPage == null) || ("".equals(currentPage.trim())))
{
page.setCurrentPage(1);
}
else
{
page.setCurrentPage(Integer.parseInt(currentPage));
}
UserInfo user = getUserInfo(req);
List projects = null;
List users = null;
// String taskResultInquire = (String)PropertiesUtils.getProperties().get("task.result.inquire");
// if ("user".equals(taskResultInquire))
// {
// projects = this.projectService.getProjectByStates(states, new int[]{user.getId()}, page, null);
// users = Arrays.asList(user);
// }
// else
if (UserConstants.USER_LEVEL_ADMIN == user.getGroupId() || UserConstants.USER_LEVEL_SUPER_USER == user.getGroupId())
{
projects = this.projectService.getProjectByStates(states, page, null);
users = this.userService.getAllUser();
}
else if (UserConstants.USER_LEVEL_NORMAL == user.getGroupId())
{
projects = this.projectService.getProjectByStates(states, new int[]{user.getId()}, page, null);
users = Arrays.asList(user);
}
//部门管理员可以查看部门所有人的项目
else if (UserConstants.USER_LEVEL_DEP_ADMIN == user.getGroupId())
{
String department = user.getDepartment();
List<UserInfo> depUsers = userService.getByDepartment(department);
//if(null == depUsers || depUsers.isEmpty()) {}
int[] uids = new int [depUsers.size()];
for (int i=0;i<uids.length;i++) {
uids[i] = depUsers.get(i).getId();
}
projects = this.projectService.getProjectByStates(states, uids, page, null);
users = depUsers;
}
req.setAttribute("users", users);
req.setAttribute("projects", projects);
req.setAttribute("page", page);
req.setAttribute("oper", user);
req.setAttribute("queryParam", "{}");
req.setAttribute("loadType", "init");
return new ModelAndView("resultDownload");
}
@RequestMapping("/downloadResultFile")
public void downloadResultFile(HttpServletRequest req, HttpServletResponse response)
throws Exception
{
try
{
String fid = req.getParameter("fid");
final String fname = req.getParameter("fname");
FileInfo pcbFileInfo = this.fileService.getById(Integer.parseInt(fid));
//fname = new String(fname.getBytes("iso8859-1"), "utf-8");
String decodeFname = URLDecoder.decode(fname, "utf-8");
String path = this.fileService.getRootPath() + "/" + pcbFileInfo.getRelaPath() + "/" + decodeFname;
File file = new File(path);
if (!(file.exists()))
{
outputMsg(response, "<script>alert('结果文件不存在,请联系管理员!');window.history.go(-1);</script>");
logger.error("结果文件不存在");
return;
}
response.setHeader("Location", fname);
response.setHeader("Cache-Control", "max-age=");
response.setHeader("Content-Disposition", "attachment; filename=" + new String(decodeFname.getBytes("utf-8"),"iso8859-1"));
response.setContentLength((int)file.length());
OutputStream outputStream = response.getOutputStream();
InputStream inputStream = new FileInputStream(file);
byte[] buffer = new byte[1024];
int i = -1;
while ((i = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, i);
}
outputStream.flush();
outputStream.close();
inputStream.close();
outputStream = null;
}
catch (Exception e) {
logger.error("下载结果文件失败!", e);
outputMsg(response, "<script>alert('下载结果文件失败,请联系管理员!');window.history.go(-1);</script>");
}
}
@RequestMapping("/downloadParamFile")
public void downloadParamFile(HttpServletRequest req, HttpServletResponse response)
throws Exception
{
try
{
String fid = req.getParameter("fid");
String fname = req.getParameter("fname");
FileInfo pcbFileInfo = this.fileService.getById(Integer.parseInt(fid));
String decodeFname = URLDecoder.decode(fname, "utf-8");
String path = this.fileService.getRootPath() + "/" + pcbFileInfo.getRelaPath() + "/" + decodeFname;
File file = new File(path);
if (!(file.exists()))
{
outputMsg(response, "<script>alert('参数文件不存在,请联系管理员!');window.history.go(-1);</script>");
logger.error("参数文件不存在");
return;
}
response.setHeader("Location", fname);
response.setHeader("Cache-Control", "max-age=");
response.setHeader("Content-Disposition", "attachment; filename=" + new String(decodeFname.getBytes("utf-8"),"iso8859-1"));
response.setContentLength((int)file.length());
OutputStream outputStream = response.getOutputStream();
InputStream inputStream = new FileInputStream(file);
byte[] buffer = new byte[1024];
int i = -1;
while ((i = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, i);
}
outputStream.flush();
outputStream.close();
inputStream.close();
outputStream = null;
}
catch (Exception e) {
logger.error("下载参数文件失败!", e);
outputMsg(response, "<script>alert('下载参数文件失败,请联系管理员!');window.history.go(-1);</script>");
}
}
@RequestMapping("/downloadPcbAndBomFile")
public void downloadPcbAndBomFile(HttpServletRequest req, HttpServletResponse response)
throws Exception
{
try
{
String fid = req.getParameter("fid");
FileInfo fileInfo = fileService.getById(Integer.parseInt(fid));
// UserInfo currentUser = getUserInfo(req);
// if(currentUser.getGroupId() == UserConstants.USER_LEVEL_NORMAL && currentUser.getId() != fileInfo.getUploadUser()) {
// outputMsg(response, "<script>alert('该文件没有权限下载,请联系管理员!');window.history.go(-1);</script>");
// return ;
// }
//
File file = fileService.getPhysicFile(fileInfo);
// if(null == file){
// outputMsg(response, "<script>alert('该文件不存在,下载失败,请联系管理员!');window.history.go(-1);</script>");
// return ;
// }
//重命名文件为之前存储的名字
String fname = fileInfo.getFileName();
try {
fname = new String(fname.getBytes("utf-8"),"iso8859-1");
response.setHeader("Location", fname);
response.setHeader("Cache-Control", "max-age=" + "");
response.setHeader("Content-Disposition", "attachment; filename=" + fname);
response.setContentLength((int) file.length());
OutputStream outputStream = response.getOutputStream();
InputStream inputStream = new FileInputStream(file);
byte[] buffer = new byte[1024];
int i = -1;
while ((i = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, i);
}
outputStream.flush();
outputStream.close();
inputStream.close();
outputStream = null;
} catch (Exception e) {
outputMsg(response, "<script>alert('下载文件失败,请联系管理员!');window.history.go(-1);</script>");
}
} catch (Exception e) {
outputMsg(response, "<script>alert('下载文件失败,请联系管理员!');window.history.go(-1);</script>");
}
}
@RequestMapping("/checkDownloadPcbAndBomFile")
public void checkDownloadPcbAndBomFile(HttpServletRequest req, HttpServletResponse response) throws Exception {
try {
String fid = req.getParameter("fid");
FileInfo fileInfo = fileService.getById(Integer.parseInt(fid));
UserInfo currentUser = getUserInfo(req);
if (currentUser.getGroupId() == UserConstants.USER_LEVEL_NORMAL
&& currentUser.getId() != fileInfo.getUploadUser()) {
outputMsg(response, "{\"success\":false,\"message\":\"该文件没有权限下载,请联系管理员!\"}");
return;
}
File file = fileService.getPhysicFile(fileInfo);
if (null == file) {
outputMsg(response, "{\"success\":false,\"message\":\"该文件不存在,下载失败,请联系管理员!\"}");
return;
}
outputMsg(response, "{\"success\":true,\"message\":\"\"}");
} catch (Exception e) {
outputMsg(response, "{\"success\":false,\"message\":\"下载文件失败,请联系管理员!\"}");
}
}
@RequestMapping("/queryProject")
public ModelAndView queryProject(HttpServletRequest req, HttpServletResponse res)
throws Exception
{
String queryType = req.getParameter("queryType");
String projectName = req.getParameter("projectName");
String username = req.getParameter("username");
String state = req.getParameter("state");
String startSubmitTime = req.getParameter("startSubmitTime");
String endSubmitTime = req.getParameter("endSubmitTime");
ProjectQueryBean queryBean = new ProjectQueryBean();
queryBean.setEndSubmitTime(endSubmitTime);
queryBean.setProjectName(projectName);
queryBean.setStartSubmitTime(startSubmitTime);
queryBean.setState(state);
queryBean.setUsername(username);
String currentPage = req.getParameter("currentPage");
Page page = new Page();
if ((currentPage == null) || ("".equals(currentPage.trim())))
{
page.setCurrentPage(1);
}
else
{
page.setCurrentPage(Integer.parseInt(currentPage));
}
String[] states = new String[3];
List<Project> projects = null;
UserInfo user = getUserInfo(req);
List users = null;
if ("resultDownload".equals(queryType))
{
states[0] = "完成";
states[1] = "出错";
states[2] = "中断";
page.setOrderCase(" ORDER BY F_END_TIME DESC ");
// String taskResultInquire = (String)PropertiesUtils.getProperties().get("task.result.inquire");
// if ("user".equals(taskResultInquire))
// {
// projects = this.projectService.getProjectByStates(states, page, queryBean);
// }
// else
if (UserConstants.USER_LEVEL_ADMIN == user.getGroupId() || UserConstants.USER_LEVEL_SUPER_USER == user.getGroupId())
{
projects = this.projectService.getProjectByStates(states, page, queryBean);
users = this.userService.getAllUser();
}
else if (UserConstants.USER_LEVEL_NORMAL == user.getGroupId())
{
projects = this.projectService.getProjectByStates(states, new int[]{user.getId()}, page, queryBean);
users = Arrays.asList(user);
}
//部门管理员可以查看部门所有人的项目
else if (UserConstants.USER_LEVEL_DEP_ADMIN == user.getGroupId())
{
String department = user.getDepartment();
List<UserInfo> depUsers = userService.getByDepartment(department);
int[] uids = new int [depUsers.size()];
for (int i=0;i<uids.length;i++) {
uids[i] = depUsers.get(i).getId();
}
projects = this.projectService.getProjectByStates(states, uids, page, queryBean);
users = depUsers;
}
req.setAttribute("projects", projects);
req.setAttribute("page", page);
req.setAttribute("users", users);
//FIXME 修正查询条件中的时间 json
// req.setAttribute("queryParam", JSONObject.fromObject(queryBean));
req.setAttribute("queryParam", JSON.toJSONString(queryBean));
req.setAttribute("loadType", "query");
return new ModelAndView("resultDownload");
}
if ("queueManage".equals(queryType))
{
states[0] = "待查";
states[1] = "在查";
states[2] = "暂停";
//查询排序
Page tempPage = new Page();
tempPage.setCurrentPage(1);
tempPage.setPageSize(999999);
//查询所有的项目按照优先级排序
List<Project> totalByStates = projectService.getProjectByStates(states, tempPage, null);
if (UserConstants.USER_LEVEL_ADMIN == user.getGroupId())
{
projects = this.projectService.getProjectByStates(states, page, queryBean);
users = this.userService.getAllUser();
}
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);
users = Arrays.asList(user);
}
//部门管理员可以查看部门所有人的项目
else if (UserConstants.USER_LEVEL_DEP_ADMIN == user.getGroupId())
{
String department = user.getDepartment();
List<UserInfo> depUsers = userService.getByDepartment(department);
int[] uids = new int [depUsers.size()];
for (int i=0;i<uids.length;i++) {
uids[i] = depUsers.get(i).getId();
}
projects = this.projectService.getProjectByStates(states, uids, page, queryBean);
users = depUsers;
}
Integer waitTime = Integer.parseInt(PropertiesUtils.getProperties().getProperty("wait.time", "10"));
if(null != projects && !projects.isEmpty()) {
//融合实际排序
for(Project project : projects) {
for(int i=0;i<totalByStates.size();i++) {
Project projectOrder = totalByStates.get(i);
if(project.getId() == projectOrder.getId()) {
project.setRealOrder(i+1);
project.setWaitTime(i*waitTime);
break;
}
}
}
}
req.setAttribute("projects", projects);
req.setAttribute("page", page);
req.setAttribute("users", users);
return new ModelAndView("queueManage");
}
return null;
}
@RequestMapping("/changePri")
public void changePri(HttpServletRequest req, HttpServletResponse res)
throws Exception
{
try
{
String pid = req.getParameter("pid");
String change = req.getParameter("change");
String currentPage = req.getParameter("currentPage");
int uids[] = null;
if (UserConstants.USER_LEVEL_NORMAL == getUserInfo(req).getGroupId())
{
uids = new int[]{getUserInfo(req).getId()};
}
else if (UserConstants.USER_LEVEL_DEP_ADMIN == getUserInfo(req).getGroupId())
{
//根据部门查询部门所有用户
String department = getUserInfo(req).getDepartment();
List<UserInfo> depUsers = userService.getByDepartment(department);
uids = new int [depUsers.size()];
for (int i=0;i<uids.length;i++) {
uids[i] = depUsers.get(i).getId();
}
}
this.projectService.changePri(pid, uids, change);
outputMsg(res, "<script>document.location.href='project.do?method=queueManage&currentPage=" + currentPage + "';</script>");
}
catch (Exception e) {
logger.error("调整优先级失败!", e);
outputMsg(res, "<script>alert('调整优先级失败,请联系管理员!');window.history.go(-1);</script>");
}
}
@RequestMapping("/recheck")
public void recheck(HttpServletRequest req, HttpServletResponse res)
throws Exception
{
try
{
String pid = req.getParameter("pid");
String[] pids = pid.split(",");
String currentPage = req.getParameter("currentPage");
this.projectService.recheck(pids);
outputMsg(res, "<script>document.location.href='project.do?method=resultDownload&currentPage=" + currentPage + "';</script>");
}
catch (Exception e) {
logger.error("再查项目失败!", e);
outputMsg(res, "<script>alert('再查项目失败,请联系管理员!');window.history.go(-1);</script>");
}
}
@RequestMapping("/serverMonitor")
public ModelAndView serverMonitor(HttpServletRequest req, HttpServletResponse res)
throws Exception
{
List servers = this.projectService.getAllServers();
String server = req.getParameter("server");
if ((server == null) && (servers != null))
{
server = (String)servers.get(0);
}
if ((server != null) || ("".equals(server)))
{
server = new String(server.getBytes("iso-8859-1"), "utf-8");
Project project = this.projectService.getProjectByServerState(server, "在查");
if (project != null)
{
int pid = project.getId();
List stages = this.projectService.getStagesByProject(pid);
req.setAttribute("project", project);
req.setAttribute("stages", stages);
}
}
req.setAttribute("servers", servers);
req.setAttribute("server", server);
return new ModelAndView("serverMonitor");
}
@RequestMapping("/stopProject")
public void stopProject(HttpServletRequest req, HttpServletResponse res)
throws Exception
{
try
{
String pid = req.getParameter("pid");
this.projectService.stopProject(pid);
String server = new String(req.getParameter("server").getBytes("iso-8859-1"), "utf-8");
outputMsg(res, "<script>document.location.href='project.do?method=serverMonitor&server=" + server + "';</script>");
}
catch (Exception e) {
logger.error("中止项目失败!", e);
outputMsg(res, "<script>alert('中止项目失败,请联系管理员!');window.history.go(-1);</script>");
}
}
/**
* 上传preDFM文件
* @param request
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/uploadPreDFM")
public ModelAndView uploadPreDFM(HttpServletRequest request, HttpServletResponse res)
throws Exception
{
//FIXME 修改上传文件
MultipartResolver cmr = null;//new CosMultipartResolver(request.getSession().getServletContext());
MultipartHttpServletRequest req = cmr.resolveMultipart(request);
try
{
//项目ID
Integer pid = Integer.parseInt(req.getParameter("pid"));
Project project = projectService.getProjectById(pid);
UserInfo projectUser = userService.getUserById(project.getSubmitUser());
String dir = projectUser.getUsername() + "/" +
project.getProjectName() + "/" + "Ver" + project.getVersion();
List<FileInfo> fileList = new ArrayList<FileInfo>();
this.fileService.savePhysicFile(req, fileList, dir, true, "pre-");
projectService.updateProjectPreDFMFile(pid, fileList.get(0).getId(), fileList.get(0).getFileName());
req.setAttribute("uploadResult", "上传成功");
req.setAttribute("uploadType", "preDFM");
req.setAttribute("fid", fileList.get(0).getId());
req.setAttribute("fname", fileList.get(0).getFileName());
req.setAttribute("pid", pid);
} catch (Exception e) {
logger.error("上传PreDFM报告失败", e);
req.setAttribute("uploadResult", "上传失败");
req.setAttribute("uploadType", "preDFM");
}
return new ModelAndView("upload");
}
/**
* 上传preDFM文件
* @param request
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/uploadPostDFM")
public ModelAndView uploadPostDFM(HttpServletRequest request, HttpServletResponse res)
throws Exception
{
//FIXME 修改上传文件
MultipartResolver cmr = null;//new CosMultipartResolver(request.getSession().getServletContext());
MultipartHttpServletRequest req = cmr.resolveMultipart(request);
try
{
//项目ID
Integer pid = Integer.parseInt(req.getParameter("pid"));
Project project = projectService.getProjectById(pid);
UserInfo projectUser = userService.getUserById(project.getSubmitUser());
String dir = projectUser.getUsername() + "/" +
project.getProjectName() + "/" + "Ver" + project.getVersion();
List<FileInfo> fileList = new ArrayList<FileInfo>();
this.fileService.savePhysicFile(req, fileList, dir, true, "post-");
projectService.updateProjectPostDFMFile(pid, fileList.get(0).getId(), fileList.get(0).getFileName());
req.setAttribute("uploadResult", "上传成功");
req.setAttribute("uploadType", "postDFM");
req.setAttribute("fid", fileList.get(0).getId());
req.setAttribute("fname", fileList.get(0).getFileName());
req.setAttribute("pid", pid);
} catch (Exception e) {
logger.error("上传PostDFM报告失败", e);
req.setAttribute("uploadResult", "上传失败");
req.setAttribute("uploadType", "postDFM");
}
return new ModelAndView("upload");
}
}

View File

@ -0,0 +1,158 @@
package com.ruoyi.dfm.controller;
import com.alibaba.fastjson.JSON;
import com.ruoyi.dfm.pojo.Result;
import com.ruoyi.dfm.service.StatisticsService;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 项目统计控制器
*/
@Controller
@RequestMapping("/statistics.do")
public class StatisticsController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(DataAnalysisController.class);
@Autowired
StatisticsService statisticsService;
/**
* 项目统计页面
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/")
public ModelAndView defaultHandle(HttpServletRequest req, HttpServletResponse res) throws Exception {
List<Map<String, Object>> allYear = statisticsService.getAllYear();
List<Object> allYears = new ArrayList<>(allYear.size());
for(Map<String, Object> map : allYear) {
allYears.add(map.get("f_year"));
}
req.setAttribute("allYears", allYears);
return new ModelAndView("statistics");
}
/**
* 获取软件总利用率
* @param req
* @param res
* @throws Exception
*/
@RequestMapping("/usage")
public void usage(HttpServletRequest req, HttpServletResponse res) throws Exception {
try {
logger.info("获取软件总利用率");
Map<String, Object> usage = statisticsService.usage();
Result result = new Result();
result.setSuccess(true);
result.setMessage("获取软件利用率成功");
result.setData(usage);
outputJson(res, JSON.toJSONString(result));
} catch (Exception e) {
logger.error("获取软件利用率失败!", e);
Result result = new Result();
result.setSuccess(false);
result.setMessage("获取软件利用率失败!");
outputJson(res, JSON.toJSONString(result));
}
}
/**
* 获取根据部门分组的时间利用率
* @param req
* @param res
* @throws Exception
*/
@RequestMapping("/usageGroupByDepartment")
public void usageGroupByDepartment(HttpServletRequest req, HttpServletResponse res) throws Exception {
try {
logger.info("获取根据部门分组的时间利用率");
List<Map<String, Object>> usages = statisticsService.usageGroupByDepartment();
Result result = new Result();
result.setSuccess(true);
result.setMessage("获取软件利用率成功");
result.setData(usages);
outputJson(res, JSON.toJSONString(result));
} catch (Exception e) {
logger.error("获取软件利用率失败!", e);
Result result = new Result();
result.setSuccess(false);
result.setMessage("获取软件利用率失败!");
outputJson(res, JSON.toJSONString(result));
}
}
/**
* 获取年度根据部门分组的时间利用率
* @param req
* @param res
* @throws Exception
*/
@RequestMapping("/usageGroupByDepartmentAndYear")
public void usageGroupByDepartmentAndYear(HttpServletRequest req, HttpServletResponse res) throws Exception {
try {
logger.info("获取年度根据部门分组的时间利用率");
List<Map<String, Object>> usages = statisticsService.usageGroupByDepartmentAndYear();
Result result = new Result();
result.setSuccess(true);
result.setMessage("获取软件利用率成功");
result.setData(usages);
outputJson(res, JSON.toJSONString(result));
} catch (Exception e) {
logger.error("获取软件利用率失败!", e);
Result result = new Result();
result.setSuccess(false);
result.setMessage("获取年度软件利用率失败!");
outputJson(res, JSON.toJSONString(result));
}
}
/**
* 单位时间内已完成的项目数量统计
* 月份f_month
* 完成的项目数量f_count
* @param req
* @param res
* @throws Exception
*/
@RequestMapping("/completedProjectSummary")
public void completedProjectSummary(HttpServletRequest req, HttpServletResponse res) throws Exception {
String year = req.getParameter("year");
if(StringUtils.isBlank(year)) {
year = new Date().getYear() + "";
}
try {
logger.info("按月统计已完成数量");
List<Map<String, Object>> countResult = statisticsService.countByMonth(year);
Result result = new Result();
result.setSuccess(true);
result.setMessage("按月统计已完成数量成功");
result.setData(countResult);
outputJson(res, JSON.toJSONString(result));
} catch (Exception e) {
logger.error("按月统计已完成数量失败!", e);
Result result = new Result();
result.setSuccess(false);
result.setMessage("按月统计已完成数量失败!年份=" + year);
outputJson(res, JSON.toJSONString(result));
}
}
}

View File

@ -0,0 +1,311 @@
package com.ruoyi.dfm.controller;
import com.ruoyi.dfm.constant.UserConstants;
import com.ruoyi.dfm.pojo.Page;
import com.ruoyi.dfm.pojo.UserInfo;
import com.ruoyi.dfm.pojo.UserQueryBean;
import com.ruoyi.dfm.service.FileService;
import com.ruoyi.dfm.service.UserService;
import com.ruoyi.dfm.util.Md5Util;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@Controller
@RequestMapping("/user.do")
public class UserController extends BaseController{
private static final Logger logger = LoggerFactory.getLogger(UserController.class);
@Autowired
private UserService userService;
@Autowired
private FileService fileService;
/**
* 用户管理控制器默认打开个人资料方法
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/")
public ModelAndView defaultHandle(HttpServletRequest req,
HttpServletResponse res) throws Exception {
return new ModelAndView("modifyUser");
}
/**
* 添加用户
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/add")
public ModelAndView add(HttpServletRequest req,
HttpServletResponse res) throws Exception {
String name = req.getParameter("name");
String username = req.getParameter("username");
String pwd = req.getParameter("password");
String pwd1 = req.getParameter("password1");
String department = req.getParameter("department");
String projectGroup = req.getParameter("projectGroup");
String email = req.getParameter("email");
String ccEmail = req.getParameter("ccEmail");
String isDepAdmin = req.getParameter("isDepAdmin");
String isAdmin = req.getParameter("isAdmin");
try {
UserInfo user = new UserInfo();
user.setDepartment(department);
user.setEmail(email);
user.setCcEmail(ccEmail);
user.setPassword(Md5Util.md5(pwd));
int groupId = UserConstants.USER_LEVEL_NORMAL;
if(StringUtils.isNotBlank(isAdmin) && "1".equals(isAdmin))
{
groupId = UserConstants.USER_LEVEL_ADMIN;
} else if(StringUtils.isNotBlank(isDepAdmin) && "1".equals(isDepAdmin))
{
groupId = UserConstants.USER_LEVEL_DEP_ADMIN;
}
user.setGroupId(groupId);
user.setName(name);
user.setProjectGroup(projectGroup);
user.setUsername(username);
userService.addUser(user);
//创建用户目录
String dir = fileService.getRootPath() + user.getUsername();
fileService.createDir(dir);
outputMsg(res, "<script>alert('添加成功,点击确定跳转到用户列表!');document.location.href='user.do?method=getUserList';</script>");
return null;
} catch (Exception e) {
logger.error("添加用户失败", e);
outputMsg(res, "<script>alert('添加用户失败,请检查数据正确性,重新添加!');window.history.go(-1)';</script>");
return null;
}
}
/**
* 获取用户列表
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/getUserList")
public ModelAndView getUserList(HttpServletRequest req,
HttpServletResponse res) throws Exception {
String currentPage = req.getParameter("currentPage");
Page page = new Page();
if(currentPage == null || "".equals(currentPage.trim()))
{
page.setCurrentPage(1);
}
else
{
page.setCurrentPage(Integer.parseInt(currentPage));
}
UserInfo currentUser = getUserInfo(req);
List<UserInfo> rs = null;
if(UserConstants.USER_LEVEL_ADMIN == currentUser.getGroupId()) {
rs = userService.getAllUser(page);
} else if(UserConstants.USER_LEVEL_DEP_ADMIN == currentUser.getGroupId()) {
//部门管理员只能获取自己部门的用户
UserQueryBean userQueryBean = new UserQueryBean();
userQueryBean.setDepartment(currentUser.getDepartment());
rs = userService.getByQueryBean(userQueryBean, page);
}
req.setAttribute("userList", rs);
req.setAttribute("page", page);
return new ModelAndView("userList");
}
/**
* 删除用户
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/deleteUser")
public ModelAndView deleteUser(HttpServletRequest req,
HttpServletResponse res) throws Exception {
try {
String delProject = req.getParameter("delProject");
int uid = Integer.parseInt(req.getParameter("uid"));
userService.deleteUser(uid,delProject);
outputMsg(res, "<script>alert('删除用户成功!');document.location.href='user.do?method=getUserList';</script>");
} catch (Exception e) {
logger.error("删除用户失败", e);
outputMsg(res, "<script>alert('删除用户失败,请重试!');window.history.go(-1);</script>");
}
return null;
}
/**
* 暂停用户
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/changeUserState")
public ModelAndView changeUserState(HttpServletRequest req,
HttpServletResponse res) throws Exception {
try {
int uid = Integer.parseInt(req.getParameter("uid"));
int state = Integer.parseInt(req.getParameter("state"));
//构造分页参数
String currentPage = req.getParameter("currentPage");
userService.changeUserState(uid , state);
outputMsg(res, "<script>alert('操作用户成功!');document.location.href='user.do?method=getUserList&currentPage="+currentPage+"';</script>");
} catch (Exception e) {
logger.error("暂停用户失败", e);
outputMsg(res, "<script>alert('操作用户失败,请重试!');window.history.go(-1);</script>");
}
return null;
}
/**
* 获取修改用户界面
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping("/getModifyUser")
public ModelAndView getModifyUser(HttpServletRequest req,
HttpServletResponse res) throws Exception {
int uid = 0 ;
String ustr = req.getParameter("uid");
if(ustr == null || "".equals(ustr))
{
uid = getUserInfo(req).getId();
}else
{
uid = Integer.parseInt(ustr);
}
UserInfo user = userService.getUserById(uid);
req.setAttribute("user", user);
return new ModelAndView("modifyUser");
}
@RequestMapping("/modifyUser")
public ModelAndView modifyUser(HttpServletRequest req,
HttpServletResponse res) throws Exception {
String id = req.getParameter("id");
String name = req.getParameter("name");
String username = req.getParameter("username");
String pwd = req.getParameter("password");
String pwd1 = req.getParameter("password1");
String department = req.getParameter("department");
String projectGroup = req.getParameter("projectGroup");
String email = req.getParameter("email");
String ccEmail = req.getParameter("ccEmail");
String gid = req.getParameter("gid");
int groupId = null == gid ? UserConstants.USER_LEVEL_NORMAL : Integer.parseInt(gid);
String isDepAdmin = req.getParameter("isDepAdmin");
String isAdmin = req.getParameter("isAdmin");
// int groupId = UserConstants.USER_LEVEL_NORMAL;
if("1".equals(isAdmin))
{
groupId = UserConstants.USER_LEVEL_ADMIN;
} else if("1".equals(isDepAdmin))
{
groupId = UserConstants.USER_LEVEL_DEP_ADMIN;
}
UserInfo user1 = getUserInfo(req);
try {
UserInfo user = new UserInfo();
user.setId(Integer.parseInt(id));
user.setDepartment(department);
user.setEmail(email);
user.setCcEmail(ccEmail);
//user.setPassword(Md5Util.md5(pwd));
user.setPassword(pwd);
user.setName(name);
user.setProjectGroup(projectGroup);
user.setUsername(username);
user.setGroupId(groupId);
userService.updateUser(user);
if(UserConstants.USER_LEVEL_ADMIN == user1.getGroupId())
{
outputMsg(res, "<script>alert('修改成功,点击确定跳转到用户列表!');document.location.href='user.do?method=getUserList';</script>");
}
else
{
outputMsg(res, "<script>alert('修改成功,点击确定跳转项目提交页面!');document.location.href='project.do?method=getAddPage';</script>");
}
return null;
} catch (Exception e) {
logger.error("修改用户失败", e);
outputMsg(res, "<script>alert('修改用户失败,请检查数据正确性,重新添加!');window.history.go(-1)';</script>");
return null;
}
}
@RequestMapping("/queryUser")
public ModelAndView queryUser(HttpServletRequest req,
HttpServletResponse res) throws Exception {
String name = req.getParameter("name");
String username = req.getParameter("username");
String department = req.getParameter("department");
String projectGroup = req.getParameter("projectGroup");
String state = req.getParameter("state");
UserQueryBean queryBean = new UserQueryBean();
queryBean.setDepartment(department);
queryBean.setName(name);
queryBean.setProjectGroup(projectGroup);
queryBean.setState(state);
queryBean.setUsername(username);
//构造分页参数
String currentPage = req.getParameter("currentPage");
Page page = new Page();
if(currentPage == null || "".equals(currentPage.trim()))
{
page.setCurrentPage(1);
}
else
{
page.setCurrentPage(Integer.parseInt(currentPage));
}
UserInfo currentUser = getUserInfo(req);
List<UserInfo> rs = null;
if(UserConstants.USER_LEVEL_ADMIN == currentUser.getGroupId()) {
rs = userService.getByQueryBean(queryBean , page);
} else if(UserConstants.USER_LEVEL_DEP_ADMIN == currentUser.getGroupId()) {
//部门管理员只能获取自己部门的用户
queryBean.setDepartment(currentUser.getDepartment());
rs = userService.getByQueryBean(queryBean, page);
}
//List<UserInfo> list = userService.getByQueryBean(queryBean , page);
req.setAttribute("page", page);
req.setAttribute("userList", rs);
return new ModelAndView("userList");
}
}

View File

@ -0,0 +1,140 @@
package com.ruoyi.dfm.dao;
import com.ruoyi.dfm.pojo.DataAnalysisBean;
import com.ruoyi.dfm.pojo.UserInfo;
import com.ruoyi.dfm.util.TimeUtil;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Component
public class DataAnalysisDAO extends JdbcBaseDao {
public List<DataAnalysisBean> analysisByProject(String projectName, String startSubmitTime,
String endSubmitTime) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT t.F_PROJECT_NAME, t.F_VERSION , t.F_ISSUE_DESCRIPTION, SUM(t.F_ISSUE_QTY) F_ISSUE_QTY ");
sb.append("FROM dfm.t_dataays t ");
sb.append("where t.F_PROJECT_NAME = ? AND T.F_SUBMIT_TIME >= ? AND T.F_SUBMIT_TIME <= ? ");
sb.append("group by t.F_PROJECT_NAME, t.F_VERSION , t.F_ISSUE_DESCRIPTION ");
sb.append("order by SUM(t.F_ISSUE_QTY) desc, t.F_VERSION ASC");
//先根据问题数量倒叙排列再根据版本升序排列
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sb.toString(), new Object[] {
projectName,
TimeUtil.getDateStrByFormat(startSubmitTime, "yyyy-MM-dd", "yyyyMMdd") + "000000",
TimeUtil.getDateStrByFormat(endSubmitTime, "yyyy-MM-dd", "yyyyMMdd") + "235959"
});
if(null == list || list.size() <= 0) {
return null;
}
List<DataAnalysisBean> result = new ArrayList<DataAnalysisBean>(list.size());
for(Map<String, Object> map : list) {
DataAnalysisBean b = new DataAnalysisBean();
b.setProjectName((String)map.get("F_PROJECT_NAME"));
b.setVersion(null == map.get("F_VERSION") ? 0 : Integer.parseInt(map.get("F_VERSION").toString()));
b.setIssueDescription((String)map.get("F_ISSUE_DESCRIPTION"));
b.setIssueQty(null == map.get("F_ISSUE_QTY") ? 0 : Integer.parseInt(map.get("F_ISSUE_QTY").toString()));
result.add(b);
}
return result;
}
public List<DataAnalysisBean> analysisByUser(String userName, String startSubmitTime, String endSubmitTime) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT t.F_SUBMIT_USERNAME, t.F_ISSUE_DESCRIPTION, SUM(t.F_ISSUE_QTY) F_ISSUE_QTY ");
sb.append("FROM dfm.t_dataays t ");
sb.append("where t.F_SUBMIT_USERNAME = ? AND T.F_SUBMIT_TIME >= ? AND T.F_SUBMIT_TIME <= ? ");
sb.append("group by t.F_SUBMIT_USERNAME, t.F_ISSUE_DESCRIPTION ");
sb.append("order by SUM(t.F_ISSUE_QTY) DESC");
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sb.toString(), new Object[] {
userName,
TimeUtil.getDateStrByFormat(startSubmitTime, "yyyy-MM-dd", "yyyyMMdd") + "000000",
TimeUtil.getDateStrByFormat(endSubmitTime, "yyyy-MM-dd", "yyyyMMdd") + "235959"
});
if(null == list || list.size() <= 0) {
return null;
}
List<DataAnalysisBean> result = new ArrayList<DataAnalysisBean>(list.size());
for(Map<String, Object> map : list) {
DataAnalysisBean b = new DataAnalysisBean();
b.setSubmitUserName((String)map.get("F_SUBMIT_USERNAME"));
b.setIssueDescription((String)map.get("F_ISSUE_DESCRIPTION"));
b.setIssueQty(null == map.get("F_ISSUE_QTY") ? 0 : Integer.parseInt(map.get("F_ISSUE_QTY").toString()));
result.add(b);
}
return result;
}
public List<DataAnalysisBean> analysisByAllUser(String startSubmitTime, String endSubmitTime, List<UserInfo> submitUsers) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT t.F_SUBMIT_USERNAME, SUM(t.F_ISSUE_QTY) F_ISSUE_QTY ");
sb.append("FROM dfm.t_dataays t ");
sb.append("where T.F_SUBMIT_TIME >= ? AND T.F_SUBMIT_TIME <= ? ");
sb.append("AND T.F_SUBMIT_USER IN (-1");
for (int i = 0; i < submitUsers.size(); ++i)
{
sb.append( "," + submitUsers.get(i).getId());
}
sb.append(")");
sb.append("group by t.F_SUBMIT_USERNAME ");
sb.append("order by SUM(t.F_ISSUE_QTY) DESC");
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sb.toString(), new Object[] {
TimeUtil.getDateStrByFormat(startSubmitTime, "yyyy-MM-dd", "yyyyMMdd") + "000000",
TimeUtil.getDateStrByFormat(endSubmitTime, "yyyy-MM-dd", "yyyyMMdd") + "235959"
});
if(null == list || list.size() <= 0) {
return null;
}
List<DataAnalysisBean> result = new ArrayList<DataAnalysisBean>(list.size());
for(Map<String, Object> map : list) {
DataAnalysisBean b = new DataAnalysisBean();
b.setSubmitUserName((String)map.get("F_SUBMIT_USERNAME"));
//b.setIssueDescription((String)map.get("F_ISSUE_DESCRIPTION"));
b.setIssueQty(null == map.get("F_ISSUE_QTY") ? 0 : Integer.parseInt(map.get("F_ISSUE_QTY").toString()));
result.add(b);
}
return result;
}
public List<DataAnalysisBean> analysisByAllIssue(String startSubmitTime, String endSubmitTime, List<UserInfo> submitUsers) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT t.F_ISSUE_DESCRIPTION, SUM(t.F_ISSUE_QTY) F_ISSUE_QTY ");
sb.append("FROM dfm.t_dataays t ");
sb.append("where T.F_SUBMIT_TIME >= ? AND T.F_SUBMIT_TIME <= ? ");
sb.append("AND T.F_SUBMIT_USER IN (-1");
for (int i = 0; i < submitUsers.size(); ++i)
{
sb.append( "," + submitUsers.get(i).getId());
}
sb.append(")");
sb.append("group by t.F_ISSUE_DESCRIPTION ");
sb.append("order by SUM(t.F_ISSUE_QTY) DESC");
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sb.toString(), new Object[] {
TimeUtil.getDateStrByFormat(startSubmitTime, "yyyy-MM-dd", "yyyyMMdd") + "000000",
TimeUtil.getDateStrByFormat(endSubmitTime, "yyyy-MM-dd", "yyyyMMdd") + "235959"
});
if(null == list || list.size() <= 0) {
return null;
}
List<DataAnalysisBean> result = new ArrayList<DataAnalysisBean>(list.size());
for(Map<String, Object> map : list) {
DataAnalysisBean b = new DataAnalysisBean();
b.setIssueDescription((String)map.get("F_ISSUE_DESCRIPTION"));
b.setIssueQty(null == map.get("F_ISSUE_QTY") ? 0 : Integer.parseInt(map.get("F_ISSUE_QTY").toString()));
result.add(b);
}
return result;
}
}

View File

@ -0,0 +1,55 @@
package com.ruoyi.dfm.dao;
import com.ruoyi.dfm.pojo.FileInfo;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component
public class FileDAO extends JdbcBaseDao{
public void add(FileInfo file)
{
String sql = "INSERT INTO T_FILE "
+ "(F_FILE_NAME ,F_RELA_PATH, F_EXTEND_NAME,F_FILE_SIZE,F_UPLOAD_USER,F_UPLOAD_TIME)"
+ "VALUES(?,?,?,?,?,?)";
Object [] args = new Object[6];
args[0] = file.getFileName();
args[1] = file.getRelaPath();
args[2] = file.getExtendName();
args[3] = file.getFileSize();
args[4] = file.getUploadUser();
args[5] = file.getUploadTime();
getJdbcTemplate().update(sql, args);
String idSql = "SELECT LAST_INSERT_ID()";
int id = getJdbcTemplate().queryForObject(idSql, Integer.class);
file.setId(id);
}
public FileInfo getById(int fid)
{
FileInfo file = null;
String sql = "SELECT * FROM T_FILE T WHERE T.F_ID = ?";
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql,new Object[] { fid });
if (null == list || list.size() <= 0) {
return file;
} else {
Map map = list.get(0);
file = new FileInfo();
file.setId(Integer.parseInt(map.get("F_ID").toString()));
file.setFileName(map.get("F_FILE_NAME")==null?"":map.get("F_FILE_NAME").toString());
file.setRelaPath(map.get("F_RELA_PATH")==null?"":map.get("F_RELA_PATH").toString());
file.setExtendName(map.get("F_EXTEND_NAME")==null?"":map.get("F_EXTEND_NAME").toString());
file.setFileSize(Long.parseLong(map.get("F_FILE_SIZE").toString()));
file.setUploadTime(map.get("F_UPLOAD_TIME")==null?"":map.get("F_UPLOAD_TIME").toString());
file.setUploadUser(Integer.parseInt(map.get("F_UPLOAD_USER").toString()));
}
return file;
}
public void delete(int fid) {
String sql = "DELETE T.* FROM T_FILE T WHERE T.F_ID = ?";
getJdbcTemplate().update(sql, new Object[]{fid});
}
}

View File

@ -0,0 +1,271 @@
package com.ruoyi.dfm.dao;
import com.alibaba.druid.pool.DruidDataSource;
import com.ruoyi.framework.config.DruidConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementCallback;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.jdbc.support.lob.LobHandler;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import java.sql.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* @author
*
*/
@Component
public class JdbcBaseDao {//extends JdbcDaoSupport {
protected static final Logger log = LoggerFactory.getLogger(JdbcBaseDao.class);
@Autowired
JdbcTemplate jdbcTemplate;
JdbcTemplate getJdbcTemplate(){
return jdbcTemplate;
}
/**
* 设置 LOB 处理器
*/
private LobHandler lobHandler ;
public LobHandler getLobHandler() {
return lobHandler;
}
public void setLobHandler(LobHandler lobHandler) {
this.lobHandler = lobHandler;
}
/**
* 构造方法
*/
public JdbcBaseDao(){}
/**
* 执行查询返回Map结果集的List
*
* @param sql sql文本
* @param args 参数数组注意与sql语句里面的排序对应, 无参数传null
* @return Map结果集的ListList存放的是多个数据库列和值的Map
*/
public List queryForList(String sql, Object[] args) throws DataAccessException {
return getJdbcTemplate().queryForList(sql, args);
}
/**
* 提供一个参数执行查询
* @param sql
* @return
* @throws DataAccessException
* <ul>
* <li>邹美亮,2008/01/08 PM,查询话单业务分类信息列表</li>
* </ul>
*/
public List queryForList(String sql) throws DataAccessException {
return getJdbcTemplate().queryForList(sql);
}
/**
* 执行查询象返回Map结果集
*
* @param sql sql文本
* @param args 参数数组注意与sql语句里面的排序对应, 无参数传null
* @return 数据库列和值的Map
* @throws SQLException
*/
public Map queryForMap(String sql, Object[] args) throws DataAccessException {
return (args == null) ? getJdbcTemplate().queryForMap(sql) :
getJdbcTemplate().queryForMap(sql, args);
}
/**
* 执行单一值查询
*
* @param sql sql文本
* @param args 参数数组注意与sql语句里面的排序对应, 无参数传null
* @param requiredType 该值的类型
* @return 单一值
*/
public Object queryForObject(String sql, Object[] args, Class requiredType) throws DataAccessException {
return (args == null) ? getJdbcTemplate().queryForObject(sql, requiredType) :
getJdbcTemplate().queryForObject(sql, args, requiredType);
}
/**
* 执行单一值查询
*
* @param sql sql文本
* @param args 参数数组注意与sql语句里面的排序对应, 无参数传null
* @return long
* @throws SQLException
*/
public long queryForLong(String sql, Object[] args) throws DataAccessException {
return (args == null) ? getJdbcTemplate().queryForObject(sql, Long.class) :
getJdbcTemplate().queryForObject(sql, args, Long.class);
}
/**
* 执行单一值查询
*
* @param sql sql文本
* @param args 参数数组注意与sql语句里面的排序对应, 无参数传null
* @return int
* @throws SQLException
*/
public int queryForObject(String sql, Object[] args) throws SQLException {
return (args == null) ? getJdbcTemplate().queryForObject(sql, Integer.class) :
getJdbcTemplate().queryForObject(sql, args, Integer.class);
}
public int update(String sql, Object[] args) {
return (args == null) ? getJdbcTemplate().update(sql) :
getJdbcTemplate().update(sql, args);
}
/**
* 执行无返回结果集的SQL返回影响行数
*
* @param sql sql文本
* @param args 参数数组注意与sql语句里面的排序对应, 无参数传null
* @return 影响行数
*/
public Object execute(String sql, final Object[] args) throws DataAccessException, SQLException {
return this.getJdbcTemplate().execute(sql, new PreparedStatementCallback() {
public Object doInPreparedStatement(PreparedStatement ps)
throws SQLException, DataAccessException {
if(args != null) {
for(int i = 0; i < args.length; i++) {
ps.setObject(i+1, args[i]);
}
}
return ps.executeUpdate();
}
}
);
}
public int updateForClob(String sql, Object[] args) throws DataAccessException {
int intResult = 0;
try {
String className = "";
int[] argTypes = new int[args.length];
for(int i=0; i<args.length; i++){
className = args[i].getClass().getName();
if(className.indexOf("String")>0){
argTypes[i] = Types.VARCHAR;
}else if (className.indexOf("Long")>0
|| className.indexOf("Integer")>0
|| className.indexOf("Double")>0
|| className.indexOf("Float")>0) {
argTypes[i] = Types.NUMERIC;
}else if(className.indexOf("SqlLobValue")>0 ){
argTypes[i] = Types.CLOB;
}else{
argTypes[i] = Types.VARCHAR;
}
}
intResult = this.getJdbcTemplate().update(sql, args, argTypes);
} catch (Exception e) {
e.printStackTrace();
intResult = -1;
}
return intResult;
}
/**
* 获取含有CLOBBLOB字段内容表数据 String
* @param sql
* @param args
* @return
* @throws DataAccessException
*/
public Map queryClobToStringForMap(String sql, Object[] args) throws DataAccessException {
Map mapResult = null;
try {
mapResult = (Map)this.getJdbcTemplate().queryForObject(sql, args, new RowMapper(){
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
Map<String, String> mapRs = new HashMap<String, String>();
ResultSetMetaData metaData =rs.getMetaData();
for(int num=1 ; num<=metaData.getColumnCount(); num++){
if(metaData.getColumnType(num)==Types.CLOB){
mapRs.put(metaData.getColumnName(num).toLowerCase(), lobHandler.getClobAsString(rs, num));
}else{
mapRs.put(metaData.getColumnName(num).toLowerCase(), rs.getString(num));
}
}
return mapRs;
}
});
} catch (DataAccessException da) {
mapResult = null;
} catch (Exception e) {
mapResult = null;
}
return mapResult;
}
/**
* 带Clob字段的查询
* @param sql
* @param args
* @return
*/
protected List queryForClob(String sql,Object[] args)
{
return this.getJdbcTemplate().query(sql,args,new RowMapper(){
public Object mapRow(ResultSet resultset, int i) throws SQLException
{
Map<String,String> retMap = new HashMap<String,String>();
ResultSetMetaData metaData = resultset.getMetaData();
for(int num = 1; num <= metaData.getColumnCount(); num++)
{
if(metaData.getColumnType(num) == Types.CLOB)
{
retMap.put(metaData.getColumnName(num).toLowerCase(), getLobHandler().getClobAsString(resultset, num));
}
else
{
retMap.put(metaData.getColumnName(num).toLowerCase(), resultset.getString(num));
}
}
return retMap;
}});
}
/**
* 带Clob字段的查询
* @param sql
* @return
*/
protected List queryForClob(String sql)
{
return this.queryForClob(sql, null);
}
}

View File

@ -0,0 +1,41 @@
package com.ruoyi.dfm.dao;
import com.ruoyi.dfm.pojo.MenuInfo;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Component
public class MenuDAO extends JdbcBaseDao {
/**
* 根据用户组获取菜单列表
*
* @param groupId
* @return
*/
public List<MenuInfo> getByGroup(int groupId) {
String sql = "SELECT T1.* FROM t_menu_list T1 , t_menu_group_dz T2 "
+ "WHERE T1.F_ID = T2.F_MENU_ID AND T2.F_GROUP_ID = ?";
List<MenuInfo> rs = null;
List<Map<String, Object>> dbRs = getJdbcTemplate().queryForList(sql, new Object[]{groupId});
if(null == dbRs || dbRs.isEmpty())
{
return rs;
}
rs = new ArrayList<MenuInfo>();
for(int i=0;i<dbRs.size();i++)
{
Map map = dbRs.get(i);
MenuInfo menu = new MenuInfo();
menu.setId(Integer.parseInt(map.get("F_ID").toString()));
menu.setUrl(map.get("F_URL")==null?"":map.get("F_URL").toString());
menu.setMenuName(map.get("F_MENU_NAME")==null?"":map.get("F_MENU_NAME").toString());
menu.setMenuLevel(Integer.parseInt(map.get("F_NEMU_LEVEL").toString()));
menu.setParentId(map.get("F_PARENT_ID") == null ?0:Integer.parseInt(map.get("F_PARENT_ID").toString()));
rs.add(menu);
}
return rs;
}
}

View File

@ -0,0 +1,636 @@
package com.ruoyi.dfm.dao;
import com.ruoyi.dfm.constant.ProjectConstants;
import com.ruoyi.dfm.pojo.Page;
import com.ruoyi.dfm.pojo.Project;
import com.ruoyi.dfm.pojo.ProjectQueryBean;
import com.ruoyi.dfm.pojo.ProjectStage;
import com.ruoyi.dfm.util.PageUtil;
import com.ruoyi.dfm.util.TimeUtil;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Component
public class ProjectDAO extends JdbcBaseDao
{
private static final Logger logger = LoggerFactory.getLogger(ProjectDAO.class);
public void add(Project project)
{
String sql = "INSERT INTO T_PROJECT (F_PROJECT_NAME ,F_VERSION, F_PCB_FILE,F_BOM_FILE,F_CHECK_TYPE,F_DFM_CHECK,F_PCB_TYPE,F_HDI_Model ,F_Board_Thickness, F_Panel_Model,F_Max_Heigh_Top,F_SubPCB_Num,F_Max_Heigh_Bot ,F_Railway_Position, F_Viacap_layer,F_Assembly_Process_Top,F_Have_Pb ,F_Assembly_Process_Bot, F_Surface_Process,F_Direction_Top,F_Primary_Side,F_Direction_Bot, F_Direction_Bot_Fs ,F_Density,F_SUBMIT_USER, F_SUBMIT_TIME,F_STATE,F_PRI ,F_FILE_RESULT, F_SERVER,F_PCB_FILE_NAME,F_BOM_FILE_NAME,F_SUBMIT_USERNAME,F_REPORT_LANGUAGE,F_CC_USERNAME)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
Object[] args = new Object[35];
args[0] = project.getProjectName();
args[1] = Integer.valueOf(project.getVersion());
args[2] = Integer.valueOf(project.getPcbFile());
args[3] = Integer.valueOf(project.getBomFile());
args[4] = Integer.valueOf(project.getCheckType());
args[5] = project.getDfmCheck();
args[6] = Integer.valueOf(project.getPcbType());
args[7] = Integer.valueOf(project.getHdiModel());
args[8] = Float.valueOf(project.getBoardThickness());
args[9] = Integer.valueOf(project.getPanelModel());
args[10] = Float.valueOf(project.getMaxHeightTop());
args[11] = Integer.valueOf(project.getSubPcbNum());
args[12] = Float.valueOf(project.getMaxHeightBot());
args[13] = Integer.valueOf(project.getRailwayPosition());
args[14] = Integer.valueOf(project.getViacapLayer());
args[15] = Integer.valueOf(project.getAssemblyProcessTop());
args[16] = Integer.valueOf(project.getHavePb());
args[17] = Integer.valueOf(project.getAssemblyProcessBot());
args[18] = Integer.valueOf(project.getSurfaceProcess());
args[19] = Integer.valueOf(project.getDirectionTop());
args[20] = Integer.valueOf(project.getPrimarySide());
args[21] = Integer.valueOf(project.getDirectionBot());
args[22] = Integer.valueOf(project.getDirectionBotFs());
args[23] = project.getDensity();
args[24] = Integer.valueOf(project.getSubmitUser());
args[25] = project.getSubmitTime();
args[26] = project.getState();
args[27] = Integer.valueOf(project.getPri());
args[28] = project.getResultFile();
args[29] = project.getServer();
args[30] = project.getPcbFileName();
args[31] = project.getBomFileName();
args[32] = project.getSubmitUserName();
args[33] = project.getReportLanguage();
args[34] = project.getCCtoOther();
getJdbcTemplate().update(sql, args);
}
public Project getById(int id)
{
String sql = "SELECT * FROM T_PROJECT T WHERE T.F_ID = ?";
List list = getJdbcTemplate().queryForList(sql, new Object[] { Integer.valueOf(id) });
Project rs = null;
if ((list == null) || (list.size() <= 0))
{
return null;
}
Map map = (Map)list.get(0);
rs = map2Bean(map);
return rs;
}
/**
* 结果文件下载查询
* @param states
* @param page
* @param queryBean
* @return
*/
public List<Project> getByStates(String[] states, Page page, ProjectQueryBean queryBean)
{
int totalCount = getCountByStates(states, queryBean);
int start = (page.getCurrentPage() - 1) * page.getPageSize();
String sql = "SELECT * FROM T_PROJECT T WHERE T.F_STATE IN ('-1'";
for (int i = 0; i < states.length; ++i)
{
sql = sql + ",'" + states[i] + "'";
}
sql = sql + ") ";
List params = new ArrayList();
if (queryBean != null)
{
sql = constructConditionSql(queryBean, sql, params);
}
for (String state : states)
{
//表示结果下载的场景
if (ProjectConstants.PROJECT_STATE_WANCHENG.equals(state)
|| ProjectConstants.PROJECT_STATE_CHUCUO.equals(state)
|| ProjectConstants.PROJECT_STATE_ZHONGDUAN.equals(state))
{
sql = sql + " ORDER BY T.F_END_TIME DESC limit ?,?";
break;
}
if (!("在查".equals(state)))
{
continue;
}
sql = sql + " ORDER BY T.F_PRI ASC limit ?,?";
break;
}
params.add(Integer.valueOf(start));
params.add(Integer.valueOf(page.getPageSize()));
List<Project> list = getJdbcTemplate().queryForList(sql, params.toArray(), Project.class);
List<Project> rs = null;
if ((list == null) || (list.size() <= 0)) {
return rs;
}
rs = new ArrayList();
for (int k = 0; k < list.size(); ++k)
{
Map map = (Map)list.get(k);
((List)rs).add(map2Bean(map));
}
PageUtil.constructPage(page, totalCount);
return ((List<Project>)rs);
}
private int getCountByStates(String[] states, ProjectQueryBean queryBean)
{
String sql = "SELECT COUNT(*) FROM T_PROJECT T WHERE T.F_STATE IN ('-1'";
for (int i = 0; i < states.length; ++i)
{
sql = sql + ",'" + states[i] + "'";
}
sql = sql + ")";
List params = new ArrayList();
if (queryBean != null)
{
sql = constructConditionSql(queryBean, sql, params);
}
return getJdbcTemplate().queryForObject(sql, params.toArray(), Integer.class);
}
public Project getLastVersion(int uid, String projectName)
{
String sql = "select t1.* from T_PROJECT t1 where t1.f_version = (SELECT max(t.f_version) FROM T_PROJECT T WHERE T.F_SUBMIT_USER = ? AND T.F_PROJECT_NAME = ?) and T1.F_SUBMIT_USER = ? AND T1.F_PROJECT_NAME = ?";
List list = getJdbcTemplate().queryForList(sql, new Object[] { Integer.valueOf(uid), projectName, Integer.valueOf(uid), projectName });
if ((list != null) && (!(list.isEmpty())))
{
return map2Bean((Map)list.get(0));
}
return null;
}
private Project map2Bean(Map map)
{
Project project = new Project();
project.setId(Integer.parseInt(map.get("F_ID").toString()));
project.setProjectName((map.get("F_PROJECT_NAME") == null) ? "" : map.get("F_PROJECT_NAME").toString());
project.setVersion((map.get("F_VERSION") == null) ? 0 : Integer.parseInt(map.get("F_VERSION").toString()));
project.setPcbFile((map.get("F_PCB_FILE") == null) ? 0 : Integer.parseInt(map.get("F_PCB_FILE").toString()));
project.setBomFile((map.get("F_BOM_FILE") == null) ? 0 : Integer.parseInt(map.get("F_BOM_FILE").toString()));
project.setCheckType((map.get("F_CHECK_TYPE") == null) ? 0 : Integer.parseInt(map.get("F_CHECK_TYPE").toString()));
project.setDfmCheck((map.get("F_DFM_CHECK") == null) ? "" : map.get("F_DFM_CHECK").toString());
project.setPcbType((map.get("F_PCB_TYPE") == null) ? 0 : Integer.parseInt(map.get("F_PCB_TYPE").toString()));
project.setHdiModel((map.get("F_HDI_Model") == null) ? 0 : Integer.parseInt(map.get("F_HDI_Model").toString()));
project.setBoardThickness((map.get("F_Board_Thickness") == null) ? 0.0F : Float.parseFloat(map.get("F_Board_Thickness").toString()));
project.setPanelModel((map.get("F_Panel_Model") == null) ? 0 : Integer.parseInt(map.get("F_Panel_Model").toString()));
project.setMaxHeightTop((map.get("F_Max_Heigh_Top") == null) ? 0.0F : Float.parseFloat(map.get("F_Max_Heigh_Top").toString()));
project.setSubPcbNum((map.get("F_SubPCB_Num") == null) ? 0 : Integer.parseInt(map.get("F_SubPCB_Num").toString()));
project.setMaxHeightBot((map.get("F_Max_Heigh_Bot") == null) ? 0.0F : Float.parseFloat(map.get("F_Max_Heigh_Bot").toString()));
project.setRailwayPosition((map.get("F_Railway_Position") == null) ? 0 : Integer.parseInt(map.get("F_Railway_Position").toString()));
project.setViacapLayer((map.get("F_Viacap_layer") == null) ? 0 : Integer.parseInt(map.get("F_Viacap_layer").toString()));
project.setAssemblyProcessTop((map.get("F_Assembly_Process_Top") == null) ? 0 : Integer.parseInt(map.get("F_Assembly_Process_Top").toString()));
project.setHavePb((map.get("F_Have_Pb") == null) ? -1 : Integer.parseInt(map.get("F_Have_Pb").toString()));
project.setAssemblyProcessBot((map.get("F_Assembly_Process_Bot") == null) ? 0 : Integer.parseInt(map.get("F_Assembly_Process_Bot").toString()));
project.setSurfaceProcess((map.get("F_Surface_Process") == null) ? 0 : Integer.parseInt(map.get("F_Surface_Process").toString()));
project.setDirectionTop((map.get("F_Direction_Top") == null) ? 0 : Integer.parseInt(map.get("F_Direction_Top").toString()));
project.setPrimarySide((map.get("F_Primary_Side") == null) ? 0 : Integer.parseInt(map.get("F_Primary_Side").toString()));
project.setDirectionBot((map.get("F_Direction_Bot") == null) ? 0 : Integer.parseInt(map.get("F_Direction_Bot").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.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());
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.setTaskNum((map.get("T_TASK_NUM") == null) ? 0 : Integer.parseInt(map.get("T_TASK_NUM").toString()));
project.setPri((map.get("F_PRI") == null) ? 0 : Integer.parseInt(map.get("F_PRI").toString()));
project.setResultFile((map.get("F_FILE_RESULT") == null) ? "" : map.get("F_FILE_RESULT").toString());
project.setServer((map.get("F_SERVER") == null) ? "" : map.get("F_SERVER").toString());
project.setServerState((map.get("F_SERVER_STATE") == null) ? "" : map.get("F_SERVER_STATE").toString());
project.setPcbFileName((map.get("F_PCB_FILE_NAME") == null) ? "" : map.get("F_PCB_FILE_NAME").toString());
project.setBomFileName((map.get("F_BOM_FILE_NAME") == null) ? "" : map.get("F_BOM_FILE_NAME").toString());
project.setSubmitUserName((map.get("F_SUBMIT_USERNAME") == null) ? "" : map.get("F_SUBMIT_USERNAME").toString());
project.setRunTime((String)map.get("F_RUN_TIME"));
project.setPreDFMFileId((map.get("F_PRE_DFM_FILE_ID") == null) ? 0 : Integer.parseInt(map.get("F_PRE_DFM_FILE_ID").toString()));
project.setPostDFMFileId((map.get("F_POST_DFM_FILE_ID") == null) ? 0 : Integer.parseInt(map.get("F_POST_DFM_FILE_ID").toString()));
project.setPreDFMFileName((map.get("F_PRE_DFM_FILE_NAME") == null) ? "" : map.get("F_PRE_DFM_FILE_NAME").toString());
project.setPostDFMFileName((map.get("F_POST_DFM_FILE_NAME") == null) ? "" : map.get("F_POST_DFM_FILE_NAME").toString());
project.setReportLanguage((map.get("F_REPORT_LANGUAGE") == null) ? "" : map.get("F_REPORT_LANGUAGE").toString());
//project.setRealOrder((map.get("F_REAL_ORDER") == null) ? 99999 : Float.valueOf(map.get("F_REAL_ORDER").toString()).intValue());
project.setRemark((map.get("F_REMARK") == null) ? "" : map.get("F_REMARK").toString());
return project;
}
public List<Map<String, Object>> getAttrValue(String attrName)
{
String sql = "select t2.F_ID , t2.F_ATTR_VALUE ,t2.F_IS_DEFAULT from t_project_attr t1 , t_project_attr_value t2 where t1.F_ATTR_EN_NAME=? and t1.F_ID = t2.F_ATTR_NAME";
return getJdbcTemplate().queryForList(sql, new Object[] { attrName });
}
public void delete(String pid) {
String sql = "DELETE T.* FROM T_PROJECT T WHERE T.F_ID = " + pid;
getJdbcTemplate().update(sql);
}
/**
* 结果文件下载查询
* @param states
* @param uid
* @param page
* @param queryBean
* @return
*/
public List<Project> getByStates(String[] states, int[] uid, Page page, ProjectQueryBean queryBean)
{
int totalCount = getCountByStates(states, uid, queryBean);
int start = (page.getCurrentPage() - 1) * page.getPageSize();
String sql = "SELECT * FROM T_PROJECT T WHERE T.F_STATE IN ('-1'";
for (int i = 0; i < states.length; ++i)
{
sql = sql + ",'" + states[i] + "'";
}
sql = sql + ") ";
List params = new ArrayList();
if (queryBean != null)
{
sql = constructConditionSql(queryBean, sql, params);
}
sql = sql + " AND T.F_SUBMIT_USER IN (-1";
for (int i = 0; i < uid.length; ++i)
{
sql = sql + "," + uid[i];
}
sql = sql + ") ";
//表示结果下载的场景
if (StringUtils.isNotEmpty(page.getOrderCase()))
{
sql = sql + page.getOrderCase() + " limit ?,?";
} else {
sql = sql + "ORDER BY T.F_PRI ASC limit ?,?";
}
//params.add(Integer.valueOf(uid));
params.add(Integer.valueOf(start));
params.add(Integer.valueOf(page.getPageSize()));
logger.info("getProjectsSQL====" + sql);
List list = getJdbcTemplate().queryForList(sql, params.toArray());
List rs = null;
if ((list == null) || (list.size() <= 0)) {
return rs;
}
rs = new ArrayList();
for (int i = 0; i < list.size(); ++i)
{
Map map = (Map)list.get(i);
rs.add(map2Bean(map));
}
PageUtil.constructPage(page, totalCount);
return rs;
}
public List<Project> getByStatesOrderUser(String[] states, int uid, Page page, ProjectQueryBean queryBean)
{
int totalCount = getCountByStates(states, queryBean);
int start = (page.getCurrentPage() - 1) * page.getPageSize();
String subTabSql =
" ( \tSELECT 1 f_order,t1.* FROM t_project t1 WHERE t1.F_SUBMIT_USER = ? \tunion \tSELECT 2 f_order,t2.* FROM t_project t2 WHERE t2.F_SUBMIT_USER <> ? ) ";
String sql = "SELECT * FROM " + subTabSql + " T WHERE T.F_STATE IN ('-1'";
for (int i = 0; i < states.length; ++i)
{
sql = sql + ",'" + states[i] + "'";
}
sql = sql + ") ";
List params = new ArrayList();
if (queryBean != null)
{
sql = constructConditionSql(queryBean, sql, params);
}
sql = sql + " ORDER BY T.f_order,T.F_PRI ASC limit ?,?";
params.add(Integer.valueOf(uid));
params.add(Integer.valueOf(uid));
params.add(Integer.valueOf(start));
params.add(Integer.valueOf(page.getPageSize()));
logger.info("getProjectsSQL====" + sql);
List list = getJdbcTemplate().queryForList(sql, params.toArray());
List rs = null;
if ((list == null) || (list.size() <= 0)) {
return rs;
}
rs = new ArrayList();
for (int i = 0; i < list.size(); ++i)
{
Map map = (Map)list.get(i);
rs.add(map2Bean(map));
}
PageUtil.constructPage(page, totalCount);
return rs;
}
private int getCountByStates(String[] states, int[] uid, ProjectQueryBean queryBean)
{
String sql = "SELECT COUNT(*) FROM T_PROJECT T WHERE T.F_STATE IN ('-1'";
for (int i = 0; i < states.length; ++i)
{
sql = sql + ",'" + states[i] + "'";
}
sql = sql + ") AND T.F_SUBMIT_USER IN (-1";
for (int i = 0; i < uid.length; ++i)
{
sql = sql + "," + uid[i];
}
sql = sql + ") ";
List params = new ArrayList();
//params.add(Integer.valueOf(uid));
if (queryBean != null)
{
sql = constructConditionSql(queryBean, sql, params);
}
log.info("getCountByStates.sql=" + sql);
return getJdbcTemplate().queryForObject(sql, params.toArray(), Integer.class);
}
private String constructConditionSql(ProjectQueryBean queryBean, String sql, List<Object> params)
{
if ((queryBean.getUsername() != null) && (!("".equals(queryBean.getUsername().trim()))))
{
sql = sql + " AND T.F_SUBMIT_USERNAME = ? ";
params.add(queryBean.getUsername().trim());
}
if ((queryBean.getState() != null) && (!("".equals(queryBean.getState().trim()))))
{
sql = sql + " AND T.F_STATE=?";
params.add(queryBean.getState());
}
String time;
if ((queryBean.getStartSubmitTime() != null) && (!("".equals(queryBean.getStartSubmitTime().trim()))))
{
sql = sql + " AND T.F_SUBMIT_TIME >= ?";
time = TimeUtil.getDateStrByFormat(queryBean.getStartSubmitTime(), "yyyy-MM-dd", "yyyyMMddHHMMSS");
time = time.substring(0, 8) + "000000";
params.add(time);
}
if ((queryBean.getEndSubmitTime() != null) && (!("".equals(queryBean.getEndSubmitTime().trim()))))
{
sql = sql + " AND T.F_SUBMIT_TIME <= ?";
time = TimeUtil.getDateStrByFormat(queryBean.getEndSubmitTime(), "yyyy-MM-dd", "yyyyMMddHHMMSS");
time = time.substring(0, 8) + "245999";
params.add(time);
}
if ((queryBean.getProjectName() != null) && (!("".equals(queryBean.getProjectName().trim()))))
{
sql = sql + " AND T.F_PROJECT_NAME like '%" + queryBean.getProjectName() + "%'";
}
return sql;
}
public void changePri(String pid, int pri, String state)
{
String sql = "UPDATE T_PROJECT T SET T.F_PRI = ? , T.F_STATE = ? WHERE T.F_ID = " + pid;
getJdbcTemplate().update(sql, new Object[] { Integer.valueOf(pri), state });
}
public void changePri(int pid, int pri)
{
String sql = "UPDATE T_PROJECT T SET T.F_PRI = ? WHERE T.F_ID = " + pid;
getJdbcTemplate().update(sql, new Object[] { Integer.valueOf(pri) });
}
public int getMaxPri()
{
String sql = "SELECT max(t.F_PRI) FROM T_PROJECT T WHERE T.F_STATE = ?";
return getJdbcTemplate().queryForObject(sql, new Object[] { "待查" }, Integer.class);
}
public List<Map<String, Object>> getAttrValueByIds(int[] ids)
{
String sql = "SELECT T.F_ID, T.F_ATTR_VALUE FROM t_project_attr_value T WHERE T.F_ID IN ( -1";
for (int i = 0; i < ids.length; ++i)
{
sql = sql + "," + ids[i];
}
sql = sql + ")";
return getJdbcTemplate().queryForList(sql);
}
public Project getByPriState(int pid, int[] uids, String change, String state) {
List list = null;
String sql;
if (null == uids)
{
sql = "";
if ("up".equals(change))
{
sql = "select * from t_project where f_pri = ( select max(t1.f_pri) from t_project t1 where t1.f_pri <(select t.f_pri from t_project t where t.f_id = ?) and t1.f_state = ?)";
}
else if ("down".equals(change))
{
sql = "select * from t_project where f_pri = ( select min(t1.f_pri) from t_project t1 where t1.f_pri >(select t.f_pri from t_project t where t.f_id = ?) and t1.f_state = ?)";
}
list = getJdbcTemplate().queryForList(sql, new Object[] { Integer.valueOf(pid), state });
}
else
{
sql = "";
String uidsStr = "(-1";
for (int i = 0; i < uids.length; ++i)
{
uidsStr += "," + uids[i];
}
uidsStr += ") ";
if ("up".equals(change))
{
sql = "select * from t_project where f_pri = ( select max(t1.f_pri) from t_project t1 where t1.f_pri <(select t.f_pri from t_project t where t.f_id = ? ) and t1.f_state = ? and t1.f_submit_user in " + uidsStr+ " ) and f_submit_user in " + uidsStr;
}
else if ("down".equals(change))
{
sql = "select * from t_project where f_pri = ( select min(t1.f_pri) from t_project t1 where t1.f_pri >(select t.f_pri from t_project t where t.f_id = ?) and t1.f_state = ? and t1.f_submit_user in " + uidsStr+ " ) and f_submit_user in " + uidsStr;
}
list = getJdbcTemplate().queryForList(sql, new Object[] { Integer.valueOf(pid), state });
}
Project rs = null;
if ((list == null) || (list.size() <= 0))
{
return null;
}
Map map = (Map)list.get(0);
rs = map2Bean(map);
return rs;
}
public void reOrderPriByState(String state, int pri)
{
int i;
if (pri <= 1000)
{
String selectSql = "select t.* from t_project t where t.f_state = ? and t.f_pri <= 1000 order by t.f_pri asc";
List list = getJdbcTemplate().queryForList(selectSql, new Object[] { state });
String updateSql = "update t_project t set t.f_pri = ? where t.f_id = ? and t.f_pri <= 1000";
for (i = 0; i < list.size(); ++i)
{
getJdbcTemplate().update(updateSql, new Object[] { Integer.valueOf(i + 1), ((Map)list.get(i)).get("f_id") });
}
}
else
{
String selectSql1 = "select t.* from t_project t where t.f_state = ? and t.f_pri > 1000 order by t.f_pri asc";
List list1 = getJdbcTemplate().queryForList(selectSql1, new Object[] { state });
String updateSql1 = "update t_project t set t.f_pri = ? where t.f_id = ? and t.f_pri > 1000";
for (i = 0; i < list1.size(); ++i)
{
getJdbcTemplate().update(updateSql1, new Object[] { Integer.valueOf(i + 1001), ((Map)list1.get(i)).get("f_id") });
}
}
}
public List<Project> getByUser(int uid)
{
String sql = "SELECT * FROM T_PROJECT T WHERE T.F_SUBMIT_USER = ?";
List list = getJdbcTemplate().queryForList(sql, new Object[] { Integer.valueOf(uid) });
List rs = null;
if ((list == null) || (list.size() <= 0)) {
return rs;
}
rs = new ArrayList();
for (int i = 0; i < list.size(); ++i)
{
Map map = (Map)list.get(i);
rs.add(map2Bean(map));
}
return rs;
}
public void deleteStageByProject(int pid)
{
String sql = "DELETE T.* FROM T_PROJECT_STAGE T WHERE T.F_PROJECT_ID = ?";
getJdbcTemplate().update(sql, new Object[] { Integer.valueOf(pid) });
}
public void recheck(int pid, String submitTime, String state)
{
int pri = getMaxPri() + 1;
String sql = "update t_project set F_SUBMIT_TIME = ?,F_STATE=?,f_pri = ? where f_id = ?";
getJdbcTemplate().update(sql, new Object[] { submitTime, state, Integer.valueOf(pri), Integer.valueOf(pid) });
}
public List<String> getAllServers() {
String sql = "SELECT t.f_server FROM T_PROJECT T where t.F_SERVER is not null and t.F_SERVER != '' group by t.f_server ";
List list = getJdbcTemplate().queryForList(sql);
List rs = null;
if ((list == null) || (list.size() <= 0)) {
return rs;
}
rs = new ArrayList();
for (int i = 0; i < list.size(); ++i)
{
Map map = (Map)list.get(i);
if (map.get("F_SERVER") == null)
continue;
rs.add(map.get("F_SERVER").toString());
}
return rs;
}
public Project getByServerState(String server, String state) {
String sql = "SELECT T.* , T1.F_ATTR_VALUE FROM T_PROJECT T , T_PROJECT_ATTR_VALUE T1 WHERE T.F_SERVER = ? AND T.F_STATE = ? AND T.F_CHECK_TYPE = T1.F_ID";
List list = getJdbcTemplate().queryForList(sql, new Object[] { server, state });
Project rs = null;
if ((list == null) || (list.size() <= 0))
{
return null;
}
Map map = (Map)list.get(0);
rs = map2Bean(map);
rs.setCheckTypeStr((map.get("F_ATTR_VALUE") == null) ? "" : map.get("F_ATTR_VALUE").toString());
return rs;
}
public List<ProjectStage> getStagesByProject(int pid) {
String sql = "SELECT T.* FROM T_PROJECT_STAGE T WHERE T.F_PROJECT_ID = ? ORDER BY T.F_STAGE_ORDER ASC";
List list = getJdbcTemplate().queryForList(sql, new Object[] { Integer.valueOf(pid) });
List rs = null;
if ((list == null) || (list.size() <= 0)) {
return rs;
}
rs = new ArrayList();
for (int i = 0; i < list.size(); ++i)
{
Map map = (Map)list.get(i);
ProjectStage stage = new ProjectStage();
stage.setStageName((map.get("F_STAGE_NAME") == null) ? "" : map.get("F_STAGE_NAME").toString());
stage.setId((map.get("F_ID") == null) ? 0 : Integer.parseInt(map.get("F_ID").toString()));
stage.setEndTime((map.get("F_END_TIME") == null) ? "" : map.get("F_END_TIME").toString());
stage.setId((map.get("F_PROJECT_ID") == null) ? 0 : Integer.parseInt(map.get("F_PROJECT_ID").toString()));
stage.setStatrTime((map.get("F_START_TIME") == null) ? "" : map.get("F_START_TIME").toString());
stage.setStageOrder((map.get("F_STAGE_ORDER") == null) ? 0 : Integer.parseInt(map.get("F_STAGE_ORDER").toString()));
rs.add(stage);
}
return rs;
}
public void stop(String pid) {
String sql = "update t_project set F_CANCEL= 1 where f_id = " +
pid;
getJdbcTemplate().update(sql);
}
/**
* 修改项目PreDFMFile字段
* @param pid
*/
public void updateProjectPreDFMFile(Integer pid, Integer preDFMFileId, String preDFMFileName) {
String sql = "update t_project set F_PRE_DFM_FILE_ID = ?, F_PRE_DFM_FILE_NAME = ? where f_id = ?";
getJdbcTemplate().update(sql,new Object[] {
preDFMFileId,
preDFMFileName,
pid
});
}
/**
* 修改项目PostDFMFile字段
* @param pid
*/
public void updateProjectPostDFMFile(Integer pid, Integer postDFMFileId, String postDFMFileName) {
String sql = "update t_project set F_POST_DFM_FILE_ID = ?, F_POST_DFM_FILE_NAME = ? where f_id = ?";
getJdbcTemplate().update(sql,new Object[] {
postDFMFileId,
postDFMFileName,
pid
});
}
}

View File

@ -0,0 +1,114 @@
package com.ruoyi.dfm.dao;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 统计功能DAO
*/
@Component
public class StatisticsDAO extends JdbcBaseDao {
private final static int groupByYear = 4;
/**
* 获取总利用率
* 过滤大于20小时的不合法运行时间
* 总时间f_total_time
* 总运行时间f_total_run_time
* @return
*/
public Map<String, Object> usage(){
String sql = "SELECT " +
"TIMESTAMPDIFF(MINUTE, min(str_to_date(F_SUBMIT_TIME, '%Y%m%d%H%i%s')), max(str_to_date(f_end_time, '%Y%m%d%H%i%s'))) as f_total_time, " +
"sum(F_RUN_TIME) as f_total_run_time " +
"FROM t_project " +
"where F_STATE in ('完成') and f_run_time < 1200;";
log.info("获取利用率sql=" + sql);
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql);
return list.get(0);
}
/**
* 获取根据部门分组的时间利用率
* 过滤大于20小时的不合法运行时间
* 部门F_DEPARTMENT
* 总时间f_total_time
* 总运行时间f_total_run_time
* @return
*/
public List<Map<String, Object>> usageGroupByDepartment(){
String sql = "SELECT u.F_DEPARTMENT, " +
//"TIMESTAMPDIFF (MINUTE, min(str_to_date(p.F_SUBMIT_TIME, '%Y%m%d%H%i%s')), max(str_to_date(p.f_end_time, '%Y%m%d%H%i%s'))) as f_total_time, " +
"sum(p.F_RUN_TIME) as f_total_run_time " +
"FROM t_project p " +
"LEFT JOIN t_user u on p.F_SUBMIT_USER = u.F_ID " +
"WHERE p.F_STATE in ('完成') and p.f_run_time < 1200 " +
"group by (u.F_DEPARTMENT);";
log.info("获取利用率sql=" + sql);
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql);
return list;
}
/**
* 获取根据部门和年份分组的时间利用率
* 过滤大于20小时的不合法运行时间
* 部门F_DEPARTMENT
* 年份F_YEAR
* 总时间f_total_time
* 总运行时间f_total_run_time
* @return
*/
public List<Map<String, Object>> usageGroupByDepartmentAndYear(){
String sql = "SELECT u.F_DEPARTMENT, left(p.F_SUBMIT_TIME,"+groupByYear+") as F_YEAR ," +
//"TIMESTAMPDIFF (MINUTE, min(str_to_date(p.F_SUBMIT_TIME, '%Y%m%d%H%i%s')), max(str_to_date(p.f_end_time, '%Y%m%d%H%i%s'))) as f_total_time, " +
"sum(p.F_RUN_TIME) as f_total_run_time " +
"FROM t_project p " +
"LEFT JOIN t_user u on p.F_SUBMIT_USER = u.F_ID " +
"WHERE p.F_STATE in ('完成') and p.f_run_time < 1200 " +
"group by u.F_DEPARTMENT, left(p.F_SUBMIT_TIME,"+groupByYear+") " +
"order by left(p.F_SUBMIT_TIME,"+groupByYear+") asc";
log.info("根据部门和年份分组的时间利用率sql=" + sql);
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql);
return list;
}
/**
* 统计完成数量
* 过滤大于20小时的不合法运行时间
* 月份f_month
* 完成的项目数量f_count
* @return
*/
public List<Map<String, Object>> countByMonth(String year){
String sql = "SELECT left(p.f_end_time,6) as f_month , count(1) as f_count" +
" FROM t_project p " +
" WHERE p.F_STATE in ('完成') and left(p.f_end_time,4) = ?" +
" group by left(p.f_end_time,6) " +
" order by left(p.f_end_time,6) asc";
log.info("统计完成数量sql=" + sql);
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql, new Object[] {year});
return list;
}
/**
* 获取所有年份
* @return
*/
public List<Map<String, Object>> getAllYear(){
String sql = "select distinct left(p.f_end_time,4) as f_year" +
" FROM t_project p " +
" where p.f_end_time != ''" +
" order by left(p.f_end_time,4) desc";
log.info("获取所有年份sql=" + sql);
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql);
return list;
}
}

View File

@ -0,0 +1,320 @@
package com.ruoyi.dfm.dao;
import com.ruoyi.dfm.pojo.Page;
import com.ruoyi.dfm.pojo.UserInfo;
import com.ruoyi.dfm.pojo.UserQueryBean;
import com.ruoyi.dfm.util.PageUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Component
public class UserDAO extends JdbcBaseDao
{
private static final Logger logger = LoggerFactory.getLogger(UserDAO.class);
public void add(UserInfo user)
{
String sql = "INSERT INTO T_USER (F_NAME ,F_USERNAME, F_PASSWORD,F_DEPARTMENT,F_PROJECT_GROUP,F_EMAIL,F_GROUP_ID,F_COPY_EMAIL)VALUES(?,?,?,?,?,?,?,?)";
Object[] args = new Object[8];
args[0] = user.getName();
args[1] = user.getUsername();
args[2] = user.getPassword();
args[3] = user.getDepartment();
args[4] = user.getProjectGroup();
args[5] = user.getEmail();
args[6] = Integer.valueOf(user.getGroupId());
args[7] = user.getCcEmail();
getJdbcTemplate().update(sql, args);
}
public UserInfo checkUser(String username, String pwd) {
UserInfo user = null;
String sql = "SELECT * FROM T_USER T WHERE T.F_USERNAME = ? AND T.F_PASSWORD = ?";
List list = getJdbcTemplate().queryForList(sql, new Object[] { username, pwd });
if ((list == null) || (list.size() <= 0)) {
return user;
}
Map map = (Map)list.get(0);
user = new UserInfo();
user.setId(Integer.parseInt(map.get("F_ID").toString()));
user.setGroupId(Integer.parseInt(map.get("F_GROUP_ID").toString()));
user.setDepartment((map.get("F_DEPARTMENT") == null) ? "" : map.get("F_DEPARTMENT").toString());
user.setCcEmail((map.get("F_COPY_EMAIL") == null) ? "" : map.get("F_COPY_EMAIL").toString());
user.setEmail((map.get("F_EMAIL") == null) ? "" : map.get("F_EMAIL").toString());
user.setName((map.get("F_NAME") == null) ? "" : map.get("F_NAME").toString());
user.setPassword(map.get("F_PASSWORD").toString());
user.setProjectGroup((map.get("F_PROJECT_GROUP") == null) ? "" : map.get("F_PROJECT_GROUP").toString());
user.setUsername(map.get("F_USERNAME").toString());
user.setStatus(Integer.parseInt(map.get("F_STATUS").toString()));
return user;
}
public List<UserInfo> getAll()
{
String sql = "SELECT * FROM T_USER T ORDER BY T.F_ID ASC";
List list = getJdbcTemplate().queryForList(sql);
List rs = null;
if ((list == null) || (list.size() <= 0)) {
return rs;
}
rs = new ArrayList();
for (int i = 0; i < list.size(); ++i)
{
Map map = (Map)list.get(i);
UserInfo user = new UserInfo();
user.setId(Integer.parseInt(map.get("F_ID").toString()));
user.setGroupId(Integer.parseInt(map.get("F_GROUP_ID").toString()));
user.setDepartment((map.get("F_DEPARTMENT") == null) ? "" : map.get("F_DEPARTMENT").toString());
user.setEmail((map.get("F_EMAIL") == null) ? "" : map.get("F_EMAIL").toString());
user.setCcEmail((map.get("F_COPY_EMAIL") == null) ? "" : map.get("F_COPY_EMAIL").toString());
user.setName((map.get("F_NAME") == null) ? "" : map.get("F_NAME").toString());
user.setPassword((String)map.get("F_PASSWORD"));
user.setProjectGroup((map.get("F_PROJECT_GROUP") == null) ? "" : map.get("F_PROJECT_GROUP").toString());
user.setUsername(map.get("F_USERNAME").toString());
user.setStatus(Integer.parseInt(map.get("F_STATUS").toString()));
rs.add(user);
}
return rs;
}
public List<UserInfo> getAll(Page page)
{
int totalCount = getAllCount();
int start = (page.getCurrentPage() - 1) * page.getPageSize();
String sql = "SELECT * FROM T_USER T ORDER BY T.F_ID ASC limit ?,?";
List list = getJdbcTemplate().queryForList(sql, new Object[] { Integer.valueOf(start), Integer.valueOf(page.getPageSize()) });
List rs = null;
if ((list == null) || (list.size() <= 0)) {
return rs;
}
rs = new ArrayList();
for (int i = 0; i < list.size(); ++i)
{
Map map = (Map)list.get(i);
UserInfo user = new UserInfo();
user.setId(Integer.parseInt(map.get("F_ID").toString()));
user.setGroupId(Integer.parseInt(map.get("F_GROUP_ID").toString()));
user.setDepartment((map.get("F_DEPARTMENT") == null) ? "" : map.get("F_DEPARTMENT").toString());
user.setEmail((map.get("F_EMAIL") == null) ? "" : map.get("F_EMAIL").toString());
user.setCcEmail((map.get("F_COPY_EMAIL") == null) ? "" : map.get("F_COPY_EMAIL").toString());
user.setName((map.get("F_NAME") == null) ? "" : map.get("F_NAME").toString());
user.setPassword(map.get("F_PASSWORD").toString());
user.setProjectGroup((map.get("F_PROJECT_GROUP") == null) ? "" : map.get("F_PROJECT_GROUP").toString());
user.setUsername(map.get("F_USERNAME").toString());
user.setStatus(Integer.parseInt(map.get("F_STATUS").toString()));
rs.add(user);
}
PageUtil.constructPage(page, totalCount);
return rs;
}
private int getAllCount()
{
String sql = "SELECT COUNT(*) FROM T_USER T ";
return getJdbcTemplate().queryForObject(sql, Integer.class);
}
public void delete(int uid) {
String sql = "DELETE FROM T_USER WHERE F_ID = ?";
getJdbcTemplate().update(sql, new Object[] { Integer.valueOf(uid) });
}
public UserInfo getById(int uid)
{
UserInfo user = null;
String sql = "SELECT * FROM T_USER T WHERE T.F_ID = ?";
List list = getJdbcTemplate().queryForList(sql, new Object[] { Integer.valueOf(uid) });
if ((list == null) || (list.size() <= 0)) {
return user;
}
Map map = (Map)list.get(0);
user = new UserInfo();
user.setId(Integer.parseInt(map.get("F_ID").toString()));
user.setGroupId(Integer.parseInt(map.get("F_GROUP_ID").toString()));
user.setDepartment((map.get("F_DEPARTMENT") == null) ? "" : map.get("F_DEPARTMENT").toString());
user.setEmail((map.get("F_EMAIL") == null) ? "" : map.get("F_EMAIL").toString());
user.setCcEmail((map.get("F_COPY_EMAIL") == null) ? "" : map.get("F_COPY_EMAIL").toString());
user.setName((map.get("F_NAME") == null) ? "" : map.get("F_NAME").toString());
user.setPassword(map.get("F_PASSWORD").toString());
user.setProjectGroup((map.get("F_PROJECT_GROUP") == null) ? "" : map.get("F_PROJECT_GROUP").toString());
user.setUsername(map.get("F_USERNAME").toString());
user.setStatus(Integer.parseInt(map.get("F_STATUS").toString()));
return user;
}
public void update(UserInfo user) {
String sql = "UPDATE T_USER SET F_NAME = ?,F_USERNAME= ?, F_PASSWORD= ?,F_DEPARTMENT= ?,F_PROJECT_GROUP= ?,F_EMAIL= ?,F_GROUP_ID= ?,F_STATUS = ?,F_COPY_EMAIL=? WHERE F_ID = ?";
Object[] args = new Object[10];
args[0] = user.getName();
args[1] = user.getUsername();
args[2] = user.getPassword();
args[3] = user.getDepartment();
args[4] = user.getProjectGroup();
args[5] = user.getEmail();
args[6] = Integer.valueOf(user.getGroupId());
args[7] = Integer.valueOf(user.getStatus());
args[8] = user.getCcEmail();
args[9] = Integer.valueOf(user.getId());
getJdbcTemplate().update(sql, args);
}
public List<UserInfo> getByQueryBean(UserQueryBean queryBean, Page page)
{
int totalCount = getCountByQueryBean(queryBean);
int start = (page.getCurrentPage() - 1) * page.getPageSize();
String sql = "SELECT * FROM T_USER T WHERE 1=1 ";
List params = new ArrayList();
if (queryBean != null)
{
sql = constructConditionSql(queryBean, sql, params);
}
sql = sql + " limit ?,?";
params.add(Integer.valueOf(start));
params.add(Integer.valueOf(page.getPageSize()));
PageUtil.constructPage(page, totalCount);
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql, params.toArray());
List rs = new ArrayList();
for (Map map : list)
{
UserInfo user = new UserInfo();
user.setId(Integer.parseInt(map.get("F_ID").toString()));
user.setGroupId(Integer.parseInt(map.get("F_GROUP_ID").toString()));
user.setDepartment((map.get("F_DEPARTMENT") == null) ? "" : map.get("F_DEPARTMENT").toString());
user.setEmail((map.get("F_EMAIL") == null) ? "" : map.get("F_EMAIL").toString());
user.setCcEmail((map.get("F_COPY_EMAIL") == null) ? "" : map.get("F_COPY_EMAIL").toString());
user.setName((map.get("F_NAME") == null) ? "" : map.get("F_NAME").toString());
user.setPassword(map.get("F_PASSWORD").toString());
user.setProjectGroup((map.get("F_PROJECT_GROUP") == null) ? "" : map.get("F_PROJECT_GROUP").toString());
user.setUsername(map.get("F_USERNAME").toString());
user.setStatus(Integer.parseInt(map.get("F_STATUS").toString()));
rs.add(user);
}
return rs;
}
public List<UserInfo> getByQueryBean(UserQueryBean queryBean)
{
String sql = "SELECT * FROM T_USER T WHERE 1=1 ";
List params = new ArrayList();
if (queryBean != null)
{
sql = constructConditionSql(queryBean, sql, params);
}
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql, params.toArray());
List rs = new ArrayList();
for (Map map : list)
{
UserInfo user = new UserInfo();
user.setId(Integer.parseInt(map.get("F_ID").toString()));
user.setGroupId(Integer.parseInt(map.get("F_GROUP_ID").toString()));
user.setDepartment((map.get("F_DEPARTMENT") == null) ? "" : map.get("F_DEPARTMENT").toString());
user.setEmail((map.get("F_EMAIL") == null) ? "" : map.get("F_EMAIL").toString());
user.setCcEmail((map.get("F_COPY_EMAIL") == null) ? "" : map.get("F_COPY_EMAIL").toString());
user.setName((map.get("F_NAME") == null) ? "" : map.get("F_NAME").toString());
user.setPassword(map.get("F_PASSWORD").toString());
user.setProjectGroup((map.get("F_PROJECT_GROUP") == null) ? "" : map.get("F_PROJECT_GROUP").toString());
user.setUsername(map.get("F_USERNAME").toString());
user.setStatus(Integer.parseInt(map.get("F_STATUS").toString()));
rs.add(user);
}
return rs;
}
private int getCountByQueryBean(UserQueryBean queryBean) {
String sql = "SELECT COUNT(*) FROM T_USER T WHERE 1=1 ";
List params = new ArrayList();
if (queryBean != null)
{
sql = constructConditionSql(queryBean, sql, params);
}
return getJdbcTemplate().queryForObject(sql, params.toArray(), Integer.class);
}
private String constructConditionSql(UserQueryBean queryBean, String sql, List<Object> params)
{
if ((queryBean.getUsername() != null) && (!("".equals(queryBean.getUsername().trim()))))
{
sql = sql + " AND T.F_USERNAME like '%" + queryBean.getUsername() + "%'";
}
if ((queryBean.getState() != null) && (!("-1".equals(queryBean.getState().trim()))))
{
sql = sql + " AND T.F_STATUS=?";
params.add(queryBean.getState());
}
if ((queryBean.getName() != null) && (!("".equals(queryBean.getName().trim()))))
{
sql = sql + " AND T.F_NAME like '%" + queryBean.getName() + "%'";
}
if ((queryBean.getProjectGroup() != null) && (!("".equals(queryBean.getProjectGroup().trim()))))
{
sql = sql + " AND T.F_PROJECT_GROUP like '%" + queryBean.getProjectGroup() + "%'";
}
if ((queryBean.getDepartment() != null) && (!("".equals(queryBean.getDepartment().trim()))))
{
sql = sql + " AND T.F_DEPARTMENT like '%" + queryBean.getDepartment() + "%'";
}
return sql;
}
/**
* 根据部门ID获取部门所有员工
* @param department
* @return
*/
public List<UserInfo> getByDepartment(String department)
{
String sql = "SELECT * FROM T_USER T WHERE T.F_DEPARTMENT = ? ";
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql, new Object[]{department});
List rs = new ArrayList();
for (Map map : list)
{
UserInfo user = new UserInfo();
user.setId(Integer.parseInt(map.get("F_ID").toString()));
user.setGroupId(Integer.parseInt(map.get("F_GROUP_ID").toString()));
user.setDepartment((map.get("F_DEPARTMENT") == null) ? "" : map.get("F_DEPARTMENT").toString());
user.setEmail((map.get("F_EMAIL") == null) ? "" : map.get("F_EMAIL").toString());
user.setCcEmail((map.get("F_COPY_EMAIL") == null) ? "" : map.get("F_COPY_EMAIL").toString());
user.setName((map.get("F_NAME") == null) ? "" : map.get("F_NAME").toString());
user.setPassword(map.get("F_PASSWORD").toString());
user.setProjectGroup((map.get("F_PROJECT_GROUP") == null) ? "" : map.get("F_PROJECT_GROUP").toString());
user.setUsername(map.get("F_USERNAME").toString());
user.setStatus(Integer.parseInt(map.get("F_STATUS").toString()));
rs.add(user);
}
return rs;
}
/**
* 检查当前需要分析的projectName是否属于当前登陆用户的可见范围
* @param projectName
* @param submitUsers
*/
public boolean checkProjectAndUsers(String projectName, List<UserInfo> submitUsers) {
String sql = "SELECT count(1) FROM T_PROJECT T WHERE T.F_SUBMIT_USER IN (-1";
for (int i = 0; i < submitUsers.size(); ++i)
{
sql += "," + submitUsers.get(i).getId();
}
sql += ") AND T.F_PROJECT_NAME = ?";
log.info("检查项目和用户关系sql=" + sql);
int result = getJdbcTemplate().queryForObject(sql, new Object[]{ projectName}, Integer.class);
if(result > 0) {
return true;
}
return false;
}
}

View File

@ -0,0 +1,68 @@
package com.ruoyi.dfm.pojo;
public class DataAnalysisBean {
private int dataId;
private int projectId;
private String projectName;
private int version;
private int submitUserId;
private String submitUserName;
private String submitTime;
private String issueDescription;
private int issueQty;
public int getDataId() {
return dataId;
}
public void setDataId(int dataId) {
this.dataId = dataId;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
public int getSubmitUserId() {
return submitUserId;
}
public void setSubmitUserId(int submitUserId) {
this.submitUserId = submitUserId;
}
public String getSubmitUserName() {
return submitUserName;
}
public void setSubmitUserName(String submitUserName) {
this.submitUserName = submitUserName;
}
public String getSubmitTime() {
return submitTime;
}
public void setSubmitTime(String submitTime) {
this.submitTime = submitTime;
}
public String getIssueDescription() {
return issueDescription;
}
public void setIssueDescription(String issueDescription) {
this.issueDescription = issueDescription;
}
public int getIssueQty() {
return issueQty;
}
public void setIssueQty(int issueQty) {
this.issueQty = issueQty;
}
}

View File

@ -0,0 +1,63 @@
package com.ruoyi.dfm.pojo;
public class FileInfo {
private int id;
private String fileName;
private String relaPath;
private String extendName;
private long fileSize;
private int uploadUser;
private String uploadTime;
private String fieldName;
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getRelaPath() {
return relaPath;
}
public void setRelaPath(String relaPath) {
this.relaPath = relaPath;
}
public String getExtendName() {
return extendName;
}
public void setExtendName(String extendName) {
this.extendName = extendName;
}
public long getFileSize() {
return fileSize;
}
public void setFileSize(long fileSize) {
this.fileSize = fileSize;
}
public int getUploadUser() {
return uploadUser;
}
public void setUploadUser(int uploadUser) {
this.uploadUser = uploadUser;
}
public String getUploadTime() {
return uploadTime;
}
public void setUploadTime(String uploadTime) {
this.uploadTime = uploadTime;
}
}

View File

@ -0,0 +1,48 @@
package com.ruoyi.dfm.pojo;
/**
* 菜单类
* @author Kfighter
*
*/
public class MenuInfo {
private int id;
private String url;
private String menuName;
private int menuLevel;
private int parentId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getMenuName() {
return menuName;
}
public void setMenuName(String menuName) {
this.menuName = menuName;
}
public int getMenuLevel() {
return menuLevel;
}
public void setMenuLevel(int menuLevel) {
this.menuLevel = menuLevel;
}
public int getParentId() {
return parentId;
}
public void setParentId(int parentId) {
this.parentId = parentId;
}
}

View File

@ -0,0 +1,55 @@
package com.ruoyi.dfm.pojo;
import com.ruoyi.dfm.util.PropertiesUtils;
public class Page {
private int currentPage;
private int pageSize;
private int totalCount;
private int totalPage;
private String orderCase;
private static int PAGE_SIZE;
// 获取系统文件根路径
static {
PAGE_SIZE = Integer.parseInt(PropertiesUtils.getProperties().getProperty("PAGE_SIZE"));
}
public Page() {
this.currentPage = 1;
this.pageSize = PAGE_SIZE;
this.totalCount = 0;
this.totalPage = 1;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public String getOrderCase() {
return orderCase;
}
public void setOrderCase(String orderCase) {
this.orderCase = orderCase;
}
}

View File

@ -0,0 +1,450 @@
package com.ruoyi.dfm.pojo;
public class Project {
private int id;
private String projectName;
private int version = 1;
private int pcbFile;
private int bomFile;
private String pcbFileName;
private String bomFileName;
private int checkType;
private String checkTypeStr;
private String dfmCheck;
private int pcbType;
private int hdiModel;
private float boardThickness;
private int panelModel;
private float maxHeightTop;
private int subPcbNum;
private float maxHeightBot;
private int railwayPosition;
private int viacapLayer;
private int assemblyProcessTop;
private int havePb;
private int assemblyProcessBot;
private int surfaceProcess;
private int directionTop;
private int primarySide;
private int directionBot;
private int directionBotFs;
private String density;
private int submitUser;
private String submitUserName;
private String submitTime;
private String endTime;
private String state = "待查";
private int taskNum = 0;
private int pri = 1;
private String resultFile = "";
private String server = "";
private String serverState = "";
private String runTime = "-";
private Integer preDFMFileId;
private Integer postDFMFileId;
private String preDFMFileName;
private String postDFMFileName;
private String lastVersion;
private String CCtoOther;
private String reportLanguage;
private Integer realOrder;
//等待时间分钟
private Integer waitTime;
//备注
private String remark;
public String getRunTime() {
return this.runTime;
}
public void setRunTime(String runTime) {
this.runTime = runTime;
}
public String getProjectName() {
return this.projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public int getVersion() {
return this.version;
}
public void setVersion(int version) {
this.version = version;
}
public int getPcbFile() {
return this.pcbFile;
}
public void setPcbFile(int pcbFile) {
this.pcbFile = pcbFile;
}
public int getBomFile() {
return this.bomFile;
}
public void setBomFile(int bomFile) {
this.bomFile = bomFile;
}
public int getCheckType() {
return this.checkType;
}
public void setCheckType(int checkType) {
this.checkType = checkType;
}
public String getDfmCheck() {
return this.dfmCheck;
}
public void setDfmCheck(String dfmCheck) {
this.dfmCheck = dfmCheck;
}
public int getPcbType() {
return this.pcbType;
}
public void setPcbType(int pcbType) {
this.pcbType = pcbType;
}
public int getHdiModel() {
return this.hdiModel;
}
public void setHdiModel(int hdiModel) {
this.hdiModel = hdiModel;
}
public float getBoardThickness() {
return this.boardThickness;
}
public void setBoardThickness(float boardThickness) {
this.boardThickness = boardThickness;
}
public int getPanelModel() {
return this.panelModel;
}
public void setPanelModel(int panelModel) {
this.panelModel = panelModel;
}
public float getMaxHeightTop() {
return this.maxHeightTop;
}
public void setMaxHeightTop(float maxHeightTop) {
this.maxHeightTop = maxHeightTop;
}
public int getSubPcbNum() {
return this.subPcbNum;
}
public void setSubPcbNum(int subPcbNum) {
this.subPcbNum = subPcbNum;
}
public float getMaxHeightBot() {
return this.maxHeightBot;
}
public void setMaxHeightBot(float maxHeightBot) {
this.maxHeightBot = maxHeightBot;
}
public int getRailwayPosition() {
return this.railwayPosition;
}
public void setRailwayPosition(int railwayPosition) {
this.railwayPosition = railwayPosition;
}
public int getViacapLayer() {
return this.viacapLayer;
}
public void setViacapLayer(int viacapLayer) {
this.viacapLayer = viacapLayer;
}
public int getAssemblyProcessTop() {
return this.assemblyProcessTop;
}
public void setAssemblyProcessTop(int assemblyProcessTop) {
this.assemblyProcessTop = assemblyProcessTop;
}
public int getHavePb() {
return this.havePb;
}
public void setHavePb(int havePb) {
this.havePb = havePb;
}
public int getAssemblyProcessBot() {
return this.assemblyProcessBot;
}
public void setAssemblyProcessBot(int assemblyProcessBot) {
this.assemblyProcessBot = assemblyProcessBot;
}
public int getSurfaceProcess() {
return this.surfaceProcess;
}
public void setSurfaceProcess(int surfaceProcess) {
this.surfaceProcess = surfaceProcess;
}
public int getDirectionTop() {
return this.directionTop;
}
public void setDirectionTop(int directionTop) {
this.directionTop = directionTop;
}
public int getPrimarySide() {
return this.primarySide;
}
public void setPrimarySide(int primarySide) {
this.primarySide = primarySide;
}
public int getDirectionBot() {
return this.directionBot;
}
public void setDirectionBot(int directionBot) {
this.directionBot = directionBot;
}
public int getSubmitUser() {
return this.submitUser;
}
public void setSubmitUser(int submitUser) {
this.submitUser = submitUser;
}
public String getSubmitTime() {
return this.submitTime;
}
public void setSubmitTime(String submitTime) {
this.submitTime = submitTime;
}
public String getState() {
return this.state;
}
public void setState(String state) {
this.state = state;
}
public int getTaskNum() {
return this.taskNum;
}
public void setTaskNum(int taskNum) {
this.taskNum = taskNum;
}
public int getPri() {
return this.pri;
}
public void setPri(int pri) {
this.pri = pri;
}
public String getResultFile() {
return this.resultFile;
}
public void setResultFile(String resultFile) {
this.resultFile = resultFile;
}
public String getServer() {
return this.server;
}
public void setServer(String server) {
this.server = server;
}
public String getServerState() {
return this.serverState;
}
public void setServerState(String serverState) {
this.serverState = serverState;
}
public String getPcbFileName() {
return this.pcbFileName;
}
public void setPcbFileName(String pcbFileName) {
this.pcbFileName = pcbFileName;
}
public String getBomFileName() {
return this.bomFileName;
}
public void setBomFileName(String bomFileName) {
this.bomFileName = bomFileName;
}
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
public String getSubmitUserName() {
return this.submitUserName;
}
public void setSubmitUserName(String submitUserName) {
this.submitUserName = submitUserName;
}
public String getEndTime() {
return this.endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getCheckTypeStr() {
return this.checkTypeStr;
}
public void setCheckTypeStr(String checkTypeStr) {
this.checkTypeStr = checkTypeStr;
}
public int getDirectionBotFs() {
return this.directionBotFs;
}
public void setDirectionBotFs(int directionBotFs) {
this.directionBotFs = directionBotFs;
}
public String getDensity() {
return this.density;
}
public void setDensity(String density) {
this.density = density;
}
public String getPreDFMFileName() {
return preDFMFileName;
}
public void setPreDFMFileName(String preDFMFileName) {
this.preDFMFileName = preDFMFileName;
}
public String getPostDFMFileName() {
return postDFMFileName;
}
public void setPostDFMFileName(String postDFMFileName) {
this.postDFMFileName = postDFMFileName;
}
public Integer getPreDFMFileId() {
return preDFMFileId;
}
public void setPreDFMFileId(Integer preDFMFileId) {
this.preDFMFileId = preDFMFileId;
}
public Integer getPostDFMFileId() {
return postDFMFileId;
}
public void setPostDFMFileId(Integer postDFMFileId) {
this.postDFMFileId = postDFMFileId;
}
public String getLastVersion() {
return lastVersion;
}
public void setLastVersion(String lastVersion) {
this.lastVersion = lastVersion;
}
public String getCCtoOther() {
return CCtoOther;
}
public void setCCtoOther(String cCtoOther) {
CCtoOther = cCtoOther;
}
public String getReportLanguage() {
return reportLanguage;
}
public void setReportLanguage(String reportLanguage) {
this.reportLanguage = reportLanguage;
}
public Integer getRealOrder() {
return realOrder;
}
public void setRealOrder(Integer realOrder) {
this.realOrder = realOrder;
}
public Integer getWaitTime() {
return waitTime;
}
public void setWaitTime(Integer waitTime) {
this.waitTime = waitTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

View File

@ -0,0 +1,40 @@
package com.ruoyi.dfm.pojo;
public class ProjectQueryBean {
private String projectName;
private String username;
private String state;
private String startSubmitTime;
private String endSubmitTime;
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getStartSubmitTime() {
return startSubmitTime;
}
public void setStartSubmitTime(String startSubmitTime) {
this.startSubmitTime = startSubmitTime;
}
public String getEndSubmitTime() {
return endSubmitTime;
}
public void setEndSubmitTime(String endSubmitTime) {
this.endSubmitTime = endSubmitTime;
}
}

View File

@ -0,0 +1,50 @@
package com.ruoyi.dfm.pojo;
public class ProjectStage {
private int id ;
private String stageName;
private int stageOrder;
private String statrTime;
private String endTime;
private int projectId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getStageName() {
return stageName;
}
public void setStageName(String stageName) {
this.stageName = stageName;
}
public int getStageOrder() {
return stageOrder;
}
public void setStageOrder(int stageOrder) {
this.stageOrder = stageOrder;
}
public String getStatrTime() {
return statrTime;
}
public void setStatrTime(String statrTime) {
this.statrTime = statrTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
}

View File

@ -0,0 +1,26 @@
package com.ruoyi.dfm.pojo;
public class Result {
private boolean success;
private String message;
private Object data;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}

View File

@ -0,0 +1,75 @@
package com.ruoyi.dfm.pojo;
public class UserInfo {
private int id;
private String name;
private String username;
private String password;
private String department;
private String projectGroup;
private String email;
private String ccEmail;
private int groupId;
private int status;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getProjectGroup() {
return projectGroup;
}
public void setProjectGroup(String projectGroup) {
this.projectGroup = projectGroup;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getGroupId() {
return groupId;
}
public void setGroupId(int groupId) {
this.groupId = groupId;
}
public String getCcEmail() {
return ccEmail;
}
public void setCcEmail(String ccEmail) {
this.ccEmail = ccEmail;
}
}

View File

@ -0,0 +1,42 @@
package com.ruoyi.dfm.pojo;
public class UserQueryBean {
private String name;
private String username;
private String department;
private String projectGroup;
private String state;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getProjectGroup() {
return projectGroup;
}
public void setProjectGroup(String projectGroup) {
this.projectGroup = projectGroup;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}

View File

@ -0,0 +1,32 @@
package com.ruoyi.dfm.service;
import com.ruoyi.dfm.dao.DataAnalysisDAO;
import com.ruoyi.dfm.pojo.DataAnalysisBean;
import com.ruoyi.dfm.pojo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class DataAnalysisService {
@Autowired
private DataAnalysisDAO dataAnalysisDAO;
public List<DataAnalysisBean> analysisByProject(String projectName, String startSubmitTime, String endSubmitTime) {
return dataAnalysisDAO.analysisByProject(projectName, startSubmitTime, endSubmitTime) ;
}
public List<DataAnalysisBean> analysisByUser(String userName, String startSubmitTime, String endSubmitTime) {
return dataAnalysisDAO.analysisByUser(userName, startSubmitTime, endSubmitTime) ;
}
public List<DataAnalysisBean> analysisByAllUser(String startSubmitTime, String endSubmitTime, List<UserInfo> submitUsers) {
return dataAnalysisDAO.analysisByAllUser(startSubmitTime, endSubmitTime, submitUsers) ;
}
public List<DataAnalysisBean> analysisByAllIssue(String startSubmitTime, String endSubmitTime, List<UserInfo> submitUsers) {
return dataAnalysisDAO.analysisByAllIssue(startSubmitTime, endSubmitTime, submitUsers) ;
}
}

View File

@ -0,0 +1,238 @@
package com.ruoyi.dfm.service;
import com.ruoyi.dfm.dao.FileDAO;
import com.ruoyi.dfm.pojo.FileInfo;
import com.ruoyi.dfm.pojo.UserInfo;
import com.ruoyi.dfm.util.PropertiesUtils;
import com.ruoyi.dfm.util.TimeUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import java.util.List;
@Component
public class FileService {
private static final Logger log = LoggerFactory.getLogger(FileService.class);
@Autowired
private FileDAO fileDAO;
// 默认文件存储路径
public static String rootPath = "";
// 文件上传的最大值100MB
private int maxPostSize = 100 * 1024 * 1024;
// 文件传输编码
private String fileEncoding = "utf-8";
// 获取系统文件根路径
static {
try {
rootPath = PropertiesUtils.getProperties().getProperty(
"FILE_PHYSICAL_ROOT");
File file = new File(rootPath);
if (!file.exists()) {
file.mkdir();
}
file = null;
} catch (Exception e) {
log.error("读取资源文件错误!");
}
}
/**
* 获取系统文件根目录 Kfighter Dec 10, 2010 修改者名字 修改日期 修改内容
*
* @return
* @return String
* @throws
*/
public String getRootPath() {
return rootPath;
}
/**
* @Title: savePhysicFile
* @Description: 存储物理文件
* @param
* @return
* @return boolean
* @throws
*/
public void savePhysicFile(MultipartHttpServletRequest request, List<FileInfo> list , String filePath, boolean isRename, String reNameKey) throws Exception{
try {
String path = rootPath + filePath;
if(!createDir(path))
{
log.error("创建项目文件目录失败");
throw new IOException();
}
/*MultipartRequest multi = new MultipartRequest(request, path,
maxPostSize, fileEncoding);
Enumeration fileNames = multi.getFileNames();
int count = 0;
FileInfo fileInfo;
while (fileNames.hasMoreElements()) {
// 表单file元素name属性值
String name = fileNames.nextElement().toString();
// 原文件名值
String original = multi.getOriginalFileName(name);
File file = multi.getFile(name);
if (null == file) {
continue;
}
fileInfo = new FileInfo();
fileInfo.setFieldName(name);
fileInfo.setFileName(original);
fileInfo.setFileSize(file.length());
fileInfo.setRelaPath(filePath);
fileInfo.setUploadTime(TimeUtil.getNowChar14());
// 设置实际名称
String extendName = file.getName().substring(
file.getName().lastIndexOf(".") + 1);
fileInfo.setExtendName(extendName);
fileDAO.add(fileInfo);
list.add(fileInfo);
count++;
}*/
Iterator<String> it = request.getFileNames();
FileInfo fileInfo;
while (it.hasNext()) {
// 表单file元素name属性值
String name = it.next();
// 原文件名值
MultipartFile multipartFile = request.getFile(name);
String original = multipartFile.getOriginalFilename();
if(null == original || "".equals(original))
{
continue ;
}
InputStream is = multipartFile.getInputStream();
if (null == is) {
continue;
}
String newFileName = original;
//处理DFM文件名称
if(isRename) {
if(!newFileName.startsWith(reNameKey)) {
newFileName = reNameKey + newFileName;
}
}
FileOutputStream fs = new FileOutputStream( path + "/"+ newFileName);
byte[] buffer = new byte[1024*1024];
int bytesum = 0;
int byteread = 0;
while ((byteread=is.read(buffer))!=-1)
{
bytesum += byteread;
fs.write(buffer,0,byteread);
fs.flush();
}
fs.close();
is.close();
fileInfo = new FileInfo();
fileInfo.setFieldName(name);
fileInfo.setFileName(newFileName);
fileInfo.setFileSize(multipartFile.getSize());
fileInfo.setRelaPath(filePath);
fileInfo.setUploadTime(TimeUtil.getNowChar14());
fileInfo.setUploadUser(((UserInfo)request.getSession().getAttribute("user")).getId());
// 设置实际名称
String extendName = original.substring(original.lastIndexOf(".") + 1);
fileInfo.setExtendName(extendName);
//需要返回文件ID
fileDAO.add(fileInfo);
list.add(fileInfo);
}
} catch (IOException e) {
log.error("存储物理文件失败",e);
throw e;
}
}
/**
* 根据文件表获取物理文件 Kfighter Oct 22, 2010 修改者名字 修改日期 修改内容
*
* @param file
* 附件
* @throws
*/
public File getPhysicFile(FileInfo file) {
File pFile = new File(rootPath + "/" +file.getRelaPath() + "/"
+ file.getFileName());
if (!pFile.exists()) {
return null;
} else {
return pFile;
}
}
public boolean createDir(String dir)
{
boolean flag = true;
File file = new File(dir);
if(!file.exists())
{
return file.mkdirs();
}
return flag;
}
public File createFile(String filePath) throws IOException
{
String path = rootPath + filePath;
File file = new File(path);
if(!file.exists())
{
file.createNewFile();
}
return file;
}
public boolean deleteFile(int fid)
{
FileInfo fileInfo = fileDAO.getById(fid);
//File file = new File(rootPath + "/" + fileInfo.getRelaPath()+ "/" + fileInfo.getFileName());
//file.deleteOnExit();
if(fileInfo != null)
{
fileDAO.delete(fid);
String path = rootPath + "/" + fileInfo.getRelaPath()+ "/" + fileInfo.getFileName();
deletePhysicFile(path);
}
return false;
}
public boolean deletePhysicFile(String path)
{
File file = new File(path);
file.delete();
return true;
}
public FileInfo getById(int fid)
{
return fileDAO.getById(fid);
}
}

View File

@ -0,0 +1,27 @@
package com.ruoyi.dfm.service;
import com.ruoyi.dfm.dao.UserDAO;
import com.ruoyi.dfm.pojo.UserInfo;
import com.ruoyi.dfm.util.Md5Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class LoginService {
private static final Logger logger = LoggerFactory.getLogger(LoginService.class);
@Autowired
private UserDAO userDAO;
public void setUserDAO(UserDAO userDAO) {
this.userDAO = userDAO;
}
public UserInfo checkUser(String username, String pwd) {
//加密查询
return userDAO.checkUser(username, Md5Util.md5(pwd));
}
}

View File

@ -0,0 +1,28 @@
package com.ruoyi.dfm.service;
import com.ruoyi.dfm.dao.MenuDAO;
import com.ruoyi.dfm.pojo.MenuInfo;
import com.ruoyi.dfm.pojo.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class MenuService {
private static final Logger logger = LoggerFactory.getLogger(MenuService.class);
@Autowired
private MenuDAO menuDAO;
/**
* 根据用户ID获取该用户拥有的菜单列表
* @return
*/
public List<MenuInfo> getMenuByUser(UserInfo user)
{
return menuDAO.getByGroup(user.getGroupId());
}
}

View File

@ -0,0 +1,433 @@
package com.ruoyi.dfm.service;
import com.ruoyi.dfm.dao.ProjectDAO;
import com.ruoyi.dfm.dao.UserDAO;
import com.ruoyi.dfm.pojo.*;
import com.ruoyi.dfm.util.TimeUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Component
public class ProjectService
{
private static final Logger logger = LoggerFactory.getLogger(ProjectService.class);
@Autowired
private ProjectDAO projectDAO;
@Autowired
private UserDAO userDAO;
@Autowired
private FileService fileService;
public void addProject(MultipartHttpServletRequest req, Project project) throws Exception
{
try
{
String dir = ((UserInfo)req.getSession().getAttribute("user")).getUsername() + "/" +
project.getProjectName() + "/" + "Ver" + project.getVersion();
List fileList = new ArrayList();
this.fileService.savePhysicFile(req, fileList, dir, false , null);
for (int i = 0; i < fileList.size(); ++i)
{
FileInfo file = (FileInfo)fileList.get(i);
if ("pcbFile".equals(file.getFieldName()))
{
project.setPcbFile(file.getId());
project.setPcbFileName(file.getFileName());
}
else {
if (!("bomFile".equals(file.getFieldName())))
continue;
project.setBomFile(file.getId());
project.setBomFileName(file.getFileName());
}
}
this.projectDAO.add(project);
createParamFile(dir, project);
reOrderPriByState("待查", project.getPri());
} catch (IOException e) {
logger.error("创建文件失败!", e);
throw e;
}
}
private void createParamFile(String dir, Project project)
throws IOException
{
String fileName = project.getProjectName() + "_" + project.getVersion() + ".param";
File file = this.fileService.createFile(dir + "/" + fileName);
int[] ids = new int[15];
ids[0] = project.getCheckType();
ids[1] = project.getPcbType();
ids[2] = project.getHdiModel();
ids[3] = project.getPanelModel();
ids[4] = project.getRailwayPosition();
ids[5] = project.getViacapLayer();
ids[6] = project.getAssemblyProcessTop();
ids[7] = project.getHavePb();
ids[8] = project.getAssemblyProcessBot();
ids[9] = project.getSurfaceProcess();
ids[10] = project.getDirectionTop();
ids[11] = project.getPrimarySide();
ids[12] = project.getDirectionBot();
ids[13] = project.getDirectionBotFs();
ids[14] = Integer.parseInt(project.getDensity());
List<Map<String, Object>> attrValues = this.projectDAO.getAttrValueByIds(ids);
UserInfo userInfo = this.userDAO.getById(project.getSubmitUser());
StringBuilder sb = new StringBuilder();
sb.append("User=" + project.getSubmitUserName());
sb.append("\r\n");
sb.append("Email=" + userInfo.getEmail());
sb.append("\r\n");
sb.append("CC_EMAIL=" + project.getCCtoOther());
// sb.append("\r\n");
// sb.append("CCtoOther=" + project.getCCtoOther());
sb.append("\r\n");
sb.append("ReportLanguage=" + project.getReportLanguage());
sb.append("\r\n");
sb.append("Version=" + project.getVersion());
sb.append("\r\n");
sb.append("LastVersion=" + project.getLastVersion());
sb.append("\r\n");
sb.append("Check_Type=" + getValueById(attrValues, project.getCheckType()));
sb.append("\r\n");
sb.append("NetlistCheck=" + ((project.getDfmCheck().contains("NetlistCheck")) ? 1 : 0));
sb.append("\r\n");
sb.append("Fiducial=" + ((project.getDfmCheck().contains("Fiducial")) ? 1 : 0));
sb.append("\r\n");
sb.append("Component=" + ((project.getDfmCheck().contains("Component")) ? 1 : 0));
sb.append("\r\n");
sb.append("Padstack=" + ((project.getDfmCheck().contains("Padstack")) ? 1 : 0));
sb.append("\r\n");
sb.append("Solderpaste=" + ((project.getDfmCheck().contains("Solderpaste")) ? 1 : 0));
sb.append("\r\n");
sb.append("Pin2Pad=" + ((project.getDfmCheck().contains("Pin2Pad")) ? 1 : 0));
sb.append("\r\n");
sb.append("Testpoint=" + ((project.getDfmCheck().contains("Testpoint")) ? 1 : 0));
sb.append("\r\n");
sb.append("Drill=" + ((project.getDfmCheck().contains("Drill")) ? 1 : 0));
sb.append("\r\n");
sb.append("Signal Layer=" + ((project.getDfmCheck().contains("Signal Layer")) ? 1 : 0));
sb.append("\r\n");
sb.append("P/G Layer=" + ((project.getDfmCheck().contains("P/G Layer")) ? 1 : 0));
sb.append("\r\n");
sb.append("Silk Screen=" + ((project.getDfmCheck().contains("Silk Screen")) ? 1 : 0));
sb.append("\r\n");
sb.append("Solder Mask=" + ((project.getDfmCheck().contains("Solder Mask")) ? 1 : 0));
sb.append("\r\n");
sb.append("extchk1=" + ((project.getDfmCheck().contains("extchk1")) ? 1 : 0));
sb.append("\r\n");
sb.append("extchk2=" + ((project.getDfmCheck().contains("extchk2")) ? 1 : 0));
sb.append("\r\n");
sb.append("extchk3=" + ((project.getDfmCheck().contains("extchk3")) ? 1 : 0));
sb.append("\r\n");
sb.append("extchk4=" + ((project.getDfmCheck().contains("extchk4")) ? 1 : 0));
sb.append("\r\n");
sb.append("extchk5=" + ((project.getDfmCheck().contains("extchk5")) ? 1 : 0));
sb.append("\r\n");
sb.append("extchk6=" + ((project.getDfmCheck().contains("extchk6")) ? 1 : 0));
sb.append("\r\n");
if ((project.getPcbFileName() == null) || ("".equals(project.getPcbFileName())))
{
sb.append("PCB_File=");
}
else
{
FileInfo pcbFile = this.fileService.getById(project.getPcbFile());
sb.append("PCB_File=" + this.fileService.getRootPath() + pcbFile.getRelaPath() + "/" + project.getPcbFileName());
}
sb.append("\r\n");
if ((project.getBomFileName() == null) || ("".equals(project.getBomFileName())))
{
sb.append("BOM_File=");
}
else
{
FileInfo bomFile = this.fileService.getById(project.getBomFile());
sb.append("BOM_File=" + this.fileService.getRootPath() + bomFile.getRelaPath() + "/" + project.getBomFileName());
}
sb.append("\r\n");
sb.append("PCB_Type=" + getValueById(attrValues, project.getPcbType()));
sb.append("\r\n");
sb.append("Board_Thickness=" + project.getBoardThickness());
sb.append("\r\n");
sb.append("Max_Heigh_Top=" + project.getMaxHeightTop());
sb.append("\r\n");
sb.append("Max_Heigh_Bot=" + project.getMaxHeightBot());
sb.append("\r\n");
sb.append("HDI_Model=" + getValueById(attrValues, project.getHdiModel()));
sb.append("\r\n");
sb.append("Panel_Model=" + getValueById(attrValues, project.getPanelModel()));
sb.append("\r\n");
sb.append("SubPCB_Num=" + project.getSubPcbNum());
sb.append("\r\n");
sb.append("Railway_Position=" + getValueById(attrValues, project.getRailwayPosition()));
sb.append("\r\n");
sb.append("Direction_Bot_Fs=" + getValueById(attrValues, project.getDirectionBotFs()));
sb.append("\r\n");
sb.append("Have_Pb=" + getValueById(attrValues, project.getHavePb()));
sb.append("\r\n");
sb.append("Surface_Process=" + getValueById(attrValues, project.getSurfaceProcess()));
sb.append("\r\n");
sb.append("Primary_Side=" + getValueById(attrValues, project.getPrimarySide()));
sb.append("\r\n");
sb.append("Assembly_Process_Top=" + getValueById(attrValues, project.getAssemblyProcessTop()));
sb.append("\r\n");
sb.append("Assembly_Process_Bot=" + getValueById(attrValues, project.getAssemblyProcessBot()));
sb.append("\r\n");
sb.append("Direction_Top=" + getValueById(attrValues, project.getDirectionTop()));
sb.append("\r\n");
sb.append("Direction_Bot=" + getValueById(attrValues, project.getDirectionBot()));
sb.append("\r\n");
sb.append("Density=" + getValueById(attrValues, Integer.parseInt(project.getDensity())));
OutputStream os = new FileOutputStream(file);
os.write(sb.toString().getBytes());
os.close();
}
private String getValueById(List<Map<String, Object>> values, int id)
{
String rs = "";
for (int i = 0; i < values.size(); ++i)
{
if (!(((Map)values.get(i)).get("F_ID").equals(Integer.valueOf(id))))
continue;
rs = ((Map)values.get(i)).get("F_ATTR_VALUE").toString();
break;
}
return rs;
}
/**
* 结果文件下载查询
* @param states
* @param page
* @param queryBean
* @return
*/
public List<Project> getProjectByStates(String[] states, Page page, ProjectQueryBean queryBean)
{
return this.projectDAO.getByStates(states, page, queryBean);
}
public List<Project> getProjectByStatesOrderUser(String[] states, int uid, Page page, ProjectQueryBean queryBean)
{
return this.projectDAO.getByStatesOrderUser(states, uid, page, queryBean);
}
/**
* 结果文件下载查询
* @param states
* @param uid
* @param page
* @param queryBean
* @return
*/
public List<Project> getProjectByStates(String[] states, int[] uid, Page page, ProjectQueryBean queryBean)
{
return this.projectDAO.getByStates(states, uid, page, queryBean);
}
public Project getLastVersion(int uid, String projectName)
{
return this.projectDAO.getLastVersion(uid, projectName);
}
public List<Map<String, Object>> getAttrValue(String attrName)
{
return this.projectDAO.getAttrValue(attrName);
}
public void pauseProject(String[] pids)
{
int pri = 10000;
String state = "暂停";
for (String pid : pids)
{
this.projectDAO.changePri(pid, pri, state);
}
}
public void startProject(String[] pids)
{
int pri = this.projectDAO.getMaxPri();
String state = "待查";
for (String pid : pids)
{
pri++;
this.projectDAO.changePri(pid, pri, state);
}
}
public void deleteProject(String[] pids)
{
try
{
for (String pid : pids)
{
Project project = this.projectDAO.getById(Integer.parseInt(pid));
this.projectDAO.delete(pid);
FileInfo fileInfo = null;
if (project.getPcbFile() != 0)
{
fileInfo = this.fileService.getById(project.getPcbFile());
}
else if (project.getBomFile() != 0)
{
fileInfo = this.fileService.getById(project.getBomFile());
}
this.fileService.deleteFile(project.getPcbFile());
this.fileService.deleteFile(project.getBomFile());
String deleteDir = this.fileService.getRootPath() + "\\" + fileInfo.getRelaPath();
File file = new File(deleteDir);
if (!(file.exists()))
continue;
File[] files = file.listFiles();
if ((files != null) && (files.length > 0))
{
for (File temp : files)
{
if (!(temp.exists()))
continue;
temp.delete();
}
}
if (file.exists())
{
file.delete();
}
if ((project.getVersion() > 1) ||
(!(file.getParentFile().exists())))
continue;
file.getParentFile().delete();
}
}
catch (Exception e)
{
logger.error("删除项目失败", e);
}
}
public Project getProjectById(int id)
{
return this.projectDAO.getById(id);
}
public void restoreProject(String pid) {
int pri = this.projectDAO.getMaxPri();
if (pri <= 0)
{
pri = 1;
}
else {
++pri;
}
String state = "待查";
this.projectDAO.changePri(pid, pri, state);
}
public void setUserDAO(UserDAO userDAO) {
this.userDAO = userDAO;
}
public void changePri(String pid, int[] uids, String change)
{
int id = Integer.parseInt(pid);
Project p1 = this.projectDAO.getById(id);
Project p2 = this.projectDAO.getByPriState(id, uids, change, "待查");
this.projectDAO.changePri(p1.getId(), p2.getPri());
this.projectDAO.changePri(p2.getId(), p1.getPri());
}
public Project getByPriState(String change, int pid, int[] uids, String state)
{
return this.projectDAO.getByPriState(pid, uids, change, state);
}
public void reOrderPriByState(String state, int pri)
{
this.projectDAO.reOrderPriByState(state, pri);
}
public List<Project> getProjectByUser(int uid) {
return this.projectDAO.getByUser(uid);
}
public void recheck(String[] pids)
{
for (String pid : pids)
{
int id = Integer.parseInt(pid);
this.projectDAO.recheck(id, TimeUtil.getNowChar14(), "待查");
this.projectDAO.deleteStageByProject(id);
}
}
public List<String> getAllServers() {
return this.projectDAO.getAllServers();
}
public Project getProjectByServerState(String server, String state)
{
return this.projectDAO.getByServerState(server, state);
}
public List<ProjectStage> getStagesByProject(int pid) {
return this.projectDAO.getStagesByProject(pid);
}
public void stopProject(String pid)
{
this.projectDAO.stop(pid);
}
/**
* 修改项目PreDFMFile字段
* @param pid
*/
public void updateProjectPreDFMFile(Integer pid, Integer preDFMFileId, String preDFMFileName) {
projectDAO.updateProjectPreDFMFile(pid, preDFMFileId, preDFMFileName);
}
/**
* 修改项目PostDFMFile字段
* @param pid
*/
public void updateProjectPostDFMFile(Integer pid, Integer postDFMFileId, String postDFMFileName) {
projectDAO.updateProjectPostDFMFile(pid, postDFMFileId, postDFMFileName);
}
}

View File

@ -0,0 +1,63 @@
package com.ruoyi.dfm.service;
import com.ruoyi.dfm.dao.StatisticsDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* 统计服务
*/
@Component
public class StatisticsService {
@Autowired
private StatisticsDAO statisticsDAO;
public void setStatisticsDAO(StatisticsDAO statisticsDAO) {
this.statisticsDAO = statisticsDAO;
}
/**
* 统计系统总利用率
*/
public Map<String, Object> usage() {
return statisticsDAO.usage();
}
/**
* 获取根据部门分组的时间利用率
* @return
*/
public List<Map<String, Object>> usageGroupByDepartment(){
return statisticsDAO.usageGroupByDepartment();
}
/**
* 获取根据部门和年份分组的时间利用率
* @return
*/
public List<Map<String, Object>> usageGroupByDepartmentAndYear(){
return statisticsDAO.usageGroupByDepartmentAndYear();
}
/**
* 统计完成数量
* 过滤大于20小时的不合法运行时间
* 月份f_month
* 完成的项目数量f_count
* @return
*/
public List<Map<String, Object>> countByMonth(String year){
return statisticsDAO.countByMonth(year);
}
/**
* 获取所有年份
* @return
*/
public List<Map<String, Object>> getAllYear(){
return statisticsDAO.getAllYear();
}
}

View File

@ -0,0 +1,120 @@
package com.ruoyi.dfm.service;
import com.ruoyi.dfm.dao.UserDAO;
import com.ruoyi.dfm.pojo.Page;
import com.ruoyi.dfm.pojo.Project;
import com.ruoyi.dfm.pojo.UserInfo;
import com.ruoyi.dfm.pojo.UserQueryBean;
import com.ruoyi.dfm.util.Md5Util;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.File;
import java.util.List;
@Component
public class UserService
{
private static final Logger logger = LoggerFactory.getLogger(UserService.class);
@Autowired
private UserDAO userDAO;
@Autowired
private ProjectService projectService;
public void addUser(UserInfo user)
{
this.userDAO.add(user);
}
public List<UserInfo> getAllUser(Page page)
{
return this.userDAO.getAll(page);
}
public List<UserInfo> getAllUser()
{
return this.userDAO.getAll();
}
public void deleteUser(int uid, String delProject)
{
if ("yes".equals(delProject))
{
List list = this.projectService.getProjectByUser(uid);
if ((list != null) && (!(list.isEmpty())))
{
String[] pids = new String[list.size()];
for (int i = 0; i < list.size(); ++i)
{
pids[i] = ((Project)list.get(i)).getId() + "";
}
this.projectService.deleteProject(pids);
UserInfo user = this.userDAO.getById(uid);
String userDirPath = FileService.rootPath + user.getUsername();
File userDir = new File(userDirPath);
if (userDir.exists())
{
userDir.delete();
}
}
}
this.userDAO.delete(uid);
}
public UserInfo getUserById(int uid)
{
return this.userDAO.getById(uid);
}
public void updateUser(UserInfo user)
{
UserInfo userInfo = this.userDAO.getById(user.getId());
userInfo.setDepartment(user.getDepartment());
userInfo.setEmail(user.getEmail());
userInfo.setCcEmail(user.getCcEmail());
//如果密码没有发生变更则不修改如果发生变更则使用md5加密
if(!StringUtils.equals(userInfo.getPassword(), user.getPassword())) {
userInfo.setPassword(Md5Util.md5(user.getPassword()));
}
userInfo.setProjectGroup(user.getProjectGroup());
userInfo.setGroupId(user.getGroupId());
this.userDAO.update(userInfo);
}
public List<UserInfo> getByQueryBean(UserQueryBean queryBean, Page page) {
return this.userDAO.getByQueryBean(queryBean, page);
}
public List<UserInfo> getByQueryBean(UserQueryBean queryBean) {
return this.userDAO.getByQueryBean(queryBean);
}
public List<UserInfo> getByDepartment(String department) {
return this.userDAO.getByDepartment(department);
}
public void changeUserState(int uid, int state) {
UserInfo user = getUserById(uid);
user.setStatus(state);
this.userDAO.update(user);
}
/**
* 检查当前需要分析的projectName是否属于当前登陆用户的可见范围
* @param projectName
* @param submitUsers
*/
public boolean checkProjectAndUsers(String projectName, List<UserInfo> submitUsers) {
return userDAO.checkProjectAndUsers(projectName, submitUsers);
}
}

View File

@ -0,0 +1,6 @@
package com.ruoyi.dfm.util;
public class FileUtil {
}

View File

@ -0,0 +1,12 @@
package com.ruoyi.dfm.util;
import org.apache.commons.codec.digest.DigestUtils;
/**
* Md5加密工具类
*/
public class Md5Util {
public static String md5(String str) {
return DigestUtils.md5Hex(str);
}
}

View File

@ -0,0 +1,10 @@
package com.ruoyi.dfm.util;
import com.ruoyi.dfm.pojo.Page;
public class PageUtil {
public static void constructPage(Page page , int totalCount){
page.setTotalCount(totalCount);
page.setTotalPage(totalCount % page.getPageSize() == 0 ? totalCount / page.getPageSize() : totalCount / page.getPageSize() + 1);
}
}

View File

@ -0,0 +1,47 @@
package com.ruoyi.dfm.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.Properties;
/**
* 获取系统properties文件处理类
* 类修改者 修改日期
* 修改说明
* <p>Title: PropertiesUtils.java</p>
* <p>Description:清大海辉科技开发平台</p>
* <p>Copyright: Copyright (c) 2006</p>
* <p>Company:北京清大海辉科技有限公司</p>
* @author Kfighter
* @date Dec 15, 2010 3:21:07 PM
* @version V0.1
*/
public class PropertiesUtils {
private static final Logger log = LoggerFactory.getLogger(PropertiesUtils.class);
private static String config = "/config.properties";
private static Properties props;
/**
* 根据文件路径获取*.properties文件
* Kfighter Dec 15, 2010
* 修改者名字 修改日期
* 修改内容
* @return
* @return Properties
* @throws
*/
public static Properties getProperties() {
try {
if(null == props){
props = new Properties();
}
props.load(PropertiesUtils.class.getResourceAsStream(config));
return props;
} catch (IOException e) {
log.error("找不到对应的配置文件!");
}
return props;
}
}

View File

@ -0,0 +1,391 @@
package com.ruoyi.dfm.util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
public abstract class TimeUtil {
//---当前日期的年
public static Calendar now = Calendar.getInstance();
int year = now.get( Calendar.YEAR );
int date = now.get( Calendar.DAY_OF_MONTH );
int month = now.get( Calendar.MONTH ) + 1;
int hour = now.get( Calendar.HOUR );
int min = now.get( Calendar.MINUTE );
int sec = now.get( Calendar.SECOND );
/**
* 有关日期工具类(extends TimeUtil)
*
* TimeUtil主要功能有
* 1.各种日期类型字符util.Datesql.DateCalendar等转换
* 2.获取指定日期的年份月份日份小时毫秒
* 3.获取当前/系统日期(指定日期格式)
* 4.获取字符日期一个月的天数
* 5.获取指定月份的第一天,最后一天
*
* DateUtil主要功能有
* 1.日期比较
* 2.获取2个字符日期的天数差周数差月数差年数差
* 3.日期添加
* 4.判断给定日期是不是润年
*/
//-------------------------------日期类型转换---------------------------------------------------------------------------
/**
* 字符型日期转化util.Date型日期
* @Param:p_strDate 字符型日期
* @param p_format 格式:"yyyy-MM-dd" / "yyyy-MM-dd hh:mm:ss"
* @Return:java.util.Date util.Date型日期
* @Throws: ParseException
* @Author: zhuqx
* @Date: 2006-10-31
*/
public static Date toUtilDateFromStrDateByFormat( String p_strDate, String p_format )
throws ParseException {
Date l_date = null;
DateFormat df = new SimpleDateFormat( p_format );
if ( p_strDate != null && ( !"".equals( p_strDate ) ) && p_format != null && ( !"".equals( p_format ) ) ) {
l_date = df.parse( p_strDate );
}
return l_date;
}
/**
* 字符型日期转化成sql.Date型日期
* @param p_strDate 字符型日期
* @return java.sql.Date sql.Date型日期
* @throws ParseException
* @Author: zhuqx
* @Date: 2006-10-31
*/
public static java.sql.Date toSqlDateFromStrDate( String p_strDate, String p_format ) throws ParseException {
java.sql.Date returnDate = null;
DateFormat sdf = new SimpleDateFormat( p_format );
if ( p_strDate != null && !"".equals( p_strDate ) && p_format != null && !"".equals( p_format )) {
returnDate = new java.sql.Date( sdf.parse( p_strDate ).getTime() );
}
return returnDate;
}
/**
* util.Date型日期转化指定格式的字符串型日期
* @param p_date Date
* @param p_format String
* 格式1:"yyyy-MM-dd"
* 格式2:"yyyy-MM-dd hh:mm:ss EE"
* 格式3:"yyyy年MM月dd日 hh:mm:ss EE"
* 说明: -- :: 星期 注意MM/mm大小写
* @return String
* @Author: zhuqx
* @Date: 2006-10-31
*/
public static String toStrDateFromUtilDateByFormat( Date p_utilDate, String p_format ) throws ParseException {
String l_result = "";
if ( p_utilDate != null ) {
SimpleDateFormat sdf = new SimpleDateFormat( p_format );
l_result = sdf.format( p_utilDate );
}
return l_result;
}
/**
* util.Date型日期转化转化成Calendar日期
* @param p_utilDate Date
* @return Calendar
* @Author: zhuqx
* @Date: 2006-10-31
*/
public static Calendar toCalendarFromUtilDate(Date p_utilDate) {
Calendar c = Calendar.getInstance();
c.setTime(p_utilDate);
return c;
}
/**
* util.Date型日期转化sql.Date(年月日)型日期
* @Param: p_utilDate util.Date型日期
* @Return: java.sql.Date sql.Date型日期
* @Author: zhuqx
* @Date: 2006-10-31
*/
public static java.sql.Date toSqlDateFromUtilDate( Date p_utilDate ) {
java.sql.Date returnDate = null;
if ( p_utilDate != null ) {
returnDate = new java.sql.Date( p_utilDate.getTime() );
}
return returnDate;
}
/**
* util.Date型日期转化sql.Time(时分秒)型日期
* @Param: p_utilDate util.Date型日期
* @Return: java.sql.Time sql.Time型日期
* @Author: zhuqx
* @Date: 2006-10-31
*/
public static java.sql.Time toSqlTimeFromUtilDate( Date p_utilDate ) {
java.sql.Time returnDate = null;
if ( p_utilDate != null ) {
returnDate = new java.sql.Time( p_utilDate.getTime() );
}
return returnDate;
}
/**
* util.Date型日期转化sql.Date(时分秒)型日期
* @Param: p_utilDate util.Date型日期
* @Return: java.sql.Timestamp sql.Timestamp型日期
* @Author: zhuqx
* @Date: 2006-10-31
*/
public static java.sql.Timestamp toSqlTimestampFromUtilDate( Date p_utilDate ) {
java.sql.Timestamp returnDate = null;
if ( p_utilDate != null ) {
returnDate = new java.sql.Timestamp( p_utilDate.getTime() );
}
return returnDate;
}
/**
* sql.Date型日期转化util.Date型日期
* @Param: sqlDate sql.Date型日期
* @Return: java.util.Date util.Date型日期
* @Author: zhuqx
* @Date: 2006-10-31
*/
public static Date toUtilDateFromSqlDate( java.sql.Date p_sqlDate ) {
Date returnDate = null;
if ( p_sqlDate != null ) {
returnDate = new Date( p_sqlDate.getTime() );
}
return returnDate;
}
//-----------------获取指定日期的年份月份日份小时毫秒----------------------------
/**
* 获取指定日期的年份
* @param p_date util.Date日期
* @return int 年份
* @author zhuqx
* @Date: 2006-10-31
*/
public static int getYearOfDate( Date p_date ) {
Calendar c = Calendar.getInstance();
c.setTime( p_date );
return c.get( Calendar.YEAR );
}
/**
* 获取指定日期的月份
* @param p_date util.Date日期
* @return int 月份
* @author zhuqx
* @Date: 2006-10-31
*/
public static int getMonthOfDate( Date p_date ) {
Calendar c = Calendar.getInstance();
c.setTime( p_date );
return c.get( Calendar.MONTH ) + 1;
}
/**
* 获取指定日期的日份
* @param p_date util.Date日期
* @return int 日份
* @author zhuqx
* @Date: 2006-10-31
*/
public static int getDayOfDate( Date p_date ) {
Calendar c = Calendar.getInstance();
c.setTime( p_date );
return c.get( Calendar.DAY_OF_MONTH );
}
/**
* 获取指定日期的小时
* @param p_date util.Date日期
* @return int 日份
* @author zhuqx
* @Date: 2006-10-31
*/
public static int getHourOfDate( Date p_date ) {
Calendar c = Calendar.getInstance();
c.setTime( p_date );
return c.get( Calendar.HOUR_OF_DAY );
}
/**
* 获取指定日期的分钟
* @param p_date util.Date日期
* @return int 分钟
* @author zhuqx
* @Date: 2006-10-31
*/
public static int getMinuteOfDate( Date p_date ) {
Calendar c = Calendar.getInstance();
c.setTime( p_date );
return c.get( Calendar.MINUTE );
}
/**
* 获取指定日期的秒钟
* @param p_date util.Date日期
* @return int 秒钟
* @author zhuqx
* @Date: 2006-10-31
*/
public static int getSecondOfDate( Date p_date ) {
Calendar c = Calendar.getInstance();
c.setTime( p_date );
return c.get( Calendar.SECOND );
}
/**
* 获取指定日期的毫秒
* @param p_date util.Date日期
* @return int 毫秒
* @author zhuqx
* @Date: 2006-10-31
*/
public static long getMillisOfDate( Date p_date ) {
Calendar c = Calendar.getInstance();
c.setTime( p_date );
return c.getTimeInMillis();
}
//-----------------获取当前/系统日期(指定日期格式)-----------------------------------------------------------------------------------
/**
* 获取指定日期格式当前日期的字符型日期
* @param p_format 日期格式
* 格式1:"yyyy-MM-dd"
* 格式2:"yyyy-MM-dd hh:mm:ss EE"
* 格式3:"yyyy年MM月dd日 hh:mm:ss EE"
* 说明: -- :: 星期 注意MM/mm大小写
* @return String 当前时间字符串
* @author zhuqx
* @Date: 2006-10-31
*/
public static String getNowOfDateByFormat( String p_format ) {
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat( p_format );
String dateStr = sdf.format( d );
return dateStr;
}
public static String getNowChar14()
{
String format = "yyyyMMddHHmmss";
return getNowOfDateByFormat(format);
}
/**
* 获取指定日期格式系统日期的字符型日期
* @param p_format 日期格式
* 格式1:"yyyy-MM-dd"
* 格式2:"yyyy-MM-dd hh:mm:ss EE"
* 格式3:"yyyy年MM月dd日 hh:mm:ss EE"
* 说明: -- :: 星期 注意MM/mm大小写
* @return String 系统时间字符串
* @author zhuqx
* @Date: 2006-10-31
*/
public static String getSystemOfDateByFormat( String p_format ) {
long time = System.currentTimeMillis();
Date d = new Date( time );
SimpleDateFormat sdf = new SimpleDateFormat( p_format );
String dateStr = sdf.format( d );
return dateStr;
}
/**
* 获取字符日期一个月的天数
* @param p_date
* @return 天数
* @author zhuqx
*/
public static int getDayOfMonth( Date p_date ) throws ParseException {
int year = getYearOfDate(p_date);
int month = getMonthOfDate( p_date )-1;
int day = getDayOfDate( p_date );
int hour = getHourOfDate( p_date );
int minute = getMinuteOfDate( p_date );
int second = getSecondOfDate( p_date );
Calendar l_calendar = new GregorianCalendar(year,month,day,hour,minute,second);
return l_calendar.getActualMaximum( l_calendar.DAY_OF_MONTH );
}
// -----------------获取指定月份的第一天,最后一天 ---------------------------------------------------------------------------
/**
* 获取指定月份的第一天
* @param p_strDate 指定月份
* @param p_formate 日期格式
* @return String 时间字符串
* @author zhuqx
* @Date: 2006-10-31
*/
public static String getDateOfMonthBegin( String p_strDate, String p_format ) throws ParseException {
Date date = toUtilDateFromStrDateByFormat( p_strDate,p_format );
return toStrDateFromUtilDateByFormat( date,"yyyy-MM" ) + "-01";
}
/**
* 获取指定月份的最后一天
* @param p_strDate 指定月份
* @param p_formate 日期格式
* @return String 时间字符串
* @author zhuqx
* @Date: 2006-10-31
*/
public static String getDateOfMonthEnd( String p_strDate, String p_format ) throws ParseException {
Date date = toUtilDateFromStrDateByFormat( getDateOfMonthBegin( p_strDate,p_format ),p_format );
Calendar calendar = Calendar.getInstance();
calendar.setTime( date );
calendar.add( Calendar.MONTH,1 );
calendar.add( Calendar.DAY_OF_YEAR,-1 );
return toStrDateFromUtilDateByFormat( calendar.getTime(),"yyyy-MM-dd" );
}
public static String getDateStrByFormat(String source , String format){
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
Date date = sdf.parse(source);
SimpleDateFormat sdf1 = new SimpleDateFormat(format);
return sdf1.format(date);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
public static String getDateStrByFormat(String source , String sourceFormat, String destFormat){
try {
SimpleDateFormat sdf = new SimpleDateFormat(sourceFormat);
Date date = sdf.parse(source);
SimpleDateFormat sdf1 = new SimpleDateFormat(destFormat);
return sdf1.format(date);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
public static void main(String args[])throws Exception
{
String source = "20110918131312122";
//String format = "yyyy-MM-dd HH24:mm:ss";
//SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
//sdf.parse(source);
System.out.println(getDateStrByFormat(source,"yyyy-MM-dd HH:mm:ss"));
}
}

View File

@ -0,0 +1,49 @@
package com.ruoyi.dfm.web;
import com.ruoyi.dfm.pojo.UserInfo;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.IOException;
public class LoginFilter implements Filter {
FilterConfig filterConfig;
public void destroy() {
}
public void doFilter(ServletRequest req, ServletResponse resp,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpSession session = request.getSession(false);
RequestDispatcher dispatcher = request
.getRequestDispatcher("/login.jsp");
if (filterConfig.getInitParameter("loginURL").equals(request.getRequestURI().trim())) {
chain.doFilter(req, resp);// 初始页面没有user要让他通过
// 或者要用静态属性
return;
}
if (session == null)
dispatcher.forward(req, resp); // user null转发到login.jsp
else {
UserInfo user = (UserInfo) session.getAttribute("user");
if (user == null)
dispatcher.forward(req, resp); // user null,转发到login.jsp
else
chain.doFilter(req, resp); // user 不为 null继续
}
}
public void init(FilterConfig arg0) throws ServletException {
filterConfig = arg0;
}
}

View File

@ -1,7 +1,12 @@
package com.ruoyi.web.controller.common;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.config.Global;
import com.ruoyi.common.config.ServerConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -11,13 +16,9 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.Global;
import com.ruoyi.common.config.ServerConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 通用请求处理

View File

@ -1,19 +1,20 @@
package com.ruoyi.web.controller.demo.controller;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSON;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.CxSelect;
import com.ruoyi.common.json.JSONObject;
import com.ruoyi.common.json.JSONObject.JSONArray;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.List;
/**
* 表单相关

View File

@ -1,17 +1,5 @@
package com.ruoyi.web.controller.demo.controller;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain;
@ -23,6 +11,15 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.controller.demo.domain.CustomerModel;
import com.ruoyi.web.controller.demo.domain.UserOperateModel;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 操作控制

View File

@ -1,16 +1,5 @@
package com.ruoyi.web.controller.demo.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.PageDomain;
@ -18,6 +7,14 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.*;
/**
* 表格相关

View File

@ -1,9 +1,10 @@
package com.ruoyi.web.controller.demo.domain;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.List;
/**
* 客户测试信息
*

View File

@ -1,9 +1,10 @@
package com.ruoyi.web.controller.demo.domain;
import java.util.Date;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 商品测试信息
*

View File

@ -1,11 +1,12 @@
package com.ruoyi.web.controller.demo.domain;
import java.util.Date;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.Type;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.DateUtils;
import java.util.Date;
public class UserOperateModel extends BaseEntity
{
private static final long serialVersionUID = 1L;

View File

@ -1,10 +1,10 @@
package com.ruoyi.web.controller.monitor;
import com.ruoyi.common.core.controller.BaseController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController;
/**
* druid 监控

View File

@ -1,12 +1,12 @@
package com.ruoyi.web.controller.monitor;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.framework.web.domain.Server;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.framework.web.domain.Server;
/**
* 服务器监控

View File

@ -1,7 +1,14 @@
package com.ruoyi.web.controller.monitor;
import java.util.List;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.shiro.service.SysPasswordService;
import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.service.ISysLogininforService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -9,14 +16,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.service.ISysLogininforService;
import java.util.List;
/**
* 系统访问记录

View File

@ -1,15 +1,5 @@
package com.ruoyi.web.controller.monitor;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -18,6 +8,13 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.service.ISysOperLogService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 操作日志记录

View File

@ -1,14 +1,5 @@
package com.ruoyi.web.controller.monitor;
import java.util.List;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -21,6 +12,16 @@ import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.SysUserOnline;
import com.ruoyi.system.service.ISysUserOnlineService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* 在线用户监控

View File

@ -1,20 +1,21 @@
package com.ruoyi.web.controller.system;
import java.awt.image.BufferedImage;
import java.io.IOException;
import com.google.code.kaptcha.Constants;
import com.google.code.kaptcha.Producer;
import com.ruoyi.common.core.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.google.code.kaptcha.Constants;
import com.google.code.kaptcha.Producer;
import com.ruoyi.common.core.controller.BaseController;
import java.awt.image.BufferedImage;
import java.io.IOException;
/**
* 图片验证码支持算术形式

View File

@ -1,16 +1,5 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
@ -21,6 +10,14 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 参数配置 信息操作处理

View File

@ -1,16 +1,5 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
@ -22,6 +11,14 @@ import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.SysDept;
import com.ruoyi.system.domain.SysRole;
import com.ruoyi.system.service.ISysDeptService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 部门信息

View File

@ -1,16 +1,5 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -20,6 +9,14 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.SysDictData;
import com.ruoyi.system.service.ISysDictDataService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 数据字典信息

View File

@ -1,16 +1,5 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
@ -22,6 +11,14 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.SysDictType;
import com.ruoyi.system.service.ISysDictTypeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 数据字典信息

View File

@ -1,10 +1,5 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import com.ruoyi.common.config.Global;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.framework.util.ShiroUtils;
@ -12,6 +7,12 @@ import com.ruoyi.system.domain.SysMenu;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;
/**
* 首页 业务处理

View File

@ -1,7 +1,9 @@
package com.ruoyi.web.controller.system;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
@ -10,10 +12,9 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 登录验证

View File

@ -1,16 +1,5 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
@ -21,6 +10,14 @@ import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.SysMenu;
import com.ruoyi.system.domain.SysRole;
import com.ruoyi.system.service.ISysMenuService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 菜单信息

View File

@ -1,15 +1,5 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -18,6 +8,13 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 公告 信息操作处理

View File

@ -1,16 +1,5 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
@ -21,6 +10,14 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 岗位信息操作处理

View File

@ -1,16 +1,5 @@
package com.ruoyi.web.controller.system;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.Global;
import com.ruoyi.common.core.controller.BaseController;
@ -22,6 +11,13 @@ import com.ruoyi.framework.shiro.service.SysPasswordService;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.service.ISysUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
* 个人信息 业务处理

View File

@ -1,16 +1,16 @@
package com.ruoyi.web.controller.system;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.shiro.service.SysRegisterService;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.shiro.service.SysRegisterService;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.service.ISysConfigService;
/**
* 注册验证

View File

@ -1,16 +1,5 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
@ -24,6 +13,14 @@ import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 角色信息

View File

@ -1,18 +1,5 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
@ -27,6 +14,16 @@ import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.stream.Collectors;
/**
* 用户信息

View File

@ -1,10 +1,10 @@
package com.ruoyi.web.controller.tool;
import com.ruoyi.common.core.controller.BaseController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController;
/**
* build 表单构建

View File

@ -1,10 +1,10 @@
package com.ruoyi.web.controller.tool;
import com.ruoyi.common.core.controller.BaseController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController;
/**
* swagger 接口

View File

@ -1,24 +1,15 @@
package com.ruoyi.web.controller.tool;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
/**
* swagger 用户测试方法

View File

@ -1,10 +1,10 @@
package com.ruoyi.web.core.config;
import com.ruoyi.common.config.Global;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.ruoyi.common.config.Global;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;

View File

@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://localhost:3306/dfm-ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: dave
password: 5253232
# 从库数据源

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('check表格页')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('表格传值给父页面')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('radio表格页')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('其他操作')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('其他操作')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('百度ECharts')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('图表组合')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('图表')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('线状图')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('点击按钮加载表格')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('表格父子视图')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('动态增删改查')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('加载data数据')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('表格细节视图')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('表格行内编辑')" />
<th:block th:include="include :: bootstrap-editable-css" />

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('自定义触发事件')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('导出')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('冻结列')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('表格数据汇总')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('组合表头')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('跳转至指定页')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('初始多表格')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('其他操作')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('跳转至指定页')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('自定义查询参数')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('表格打印配置')" />
</head>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('表格自动刷新')" />
</head>

Some files were not shown because too many files have changed in this diff Show More