diff --git a/doc/工作计划 b/doc/工作计划 new file mode 100644 index 000000000..647b98a24 --- /dev/null +++ b/doc/工作计划 @@ -0,0 +1,7 @@ +2020-08-30 +计划: +1.菜单使用DFM数据 +2.完成用户列表的迁移 +3.熟悉 + +实际: diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index a0e726bd4..a4b5bf70c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -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" + " ''-' `'-' `-..-' "); } + } \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/constant/ProjectConstants.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/constant/ProjectConstants.java new file mode 100644 index 000000000..490c5eab6 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/constant/ProjectConstants.java @@ -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"; + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/constant/RequestConstants.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/constant/RequestConstants.java new file mode 100644 index 000000000..6233f8fb5 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/constant/RequestConstants.java @@ -0,0 +1,5 @@ +package com.ruoyi.dfm.constant; + +public interface RequestConstants { + public final static String UPLOAD_RELATIVE_PATH = "/upload/"; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/constant/UserConstants.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/constant/UserConstants.java new file mode 100644 index 000000000..280362b4d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/constant/UserConstants.java @@ -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; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/BaseController.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/BaseController.java new file mode 100644 index 000000000..3be2747e6 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/BaseController.java @@ -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; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/DataAnalysisController.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/DataAnalysisController.java new file mode 100644 index 000000000..770ed2bef --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/DataAnalysisController.java @@ -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 getSubmitUsers(HttpServletRequest req){ + UserInfo user = getUserInfo(req); + //获取上传人下拉列表 + List 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 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 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 data = null; + Map 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 result = dataAnalysisService.analysisByProject(projectName, startSubmitTime, endSubmitTime); + //data.put("result", result); + + if(null != result && result.size() > 0) { + //构造版本集合 + TreeSet versions = new TreeSet<>(); + + for(DataAnalysisBean b : result) { + versions.add(b.getVersion()); + } + data.put("versions", versions); + + //按照问题种类对结果集进行分组 + Map> issues = new HashMap<>(); + + for(DataAnalysisBean b : result) { + String key = b.getIssueDescription(); + if(!issues.containsKey(key)) { + List list = new ArrayList<>(); + issues.put(key, list); + } + issues.get(key).add(b); + } + + //按照版本进行填充 + Integer [] versionArr = versions.toArray(new Integer[] {}); + Iterator it = issues.keySet().iterator(); + while(it.hasNext()) { + String key = it.next(); + List list = issues.get(key); + Collections.sort(list, new Comparator() { + @Override + public int compare(DataAnalysisBean o1, DataAnalysisBean o2) { + return o1.getVersion() - o2.getVersion(); + } + }); + for(int i = 0;i result = dataAnalysisService.analysisByUser(submitUser, startSubmitTime, endSubmitTime); + data.put("result", result); + } + else { + + List submitUsers = getSubmitUsers(req); + if(ANALYSIS_TYPE_ALL_USER.equals(analysisType)) { + List result = dataAnalysisService.analysisByAllUser(startSubmitTime, endSubmitTime, submitUsers); + data.put("result", result); + } + else if(ANALYSIS_TYPE_ALL_ISSUE.equals(analysisType)) { + List 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)); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/FileController.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/FileController.java new file mode 100644 index 000000000..eda1fd6c3 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/FileController.java @@ -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, ""); + 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, ""); + } + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/LoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/LoginController.java new file mode 100644 index 000000000..4195d1ccc --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/LoginController.java @@ -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, ""); + return null; + } + UserInfo user = loginService.checkUser(username, pwd); + if(null != user) + { + if(UserConstants.USER_STATUS_ZANTING == user.getStatus()) + { + outputMsg(res, ""); + return null; + } + + logger.debug("用户:" + user.getUsername() + " 登录成功!"); + req.getSession().setAttribute("user", user); + List menus = menuService.getMenuByUser(user); + req.getSession().setAttribute("menus", menus); + return new ModelAndView("index"); + } + else + { + outputMsg(res, ""); + return null; + } + + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/ProjectController.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/ProjectController.java new file mode 100644 index 000000000..ca85e2f03 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/ProjectController.java @@ -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, ""); + return null; + } catch (Exception e) { + logger.error("添加项目失败", e); + outputMsg(res, ""); } + 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 projects = null; + Project pre = null; + Project next = null; + List users = null; + + //查询排序 + Page tempPage = new Page(); + tempPage.setCurrentPage(1); + tempPage.setPageSize(999999); + //查询所有的项目,按照优先级排序 + List 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 depUsers = userService.getByDepartment(department); + //if(null == depUsers || depUsers.isEmpty()) {} + int[] uids = new int [depUsers.size()]; + for (int i=0;idocument.location.href='project.do?method=queueManage¤tPage=" + currentPage + "';"); + } catch (Exception e) { + logger.error("暂停项目失败!", e); + outputMsg(res, ""); + } + } + + @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, ""); + } catch (Exception e) { + logger.error("批量开始项目失败!", e); + outputMsg(res, ""); + } + } + + @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, ""); + } catch (Exception e) { + logger.error("恢复项目失败!", e); + outputMsg(res, ""); + } + } + + @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, ""); + } catch (Exception e) { + logger.error("删除项目失败!", e); + outputMsg(res, ""); + } + } + + + @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 depUsers = userService.getByDepartment(department); + //if(null == depUsers || depUsers.isEmpty()) {} + int[] uids = new int [depUsers.size()]; + for (int i=0;ialert('结果文件不存在,请联系管理员!');window.history.go(-1);"); + 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, ""); + } + } + + @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, ""); + 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, ""); + } + } + + + @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, ""); +// return ; +// } +// + File file = fileService.getPhysicFile(fileInfo); +// if(null == file){ +// outputMsg(response, ""); +// 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, ""); + } + } catch (Exception e) { + outputMsg(response, ""); + } + } + + @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 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 depUsers = userService.getByDepartment(department); + int[] uids = new int [depUsers.size()]; + for (int i=0;i 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 depUsers = userService.getByDepartment(department); + int[] uids = new int [depUsers.size()]; + for (int i=0;i depUsers = userService.getByDepartment(department); + uids = new int [depUsers.size()]; + for (int i=0;idocument.location.href='project.do?method=queueManage¤tPage=" + currentPage + "';"); + } + catch (Exception e) { + logger.error("调整优先级失败!", e); + outputMsg(res, ""); + } + } + + @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, ""); + } + catch (Exception e) { + logger.error("再查项目失败!", e); + outputMsg(res, ""); + } + } + + @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, ""); + } + catch (Exception e) { + logger.error("中止项目失败!", e); + outputMsg(res, ""); + } + } + + /** + * 上传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 fileList = new ArrayList(); + 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 fileList = new ArrayList(); + 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"); + } + +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/StatisticsController.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/StatisticsController.java new file mode 100644 index 000000000..6fd74e8fe --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/StatisticsController.java @@ -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> allYear = statisticsService.getAllYear(); + List allYears = new ArrayList<>(allYear.size()); + for(Map 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 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> 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> 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> 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)); + } + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/UserController.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/UserController.java new file mode 100644 index 000000000..14ee6cb94 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/UserController.java @@ -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, ""); + return null; + } catch (Exception e) { + logger.error("添加用户失败", e); + outputMsg(res, ""); + 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 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, ""); + } catch (Exception e) { + logger.error("删除用户失败", e); + outputMsg(res, ""); + } + 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, ""); + } catch (Exception e) { + logger.error("暂停用户失败", e); + outputMsg(res, ""); + } + 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, ""); + } + else + { + outputMsg(res, ""); + } + + return null; + } catch (Exception e) { + logger.error("修改用户失败", e); + outputMsg(res, ""); + 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 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 list = userService.getByQueryBean(queryBean , page); + req.setAttribute("page", page); + req.setAttribute("userList", rs); + return new ModelAndView("userList"); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/DataAnalysisDAO.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/DataAnalysisDAO.java new file mode 100644 index 000000000..d4e7d53cf --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/DataAnalysisDAO.java @@ -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 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> 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 result = new ArrayList(list.size()); + for(Map 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 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> 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 result = new ArrayList(list.size()); + for(Map 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 analysisByAllUser(String startSubmitTime, String endSubmitTime, List 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> 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 result = new ArrayList(list.size()); + for(Map 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 analysisByAllIssue(String startSubmitTime, String endSubmitTime, List 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> 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 result = new ArrayList(list.size()); + for(Map 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; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/FileDAO.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/FileDAO.java new file mode 100644 index 000000000..bcfdd1511 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/FileDAO.java @@ -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> 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}); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/JdbcBaseDao.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/JdbcBaseDao.java new file mode 100644 index 000000000..50d7f3ce9 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/JdbcBaseDao.java @@ -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结果集的List,List存放的是多个数据库列和值的Map + */ + public List queryForList(String sql, Object[] args) throws DataAccessException { + return getJdbcTemplate().queryForList(sql, args); + } + + /** + * 提供一个参数执行查询 + * @param sql + * @return + * @throws DataAccessException + *
    + *
  • 邹美亮,2008/01/08 PM,查询话单业务分类信息列表
  • + *
+ */ + 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; i0){ + 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; + } + + /** + * 获取含有CLOB、BLOB字段内容表数据 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 mapRs = new HashMap(); + 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 retMap = new HashMap(); + + 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); + } + + + + + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/MenuDAO.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/MenuDAO.java new file mode 100644 index 000000000..8d51b2e1d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/MenuDAO.java @@ -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 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 rs = null; + List> dbRs = getJdbcTemplate().queryForList(sql, new Object[]{groupId}); + if(null == dbRs || dbRs.isEmpty()) + { + return rs; + } + rs = new ArrayList(); + for(int i=0;i 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 list = getJdbcTemplate().queryForList(sql, params.toArray(), Project.class); + List 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)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> 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 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 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 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> 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 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 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 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 + }); + } + +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/StatisticsDAO.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/StatisticsDAO.java new file mode 100644 index 000000000..96027c065 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/StatisticsDAO.java @@ -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 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> list = getJdbcTemplate().queryForList(sql); + return list.get(0); + } + + /** + * 获取根据部门分组的时间利用率 + * 过滤大于20小时的不合法运行时间 + * 部门:F_DEPARTMENT + * 总时间:f_total_time + * 总运行时间:f_total_run_time + * @return + */ + public List> 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> list = getJdbcTemplate().queryForList(sql); + return list; + } + + /** + * 获取根据部门和年份分组的时间利用率 + * 过滤大于20小时的不合法运行时间 + * 部门:F_DEPARTMENT + * 年份:F_YEAR + * 总时间:f_total_time + * 总运行时间:f_total_run_time + * @return + */ + public List> 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> list = getJdbcTemplate().queryForList(sql); + return list; + } + + /** + * 统计完成数量 + * 过滤大于20小时的不合法运行时间 + * 月份:f_month + * 完成的项目数量:f_count + * @return + */ + public List> 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> list = getJdbcTemplate().queryForList(sql, new Object[] {year}); + return list; + } + + /** + * 获取所有年份 + * @return + */ + public List> 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> list = getJdbcTemplate().queryForList(sql); + return list; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/UserDAO.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/UserDAO.java new file mode 100644 index 000000000..e2cd5fd1c --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/dao/UserDAO.java @@ -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 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 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 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> 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 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> 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 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 getByDepartment(String department) + { + String sql = "SELECT * FROM T_USER T WHERE T.F_DEPARTMENT = ? "; + List> 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 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; + } +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/DataAnalysisBean.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/DataAnalysisBean.java new file mode 100644 index 000000000..3547d7974 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/DataAnalysisBean.java @@ -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; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/FileInfo.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/FileInfo.java new file mode 100644 index 000000000..285185bd7 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/FileInfo.java @@ -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; + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/MenuInfo.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/MenuInfo.java new file mode 100644 index 000000000..13fee74c4 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/MenuInfo.java @@ -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; + } + + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/Page.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/Page.java new file mode 100644 index 000000000..2402a35a2 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/Page.java @@ -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; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/Project.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/Project.java new file mode 100644 index 000000000..16a04928a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/Project.java @@ -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; + } +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/ProjectQueryBean.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/ProjectQueryBean.java new file mode 100644 index 000000000..b0aba3c41 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/ProjectQueryBean.java @@ -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; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/ProjectStage.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/ProjectStage.java new file mode 100644 index 000000000..7c71721f5 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/ProjectStage.java @@ -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; + } + + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/Result.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/Result.java new file mode 100644 index 000000000..1b416f353 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/Result.java @@ -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; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/UserInfo.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/UserInfo.java new file mode 100644 index 000000000..9a93369ae --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/UserInfo.java @@ -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; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/UserQueryBean.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/UserQueryBean.java new file mode 100644 index 000000000..6a565ed26 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/pojo/UserQueryBean.java @@ -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; + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/DataAnalysisService.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/DataAnalysisService.java new file mode 100644 index 000000000..429d963f1 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/DataAnalysisService.java @@ -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 analysisByProject(String projectName, String startSubmitTime, String endSubmitTime) { + return dataAnalysisDAO.analysisByProject(projectName, startSubmitTime, endSubmitTime) ; + + } + + public List analysisByUser(String userName, String startSubmitTime, String endSubmitTime) { + return dataAnalysisDAO.analysisByUser(userName, startSubmitTime, endSubmitTime) ; + } + + public List analysisByAllUser(String startSubmitTime, String endSubmitTime, List submitUsers) { + return dataAnalysisDAO.analysisByAllUser(startSubmitTime, endSubmitTime, submitUsers) ; + } + + public List analysisByAllIssue(String startSubmitTime, String endSubmitTime, List submitUsers) { + return dataAnalysisDAO.analysisByAllIssue(startSubmitTime, endSubmitTime, submitUsers) ; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/FileService.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/FileService.java new file mode 100644 index 000000000..388ac0367 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/FileService.java @@ -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 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 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); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/LoginService.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/LoginService.java new file mode 100644 index 000000000..2dfe65362 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/LoginService.java @@ -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)); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/MenuService.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/MenuService.java new file mode 100644 index 000000000..acc2ba827 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/MenuService.java @@ -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 getMenuByUser(UserInfo user) + { + return menuDAO.getByGroup(user.getGroupId()); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/ProjectService.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/ProjectService.java new file mode 100644 index 000000000..992c82ea0 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/ProjectService.java @@ -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> 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> 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 getProjectByStates(String[] states, Page page, ProjectQueryBean queryBean) + { + return this.projectDAO.getByStates(states, page, queryBean); + } + + public List 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 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> 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 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 getAllServers() { + return this.projectDAO.getAllServers(); + } + + public Project getProjectByServerState(String server, String state) + { + return this.projectDAO.getByServerState(server, state); + } + + public List 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); + } + +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/StatisticsService.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/StatisticsService.java new file mode 100644 index 000000000..72ce8a7bd --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/StatisticsService.java @@ -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 usage() { + return statisticsDAO.usage(); + } + + /** + * 获取根据部门分组的时间利用率 + * @return + */ + public List> usageGroupByDepartment(){ + return statisticsDAO.usageGroupByDepartment(); + } + + /** + * 获取根据部门和年份分组的时间利用率 + * @return + */ + public List> usageGroupByDepartmentAndYear(){ + return statisticsDAO.usageGroupByDepartmentAndYear(); + } + + /** + * 统计完成数量 + * 过滤大于20小时的不合法运行时间 + * 月份:f_month + * 完成的项目数量:f_count + * @return + */ + public List> countByMonth(String year){ + return statisticsDAO.countByMonth(year); + } + + /** + * 获取所有年份 + * @return + */ + public List> getAllYear(){ + return statisticsDAO.getAllYear(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/UserService.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/UserService.java new file mode 100644 index 000000000..c1a9fd5fe --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/service/UserService.java @@ -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 getAllUser(Page page) + { + return this.userDAO.getAll(page); + } + + public List 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 getByQueryBean(UserQueryBean queryBean, Page page) { + return this.userDAO.getByQueryBean(queryBean, page); + } + + public List getByQueryBean(UserQueryBean queryBean) { + return this.userDAO.getByQueryBean(queryBean); + } + + public List 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 submitUsers) { + return userDAO.checkProjectAndUsers(projectName, submitUsers); + } +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/FileUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/FileUtil.java new file mode 100644 index 000000000..fa712e4ef --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/FileUtil.java @@ -0,0 +1,6 @@ +package com.ruoyi.dfm.util; + + +public class FileUtil { + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/Md5Util.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/Md5Util.java new file mode 100644 index 000000000..dbfa3a74e --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/Md5Util.java @@ -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); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/PageUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/PageUtil.java new file mode 100644 index 000000000..4c8b15239 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/PageUtil.java @@ -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); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/PropertiesUtils.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/PropertiesUtils.java new file mode 100644 index 000000000..74a76550b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/PropertiesUtils.java @@ -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文件处理类 +* 类修改者 修改日期 +* 修改说明 +*

