增加菜单编辑、选择图标功能,前端js封装,修复工作流程现存bug
This commit is contained in:
parent
f12fc486dc
commit
530db31b6e
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CheckStyle-IDEA">
|
||||
<option name="configuration">
|
||||
<map>
|
||||
<entry key="checkstyle-version" value="8.8" />
|
||||
<entry key="copy-libs" value="true" />
|
||||
<entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
|
||||
<entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
|
||||
<entry key="scan-before-checkin" value="false" />
|
||||
<entry key="scanscope" value="JavaOnly" />
|
||||
<entry key="suppress-errors" value="false" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectCodeStyleSettingsManager">
|
||||
<option name="PER_PROJECT_SETTINGS">
|
||||
<value />
|
||||
</option>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,6 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<excludeFromCompile>
|
||||
<file url="file://$PROJECT_DIR$/len-activiti/src/main/java/org/activiti/rest/diagram/services/BaseProcessDefinitionDiagramLayoutResource.java" />
|
||||
</excludeFromCompile>
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
|
||||
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/len-activiti" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/len-core" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/len-sys" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/len-web" charset="UTF-8" />
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,36 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="INNER_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="METHOD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="FIELD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IGNORE_DEPRECATED" value="false" />
|
||||
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||
<option name="myAdditionalJavadocTags" value="date" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
|
@ -0,0 +1,13 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: junit:junit:3.8.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/3.8.1/junit-3.8.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/3.8.1/junit-3.8.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/3.8.1/junit-3.8.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$/len-web" />
|
||||
<file type="web" url="file://$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
|
|
|
@ -5,14 +5,16 @@
|
|||
<artifactId>lenosp</artifactId>
|
||||
<groupId>com.len</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>len-activiti</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<name>len-activiti</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<!-- <packaging>war</packaging>-->
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ListenUserRole {
|
|||
* 明确切入方法的参数
|
||||
* @param joinPoint
|
||||
*/
|
||||
@Around("execution(com.len.util.JsonUtil com.len.controller.UserController.updateUser(..))")
|
||||
@Around("execution(com.len.util.JsonUtil com.len.controller.UserController.updateUser(*,String[]))")
|
||||
public Object listenerUserUpdate(ProceedingJoinPoint joinPoint){
|
||||
Object o=new Object();
|
||||
try{
|
||||
|
@ -72,7 +72,7 @@ public class ListenUserRole {
|
|||
* 新增用户监听 同步工作流用户表 环绕注解能得到 插入用户id 啊哈哈
|
||||
* @param joinPoint
|
||||
*/
|
||||
@Around("execution(java.lang.String com.len.controller.UserController.addUser(..))")
|
||||
@Around("execution(com.len.util.JsonUtil com.len.controller.UserController.addUser(*,String[]))")
|
||||
public Object listenerUserInsert(ProceedingJoinPoint joinPoint){
|
||||
Object o=new Object();
|
||||
try{
|
||||
|
@ -126,7 +126,7 @@ public class ListenUserRole {
|
|||
identityService.deleteMembership(user.getId(),roleId);
|
||||
}
|
||||
//再次关联
|
||||
if(strings!=null){
|
||||
if(!strings.isEmpty()){
|
||||
for(String roleId:strings){
|
||||
identityService.createMembership(user.getId(),roleId);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class ListenUserRole {
|
|||
|
||||
|
||||
/**********************角色处理begin***************************/
|
||||
@Around("execution(com.len.util.JsonUtil com.len.controller.RoleController.addRole(..))")
|
||||
@Around("execution(com.len.util.JsonUtil com.len.controller.RoleController.addRole(*,String[]))")
|
||||
public Object listenRoleInsert(ProceedingJoinPoint joinPoint){
|
||||
Object o=null;
|
||||
try{
|
||||
|
@ -156,7 +156,7 @@ public class ListenUserRole {
|
|||
return o;
|
||||
}
|
||||
|
||||
@Around("execution(com.len.util.JsonUtil com.len.controller.RoleController.updateUser(..))")
|
||||
@Around("execution(com.len.util.JsonUtil com.len.controller.RoleController.updateUser(*,String[]))")
|
||||
public Object listenRoleUpdate(ProceedingJoinPoint joinPoint){
|
||||
Object o=null;
|
||||
try{
|
||||
|
|
|
@ -38,6 +38,8 @@ public class ActivitiConfig {
|
|||
//指定数据库
|
||||
processEngineConfiguration.setDatabaseType("mysql");
|
||||
processEngineConfiguration.setTransactionManager(transactionManager);
|
||||
//历史变量
|
||||
processEngineConfiguration.setHistory("full");
|
||||
//指定字体
|
||||
processEngineConfiguration.setActivityFontName("宋体");
|
||||
processEngineConfiguration.setAnnotationFontName("宋体");
|
||||
|
|
|
@ -272,10 +272,6 @@ public class ActivitiController extends BaseController {
|
|||
String convertToXML = new String(bpmnBytes);
|
||||
|
||||
System.out.println(convertToXML);
|
||||
/*String str="d:\\"+processName;
|
||||
FileOutputStream stream=new FileOutputStream(str);
|
||||
stream.write(bpmnBytes);
|
||||
stream.close();*/
|
||||
Deployment deployment = repositoryService.createDeployment()
|
||||
.name(modelData.getName())
|
||||
.addString(processName, new String(bpmnBytes, "UTF-8"))
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.len.base.BaseController;
|
|||
import com.len.base.CurrentUser;
|
||||
import com.len.core.shiro.ShiroUtil;
|
||||
import com.len.entity.LeaveOpinion;
|
||||
import com.len.entity.SysUser;
|
||||
import com.len.entity.UserLeave;
|
||||
import com.len.exception.MyException;
|
||||
import com.len.service.UserLeaveService;
|
||||
|
@ -15,7 +14,6 @@ import com.len.util.BeanUtil;
|
|||
import com.len.util.CommonUtil;
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.ReType;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
@ -24,27 +22,24 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.engine.IdentityService;
|
||||
import org.activiti.engine.ProcessEngineConfiguration;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.*;
|
||||
import org.activiti.engine.history.HistoricActivityInstance;
|
||||
import org.activiti.engine.history.HistoricDetail;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.history.HistoricVariableUpdate;
|
||||
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.activiti.engine.impl.context.Context;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.activiti.engine.task.TaskInfo;
|
||||
import org.activiti.image.ProcessDiagramGenerator;
|
||||
import org.activiti.spring.ProcessEngineFactoryBean;
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
@ -84,6 +79,8 @@ public class UserLeaveController extends BaseController {
|
|||
@Autowired
|
||||
ProcessEngineConfiguration processEngineConfiguration;
|
||||
|
||||
private String leaveOpinionList="leaveOpinionList";
|
||||
|
||||
|
||||
@GetMapping(value = "showLeave")
|
||||
public String showUser(Model model) {
|
||||
|
@ -127,17 +124,30 @@ public class UserLeaveController extends BaseController {
|
|||
.processInstanceId(processId).singleResult();
|
||||
//保证运行ing
|
||||
List<LeaveOpinion> leaveList=null;
|
||||
List<HistoricActivityInstance> historicActivityInstanceList=new ArrayList<>();
|
||||
if(instance!=null){
|
||||
Task task = this.taskService.createTaskQuery().processInstanceId(processId).singleResult();
|
||||
Map<String, Object> variables = taskService.getVariables(task.getId());
|
||||
Object o = variables.get("leaveOpinionList");
|
||||
Object o = variables.get(leaveOpinionList);
|
||||
if(o!=null){
|
||||
/**获取历史审核信息*/
|
||||
/*获取历史审核信息*/
|
||||
leaveList= ( List<LeaveOpinion>) o;
|
||||
}
|
||||
}else{
|
||||
leaveList=new ArrayList<>();
|
||||
List<HistoricDetail> list = historyService.createHistoricDetailQuery().
|
||||
processInstanceId(processId).list();
|
||||
HistoricVariableUpdate variable=null;
|
||||
for(HistoricDetail historicDetail:list){
|
||||
variable= (HistoricVariableUpdate) historicDetail;
|
||||
String variableName = variable.getVariableName();
|
||||
if(leaveOpinionList.equals(variable.getVariableName())){
|
||||
leaveList.clear();
|
||||
leaveList.addAll((List<LeaveOpinion>)variable.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
String s=JSON.toJSONString(leaveList);
|
||||
model.addAttribute("leaveDetail",JSON.toJSONString(leaveList));
|
||||
model.addAttribute("leaveDetail",JSON.toJSONString(leaveList));
|
||||
return "/act/leave/leaveDetail";
|
||||
}
|
||||
|
||||
|
@ -189,7 +199,7 @@ public class UserLeaveController extends BaseController {
|
|||
public JsonUtil addLeave(Model model,UserLeave userLeave){
|
||||
JsonUtil j=new JsonUtil();
|
||||
if(userLeave==null){
|
||||
return j.error("获取数据失败");
|
||||
return JsonUtil.error("获取数据失败");
|
||||
}
|
||||
userLeave.setDays(3);
|
||||
CurrentUser user = CommonUtil.getUser();
|
||||
|
@ -273,17 +283,19 @@ public class UserLeaveController extends BaseController {
|
|||
map.put("flag",op.isFlag());
|
||||
//审批信息叠加
|
||||
List<LeaveOpinion> leaveList=new ArrayList<>();
|
||||
Object o = variables.get("leaveOpinionList");
|
||||
Object o = variables.get(leaveOpinionList);
|
||||
if(o!=null){
|
||||
leaveList= (List<LeaveOpinion>) o;
|
||||
}
|
||||
leaveList.add(op);
|
||||
map.put("leaveOpinionList",leaveList);
|
||||
map.put(leaveOpinionList,leaveList);
|
||||
j.setMsg("审核成功"+(op.isFlag()?"<font style='color:green'>[通过]</font>":"<font style='color:red'>[未通过]</font>"));
|
||||
taskService.complete(op.getTaskId(),map);
|
||||
return j;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
HistoryService historyService;
|
||||
/**
|
||||
* 追踪图片成图
|
||||
* @param request
|
||||
|
@ -295,19 +307,35 @@ public class UserLeaveController extends BaseController {
|
|||
public void getProcImage(HttpServletRequest request, HttpServletResponse resp,String processInstanceId)
|
||||
throws IOException {
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
if(processInstance==null){
|
||||
HistoricProcessInstance historicProcessInstance =
|
||||
historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
String processDefinitionId=null;
|
||||
List<String> executedActivityIdList = new ArrayList<String>();
|
||||
if(processInstance!=null){
|
||||
processDefinitionId=processInstance.getProcessDefinitionId();
|
||||
executedActivityIdList=this.runtimeService.getActiveActivityIds(processInstance.getId());
|
||||
}else if(historicProcessInstance!=null){
|
||||
processDefinitionId=historicProcessInstance.getProcessDefinitionId();
|
||||
List<HistoricActivityInstance> historicActivityInstanceList =
|
||||
historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).orderByHistoricActivityInstanceId().asc().list();
|
||||
for (HistoricActivityInstance activityInstance : historicActivityInstanceList) {
|
||||
executedActivityIdList.add(activityInstance.getActivityId());
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isEmpty(processDefinitionId)||executedActivityIdList.isEmpty()){
|
||||
return;
|
||||
}
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId());
|
||||
List<String> activeActivityIds = runtimeService.getActiveActivityIds(processInstanceId);
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
|
||||
//List<String> activeActivityIds = runtimeService.getActiveActivityIds(processInstanceId);
|
||||
processEngineConfiguration = processEngine.getProcessEngineConfiguration();
|
||||
Context.setProcessEngineConfiguration((ProcessEngineConfigurationImpl) processEngineConfiguration);
|
||||
ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
|
||||
List<String> activeIds = this.runtimeService.getActiveActivityIds(processInstance.getId());
|
||||
//List<String> activeIds = this.runtimeService.getActiveActivityIds(processInstance.getId());
|
||||
|
||||
InputStream imageStream=diagramGenerator.generateDiagram(
|
||||
bpmnModel, "png",
|
||||
activeIds, Collections.<String>emptyList(),
|
||||
executedActivityIdList, Collections.<String>emptyList(),
|
||||
processEngine.getProcessEngineConfiguration().getActivityFontName(),
|
||||
processEngine.getProcessEngineConfiguration().getLabelFontName(),
|
||||
"宋体",
|
||||
|
|
|
@ -15,7 +15,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
</head>
|
||||
|
|
|
@ -15,7 +15,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
</head>
|
||||
|
@ -86,7 +86,8 @@ To change this template use File | Settings | File Templates.-->
|
|||
,layer = layui.layer
|
||||
,laydate = layui.laydate;
|
||||
var d = new Date();
|
||||
var day=d.getFullYear()+"-"+d.getMonth()+1+'-'+d.getDate();
|
||||
var day=d.getFullYear()+"-"+(parseInt(d.getMonth())+1)+'-'+d.getDate();
|
||||
console.log(day);
|
||||
var $ = layui.$, active = {
|
||||
close: function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<meta name="viewport"
|
||||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/lenos/main.css"/>
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
|
|
|
@ -90,7 +90,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
,layer = layui.layer
|
||||
,laydate = layui.laydate;
|
||||
var d = new Date();
|
||||
var day=d.getFullYear()+"-"+d.getMonth()+1+'-'+d.getDate();
|
||||
var day=d.getFullYear()+"-"+(parseInt(d.getMonth())+1)+'-'+d.getDate();
|
||||
var $ = layui.$, active = {
|
||||
close: function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
|
|
|
@ -15,7 +15,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
</head>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/lenos/main.css">
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
</head>
|
||||
|
@ -48,6 +48,7 @@
|
|||
{{# }else{ }}
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="handle"><i class="layui-icon"></i>办理</a>
|
||||
{{# } }}
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="leaveDetail"><i class="layui-icon"></i>查看详情</a>
|
||||
</script>
|
||||
<script>
|
||||
layui.laytpl.toDateString = function(d, format){
|
||||
|
@ -156,6 +157,18 @@
|
|||
popup('办理','agent/'+data.id,700,500,'task-agent');
|
||||
}else if(obj.event === 'update'){
|
||||
popup('编辑','updateLeave/'+data.id,700,500,'task-update');
|
||||
}else if(obj.event==='leaveDetail'){
|
||||
layer.open({
|
||||
id: 'leave-detail',
|
||||
type: 2,
|
||||
area: [ '880px', '400px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '审核详情',
|
||||
content: "/leave/leaveDetail?processId="+data.processInstanceId
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/lenos/main.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
|
@ -109,8 +109,8 @@
|
|||
, {field: 'id', title: '编号', width: '15%', sort: true}
|
||||
, {field: 'name', title: '流程名称', width: '10%', sort: true}
|
||||
, {field: 'key', title: 'key', width: '12%', sort: true}
|
||||
, {field: 'deploymentId', title: '部署id', width: '10%', sort: true}
|
||||
, {field: 'diagramResourceName', title: '流程图资源', width: '20%', sort: true}
|
||||
, {field: 'deploymentId', title: '部署id', width: '5%', sort: true}
|
||||
, {field: 'diagramResourceName', title: '流程图资源', width: '15%', sort: true}
|
||||
, {field: 'category', title: '版本', width: '15%', sort: true}
|
||||
, {field: 'resourceName', title: '资源名称', width: '10%', sort: true}
|
||||
, {field: 'text', title: '操作', width: '10%', toolbar:'#toolBar'}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/lenos/main.css"/>
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
|
@ -237,7 +237,7 @@
|
|||
type: "post",
|
||||
data: {id: id},
|
||||
dataType: "json", traditional: true,
|
||||
success: function d(ata) {
|
||||
success: function d(data) {
|
||||
layer.msg(data.msg, {icon: 6});
|
||||
layui.table.reload('actModelList');
|
||||
}
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
SELECT <include refid="Base_Column_List"/>
|
||||
from user_leave
|
||||
<where>
|
||||
<if test="userId!=null and userId!=''">and user_id=#{userId}</if>
|
||||
<if test="beginTime!=null">
|
||||
<![CDATA[ and DATE_FORMAT(begin_time, '%Y-%m-%d')>= DATE_FORMAT(#{beginTime}, '%Y-%m-%d') ]]>
|
||||
</if>
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
<artifactId>lenosp</artifactId>
|
||||
<groupId>com.len</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>len-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<packaging>war</packaging>
|
||||
|
||||
|
||||
<name>len-core</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
@ -25,10 +27,5 @@
|
|||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.len.util;
|
|||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import net.minidev.json.JSONUtil;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
|
|
|
@ -5,14 +5,15 @@
|
|||
<artifactId>lenosp</artifactId>
|
||||
<groupId>com.len</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>len-sys</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>len-sys</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.len.controller;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
|
@ -17,17 +18,17 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
@RequestMapping(value = "/error")
|
||||
public class ErrorController {
|
||||
|
||||
@GetMapping(value = "404")
|
||||
public String pageNotFound(){
|
||||
return "error/404";
|
||||
}
|
||||
|
||||
@GetMapping(value = "403")
|
||||
public String NotFound(String message,Model model){
|
||||
if(!StringUtils.isEmpty(message)){
|
||||
model.addAttribute("message",message);
|
||||
@GetMapping(value = "404")
|
||||
public String pageNotFound() {
|
||||
return "error/404";
|
||||
}
|
||||
|
||||
@GetMapping(value = "403")
|
||||
public String NotFound(String message, Model model) {
|
||||
if (!StringUtils.isEmpty(message)) {
|
||||
model.addAttribute("message", message);
|
||||
}
|
||||
return "error/403";
|
||||
}
|
||||
return "error/403";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,9 @@ import com.len.util.BeanUtil;
|
|||
import com.len.util.Checkbox;
|
||||
import com.len.util.JsonUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -27,177 +29,177 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
* @author zhuxiaomeng
|
||||
* @date 2018/1/6.
|
||||
* @email 154040976@qq.com
|
||||
*
|
||||
* <p>
|
||||
* 定时任务 controller
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/job")
|
||||
public class JobController extends BaseController<SysJob> {
|
||||
|
||||
@Autowired
|
||||
JobService jobService;
|
||||
@Autowired
|
||||
JobService jobService;
|
||||
|
||||
@Autowired
|
||||
JobTask jobTask;
|
||||
@Autowired
|
||||
JobTask jobTask;
|
||||
|
||||
@GetMapping(value = "showJob")
|
||||
@RequiresPermissions("job:show")
|
||||
public String showUser(Model model) {
|
||||
return "/system/job/jobList";
|
||||
}
|
||||
|
||||
@GetMapping(value = "showJobList")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("job:show")
|
||||
public String showUser(Model model, SysJob job, String page, String limit) {
|
||||
return jobService.show(job,Integer.valueOf(page),Integer.valueOf(limit));
|
||||
}
|
||||
|
||||
@GetMapping(value = "showAddJob")
|
||||
public String addJob(Model model) {
|
||||
return "/system/job/add-job";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "/addJob", httpMethod = "POST", notes = "添加任务类")
|
||||
@Log(desc = "添加任务")
|
||||
@PostMapping(value = "addJob")
|
||||
@ResponseBody
|
||||
public JsonUtil addJob(SysJob job) {
|
||||
JsonUtil j=new JsonUtil();
|
||||
String msg="保存成功";
|
||||
job.setStatus(false);
|
||||
try {
|
||||
jobService.insertSelective(job);
|
||||
}catch (MyException e){
|
||||
msg="保存失败";
|
||||
j.setFlag(false);
|
||||
e.printStackTrace();
|
||||
@GetMapping(value = "showJob")
|
||||
@RequiresPermissions("job:show")
|
||||
public String showUser(Model model) {
|
||||
return "/system/job/jobList";
|
||||
}
|
||||
j.setMsg(msg);
|
||||
return j;
|
||||
}
|
||||
|
||||
@GetMapping(value = "updateJob")
|
||||
public String updateJob(String id, Model model, boolean detail) {
|
||||
if (StringUtils.isNotEmpty(id)) {
|
||||
SysJob job = jobService.selectByPrimaryKey(id);
|
||||
model.addAttribute("job", job);
|
||||
@GetMapping(value = "showJobList")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("job:show")
|
||||
public String showUser(Model model, SysJob job, String page, String limit) {
|
||||
return jobService.show(job, Integer.valueOf(page), Integer.valueOf(limit));
|
||||
}
|
||||
model.addAttribute("detail", detail);
|
||||
return "system/job/update-job";
|
||||
}
|
||||
|
||||
@GetMapping(value = "showAddJob")
|
||||
public String addJob(Model model) {
|
||||
return "/system/job/add-job";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "/updateJob", httpMethod = "POST", notes = "更新任务")
|
||||
@Log(desc = "更新任务",type = LOG_TYPE.UPDATE)
|
||||
@PostMapping(value = "updateJob")
|
||||
@ResponseBody
|
||||
public JsonUtil updateJob(SysJob job){
|
||||
JsonUtil j=new JsonUtil();
|
||||
j.setFlag(false);
|
||||
if (job == null) {
|
||||
j.setMsg("获取数据失败");
|
||||
return j;
|
||||
}
|
||||
if(jobTask.checkJob(job)){
|
||||
j.setMsg("已经启动任务无法更新,请停止后更新");
|
||||
return j;
|
||||
}
|
||||
try{
|
||||
SysJob oldJob=jobService.selectByPrimaryKey(job.getId());
|
||||
BeanUtil.copyNotNullBean(job, oldJob);
|
||||
jobService.updateByPrimaryKey(oldJob);
|
||||
j.setFlag(true);
|
||||
j.setMsg("修改成功");
|
||||
}catch (MyException e){
|
||||
j.setMsg("更新失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
@Log(desc = "删除任务",type = LOG_TYPE.DEL)
|
||||
@ApiOperation(value = "/del", httpMethod = "POST", notes = "删除任务")
|
||||
@PostMapping(value = "del")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("job:del")
|
||||
public JsonUtil del(String id){
|
||||
JsonUtil j=new JsonUtil();
|
||||
j.setFlag(false);
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
j.setMsg("获取数据失败");
|
||||
return j;
|
||||
}
|
||||
try{
|
||||
SysJob job=jobService.selectByPrimaryKey(id);
|
||||
boolean flag=jobTask.checkJob(job);
|
||||
if((flag&&!job.getStatus())||!flag&&job.getStatus()){
|
||||
j.setMsg("您任务表状态和web任务状态不一致,无法删除");
|
||||
@ApiOperation(value = "/addJob", httpMethod = "POST", notes = "添加任务类")
|
||||
@Log(desc = "添加任务")
|
||||
@PostMapping(value = "addJob")
|
||||
@ResponseBody
|
||||
public JsonUtil addJob(SysJob job) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
String msg = "保存成功";
|
||||
job.setStatus(false);
|
||||
try {
|
||||
jobService.insertSelective(job);
|
||||
} catch (MyException e) {
|
||||
msg = "保存失败";
|
||||
j.setFlag(false);
|
||||
e.printStackTrace();
|
||||
}
|
||||
j.setMsg(msg);
|
||||
return j;
|
||||
}
|
||||
if(flag){
|
||||
j.setMsg("该任务处于启动中,无法删除");
|
||||
}
|
||||
|
||||
@GetMapping(value = "updateJob")
|
||||
public String updateJob(String id, Model model, boolean detail) {
|
||||
if (StringUtils.isNotEmpty(id)) {
|
||||
SysJob job = jobService.selectByPrimaryKey(id);
|
||||
model.addAttribute("job", job);
|
||||
}
|
||||
model.addAttribute("detail", detail);
|
||||
return "system/job/update-job";
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "/updateJob", httpMethod = "POST", notes = "更新任务")
|
||||
@Log(desc = "更新任务", type = LOG_TYPE.UPDATE)
|
||||
@PostMapping(value = "updateJob")
|
||||
@ResponseBody
|
||||
public JsonUtil updateJob(SysJob job) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
j.setFlag(false);
|
||||
if (job == null) {
|
||||
j.setMsg("获取数据失败");
|
||||
return j;
|
||||
}
|
||||
if (jobTask.checkJob(job)) {
|
||||
j.setMsg("已经启动任务无法更新,请停止后更新");
|
||||
return j;
|
||||
}
|
||||
try {
|
||||
SysJob oldJob = jobService.selectByPrimaryKey(job.getId());
|
||||
BeanUtil.copyNotNullBean(job, oldJob);
|
||||
jobService.updateByPrimaryKey(oldJob);
|
||||
j.setFlag(true);
|
||||
j.setMsg("修改成功");
|
||||
} catch (MyException e) {
|
||||
j.setMsg("更新失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
@Log(desc = "删除任务", type = LOG_TYPE.DEL)
|
||||
@ApiOperation(value = "/del", httpMethod = "POST", notes = "删除任务")
|
||||
@PostMapping(value = "del")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("job:del")
|
||||
public JsonUtil del(String id) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
j.setFlag(false);
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
j.setMsg("获取数据失败");
|
||||
return j;
|
||||
}
|
||||
try {
|
||||
SysJob job = jobService.selectByPrimaryKey(id);
|
||||
boolean flag = jobTask.checkJob(job);
|
||||
if ((flag && !job.getStatus()) || !flag && job.getStatus()) {
|
||||
j.setMsg("您任务表状态和web任务状态不一致,无法删除");
|
||||
return j;
|
||||
}
|
||||
if (flag) {
|
||||
j.setMsg("该任务处于启动中,无法删除");
|
||||
return j;
|
||||
}
|
||||
jobService.deleteByPrimaryKey(id);
|
||||
j.setFlag(true);
|
||||
j.setMsg("任务删除成功");
|
||||
} catch (MyException e) {
|
||||
j.setMsg("任务删除异常");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
jobService.deleteByPrimaryKey(id);
|
||||
j.setFlag(true);
|
||||
j.setMsg("任务删除成功");
|
||||
}catch (MyException e){
|
||||
j.setMsg("任务删除异常");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
@Log(desc = "启动任务")
|
||||
@PostMapping(value = "startJob")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("job:start")
|
||||
public JsonUtil startJob(String id){
|
||||
JsonUtil j=new JsonUtil();
|
||||
String msg=null;
|
||||
if(StringUtils.isEmpty(id)){
|
||||
j.setMsg("获取数据失败");
|
||||
j.setFlag(false);
|
||||
return j;
|
||||
@Log(desc = "启动任务")
|
||||
@PostMapping(value = "startJob")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("job:start")
|
||||
public JsonUtil startJob(String id) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
String msg = null;
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
j.setMsg("获取数据失败");
|
||||
j.setFlag(false);
|
||||
return j;
|
||||
}
|
||||
try {
|
||||
SysJob job = jobService.selectByPrimaryKey(id);
|
||||
jobTask.startJob(job);
|
||||
job.setStatus(true);
|
||||
jobService.updateByPrimaryKey(job);
|
||||
msg = "启动成功";
|
||||
} catch (MyException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
j.setMsg(msg);
|
||||
return j;
|
||||
}
|
||||
try {
|
||||
SysJob job = jobService.selectByPrimaryKey(id);
|
||||
jobTask.startJob(job);
|
||||
job.setStatus(true);
|
||||
jobService.updateByPrimaryKey(job);
|
||||
msg="启动成功";
|
||||
}catch (MyException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
j.setMsg(msg);
|
||||
return j;
|
||||
}
|
||||
|
||||
@Log(desc = "停止任务")
|
||||
@PostMapping(value = "endJob")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("job:end")
|
||||
public JsonUtil endJob(String id){
|
||||
JsonUtil j=new JsonUtil();
|
||||
String msg=null;
|
||||
if(StringUtils.isEmpty(id)){
|
||||
j.setMsg("获取数据失败");
|
||||
j.setFlag(false);
|
||||
return j;
|
||||
@Log(desc = "停止任务")
|
||||
@PostMapping(value = "endJob")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("job:end")
|
||||
public JsonUtil endJob(String id) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
String msg = null;
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
j.setMsg("获取数据失败");
|
||||
j.setFlag(false);
|
||||
return j;
|
||||
}
|
||||
try {
|
||||
SysJob job = jobService.selectByPrimaryKey(id);
|
||||
jobTask.remove(job);
|
||||
job.setStatus(false);
|
||||
jobService.updateByPrimaryKey(job);
|
||||
msg = "停止成功";
|
||||
} catch (MyException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
j.setMsg(msg);
|
||||
return j;
|
||||
}
|
||||
try {
|
||||
SysJob job = jobService.selectByPrimaryKey(id);
|
||||
jobTask.remove(job);
|
||||
job.setStatus(false);
|
||||
jobService.updateByPrimaryKey(job);
|
||||
msg="停止成功";
|
||||
}catch (MyException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
j.setMsg(msg);
|
||||
return j;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ import com.len.exception.MyException;
|
|||
import com.len.mapper.SysLogMapper;
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.ReType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -23,23 +25,24 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
* @author zhuxiaomeng
|
||||
* @date 2017/12/29.
|
||||
* @email 154040976@qq.com
|
||||
*
|
||||
* <p>
|
||||
* 日志监控
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "/log")
|
||||
public class LogController extends BaseController{
|
||||
private static final Logger logger= Logger.getLogger(LogController.class);
|
||||
public class LogController extends BaseController {
|
||||
private static final Logger logger = Logger.getLogger(LogController.class);
|
||||
@Autowired
|
||||
private SysLogMapper logMapper;
|
||||
|
||||
@GetMapping(value = "showLog")
|
||||
public String showMenu(Model model){
|
||||
public String showMenu(Model model) {
|
||||
return "/system/log/logList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志监控
|
||||
*
|
||||
* @param sysLog
|
||||
* @param page
|
||||
* @param limit
|
||||
|
@ -47,35 +50,37 @@ public class LogController extends BaseController{
|
|||
*/
|
||||
@GetMapping(value = "showLogList")
|
||||
@ResponseBody
|
||||
public String showLog(SysLog sysLog, String page, String limit){
|
||||
List<SysLog> tList=null;
|
||||
Page<SysLog> tPage= PageHelper.startPage(Integer.valueOf(page),Integer.valueOf(limit));
|
||||
try{
|
||||
tList=logMapper.selectListByPage(sysLog);
|
||||
}catch (MyException e){
|
||||
logger.error("class:LogController ->method:showLog->message:"+e.getMessage());
|
||||
public String showLog(SysLog sysLog, String page, String limit) {
|
||||
List<SysLog> tList = null;
|
||||
Page<SysLog> tPage = PageHelper.startPage(Integer.valueOf(page), Integer.valueOf(limit));
|
||||
try {
|
||||
tList = logMapper.selectListByPage(sysLog);
|
||||
} catch (MyException e) {
|
||||
logger.error("class:LogController ->method:showLog->message:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
ReType reType=new ReType(tPage.getTotal(),tList);
|
||||
ReType reType = new ReType(tPage.getTotal(), tList);
|
||||
return JSON.toJSONString(reType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除log
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "del")
|
||||
@ResponseBody
|
||||
public JsonUtil del(String[] ids){
|
||||
JsonUtil j=new JsonUtil();
|
||||
String msg="删除成功";
|
||||
try{
|
||||
for(String id:ids)
|
||||
logMapper.deleteByPrimaryKey(Integer.valueOf(id));
|
||||
}catch (MyException e){
|
||||
msg="删除失败";
|
||||
logger.error(msg+e.getMessage());
|
||||
public JsonUtil del(String[] ids) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
String msg = "删除成功";
|
||||
try {
|
||||
for (String id : ids) {
|
||||
logMapper.deleteByPrimaryKey(Integer.valueOf(id));
|
||||
}
|
||||
} catch (MyException e) {
|
||||
msg = "删除失败";
|
||||
logger.error(msg + e.getMessage());
|
||||
}
|
||||
j.setMsg(msg);
|
||||
return j;
|
||||
|
|
|
@ -12,12 +12,14 @@ import com.len.service.MenuService;
|
|||
import com.len.service.SysUserService;
|
||||
import com.len.util.VerifyCodeUtils;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.ExcessiveAttemptsException;
|
||||
import org.apache.shiro.authc.IncorrectCredentialsException;
|
||||
|
@ -46,130 +48,132 @@ import org.springframework.web.bind.annotation.ResponseStatus;
|
|||
@Controller
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
private SysUserService userService;
|
||||
@Autowired
|
||||
private SysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@GetMapping(value = "")
|
||||
public String loginInit(){
|
||||
return loginCheck();
|
||||
}
|
||||
@GetMapping(value = "goLogin")
|
||||
public String goLogin(Model model,ServletRequest request){
|
||||
Subject sub=SecurityUtils.getSubject();
|
||||
if(sub.isAuthenticated()){
|
||||
return "/main/main";
|
||||
}else{
|
||||
model.addAttribute("message","请重新登录");
|
||||
return "/login";
|
||||
@GetMapping(value = "")
|
||||
public String loginInit() {
|
||||
return loginCheck();
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping(value = "/login")
|
||||
public String loginCheck(){
|
||||
Subject sub=SecurityUtils.getSubject();
|
||||
Boolean flag2=sub.isRemembered();
|
||||
boolean flag=sub.isAuthenticated()||flag2;
|
||||
Session session=sub.getSession();
|
||||
if(flag){
|
||||
return "/main/main";
|
||||
@GetMapping(value = "goLogin")
|
||||
public String goLogin(Model model, ServletRequest request) {
|
||||
Subject sub = SecurityUtils.getSubject();
|
||||
if (sub.isAuthenticated()) {
|
||||
return "/main/main";
|
||||
} else {
|
||||
model.addAttribute("message", "请重新登录");
|
||||
return "/login";
|
||||
}
|
||||
}
|
||||
return "/login";
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录动作
|
||||
* @param user
|
||||
* @param model
|
||||
* @param rememberMe
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "/login", httpMethod = "POST", notes = "登录method")
|
||||
@PostMapping(value = "/login")
|
||||
public String login(SysUser user,Model model,String rememberMe,HttpServletRequest request){
|
||||
String codeMsg = (String)request.getAttribute("shiroLoginFailure");
|
||||
if("code.error".equals(codeMsg)){
|
||||
model.addAttribute("message","验证码错误");
|
||||
return "/login";
|
||||
@GetMapping(value = "/login")
|
||||
public String loginCheck() {
|
||||
Subject sub = SecurityUtils.getSubject();
|
||||
Boolean flag2 = sub.isRemembered();
|
||||
boolean flag = sub.isAuthenticated() || flag2;
|
||||
Session session = sub.getSession();
|
||||
if (flag) {
|
||||
return "/main/main";
|
||||
}
|
||||
return "/login";
|
||||
}
|
||||
UsernamePasswordToken token = new UsernamePasswordToken(user.getUsername().trim(),
|
||||
user.getPassword());
|
||||
Subject subject = ShiroUtil.getSubject();
|
||||
String msg=null;
|
||||
try{
|
||||
subject.login(token);
|
||||
//subject.hasRole("admin");
|
||||
if(subject.isAuthenticated()){
|
||||
return "/main/main";
|
||||
}
|
||||
}catch (UnknownAccountException e) {
|
||||
msg = "用户名/密码错误";
|
||||
} catch (IncorrectCredentialsException e) {
|
||||
msg = "用户名/密码错误";
|
||||
} catch (ExcessiveAttemptsException e) {
|
||||
msg = "登录失败多次,账户锁定10分钟";
|
||||
|
||||
/**
|
||||
* 登录动作
|
||||
*
|
||||
* @param user
|
||||
* @param model
|
||||
* @param rememberMe
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "/login", httpMethod = "POST", notes = "登录method")
|
||||
@PostMapping(value = "/login")
|
||||
public String login(SysUser user, Model model, String rememberMe, HttpServletRequest request) {
|
||||
String codeMsg = (String) request.getAttribute("shiroLoginFailure");
|
||||
if ("code.error".equals(codeMsg)) {
|
||||
model.addAttribute("message", "验证码错误");
|
||||
return "/login";
|
||||
}
|
||||
UsernamePasswordToken token = new UsernamePasswordToken(user.getUsername().trim(),
|
||||
user.getPassword());
|
||||
Subject subject = ShiroUtil.getSubject();
|
||||
String msg = null;
|
||||
try {
|
||||
subject.login(token);
|
||||
//subject.hasRole("admin");
|
||||
if (subject.isAuthenticated()) {
|
||||
return "/main/main";
|
||||
}
|
||||
} catch (UnknownAccountException e) {
|
||||
msg = "用户名/密码错误";
|
||||
} catch (IncorrectCredentialsException e) {
|
||||
msg = "用户名/密码错误";
|
||||
} catch (ExcessiveAttemptsException e) {
|
||||
msg = "登录失败多次,账户锁定10分钟";
|
||||
}
|
||||
if (msg != null) {
|
||||
model.addAttribute("message", msg);
|
||||
}
|
||||
return "/login";
|
||||
}
|
||||
if(msg!=null){
|
||||
model.addAttribute("message",msg);
|
||||
|
||||
@Log(desc = "用户退出平台")
|
||||
@GetMapping(value = "/logout")
|
||||
public String logout() {
|
||||
Subject sub = SecurityUtils.getSubject();
|
||||
sub.logout();
|
||||
return "/login";
|
||||
}
|
||||
return "/login";
|
||||
}
|
||||
|
||||
@Log(desc = "用户退出平台")
|
||||
@GetMapping(value = "/logout")
|
||||
public String logout(){
|
||||
Subject sub=SecurityUtils.getSubject();
|
||||
sub.logout();
|
||||
return "/login";
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装菜单json格式
|
||||
* update by 17/12/13
|
||||
* @return
|
||||
*/
|
||||
public JSONArray getMenuJson(){
|
||||
List<SysMenu> mList=menuService.getMenuNotSuper();
|
||||
JSONArray jsonArr=new JSONArray();
|
||||
for(SysMenu sysMenu:mList){
|
||||
SysMenu menu=getChild(sysMenu.getId());
|
||||
jsonArr.add(menu);
|
||||
/**
|
||||
* 组装菜单json格式
|
||||
* update by 17/12/13
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public JSONArray getMenuJson() {
|
||||
List<SysMenu> mList = menuService.getMenuNotSuper();
|
||||
JSONArray jsonArr = new JSONArray();
|
||||
for (SysMenu sysMenu : mList) {
|
||||
SysMenu menu = getChild(sysMenu.getId());
|
||||
jsonArr.add(menu);
|
||||
}
|
||||
return jsonArr;
|
||||
}
|
||||
return jsonArr;
|
||||
}
|
||||
|
||||
public SysMenu getChild(String id){
|
||||
SysMenu sysMenu=menuService.selectByPrimaryKey(id);
|
||||
List<SysMenu> mList=menuService.getMenuChildren(id);
|
||||
for(SysMenu menu:mList){
|
||||
SysMenu m=getChild(menu.getId());
|
||||
sysMenu.addChild(m);
|
||||
public SysMenu getChild(String id) {
|
||||
SysMenu sysMenu = menuService.selectByPrimaryKey(id);
|
||||
List<SysMenu> mList = menuService.getMenuChildren(id);
|
||||
for (SysMenu menu : mList) {
|
||||
SysMenu m = getChild(menu.getId());
|
||||
sysMenu.addChild(m);
|
||||
}
|
||||
return sysMenu;
|
||||
}
|
||||
return sysMenu;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/getCode")
|
||||
public void getYzm(HttpServletResponse response, HttpServletRequest request) {
|
||||
try {
|
||||
response.setHeader("Pragma", "No-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setDateHeader("Expires", 0);
|
||||
response.setContentType("image/jpg");
|
||||
|
||||
@GetMapping(value="/getCode")
|
||||
public void getYzm(HttpServletResponse response, HttpServletRequest request){
|
||||
try {
|
||||
response.setHeader("Pragma", "No-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setDateHeader("Expires", 0);
|
||||
response.setContentType("image/jpg");
|
||||
|
||||
//生成随机字串
|
||||
String verifyCode = VerifyCodeUtils.generateVerifyCode(4);
|
||||
//存入会话session
|
||||
HttpSession session = request.getSession(true);
|
||||
session.setAttribute("_code", verifyCode.toLowerCase());
|
||||
//生成图片
|
||||
int w = 146, h = 33;
|
||||
VerifyCodeUtils.outputImage(w, h, response.getOutputStream(), verifyCode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//生成随机字串
|
||||
String verifyCode = VerifyCodeUtils.generateVerifyCode(4);
|
||||
//存入会话session
|
||||
HttpSession session = request.getSession(true);
|
||||
session.setAttribute("_code", verifyCode.toLowerCase());
|
||||
//生成图片
|
||||
int w = 146, h = 33;
|
||||
VerifyCodeUtils.outputImage(w, h, response.getOutputStream(), verifyCode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@ package com.len.controller;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.len.base.BaseController;
|
||||
import com.len.core.annotation.Log;
|
||||
import com.len.core.annotation.Log.LOG_TYPE;
|
||||
import com.len.entity.SysMenu;
|
||||
import com.len.exception.MyException;
|
||||
import com.len.service.MenuService;
|
||||
import com.len.util.BeanUtil;
|
||||
import com.len.util.JsonUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -24,8 +26,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
* @email 154040976@qq.com
|
||||
* 菜单
|
||||
*/
|
||||
@RequestMapping("/menu")
|
||||
@Controller
|
||||
@RequestMapping(value = "/menu")
|
||||
public class MenuController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
|
@ -54,6 +56,7 @@ public class MenuController extends BaseController{
|
|||
return "/system/menu/add-menu";
|
||||
}
|
||||
|
||||
@Log(desc = "添加菜单",type = LOG_TYPE.UPDATE)
|
||||
@ApiOperation(value = "/addMenu", httpMethod = "POST", notes = "添加菜单")
|
||||
@PostMapping(value = "addMenu")
|
||||
@ResponseBody
|
||||
|
@ -86,4 +89,28 @@ public class MenuController extends BaseController{
|
|||
return jsonUtil;
|
||||
}
|
||||
|
||||
@GetMapping(value = "showUpdateMenu")
|
||||
public String showUpdateMenu(Model model,String id){
|
||||
SysMenu sysMenu = menuService.selectByPrimaryKey(id);
|
||||
JSONArray ja=menuService.getMenuJsonList();
|
||||
model.addAttribute("menus", ja.toJSONString());
|
||||
model.addAttribute("sysMenu", sysMenu);
|
||||
if(null!=sysMenu.getPId()){
|
||||
SysMenu pSysMenu=menuService.selectByPrimaryKey(sysMenu.getPId());
|
||||
model.addAttribute("pName", pSysMenu.getName());
|
||||
}
|
||||
return "/system/menu/update-menu";
|
||||
}
|
||||
|
||||
|
||||
@Log(desc = "更新菜单",type = LOG_TYPE.ADD)
|
||||
@PostMapping(value = "updateMenu")
|
||||
@ResponseBody
|
||||
public JsonUtil updateMenu(SysMenu sysMenu){
|
||||
SysMenu oldMenu = menuService.selectByPrimaryKey(sysMenu.getId());
|
||||
BeanUtil.copyNotNullBean(sysMenu,oldMenu);
|
||||
menuService.updateByPrimaryKeySelective(oldMenu);
|
||||
return JsonUtil.sucess("保存成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,9 @@ import com.len.service.RoleUserService;
|
|||
import com.len.util.BeanUtil;
|
||||
import com.len.util.JsonUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -36,141 +38,141 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
@RequestMapping(value = "/role")
|
||||
public class RoleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private RoleUserService roleUserService;
|
||||
@Autowired
|
||||
private RoleUserService roleUserService;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private RoleMenuService roleMenuService;
|
||||
@Autowired
|
||||
private RoleMenuService roleMenuService;
|
||||
|
||||
@GetMapping(value = "showRole")
|
||||
@RequiresPermissions(value = "role:show")
|
||||
public String showRole(Model model){
|
||||
return "/system/role/roleList";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "/showRoleList", httpMethod = "GET", notes = "展示角色")
|
||||
@GetMapping(value = "showRoleList")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("role:show")
|
||||
public String showRoleList(SysRole role,Model model,String page,String limit){
|
||||
return roleService.show(role,Integer.valueOf(page),Integer.valueOf(limit));
|
||||
}
|
||||
|
||||
@GetMapping(value = "showAddRole")
|
||||
public String addRole(Model model) {
|
||||
JSONArray jsonArray=menuService.getTreeUtil(null);
|
||||
model.addAttribute("menus",jsonArray.toJSONString());
|
||||
return "/system/role/add-role";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "/addRole", httpMethod = "POST", notes = "添加角色")
|
||||
@Log(desc = "添加角色")
|
||||
@PostMapping(value = "addRole")
|
||||
@ResponseBody
|
||||
public JsonUtil addRole(SysRole sysRole,String[] menus){
|
||||
if(StringUtils.isEmpty(sysRole.getRoleName())){
|
||||
JsonUtil.error("角色名称不能为空");
|
||||
@GetMapping(value = "showRole")
|
||||
@RequiresPermissions(value = "role:show")
|
||||
public String showRole(Model model) {
|
||||
return "/system/role/roleList";
|
||||
}
|
||||
JsonUtil j=new JsonUtil();
|
||||
try{
|
||||
roleService.insertSelective(sysRole);
|
||||
//操作role-menu data
|
||||
SysRoleMenu sysRoleMenu=new SysRoleMenu();
|
||||
sysRoleMenu.setRoleId(sysRole.getId());
|
||||
|
||||
if(menus!=null)
|
||||
for(String menu:menus){
|
||||
sysRoleMenu.setMenuId(menu);
|
||||
roleMenuService.insert(sysRoleMenu);
|
||||
}
|
||||
j.setMsg("保存成功");
|
||||
}catch (MyException e){
|
||||
j.setMsg("保存失败");
|
||||
j.setFlag(false);
|
||||
e.printStackTrace();
|
||||
@ApiOperation(value = "/showRoleList", httpMethod = "GET", notes = "展示角色")
|
||||
@GetMapping(value = "showRoleList")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("role:show")
|
||||
public String showRoleList(SysRole role, Model model, String page, String limit) {
|
||||
return roleService.show(role, Integer.valueOf(page), Integer.valueOf(limit));
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
@GetMapping(value = "updateRole")
|
||||
public String updateRole(String id,Model model,boolean detail){
|
||||
if (StringUtils.isNotEmpty(id)) {
|
||||
SysRole role = roleService.selectByPrimaryKey(id);
|
||||
model.addAttribute("role", role);
|
||||
JSONArray jsonArray=menuService.getTreeUtil(id);
|
||||
model.addAttribute("menus",jsonArray.toJSONString());
|
||||
@GetMapping(value = "showAddRole")
|
||||
public String goAddRole(Model model) {
|
||||
JSONArray jsonArray = menuService.getTreeUtil(null);
|
||||
model.addAttribute("menus", jsonArray.toJSONString());
|
||||
return "/system/role/add-role";
|
||||
}
|
||||
model.addAttribute("detail", detail);
|
||||
return "system/role/update-role";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "/updateRole", httpMethod = "POST", notes = "更新角色")
|
||||
@Log(desc = "更新角色")
|
||||
@PostMapping(value = "updateRole")
|
||||
@ResponseBody
|
||||
public JsonUtil updateUser(SysRole role,String[] menus) {
|
||||
JsonUtil jsonUtil = new JsonUtil();
|
||||
jsonUtil.setFlag(false);
|
||||
if (role == null) {
|
||||
jsonUtil.setMsg("获取数据失败");
|
||||
return jsonUtil;
|
||||
}
|
||||
try {
|
||||
SysRole oldRole = roleService.selectByPrimaryKey(role.getId());
|
||||
BeanUtil.copyNotNullBean(role, oldRole);
|
||||
roleService.updateByPrimaryKeySelective(oldRole);
|
||||
@ApiOperation(value = "/addRole", httpMethod = "POST", notes = "添加角色")
|
||||
@Log(desc = "添加角色")
|
||||
@PostMapping(value = "addRole")
|
||||
@ResponseBody
|
||||
public JsonUtil addRole(SysRole sysRole, String[] menus) {
|
||||
if (StringUtils.isEmpty(sysRole.getRoleName())) {
|
||||
JsonUtil.error("角色名称不能为空");
|
||||
}
|
||||
JsonUtil j = new JsonUtil();
|
||||
try {
|
||||
roleService.insertSelective(sysRole);
|
||||
//操作role-menu data
|
||||
SysRoleMenu sysRoleMenu = new SysRoleMenu();
|
||||
sysRoleMenu.setRoleId(sysRole.getId());
|
||||
|
||||
SysRoleMenu sysRoleMenu=new SysRoleMenu();
|
||||
sysRoleMenu.setRoleId(role.getId());
|
||||
List<SysRoleMenu> menuList=roleMenuService.selectByCondition(sysRoleMenu);
|
||||
for(SysRoleMenu sysRoleMenu1:menuList){
|
||||
roleMenuService.deleteByPrimaryKey(sysRoleMenu1);
|
||||
}
|
||||
if(menus!=null)
|
||||
for(String menu:menus){
|
||||
sysRoleMenu.setMenuId(menu);
|
||||
roleMenuService.insert(sysRoleMenu);
|
||||
}
|
||||
jsonUtil.setFlag(true);
|
||||
jsonUtil.setMsg("修改成功");
|
||||
} catch (MyException e) {
|
||||
jsonUtil.setMsg("修改失败");
|
||||
e.printStackTrace();
|
||||
if (menus != null)
|
||||
for (String menu : menus) {
|
||||
sysRoleMenu.setMenuId(menu);
|
||||
roleMenuService.insert(sysRoleMenu);
|
||||
}
|
||||
j.setMsg("保存成功");
|
||||
} catch (MyException e) {
|
||||
j.setMsg("保存失败");
|
||||
j.setFlag(false);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
return jsonUtil;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "/del", httpMethod = "POST", notes = "删除角色")
|
||||
@Log(desc = "删除角色",type = LOG_TYPE.DEL)
|
||||
@PostMapping(value = "del")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("role:del")
|
||||
public JsonUtil del(String id) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JsonUtil.error("获取数据失败");
|
||||
@GetMapping(value = "updateRole")
|
||||
public String updateRole(String id, Model model, boolean detail) {
|
||||
if (StringUtils.isNotEmpty(id)) {
|
||||
SysRole role = roleService.selectByPrimaryKey(id);
|
||||
model.addAttribute("role", role);
|
||||
JSONArray jsonArray = menuService.getTreeUtil(id);
|
||||
model.addAttribute("menus", jsonArray.toJSONString());
|
||||
}
|
||||
model.addAttribute("detail", detail);
|
||||
return "system/role/update-role";
|
||||
}
|
||||
SysRoleUser sysRoleUser=new SysRoleUser();
|
||||
sysRoleUser.setRoleId(id);
|
||||
JsonUtil j=new JsonUtil();
|
||||
try {
|
||||
int count= roleUserService.selectCountByCondition(sysRoleUser);
|
||||
if(count>0){
|
||||
return JsonUtil.error("已分配给用户,删除失败");
|
||||
}
|
||||
roleService.deleteByPrimaryKey(id);
|
||||
j.setMsg("删除成功");
|
||||
} catch (MyException e) {
|
||||
j.setMsg("删除失败");
|
||||
j.setFlag(false);
|
||||
e.printStackTrace();
|
||||
|
||||
@ApiOperation(value = "/updateRole", httpMethod = "POST", notes = "更新角色")
|
||||
@Log(desc = "更新角色")
|
||||
@PostMapping(value = "updateRole")
|
||||
@ResponseBody
|
||||
public JsonUtil updateUser(SysRole role, String[] menus) {
|
||||
JsonUtil jsonUtil = new JsonUtil();
|
||||
jsonUtil.setFlag(false);
|
||||
if (role == null) {
|
||||
jsonUtil.setMsg("获取数据失败");
|
||||
return jsonUtil;
|
||||
}
|
||||
try {
|
||||
SysRole oldRole = roleService.selectByPrimaryKey(role.getId());
|
||||
BeanUtil.copyNotNullBean(role, oldRole);
|
||||
roleService.updateByPrimaryKeySelective(oldRole);
|
||||
|
||||
SysRoleMenu sysRoleMenu = new SysRoleMenu();
|
||||
sysRoleMenu.setRoleId(role.getId());
|
||||
List<SysRoleMenu> menuList = roleMenuService.selectByCondition(sysRoleMenu);
|
||||
for (SysRoleMenu sysRoleMenu1 : menuList) {
|
||||
roleMenuService.deleteByPrimaryKey(sysRoleMenu1);
|
||||
}
|
||||
if (menus != null)
|
||||
for (String menu : menus) {
|
||||
sysRoleMenu.setMenuId(menu);
|
||||
roleMenuService.insert(sysRoleMenu);
|
||||
}
|
||||
jsonUtil.setFlag(true);
|
||||
jsonUtil.setMsg("修改成功");
|
||||
} catch (MyException e) {
|
||||
jsonUtil.setMsg("修改失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return jsonUtil;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "/del", httpMethod = "POST", notes = "删除角色")
|
||||
@Log(desc = "删除角色", type = LOG_TYPE.DEL)
|
||||
@PostMapping(value = "del")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("role:del")
|
||||
public JsonUtil del(String id) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JsonUtil.error("获取数据失败");
|
||||
}
|
||||
SysRoleUser sysRoleUser = new SysRoleUser();
|
||||
sysRoleUser.setRoleId(id);
|
||||
JsonUtil j = new JsonUtil();
|
||||
try {
|
||||
int count = roleUserService.selectCountByCondition(sysRoleUser);
|
||||
if (count > 0) {
|
||||
return JsonUtil.error("已分配给用户,删除失败");
|
||||
}
|
||||
roleService.deleteByPrimaryKey(id);
|
||||
j.setMsg("删除成功");
|
||||
} catch (MyException e) {
|
||||
j.setMsg("删除失败");
|
||||
j.setFlag(false);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,11 +14,13 @@ import com.len.util.Checkbox;
|
|||
import com.len.util.JsonUtil;
|
||||
import com.len.util.Md5Util;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -41,249 +43,251 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
//@Api(value="user")
|
||||
@Controller
|
||||
@RequestMapping(value = "/user")
|
||||
public class UserController extends BaseController{
|
||||
public class UserController extends BaseController {
|
||||
|
||||
//private static final Logger
|
||||
//private static final Logger
|
||||
|
||||
@Autowired
|
||||
SysUserService userService;
|
||||
@Autowired
|
||||
SysUserService userService;
|
||||
|
||||
@Autowired
|
||||
RoleUserService roleUserService;
|
||||
@Autowired
|
||||
RoleUserService roleUserService;
|
||||
|
||||
@Autowired
|
||||
JobTask task;
|
||||
@Autowired
|
||||
JobTask task;
|
||||
|
||||
@GetMapping(value = "mainTest")
|
||||
@RequiresPermissions("user:show")
|
||||
public String showTest() {
|
||||
return "system/user/mainTest";
|
||||
}
|
||||
|
||||
@GetMapping(value = "showUser")
|
||||
@RequiresPermissions("user:show")
|
||||
public String showUser(Model model) {
|
||||
return "/system/user/userList";
|
||||
}
|
||||
|
||||
@GetMapping(value = "showUserList")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("user:show")
|
||||
public String showUser(Model model, SysUser user, String page, String limit) {
|
||||
return userService.show(user,Integer.valueOf(page),Integer.valueOf(limit));
|
||||
}
|
||||
|
||||
@GetMapping(value = "showAddUser")
|
||||
public String addUser(Model model) {
|
||||
List<Checkbox> checkboxList=userService.getUserRoleByJson(null);
|
||||
model.addAttribute("boxJson",checkboxList);
|
||||
return "/system/user/add-user";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "/addUser", httpMethod = "POST", notes = "添加用户")
|
||||
@Log(desc = "添加用户")
|
||||
@PostMapping(value = "addUser")
|
||||
@ResponseBody
|
||||
public JsonUtil addUser(SysUser user,String[] role) {
|
||||
if (user == null) {
|
||||
return JsonUtil.error("获取数据失败");
|
||||
@GetMapping(value = "mainTest")
|
||||
@RequiresPermissions("user:show")
|
||||
public String showTest() {
|
||||
return "system/user/mainTest";
|
||||
}
|
||||
if (StringUtils.isBlank(user.getUsername())) {
|
||||
return JsonUtil.error("用户名不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(user.getPassword())) {
|
||||
return JsonUtil.error("密码不能为空");
|
||||
}
|
||||
if(role==null){
|
||||
return JsonUtil.error("请选择角色");
|
||||
}
|
||||
int result = userService.checkUser(user.getUsername());
|
||||
if (result > 0) {
|
||||
return JsonUtil.error("用户名已存在");
|
||||
}
|
||||
JsonUtil j=new JsonUtil();
|
||||
try {
|
||||
userService.insertSelective(user);
|
||||
SysRoleUser sysRoleUser=new SysRoleUser();
|
||||
sysRoleUser.setUserId(user.getId());
|
||||
for(String r:role){
|
||||
sysRoleUser.setRoleId(r);
|
||||
roleUserService.insertSelective(sysRoleUser);
|
||||
}
|
||||
j.setMsg("保存成功");
|
||||
} catch (MyException e) {
|
||||
j.setMsg("保存失败");
|
||||
j.setFlag(false);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
@GetMapping(value = "updateUser")
|
||||
public String updateUser(String id, Model model, boolean detail) {
|
||||
if (StringUtils.isNotEmpty(id)) {
|
||||
//用户-角色
|
||||
List<Checkbox> checkboxList=userService.getUserRoleByJson(id);
|
||||
SysUser user = userService.selectByPrimaryKey(id);
|
||||
model.addAttribute("user", user);
|
||||
model.addAttribute("boxJson", checkboxList);
|
||||
@GetMapping(value = "showUser")
|
||||
@RequiresPermissions("user:show")
|
||||
public String showUser(Model model) {
|
||||
return "/system/user/userList";
|
||||
}
|
||||
model.addAttribute("detail", detail);
|
||||
return "system/user/update-user";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "/updateUser", httpMethod = "POST", notes = "更新用户")
|
||||
@Log(desc = "更新用户",type = LOG_TYPE.UPDATE)
|
||||
@PostMapping(value = "updateUser")
|
||||
@ResponseBody
|
||||
public JsonUtil updateUser(SysUser user,String role[]) {
|
||||
JsonUtil jsonUtil = new JsonUtil();
|
||||
jsonUtil.setFlag(false);
|
||||
if (user == null) {
|
||||
jsonUtil.setMsg("获取数据失败");
|
||||
return jsonUtil;
|
||||
@GetMapping(value = "showUserList")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("user:show")
|
||||
public String showUser(Model model, SysUser user, String page, String limit) {
|
||||
return userService.show(user, Integer.valueOf(page), Integer.valueOf(limit));
|
||||
}
|
||||
try {
|
||||
SysUser oldUser = userService.selectByPrimaryKey(user.getId());
|
||||
BeanUtil.copyNotNullBean(user, oldUser);
|
||||
userService.updateByPrimaryKeySelective(oldUser);
|
||||
|
||||
SysRoleUser sysRoleUser =new SysRoleUser();
|
||||
sysRoleUser.setUserId(oldUser.getId());
|
||||
List<SysRoleUser> keyList=userService.selectByCondition(sysRoleUser);
|
||||
for(SysRoleUser sysRoleUser1 :keyList){
|
||||
roleUserService.deleteByPrimaryKey(sysRoleUser1);
|
||||
}
|
||||
if(role!=null){
|
||||
for(String r:role){
|
||||
sysRoleUser.setRoleId(r);
|
||||
roleUserService.insert(sysRoleUser);
|
||||
@GetMapping(value = "showAddUser")
|
||||
public String goAddUser(Model model) {
|
||||
List<Checkbox> checkboxList = userService.getUserRoleByJson(null);
|
||||
model.addAttribute("boxJson", checkboxList);
|
||||
return "/system/user/add-user";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "/addUser", httpMethod = "POST", notes = "添加用户")
|
||||
@Log(desc = "添加用户")
|
||||
@PostMapping(value = "addUser")
|
||||
@ResponseBody
|
||||
public JsonUtil addUser(SysUser user, String[] role) {
|
||||
if (user == null) {
|
||||
return JsonUtil.error("获取数据失败");
|
||||
}
|
||||
if (StringUtils.isBlank(user.getUsername())) {
|
||||
return JsonUtil.error("用户名不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(user.getPassword())) {
|
||||
return JsonUtil.error("密码不能为空");
|
||||
}
|
||||
if (role == null) {
|
||||
return JsonUtil.error("请选择角色");
|
||||
}
|
||||
int result = userService.checkUser(user.getUsername());
|
||||
if (result > 0) {
|
||||
return JsonUtil.error("用户名已存在");
|
||||
}
|
||||
JsonUtil j = new JsonUtil();
|
||||
try {
|
||||
userService.insertSelective(user);
|
||||
SysRoleUser sysRoleUser = new SysRoleUser();
|
||||
sysRoleUser.setUserId(user.getId());
|
||||
for (String r : role) {
|
||||
sysRoleUser.setRoleId(r);
|
||||
roleUserService.insertSelective(sysRoleUser);
|
||||
}
|
||||
j.setMsg("保存成功");
|
||||
} catch (MyException e) {
|
||||
j.setMsg("保存失败");
|
||||
j.setFlag(false);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
jsonUtil.setFlag(true);
|
||||
jsonUtil.setMsg("修改成功");
|
||||
} catch (MyException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return jsonUtil;
|
||||
}
|
||||
|
||||
@Log(desc = "删除用户",type = LOG_TYPE.DEL)
|
||||
@ApiOperation(value = "/del", httpMethod = "POST", notes = "删除用户")
|
||||
@PostMapping(value = "/del")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("user:del")
|
||||
public JsonUtil del(String id, boolean flag) {
|
||||
return userService.delById(id,flag);
|
||||
}
|
||||
|
||||
@GetMapping(value = "goRePass")
|
||||
public String goRePass(String id,Model model){
|
||||
if(StringUtils.isEmpty(id)){
|
||||
return "获取账户信息失败";
|
||||
}
|
||||
SysUser user=userService.selectByPrimaryKey(id);
|
||||
model.addAttribute("user",user);
|
||||
return "/system/user/re-pass";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* @param id
|
||||
* @param pass
|
||||
* @param newPwd
|
||||
* @return
|
||||
*/
|
||||
@Log(desc = "修改密码",type = LOG_TYPE.UPDATE)
|
||||
@PostMapping(value = "rePass")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("user:repass")
|
||||
public JsonUtil rePass(String id,String pass,String newPwd){
|
||||
boolean flag=StringUtils.isEmpty(id)||StringUtils.isEmpty(pass)||StringUtils.isEmpty(newPwd);
|
||||
JsonUtil j=new JsonUtil();
|
||||
j.setFlag(false);
|
||||
if(flag){
|
||||
j.setMsg("获取数据失败,修改失败");
|
||||
return j;
|
||||
}
|
||||
SysUser user=userService.selectByPrimaryKey(id);
|
||||
newPwd=Md5Util.getMD5(newPwd,user.getUsername());
|
||||
pass=Md5Util.getMD5(pass,user.getUsername());
|
||||
if(!pass.equals(user.getPassword())){
|
||||
j.setMsg("密码不正确");
|
||||
return j;
|
||||
}
|
||||
if(newPwd.equals(user.getPassword())){
|
||||
j.setMsg("新密码不能与旧密码相同");
|
||||
|
||||
return j;
|
||||
}
|
||||
user.setPassword(newPwd);
|
||||
try {
|
||||
userService.rePass(user);
|
||||
j.setMsg("修改成功");
|
||||
j.setFlag(true);
|
||||
}catch (MyException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
* 头像上传 目前首先相对路径
|
||||
*/
|
||||
@PostMapping(value = "upload")
|
||||
@ResponseBody
|
||||
public JsonUtil imgUpload(HttpServletRequest req, @RequestParam("file") MultipartFile file,
|
||||
ModelMap model) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat sdf1 = new SimpleDateFormat("hhmmss");
|
||||
|
||||
String fileName = sdf1.format(new Date()) + file.getOriginalFilename();
|
||||
String objPath =
|
||||
req.getSession().getServletContext().getRealPath("image/") + sdf.format(new Date())
|
||||
.toString();
|
||||
File targetFile1 = new File(objPath, fileName);
|
||||
File file2 = new File(objPath);
|
||||
if (!file2.exists()) {
|
||||
file2.mkdirs();
|
||||
}
|
||||
if (!targetFile1.exists()) {
|
||||
targetFile1.mkdirs();
|
||||
@GetMapping(value = "updateUser")
|
||||
public String goUpdateUser(String id, Model model, boolean detail) {
|
||||
if (StringUtils.isNotEmpty(id)) {
|
||||
//用户-角色
|
||||
List<Checkbox> checkboxList = userService.getUserRoleByJson(id);
|
||||
SysUser user = userService.selectByPrimaryKey(id);
|
||||
model.addAttribute("user", user);
|
||||
model.addAttribute("boxJson", checkboxList);
|
||||
}
|
||||
model.addAttribute("detail", detail);
|
||||
return "system/user/update-user";
|
||||
}
|
||||
|
||||
try {
|
||||
file.transferTo(targetFile1);
|
||||
} catch (Exception e) {
|
||||
j.setFlag(false);
|
||||
j.setMsg("上传失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
j.setMsg("image/" + sdf.format(new Date()).toString() + "/" + req.getContextPath() + fileName);
|
||||
return j;
|
||||
}
|
||||
@ApiOperation(value = "/updateUser", httpMethod = "POST", notes = "更新用户")
|
||||
@Log(desc = "更新用户", type = LOG_TYPE.UPDATE)
|
||||
@PostMapping(value = "updateUser")
|
||||
@ResponseBody
|
||||
public JsonUtil updateUser(SysUser user, String role[]) {
|
||||
JsonUtil jsonUtil = new JsonUtil();
|
||||
jsonUtil.setFlag(false);
|
||||
if (user == null) {
|
||||
jsonUtil.setMsg("获取数据失败");
|
||||
return jsonUtil;
|
||||
}
|
||||
try {
|
||||
SysUser oldUser = userService.selectByPrimaryKey(user.getId());
|
||||
BeanUtil.copyNotNullBean(user, oldUser);
|
||||
userService.updateByPrimaryKeySelective(oldUser);
|
||||
|
||||
/**
|
||||
* 验证用户名是否存在
|
||||
*/
|
||||
@GetMapping(value = "checkUser")
|
||||
@ResponseBody
|
||||
public JsonUtil checkUser(String uname, HttpServletRequest req) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
j.setFlag(Boolean.FALSE);
|
||||
if (StringUtils.isEmpty(uname)) {
|
||||
j.setMsg("获取数据失败");
|
||||
return j;
|
||||
SysRoleUser sysRoleUser = new SysRoleUser();
|
||||
sysRoleUser.setUserId(oldUser.getId());
|
||||
List<SysRoleUser> keyList = userService.selectByCondition(sysRoleUser);
|
||||
for (SysRoleUser sysRoleUser1 : keyList) {
|
||||
roleUserService.deleteByPrimaryKey(sysRoleUser1);
|
||||
}
|
||||
if (role != null) {
|
||||
for (String r : role) {
|
||||
sysRoleUser.setRoleId(r);
|
||||
roleUserService.insert(sysRoleUser);
|
||||
}
|
||||
}
|
||||
jsonUtil.setFlag(true);
|
||||
jsonUtil.setMsg("修改成功");
|
||||
} catch (MyException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return jsonUtil;
|
||||
}
|
||||
int result = userService.checkUser(uname);
|
||||
if (result > 0) {
|
||||
j.setMsg("用户名已存在");
|
||||
return j;
|
||||
}
|
||||
j.setFlag(true);
|
||||
return j;
|
||||
|
||||
}
|
||||
@Log(desc = "删除用户", type = LOG_TYPE.DEL)
|
||||
@ApiOperation(value = "/del", httpMethod = "POST", notes = "删除用户")
|
||||
@PostMapping(value = "/del")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("user:del")
|
||||
public JsonUtil del(String id, boolean flag) {
|
||||
return userService.delById(id, flag);
|
||||
}
|
||||
|
||||
@GetMapping(value = "goRePass")
|
||||
public String goRePass(String id, Model model) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return "获取账户信息失败";
|
||||
}
|
||||
SysUser user = userService.selectByPrimaryKey(id);
|
||||
model.addAttribute("user", user);
|
||||
return "/system/user/re-pass";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*
|
||||
* @param id
|
||||
* @param pass
|
||||
* @param newPwd
|
||||
* @return
|
||||
*/
|
||||
@Log(desc = "修改密码", type = LOG_TYPE.UPDATE)
|
||||
@PostMapping(value = "rePass")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("user:repass")
|
||||
public JsonUtil rePass(String id, String pass, String newPwd) {
|
||||
boolean flag = StringUtils.isEmpty(id) || StringUtils.isEmpty(pass) || StringUtils.isEmpty(newPwd);
|
||||
JsonUtil j = new JsonUtil();
|
||||
j.setFlag(false);
|
||||
if (flag) {
|
||||
j.setMsg("获取数据失败,修改失败");
|
||||
return j;
|
||||
}
|
||||
SysUser user = userService.selectByPrimaryKey(id);
|
||||
newPwd = Md5Util.getMD5(newPwd, user.getUsername());
|
||||
pass = Md5Util.getMD5(pass, user.getUsername());
|
||||
if (!pass.equals(user.getPassword())) {
|
||||
j.setMsg("密码不正确");
|
||||
return j;
|
||||
}
|
||||
if (newPwd.equals(user.getPassword())) {
|
||||
j.setMsg("新密码不能与旧密码相同");
|
||||
|
||||
return j;
|
||||
}
|
||||
user.setPassword(newPwd);
|
||||
try {
|
||||
userService.rePass(user);
|
||||
j.setMsg("修改成功");
|
||||
j.setFlag(true);
|
||||
} catch (MyException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 头像上传 目前首先相对路径
|
||||
*/
|
||||
@PostMapping(value = "upload")
|
||||
@ResponseBody
|
||||
public JsonUtil imgUpload(HttpServletRequest req, @RequestParam("file") MultipartFile file,
|
||||
ModelMap model) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat sdf1 = new SimpleDateFormat("hhmmss");
|
||||
|
||||
String fileName = sdf1.format(new Date()) + file.getOriginalFilename();
|
||||
String objPath =
|
||||
req.getSession().getServletContext().getRealPath("image/") + sdf.format(new Date())
|
||||
.toString();
|
||||
File targetFile1 = new File(objPath, fileName);
|
||||
File file2 = new File(objPath);
|
||||
if (!file2.exists()) {
|
||||
file2.mkdirs();
|
||||
}
|
||||
if (!targetFile1.exists()) {
|
||||
targetFile1.mkdirs();
|
||||
}
|
||||
|
||||
try {
|
||||
file.transferTo(targetFile1);
|
||||
} catch (Exception e) {
|
||||
j.setFlag(false);
|
||||
j.setMsg("上传失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
j.setMsg("image/" + sdf.format(new Date()).toString() + "/" + req.getContextPath() + fileName);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证用户名是否存在
|
||||
*/
|
||||
@GetMapping(value = "checkUser")
|
||||
@ResponseBody
|
||||
public JsonUtil checkUser(String uname, HttpServletRequest req) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
j.setFlag(Boolean.FALSE);
|
||||
if (StringUtils.isEmpty(uname)) {
|
||||
j.setMsg("获取数据失败");
|
||||
return j;
|
||||
}
|
||||
int result = userService.checkUser(uname);
|
||||
if (result > 0) {
|
||||
j.setMsg("用户名已存在");
|
||||
return j;
|
||||
}
|
||||
j.setFlag(true);
|
||||
return j;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,9 @@ import com.len.entity.SysJob;
|
|||
import com.len.service.JobService;
|
||||
import com.len.util.SpringUtil;
|
||||
import com.len.service.RoleService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -15,40 +17,40 @@ import org.springframework.context.annotation.Configuration;
|
|||
* @author zhuxiaomeng
|
||||
* @date 2018/1/6.
|
||||
* @email 154040976@qq.com
|
||||
*
|
||||
* <p>
|
||||
* 启动数据库中已经设定为 启动状态(status:true)的任务 项目启动时init
|
||||
*/
|
||||
@Configuration
|
||||
public class DataSourceJobThread extends Thread {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DataSourceJobThread.class);
|
||||
@Autowired
|
||||
RoleService roleService;
|
||||
private static final Logger log = LoggerFactory.getLogger(DataSourceJobThread.class);
|
||||
@Autowired
|
||||
RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
JobService jobService;
|
||||
@Autowired
|
||||
JobService jobService;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
log.info("---------线程启动---------");
|
||||
JobTask jobTask = SpringUtil.getBean("jobTask");
|
||||
SysJob job = new SysJob();
|
||||
job.setStatus(true);
|
||||
List<SysJob> jobList = jobService.selectListByPage(job);
|
||||
//开启任务
|
||||
jobList.forEach(jobs -> {
|
||||
log.info("---任务["+jobs.getId()+"]系统 init--开始启动---------");
|
||||
jobTask.startJob(jobs);
|
||||
}
|
||||
);
|
||||
if(jobList.size()==0){
|
||||
log.info("---数据库暂无启动的任务---------");
|
||||
}else
|
||||
System.out.println("---任务启动完毕---------");
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
log.info("---------线程启动---------");
|
||||
JobTask jobTask = SpringUtil.getBean("jobTask");
|
||||
SysJob job = new SysJob();
|
||||
job.setStatus(true);
|
||||
List<SysJob> jobList = jobService.selectListByPage(job);
|
||||
//开启任务
|
||||
jobList.forEach(jobs -> {
|
||||
log.info("---任务[" + jobs.getId() + "]系统 init--开始启动---------");
|
||||
jobTask.startJob(jobs);
|
||||
}
|
||||
);
|
||||
if (jobList.size() == 0) {
|
||||
log.info("---数据库暂无启动的任务---------");
|
||||
} else
|
||||
System.out.println("---任务启动完毕---------");
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,26 +10,25 @@ import org.springframework.stereotype.Component;
|
|||
* @author zhuxiaomeng
|
||||
* @date 2018/1/6.
|
||||
* @email 154040976@qq.com
|
||||
*
|
||||
* <p>
|
||||
* 通过监听,开辟线程,执行定时任务 当然 也可以执行其他
|
||||
*/
|
||||
@Component
|
||||
public class MyApplicationListener implements ApplicationListener<ContextRefreshedEvent> {
|
||||
public class MyApplicationListener implements ApplicationListener<ContextRefreshedEvent> {
|
||||
|
||||
Logger logger= LoggerFactory.getLogger(MyApplicationListener.class);
|
||||
Logger logger = LoggerFactory.getLogger(MyApplicationListener.class);
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
logger.info("-------------bean初始化完毕-------------");
|
||||
/**
|
||||
* 通过线程开启数据库中已经开启的定时任务 灵感来自spring
|
||||
* spring boot继续执行 mythread开辟线程,延迟后执行
|
||||
*/
|
||||
DataSourceJobThread myThread= (DataSourceJobThread) event.getApplicationContext().getBean(
|
||||
"dataSourceJobThread");
|
||||
myThread.start();
|
||||
}
|
||||
@Override
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
logger.info("-------------bean初始化完毕-------------");
|
||||
/**
|
||||
* 通过线程开启数据库中已经开启的定时任务 灵感来自spring
|
||||
* spring boot继续执行 mythread开辟线程,延迟后执行
|
||||
*/
|
||||
DataSourceJobThread myThread = (DataSourceJobThread) event.getApplicationContext().getBean(
|
||||
"dataSourceJobThread");
|
||||
myThread.start();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.len.core.BootListener;
|
|||
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
|
@ -12,13 +13,13 @@ import org.springframework.stereotype.Component;
|
|||
@Component
|
||||
public class MyServletContextListener implements ServletContextListener {
|
||||
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent sce) {
|
||||
System.out.println("-------contextInitialized-----------");
|
||||
}
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent sce) {
|
||||
System.out.println("-------contextInitialized-----------");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contextDestroyed(ServletContextEvent sce) {
|
||||
System.out.println("------------contextDestroyed-------------");
|
||||
}
|
||||
@Override
|
||||
public void contextDestroyed(ServletContextEvent sce) {
|
||||
System.out.println("------------contextDestroyed-------------");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.lang.annotation.Target;
|
|||
* @author zhuxiaomeng
|
||||
* @date 2017/12/28.
|
||||
* @email 154040976@qq.com
|
||||
*
|
||||
* <p>
|
||||
* 记录日志
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
@ -19,9 +19,17 @@ import java.lang.annotation.Target;
|
|||
@Documented
|
||||
@Inherited
|
||||
public @interface Log {
|
||||
public enum LOG_TYPE{ADD,UPDATE,DEL,SELECT,ATHOR};
|
||||
/**内容*/
|
||||
public enum LOG_TYPE {ADD, UPDATE, DEL, SELECT, ATHOR}
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
String desc();
|
||||
/**类型 curd*/
|
||||
|
||||
/**
|
||||
* 类型 curd
|
||||
*/
|
||||
LOG_TYPE type() default LOG_TYPE.ATHOR;
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import com.len.core.shiro.ShiroUtil;
|
|||
import com.len.entity.SysLog;
|
||||
import com.len.mapper.SysLogMapper;
|
||||
import com.len.util.IpUtil;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.UnavailableSecurityManagerException;
|
||||
import org.apache.shiro.mgt.SecurityManager;
|
||||
|
@ -29,7 +31,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|||
* @author zhuxiaomeng
|
||||
* @date 2017/12/28.
|
||||
* @email 154040976@qq.com
|
||||
*
|
||||
* <p>
|
||||
* 为增删改添加监控
|
||||
*/
|
||||
@Aspect
|
||||
|
@ -45,29 +47,29 @@ public class LogAspect {
|
|||
}
|
||||
|
||||
@After("pointcut()")
|
||||
public void insertLogSuccess(JoinPoint jp){
|
||||
addLog(jp,getDesc(jp));
|
||||
public void insertLogSuccess(JoinPoint jp) {
|
||||
addLog(jp, getDesc(jp));
|
||||
}
|
||||
|
||||
private void addLog(JoinPoint jp,String text){
|
||||
Log.LOG_TYPE type=getType(jp);
|
||||
SysLog log=new SysLog();
|
||||
RequestAttributes requestAttributes=RequestContextHolder.getRequestAttributes();
|
||||
private void addLog(JoinPoint jp, String text) {
|
||||
Log.LOG_TYPE type = getType(jp);
|
||||
SysLog log = new SysLog();
|
||||
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
|
||||
//一些系统监控
|
||||
if(requestAttributes!=null){
|
||||
if (requestAttributes != null) {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
String ip= IpUtil.getIp(request);
|
||||
String ip = IpUtil.getIp(request);
|
||||
log.setIp(ip);
|
||||
}
|
||||
log.setCreateTime(new Date());
|
||||
log.setType(type.toString());
|
||||
log.setText(text);
|
||||
|
||||
Object[] obj= jp.getArgs();
|
||||
StringBuffer buffer=new StringBuffer();
|
||||
if(obj!=null){
|
||||
for(int i=0;i<obj.length;i++){
|
||||
buffer.append("[参数"+(i+1)+":");
|
||||
Object[] obj = jp.getArgs();
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
if (obj != null) {
|
||||
for (int i = 0; i < obj.length; i++) {
|
||||
buffer.append("[参数" + (i + 1) + ":");
|
||||
buffer.append(JSON.toJSONString(obj[i]));
|
||||
buffer.append("]");
|
||||
}
|
||||
|
@ -76,7 +78,7 @@ public class LogAspect {
|
|||
try {
|
||||
CurrentUser currentUser = ShiroUtil.getCurrentUse();
|
||||
log.setUserName(currentUser.getUsername());
|
||||
}catch (UnavailableSecurityManagerException e){
|
||||
} catch (UnavailableSecurityManagerException e) {
|
||||
|
||||
}
|
||||
logMapper.insert(log);
|
||||
|
@ -84,24 +86,25 @@ public class LogAspect {
|
|||
|
||||
/**
|
||||
* 记录异常
|
||||
*
|
||||
* @param joinPoint
|
||||
* @param e
|
||||
*/
|
||||
@AfterThrowing(value="pointcut()",throwing="e")
|
||||
public void afterException(JoinPoint joinPoint,Exception e){
|
||||
System.out.print("-----------afterException:"+e.getMessage());
|
||||
addLog(joinPoint,getDesc(joinPoint)+e.getMessage());
|
||||
@AfterThrowing(value = "pointcut()", throwing = "e")
|
||||
public void afterException(JoinPoint joinPoint, Exception e) {
|
||||
System.out.print("-----------afterException:" + e.getMessage());
|
||||
addLog(joinPoint, getDesc(joinPoint) + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
private String getDesc(JoinPoint joinPoint){
|
||||
MethodSignature methodName = (MethodSignature)joinPoint.getSignature();
|
||||
private String getDesc(JoinPoint joinPoint) {
|
||||
MethodSignature methodName = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = methodName.getMethod();
|
||||
return method.getAnnotation(Log.class).desc();
|
||||
}
|
||||
|
||||
private Log.LOG_TYPE getType(JoinPoint joinPoint){
|
||||
MethodSignature methodName = (MethodSignature)joinPoint.getSignature();
|
||||
private Log.LOG_TYPE getType(JoinPoint joinPoint) {
|
||||
MethodSignature methodName = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = methodName.getMethod();
|
||||
return method.getAnnotation(Log.class).type();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.len.core.quartz.CustomQuartz;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/1/29.
|
||||
* @email 154040976@qq.com
|
||||
*
|
||||
* 定时还原数据库数据
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class DataSchdule {
|
||||
|
||||
//@Scheduled(cron="0/5 * * * * ? ")
|
||||
public static void restData() throws IOException, InterruptedException {
|
||||
String sqlPath = "G:\\os\\sql\\lenos_test.sql"; // SQL文件路径
|
||||
String[] execCMD = new String[]{"mysql", "lenos_test", "-u" + "root", "-p" , "-e source", sqlPath};
|
||||
Process process = Runtime.getRuntime().exec(execCMD);
|
||||
|
||||
int processComplete = process.waitFor();
|
||||
if (processComplete == 0) {
|
||||
System.out.println("还原成功.");
|
||||
} else {
|
||||
throw new RuntimeException("还原数据库失败.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.len.core.quartz.CustomQuartz;
|
||||
|
||||
import com.len.core.annotation.Log;
|
||||
|
||||
import com.len.entity.SysUser;
|
||||
import com.len.service.SysUserService;
|
||||
import com.len.service.impl.SysUserServiceImpl;
|
||||
|
@ -10,6 +10,8 @@ import java.util.List;
|
|||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
/**
|
||||
|
@ -20,7 +22,7 @@ import org.springframework.context.ApplicationContext;
|
|||
* 定时测试类
|
||||
*/
|
||||
public class JobDemo2 implements Job{
|
||||
|
||||
private static Logger logger= LoggerFactory.getLogger(JobDemo2.class);
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
|
@ -35,8 +37,7 @@ public class JobDemo2 implements Job{
|
|||
ApplicationContext applicationContext=SpringUtil.getApplicationContext();
|
||||
SysUserService sys=SpringUtil.getBean(SysUserServiceImpl.class);
|
||||
List<SysUser> userList=sys.selectListByPage(new SysUser());
|
||||
System.out.println(userList.get(0).getUsername());;
|
||||
System.out.println("JobDemo2:执行完毕=======================");
|
||||
|
||||
logger.info(userList.get(0).getUsername());
|
||||
logger.info("JobDemo2:执行完毕=======================");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.len.entity;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.len.mapper;
|
|||
import com.len.base.BaseMapper;
|
||||
import com.len.entity.SysJob;
|
||||
|
||||
public interface SysJobMapper extends BaseMapper<SysJob,String> {
|
||||
public interface SysJobMapper extends BaseMapper<SysJob, String> {
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
int insert(SysJob record);
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
<div class="layui-footer">
|
||||
<!-- 底部固定区域 -->
|
||||
2017 ©
|
||||
<a target="_blank" href="http://www.true08.com/">true08.com/</a> 由zxm倾心打造的一款快速开发脚手架 <#--技术交流请联系本人-154040976@qq.com-->
|
||||
<a target="_blank" href="https://my.oschina.net/u/3312115/blog">开源中国博客</a> 由zxm倾心打造的一款快速开发脚手架 <#--技术交流请联系本人-154040976@qq.com-->
|
||||
</div>
|
||||
</div>
|
||||
<script src="${re.contextPath}/plugin/plugins/layui/layui.js"></script>
|
||||
|
|
|
@ -15,8 +15,9 @@ To change this template use File | Settings | File Templates.-->
|
|||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -125,27 +126,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
});
|
||||
//监听提交
|
||||
form.on('submit(add)', function(data){
|
||||
$.ajax({
|
||||
url:'addJob',
|
||||
type:'post',
|
||||
data:data.field,
|
||||
async:false, traditional: true,
|
||||
success:function(d){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
if(d.flag){
|
||||
parent.layer.close(index);
|
||||
window.parent.layui.table.reload('jobList');
|
||||
window.top.layer.msg(d.msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
}else{
|
||||
layer.msg(d.msg,{icon:5});
|
||||
}
|
||||
},error:function(){
|
||||
layer.alert("请求失败", {icon: 6},function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
layerAjax('addJob', data.field, 'jobList');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/lenos/main.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
</head>
|
||||
|
|
|
@ -15,8 +15,9 @@ To change this template use File | Settings | File Templates.-->
|
|||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
|
||||
</head>
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
|
@ -143,27 +144,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
});
|
||||
//监听提交
|
||||
form.on('submit(add)', function(data){
|
||||
$.ajax({
|
||||
url:'updateJob',
|
||||
type:'post',
|
||||
data:data.field,
|
||||
async:false, traditional: true,
|
||||
success:function(d){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
if(d.flag){
|
||||
parent.layer.close(index);
|
||||
window.parent.layui.table.reload('jobList');
|
||||
window.top.layer.msg(d.msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
}else{
|
||||
layer.msg(d.msg,{icon:5});
|
||||
}
|
||||
},error:function(){
|
||||
layer.alert("请求失败", {icon: 6},function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
layerAjax('updateJob', data.field, 'jobList');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/lenos/main.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
</head>
|
||||
|
|
|
@ -14,14 +14,14 @@ To change this template use File | Settings | File Templates.-->
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="x-body">
|
||||
<form class="layui-form layui-form-pane" style="margin-left: 20px;">
|
||||
<div style="width:100%;height:400px;overflow: auto;">
|
||||
<div style="width:100%;height:500px;overflow: auto;">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">基础信息</legend>
|
||||
|
@ -84,15 +84,19 @@ To change this template use File | Settings | File Templates.-->
|
|||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-item">
|
||||
<label for="icon" class="layui-form-label">
|
||||
<span class="x-red">*</span>图标
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="icon" id="icon" name="icon" lay-verify="icon"
|
||||
autocomplete="off" class="layui-input">
|
||||
<div style="margin-left: 20px;margin-top:5px">
|
||||
<ul>
|
||||
<li style="display: inline-block;width: 50px;" id="menu-icon"><i class="layui-icon" id="icon" style="font-size: 25px;"></i></li>
|
||||
<li style="display: inline-block;"><i class="layui-btn layui-btn-primary layui-btn-sm" id="select_icon">选择图标</i></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="orderNum" class="layui-form-label">
|
||||
<span class="x-red">*</span>序号
|
||||
|
@ -135,7 +139,17 @@ To change this template use File | Settings | File Templates.-->
|
|||
$('#pName').val(node.name);
|
||||
}
|
||||
});
|
||||
|
||||
$('#select_icon').click(function(){
|
||||
parent.layer.open({
|
||||
id:'icon',
|
||||
type: 2,
|
||||
area: ['800px','600px'],
|
||||
shade: 0.4,
|
||||
zIndex: layer.zIndex,
|
||||
title: '图标',
|
||||
content: '/plugin/html/icon.html'
|
||||
});
|
||||
});
|
||||
//自定义验证规则
|
||||
var type=$('#menuType');
|
||||
form.verify({
|
||||
|
@ -201,6 +215,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
});
|
||||
//监听提交
|
||||
form.on('submit(add)', function(data){
|
||||
data.field['icon']=$('#icon').text();
|
||||
$.ajax({
|
||||
url:'addMenu',
|
||||
type:'post',
|
||||
|
@ -211,6 +226,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
var index = parent.layer.getFrameIndex(window.name);
|
||||
window.top.layer.msg(data.msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
parent.layer.close(index);
|
||||
parent.location.replace(parent.location.href);
|
||||
},error:function(){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
window.top.layer.msg('请求失败',{icon:5,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
console.info(nodeId);
|
||||
alert(nodeId)
|
||||
}
|
||||
function update(nodeId){
|
||||
add('编辑菜单', 'showUpdateMenu?id='+nodeId, 700, 550);
|
||||
}
|
||||
|
||||
var layout = [
|
||||
{ name: '菜单名称', treeNodes: true, headerClass: 'value_col', colClass: 'value_col', style: 'width: 10%'
|
||||
|
@ -66,7 +69,7 @@
|
|||
render: function(row) {
|
||||
var chil_len=row.children.length;
|
||||
var str= '<a class="layui-btn layui-btn-primary layui-btn-xs" onclick="del(\'' + row.id + '\')"><i class="layui-icon"></i> 查看</a>' +
|
||||
'<a class="layui-btn layui-btn-xs layui-btn-normal" onclick="del(\'' + row.id + '\')"><i class="layui-icon"></i> 编辑</a>'; //列渲染
|
||||
'<a class="layui-btn layui-btn-xs layui-btn-normal" onclick="update(\'' + row.id + '\')"><i class="layui-icon"></i> 编辑</a>'; //列渲染
|
||||
if(chil_len==0){
|
||||
str+='<a class="layui-btn layui-btn-danger layui-btn-xs" onclick="del(\'' + row.id + '\')"><i class="layui-icon"></i> 删除</a>';
|
||||
}
|
||||
|
@ -85,7 +88,7 @@
|
|||
});
|
||||
var $ = layui.$, active = {
|
||||
add: function () {
|
||||
add('添加菜单', 'showAddMenu', 700, 450);
|
||||
add('添加菜单', 'showAddMenu', 700, 550);
|
||||
}
|
||||
}
|
||||
$('.layui-btn-group .layui-btn').on('click', function () {
|
||||
|
@ -99,7 +102,7 @@
|
|||
}
|
||||
;
|
||||
if (url == null || url == '') {
|
||||
url = "404.html";
|
||||
url = "/error/404";
|
||||
}
|
||||
;
|
||||
if (w == null || w == '') {
|
||||
|
|
|
@ -0,0 +1,269 @@
|
|||
<#--Created by IntelliJ IDEA.
|
||||
User: Administrator
|
||||
Date: 2018/3/5
|
||||
Time: 12:40
|
||||
To change this template use File | Settings | File Templates.-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>菜单管理</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="x-body">
|
||||
<form class="layui-form layui-form-pane" style="margin-left: 20px;">
|
||||
<div style="width:100%;height:500px;overflow: auto;">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">基础信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div style="margin-left:25%">
|
||||
<div class="layui-form-item">
|
||||
<label for="menuType" class="layui-form-label">
|
||||
<span class="x-red">*</span>类型
|
||||
</label>
|
||||
<div class="layui-input-block" style="width:190px;">
|
||||
<select disabled id="menuType" lay-verify="menuType" lay-filter="menuType">
|
||||
<option value=""></option>
|
||||
<option <#if (sysMenu.PId)??==null>selected</#if> value="2">一级菜单</option>
|
||||
<option <#if sysMenu.menuType='0'&&(sysMenu.PId)??>selected</#if> value="0">二级菜单</option>
|
||||
<option <#if sysMenu.menuType=='1'>selected</#if> value="1">按钮</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" id="pDiv">
|
||||
<label for="pName" class="layui-form-label">
|
||||
父级菜单
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<#-- <input type="hidden" id="pId" value="${sysMenu.PId}">-->
|
||||
<#--保留 但不做更新-->
|
||||
<input type="text" id="pName" disabled value="${pName}" onclick="showTree();" lay-verify="pName"
|
||||
class="layui-input">
|
||||
</div>
|
||||
<div id="treeNode" style="display:none; position: absolute;z-index:1000;background-color: white;">
|
||||
<div id="tree"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="name" class="layui-form-label">
|
||||
<span class="x-red">*</span>名称
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" value="${sysMenu.name}" id="name" name="name" lay-verify="name"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div id="ms" class="layui-form-mid layui-word-aux">
|
||||
<span class="x-red">*</span><span id="ums">必须填写</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="url" class="layui-form-label">
|
||||
url
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" value="${sysMenu.url}" id="url" name="url" lay-verify="url" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
|
||||
<label for="permission" class="layui-form-label">
|
||||
<span class="x-red">*</span>权限
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" value="${sysMenu.permission}" id="permission" name="permission" lay-verify="permission"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="icon" class="layui-form-label">
|
||||
<span class="x-red">*</span>图标
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<div style="margin-left: 20px;margin-top:5px">
|
||||
<ul>
|
||||
<li style="display: inline-block;width: 50px;" id="menu-icon"><i class="layui-icon" id="icon" style="font-size: 25px;">${sysMenu.icon}</i></li>
|
||||
<li style="display: inline-block;"><i class="layui-btn layui-btn-primary layui-btn-sm" id="select_icon">选择图标</i></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="orderNum" class="layui-form-label">
|
||||
<span class="x-red">*</span>序号
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="orderNum" value="${sysMenu.orderNum}" name="orderNum" lay-verify="orderNum"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 60px"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6;
|
||||
position: fixed;bottom: 1px;margin-left:-20px;">
|
||||
<div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">
|
||||
<button class="layui-btn layui-btn-normal" lay-filter="add" lay-submit="">
|
||||
更新
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-primary" id="close">
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['form','layer'], function(){
|
||||
$ = layui.jquery;
|
||||
var form = layui.form
|
||||
,layer = layui.layer;
|
||||
layui.tree({
|
||||
elem:'#tree',
|
||||
nodes:${menus}
|
||||
,click: function(node){
|
||||
if(node.menuType=='1'){
|
||||
layer.msg('请勿选择按钮', {icon: 5,anim:6});
|
||||
return false;
|
||||
}
|
||||
$('#pId').val(node.id);
|
||||
$('#pName').val(node.name);
|
||||
}
|
||||
});
|
||||
$('#select_icon').click(function(){
|
||||
parent.layer.open({
|
||||
id:'icon',
|
||||
type: 2,
|
||||
area: ['800px','600px'],
|
||||
shade: 0.4,
|
||||
zIndex: layer.zIndex,
|
||||
title: '图标',
|
||||
content: '/plugin/html/icon.html'
|
||||
});
|
||||
});
|
||||
|
||||
//自定义验证规则
|
||||
var type=$('#menuType');
|
||||
form.verify({
|
||||
menuType:function(v){
|
||||
console.info(v=='')
|
||||
if(v==''){
|
||||
return '类型不能为空';
|
||||
}
|
||||
}
|
||||
,pName:function(v){
|
||||
if(type.val()!='2'&&v.trim()==''){
|
||||
return '父菜单不能为空';
|
||||
}
|
||||
}
|
||||
,name:function(v){
|
||||
if(v.trim()==''){
|
||||
return '名称不能为空';
|
||||
}
|
||||
}
|
||||
,url:function(v){
|
||||
if(type.val()=='1'){
|
||||
$('#url').val('');
|
||||
}
|
||||
if(type.val()=='0'&&v.trim()==''){
|
||||
return 'url不能为空';
|
||||
}
|
||||
}
|
||||
,permission:function(v){
|
||||
if((type.val()=='1'||type.val()=='0')&&v.trim()==''){
|
||||
return '权限不能为空';
|
||||
}
|
||||
}
|
||||
,orderNum: [/^[0-9]*[1-9][0-9]*$/, '请填写序号(正整数)']
|
||||
});
|
||||
|
||||
form.on('select(menuType)', function(data){
|
||||
if(data.value=='2'){
|
||||
$('#pId').val('');
|
||||
dOs('pName',true);dOs('permission',true);dOs('url',false);
|
||||
}else if(data.value=='1'){//按钮
|
||||
dOs('url',true);dOs('pName',false);dOs('permission',false);
|
||||
}else if(data.value=='0'){
|
||||
dOs('url',false);dOs('pName',false);dOs('permission',false);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* id :元素id
|
||||
* flag true:禁止输入,false 允许输入
|
||||
*/
|
||||
function dOs(id,flag){
|
||||
var $id= $("#"+id);
|
||||
if(flag){
|
||||
$id.val('');
|
||||
$id.attr('disabled','disabled').css('background','#e6e6e6');
|
||||
}
|
||||
else
|
||||
$id.removeAttr('disabled').css('background','white')
|
||||
}
|
||||
|
||||
$('#close').click(function(){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(add)', function(data){
|
||||
data.field['icon']=$('#icon').text();
|
||||
data.field['id']='${sysMenu.id}';
|
||||
$.ajax({
|
||||
url:'updateMenu',
|
||||
type:'post',
|
||||
data:data.field,
|
||||
async:false, dataType: "json", traditional: true,
|
||||
success:function(data){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
window.top.layer.msg(data.msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
parent.layer.close(index);
|
||||
parent.location.replace(parent.location.href);
|
||||
},error:function(){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
window.top.layer.msg('请求失败',{icon:5,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
parent.layer.close(index);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
form.render();
|
||||
});
|
||||
|
||||
function showTree(){
|
||||
var p=$('#pName');
|
||||
var cityObj = p;
|
||||
var cityOffset =p.offset();
|
||||
var width=p.css('width');
|
||||
$('#treeNode').css({
|
||||
left: cityOffset.left + 'px',
|
||||
top: cityOffset.top + cityObj.outerHeight() + 'px',
|
||||
width:width,
|
||||
border:'1px solid #e6e6e6'
|
||||
}).slideDown('fast');
|
||||
$('body').bind('mousedown', onBodyDown);
|
||||
$('#treeNode').css('display','inline');
|
||||
}
|
||||
function hideMenu() {
|
||||
$('#treeNode').fadeOut('fast');
|
||||
$('body').unbind('blur', onBodyDown);
|
||||
}
|
||||
function onBodyDown(event) {
|
||||
if (! ( event.target.id == 'treeNode' || $(event.target).parents('#treeNode').length > 0)) {
|
||||
hideMenu();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -15,10 +15,11 @@ To change this template use File | Settings | File Templates.-->
|
|||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/ztree/js/jquery.ztree.core.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/ztree/js/jquery.ztree.excheck.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
|
||||
<script type="text/javascript">
|
||||
var setting = {
|
||||
check: {
|
||||
|
@ -128,28 +129,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
menus.push(jsonArr[item].id);
|
||||
}
|
||||
data.field.menus=menus;
|
||||
$.ajax({
|
||||
url:'addRole',
|
||||
type:'post',
|
||||
data:data.field,
|
||||
async:false, traditional: true,
|
||||
success:function(d){
|
||||
if(d.flag){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
window.parent.layui.table.reload('roleList');
|
||||
window.top.layer.msg(d.msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
}else{
|
||||
layer.msg(d.msg,{icon:5,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
}
|
||||
|
||||
},error:function(){
|
||||
layer.alert("请求失败", {icon: 6},function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
layerAjax('addRole',data.field,'roleList');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/lenos/main.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
</head>
|
||||
|
@ -225,7 +225,7 @@
|
|||
}
|
||||
;
|
||||
if (url == null || url == '') {
|
||||
url = "404.html";
|
||||
url = "/error/404";
|
||||
}
|
||||
;
|
||||
if (w == null || w == '') {
|
||||
|
@ -257,7 +257,7 @@
|
|||
title = false;
|
||||
}
|
||||
if (url == null || url == '') {
|
||||
url = "404.html";
|
||||
url = "/error/404";
|
||||
}
|
||||
if (w == null || w == '') {
|
||||
w = ($(window).width() * 0.9);
|
||||
|
@ -293,7 +293,7 @@
|
|||
}
|
||||
;
|
||||
if (url == null || url == '') {
|
||||
url = "404.html";
|
||||
url = "/error/404";
|
||||
}
|
||||
;
|
||||
if (w == null || w == '') {
|
||||
|
|
|
@ -12,15 +12,20 @@ To change this template use File | Settings | File Templates.-->
|
|||
<title>编辑角色</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/ztree/js/jquery.ztree.core.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/ztree/js/jquery.ztree.excheck.js" charset="utf-8"></script>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript"
|
||||
src="${re.contextPath}/plugin/ztree/js/jquery.ztree.core.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/ztree/js/jquery.ztree.excheck.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
(function ($) {
|
||||
$.fn.disable = function () {
|
||||
return $(this).find("*").each(function () {
|
||||
$(this).attr("disabled", "disabled");
|
||||
|
@ -29,31 +34,30 @@ To change this template use File | Settings | File Templates.-->
|
|||
})(jQuery);
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var flag='${detail}';
|
||||
if(flag){
|
||||
$(document).ready(function () {
|
||||
var flag = '${detail}';
|
||||
if (flag) {
|
||||
$("form").disable();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var setting = {
|
||||
check: {
|
||||
enable: true
|
||||
},
|
||||
data: {
|
||||
simpleData: {
|
||||
enable: true
|
||||
}
|
||||
}
|
||||
};
|
||||
var zNodes =${menus};
|
||||
$(document).ready(function(){
|
||||
$.fn.zTree.init($("#treeDemo"), setting, zNodes);
|
||||
});
|
||||
var setting = {
|
||||
check: {
|
||||
enable: true
|
||||
},
|
||||
data: {
|
||||
simpleData: {
|
||||
enable: true
|
||||
}
|
||||
}
|
||||
};
|
||||
var zNodes =${menus};
|
||||
$(document).ready(function () {
|
||||
$.fn.zTree.init($("#treeDemo"), setting, zNodes);
|
||||
});
|
||||
|
||||
|
||||
(function($) {
|
||||
(function ($) {
|
||||
$.fn.disable = function () {
|
||||
return $(this).find("*").each(function () {
|
||||
$(this).attr("disabled", "disabled");
|
||||
|
@ -62,9 +66,9 @@ To change this template use File | Settings | File Templates.-->
|
|||
})(jQuery);
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var flag='${detail}';
|
||||
if(flag){
|
||||
$(document).ready(function () {
|
||||
var flag = '${detail}';
|
||||
if (flag) {
|
||||
$("form").disable();
|
||||
}
|
||||
});
|
||||
|
@ -75,112 +79,99 @@ To change this template use File | Settings | File Templates.-->
|
|||
<div class="x-body">
|
||||
<form class="layui-form layui-form-pane" style="margin-left: 20px;">
|
||||
<div style="width:100%;height:400px;overflow: auto;">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">角色信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="roleName" class="layui-form-label">
|
||||
<span class="x-red">*</span>角色名称
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input value="${role.id}" type="hidden" name="id">
|
||||
<input type="text" value="${role.roleName}" id="roleName" name="roleName" lay-verify="roleName"
|
||||
autocomplete="off" class="layui-input">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">角色信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div id="ms" class="layui-form-mid layui-word-aux">
|
||||
<span class="x-red">*</span><span id="ums">角色名称必填</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="remark" class="layui-form-label">
|
||||
<span class="x-red">*</span>角色备注
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" value="${role.remark}" id="remark" name="remark" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">权限</legend>
|
||||
</fieldset>
|
||||
<div class="layui-form-item">
|
||||
<label for="roleName" class="layui-form-label">
|
||||
<span class="x-red">*</span>角色名称
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input value="${role.id}" type="hidden" name="id">
|
||||
<input type="text" value="${role.roleName}" id="roleName" name="roleName"
|
||||
lay-verify="roleName"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="remark" class="layui-form-label">
|
||||
<span class="x-red">*</span>权限选择
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="hidden" name="menus">
|
||||
<ul id="treeDemo" class="ztree"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ms" class="layui-form-mid layui-word-aux">
|
||||
<span class="x-red">*</span><span id="ums">角色名称必填</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="remark" class="layui-form-label">
|
||||
<span class="x-red">*</span>角色备注
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" value="${role.remark}" id="remark" name="remark" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">权限</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="remark" class="layui-form-label">
|
||||
<span class="x-red">*</span>权限选择
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="hidden" name="menus">
|
||||
<ul id="treeDemo" class="ztree"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 60px"></div>
|
||||
</div>
|
||||
<#if !detail>
|
||||
<div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6;
|
||||
<#if !detail>
|
||||
<div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6;
|
||||
position: fixed;bottom: 1px;margin-left:-20px;">
|
||||
<div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">
|
||||
<div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">
|
||||
|
||||
<button class="layui-btn layui-btn-normal" lay-filter="add" lay-submit>
|
||||
确认
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-primary" id="close">
|
||||
取消
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-normal" lay-filter="add" lay-submit>
|
||||
确认
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-primary" id="close">
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</#if>
|
||||
</#if>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['form','layer'], function(){
|
||||
layui.use(['form', 'layer'], function () {
|
||||
$ = layui.jquery;
|
||||
var form = layui.form
|
||||
,layer = layui.layer;
|
||||
, layer = layui.layer;
|
||||
|
||||
//自定义验证规则
|
||||
form.verify({
|
||||
roleName: function(value){
|
||||
if(value.trim()==""){
|
||||
roleName: function (value) {
|
||||
if (value.trim() == "") {
|
||||
return "角色名不能为空";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#close').click(function(){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
});
|
||||
$('#close').click(function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(add)', function(data){
|
||||
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
|
||||
var jsonArr= zTree.getCheckedNodes(true);
|
||||
var menus=[];
|
||||
for(var item in jsonArr){
|
||||
menus.push(jsonArr[item].id);
|
||||
}
|
||||
data.field.menus=menus;
|
||||
$.ajax({
|
||||
url:'updateRole',
|
||||
type:'post',
|
||||
data:data.field,
|
||||
async:false, traditional: true,
|
||||
success:function(d){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
window.parent.layui.table.reload('roleList');
|
||||
window.top.layer.msg(d.msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
},error:function(){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
window.top.layer.msg('请求失败',{icon:5,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
}
|
||||
});
|
||||
form.on('submit(add)', function (data) {
|
||||
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
|
||||
var jsonArr = zTree.getCheckedNodes(true);
|
||||
var menus = [];
|
||||
for (var item in jsonArr) {
|
||||
menus.push(jsonArr[item].id);
|
||||
}
|
||||
data.field.menus = menus;
|
||||
layerAjax('updateRole', data.field, 'roleList');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,8 +14,9 @@ To change this template use File | Settings | File Templates.-->
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -240,26 +241,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
}
|
||||
}
|
||||
data.field.role=role;
|
||||
$.ajax({
|
||||
url:'addUser',
|
||||
type:'post',
|
||||
data:data.field,
|
||||
async:false,traditional: true,
|
||||
success:function(d){
|
||||
if(d.flag){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
window.parent.layui.table.reload('userList');
|
||||
window.top.layer.msg(d.msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
}else{
|
||||
layer.msg(d.msg,{icon:5,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
}
|
||||
},error:function(){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
window.top.layer.msg('请求失败',{icon:5,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
}
|
||||
});
|
||||
layerAjax('addUser', data.field, 'userList');
|
||||
return false;
|
||||
});
|
||||
form.render();
|
||||
|
|
|
@ -14,7 +14,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
</head>
|
||||
|
||||
|
|
|
@ -14,8 +14,9 @@ To change this template use File | Settings | File Templates.-->
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
$.fn.disable = function () {
|
||||
|
@ -237,23 +238,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
}
|
||||
}
|
||||
data.field.role=role;
|
||||
$.ajax({
|
||||
url:'updateUser',
|
||||
type:'post',
|
||||
data:data.field,
|
||||
async:false,
|
||||
traditional: true,
|
||||
success:function(d){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
window.parent.layui.table.reload('userList');
|
||||
window.top.layer.msg(d.msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
},error:function(){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
window.top.layer.msg('请求失败',{icon:5,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
}
|
||||
});
|
||||
layerAjax('updateUser', data.field, 'userList');
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/lenos/main.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
|
||||
|
|
|
@ -0,0 +1,688 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>图标</title>
|
||||
<link rel="stylesheet" href="/plugin/layuitree/layui/css/layui.css">
|
||||
<script type="text/javascript" src="/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="/plugin/layer/layer.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
</head>
|
||||
<script>
|
||||
$(function(){
|
||||
var layer = layui.layer;
|
||||
$('li').on('click',function(){
|
||||
var text=$(this).find('div').eq(1).html();
|
||||
text=text.substring(5,text.length);
|
||||
var icon=$("#menu-icon" , window.parent.frames[0].document);
|
||||
icon.find('i').remove();
|
||||
icon.append('<i class="layui-icon" id="icon" style="font-size: 25px;">&'+text+'</i>');
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.layui-icon{font-size: 30px;}
|
||||
.site-doc-icon {
|
||||
margin-bottom: 50px;
|
||||
font-size: 0;
|
||||
}
|
||||
.site-doc-icon li{
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 127px;
|
||||
line-height: 25px;
|
||||
padding: 20px 0;
|
||||
margin-right: -1px;
|
||||
margin-bottom: -1px;
|
||||
border: 1px solid #e2e2e2;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
color: #666;
|
||||
transition: all .3s;
|
||||
-webkit-transition: all .3s;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
|
||||
<ul class="site-doc-icon">
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">主页</div>
|
||||
<div class="code">&#xe68e;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">赞</div>
|
||||
<div class="code">&#xe6c6;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">踩</div>
|
||||
<div class="code">&#xe6c5;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">男</div>
|
||||
<div class="code">&#xe662;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">女</div>
|
||||
<div class="code">&#xe661;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">相机-空心</div>
|
||||
<div class="code">&#xe660;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">相机-实心</div>
|
||||
<div class="code">&#xe65d;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">菜单-水平</div>
|
||||
<div class="code">&#xe65f;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">菜单-竖直</div>
|
||||
<div class="code">&#xe671;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">返回</div>
|
||||
<div class="code">&#xe65c;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">Hot</div>
|
||||
<div class="code">&#xe756;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">等级</div>
|
||||
<div class="code">&#xe735;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">金额-人民币</div>
|
||||
<div class="code">&#xe65e;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">金额-美元</div>
|
||||
<div class="code">&#xe659;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">位置</div>
|
||||
<div class="code">&#xe715;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">文档</div>
|
||||
<div class="code">&#xe705;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">检验</div>
|
||||
<div class="code">&#xe6b2;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">笑脸</div>
|
||||
<div class="code">&#xe6af;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">哭脸</div>
|
||||
<div class="code">&#xe69c;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">购物车1</div>
|
||||
<div class="code">&#xe698;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">购物车2</div>
|
||||
<div class="code">&#xe657;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">星级</div>
|
||||
<div class="code">&#xe658;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">上一页</div>
|
||||
<div class="code">&#xe65a;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">下一页</div>
|
||||
<div class="code">&#xe65b;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">上传-空心</div>
|
||||
<div class="code">&#xe681;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">上传-实心</div>
|
||||
<div class="code">&#xe67c;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">文件夹</div>
|
||||
<div class="code">&#xe7a0;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">应用</div>
|
||||
<div class="code">&#xe857;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">播放</div>
|
||||
<div class="code">&#xe652;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">播放暂停</div>
|
||||
<div class="code">&#xe651;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">音乐</div>
|
||||
<div class="code">&#xe6fc;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">视频</div>
|
||||
<div class="code">&#xe6ed;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">语音</div>
|
||||
<div class="code">&#xe688;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">喇叭</div>
|
||||
<div class="code">&#xe645;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">对话</div>
|
||||
<div class="code">&#xe611;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">设置</div>
|
||||
<div class="code">&#xe614;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">隐身-im</div>
|
||||
<div class="code">&#xe60f;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">搜索</div>
|
||||
<div class="code">&#xe615;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">分享</div>
|
||||
<div class="code">&#xe641;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon layui-anim layui-anim-rotate layui-anim-loop">ဂ</i>
|
||||
<div class="name">刷新</div>
|
||||
<div class="code">&#x1002;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon layui-anim layui-anim-rotate layui-anim-loop"></i>
|
||||
<div class="name">loading</div>
|
||||
<div class="code">&#xe63d;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon layui-anim layui-anim-rotate layui-anim-loop"></i>
|
||||
<div class="name">loading</div>
|
||||
<div class="code">&#xe63e;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">设置</div>
|
||||
<div class="code">&#xe620;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">引擎</div>
|
||||
<div class="code">&#xe628;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon">ဆ</i>
|
||||
<div class="name">阅卷错号</div>
|
||||
<div class="code">&#x1006;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon">ဇ</i>
|
||||
<div class="name">错-</div>
|
||||
<div class="code">&#x1007;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">报表</div>
|
||||
<div class="code">&#xe629;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">star</div>
|
||||
<div class="code">&#xe600;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">圆点</div>
|
||||
<div class="code">&#xe617;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">客服</div>
|
||||
<div class="code">&#xe606;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">发布</div>
|
||||
<div class="code">&#xe609;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">21cake_list</div>
|
||||
<div class="code">&#xe60a;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">图表</div>
|
||||
<div class="code">&#xe62c;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon">စ</i>
|
||||
<div class="name">正确</div>
|
||||
<div class="code">&#x1005;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">换肤2</div>
|
||||
<div class="code">&#xe61b;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">在线</div>
|
||||
<div class="code">&#xe610;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">右右</div>
|
||||
<div class="code">&#xe602;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">左左</div>
|
||||
<div class="code">&#xe603;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">表格</div>
|
||||
<div class="code">&#xe62d;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">icon_树</div>
|
||||
<div class="code">&#xe62e;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">上传</div>
|
||||
<div class="code">&#xe62f;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">添加</div>
|
||||
<div class="code">&#xe61f;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">下载</div>
|
||||
<div class="code">&#xe601;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">选择模版48</div>
|
||||
<div class="code">&#xe630;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">工具</div>
|
||||
<div class="code">&#xe631;</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">添加</div>
|
||||
<div class="code">&#xe654;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">编辑</div>
|
||||
<div class="code">&#xe642;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">删除</div>
|
||||
<div class="code">&#xe640;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">向下</div>
|
||||
<div class="code">&#xe61a;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">文件</div>
|
||||
<div class="code">&#xe621;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">布局</div>
|
||||
<div class="code">&#xe632;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">对勾</div>
|
||||
<div class="code">&#xe618;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">添加</div>
|
||||
<div class="code">&#xe608;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">么么直播-翻页</div>
|
||||
<div class="code">&#xe633;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">404</div>
|
||||
<div class="code">&#xe61c;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">轮播组图</div>
|
||||
<div class="code">&#xe634;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">help</div>
|
||||
<div class="code">&#xe607;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">代码1</div>
|
||||
<div class="code">&#xe635;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">进水</div>
|
||||
<div class="code">&#xe636;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">关于</div>
|
||||
<div class="code">&#xe60b;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">向上</div>
|
||||
<div class="code">&#xe619;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">日期</div>
|
||||
<div class="code">&#xe637;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">文件</div>
|
||||
<div class="code">&#xe61d;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">top</div>
|
||||
<div class="code">&#xe604;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">好友请求</div>
|
||||
<div class="code">&#xe612;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">对</div>
|
||||
<div class="code">&#xe605;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">窗口</div>
|
||||
<div class="code">&#xe638;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">表情</div>
|
||||
<div class="code">&#xe60c;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">正确</div>
|
||||
<div class="code">&#xe616;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">我的好友</div>
|
||||
<div class="code">&#xe613;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">文件下载</div>
|
||||
<div class="code">&#xe61e;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">图片</div>
|
||||
<div class="code">&#xe60d;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">链接</div>
|
||||
<div class="code">&#xe64c;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">记录</div>
|
||||
<div class="code">&#xe60e;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">文件夹</div>
|
||||
<div class="code">&#xe622;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">font-strikethrough</div>
|
||||
<div class="code">&#xe64f;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">unlink</div>
|
||||
<div class="code">&#xe64d;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">编辑_文字</div>
|
||||
<div class="code">&#xe639;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">三角</div>
|
||||
<div class="code">&#xe623;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">单选框-候选</div>
|
||||
<div class="code">&#xe63f;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">单选框-选中</div>
|
||||
<div class="code">&#xe643;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">居中对齐</div>
|
||||
<div class="code">&#xe647;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">右对齐</div>
|
||||
<div class="code">&#xe648;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">左对齐</div>
|
||||
<div class="code">&#xe649;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">勾选框(未打勾)</div>
|
||||
<div class="code">&#xe626;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">勾选框(已打勾)</div>
|
||||
<div class="code">&#xe627;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">加粗</div>
|
||||
<div class="code">&#xe62b;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">聊天 对话 IM 沟通</div>
|
||||
<div class="code">&#xe63a;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">文件夹_反</div>
|
||||
<div class="code">&#xe624;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">手机</div>
|
||||
<div class="code">&#xe63b;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">表情</div>
|
||||
<div class="code">&#xe650;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">html</div>
|
||||
<div class="code">&#xe64b;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">表单</div>
|
||||
<div class="code">&#xe63c;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">tab</div>
|
||||
<div class="code">&#xe62a;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">emw_代码</div>
|
||||
<div class="code">&#xe64e;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">字体-下划线</div>
|
||||
<div class="code">&#xe646;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">三角</div>
|
||||
<div class="code">&#xe625;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">图片</div>
|
||||
<div class="code">&#xe64a;</div>
|
||||
</li>
|
||||
<li>
|
||||
<i class="layui-icon"></i>
|
||||
<div class="name">斜体</div>
|
||||
<div class="code">&#xe644;</div>
|
||||
</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
|
@ -5,12 +5,14 @@
|
|||
<artifactId>lenosp</artifactId>
|
||||
<groupId>com.len</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>len-web</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>len-web Maven Webapp</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!--生成代码插件-->
|
||||
|
@ -45,6 +47,11 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<!--<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
</plugin>-->
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
|
|
@ -27,7 +27,8 @@ public class Application {
|
|||
public static void main(String[] args) {
|
||||
ApplicationContext applicationContext=SpringApplication.run(Application.class,args);
|
||||
String[] names = applicationContext.getBeanDefinitionNames();
|
||||
Arrays.asList(names).forEach(name -> System.out.println(name));//1.8 forEach循环
|
||||
//1.8 forEach循环
|
||||
Arrays.asList(names).forEach(System.out::println);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.len.config;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.ResolvableType;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/1/31.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Configuration
|
||||
public class BeanFactoryImpl implements BeanFactoryAware {
|
||||
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
System.out.println("BeanFactoryAware------->"+beanFactory);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.len.config;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/1/31.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Configuration
|
||||
public class BeanName implements BeanNameAware {
|
||||
|
||||
@Override
|
||||
public void setBeanName(String name) {
|
||||
System.out.println("BeanNameAware-------->:"+name);
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ public class SwaggerConfig extends WebMvcConfigurerAdapter{
|
|||
return new ApiInfoBuilder()
|
||||
.title("Swagger接口列表")
|
||||
.description("接口")
|
||||
.termsOfServiceUrl("http://localhost:8080/swagger-ui.html")
|
||||
.termsOfServiceUrl("http://localhost:8081/swagger-ui.html")
|
||||
.contact(new Contact("zxm","true08.com","154040976@qq.com"))
|
||||
.version("1.1.0")
|
||||
.build();
|
||||
|
|
28
pom.xml
28
pom.xml
|
@ -310,9 +310,33 @@
|
|||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!--<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>com.len.Application</mainClass>
|
||||
<layout>ZIP</layout>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.4.2</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<!-- <repositories>
|
||||
<repository>
|
||||
<id>lenos</id>
|
||||
<name>项目仓库</name>
|
||||
|
@ -324,5 +348,5 @@
|
|||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
</repositories>-->
|
||||
</project>
|
Loading…
Reference in New Issue