引入Hutool;修复多个FindBUG检测出的BUG
This commit is contained in:
parent
82c989211d
commit
468238c2ed
File diff suppressed because it is too large
Load Diff
|
@ -1,255 +1,255 @@
|
|||
/* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.activiti.rest.diagram.services;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.history.HistoricActivityInstance;
|
||||
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
|
||||
import org.activiti.engine.impl.pvm.PvmTransition;
|
||||
import org.activiti.engine.impl.pvm.process.ActivityImpl;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class ProcessInstanceHighlightsResource {
|
||||
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
private HistoryService historyService;
|
||||
|
||||
protected ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@RequestMapping(value="/process-instance/{processInstanceId}/highlights", method = RequestMethod.GET, produces = "application/json")
|
||||
public ObjectNode getHighlighted(@PathVariable String processInstanceId) {
|
||||
|
||||
ObjectNode responseJSON = objectMapper.createObjectNode();
|
||||
|
||||
responseJSON.put("processInstanceId", processInstanceId);
|
||||
|
||||
ArrayNode activitiesArray = objectMapper.createArrayNode();
|
||||
ArrayNode flowsArray = objectMapper.createArrayNode();
|
||||
|
||||
try {
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());
|
||||
|
||||
responseJSON.put("processDefinitionId", processInstance.getProcessDefinitionId());
|
||||
|
||||
List<String> highLightedActivities = runtimeService.getActiveActivityIds(processInstanceId);
|
||||
List<String> highLightedFlows = getHighLightedFlows(processDefinition, processInstanceId);
|
||||
|
||||
for (String activityId : highLightedActivities) {
|
||||
activitiesArray.add(activityId);
|
||||
}
|
||||
|
||||
for (String flow : highLightedFlows) {
|
||||
flowsArray.add(flow);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
responseJSON.put("activities", activitiesArray);
|
||||
responseJSON.put("flows", flowsArray);
|
||||
|
||||
return responseJSON;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getHighLightedFlows
|
||||
*
|
||||
* @param processDefinition
|
||||
* @param processInstanceId
|
||||
* @return
|
||||
*/
|
||||
private List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinition, String processInstanceId) {
|
||||
|
||||
List<String> highLightedFlows = new ArrayList<String>();
|
||||
|
||||
List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery()
|
||||
.processInstanceId(processInstanceId)
|
||||
//order by startime asc is not correct. use default order is correct.
|
||||
//.orderByHistoricActivityInstanceStartTime().asc()/*.orderByActivityId().asc()*/
|
||||
.list();
|
||||
|
||||
LinkedList<HistoricActivityInstance> hisActInstList = new LinkedList<HistoricActivityInstance>();
|
||||
hisActInstList.addAll(historicActivityInstances);
|
||||
|
||||
getHighlightedFlows(processDefinition.getActivities(), hisActInstList, highLightedFlows);
|
||||
|
||||
return highLightedFlows;
|
||||
}
|
||||
|
||||
/**
|
||||
* getHighlightedFlows
|
||||
*
|
||||
* code logic:
|
||||
* 1. Loop all activities by id asc order;
|
||||
* 2. Check each activity's outgoing transitions and eventBoundery outgoing transitions, if outgoing transitions's destination.id is in other executed activityIds, add this transition to highLightedFlows List;
|
||||
* 3. But if activity is not a parallelGateway or inclusiveGateway, only choose the earliest flow.
|
||||
*
|
||||
* @param activityList
|
||||
* @param hisActInstList
|
||||
* @param highLightedFlows
|
||||
*/
|
||||
private void getHighlightedFlows(List<ActivityImpl> activityList, LinkedList<HistoricActivityInstance> hisActInstList, List<String> highLightedFlows){
|
||||
|
||||
//check out startEvents in activityList
|
||||
List<ActivityImpl> startEventActList = new ArrayList<ActivityImpl>();
|
||||
Map<String, ActivityImpl> activityMap = new HashMap<String, ActivityImpl>(activityList.size());
|
||||
for(ActivityImpl activity : activityList){
|
||||
|
||||
activityMap.put(activity.getId(), activity);
|
||||
|
||||
String actType = (String) activity.getProperty("type");
|
||||
if (actType != null && actType.toLowerCase().indexOf("startevent") >= 0){
|
||||
startEventActList.add(activity);
|
||||
}
|
||||
}
|
||||
|
||||
//These codes is used to avoid a bug:
|
||||
//ACT-1728 If the process instance was started by a callActivity, it will be not have the startEvent activity in ACT_HI_ACTINST table
|
||||
//Code logic:
|
||||
//Check the first activity if it is a startEvent, if not check out the startEvent's highlight outgoing flow.
|
||||
HistoricActivityInstance firstHistActInst = hisActInstList.getFirst();
|
||||
String firstActType = (String) firstHistActInst.getActivityType();
|
||||
if (firstActType != null && firstActType.toLowerCase().indexOf("startevent") < 0){
|
||||
PvmTransition startTrans = getStartTransaction(startEventActList, firstHistActInst);
|
||||
if (startTrans != null){
|
||||
highLightedFlows.add(startTrans.getId());
|
||||
}
|
||||
}
|
||||
|
||||
while (!hisActInstList.isEmpty()) {
|
||||
HistoricActivityInstance histActInst = hisActInstList.removeFirst();
|
||||
ActivityImpl activity = activityMap.get(histActInst.getActivityId());
|
||||
if (activity != null) {
|
||||
boolean isParallel = false;
|
||||
String type = histActInst.getActivityType();
|
||||
if ("parallelGateway".equals(type) || "inclusiveGateway".equals(type)){
|
||||
isParallel = true;
|
||||
} else if ("subProcess".equals(histActInst.getActivityType())){
|
||||
getHighlightedFlows(activity.getActivities(), hisActInstList, highLightedFlows);
|
||||
}
|
||||
|
||||
List<PvmTransition> allOutgoingTrans = new ArrayList<PvmTransition>();
|
||||
allOutgoingTrans.addAll(activity.getOutgoingTransitions());
|
||||
allOutgoingTrans.addAll(getBoundaryEventOutgoingTransitions(activity));
|
||||
List<String> activityHighLightedFlowIds = getHighlightedFlows(allOutgoingTrans, hisActInstList, isParallel);
|
||||
highLightedFlows.addAll(activityHighLightedFlowIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check out the outgoing transition connected to firstActInst from startEventActList
|
||||
*
|
||||
* @param startEventActList
|
||||
* @param firstActInst
|
||||
* @return
|
||||
*/
|
||||
private PvmTransition getStartTransaction(List<ActivityImpl> startEventActList, HistoricActivityInstance firstActInst){
|
||||
for (ActivityImpl startEventAct: startEventActList) {
|
||||
for (PvmTransition trans : startEventAct.getOutgoingTransitions()) {
|
||||
if (trans.getDestination().getId().equals(firstActInst.getActivityId())) {
|
||||
return trans;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* getBoundaryEventOutgoingTransitions
|
||||
*
|
||||
* @param activity
|
||||
* @return
|
||||
*/
|
||||
private List<PvmTransition> getBoundaryEventOutgoingTransitions(ActivityImpl activity){
|
||||
List<PvmTransition> boundaryTrans = new ArrayList<PvmTransition>();
|
||||
for(ActivityImpl subActivity : activity.getActivities()){
|
||||
String type = (String)subActivity.getProperty("type");
|
||||
if(type!=null && type.toLowerCase().indexOf("boundary")>=0){
|
||||
boundaryTrans.addAll(subActivity.getOutgoingTransitions());
|
||||
}
|
||||
}
|
||||
return boundaryTrans;
|
||||
}
|
||||
|
||||
/**
|
||||
* find out single activity's highlighted flowIds
|
||||
*
|
||||
* @param activity
|
||||
* @param hisActInstList
|
||||
* @param isExclusive if true only return one flowId(Such as exclusiveGateway, BoundaryEvent On Task)
|
||||
* @return
|
||||
*/
|
||||
private List<String> getHighlightedFlows(List<PvmTransition> pvmTransitionList, LinkedList<HistoricActivityInstance> hisActInstList, boolean isParallel){
|
||||
|
||||
List<String> highLightedFlowIds = new ArrayList<String>();
|
||||
|
||||
PvmTransition earliestTrans = null;
|
||||
HistoricActivityInstance earliestHisActInst = null;
|
||||
|
||||
for (PvmTransition pvmTransition : pvmTransitionList) {
|
||||
|
||||
String destActId = pvmTransition.getDestination().getId();
|
||||
HistoricActivityInstance destHisActInst = findHisActInst(hisActInstList, destActId);
|
||||
if (destHisActInst != null) {
|
||||
if (isParallel) {
|
||||
highLightedFlowIds.add(pvmTransition.getId());
|
||||
} else if (earliestHisActInst == null || (earliestHisActInst.getId().compareTo(destHisActInst.getId()) > 0)) {
|
||||
earliestTrans = pvmTransition;
|
||||
earliestHisActInst = destHisActInst;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((!isParallel) && earliestTrans!=null){
|
||||
highLightedFlowIds.add(earliestTrans.getId());
|
||||
}
|
||||
|
||||
return highLightedFlowIds;
|
||||
}
|
||||
|
||||
private HistoricActivityInstance findHisActInst(LinkedList<HistoricActivityInstance> hisActInstList, String actId){
|
||||
for (HistoricActivityInstance hisActInst : hisActInstList){
|
||||
if (hisActInst.getActivityId().equals(actId)){
|
||||
return hisActInst;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.activiti.rest.diagram.services;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.history.HistoricActivityInstance;
|
||||
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
|
||||
import org.activiti.engine.impl.pvm.PvmTransition;
|
||||
import org.activiti.engine.impl.pvm.process.ActivityImpl;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class ProcessInstanceHighlightsResource {
|
||||
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
private HistoryService historyService;
|
||||
|
||||
protected ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@RequestMapping(value="/process-instance/{processInstanceId}/highlights", method = RequestMethod.GET, produces = "application/json")
|
||||
public ObjectNode getHighlighted(@PathVariable String processInstanceId) {
|
||||
|
||||
ObjectNode responseJSON = objectMapper.createObjectNode();
|
||||
|
||||
responseJSON.put("processInstanceId", processInstanceId);
|
||||
|
||||
ArrayNode activitiesArray = objectMapper.createArrayNode();
|
||||
ArrayNode flowsArray = objectMapper.createArrayNode();
|
||||
|
||||
try {
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());
|
||||
|
||||
responseJSON.put("processDefinitionId", processInstance.getProcessDefinitionId());
|
||||
|
||||
List<String> highLightedActivities = runtimeService.getActiveActivityIds(processInstanceId);
|
||||
List<String> highLightedFlows = getHighLightedFlows(processDefinition, processInstanceId);
|
||||
|
||||
for (String activityId : highLightedActivities) {
|
||||
activitiesArray.add(activityId);
|
||||
}
|
||||
|
||||
for (String flow : highLightedFlows) {
|
||||
flowsArray.add(flow);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
responseJSON.set("activities", activitiesArray);
|
||||
responseJSON.set("flows", flowsArray);
|
||||
|
||||
return responseJSON;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getHighLightedFlows
|
||||
*
|
||||
* @param processDefinition
|
||||
* @param processInstanceId
|
||||
* @return
|
||||
*/
|
||||
private List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinition, String processInstanceId) {
|
||||
|
||||
List<String> highLightedFlows = new ArrayList<String>();
|
||||
|
||||
List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery()
|
||||
.processInstanceId(processInstanceId)
|
||||
//order by startime asc is not correct. use default order is correct.
|
||||
//.orderByHistoricActivityInstanceStartTime().asc()/*.orderByActivityId().asc()*/
|
||||
.list();
|
||||
|
||||
LinkedList<HistoricActivityInstance> hisActInstList = new LinkedList<HistoricActivityInstance>();
|
||||
hisActInstList.addAll(historicActivityInstances);
|
||||
|
||||
getHighlightedFlows(processDefinition.getActivities(), hisActInstList, highLightedFlows);
|
||||
|
||||
return highLightedFlows;
|
||||
}
|
||||
|
||||
/**
|
||||
* getHighlightedFlows
|
||||
*
|
||||
* code logic:
|
||||
* 1. Loop all activities by id asc order;
|
||||
* 2. Check each activity's outgoing transitions and eventBoundery outgoing transitions, if outgoing transitions's destination.id is in other executed activityIds, add this transition to highLightedFlows List;
|
||||
* 3. But if activity is not a parallelGateway or inclusiveGateway, only choose the earliest flow.
|
||||
*
|
||||
* @param activityList
|
||||
* @param hisActInstList
|
||||
* @param highLightedFlows
|
||||
*/
|
||||
private void getHighlightedFlows(List<ActivityImpl> activityList, LinkedList<HistoricActivityInstance> hisActInstList, List<String> highLightedFlows){
|
||||
|
||||
//check out startEvents in activityList
|
||||
List<ActivityImpl> startEventActList = new ArrayList<ActivityImpl>();
|
||||
Map<String, ActivityImpl> activityMap = new HashMap<String, ActivityImpl>(activityList.size());
|
||||
for(ActivityImpl activity : activityList){
|
||||
|
||||
activityMap.put(activity.getId(), activity);
|
||||
|
||||
String actType = (String) activity.getProperty("type");
|
||||
if (actType != null && actType.toLowerCase().indexOf("startevent") >= 0){
|
||||
startEventActList.add(activity);
|
||||
}
|
||||
}
|
||||
|
||||
//These codes is used to avoid a bug:
|
||||
//ACT-1728 If the process instance was started by a callActivity, it will be not have the startEvent activity in ACT_HI_ACTINST table
|
||||
//Code logic:
|
||||
//Check the first activity if it is a startEvent, if not check out the startEvent's highlight outgoing flow.
|
||||
HistoricActivityInstance firstHistActInst = hisActInstList.getFirst();
|
||||
String firstActType = (String) firstHistActInst.getActivityType();
|
||||
if (firstActType != null && firstActType.toLowerCase().indexOf("startevent") < 0){
|
||||
PvmTransition startTrans = getStartTransaction(startEventActList, firstHistActInst);
|
||||
if (startTrans != null){
|
||||
highLightedFlows.add(startTrans.getId());
|
||||
}
|
||||
}
|
||||
|
||||
while (!hisActInstList.isEmpty()) {
|
||||
HistoricActivityInstance histActInst = hisActInstList.removeFirst();
|
||||
ActivityImpl activity = activityMap.get(histActInst.getActivityId());
|
||||
if (activity != null) {
|
||||
boolean isParallel = false;
|
||||
String type = histActInst.getActivityType();
|
||||
if ("parallelGateway".equals(type) || "inclusiveGateway".equals(type)){
|
||||
isParallel = true;
|
||||
} else if ("subProcess".equals(histActInst.getActivityType())){
|
||||
getHighlightedFlows(activity.getActivities(), hisActInstList, highLightedFlows);
|
||||
}
|
||||
|
||||
List<PvmTransition> allOutgoingTrans = new ArrayList<PvmTransition>();
|
||||
allOutgoingTrans.addAll(activity.getOutgoingTransitions());
|
||||
allOutgoingTrans.addAll(getBoundaryEventOutgoingTransitions(activity));
|
||||
List<String> activityHighLightedFlowIds = getHighlightedFlows(allOutgoingTrans, hisActInstList, isParallel);
|
||||
highLightedFlows.addAll(activityHighLightedFlowIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check out the outgoing transition connected to firstActInst from startEventActList
|
||||
*
|
||||
* @param startEventActList
|
||||
* @param firstActInst
|
||||
* @return
|
||||
*/
|
||||
private PvmTransition getStartTransaction(List<ActivityImpl> startEventActList, HistoricActivityInstance firstActInst){
|
||||
for (ActivityImpl startEventAct: startEventActList) {
|
||||
for (PvmTransition trans : startEventAct.getOutgoingTransitions()) {
|
||||
if (trans.getDestination().getId().equals(firstActInst.getActivityId())) {
|
||||
return trans;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* getBoundaryEventOutgoingTransitions
|
||||
*
|
||||
* @param activity
|
||||
* @return
|
||||
*/
|
||||
private List<PvmTransition> getBoundaryEventOutgoingTransitions(ActivityImpl activity){
|
||||
List<PvmTransition> boundaryTrans = new ArrayList<PvmTransition>();
|
||||
for(ActivityImpl subActivity : activity.getActivities()){
|
||||
String type = (String)subActivity.getProperty("type");
|
||||
if(type!=null && type.toLowerCase().indexOf("boundary")>=0){
|
||||
boundaryTrans.addAll(subActivity.getOutgoingTransitions());
|
||||
}
|
||||
}
|
||||
return boundaryTrans;
|
||||
}
|
||||
|
||||
/**
|
||||
* find out single activity's highlighted flowIds
|
||||
*
|
||||
* @param activity
|
||||
* @param hisActInstList
|
||||
* @param isExclusive if true only return one flowId(Such as exclusiveGateway, BoundaryEvent On Task)
|
||||
* @return
|
||||
*/
|
||||
private List<String> getHighlightedFlows(List<PvmTransition> pvmTransitionList, LinkedList<HistoricActivityInstance> hisActInstList, boolean isParallel){
|
||||
|
||||
List<String> highLightedFlowIds = new ArrayList<String>();
|
||||
|
||||
PvmTransition earliestTrans = null;
|
||||
HistoricActivityInstance earliestHisActInst = null;
|
||||
|
||||
for (PvmTransition pvmTransition : pvmTransitionList) {
|
||||
|
||||
String destActId = pvmTransition.getDestination().getId();
|
||||
HistoricActivityInstance destHisActInst = findHisActInst(hisActInstList, destActId);
|
||||
if (destHisActInst != null) {
|
||||
if (isParallel) {
|
||||
highLightedFlowIds.add(pvmTransition.getId());
|
||||
} else if (earliestHisActInst == null || (earliestHisActInst.getId().compareTo(destHisActInst.getId()) > 0)) {
|
||||
earliestTrans = pvmTransition;
|
||||
earliestHisActInst = destHisActInst;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((!isParallel) && earliestTrans!=null){
|
||||
highLightedFlowIds.add(earliestTrans.getId());
|
||||
}
|
||||
|
||||
return highLightedFlowIds;
|
||||
}
|
||||
|
||||
private HistoricActivityInstance findHisActInst(LinkedList<HistoricActivityInstance> hisActInstList, String actId){
|
||||
for (HistoricActivityInstance hisActInst : hisActInstList){
|
||||
if (hisActInst.getActivityId().equals(actId)){
|
||||
return hisActInst;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,71 +1,71 @@
|
|||
/* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.activiti.rest.editor.model;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.activiti.editor.constants.ModelDataJsonConstants;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author Tijs Rademakers
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("service")
|
||||
public class ModelEditorJsonRestResource implements ModelDataJsonConstants {
|
||||
|
||||
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelEditorJsonRestResource.class);
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@RequestMapping(value="/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
|
||||
public ObjectNode getEditorJson(@PathVariable String modelId) {
|
||||
ObjectNode modelNode = null;
|
||||
|
||||
Model model = repositoryService.getModel(modelId);
|
||||
|
||||
if (model != null) {
|
||||
try {
|
||||
if (StringUtils.isNotEmpty(model.getMetaInfo())) {
|
||||
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
|
||||
} else {
|
||||
modelNode = objectMapper.createObjectNode();
|
||||
modelNode.put(MODEL_NAME, model.getName());
|
||||
}
|
||||
modelNode.put(MODEL_ID, model.getId());
|
||||
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(
|
||||
new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
|
||||
modelNode.put("model", editorJsonNode);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error creating model JSON", e);
|
||||
throw new ActivitiException("Error creating model JSON", e);
|
||||
}
|
||||
}
|
||||
return modelNode;
|
||||
}
|
||||
}
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.activiti.rest.editor.model;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.activiti.editor.constants.ModelDataJsonConstants;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author Tijs Rademakers
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("service")
|
||||
public class ModelEditorJsonRestResource implements ModelDataJsonConstants {
|
||||
|
||||
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelEditorJsonRestResource.class);
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@RequestMapping(value="/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
|
||||
public ObjectNode getEditorJson(@PathVariable String modelId) {
|
||||
ObjectNode modelNode = null;
|
||||
|
||||
Model model = repositoryService.getModel(modelId);
|
||||
|
||||
if (model != null) {
|
||||
try {
|
||||
if (StringUtils.isNotEmpty(model.getMetaInfo())) {
|
||||
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
|
||||
} else {
|
||||
modelNode = objectMapper.createObjectNode();
|
||||
modelNode.put(MODEL_NAME, model.getName());
|
||||
}
|
||||
modelNode.put(MODEL_ID, model.getId());
|
||||
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(
|
||||
new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
|
||||
modelNode.set("model", editorJsonNode);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error creating model JSON", e);
|
||||
throw new ActivitiException("Error creating model JSON", e);
|
||||
}
|
||||
}
|
||||
return modelNode;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,104 +1,103 @@
|
|||
/* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.activiti.rest.editor.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.activiti.editor.constants.ModelDataJsonConstants;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.apache.batik.transcoder.TranscoderInput;
|
||||
import org.apache.batik.transcoder.TranscoderOutput;
|
||||
import org.apache.batik.transcoder.image.PNGTranscoder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author Tijs Rademakers
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("service")
|
||||
public class ModelSaveRestResource implements ModelDataJsonConstants {
|
||||
|
||||
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelSaveRestResource.class);
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
|
||||
@PostMapping(value="/model/{modelId}/save")
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public void saveModel(@PathVariable String modelId
|
||||
, String name, String description
|
||||
, String json_xml, String svg_xml,HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
Map<String, String[]> map= request.getParameterMap();
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
//全跑到key了,可取方案
|
||||
for(Map.Entry<String,String[]> entry:map.entrySet()){
|
||||
String data=entry.getKey()+"="+(entry.getValue()[0]);
|
||||
jsonObject= JSON.parseObject(data);
|
||||
}
|
||||
name= (String) jsonObject.get("name");
|
||||
description= (String) jsonObject.get("description");
|
||||
json_xml= (String) jsonObject.get("json_xml");
|
||||
svg_xml= (String) jsonObject.get("svg_xml");
|
||||
|
||||
Model model = repositoryService.getModel(modelId);
|
||||
JSONObject object=new JSONObject();
|
||||
object.put(MODEL_NAME, name);
|
||||
object.put(MODEL_DESCRIPTION, description);
|
||||
model.setMetaInfo(object.toString());
|
||||
model.setName(name);
|
||||
repositoryService.saveModel(model);
|
||||
|
||||
repositoryService.addModelEditorSource(model.getId(), json_xml.getBytes("utf-8"));
|
||||
|
||||
InputStream svgStream = new ByteArrayInputStream(svg_xml.getBytes("utf-8"));
|
||||
TranscoderInput input = new TranscoderInput(svgStream);
|
||||
|
||||
PNGTranscoder transcoder = new PNGTranscoder();
|
||||
// Setup output
|
||||
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
|
||||
TranscoderOutput output = new TranscoderOutput(outStream);
|
||||
|
||||
// Do the transformation
|
||||
transcoder.transcode(input, output);
|
||||
final byte[] result = outStream.toByteArray();
|
||||
repositoryService.addModelEditorSourceExtra(model.getId(), result);
|
||||
outStream.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error saving model", e);
|
||||
throw new ActivitiException("Error saving model", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.activiti.rest.editor.model;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.activiti.editor.constants.ModelDataJsonConstants;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.apache.batik.transcoder.TranscoderInput;
|
||||
import org.apache.batik.transcoder.TranscoderOutput;
|
||||
import org.apache.batik.transcoder.image.PNGTranscoder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* @author Tijs Rademakers
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("service")
|
||||
public class ModelSaveRestResource implements ModelDataJsonConstants {
|
||||
|
||||
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelSaveRestResource.class);
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
|
||||
@PostMapping(value="/model/{modelId}/save")
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public void saveModel(@PathVariable String modelId
|
||||
, String name, String description
|
||||
, String json_xml, String svg_xml,HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
Map<String, String[]> map= request.getParameterMap();
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
//全跑到key了,可取方案
|
||||
for(Map.Entry<String,String[]> entry:map.entrySet()){
|
||||
String data=entry.getKey()+"="+(entry.getValue()[0]);
|
||||
jsonObject= JSON.parseObject(data);
|
||||
}
|
||||
name= (String) jsonObject.get("name");
|
||||
description= (String) jsonObject.get("description");
|
||||
json_xml= (String) jsonObject.get("json_xml");
|
||||
svg_xml= (String) jsonObject.get("svg_xml");
|
||||
|
||||
Model model = repositoryService.getModel(modelId);
|
||||
JSONObject object=new JSONObject();
|
||||
object.put(MODEL_NAME, name);
|
||||
object.put(MODEL_DESCRIPTION, description);
|
||||
model.setMetaInfo(object.toString());
|
||||
model.setName(name);
|
||||
repositoryService.saveModel(model);
|
||||
|
||||
repositoryService.addModelEditorSource(model.getId(), json_xml.getBytes("utf-8"));
|
||||
|
||||
InputStream svgStream = new ByteArrayInputStream(svg_xml.getBytes("utf-8"));
|
||||
TranscoderInput input = new TranscoderInput(svgStream);
|
||||
|
||||
PNGTranscoder transcoder = new PNGTranscoder();
|
||||
// Setup output
|
||||
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
|
||||
TranscoderOutput output = new TranscoderOutput(outStream);
|
||||
|
||||
// Do the transformation
|
||||
transcoder.transcode(input, output);
|
||||
final byte[] result = outStream.toByteArray();
|
||||
repositoryService.addModelEditorSourceExtra(model.getId(), result);
|
||||
outStream.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error saving model", e);
|
||||
throw new ActivitiException("Error saving model", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,62 +1,62 @@
|
|||
package com.len.base;
|
||||
|
||||
import com.len.util.JsonUtil;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.shiro.authz.AuthorizationException;
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import org.springframework.beans.propertyeditors.CustomDateEditor;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/19.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
public abstract class BaseController<T> {
|
||||
|
||||
@InitBinder
|
||||
protected void initBinder(WebDataBinder binder) {
|
||||
binder.registerCustomEditor(Date.class, new CustomDateEditor(
|
||||
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), true));
|
||||
binder.registerCustomEditor(Date.class, new CustomDateEditor(
|
||||
new SimpleDateFormat("yyyy-MM-dd"), true));
|
||||
}
|
||||
|
||||
@ExceptionHandler({ UnauthorizedException.class, AuthorizationException.class })
|
||||
public String authorizationException(HttpServletRequest request, HttpServletResponse response) {
|
||||
if (isAjaxRequest(request)) {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("code", "-998");
|
||||
map.put("message", "无权限");
|
||||
//response.gets
|
||||
return null;
|
||||
} else {
|
||||
String message="权限不足";
|
||||
try {
|
||||
message = URLEncoder.encode(message,"utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "redirect:/error/403?message="+message;
|
||||
}
|
||||
}
|
||||
public static boolean isAjaxRequest(HttpServletRequest request) {
|
||||
String requestedWith = request.getHeader("x-requested-with");
|
||||
if (requestedWith != null && requestedWith.equalsIgnoreCase("XMLHttpRequest")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package com.len.base;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.shiro.authz.AuthorizationException;
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import org.springframework.beans.propertyeditors.CustomDateEditor;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/19.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
public abstract class BaseController<T> {
|
||||
|
||||
@InitBinder
|
||||
protected void initBinder(WebDataBinder binder) {
|
||||
binder.registerCustomEditor(Date.class, new CustomDateEditor(
|
||||
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), true));
|
||||
binder.registerCustomEditor(Date.class, new CustomDateEditor(
|
||||
new SimpleDateFormat("yyyy-MM-dd"), true));
|
||||
}
|
||||
|
||||
@ExceptionHandler({ UnauthorizedException.class, AuthorizationException.class })
|
||||
public String authorizationException(HttpServletRequest request, HttpServletResponse response) {
|
||||
if (isAjaxRequest(request)) {
|
||||
Map<String,Object> map = Maps.newHashMap();
|
||||
map.put("code", "-998");
|
||||
map.put("message", "无权限");
|
||||
//response.gets
|
||||
return null;
|
||||
} else {
|
||||
String message="权限不足";
|
||||
try {
|
||||
message = URLEncoder.encode(message,"utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "redirect:/error/403?message="+message;
|
||||
}
|
||||
}
|
||||
public static boolean isAjaxRequest(HttpServletRequest request) {
|
||||
String requestedWith = request.getHeader("x-requested-with");
|
||||
if (requestedWith != null && requestedWith.equalsIgnoreCase("XMLHttpRequest")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,54 +1,60 @@
|
|||
package com.len.base;
|
||||
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/30.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class CurrentMenu {
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String pId;
|
||||
|
||||
private String url;
|
||||
|
||||
private Integer orderNum;
|
||||
|
||||
private String icon;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date createDate;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private Date updateDate;
|
||||
|
||||
private String permission;
|
||||
|
||||
private Byte menuType;
|
||||
/**菜单排序id 填充菜单展示id*/
|
||||
private int num;
|
||||
|
||||
public CurrentMenu(String id, String name, String pId, String url, Integer orderNum, String icon, String permission, Byte menuType, int num) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.pId = pId;
|
||||
this.url = url;
|
||||
this.orderNum = orderNum;
|
||||
this.icon = icon;
|
||||
this.permission = permission;
|
||||
this.menuType = menuType;
|
||||
this.num = num;
|
||||
}
|
||||
}
|
||||
package com.len.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/30.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class CurrentMenu implements Serializable {
|
||||
/**
|
||||
* @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String pId;
|
||||
|
||||
private String url;
|
||||
|
||||
private Integer orderNum;
|
||||
|
||||
private String icon;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date createDate;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private Date updateDate;
|
||||
|
||||
private String permission;
|
||||
|
||||
private Byte menuType;
|
||||
/**菜单排序id 填充菜单展示id*/
|
||||
private int num;
|
||||
|
||||
public CurrentMenu(String id, String name, String pId, String url, Integer orderNum, String icon, String permission, Byte menuType, int num) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.pId = pId;
|
||||
this.url = url;
|
||||
this.orderNum = orderNum;
|
||||
this.icon = icon;
|
||||
this.permission = permission;
|
||||
this.menuType = menuType;
|
||||
this.num = num;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,28 +1,35 @@
|
|||
package com.len.base;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/30.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class CurrentRole {
|
||||
|
||||
private String id;
|
||||
|
||||
private String roleName;
|
||||
|
||||
private String remark;
|
||||
|
||||
public CurrentRole(String id, String roleName, String remark) {
|
||||
this.id = id;
|
||||
this.roleName = roleName;
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
package com.len.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/30.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class CurrentRole implements Serializable {
|
||||
|
||||
/**
|
||||
* @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
|
||||
private String roleName;
|
||||
|
||||
private String remark;
|
||||
|
||||
public CurrentRole(String id, String roleName, String remark) {
|
||||
this.id = id;
|
||||
this.roleName = roleName;
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,116 +1,117 @@
|
|||
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;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/13.
|
||||
* @email 154040976@qq.com
|
||||
* 菜单
|
||||
*/
|
||||
@RequestMapping("/menu")
|
||||
@Controller
|
||||
public class MenuController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
/**
|
||||
* 展示tree
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "/showMenu", httpMethod = "GET", notes = "展示菜单")
|
||||
@Log(desc = "展示菜单",type = Log.LOG_TYPE.SELECT)
|
||||
@GetMapping(value = "showMenu")
|
||||
@RequiresPermissions("menu:show")
|
||||
public String showMenu(Model model){
|
||||
JSONArray ja=menuService.getMenuJsonList();
|
||||
model.addAttribute("menus", ja.toJSONString());
|
||||
return "/system/menu/menuList";
|
||||
}
|
||||
|
||||
@GetMapping(value = "showAddMenu")
|
||||
public String addMenu(Model model){
|
||||
JSONArray ja=menuService.getMenuJsonList();
|
||||
System.out.print(ja.toJSONString());
|
||||
model.addAttribute("menus", ja.toJSONString());
|
||||
return "/system/menu/add-menu";
|
||||
}
|
||||
|
||||
@Log(desc = "添加菜单",type = LOG_TYPE.UPDATE)
|
||||
@ApiOperation(value = "/addMenu", httpMethod = "POST", notes = "添加菜单")
|
||||
@PostMapping(value = "addMenu")
|
||||
@ResponseBody
|
||||
public JsonUtil addMenu(SysMenu sysMenu,Model model){
|
||||
if(StringUtils.isEmpty(sysMenu.getPId())){
|
||||
sysMenu.setPId(null);
|
||||
}
|
||||
if(StringUtils.isEmpty(sysMenu.getUrl())){
|
||||
sysMenu.setUrl(null);
|
||||
}
|
||||
if(StringUtils.isEmpty(sysMenu.getPermission())){
|
||||
sysMenu.setPermission(null);
|
||||
}
|
||||
JsonUtil jsonUtil=new JsonUtil();
|
||||
jsonUtil.setFlag(false);
|
||||
if(sysMenu==null){
|
||||
jsonUtil.setMsg("获取数据失败");
|
||||
return jsonUtil;
|
||||
}
|
||||
try{
|
||||
if(sysMenu.getMenuType()==2){
|
||||
sysMenu.setMenuType((byte)0);
|
||||
}
|
||||
menuService.insertSelective(sysMenu);
|
||||
jsonUtil.setMsg("添加成功");
|
||||
}catch (MyException e){
|
||||
e.printStackTrace();
|
||||
jsonUtil.setMsg("添加失败");
|
||||
}
|
||||
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("保存成功");
|
||||
}
|
||||
|
||||
}
|
||||
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;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/13.
|
||||
* @email 154040976@qq.com
|
||||
* 菜单
|
||||
*/
|
||||
@RequestMapping("/menu")
|
||||
@Controller
|
||||
public class MenuController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
/**
|
||||
* 展示tree
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "/showMenu", httpMethod = "GET", notes = "展示菜单")
|
||||
@Log(desc = "展示菜单",type = Log.LOG_TYPE.SELECT)
|
||||
@GetMapping(value = "showMenu")
|
||||
@RequiresPermissions("menu:show")
|
||||
public String showMenu(Model model){
|
||||
JSONArray ja=menuService.getMenuJsonList();
|
||||
model.addAttribute("menus", ja.toJSONString());
|
||||
return "/system/menu/menuList";
|
||||
}
|
||||
|
||||
@GetMapping(value = "showAddMenu")
|
||||
public String addMenu(Model model){
|
||||
JSONArray ja=menuService.getMenuJsonList();
|
||||
System.out.print(ja.toJSONString());
|
||||
model.addAttribute("menus", ja.toJSONString());
|
||||
return "/system/menu/add-menu";
|
||||
}
|
||||
|
||||
@Log(desc = "添加菜单",type = LOG_TYPE.UPDATE)
|
||||
@ApiOperation(value = "/addMenu", httpMethod = "POST", notes = "添加菜单")
|
||||
@PostMapping(value = "addMenu")
|
||||
@ResponseBody
|
||||
public JsonUtil addMenu(SysMenu sysMenu,Model model){
|
||||
JsonUtil jsonUtil=new JsonUtil();
|
||||
jsonUtil.setFlag(false);
|
||||
if(sysMenu==null){
|
||||
jsonUtil.setMsg("获取数据失败");
|
||||
return jsonUtil;
|
||||
}
|
||||
if(StringUtils.isEmpty(sysMenu.getPId())){
|
||||
sysMenu.setPId(null);
|
||||
}
|
||||
if(StringUtils.isEmpty(sysMenu.getUrl())){
|
||||
sysMenu.setUrl(null);
|
||||
}
|
||||
if(StringUtils.isEmpty(sysMenu.getPermission())){
|
||||
sysMenu.setPermission(null);
|
||||
}
|
||||
|
||||
try{
|
||||
if(sysMenu.getMenuType()==2){
|
||||
sysMenu.setMenuType((byte)0);
|
||||
}
|
||||
menuService.insertSelective(sysMenu);
|
||||
jsonUtil.setMsg("添加成功");
|
||||
}catch (MyException e){
|
||||
e.printStackTrace();
|
||||
jsonUtil.setMsg("添加失败");
|
||||
}
|
||||
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("保存成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,65 +1,65 @@
|
|||
package com.len.core.shiro;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.authc.ExcessiveAttemptsException;
|
||||
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
|
||||
import org.apache.shiro.cache.Cache;
|
||||
import org.apache.shiro.cache.CacheManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 验证器,增加了登录次数校验功能
|
||||
* 限制尝试登陆次数,防止暴力破解
|
||||
*/
|
||||
public class RetryLimitCredentialsMatcher extends HashedCredentialsMatcher {
|
||||
private static final Logger log = LoggerFactory.getLogger(RetryLimitCredentialsMatcher.class);
|
||||
|
||||
private Cache<String, AtomicInteger> loginRetryCache;
|
||||
|
||||
private int maxRetryCount = 5;
|
||||
|
||||
private String loginRetryCacheName;
|
||||
|
||||
public void setMaxRetryCount(int maxRetryCount) {
|
||||
this.maxRetryCount = maxRetryCount;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cacheManager
|
||||
* @param maxRetryCount 最大尝试次数
|
||||
*/
|
||||
public RetryLimitCredentialsMatcher(CacheManager cacheManager,int maxRetryCount) {
|
||||
this.maxRetryCount = maxRetryCount;
|
||||
loginRetryCache = cacheManager.getCache("loginRetryCache");//尝试获取cache,没有则新建
|
||||
}
|
||||
|
||||
public RetryLimitCredentialsMatcher(CacheManager cacheManager){
|
||||
this(cacheManager,5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
|
||||
String username = (String) token.getPrincipal();
|
||||
//retry count + 1
|
||||
AtomicInteger retryCount = loginRetryCache.get(username) == null
|
||||
? new AtomicInteger(0) : loginRetryCache.get(username);
|
||||
log.info("retryCount:{}, username:{}",retryCount,username);
|
||||
if (retryCount.incrementAndGet() > this.maxRetryCount) {
|
||||
log.warn("username: {} tried to login more than {} times in perid", username,this.maxRetryCount);
|
||||
throw new ExcessiveAttemptsException(String.format("username: {} tried to login more than {} times in perid", username,this.maxRetryCount));
|
||||
}
|
||||
boolean matches = super.doCredentialsMatch(token, info);
|
||||
|
||||
if (matches) {
|
||||
loginRetryCache.remove(username);
|
||||
} else {
|
||||
loginRetryCache.put(username, retryCount);
|
||||
log.info(String.valueOf(retryCount.get()));
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
package com.len.core.shiro;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.authc.ExcessiveAttemptsException;
|
||||
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
|
||||
import org.apache.shiro.cache.Cache;
|
||||
import org.apache.shiro.cache.CacheManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
/**
|
||||
* 验证器,增加了登录次数校验功能
|
||||
* 限制尝试登陆次数,防止暴力破解
|
||||
*/
|
||||
public class RetryLimitCredentialsMatcher extends HashedCredentialsMatcher {
|
||||
private static final Logger log = LoggerFactory.getLogger(RetryLimitCredentialsMatcher.class);
|
||||
|
||||
private Cache<String, AtomicInteger> loginRetryCache;
|
||||
|
||||
private int maxRetryCount = 5;
|
||||
|
||||
public void setMaxRetryCount(int maxRetryCount) {
|
||||
this.maxRetryCount = maxRetryCount;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cacheManager
|
||||
* @param maxRetryCount 最大尝试次数
|
||||
*/
|
||||
public RetryLimitCredentialsMatcher(CacheManager cacheManager,int maxRetryCount) {
|
||||
this.maxRetryCount = maxRetryCount;
|
||||
loginRetryCache = cacheManager.getCache("loginRetryCache");//尝试获取cache,没有则新建
|
||||
}
|
||||
|
||||
public RetryLimitCredentialsMatcher(CacheManager cacheManager){
|
||||
this(cacheManager,5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
|
||||
String username = (String) token.getPrincipal();
|
||||
//retry count + 1
|
||||
AtomicInteger retryCount = loginRetryCache.get(username) == null
|
||||
? new AtomicInteger(0) : loginRetryCache.get(username);
|
||||
log.info("retryCount:{}, username:{}",retryCount,username);
|
||||
if (retryCount.incrementAndGet() > this.maxRetryCount) {
|
||||
log.warn("username: {} tried to login more than {} times in perid", username,this.maxRetryCount);
|
||||
throw new ExcessiveAttemptsException(StrUtil.format("username: {} tried to login more than {} times in perid", username,this.maxRetryCount));
|
||||
}
|
||||
boolean matches = super.doCredentialsMatch(token, info);
|
||||
|
||||
if (matches) {
|
||||
loginRetryCache.remove(username);
|
||||
} else {
|
||||
loginRetryCache.put(username, retryCount);
|
||||
log.info(String.valueOf(retryCount.get()));
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
}
|
|
@ -1,209 +1,209 @@
|
|||
package com.len.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.base.impl.BaseServiceImpl;
|
||||
import com.len.entity.SysMenu;
|
||||
import com.len.entity.SysRoleMenu;
|
||||
import com.len.mapper.SysMenuMapper;
|
||||
import com.len.mapper.SysRoleMenuMapper;
|
||||
import com.len.service.MenuService;
|
||||
import com.len.service.SysUserService;
|
||||
import com.len.util.TreeUtil;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/12.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Service
|
||||
public class MenuServiceImpl extends BaseServiceImpl<SysMenu,String> implements MenuService {
|
||||
|
||||
@Autowired
|
||||
private SysMenuMapper menuDao;
|
||||
|
||||
@Autowired
|
||||
private SysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private SysRoleMenuMapper roleMenuMapper;
|
||||
|
||||
@Override
|
||||
public BaseMapper<SysMenu, String> getMappser() {
|
||||
return menuDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> getMenuNotSuper() {
|
||||
return menuDao.getMenuNotSuper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(SysMenu menu) {
|
||||
return menuDao.insert(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysMenu selectByPrimaryKey(String id) {
|
||||
return menuDao.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> getMenuChildren(String id) {
|
||||
return menuDao.getMenuChildren(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getMenuJson(String roleId){
|
||||
List<SysMenu> mList=menuDao.getMenuNotSuper();
|
||||
JSONArray jsonArr=new JSONArray();
|
||||
int pNum=1000,num=0;
|
||||
for(SysMenu sysMenu:mList){
|
||||
SysMenu menu=getChild(sysMenu.getId(),true,pNum,num);
|
||||
jsonArr.add(menu);
|
||||
pNum+=1000;
|
||||
}
|
||||
System.out.println(jsonArr);
|
||||
return jsonArr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getMenuJsonList() {
|
||||
List<SysMenu> mList=menuDao.getMenuNotSuper();
|
||||
JSONArray jsonArr=new JSONArray();
|
||||
for(SysMenu sysMenu:mList){
|
||||
SysMenu menu=getChild(sysMenu.getId(),false,0,0);
|
||||
jsonArr.add(menu);
|
||||
}
|
||||
System.out.println(jsonArr);
|
||||
return jsonArr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getMenuJsonByUser(List<SysMenu> menuList){
|
||||
//List<SysMenu> menuListOne=new ArrayList<>();//获取第一级别
|
||||
JSONArray jsonArr=new JSONArray();
|
||||
Collections.sort(menuList, new Comparator<SysMenu>() {
|
||||
@Override
|
||||
public int compare(SysMenu o1, SysMenu o2) {
|
||||
if(o1.getOrderNum()==null||o2.getOrderNum()==null){
|
||||
return -1;
|
||||
}
|
||||
if(o1.getOrderNum()>o2.getOrderNum()){
|
||||
return 1;
|
||||
}
|
||||
if(o1.getOrderNum()==o2.getOrderNum()){
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
int pNum=1000;
|
||||
for(SysMenu menu:menuList){
|
||||
if(StringUtils.isEmpty(menu.getPId())){
|
||||
SysMenu sysMenu=getChilds(menu,pNum,0,menuList);
|
||||
jsonArr.add(sysMenu);
|
||||
pNum+=1000;
|
||||
}
|
||||
}
|
||||
return jsonArr;
|
||||
}
|
||||
|
||||
public SysMenu getChilds(SysMenu menu,int pNum,int num,List<SysMenu> menuList){
|
||||
for(SysMenu menus:menuList){
|
||||
if(menu.getId().equals(menus.getPId())&&menus.getMenuType()==0){
|
||||
++num;
|
||||
SysMenu m=getChilds(menus,pNum,num,menuList);
|
||||
m.setNum(pNum+num);
|
||||
menu.addChild(m);
|
||||
}
|
||||
}
|
||||
return menu;
|
||||
|
||||
}
|
||||
@Override
|
||||
public List<SysMenu> getMenuChildrenAll(String id) {
|
||||
return menuDao.getMenuChildrenAll(id);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id 父菜单id
|
||||
* @param flag true 获取非按钮菜单 false 获取包括按钮在内菜单 用于nemuList展示
|
||||
* @param pNum 用户控制侧拉不重复id tab 父循环+1000
|
||||
* @param num 用户控制侧拉不重复id tab 最终效果 1001 10002 2001 2002
|
||||
* @return
|
||||
*/
|
||||
public SysMenu getChild(String id,boolean flag,int pNum,int num){
|
||||
SysMenu sysMenu=menuDao.selectByPrimaryKey(id);
|
||||
List<SysMenu> mList=null;
|
||||
if(flag){
|
||||
mList= menuDao.getMenuChildren(id);
|
||||
}else{
|
||||
mList=menuDao.getMenuChildrenAll(id);
|
||||
}
|
||||
for(SysMenu menu:mList){
|
||||
++num;
|
||||
SysMenu m=getChild(menu.getId(),flag,pNum,num);
|
||||
if(flag)
|
||||
m.setNum(pNum+num);
|
||||
sysMenu.addChild(m);
|
||||
}
|
||||
return sysMenu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getTreeUtil(String roleId){
|
||||
TreeUtil treeUtil=null;
|
||||
List<SysMenu> mList=menuDao.getMenuNotSuper();
|
||||
JSONArray jsonArr=new JSONArray();
|
||||
for(SysMenu sysMenu:mList){
|
||||
treeUtil=getChildByTree(sysMenu.getId(),false,0,null,roleId);
|
||||
jsonArr.add(treeUtil);
|
||||
}
|
||||
System.out.println(jsonArr);
|
||||
return jsonArr;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> getUserMenu(String id) {
|
||||
return menuDao.getUserMenu(id);
|
||||
}
|
||||
|
||||
public TreeUtil getChildByTree(String id,boolean flag,int layer,String pId,String roleId){
|
||||
layer++;
|
||||
SysMenu sysMenu=menuDao.selectByPrimaryKey(id);
|
||||
List<SysMenu> mList=null;
|
||||
if(flag){
|
||||
mList= menuDao.getMenuChildren(id);
|
||||
}else{
|
||||
mList=menuDao.getMenuChildrenAll(id);
|
||||
}
|
||||
TreeUtil treeUtil = new TreeUtil();
|
||||
treeUtil.setId(sysMenu.getId());
|
||||
treeUtil.setName(sysMenu.getName());
|
||||
treeUtil.setLayer(layer);
|
||||
treeUtil.setPId(pId);
|
||||
/**判断是否存在*/
|
||||
if(!StringUtils.isEmpty(roleId)){
|
||||
SysRoleMenu sysRoleMenu = new SysRoleMenu();
|
||||
sysRoleMenu.setMenuId(sysMenu.getId());
|
||||
sysRoleMenu.setRoleId(roleId);
|
||||
int count = roleMenuMapper.selectCountByCondition(sysRoleMenu);
|
||||
if (count > 0)
|
||||
treeUtil.setChecked(true);
|
||||
}
|
||||
for(SysMenu menu:mList){
|
||||
TreeUtil m=getChildByTree(menu.getId(),flag,layer,menu.getId(),roleId);
|
||||
treeUtil.getChildren().add(m);
|
||||
}
|
||||
return treeUtil;
|
||||
}
|
||||
}
|
||||
package com.len.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.base.impl.BaseServiceImpl;
|
||||
import com.len.entity.SysMenu;
|
||||
import com.len.entity.SysRoleMenu;
|
||||
import com.len.mapper.SysMenuMapper;
|
||||
import com.len.mapper.SysRoleMenuMapper;
|
||||
import com.len.service.MenuService;
|
||||
import com.len.service.SysUserService;
|
||||
import com.len.util.TreeUtil;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/12.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Service
|
||||
public class MenuServiceImpl extends BaseServiceImpl<SysMenu,String> implements MenuService {
|
||||
|
||||
@Autowired
|
||||
private SysMenuMapper menuDao;
|
||||
|
||||
@Autowired
|
||||
private SysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private SysRoleMenuMapper roleMenuMapper;
|
||||
|
||||
@Override
|
||||
public BaseMapper<SysMenu, String> getMappser() {
|
||||
return menuDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> getMenuNotSuper() {
|
||||
return menuDao.getMenuNotSuper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(SysMenu menu) {
|
||||
return menuDao.insert(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysMenu selectByPrimaryKey(String id) {
|
||||
return menuDao.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> getMenuChildren(String id) {
|
||||
return menuDao.getMenuChildren(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getMenuJson(String roleId){
|
||||
List<SysMenu> mList=menuDao.getMenuNotSuper();
|
||||
JSONArray jsonArr=new JSONArray();
|
||||
int pNum=1000,num=0;
|
||||
for(SysMenu sysMenu:mList){
|
||||
SysMenu menu=getChild(sysMenu.getId(),true,pNum,num);
|
||||
jsonArr.add(menu);
|
||||
pNum+=1000;
|
||||
}
|
||||
System.out.println(jsonArr);
|
||||
return jsonArr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getMenuJsonList() {
|
||||
List<SysMenu> mList=menuDao.getMenuNotSuper();
|
||||
JSONArray jsonArr=new JSONArray();
|
||||
for(SysMenu sysMenu:mList){
|
||||
SysMenu menu=getChild(sysMenu.getId(),false,0,0);
|
||||
jsonArr.add(menu);
|
||||
}
|
||||
System.out.println(jsonArr);
|
||||
return jsonArr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getMenuJsonByUser(List<SysMenu> menuList){
|
||||
//List<SysMenu> menuListOne=new ArrayList<>();//获取第一级别
|
||||
JSONArray jsonArr=new JSONArray();
|
||||
Collections.sort(menuList, new Comparator<SysMenu>() {
|
||||
@Override
|
||||
public int compare(SysMenu o1, SysMenu o2) {
|
||||
if(o1.getOrderNum()==null||o2.getOrderNum()==null){
|
||||
return -1;
|
||||
}
|
||||
if(o1.getOrderNum()>o2.getOrderNum()){
|
||||
return 1;
|
||||
}
|
||||
if(o1.getOrderNum().equals(o2.getOrderNum())){
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
int pNum=1000;
|
||||
for(SysMenu menu:menuList){
|
||||
if(StringUtils.isEmpty(menu.getPId())){
|
||||
SysMenu sysMenu=getChilds(menu,pNum,0,menuList);
|
||||
jsonArr.add(sysMenu);
|
||||
pNum+=1000;
|
||||
}
|
||||
}
|
||||
return jsonArr;
|
||||
}
|
||||
|
||||
public SysMenu getChilds(SysMenu menu,int pNum,int num,List<SysMenu> menuList){
|
||||
for(SysMenu menus:menuList){
|
||||
if(menu.getId().equals(menus.getPId())&&menus.getMenuType()==0){
|
||||
++num;
|
||||
SysMenu m=getChilds(menus,pNum,num,menuList);
|
||||
m.setNum(pNum+num);
|
||||
menu.addChild(m);
|
||||
}
|
||||
}
|
||||
return menu;
|
||||
|
||||
}
|
||||
@Override
|
||||
public List<SysMenu> getMenuChildrenAll(String id) {
|
||||
return menuDao.getMenuChildrenAll(id);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id 父菜单id
|
||||
* @param flag true 获取非按钮菜单 false 获取包括按钮在内菜单 用于nemuList展示
|
||||
* @param pNum 用户控制侧拉不重复id tab 父循环+1000
|
||||
* @param num 用户控制侧拉不重复id tab 最终效果 1001 10002 2001 2002
|
||||
* @return
|
||||
*/
|
||||
public SysMenu getChild(String id,boolean flag,int pNum,int num){
|
||||
SysMenu sysMenu=menuDao.selectByPrimaryKey(id);
|
||||
List<SysMenu> mList=null;
|
||||
if(flag){
|
||||
mList= menuDao.getMenuChildren(id);
|
||||
}else{
|
||||
mList=menuDao.getMenuChildrenAll(id);
|
||||
}
|
||||
for(SysMenu menu:mList){
|
||||
++num;
|
||||
SysMenu m=getChild(menu.getId(),flag,pNum,num);
|
||||
if(flag)
|
||||
m.setNum(pNum+num);
|
||||
sysMenu.addChild(m);
|
||||
}
|
||||
return sysMenu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getTreeUtil(String roleId){
|
||||
TreeUtil treeUtil=null;
|
||||
List<SysMenu> mList=menuDao.getMenuNotSuper();
|
||||
JSONArray jsonArr=new JSONArray();
|
||||
for(SysMenu sysMenu:mList){
|
||||
treeUtil=getChildByTree(sysMenu.getId(),false,0,null,roleId);
|
||||
jsonArr.add(treeUtil);
|
||||
}
|
||||
System.out.println(jsonArr);
|
||||
return jsonArr;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> getUserMenu(String id) {
|
||||
return menuDao.getUserMenu(id);
|
||||
}
|
||||
|
||||
public TreeUtil getChildByTree(String id,boolean flag,int layer,String pId,String roleId){
|
||||
layer++;
|
||||
SysMenu sysMenu=menuDao.selectByPrimaryKey(id);
|
||||
List<SysMenu> mList=null;
|
||||
if(flag){
|
||||
mList= menuDao.getMenuChildren(id);
|
||||
}else{
|
||||
mList=menuDao.getMenuChildrenAll(id);
|
||||
}
|
||||
TreeUtil treeUtil = new TreeUtil();
|
||||
treeUtil.setId(sysMenu.getId());
|
||||
treeUtil.setName(sysMenu.getName());
|
||||
treeUtil.setLayer(layer);
|
||||
treeUtil.setPId(pId);
|
||||
/**判断是否存在*/
|
||||
if(!StringUtils.isEmpty(roleId)){
|
||||
SysRoleMenu sysRoleMenu = new SysRoleMenu();
|
||||
sysRoleMenu.setMenuId(sysMenu.getId());
|
||||
sysRoleMenu.setRoleId(roleId);
|
||||
int count = roleMenuMapper.selectCountByCondition(sysRoleMenu);
|
||||
if (count > 0)
|
||||
treeUtil.setChecked(true);
|
||||
}
|
||||
for(SysMenu menu:mList){
|
||||
TreeUtil m=getChildByTree(menu.getId(),flag,layer,menu.getId(),roleId);
|
||||
treeUtil.getChildren().add(m);
|
||||
}
|
||||
return treeUtil;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,183 +1,181 @@
|
|||
package com.len.service.impl;
|
||||
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.base.impl.BaseServiceImpl;
|
||||
import com.len.entity.SysRole;
|
||||
import com.len.entity.SysRoleUser;
|
||||
import com.len.entity.SysUser;
|
||||
import com.len.exception.MyException;
|
||||
import com.len.mapper.SysRoleUserMapper;
|
||||
import com.len.mapper.SysUserMapper;
|
||||
import com.len.service.RoleService;
|
||||
import com.len.service.RoleUserService;
|
||||
import com.len.service.SysUserService;
|
||||
import com.len.util.Checkbox;
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.Md5Util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/4.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Service
|
||||
public class SysUserServiceImpl extends BaseServiceImpl<SysUser,String> implements SysUserService {
|
||||
|
||||
@Autowired
|
||||
SysUserMapper sysUserMapper;
|
||||
|
||||
@Autowired
|
||||
SysRoleUserMapper sysRoleUserMapper;
|
||||
|
||||
@Autowired
|
||||
RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
RoleUserService roleUserService;
|
||||
@Override
|
||||
public BaseMapper<SysUser, String> getMappser() {
|
||||
return sysUserMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser login(String username) {
|
||||
return sysUserMapper.login(username);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(String id) {
|
||||
return sysUserMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(SysUser record) {
|
||||
return sysUserMapper.insert(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertSelective(SysUser record) {
|
||||
|
||||
String pwd= Md5Util.getMD5(record.getPassword().trim(),record.getUsername().trim());
|
||||
record.setPassword(pwd);
|
||||
return super.insertSelective(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser selectByPrimaryKey(String id) {
|
||||
return sysUserMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKeySelective(SysUser record) {
|
||||
return super.updateByPrimaryKeySelective(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKey(SysUser record) {
|
||||
return sysUserMapper.updateByPrimaryKey(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysRoleUser> selectByCondition(SysRoleUser sysRoleUser) {
|
||||
return sysRoleUserMapper.selectByCondition(sysRoleUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> selectListByPage(SysUser sysUser) {
|
||||
return sysUserMapper.selectListByPage(sysUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count() {
|
||||
return sysUserMapper.count();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int add(SysUser user) {
|
||||
//密码加密
|
||||
String pwd= Md5Util.getMD5(user.getPassword().trim(),user.getUsername().trim());
|
||||
user.setPassword(pwd);
|
||||
return sysUserMapper.add(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonUtil delById(String id,boolean flag) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JsonUtil.error("获取数据失败");
|
||||
}
|
||||
JsonUtil j=null;
|
||||
try {
|
||||
SysUser sysUser = selectByPrimaryKey(id);
|
||||
if("admin".equals(sysUser.getUsername())){
|
||||
return JsonUtil.error("超管无法删除");
|
||||
}
|
||||
SysRoleUser roleUser=new SysRoleUser();
|
||||
roleUser.setUserId(id);
|
||||
int count=roleUserService.selectCountByCondition(roleUser);
|
||||
if(count>0){
|
||||
return JsonUtil.error("账户已经绑定角色,无法删除");
|
||||
}
|
||||
j=new JsonUtil();
|
||||
if (flag) {
|
||||
//逻辑
|
||||
sysUser.setDelFlag(Byte.parseByte("1"));
|
||||
updateByPrimaryKeySelective(sysUser);
|
||||
} else {
|
||||
//物理
|
||||
sysUserMapper.delById(id);
|
||||
}
|
||||
j.setMsg("删除成功");
|
||||
} catch (MyException e) {
|
||||
j.setMsg("删除失败");
|
||||
j.setFlag(false);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkUser(String username) {
|
||||
return sysUserMapper.checkUser(username);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Checkbox> getUserRoleByJson(String id){
|
||||
List<SysRole> roleList=roleService.selectListByPage(new SysRole());
|
||||
SysRoleUser sysRoleUser =new SysRoleUser();
|
||||
sysRoleUser.setUserId(id);
|
||||
List<SysRoleUser> kList= selectByCondition(sysRoleUser);
|
||||
System.out.println(kList.size());
|
||||
List<Checkbox> checkboxList=new ArrayList<>();
|
||||
Checkbox checkbox=null;
|
||||
for(SysRole sysRole:roleList){
|
||||
checkbox=new Checkbox();
|
||||
checkbox.setId(sysRole.getId());
|
||||
checkbox.setName(sysRole.getRoleName());
|
||||
for(SysRoleUser sysRoleUser1 :kList){
|
||||
if(sysRoleUser1.getRoleId().equals(sysRole.getId())){
|
||||
checkbox.setCheck(true);
|
||||
}
|
||||
}
|
||||
checkboxList.add(checkbox);
|
||||
}
|
||||
return checkboxList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rePass(SysUser user) {
|
||||
return sysUserMapper.rePass(user);
|
||||
}
|
||||
}
|
||||
package com.len.service.impl;
|
||||
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.base.impl.BaseServiceImpl;
|
||||
import com.len.entity.SysRole;
|
||||
import com.len.entity.SysRoleUser;
|
||||
import com.len.entity.SysUser;
|
||||
import com.len.exception.MyException;
|
||||
import com.len.mapper.SysRoleUserMapper;
|
||||
import com.len.mapper.SysUserMapper;
|
||||
import com.len.service.RoleService;
|
||||
import com.len.service.RoleUserService;
|
||||
import com.len.service.SysUserService;
|
||||
import com.len.util.Checkbox;
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.Md5Util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/4.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Service
|
||||
public class SysUserServiceImpl extends BaseServiceImpl<SysUser,String> implements SysUserService {
|
||||
|
||||
@Autowired
|
||||
SysUserMapper sysUserMapper;
|
||||
|
||||
@Autowired
|
||||
SysRoleUserMapper sysRoleUserMapper;
|
||||
|
||||
@Autowired
|
||||
RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
RoleUserService roleUserService;
|
||||
@Override
|
||||
public BaseMapper<SysUser, String> getMappser() {
|
||||
return sysUserMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser login(String username) {
|
||||
return sysUserMapper.login(username);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(String id) {
|
||||
return sysUserMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(SysUser record) {
|
||||
return sysUserMapper.insert(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertSelective(SysUser record) {
|
||||
|
||||
String pwd= Md5Util.getMD5(record.getPassword().trim(),record.getUsername().trim());
|
||||
record.setPassword(pwd);
|
||||
return super.insertSelective(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser selectByPrimaryKey(String id) {
|
||||
return sysUserMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKeySelective(SysUser record) {
|
||||
return super.updateByPrimaryKeySelective(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKey(SysUser record) {
|
||||
return sysUserMapper.updateByPrimaryKey(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysRoleUser> selectByCondition(SysRoleUser sysRoleUser) {
|
||||
return sysRoleUserMapper.selectByCondition(sysRoleUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> selectListByPage(SysUser sysUser) {
|
||||
return sysUserMapper.selectListByPage(sysUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count() {
|
||||
return sysUserMapper.count();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int add(SysUser user) {
|
||||
//密码加密
|
||||
String pwd= Md5Util.getMD5(user.getPassword().trim(),user.getUsername().trim());
|
||||
user.setPassword(pwd);
|
||||
return sysUserMapper.add(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonUtil delById(String id,boolean flag) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JsonUtil.error("获取数据失败");
|
||||
}
|
||||
JsonUtil j=new JsonUtil();
|
||||
try {
|
||||
SysUser sysUser = selectByPrimaryKey(id);
|
||||
if("admin".equals(sysUser.getUsername())){
|
||||
return JsonUtil.error("超管无法删除");
|
||||
}
|
||||
SysRoleUser roleUser=new SysRoleUser();
|
||||
roleUser.setUserId(id);
|
||||
int count=roleUserService.selectCountByCondition(roleUser);
|
||||
if(count>0){
|
||||
return JsonUtil.error("账户已经绑定角色,无法删除");
|
||||
}
|
||||
if (flag) {
|
||||
//逻辑
|
||||
sysUser.setDelFlag(Byte.parseByte("1"));
|
||||
updateByPrimaryKeySelective(sysUser);
|
||||
} else {
|
||||
//物理
|
||||
sysUserMapper.delById(id);
|
||||
}
|
||||
j.setMsg("删除成功");
|
||||
} catch (MyException e) {
|
||||
j.setMsg("删除失败");
|
||||
j.setFlag(false);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkUser(String username) {
|
||||
return sysUserMapper.checkUser(username);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Checkbox> getUserRoleByJson(String id){
|
||||
List<SysRole> roleList=roleService.selectListByPage(new SysRole());
|
||||
SysRoleUser sysRoleUser =new SysRoleUser();
|
||||
sysRoleUser.setUserId(id);
|
||||
List<SysRoleUser> kList= selectByCondition(sysRoleUser);
|
||||
System.out.println(kList.size());
|
||||
List<Checkbox> checkboxList=new ArrayList<>();
|
||||
Checkbox checkbox=null;
|
||||
for(SysRole sysRole:roleList){
|
||||
checkbox=new Checkbox();
|
||||
checkbox.setId(sysRole.getId());
|
||||
checkbox.setName(sysRole.getRoleName());
|
||||
for(SysRoleUser sysRoleUser1 :kList){
|
||||
if(sysRoleUser1.getRoleId().equals(sysRole.getId())){
|
||||
checkbox.setCheck(true);
|
||||
}
|
||||
}
|
||||
checkboxList.add(checkbox);
|
||||
}
|
||||
return checkboxList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rePass(SysUser user) {
|
||||
return sysUserMapper.rePass(user);
|
||||
}
|
||||
}
|
||||
|
|
708
pom.xml
708
pom.xml
|
@ -1,352 +1,358 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.len</groupId>
|
||||
<artifactId>lenosp</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>1.5.9.RELEASE</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>len-core</module>
|
||||
<module>len-sys</module>
|
||||
<module>len-web</module>
|
||||
<module>len-activiti</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-freemarker -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!--Mysql数据库驱动-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.6</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-jdbc</artifactId>
|
||||
<version>8.0.15</version>
|
||||
</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.0.24</version>
|
||||
</dependency>
|
||||
|
||||
<!--mybatis spring整合包-->
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
<version>1.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
<version>5.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-autoconfigure</artifactId>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>3.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--shiro依赖-->
|
||||
<dependency>
|
||||
<artifactId>ehcache-core</artifactId>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-ehcache</artifactId>
|
||||
<version>1.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-aspectj -->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-aspectj</artifactId>
|
||||
<version>1.4.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.10</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-web</artifactId>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring</artifactId>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.mingsoft</groupId>
|
||||
<artifactId>shiro-freemarker-tags</artifactId>
|
||||
<version>0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.7</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.41</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.module</groupId>
|
||||
<artifactId>jackson-module-parameter-names</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- <!– https://mvnrepository.com/artifact/org.quartz-scheduler/quartz –>
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<version>1.8.6</version>
|
||||
</dependency>-->
|
||||
<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.liquibase</groupId>
|
||||
<artifactId>liquibase-core</artifactId>
|
||||
</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-quartz</artifactId>
|
||||
<version>1.2.3</version>
|
||||
<!-- 解决 shiro和quartz 冲突-->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.opensymphony.quartz</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.len</groupId>
|
||||
<artifactId>len-core</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.len</groupId>
|
||||
<artifactId>len-web</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.len</groupId>
|
||||
<artifactId>len-sys</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.len</groupId>
|
||||
<artifactId>len-activiti</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<finalName>lenosp</finalName>
|
||||
<plugins>
|
||||
<!-- jdk编译插件 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<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>
|
||||
<repository>
|
||||
<id>lenos</id>
|
||||
<name>项目仓库</name>
|
||||
<url>http://www.cqwzxt.com:9934/nexus/content/repositories/lenos/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>-->
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.len</groupId>
|
||||
<artifactId>lenosp</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>1.5.9.RELEASE</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>len-core</module>
|
||||
<module>len-sys</module>
|
||||
<module>len-web</module>
|
||||
<module>len-activiti</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-freemarker -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!--Mysql数据库驱动-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.6</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-jdbc</artifactId>
|
||||
<version>8.0.15</version>
|
||||
</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.0.24</version>
|
||||
</dependency>
|
||||
|
||||
<!--mybatis spring整合包-->
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
<version>1.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
<version>5.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-autoconfigure</artifactId>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>3.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--shiro依赖-->
|
||||
<dependency>
|
||||
<artifactId>ehcache-core</artifactId>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-ehcache</artifactId>
|
||||
<version>1.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-aspectj -->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-aspectj</artifactId>
|
||||
<version>1.4.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.10</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-web</artifactId>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring</artifactId>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.mingsoft</groupId>
|
||||
<artifactId>shiro-freemarker-tags</artifactId>
|
||||
<version>0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.7</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.41</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.module</groupId>
|
||||
<artifactId>jackson-module-parameter-names</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- <!– https://mvnrepository.com/artifact/org.quartz-scheduler/quartz –>
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<version>1.8.6</version>
|
||||
</dependency>-->
|
||||
<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
<version>4.0.10</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.liquibase</groupId>
|
||||
<artifactId>liquibase-core</artifactId>
|
||||
</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-quartz</artifactId>
|
||||
<version>1.2.3</version>
|
||||
<!-- 解决 shiro和quartz 冲突-->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.opensymphony.quartz</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.len</groupId>
|
||||
<artifactId>len-core</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.len</groupId>
|
||||
<artifactId>len-web</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.len</groupId>
|
||||
<artifactId>len-sys</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.len</groupId>
|
||||
<artifactId>len-activiti</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<finalName>lenosp</finalName>
|
||||
<plugins>
|
||||
<!-- jdk编译插件 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<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>
|
||||
<repository>
|
||||
<id>lenos</id>
|
||||
<name>项目仓库</name>
|
||||
<url>http://www.cqwzxt.com:9934/nexus/content/repositories/lenos/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>-->
|
||||
</project>
|
Loading…
Reference in New Issue