Title: PropertiesUtils.java

+*

Description:清大海辉科技开发平台

+*

Copyright: Copyright (c) 2006

+*

Company:北京清大海辉科技有限公司

+* @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; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/TimeUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/TimeUtil.java new file mode 100644 index 000000000..c123b689b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/util/TimeUtil.java @@ -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.Date,sql.Date,Calendar等)转换 + * 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")); + } +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/web/LoginFilter.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/web/LoginFilter.java new file mode 100644 index 000000000..b61eabb06 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/web/LoginFilter.java @@ -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; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index bca6ca82d..1ea1aca23 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -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; /** * 通用请求处理 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java index 5ab862046..dfe406053 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java @@ -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; /** * 表单相关 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java index c7544a325..5579fc794 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java @@ -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; /** * 操作控制 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java index 3ca31e823..62e8f0a70 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java @@ -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.*; /** * 表格相关 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/CustomerModel.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/CustomerModel.java index d1aebf2ba..48eafcfdf 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/CustomerModel.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/CustomerModel.java @@ -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; + /** * 客户测试信息 * diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/GoodsModel.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/GoodsModel.java index 897a010e6..860804c92 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/GoodsModel.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/GoodsModel.java @@ -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; + /** * 商品测试信息 * diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java index 3324cc7ca..300e14906 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java @@ -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; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java index b2647893c..1b393c4e5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java @@ -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 监控 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java index 764197d39..6b2af992e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java @@ -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; /** * 服务器监控 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java index 688c088b2..1abde3c06 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java @@ -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; /** * 系统访问记录 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java index 468866e18..0e770fbfc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java @@ -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; /** * 操作日志记录 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java index 8d17731a9..c5261695f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java @@ -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; /** * 在线用户监控 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java index 230cc3b29..c3969571c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java @@ -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; /** * 图片验证码(支持算术形式) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java index 1937c795f..4ab2d070b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java @@ -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; /** * 参数配置 信息操作处理 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index 91cb80ec9..5c3a5bf0d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -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; /** * 部门信息 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java index 945109858..197693e06 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java @@ -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; /** * 数据字典信息 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java index cde8ae798..126e1a6e0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java @@ -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; /** * 数据字典信息 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java index 28d4bf068..5ca720d5e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java @@ -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; /** * 首页 业务处理 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index 1652f74ef..e5812107f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -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; /** * 登录验证 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java index 3615c7599..4cc8f294b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java @@ -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; /** * 菜单信息 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java index 671dc11e3..2491aa9e2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java @@ -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; /** * 公告 信息操作处理 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java index d6db9fdf0..feb1058e2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java @@ -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; /** * 岗位信息操作处理 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java index f8a462dda..f9aa98d59 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -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; /** * 个人信息 业务处理 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java index a0f0a4848..f623274e5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java @@ -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; /** * 注册验证 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index 0f7379d1a..d69ee6466 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -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; /** * 角色信息 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index f5109d291..3d203c9df 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -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; /** * 用户信息 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java index 53ce0f1ba..3db84ef8e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java @@ -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 表单构建 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java index cfa748f30..7c339f123 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java @@ -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 接口 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java index bddbe7789..6fa6cdca4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java @@ -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 用户测试方法 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java index f0dad1cda..4775faf7f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java @@ -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; diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 399d48d0a..d54ce0147 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -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 # 从库数据源 diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/table/check.html b/ruoyi-admin/src/main/resources/templates/demo/modal/table/check.html index 80365d6ef..7984a9f3a 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/table/check.html +++ b/ruoyi-admin/src/main/resources/templates/demo/modal/table/check.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/table/parent.html b/ruoyi-admin/src/main/resources/templates/demo/modal/table/parent.html index 40019c7a9..00e9c6b8e 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/table/parent.html +++ b/ruoyi-admin/src/main/resources/templates/demo/modal/table/parent.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/table/radio.html b/ruoyi-admin/src/main/resources/templates/demo/modal/table/radio.html index 88c60d682..60c403eb2 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/table/radio.html +++ b/ruoyi-admin/src/main/resources/templates/demo/modal/table/radio.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/operate/other.html b/ruoyi-admin/src/main/resources/templates/demo/operate/other.html index ed0c55bbf..402307dc2 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/operate/other.html +++ b/ruoyi-admin/src/main/resources/templates/demo/operate/other.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/operate/table.html b/ruoyi-admin/src/main/resources/templates/demo/operate/table.html index 69297ec08..80d2dadd1 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/operate/table.html +++ b/ruoyi-admin/src/main/resources/templates/demo/operate/table.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/report/echarts.html b/ruoyi-admin/src/main/resources/templates/demo/report/echarts.html index 668aa2ce6..21f8e8f10 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/report/echarts.html +++ b/ruoyi-admin/src/main/resources/templates/demo/report/echarts.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/report/metrics.html b/ruoyi-admin/src/main/resources/templates/demo/report/metrics.html index 6493eed7a..6e21a544e 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/report/metrics.html +++ b/ruoyi-admin/src/main/resources/templates/demo/report/metrics.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/report/peity.html b/ruoyi-admin/src/main/resources/templates/demo/report/peity.html index 4ebbc17c8..293ba8d89 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/report/peity.html +++ b/ruoyi-admin/src/main/resources/templates/demo/report/peity.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/report/sparkline.html b/ruoyi-admin/src/main/resources/templates/demo/report/sparkline.html index 1e060a824..95d452377 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/report/sparkline.html +++ b/ruoyi-admin/src/main/resources/templates/demo/report/sparkline.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/button.html b/ruoyi-admin/src/main/resources/templates/demo/table/button.html index fb381901b..480ba03e9 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/button.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/button.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/child.html b/ruoyi-admin/src/main/resources/templates/demo/table/child.html index 8a50491f8..a9d576540 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/child.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/child.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/curd.html b/ruoyi-admin/src/main/resources/templates/demo/table/curd.html index ee7617729..139c428bd 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/curd.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/curd.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/data.html b/ruoyi-admin/src/main/resources/templates/demo/table/data.html index 818d5b7d1..6321dbade 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/data.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/data.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/detail.html b/ruoyi-admin/src/main/resources/templates/demo/table/detail.html index de12dbd8d..40b954147 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/detail.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/detail.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/editable.html b/ruoyi-admin/src/main/resources/templates/demo/table/editable.html index 3395e6d4e..7c515a6e8 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/editable.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/editable.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/event.html b/ruoyi-admin/src/main/resources/templates/demo/table/event.html index e3c8a6dc2..b4ad7a83e 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/event.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/event.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/export.html b/ruoyi-admin/src/main/resources/templates/demo/table/export.html index 82be299a5..23f72ee0f 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/export.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/export.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/fixedColumns.html b/ruoyi-admin/src/main/resources/templates/demo/table/fixedColumns.html index c93622a7b..5e3c7437d 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/fixedColumns.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/fixedColumns.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/footer.html b/ruoyi-admin/src/main/resources/templates/demo/table/footer.html index 0988f8d68..f812b251f 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/footer.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/footer.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/groupHeader.html b/ruoyi-admin/src/main/resources/templates/demo/table/groupHeader.html index 27d2b8d60..30fc1471a 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/groupHeader.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/groupHeader.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/image.html b/ruoyi-admin/src/main/resources/templates/demo/table/image.html index 32a1e0505..cc1e6814a 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/image.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/image.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/multi.html b/ruoyi-admin/src/main/resources/templates/demo/table/multi.html index a503ec95d..a0d1eef50 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/multi.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/multi.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/other.html b/ruoyi-admin/src/main/resources/templates/demo/table/other.html index d0f791b7f..898ddbd0b 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/other.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/other.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/pageGo.html b/ruoyi-admin/src/main/resources/templates/demo/table/pageGo.html index 32a95817c..69fb71187 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/pageGo.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/pageGo.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/params.html b/ruoyi-admin/src/main/resources/templates/demo/table/params.html index ba852f100..ba898e777 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/params.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/params.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/print.html b/ruoyi-admin/src/main/resources/templates/demo/table/print.html index fbf1f49f7..850c7d762 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/print.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/print.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/refresh.html b/ruoyi-admin/src/main/resources/templates/demo/table/refresh.html index 44fbb8878..0581d2703 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/refresh.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/refresh.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/remember.html b/ruoyi-admin/src/main/resources/templates/demo/table/remember.html index 4c0b9ec7e..ea0782848 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/remember.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/remember.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/reorder.html b/ruoyi-admin/src/main/resources/templates/demo/table/reorder.html index 8c40c4da9..6f7aa22c9 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/reorder.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/reorder.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/subdata.html b/ruoyi-admin/src/main/resources/templates/demo/table/subdata.html index 175e58c9e..18a490167 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/subdata.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/subdata.html @@ -1,5 +1,5 @@ - + diff --git a/ruoyi-admin/src/main/resources/templates/index_dfm.html b/ruoyi-admin/src/main/resources/templates/index_dfm.html new file mode 100644 index 000000000..f6e2e3686 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/index_dfm.html @@ -0,0 +1,316 @@ + + + + + + + 若依系统首页 + + + + + + + + + + + + +
+ + + + + + +
+ +
+ + + + 刷新 +
+ + + +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml index 498eb87b4..1da1c3598 100644 --- a/ruoyi-framework/pom.xml +++ b/ruoyi-framework/pom.xml @@ -28,6 +28,10 @@ org.springframework.boot spring-boot-starter-aop + + org.springframework.boot + spring-boot-starter-jdbc +