Compare commits
27 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
ead0c57521 | |
![]() |
7b3fe06d64 | |
![]() |
d7f86df58c | |
![]() |
ea7cfde410 | |
![]() |
fcb6b30981 | |
![]() |
cfbabe672e | |
![]() |
764c798abb | |
![]() |
a24c16d78a | |
![]() |
6dca8e8d3c | |
![]() |
d58577eab4 | |
![]() |
eb17c4d9f8 | |
![]() |
defaf1c3f8 | |
![]() |
bc093aeec3 | |
![]() |
d25ca4da7d | |
![]() |
6d07d3213b | |
![]() |
ddea82f23a | |
![]() |
aee27eb132 | |
![]() |
6cd94d2f3f | |
![]() |
a34f686180 | |
![]() |
034054d6f9 | |
![]() |
f8eede541c | |
![]() |
a536b8dea2 | |
![]() |
5f137656f8 | |
![]() |
edf40286ff | |
![]() |
df401ca7bf | |
![]() |
010a180a27 | |
![]() |
789e4cbb1a |
|
@ -52,6 +52,7 @@
|
|||
- 19/4/30 **升级admin监控**
|
||||
**博客采用vue前后分离基于jwt鉴权,博客单独分离出一个项目地址:[len-blog-ui](https://gitee.com/bweird/len-blog-ui)**
|
||||
## 头像说明
|
||||
|
||||
```
|
||||
修改 application.yml imagePath 路径 把image文件夹图片赋值进路径,即可正常展示头像
|
||||
```
|
||||
|
@ -74,7 +75,7 @@ java -jar len-web.jar
|
|||
|
||||
## 技术
|
||||
* jdk:1.8
|
||||
* 核心框架:spring boot 2.0.1.RELEASE
|
||||
* 核心框架:spring boot 2.1.9.RELEASE
|
||||
* 安全框架:Apache Shiro
|
||||
* 工作流引擎:Activiti
|
||||
* 数据库连接池:druid
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package com.len.actlistener;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.len.entity.ActAssignee;
|
||||
import com.len.service.ActAssigneeService;
|
||||
import com.len.service.impl.ActAssigneeServiceImpl;
|
||||
|
@ -40,7 +41,7 @@ public class ActNodeListener implements TaskListener {
|
|||
//KEY
|
||||
String nodeId = delegateTask.getTaskDefinitionKey();
|
||||
ActAssigneeService actAssigneeService = SpringUtil.getBean(ActAssigneeServiceImpl.class);
|
||||
List<ActAssignee> assigneeList = actAssigneeService.selectListByPage(new ActAssignee(nodeId));
|
||||
List<ActAssignee> assigneeList = actAssigneeService.list(new QueryWrapper<>(new ActAssignee(nodeId)));
|
||||
for (ActAssignee assignee : assigneeList) {
|
||||
switch (assignee.getAssigneeType()) {
|
||||
case AssigneeType.GROUP_TYPE:
|
||||
|
|
|
@ -15,17 +15,10 @@
|
|||
*/
|
||||
package com.len.actlistener;
|
||||
|
||||
import com.len.entity.ActAssignee;
|
||||
import com.len.entity.BaseTask;
|
||||
import com.len.entity.UserLeave;
|
||||
import com.len.service.ActAssigneeService;
|
||||
import com.len.service.impl.ActAssigneeServiceImpl;
|
||||
import com.len.util.AssigneeType;
|
||||
import com.len.util.SpringUtil;
|
||||
import org.activiti.engine.delegate.DelegateTask;
|
||||
import org.activiti.engine.delegate.TaskListener;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,11 +16,10 @@
|
|||
package com.len.actlistener;
|
||||
|
||||
import com.len.entity.UserLeave;
|
||||
import org.activiti.engine.delegate.DelegateTask;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.activiti.engine.delegate.DelegateTask;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/1/25.
|
||||
|
|
|
@ -18,27 +18,23 @@ package com.len.actlistener;
|
|||
import com.len.entity.SysRole;
|
||||
import com.len.entity.SysRoleUser;
|
||||
import com.len.entity.SysUser;
|
||||
import com.len.service.ActAssigneeService;
|
||||
import com.len.service.SysUserService;
|
||||
import com.len.util.JsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.len.util.LenResponse;
|
||||
import org.activiti.engine.IdentityService;
|
||||
import org.activiti.engine.identity.Group;
|
||||
import org.activiti.engine.identity.User;
|
||||
import org.activiti.engine.impl.persistence.entity.GroupEntity;
|
||||
import org.activiti.engine.impl.persistence.entity.UserEntity;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.After;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/1/25.
|
||||
|
@ -62,7 +58,7 @@ public class ListenUserRole {
|
|||
*
|
||||
* @param joinPoint
|
||||
*/
|
||||
@Around("execution(com.len.util.JsonUtil com.len.controller.UserController.updateUser(*,String[]))")
|
||||
@Around("execution(com.len.util.LenResponse com.len.controller.UserController.updateUser(*,String[]))")
|
||||
public Object listenerUserUpdate(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
Object o = new Object();
|
||||
//更新前拿到用户-角色数据
|
||||
|
@ -73,7 +69,7 @@ public class ListenUserRole {
|
|||
List<String> strings = new ArrayList<>();
|
||||
keyList.forEach(sysRoleUser1 -> strings.add(sysRoleUser1.getRoleId()));
|
||||
o = joinPoint.proceed(joinPoint.getArgs());
|
||||
JsonUtil jsonUtil = (JsonUtil) o;
|
||||
LenResponse jsonUtil = (LenResponse) o;
|
||||
if (jsonUtil.isFlag()) {
|
||||
changeUser(args, strings);
|
||||
}
|
||||
|
@ -85,12 +81,12 @@ public class ListenUserRole {
|
|||
*
|
||||
* @param joinPoint
|
||||
*/
|
||||
@Around("execution(com.len.util.JsonUtil com.len.controller.UserController.addUser(*,String[]))")
|
||||
@Around("execution(com.len.util.LenResponse com.len.controller.UserController.addUser(*,String[]))")
|
||||
public Object listenerUserInsert(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
Object o = joinPoint.proceed(joinPoint.getArgs());
|
||||
Object[] args = joinPoint.getArgs();
|
||||
if (args.length == 2) {
|
||||
JsonUtil jsonUtil = (JsonUtil) o;
|
||||
LenResponse jsonUtil = (LenResponse) o;
|
||||
if (jsonUtil.isFlag()) {
|
||||
changeUser(args, Arrays.asList((String[]) args[1]));
|
||||
}
|
||||
|
@ -98,10 +94,10 @@ public class ListenUserRole {
|
|||
return o;
|
||||
}
|
||||
|
||||
@Around("execution(com.len.util.JsonUtil com.len.controller.UserController.del(..))")
|
||||
@Around("execution(com.len.util.LenResponse com.len.controller.UserController.del(..))")
|
||||
public Object listenDelUser(ProceedingJoinPoint point) throws Throwable {
|
||||
Object o = point.proceed(point.getArgs());
|
||||
JsonUtil util = (JsonUtil) o;
|
||||
LenResponse util = (LenResponse) o;
|
||||
if (util.isFlag()) {
|
||||
Object[] args = point.getArgs();
|
||||
identityService.deleteUser((String) args[0]);
|
||||
|
@ -140,10 +136,10 @@ public class ListenUserRole {
|
|||
|
||||
|
||||
/**********************角色处理begin***************************/
|
||||
@Around("execution(com.len.util.JsonUtil com.len.controller.RoleController.addRole(*,String[]))")
|
||||
@Around("execution(com.len.util.LenResponse com.len.controller.RoleController.addRole(*,String[]))")
|
||||
public Object listenRoleInsert(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
Object o = joinPoint.proceed(joinPoint.getArgs());
|
||||
JsonUtil j = (JsonUtil) o;
|
||||
LenResponse j = (LenResponse) o;
|
||||
if (j.isFlag()) {
|
||||
Object[] args = joinPoint.getArgs();
|
||||
if (args.length == 2) {
|
||||
|
@ -153,12 +149,12 @@ public class ListenUserRole {
|
|||
return o;
|
||||
}
|
||||
|
||||
@Around("execution(com.len.util.JsonUtil com.len.controller.RoleController.updateUser(*,String[]))")
|
||||
@Around("execution(com.len.util.LenResponse com.len.controller.RoleController.updateUser(*,String[]))")
|
||||
public Object listenRoleUpdate(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
Object o = joinPoint.proceed(joinPoint.getArgs());
|
||||
Object[] args = joinPoint.getArgs();
|
||||
if (args.length == 2) {
|
||||
if (((JsonUtil) o).isFlag()) {
|
||||
if (((LenResponse) o).isFlag()) {
|
||||
changeRole(args);
|
||||
}
|
||||
}
|
||||
|
@ -166,10 +162,10 @@ public class ListenUserRole {
|
|||
return o;
|
||||
}
|
||||
|
||||
@Around("execution(com.len.util.JsonUtil com.len.controller.RoleController.del(..))")
|
||||
@Around("execution(com.len.util.LenResponse com.len.controller.RoleController.del(..))")
|
||||
public Object listenDelRole(ProceedingJoinPoint point) throws Throwable {
|
||||
Object o = point.proceed(point.getArgs());
|
||||
JsonUtil util = (JsonUtil) o;
|
||||
LenResponse util = (LenResponse) o;
|
||||
if (util.isFlag()) {
|
||||
Object[] args = point.getArgs();
|
||||
identityService.deleteGroup((String) args[0]);
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
*/
|
||||
package com.len.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
@ -27,8 +29,9 @@ import com.len.service.ActAssigneeService;
|
|||
import com.len.service.RoleService;
|
||||
import com.len.service.RoleUserService;
|
||||
import com.len.service.SysUserService;
|
||||
import com.len.util.Base64Utils;
|
||||
import com.len.util.Checkbox;
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.LenResponse;
|
||||
import com.len.util.ReType;
|
||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
|
@ -37,7 +40,6 @@ import org.activiti.editor.language.json.converter.BpmnJsonConverter;
|
|||
import org.activiti.engine.IdentityService;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.identity.Group;
|
||||
import org.activiti.engine.identity.User;
|
||||
import org.activiti.engine.impl.persistence.entity.GroupEntity;
|
||||
|
@ -47,19 +49,20 @@ import org.activiti.engine.repository.Deployment;
|
|||
import org.activiti.engine.repository.Model;
|
||||
import org.activiti.engine.repository.ModelQuery;
|
||||
import org.activiti.engine.repository.ProcessDefinitionQuery;
|
||||
import org.activiti.rest.ActivitiService;
|
||||
import org.activiti.rest.model.ActivitiProcess;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
|
@ -97,7 +100,7 @@ public class ActivitiController extends BaseController {
|
|||
private ActAssigneeService actAssigneeService;
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
ActivitiService activitiService;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -105,11 +108,11 @@ public class ActivitiController extends BaseController {
|
|||
*/
|
||||
@PostMapping(value = "syncdata")
|
||||
@ResponseBody
|
||||
public JsonUtil syncdata() {
|
||||
JsonUtil j = new JsonUtil();
|
||||
public LenResponse syncdata() {
|
||||
LenResponse j = new LenResponse();
|
||||
try {
|
||||
List<SysUser> userList = userService.selectListByPage(new SysUser());
|
||||
User au = null;
|
||||
List<SysUser> userList = userService.list();
|
||||
User au;
|
||||
for (SysUser user : userList) {
|
||||
au = new UserEntity();
|
||||
au.setId(user.getId());
|
||||
|
@ -118,8 +121,8 @@ public class ActivitiController extends BaseController {
|
|||
identityService.deleteUser(au.getId());
|
||||
identityService.saveUser(au);
|
||||
}
|
||||
List<SysRole> sysRoleList = roleService.selectListByPage(new SysRole());
|
||||
Group group = null;
|
||||
List<SysRole> sysRoleList = roleService.list();
|
||||
Group group;
|
||||
for (SysRole role : sysRoleList) {
|
||||
group = new GroupEntity();
|
||||
group.setId(role.getId());
|
||||
|
@ -127,7 +130,7 @@ public class ActivitiController extends BaseController {
|
|||
identityService.deleteGroup(group.getId());
|
||||
identityService.saveGroup(group);
|
||||
}
|
||||
List<SysRoleUser> roleUserList = roleUserService.selectByCondition(new SysRoleUser());
|
||||
List<SysRoleUser> roleUserList = roleUserService.list();
|
||||
|
||||
for (SysRoleUser sysRoleUser : roleUserList) {
|
||||
identityService.deleteMembership(sysRoleUser.getUserId(), sysRoleUser.getRoleId());
|
||||
|
@ -251,21 +254,21 @@ public class ActivitiController extends BaseController {
|
|||
*/
|
||||
@PostMapping(value = "open")
|
||||
@ResponseBody
|
||||
public JsonUtil open(String id) {
|
||||
public LenResponse open(String id) {
|
||||
String msg = "发布成功";
|
||||
JsonUtil j = new JsonUtil();
|
||||
LenResponse j = new LenResponse();
|
||||
try {
|
||||
Model modelData = repositoryService.getModel(id);
|
||||
byte[] bytes = repositoryService.getModelEditorSource(modelData.getId());
|
||||
|
||||
if (bytes == null) {
|
||||
return JsonUtil.error("模型为空");
|
||||
return LenResponse.error("模型为空");
|
||||
}
|
||||
JsonNode modelNode = null;
|
||||
modelNode = new ObjectMapper().readTree(bytes);
|
||||
BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode);
|
||||
if (model.getProcesses().size() == 0) {
|
||||
return JsonUtil.error("数据不符合要求");
|
||||
return LenResponse.error("数据不符合要求");
|
||||
}
|
||||
byte[] bpmnBytes = new BpmnXMLConverter().convertToXML(model);
|
||||
//发布流程
|
||||
|
@ -303,7 +306,7 @@ public class ActivitiController extends BaseController {
|
|||
/**根据流程实例id查询出所有流程节点*/
|
||||
List<ActivityImpl> activityList = actAssigneeService.getActivityList(deploymentId);
|
||||
/**角色和节点关系封装成list*/
|
||||
List<SysRole> roleList = roleService.selectListByPage(new SysRole());
|
||||
List<SysRole> roleList = roleService.list();
|
||||
Checkbox checkbox = null;
|
||||
Map<String, Object> map = null;
|
||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||
|
@ -317,7 +320,7 @@ public class ActivitiController extends BaseController {
|
|||
}
|
||||
//节点id 、name、节点目前关联的角色 封装成进map
|
||||
String nodeId = activiti.getId();
|
||||
assigneeList = actAssigneeService.select(new ActAssignee(nodeId));
|
||||
assigneeList = actAssigneeService.list(new QueryWrapper<>(new ActAssignee(nodeId)));
|
||||
List<String> strings = new ArrayList<>();
|
||||
assigneeList.forEach(actAssignee1 -> strings.add(actAssignee1.getRoleId()));
|
||||
map.put("id", nodeId);
|
||||
|
@ -348,8 +351,8 @@ public class ActivitiController extends BaseController {
|
|||
*/
|
||||
@PostMapping("goAssignee/updateNode")
|
||||
@ResponseBody
|
||||
public JsonUtil updateNode(HttpServletRequest request) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
public LenResponse updateNode(HttpServletRequest request) {
|
||||
LenResponse j = new LenResponse();
|
||||
|
||||
Map<String, String[]> map = request.getParameterMap();
|
||||
List<ActAssignee> assigneeList = new ArrayList<>();
|
||||
|
@ -371,7 +374,7 @@ public class ActivitiController extends BaseController {
|
|||
}
|
||||
//后添加 在map循环里添加 多角色会导致添加了的再次被删除 so 要拿出来
|
||||
for (ActAssignee actAssignee : assigneeList) {
|
||||
actAssigneeService.insertSelective(actAssignee);
|
||||
actAssigneeService.save(actAssignee);
|
||||
}
|
||||
j.setMsg("更新成功");
|
||||
return j;
|
||||
|
@ -386,8 +389,8 @@ public class ActivitiController extends BaseController {
|
|||
*/
|
||||
@PostMapping("delDeploy")
|
||||
@ResponseBody
|
||||
public JsonUtil delDeploy(org.springframework.ui.Model model, String id) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
public LenResponse delDeploy(org.springframework.ui.Model model, String id) {
|
||||
LenResponse j = new LenResponse();
|
||||
try {
|
||||
List<ActivityImpl> activityList = actAssigneeService.getActivityList(id);
|
||||
for (ActivityImpl activity : activityList) {
|
||||
|
@ -411,15 +414,51 @@ public class ActivitiController extends BaseController {
|
|||
@Autowired
|
||||
ActPropertiesConfig actPropertiesConfig;
|
||||
|
||||
@GetMapping("shinePics/{processInstanceId}")
|
||||
public String shinePics(org.springframework.ui.Model model, @PathVariable String processInstanceId) {
|
||||
model.addAttribute("processInstanceId", processInstanceId);
|
||||
return "/act/activiti/shinePics";
|
||||
}
|
||||
|
||||
@GetMapping("getShineProcImage")
|
||||
@ResponseBody
|
||||
public JSONObject getShineProcImage(HttpServletRequest request, HttpServletResponse resp, String processInstanceId)
|
||||
throws IOException {
|
||||
JSONObject result = new JSONObject();
|
||||
JSONArray shineProImages = new JSONArray();
|
||||
InputStream imageStream = activitiService.generateStream(processInstanceId, true);
|
||||
if (imageStream != null) {
|
||||
String imageCurrentNode = Base64Utils.ioToBase64(imageStream);
|
||||
if (StringUtils.isNotBlank(imageCurrentNode)) {
|
||||
shineProImages.add(imageCurrentNode);
|
||||
}
|
||||
}
|
||||
InputStream imageNoCurrentStream = activitiService.generateStream(processInstanceId, false);
|
||||
if (imageNoCurrentStream != null) {
|
||||
String imageNoCurrentNode = Base64Utils.ioToBase64(imageNoCurrentStream);
|
||||
if (StringUtils.isNotBlank(imageNoCurrentNode)) {
|
||||
shineProImages.add(imageNoCurrentNode);
|
||||
}
|
||||
}
|
||||
|
||||
List<ActivitiProcess> taskSqu = activitiService.getTaskSqu(processInstanceId);
|
||||
|
||||
|
||||
result.put("id", UUID.randomUUID().toString());
|
||||
result.put("errorNo", 0);
|
||||
result.put("images", shineProImages);
|
||||
result.put("taskSqu", taskSqu);
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("delModel")
|
||||
@ResponseBody
|
||||
public JsonUtil delModel(org.springframework.ui.Model model, String id) {
|
||||
FileInputStream inputStream = null;
|
||||
public LenResponse delModel(String id) {
|
||||
String modelId = actPropertiesConfig.getModelId();
|
||||
if (id.equals(modelId)) {
|
||||
return JsonUtil.error("演示禁止删除");
|
||||
return LenResponse.error("演示禁止删除");
|
||||
}
|
||||
JsonUtil j = new JsonUtil();
|
||||
LenResponse j = new LenResponse();
|
||||
try {
|
||||
repositoryService.deleteModel(id);
|
||||
j.setMsg("删除成功");
|
||||
|
|
|
@ -18,6 +18,7 @@ package com.len.controller;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.len.base.BaseController;
|
||||
|
@ -119,7 +120,7 @@ public class UserLeaveController extends BaseController {
|
|||
|
||||
@GetMapping(value = "showLeaveList")
|
||||
@ResponseBody
|
||||
public ReType showLeaveList(Model model, UserLeave userLeave, String page, String limit) {
|
||||
public ReType showLeaveList(UserLeave userLeave, String page, String limit) {
|
||||
String userId = CommonUtil.getUser().getId();
|
||||
userLeave.setUserId(userId);
|
||||
List<UserLeave> tList = null;
|
||||
|
@ -154,7 +155,6 @@ public class UserLeaveController extends BaseController {
|
|||
.processInstanceId(processId).singleResult();
|
||||
//保证运行ing
|
||||
List<LeaveOpinion> leaveList = null;
|
||||
List<HistoricActivityInstance> historicActivityInstanceList = new ArrayList<>();
|
||||
if (instance != null) {
|
||||
Task task = this.taskService.createTaskQuery().processInstanceId(processId).singleResult();
|
||||
Map<String, Object> variables = taskService.getVariables(task.getId());
|
||||
|
@ -170,7 +170,6 @@ public class UserLeaveController extends BaseController {
|
|||
HistoricVariableUpdate variable = null;
|
||||
for (HistoricDetail historicDetail : list) {
|
||||
variable = (HistoricVariableUpdate) historicDetail;
|
||||
String variableName = variable.getVariableName();
|
||||
if (leaveOpinionList.equals(variable.getVariableName())) {
|
||||
leaveList.clear();
|
||||
leaveList.addAll((List<LeaveOpinion>) variable.getValue());
|
||||
|
@ -190,7 +189,7 @@ public class UserLeaveController extends BaseController {
|
|||
public String updateLeave(Model model, @PathVariable String taskId) {
|
||||
Map<String, Object> variables = taskService.getVariables(taskId);
|
||||
BaseTask baseTask = (BaseTask) variables.get("baseTask");
|
||||
UserLeave leave = leaveService.selectByPrimaryKey(baseTask.getId());
|
||||
UserLeave leave = leaveService.getById(baseTask.getId());
|
||||
model.addAttribute("leave", leave);
|
||||
model.addAttribute("taskId", taskId);
|
||||
return "/act/leave/update-leave";
|
||||
|
@ -198,15 +197,15 @@ public class UserLeaveController extends BaseController {
|
|||
|
||||
@PostMapping("updateLeave/updateLeave/{taskId}/{id}/{flag}")
|
||||
@ResponseBody
|
||||
public JsonUtil updateLeave(UserLeave leave, @PathVariable String taskId, @PathVariable String id, @PathVariable boolean flag) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
public LenResponse updateLeave(UserLeave leave, @PathVariable String taskId, @PathVariable String id, @PathVariable boolean flag) {
|
||||
LenResponse j = new LenResponse();
|
||||
try {
|
||||
UserLeave oldLeave = leaveService.selectByPrimaryKey(leave.getId());
|
||||
UserLeave oldLeave = leaveService.getById(leave.getId());
|
||||
BeanUtil.copyNotNullBean(leave, oldLeave);
|
||||
leaveService.updateByPrimaryKeySelective(oldLeave);
|
||||
QueryWrapper<UserLeave> userLeaveQueryWrapper = new QueryWrapper<>(oldLeave);
|
||||
leaveService.update(userLeaveQueryWrapper);
|
||||
|
||||
Map<String, Object> variables = taskService.getVariables(taskId);
|
||||
// UserLeave userLeave = (UserLeave) variables.get("userLeave");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if (flag) {
|
||||
map.put("flag", true);
|
||||
|
@ -226,33 +225,42 @@ public class UserLeaveController extends BaseController {
|
|||
|
||||
@PostMapping("addLeave")
|
||||
@ResponseBody
|
||||
public JsonUtil addLeave(Model model, UserLeave userLeave) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
public LenResponse addLeave(UserLeave userLeave) {
|
||||
LenResponse j = new LenResponse();
|
||||
if (userLeave == null) {
|
||||
return JsonUtil.error("获取数据失败");
|
||||
return LenResponse.error("获取数据失败");
|
||||
}
|
||||
userLeave.setDays(3);
|
||||
long beginTime = userLeave.getBeginTime().getTime();
|
||||
long endTime = userLeave.getEndTime().getTime();
|
||||
int days = 1;
|
||||
if (endTime != beginTime) {
|
||||
days += (int) ((endTime - beginTime) / (1000 * 60 * 60 * 24));
|
||||
}
|
||||
if (days <= 0) {
|
||||
return LenResponse.error("时间输入有误");
|
||||
}
|
||||
|
||||
userLeave.setDays(days);
|
||||
CurrentUser user = CommonUtil.getUser();
|
||||
userLeave.setUserId(user.getId());
|
||||
userLeave.setUserName(user.getUsername());
|
||||
userLeave.setProcessInstanceId("2018");//模拟数据
|
||||
leaveService.insertSelective(userLeave);
|
||||
userLeave.setProcessInstanceId("2018");
|
||||
leaveService.save(userLeave);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
userLeave.setUrlpath("/leave/readOnlyLeave/" + userLeave.getId());
|
||||
map.put("baseTask", userLeave);
|
||||
map.put("day", days);
|
||||
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process_leave", map);
|
||||
userLeave.setProcessInstanceId(processInstance.getId());
|
||||
UserLeave userLeave1 = leaveService.selectByPrimaryKey(userLeave.getId());
|
||||
BeanUtil.copyNotNullBean(userLeave, userLeave1);
|
||||
userLeave1.setUrlpath("/leave/readOnlyLeave/" + userLeave.getId());
|
||||
leaveService.updateByPrimaryKeySelective(userLeave1);
|
||||
userLeave.setUrlpath("/leave/readOnlyLeave/" + userLeave.getId());
|
||||
leaveService.updateById(userLeave);
|
||||
j.setMsg("请假申请成功");
|
||||
return j;
|
||||
}
|
||||
|
||||
@GetMapping("readOnlyLeave/{billId}")
|
||||
public String readOnlyLeave(Model model, @PathVariable String billId) {
|
||||
UserLeave leave = leaveService.selectByPrimaryKey(billId);
|
||||
UserLeave leave = leaveService.getById(billId);
|
||||
model.addAttribute("leave", leave);
|
||||
return "/act/leave/update-leave-readonly";
|
||||
}
|
||||
|
@ -271,8 +279,9 @@ public class UserLeaveController extends BaseController {
|
|||
CurrentUser user = CommonUtil.getUser();
|
||||
SysRoleUser sysRoleUser = new SysRoleUser();
|
||||
sysRoleUser.setUserId(user.getId());
|
||||
List<SysRoleUser> userRoles = roleUserService.selectByCondition(sysRoleUser);
|
||||
List<String> roleString = new ArrayList<String>();
|
||||
QueryWrapper<SysRoleUser> queryWrapper = new QueryWrapper<>(sysRoleUser);
|
||||
List<SysRoleUser> userRoles = roleUserService.list(queryWrapper);
|
||||
List<String> roleString = new ArrayList<>();
|
||||
for (SysRoleUser sru : userRoles) {
|
||||
roleString.add(sru.getRoleId());
|
||||
}
|
||||
|
@ -281,12 +290,16 @@ public class UserLeaveController extends BaseController {
|
|||
List<Task> candidateGroup = taskService.createTaskQuery().taskCandidateGroupIn(roleString).list();
|
||||
taskList.addAll(assigneeList);
|
||||
taskList.addAll(candidateGroup);
|
||||
int count = taskList.size();
|
||||
Integer index = (Integer.valueOf(page) - 1) * Integer.valueOf(limit);
|
||||
taskList = taskList.subList(index, taskList.size() > index + 10 ? index + 10 : taskList.size());
|
||||
|
||||
List<com.len.entity.Task> tasks = new ArrayList<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
com.len.entity.Task taskEntity = null;
|
||||
Map<String, Object> map;
|
||||
com.len.entity.Task taskEntity;
|
||||
|
||||
Map<String, Map<String, Object>> mapMap = new HashMap<>();
|
||||
Map<String, Object> objectMap = null;
|
||||
Map<String, Object> objectMap;
|
||||
Set<String> taskSet = new HashSet<String>();
|
||||
for (Task task1 : taskList) {
|
||||
objectMap = new HashMap<>();
|
||||
|
@ -302,7 +315,7 @@ public class UserLeaveController extends BaseController {
|
|||
taskEntity.setUserName(userLeave.getUserName());
|
||||
taskEntity.setReason(userLeave.getReason());
|
||||
taskEntity.setUrlpath(userLeave.getUrlpath());
|
||||
/**如果是自己*/
|
||||
/*如果是自己*/
|
||||
if (user.getId().equals(userLeave.getUserId())) {
|
||||
if (map.get("flag") != null) {
|
||||
if (!(boolean) map.get("flag")) {
|
||||
|
@ -320,7 +333,7 @@ public class UserLeaveController extends BaseController {
|
|||
tasks.add(taskEntity);
|
||||
taskSet.add(taskId);
|
||||
}
|
||||
return ReType.jsonStrng(taskList.size(), tasks, mapMap, "id");
|
||||
return ReType.jsonStrng(count, tasks, mapMap, "id");
|
||||
}
|
||||
|
||||
@GetMapping("agent/{id}")
|
||||
|
@ -335,14 +348,14 @@ public class UserLeaveController extends BaseController {
|
|||
|
||||
@PostMapping("agent/complete")
|
||||
@ResponseBody
|
||||
public JsonUtil complete(LeaveOpinion op, HttpServletRequest request) {
|
||||
public LenResponse complete(LeaveOpinion op, HttpServletRequest request) {
|
||||
Map<String, Object> variables = taskService.getVariables(op.getTaskId());
|
||||
|
||||
CurrentUser user = Principal.getCurrentUse();
|
||||
op.setCreateTime(new Date());
|
||||
op.setOpId(user.getId());
|
||||
op.setOpName(user.getRealName());
|
||||
JsonUtil j = new JsonUtil();
|
||||
LenResponse j = new LenResponse();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("flag", op.isFlag());
|
||||
|
||||
|
@ -364,6 +377,8 @@ public class UserLeaveController extends BaseController {
|
|||
leaveList = (List<LeaveOpinion>) o;
|
||||
}
|
||||
leaveList.add(op);
|
||||
UserLeave userLeave=(UserLeave)variables.get("baseTask");
|
||||
map.put("day",userLeave.getDays());
|
||||
map.put(leaveOpinionList, leaveList);
|
||||
j.setMsg("审核成功" + (op.isFlag() ? "<font style='color:green'>[通过]</font>" : "<font style='color:red'>[未通过]</font>"));
|
||||
taskService.complete(op.getTaskId(), map);
|
||||
|
|
|
@ -1,39 +1,44 @@
|
|||
package com.len.entity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
@Table(name = "act_assignee")
|
||||
|
||||
@TableName(value = "act_assignee")
|
||||
public class ActAssignee {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@TableId(value = "id", type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 节点id
|
||||
*/
|
||||
@TableField(value = "sid")
|
||||
private String sid;
|
||||
|
||||
/**
|
||||
* 办理人
|
||||
*/
|
||||
@TableField(value = "assignee")
|
||||
private String assignee;
|
||||
|
||||
/**
|
||||
* 候选组(角色)
|
||||
*/
|
||||
@Column(name = "role_id")
|
||||
@TableField(value = "role_id")
|
||||
private String roleId;
|
||||
|
||||
/**
|
||||
* 办理人类型1办理人2候选人3组
|
||||
*/
|
||||
@Column(name = "assignee_type")
|
||||
@TableField(value = "assignee_type")
|
||||
private Integer assigneeType;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
@Column(name = "activti_name")
|
||||
@TableField(value = "activti_name")
|
||||
private String activtiName;
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
package com.len.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
@ -27,8 +29,7 @@ import org.activiti.engine.repository.Model;
|
|||
* @email 154040976@qq.com
|
||||
* 模型列表
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Data
|
||||
public class ActModel {
|
||||
|
||||
private String id;
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
package com.len.entity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by kingdee-001 on 2018/6/30.
|
||||
*/
|
||||
@MappedSuperclass
|
||||
public abstract class BaseTask implements Serializable{
|
||||
public abstract class BaseTask implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO,generator = "JDBC")
|
||||
protected String id;
|
||||
|
||||
/**
|
||||
|
@ -28,29 +24,22 @@ public abstract class BaseTask implements Serializable{
|
|||
this.id = id == null ? null : id.trim();
|
||||
}
|
||||
|
||||
@Column(name = "user_id")
|
||||
|
||||
protected String userId;
|
||||
|
||||
@Column(name = "user_name")
|
||||
protected String userName;
|
||||
|
||||
|
||||
|
||||
@Column(name = "process_instance_Id")
|
||||
protected String processInstanceId;
|
||||
|
||||
protected String status;
|
||||
|
||||
@Column(name = "create_date")
|
||||
protected Date createDate;
|
||||
|
||||
@Column(name = "create_by")
|
||||
protected String createBy;
|
||||
|
||||
@Column(name = "update_date")
|
||||
protected Date updateDate;
|
||||
|
||||
@Column(name = "update_by")
|
||||
protected String updateBy;
|
||||
|
||||
|
||||
|
@ -67,8 +56,6 @@ public abstract class BaseTask implements Serializable{
|
|||
private Integer submittimes;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return user_id
|
||||
*/
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
package com.len.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.persistence.*;
|
||||
|
||||
@Table(name = "user_leave")
|
||||
@TableName(value = "user_leave")
|
||||
public class UserLeave extends BaseTask {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO,generator = "JDBC")
|
||||
@TableId(value = "id", type = IdType.UUID)
|
||||
protected String id;
|
||||
|
||||
/**
|
||||
|
@ -31,36 +33,37 @@ public class UserLeave extends BaseTask {
|
|||
|
||||
private Integer days;
|
||||
|
||||
@Column(name = "begin_time")
|
||||
@TableField(value = "begin_time")
|
||||
private Date beginTime;
|
||||
|
||||
@Column(name = "end_time")
|
||||
@TableField(value = "end_time")
|
||||
private Date endTime;
|
||||
|
||||
@Column(name = "process_instance_Id")
|
||||
@TableField(value = "process_instance_Id")
|
||||
private String processInstanceId;
|
||||
|
||||
private String status;
|
||||
|
||||
@Column(name = "create_date")
|
||||
@TableField(value = "create_date")
|
||||
private Date createDate;
|
||||
|
||||
@Column(name = "create_by")
|
||||
@TableField(value = "create_by")
|
||||
private String createBy;
|
||||
|
||||
@Column(name = "update_date")
|
||||
@TableField(value = "update_date")
|
||||
private Date updateDate;
|
||||
|
||||
@Column(name = "update_by")
|
||||
@TableField(value = "update_by")
|
||||
private String updateBy;
|
||||
|
||||
//***实时节点信息
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String taskName;
|
||||
|
||||
|
||||
|
||||
//请假单审核信息
|
||||
@TableField(exist = false)
|
||||
private List<LeaveOpinion> opinionList=new ArrayList<>();
|
||||
|
||||
public void leaveOpAdd(LeaveOpinion leaveOpinion){
|
||||
|
|
|
@ -2,8 +2,7 @@ package com.len.mapper;
|
|||
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.entity.ActAssignee;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface ActAssigneeMapper extends BaseMapper<ActAssignee,String> {
|
||||
public interface ActAssigneeMapper extends BaseMapper<ActAssignee> {
|
||||
int deleteByNodeId(String nodeId);
|
||||
}
|
|
@ -2,7 +2,6 @@ package com.len.mapper;
|
|||
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.entity.UserLeave;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface UserLeaveMapper extends BaseMapper<UserLeave,String> {
|
||||
public interface UserLeaveMapper extends BaseMapper<UserLeave> {
|
||||
}
|
|
@ -3,6 +3,8 @@ package com.len.service;
|
|||
import com.len.base.BaseService;
|
||||
import com.len.entity.UserLeave;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/1/21.
|
||||
|
@ -10,4 +12,5 @@ import com.len.entity.UserLeave;
|
|||
*/
|
||||
public interface UserLeaveService extends BaseService<UserLeave,String> {
|
||||
|
||||
public List<UserLeave> selectListByPage(UserLeave record);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.len.service.impl;
|
||||
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.base.impl.BaseServiceImpl;
|
||||
import com.len.entity.ActAssignee;
|
||||
import com.len.mapper.ActAssigneeMapper;
|
||||
|
@ -34,11 +33,6 @@ public class ActAssigneeServiceImpl extends BaseServiceImpl<ActAssignee, String>
|
|||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Override
|
||||
public BaseMapper<ActAssignee, String> getMappser() {
|
||||
return actAssigneeMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByNodeId(String nodeId) {
|
||||
return actAssigneeMapper.deleteByNodeId(nodeId);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.len.service.impl;
|
||||
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.base.impl.BaseServiceImpl;
|
||||
import com.len.entity.UserLeave;
|
||||
import com.len.mapper.UserLeaveMapper;
|
||||
|
@ -8,20 +7,22 @@ import com.len.service.UserLeaveService;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/1/21.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Service
|
||||
public class UserLeaveServiceImpl extends BaseServiceImpl<UserLeave,String> implements
|
||||
UserLeaveService {
|
||||
public class UserLeaveServiceImpl extends BaseServiceImpl<UserLeave, String> implements
|
||||
UserLeaveService {
|
||||
|
||||
@Autowired
|
||||
UserLeaveMapper userLeaveMapper;
|
||||
@Autowired
|
||||
UserLeaveMapper userLeaveMapper;
|
||||
|
||||
@Override
|
||||
public BaseMapper<UserLeave,String> getMappser() {
|
||||
return userLeaveMapper;
|
||||
}
|
||||
@Override
|
||||
public List<UserLeave> selectListByPage(UserLeave record) {
|
||||
return userLeaveMapper.selectListByPage(record);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/* 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.
|
||||
|
@ -57,10 +57,10 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
* Represents a canvas on which BPMN 2.0 constructs can be drawn.
|
||||
*
|
||||
*
|
||||
* Some of the icons used are licensed under a Creative Commons Attribution 2.5
|
||||
* License, see http://www.famfamfam.com/lab/icons/silk/
|
||||
*
|
||||
*
|
||||
* @see org.activiti.engine.impl.bpmn.diagram.DefaultProcessDiagramGenerator
|
||||
* @author Joram Barrez
|
||||
*/
|
||||
|
@ -79,7 +79,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
protected static final int TEXT_PADDING = 3;
|
||||
protected static final int ANNOTATION_TEXT_PADDING = 7;
|
||||
protected static final int LINE_HEIGHT = FONT_SIZE + FONT_SPACING;
|
||||
|
||||
|
||||
|
||||
// Colors
|
||||
protected static Color TASK_BOX_COLOR = new Color(249, 249, 249);
|
||||
|
@ -92,7 +92,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
protected static Color TASK_BORDER_COLOR = new Color(187, 187, 187);
|
||||
protected static Color EVENT_BORDER_COLOR = new Color(88, 88, 88);
|
||||
protected static Color SUBPROCESS_BORDER_COLOR = new Color(0, 0, 0);
|
||||
|
||||
|
||||
// Fonts
|
||||
protected static Font LABEL_FONT = null;
|
||||
protected static Font ANNOTATION_FONT = null;
|
||||
|
@ -120,7 +120,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
protected static BufferedImage SHELL_TASK_IMAGE;
|
||||
protected static BufferedImage MULE_TASK_IMAGE;
|
||||
protected static BufferedImage CAMEL_TASK_IMAGE;
|
||||
|
||||
|
||||
protected static BufferedImage TIMER_IMAGE;
|
||||
protected static BufferedImage COMPENSATE_THROW_IMAGE;
|
||||
protected static BufferedImage COMPENSATE_CATCH_IMAGE;
|
||||
|
@ -143,19 +143,19 @@ public class DefaultProcessDiagramCanvas {
|
|||
protected String activityFontName = "Arial";
|
||||
protected String labelFontName = "Arial";
|
||||
protected String annotationFontName = "Arial";
|
||||
|
||||
|
||||
/**
|
||||
* Creates an empty canvas with given width and height.
|
||||
*
|
||||
*
|
||||
* Allows to specify minimal boundaries on the left and upper side of the
|
||||
* canvas. This is useful for diagrams that have white space there.
|
||||
* Everything beneath these minimum values will be cropped.
|
||||
* Everything beneath these minimum values will be cropped.
|
||||
* It's also possible to pass a specific font name and a class loader for the icon images.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public DefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType,
|
||||
public DefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType,
|
||||
String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) {
|
||||
|
||||
|
||||
this.canvasWidth = width;
|
||||
this.canvasHeight = height;
|
||||
this.minX = minX;
|
||||
|
@ -170,17 +170,17 @@ public class DefaultProcessDiagramCanvas {
|
|||
this.annotationFontName = annotationFontName;
|
||||
}
|
||||
this.customClassLoader = customClassLoader;
|
||||
|
||||
|
||||
initialize(imageType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an empty canvas with given width and height.
|
||||
*
|
||||
*
|
||||
* Allows to specify minimal boundaries on the left and upper side of the
|
||||
* canvas. This is useful for diagrams that have white space there (eg
|
||||
* Signavio). Everything beneath these minimum values will be cropped.
|
||||
*
|
||||
*
|
||||
* @param minX
|
||||
* Hint that will be used when generating the image. Parts that fall
|
||||
* below minX on the horizontal scale will be cropped.
|
||||
|
@ -193,17 +193,17 @@ public class DefaultProcessDiagramCanvas {
|
|||
this.canvasHeight = height;
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
|
||||
|
||||
initialize(imageType);
|
||||
}
|
||||
|
||||
|
||||
public void initialize(String imageType) {
|
||||
if ("png".equalsIgnoreCase(imageType)) {
|
||||
this.processDiagram = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_ARGB);
|
||||
} else {
|
||||
this.processDiagram = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB);
|
||||
}
|
||||
|
||||
|
||||
this.g = processDiagram.createGraphics();
|
||||
if ("png".equalsIgnoreCase(imageType) == false) {
|
||||
this.g.setBackground(new Color(255, 255, 255, 0));
|
||||
|
@ -212,14 +212,14 @@ public class DefaultProcessDiagramCanvas {
|
|||
|
||||
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g.setPaint(Color.black);
|
||||
|
||||
|
||||
Font font = new Font(activityFontName, Font.BOLD, FONT_SIZE);
|
||||
g.setFont(font);
|
||||
this.fontMetrics = g.getFontMetrics();
|
||||
|
||||
LABEL_FONT = new Font(labelFontName, Font.BOLD, 14);
|
||||
ANNOTATION_FONT = new Font(annotationFontName, Font.PLAIN, FONT_SIZE);
|
||||
|
||||
|
||||
try {
|
||||
USERTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/userTask.png", customClassLoader));
|
||||
SCRIPTTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/scriptTask.png", customClassLoader));
|
||||
|
@ -231,7 +231,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
SHELL_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/shellTask.png", customClassLoader));
|
||||
CAMEL_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/camelTask.png", customClassLoader));
|
||||
MULE_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/muleTask.png", customClassLoader));
|
||||
|
||||
|
||||
TIMER_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/timer.png", customClassLoader));
|
||||
COMPENSATE_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/compensate-throw.png", customClassLoader));
|
||||
COMPENSATE_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/compensate.png", customClassLoader));
|
||||
|
@ -248,7 +248,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
|
||||
/**
|
||||
* Generates an image of what currently is drawn on the canvas.
|
||||
*
|
||||
*
|
||||
* Throws an {@link ActivitiException} when {@link #close()} is already
|
||||
* called.
|
||||
*/
|
||||
|
@ -260,7 +260,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
try {
|
||||
ImageIO.write(processDiagram, imageType, out);
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new ActivitiImageException("Error while generating process image", e);
|
||||
} finally {
|
||||
|
@ -274,10 +274,10 @@ public class DefaultProcessDiagramCanvas {
|
|||
}
|
||||
return new ByteArrayInputStream(out.toByteArray());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates an image of what currently is drawn on the canvas.
|
||||
*
|
||||
*
|
||||
* Throws an {@link ActivitiException} when {@link #close()} is already
|
||||
* called.
|
||||
*/
|
||||
|
@ -312,11 +312,11 @@ public class DefaultProcessDiagramCanvas {
|
|||
public void drawTimerStartEvent(GraphicInfo graphicInfo, double scaleFactor) {
|
||||
drawStartEvent(graphicInfo, TIMER_IMAGE, scaleFactor);
|
||||
}
|
||||
|
||||
|
||||
public void drawSignalStartEvent(GraphicInfo graphicInfo, double scaleFactor) {
|
||||
drawStartEvent(graphicInfo, SIGNAL_CATCH_IMAGE, scaleFactor);
|
||||
}
|
||||
|
||||
|
||||
public void drawMessageStartEvent(GraphicInfo graphicInfo, double scaleFactor) {
|
||||
drawStartEvent(graphicInfo, MESSAGE_CATCH_IMAGE, scaleFactor);
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
Paint originalPaint = g.getPaint();
|
||||
g.setPaint(EVENT_COLOR);
|
||||
// g.setPaint(new Color(36,202,88));
|
||||
Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(),
|
||||
Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(),
|
||||
graphicInfo.getWidth(), graphicInfo.getHeight());
|
||||
g.fill(circle);
|
||||
g.setPaint(EVENT_BORDER_COLOR);
|
||||
|
@ -334,7 +334,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
if (image != null) {
|
||||
// calculate coordinates to center image
|
||||
int imageX = (int) Math.round(graphicInfo.getX() + (graphicInfo.getWidth() / 2) - (image.getWidth() / 2 * scaleFactor));
|
||||
int imageY = (int) Math.round(graphicInfo.getY() + (graphicInfo.getHeight() / 2) - (image.getHeight() / 2 * scaleFactor));
|
||||
int imageY = (int) Math.round(graphicInfo.getY() + (graphicInfo.getHeight() / 2) - (image.getHeight() / 2 * scaleFactor));
|
||||
g.drawImage(image, imageX, imageY,
|
||||
(int) (image.getWidth() / scaleFactor), (int) (image.getHeight() / scaleFactor), null);
|
||||
}
|
||||
|
@ -344,9 +344,8 @@ public class DefaultProcessDiagramCanvas {
|
|||
public void drawNoneEndEvent(GraphicInfo graphicInfo, double scaleFactor) {
|
||||
Paint originalPaint = g.getPaint();
|
||||
Stroke originalStroke = g.getStroke();
|
||||
// g.setPaint(EVENT_COLOR);
|
||||
g.setPaint(new Color(255,0,0));
|
||||
Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(),
|
||||
g.setPaint(new Color(255,255,255));
|
||||
Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(),
|
||||
graphicInfo.getWidth(), graphicInfo.getHeight());
|
||||
g.fill(circle);
|
||||
g.setPaint(EVENT_BORDER_COLOR);
|
||||
|
@ -366,28 +365,28 @@ public class DefaultProcessDiagramCanvas {
|
|||
drawLabel(name, graphicInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void drawErrorEndEvent(GraphicInfo graphicInfo, double scaleFactor) {
|
||||
drawNoneEndEvent(graphicInfo, scaleFactor);
|
||||
g.drawImage(ERROR_THROW_IMAGE, (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 4)),
|
||||
(int) (graphicInfo.getY() + (graphicInfo.getHeight() / 4)),
|
||||
(int) (ERROR_THROW_IMAGE.getWidth() / scaleFactor),
|
||||
g.drawImage(ERROR_THROW_IMAGE, (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 4)),
|
||||
(int) (graphicInfo.getY() + (graphicInfo.getHeight() / 4)),
|
||||
(int) (ERROR_THROW_IMAGE.getWidth() / scaleFactor),
|
||||
(int) (ERROR_THROW_IMAGE.getHeight() / scaleFactor), null);
|
||||
}
|
||||
|
||||
|
||||
public void drawErrorStartEvent(GraphicInfo graphicInfo, double scaleFactor) {
|
||||
drawNoneStartEvent(graphicInfo);
|
||||
g.drawImage(ERROR_CATCH_IMAGE, (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 4)),
|
||||
(int) (graphicInfo.getY() + (graphicInfo.getHeight() / 4)),
|
||||
(int) (ERROR_CATCH_IMAGE.getWidth() / scaleFactor),
|
||||
g.drawImage(ERROR_CATCH_IMAGE, (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 4)),
|
||||
(int) (graphicInfo.getY() + (graphicInfo.getHeight() / 4)),
|
||||
(int) (ERROR_CATCH_IMAGE.getWidth() / scaleFactor),
|
||||
(int) (ERROR_CATCH_IMAGE.getHeight() / scaleFactor), null);
|
||||
}
|
||||
|
||||
public void drawCatchingEvent(GraphicInfo graphicInfo, boolean isInterrupting,
|
||||
public void drawCatchingEvent(GraphicInfo graphicInfo, boolean isInterrupting,
|
||||
BufferedImage image, String eventType, double scaleFactor) {
|
||||
|
||||
|
||||
// event circles
|
||||
Ellipse2D outerCircle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(),
|
||||
Ellipse2D outerCircle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(),
|
||||
graphicInfo.getWidth(), graphicInfo.getHeight());
|
||||
int innerCircleSize = (int) (4 / scaleFactor);
|
||||
if (innerCircleSize == 0) {
|
||||
|
@ -405,7 +404,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
g.fill(outerCircle);
|
||||
|
||||
g.setPaint(EVENT_BORDER_COLOR);
|
||||
if (isInterrupting == false)
|
||||
if (isInterrupting == false)
|
||||
g.setStroke(NON_INTERRUPTING_EVENT_STROKE);
|
||||
g.draw(outerCircle);
|
||||
g.setStroke(originalStroke);
|
||||
|
@ -415,13 +414,13 @@ public class DefaultProcessDiagramCanvas {
|
|||
if (image != null) {
|
||||
// calculate coordinates to center image
|
||||
int imageX = (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 2) - (image.getWidth() / 2 * scaleFactor));
|
||||
int imageY = (int) (graphicInfo.getY() + (graphicInfo.getHeight() / 2) - (image.getHeight() / 2 * scaleFactor));
|
||||
int imageY = (int) (graphicInfo.getY() + (graphicInfo.getHeight() / 2) - (image.getHeight() / 2 * scaleFactor));
|
||||
if (scaleFactor == 1.0 && "timer".equals(eventType)) {
|
||||
// move image one pixel to center timer image
|
||||
imageX++;
|
||||
imageY++;
|
||||
}
|
||||
g.drawImage(image, imageX, imageY, (int) (image.getWidth() / scaleFactor),
|
||||
g.drawImage(image, imageX, imageY, (int) (image.getWidth() / scaleFactor),
|
||||
(int) (image.getHeight() / scaleFactor), null);
|
||||
}
|
||||
}
|
||||
|
@ -461,7 +460,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
public void drawCatchingSignalEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor) {
|
||||
drawCatchingEvent(graphicInfo, isInterrupting, SIGNAL_CATCH_IMAGE, "signal", scaleFactor);
|
||||
}
|
||||
|
||||
|
||||
public void drawCatchingMessageEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor) {
|
||||
drawCatchingEvent(graphicInfo, isInterrupting, MESSAGE_CATCH_IMAGE, "message", scaleFactor);
|
||||
}
|
||||
|
@ -470,7 +469,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
drawCatchingEvent(graphicInfo, isInterrupting, MESSAGE_CATCH_IMAGE, "message", scaleFactor);
|
||||
drawLabel(name, graphicInfo);
|
||||
}
|
||||
|
||||
|
||||
public void drawThrowingCompensateEvent(GraphicInfo graphicInfo, double scaleFactor) {
|
||||
drawCatchingEvent(graphicInfo, true, COMPENSATE_THROW_IMAGE, "compensate", scaleFactor);
|
||||
}
|
||||
|
@ -478,7 +477,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
public void drawThrowingSignalEvent(GraphicInfo graphicInfo, double scaleFactor) {
|
||||
drawCatchingEvent(graphicInfo, true, SIGNAL_THROW_IMAGE, "signal", scaleFactor);
|
||||
}
|
||||
|
||||
|
||||
public void drawThrowingNoneEvent(GraphicInfo graphicInfo, double scaleFactor) {
|
||||
drawCatchingEvent(graphicInfo, true, null, "none", scaleFactor);
|
||||
}
|
||||
|
@ -486,7 +485,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
public void drawSequenceflow(int srcX, int srcY, int targetX, int targetY, boolean conditional, double scaleFactor) {
|
||||
drawSequenceflow(srcX, srcY, targetX, targetY, conditional, false, scaleFactor);
|
||||
}
|
||||
|
||||
|
||||
public void drawSequenceflow(int srcX, int srcY, int targetX, int targetY, boolean conditional, boolean highLighted, double scaleFactor) {
|
||||
Paint originalPaint = g.getPaint();
|
||||
if (highLighted)
|
||||
|
@ -512,10 +511,10 @@ public class DefaultProcessDiagramCanvas {
|
|||
public void drawSequenceflow(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, boolean highLighted, double scaleFactor) {
|
||||
drawConnection(xPoints, yPoints, conditional, isDefault, "sequenceFlow", AssociationDirection.ONE, highLighted, scaleFactor);
|
||||
}
|
||||
|
||||
public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, String connectionType,
|
||||
|
||||
public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, String connectionType,
|
||||
AssociationDirection associationDirection, boolean highLighted, double scaleFactor) {
|
||||
|
||||
|
||||
Paint originalPaint = g.getPaint();
|
||||
Stroke originalStroke = g.getStroke();
|
||||
|
||||
|
@ -535,7 +534,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
Line2D.Double line = new Line2D.Double(sourceX, sourceY, targetX, targetY);
|
||||
g.draw(line);
|
||||
}
|
||||
|
||||
|
||||
if (isDefault){
|
||||
Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
|
||||
drawDefaultSequenceFlowIndicator(line, scaleFactor);
|
||||
|
@ -545,7 +544,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
|
||||
drawConditionalSequenceFlowIndicator(line, scaleFactor);
|
||||
}
|
||||
|
||||
|
||||
if (associationDirection.equals(AssociationDirection.ONE) || associationDirection.equals(AssociationDirection.BOTH)) {
|
||||
Line2D.Double line = new Line2D.Double(xPoints[xPoints.length-2], yPoints[xPoints.length-2], xPoints[xPoints.length-1], yPoints[xPoints.length-1]);
|
||||
drawArrowHead(line, scaleFactor);
|
||||
|
@ -660,22 +659,22 @@ public class DefaultProcessDiagramCanvas {
|
|||
|
||||
public void drawTask(BufferedImage icon, String name, GraphicInfo graphicInfo, double scaleFactor) {
|
||||
drawTask(name, graphicInfo);
|
||||
g.drawImage(icon, (int) (graphicInfo.getX() + ICON_PADDING / scaleFactor),
|
||||
(int) (graphicInfo.getY() + ICON_PADDING / scaleFactor),
|
||||
g.drawImage(icon, (int) (graphicInfo.getX() + ICON_PADDING / scaleFactor),
|
||||
(int) (graphicInfo.getY() + ICON_PADDING / scaleFactor),
|
||||
(int) (icon.getWidth() / scaleFactor), (int) (icon.getHeight() / scaleFactor), null);
|
||||
}
|
||||
|
||||
public void drawTask(String name, GraphicInfo graphicInfo) {
|
||||
drawTask(name, graphicInfo, false);
|
||||
}
|
||||
|
||||
|
||||
public void drawPoolOrLane(String name, GraphicInfo graphicInfo) {
|
||||
int x = (int) graphicInfo.getX();
|
||||
int y = (int) graphicInfo.getY();
|
||||
int width = (int) graphicInfo.getWidth();
|
||||
int height = (int) graphicInfo.getHeight();
|
||||
g.drawRect(x, y, width, height);
|
||||
|
||||
|
||||
// Add the name as text, vertical
|
||||
if(name != null && name.length() > 0) {
|
||||
// Include some padding
|
||||
|
@ -689,10 +688,10 @@ public class DefaultProcessDiagramCanvas {
|
|||
Font currentFont = g.getFont();
|
||||
Font theDerivedFont = currentFont.deriveFont(transformation);
|
||||
g.setFont(theDerivedFont);
|
||||
|
||||
|
||||
String truncated = fitTextToWidth(name, availableTextSpace);
|
||||
int realWidth = fontMetrics.stringWidth(truncated);
|
||||
|
||||
|
||||
g.drawString(truncated, x + 2 + fontMetrics.getHeight(), 3 + y + availableTextSpace - (availableTextSpace - realWidth) / 2);
|
||||
g.setFont(currentFont);
|
||||
}
|
||||
|
@ -704,14 +703,14 @@ public class DefaultProcessDiagramCanvas {
|
|||
int y = (int) graphicInfo.getY();
|
||||
int width = (int) graphicInfo.getWidth();
|
||||
int height = (int) graphicInfo.getHeight();
|
||||
|
||||
|
||||
// Create a new gradient paint for every task box, gradient depends on x and y and is not relative
|
||||
// g.setPaint(TASK_BOX_COLOR);
|
||||
g.setPaint(new Color(255,255,0));
|
||||
g.setPaint(new Color(144,238,144));
|
||||
int arcR = 6;
|
||||
if (thickBorder)
|
||||
arcR = 3;
|
||||
|
||||
|
||||
// shape
|
||||
RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, arcR, arcR);
|
||||
g.fill(rect);
|
||||
|
@ -733,11 +732,11 @@ public class DefaultProcessDiagramCanvas {
|
|||
int boxHeight = height - 16 - ICON_PADDING - ICON_PADDING - MARKER_WIDTH - 2 - 2;
|
||||
int boxX = x + width/2 - boxWidth/2;
|
||||
int boxY = y + height/2 - boxHeight/2 + ICON_PADDING + ICON_PADDING - 2 - 2;
|
||||
|
||||
|
||||
drawMultilineCentredText(name, boxX, boxY, boxWidth, boxHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void drawMultilineCentredText(String text, int x, int y, int boxWidth, int boxHeight) {
|
||||
drawMultilineText(text, x, y, boxWidth, boxHeight, true);
|
||||
}
|
||||
|
@ -745,38 +744,38 @@ public class DefaultProcessDiagramCanvas {
|
|||
protected void drawMultilineAnnotationText(String text, int x, int y, int boxWidth, int boxHeight) {
|
||||
drawMultilineText(text, x, y, boxWidth, boxHeight, false);
|
||||
}
|
||||
|
||||
|
||||
protected void drawMultilineText(String text, int x, int y, int boxWidth, int boxHeight, boolean centered) {
|
||||
// Create an attributed string based in input text
|
||||
AttributedString attributedString = new AttributedString(text);
|
||||
attributedString.addAttribute(TextAttribute.FONT, g.getFont());
|
||||
attributedString.addAttribute(TextAttribute.FOREGROUND, Color.black);
|
||||
|
||||
|
||||
AttributedCharacterIterator characterIterator = attributedString.getIterator();
|
||||
|
||||
|
||||
int currentHeight = 0;
|
||||
// Prepare a list of lines of text we'll be drawing
|
||||
List<TextLayout> layouts = new ArrayList<TextLayout>();
|
||||
String lastLine = null;
|
||||
|
||||
|
||||
LineBreakMeasurer measurer = new LineBreakMeasurer(characterIterator, g.getFontRenderContext());
|
||||
|
||||
|
||||
TextLayout layout = null;
|
||||
while (measurer.getPosition() < characterIterator.getEndIndex() && currentHeight <= boxHeight) {
|
||||
|
||||
|
||||
int previousPosition = measurer.getPosition();
|
||||
|
||||
|
||||
// Request next layout
|
||||
layout = measurer.nextLayout(boxWidth);
|
||||
|
||||
|
||||
int height = ((Float)(layout.getDescent() + layout.getAscent() + layout.getLeading())).intValue();
|
||||
|
||||
|
||||
if(currentHeight + height > boxHeight) {
|
||||
// The line we're about to add should NOT be added anymore, append three dots to previous one instead
|
||||
// to indicate more text is truncated
|
||||
if (!layouts.isEmpty()) {
|
||||
layouts.remove(layouts.size() - 1);
|
||||
|
||||
|
||||
if(lastLine.length() >= 4) {
|
||||
lastLine = lastLine.substring(0, lastLine.length() - 4) + "...";
|
||||
}
|
||||
|
@ -789,23 +788,23 @@ public class DefaultProcessDiagramCanvas {
|
|||
currentHeight += height;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int currentY = y + (centered ? ((boxHeight - currentHeight) /2) : 0);
|
||||
int currentX = 0;
|
||||
|
||||
|
||||
// Actually draw the lines
|
||||
for(TextLayout textLayout : layouts) {
|
||||
|
||||
|
||||
currentY += textLayout.getAscent();
|
||||
currentX = x + (centered ? ((boxWidth - ((Double)textLayout.getBounds().getWidth()).intValue()) /2) : 0);
|
||||
|
||||
|
||||
textLayout.draw(g, currentX, currentY);
|
||||
currentY += textLayout.getDescent() + textLayout.getLeading();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected String fitTextToWidth(String original, int width) {
|
||||
String text = original;
|
||||
|
@ -847,23 +846,23 @@ public class DefaultProcessDiagramCanvas {
|
|||
public void drawManualTask(String name, GraphicInfo graphicInfo, double scaleFactor) {
|
||||
drawTask(MANUALTASK_IMAGE, name, graphicInfo, scaleFactor);
|
||||
}
|
||||
|
||||
|
||||
public void drawBusinessRuleTask(String name, GraphicInfo graphicInfo, double scaleFactor) {
|
||||
drawTask(BUSINESS_RULE_TASK_IMAGE, name, graphicInfo, scaleFactor);
|
||||
}
|
||||
|
||||
|
||||
public void drawCamelTask(String name, GraphicInfo graphicInfo, double scaleFactor) {
|
||||
drawTask(CAMEL_TASK_IMAGE, name, graphicInfo, scaleFactor);
|
||||
}
|
||||
|
||||
|
||||
public void drawMuleTask(String name, GraphicInfo graphicInfo, double scaleFactor) {
|
||||
drawTask(MULE_TASK_IMAGE, name, graphicInfo, scaleFactor);
|
||||
}
|
||||
|
||||
public void drawExpandedSubProcess(String name, GraphicInfo graphicInfo, Boolean isTriggeredByEvent, double scaleFactor) {
|
||||
RoundRectangle2D rect = new RoundRectangle2D.Double(graphicInfo.getX(), graphicInfo.getY(),
|
||||
RoundRectangle2D rect = new RoundRectangle2D.Double(graphicInfo.getX(), graphicInfo.getY(),
|
||||
graphicInfo.getWidth(), graphicInfo.getHeight(), 8, 8);
|
||||
|
||||
|
||||
// Use different stroke (dashed)
|
||||
if (isTriggeredByEvent) {
|
||||
Stroke originalStroke = g.getStroke();
|
||||
|
@ -939,7 +938,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
int y = (int) graphicInfo.getY();
|
||||
int width = (int) graphicInfo.getWidth();
|
||||
int height = (int) graphicInfo.getHeight();
|
||||
|
||||
|
||||
rhombus.addPoint(x, y + (height / 2));
|
||||
rhombus.addPoint(x + (width / 2), y + height);
|
||||
rhombus.addPoint(x + width, y + (height / 2));
|
||||
|
@ -1009,39 +1008,39 @@ public class DefaultProcessDiagramCanvas {
|
|||
g.setStroke(orginalStroke);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void drawEventBasedGateway(GraphicInfo graphicInfo, double scaleFactor) {
|
||||
// rhombus
|
||||
drawGateway(graphicInfo);
|
||||
|
||||
|
||||
if (scaleFactor == 1.0) {
|
||||
int x = (int) graphicInfo.getX();
|
||||
int y = (int) graphicInfo.getY();
|
||||
int width = (int) graphicInfo.getWidth();
|
||||
int height = (int) graphicInfo.getHeight();
|
||||
|
||||
|
||||
double scale = .6;
|
||||
|
||||
|
||||
GraphicInfo eventInfo = new GraphicInfo();
|
||||
eventInfo.setX(x + width*(1-scale)/2);
|
||||
eventInfo.setY(y + height*(1-scale)/2);
|
||||
eventInfo.setWidth(width*scale);
|
||||
eventInfo.setHeight(height*scale);
|
||||
drawCatchingEvent(eventInfo, true, null, "eventGateway", scaleFactor);
|
||||
|
||||
|
||||
double r = width / 6.;
|
||||
|
||||
|
||||
// create pentagon (coords with respect to center)
|
||||
int topX = (int)(.95 * r); // top right corner
|
||||
int topY = (int)(-.31 * r);
|
||||
int bottomX = (int)(.59 * r); // bottom right corner
|
||||
int bottomY = (int)(.81 * r);
|
||||
|
||||
|
||||
int[] xPoints = new int[]{ 0, topX, bottomX, -bottomX, -topX };
|
||||
int[] yPoints = new int[]{ -(int)r, topY, bottomY, bottomY, topY };
|
||||
Polygon pentagon = new Polygon(xPoints, yPoints, 5);
|
||||
pentagon.translate(x+width/2, y+width/2);
|
||||
|
||||
|
||||
// draw
|
||||
g.drawPolygon(pentagon);
|
||||
}
|
||||
|
@ -1105,12 +1104,12 @@ public class DefaultProcessDiagramCanvas {
|
|||
int y = (int) graphicInfo.getY();
|
||||
int width = (int) graphicInfo.getWidth();
|
||||
int height = (int) graphicInfo.getHeight();
|
||||
|
||||
|
||||
Font originalFont = g.getFont();
|
||||
Stroke originalStroke = g.getStroke();
|
||||
|
||||
|
||||
g.setFont(ANNOTATION_FONT);
|
||||
|
||||
|
||||
Path2D path = new Path2D.Double();
|
||||
x += .5;
|
||||
int lineLength = 18;
|
||||
|
@ -1118,35 +1117,35 @@ public class DefaultProcessDiagramCanvas {
|
|||
path.lineTo(x, y);
|
||||
path.lineTo(x, y + height);
|
||||
path.lineTo(x + lineLength, y + height);
|
||||
|
||||
|
||||
path.lineTo(x + lineLength, y + height -1);
|
||||
path.lineTo(x + 1, y + height -1);
|
||||
path.lineTo(x + 1, y + 1);
|
||||
path.lineTo(x + lineLength, y + 1);
|
||||
path.closePath();
|
||||
|
||||
|
||||
g.draw(path);
|
||||
|
||||
|
||||
int boxWidth = width - (2 * ANNOTATION_TEXT_PADDING);
|
||||
int boxHeight = height - (2 * ANNOTATION_TEXT_PADDING);
|
||||
int boxX = x + width/2 - boxWidth/2;
|
||||
int boxY = y + height/2 - boxHeight/2;
|
||||
|
||||
|
||||
if (text != null && text.isEmpty() == false) {
|
||||
drawMultilineAnnotationText(text, boxX, boxY, boxWidth, boxHeight);
|
||||
}
|
||||
|
||||
|
||||
// restore originals
|
||||
g.setFont(originalFont);
|
||||
g.setStroke(originalStroke);
|
||||
}
|
||||
|
||||
|
||||
public void drawLabel(String text, GraphicInfo graphicInfo){
|
||||
drawLabel(text, graphicInfo, true);
|
||||
}
|
||||
public void drawLabel(String text, GraphicInfo graphicInfo, boolean centered){
|
||||
float interline = 1.0f;
|
||||
|
||||
|
||||
// text
|
||||
if (text != null && text.length()>0) {
|
||||
Paint originalPaint = g.getPaint();
|
||||
|
@ -1157,7 +1156,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
|
||||
int wrapWidth = 100;
|
||||
int textY = (int) graphicInfo.getY();
|
||||
|
||||
|
||||
// TODO: use drawMultilineText()
|
||||
AttributedString as = new AttributedString(text);
|
||||
as.addAttribute(TextAttribute.FOREGROUND, g.getPaint());
|
||||
|
@ -1165,7 +1164,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
AttributedCharacterIterator aci = as.getIterator();
|
||||
FontRenderContext frc = new FontRenderContext(null, true, false);
|
||||
LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc);
|
||||
|
||||
|
||||
while (lbm.getPosition() < text.length()) {
|
||||
TextLayout tl = lbm.nextLayout(wrapWidth);
|
||||
textY += tl.getAscent();
|
||||
|
@ -1177,7 +1176,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
tl.draw(g, (float) tX, textY);
|
||||
textY += tl.getDescent() + tl.getLeading() + (interline - 1.0f) * tl.getAscent();
|
||||
}
|
||||
|
||||
|
||||
// restore originals
|
||||
g.setFont(originalFont);
|
||||
g.setPaint(originalPaint);
|
||||
|
@ -1191,7 +1190,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
* @param sourceGraphicInfo
|
||||
* @param targetGraphicInfo
|
||||
* @param graphicInfoList
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<GraphicInfo> connectionPerfectionizer(SHAPE_TYPE sourceShapeType, SHAPE_TYPE targetShapeType, GraphicInfo sourceGraphicInfo, GraphicInfo targetGraphicInfo, List<GraphicInfo> graphicInfoList) {
|
||||
Shape shapeFirst = createShape(sourceShapeType, sourceGraphicInfo);
|
||||
|
@ -1208,9 +1207,9 @@ public class DefaultProcessDiagramCanvas {
|
|||
graphicInfoLast.setX(shapeLast.getBounds2D().getCenterX());
|
||||
graphicInfoLast.setY(shapeLast.getBounds2D().getCenterY());
|
||||
}
|
||||
|
||||
|
||||
Point p = null;
|
||||
|
||||
|
||||
if (shapeFirst != null) {
|
||||
Line2D.Double lineFirst = new Line2D.Double(graphicInfoFirst.getX(), graphicInfoFirst.getY(), graphicInfoList.get(1).getX(), graphicInfoList.get(1).getY());
|
||||
p = getIntersection(shapeFirst, lineFirst);
|
||||
|
@ -1219,7 +1218,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
graphicInfoFirst.setY(p.getY());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (shapeLast != null) {
|
||||
Line2D.Double lineLast = new Line2D.Double(graphicInfoLast.getX(), graphicInfoLast.getY(), graphicInfoList.get(graphicInfoList.size()-2).getX(), graphicInfoList.get(graphicInfoList.size()-2).getY());
|
||||
p = getIntersection(shapeLast, lineLast);
|
||||
|
@ -1242,7 +1241,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
private static Shape createShape(SHAPE_TYPE shapeType, GraphicInfo graphicInfo) {
|
||||
if (SHAPE_TYPE.Rectangle.equals(shapeType)) {
|
||||
// source is rectangle
|
||||
return new Rectangle2D.Double(graphicInfo.getX(), graphicInfo.getY(), graphicInfo.getWidth(), graphicInfo.getHeight());
|
||||
return new Rectangle2D.Double(graphicInfo.getX(), graphicInfo.getY(), graphicInfo.getWidth(), graphicInfo.getHeight());
|
||||
} else if (SHAPE_TYPE.Rhombus.equals(shapeType)) {
|
||||
// source is rhombus
|
||||
Path2D.Double rhombus = new Path2D.Double();
|
||||
|
@ -1264,7 +1263,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
|
||||
/**
|
||||
* This method returns intersection point of shape border and line.
|
||||
*
|
||||
*
|
||||
* @param shape
|
||||
* @param line
|
||||
* @return Point
|
||||
|
@ -1298,7 +1297,7 @@ public class DefaultProcessDiagramCanvas {
|
|||
|
||||
/**
|
||||
* This method calculates shape intersection with line.
|
||||
*
|
||||
*
|
||||
* @param shape
|
||||
* @param line
|
||||
* @return Intersection point
|
||||
|
|
|
@ -0,0 +1,205 @@
|
|||
package org.activiti.rest;
|
||||
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.engine.*;
|
||||
import org.activiti.engine.history.HistoricActivityInstance;
|
||||
import org.activiti.engine.history.HistoricIdentityLink;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.activiti.engine.identity.Group;
|
||||
import org.activiti.engine.identity.User;
|
||||
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.activiti.engine.impl.context.Context;
|
||||
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.activiti.image.HMProcessDiagramGenerator;
|
||||
import org.activiti.rest.model.ActivitiProcess;
|
||||
import org.activiti.spring.ProcessEngineFactoryBean;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2019-03-10.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Service
|
||||
public class ActivitiService {
|
||||
|
||||
@Autowired
|
||||
RuntimeService runtimeService;
|
||||
|
||||
@Autowired
|
||||
TaskService taskService;
|
||||
|
||||
@Autowired
|
||||
IdentityService identityService;
|
||||
|
||||
@Autowired
|
||||
RepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
ProcessEngineFactoryBean processEngine;
|
||||
|
||||
@Autowired
|
||||
ProcessEngineConfiguration processEngineConfiguration;
|
||||
|
||||
@Autowired
|
||||
HistoryService historyService;
|
||||
|
||||
static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-hh mm:ss");
|
||||
|
||||
/**
|
||||
* 获取需要高亮的线
|
||||
*
|
||||
* @param processDefinitionEntity
|
||||
* @param historicActivityInstances
|
||||
* @return
|
||||
*/
|
||||
private List<String> getHighLightedFlows(
|
||||
ProcessDefinitionEntity processDefinitionEntity,
|
||||
List<HistoricActivityInstance> historicActivityInstances) {
|
||||
|
||||
List<String> highFlows = new ArrayList<String>();
|
||||
|
||||
for (int i = 0; i < historicActivityInstances.size() - 1; i++) {
|
||||
ActivityImpl activityImpl = processDefinitionEntity
|
||||
.findActivity(historicActivityInstances.get(i)
|
||||
.getActivityId());
|
||||
List<ActivityImpl> sameStartTimeNodes = new ArrayList<ActivityImpl>();
|
||||
ActivityImpl sameActivityImpl1 = processDefinitionEntity
|
||||
.findActivity(historicActivityInstances.get(i + 1)
|
||||
.getActivityId());
|
||||
sameStartTimeNodes.add(sameActivityImpl1);
|
||||
|
||||
for (int j = i + 1; j < historicActivityInstances.size() - 1; j++) {
|
||||
HistoricActivityInstance activityImpl1 = historicActivityInstances
|
||||
.get(j);
|
||||
HistoricActivityInstance activityImpl2 = historicActivityInstances
|
||||
.get(j + 1);
|
||||
|
||||
if (activityImpl1.getStartTime().equals(
|
||||
activityImpl2.getStartTime())) {
|
||||
|
||||
ActivityImpl sameActivityImpl2 = processDefinitionEntity
|
||||
.findActivity(activityImpl2.getActivityId());
|
||||
sameStartTimeNodes.add(sameActivityImpl2);
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<PvmTransition> pvmTransitions = activityImpl
|
||||
.getOutgoingTransitions();
|
||||
for (PvmTransition pvmTransition : pvmTransitions) {
|
||||
ActivityImpl pvmActivityImpl = (ActivityImpl) pvmTransition
|
||||
.getDestination();
|
||||
if (sameStartTimeNodes.contains(pvmActivityImpl)) {
|
||||
Map<String, Object> properties = pvmActivityImpl.getProperties();
|
||||
System.out.println(properties);
|
||||
highFlows.add(pvmTransition.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
return highFlows;
|
||||
}
|
||||
|
||||
public List<ActivitiProcess> getTaskSqu(String processInstanceId) {
|
||||
List<HistoricTaskInstance> list = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstanceId)
|
||||
.list();
|
||||
List<ActivitiProcess> activitiProcesses = new ArrayList<>();
|
||||
|
||||
list.forEach(s -> {
|
||||
String assignee = s.getAssignee();
|
||||
ActivitiProcess activitiProcess = new ActivitiProcess();
|
||||
//组
|
||||
List<HistoricIdentityLink> historicIdentityLinksForTask = historyService.getHistoricIdentityLinksForTask(s.getId());
|
||||
List<String> groupName = new ArrayList<>();
|
||||
historicIdentityLinksForTask.forEach(hist -> {
|
||||
if(!StringUtils.isEmpty(hist.getGroupId())){
|
||||
List<Group> groupList = identityService.createGroupQuery().groupId(hist.getGroupId()).list();
|
||||
if (groupList.size() > 0) {
|
||||
List<String> groupNames = groupList.stream().map(Group::getName).collect(Collectors.toList());
|
||||
groupName.addAll(groupNames);
|
||||
}
|
||||
}
|
||||
});
|
||||
activitiProcess.setGroupNames(groupName);
|
||||
if (!StringUtils.isEmpty(assignee)) {
|
||||
activitiProcess.setUserId(assignee);
|
||||
User user = identityService.createUserQuery().userId(assignee).singleResult();
|
||||
if(user!=null){
|
||||
activitiProcess.setUserName(user.getFirstName());
|
||||
}
|
||||
activitiProcess.setSid(s.getTaskDefinitionKey());
|
||||
}
|
||||
|
||||
activitiProcess.setTaskName(s.getName());
|
||||
if(s.getEndTime()!=null){
|
||||
activitiProcess.setTime(simpleDateFormat.format(s.getEndTime()));
|
||||
}
|
||||
activitiProcesses.add(activitiProcess);
|
||||
});
|
||||
return activitiProcesses;
|
||||
}
|
||||
|
||||
public InputStream generateStream(String processInstanceId, boolean needCurrent) {
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
HistoricProcessInstance historicProcessInstance =
|
||||
historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
String processDefinitionId = null;
|
||||
List<String> executedActivityIdList = new ArrayList<String>();
|
||||
List<String> currentActivityIdList = new ArrayList<>();
|
||||
List<HistoricActivityInstance> historicActivityInstanceList = new ArrayList<>();
|
||||
if (processInstance != null) {
|
||||
processDefinitionId = processInstance.getProcessDefinitionId();
|
||||
if (needCurrent) {
|
||||
currentActivityIdList = this.runtimeService.getActiveActivityIds(processInstance.getId());
|
||||
}
|
||||
}
|
||||
if (historicProcessInstance != null) {
|
||||
processDefinitionId = historicProcessInstance.getProcessDefinitionId();
|
||||
historicActivityInstanceList =
|
||||
historyService.createHistoricActivityInstanceQuery().finished().processInstanceId(processInstanceId).orderByHistoricActivityInstanceId().asc().list();
|
||||
for (HistoricActivityInstance activityInstance : historicActivityInstanceList) {
|
||||
executedActivityIdList.add(activityInstance.getActivityId());
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(processDefinitionId) || executedActivityIdList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//高亮线路id集合
|
||||
ProcessDefinitionEntity definitionEntity = (ProcessDefinitionEntity) repositoryService.getProcessDefinition(processDefinitionId);
|
||||
List<String> highLightedFlows = getHighLightedFlows(definitionEntity, historicActivityInstanceList);
|
||||
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
|
||||
//List<String> activeActivityIds = runtimeService.getActiveActivityIds(processInstanceId);
|
||||
processEngineConfiguration = processEngine.getProcessEngineConfiguration();
|
||||
Context.setProcessEngineConfiguration((ProcessEngineConfigurationImpl) processEngineConfiguration);
|
||||
HMProcessDiagramGenerator diagramGenerator = (HMProcessDiagramGenerator) processEngineConfiguration.getProcessDiagramGenerator();
|
||||
//List<String> activeIds = this.runtimeService.getActiveActivityIds(processInstance.getId());
|
||||
|
||||
InputStream imageStream = diagramGenerator.generateDiagram(
|
||||
bpmnModel, "png",
|
||||
executedActivityIdList, highLightedFlows,
|
||||
processEngine.getProcessEngineConfiguration().getActivityFontName(),
|
||||
processEngine.getProcessEngineConfiguration().getLabelFontName(),
|
||||
"宋体",
|
||||
null, 1.0, currentActivityIdList);
|
||||
|
||||
return imageStream;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package org.activiti.rest.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2019-03-10.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("流程顺序")
|
||||
public class ActivitiProcess {
|
||||
|
||||
@ApiModelProperty("流程活动名称")
|
||||
String taskName;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
String userId;
|
||||
|
||||
@ApiModelProperty("用户名")
|
||||
String userName;
|
||||
|
||||
@ApiModelProperty("组")
|
||||
List<String> groupNames;
|
||||
|
||||
@ApiModelProperty("流程线id")
|
||||
String sid;
|
||||
|
||||
@ApiModelProperty("审批时间")
|
||||
String time;
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>流程图</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport"
|
||||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
</head>
|
||||
<style>
|
||||
.tab-2{margin-left: 40%}
|
||||
</style>
|
||||
<body>
|
||||
<div class="x-body">
|
||||
<div class="layui-tab">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">流程图</li>
|
||||
<li>流程审批</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div id="image" style="width:100%;height:100%;overflow: auto;">
|
||||
<div class="layui-form-item">
|
||||
<image id="showImages1" style="display: none;"></image>
|
||||
<image id="showImages2"></image>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-tab-item tab-2">
|
||||
<ul class="layui-timeline">
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var countNum = 0;
|
||||
layui.use(['form', 'layer','element'], function () {
|
||||
$ = layui.jquery;
|
||||
layer.load(1);
|
||||
$.getJSON('${re.contextPath}/act/getShineProcImage?processInstanceId=${processInstanceId}', function (json) {
|
||||
let result = json.images;
|
||||
let task=json.taskSqu;
|
||||
if(typeof task!=='undefined'){
|
||||
showTask(task);
|
||||
}
|
||||
let imgObj1 = document.getElementById("showImages1")
|
||||
imgObj1.src = "data:image/png;base64," + result[0];
|
||||
let imgObj2 = document.getElementById("showImages2")
|
||||
imgObj2.src = "data:image/png;base64," + result[1];
|
||||
window.setInterval(function () {
|
||||
if (countNum === 0) {
|
||||
$("#showImages1").show();
|
||||
$("#showImages2").hide();
|
||||
} else {
|
||||
$("#showImages1").hide();
|
||||
$("#showImages2").show();
|
||||
}
|
||||
countNum++;
|
||||
if (countNum === 2) {
|
||||
countNum = 0;
|
||||
}
|
||||
}, 1000);
|
||||
layer.closeAll('loading');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function showTask(task){
|
||||
let msg=``;
|
||||
for(let i=0;i<task.length;i++){
|
||||
let t=task[i];
|
||||
msg+= `<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<br/>
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h3 class="layui-timeline-title">`;
|
||||
msg+=t.taskName;
|
||||
msg+=`</h3>
|
||||
<p>
|
||||
<br>审批人:`;
|
||||
if(t.userName!==null){
|
||||
msg+=t.userName;
|
||||
}
|
||||
msg+=`<br>审批组:`;
|
||||
if(t.groupNames){
|
||||
t.groupNames.forEach(function(v,index){
|
||||
msg+=v;
|
||||
msg+=(index===t.groupNames.length-1?'':'/');
|
||||
});
|
||||
}
|
||||
msg+=`
|
||||
<br>审批时间:`;
|
||||
if(t.time!==null) {
|
||||
msg += t.time;
|
||||
}
|
||||
msg+=`
|
||||
</p>
|
||||
</div>
|
||||
</li>`
|
||||
}
|
||||
let line=document.getElementsByClassName('layui-timeline')[0];
|
||||
line.innerHTML=msg;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
|
@ -1,174 +0,0 @@
|
|||
<#--Created by IntelliJ IDEA.
|
||||
User: zxm
|
||||
Date: 2017/12/20
|
||||
Time: 10:00
|
||||
To change this template use File | Settings | File Templates.-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>新建业绩申报</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport"
|
||||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="x-body">
|
||||
<form class="layui-form layui-form-pane" style="margin-left: 20px;">
|
||||
<div style="width:100%;height:400px;overflow: auto;">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">业绩申报信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="customer" class="layui-form-label">
|
||||
选择客户
|
||||
</label>
|
||||
<div class="layui-input-block layui-form">
|
||||
<#--<input type="hidden" name="customerId" id="customerId">-->
|
||||
<#--<input type="hidden" name="customerName" id="customerName">-->
|
||||
<select id="customer" name="customerId" lay-verify="required" lay-filter="customerFilter">
|
||||
<option value="">请选择一个客户</option>
|
||||
<#list customerList as cl>
|
||||
<option value="${cl.id}">${cl.customerName}</option>
|
||||
</#list>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="product" class="layui-form-label">
|
||||
选择产品
|
||||
</label>
|
||||
<div class="layui-input-block layui-form">
|
||||
<#--<input type="hidden" name="productId" id="productId">-->
|
||||
<#--<input type="hidden" name="productName" id="productName">-->
|
||||
<select id="product" name="productId" lay-verify="required" lay-filter="productFilter">
|
||||
<option value="">请选择一个产品</option>
|
||||
<#list productList as cl>
|
||||
<option value="${cl.id}">${cl.productName}</option>
|
||||
</#list>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">申报原因</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="reason" class="layui-form-label">
|
||||
<span class="x-red">*</span>申报原因
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="reason" style="width: 300px;" name="reason" lay-verify="reason"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 60px"></div>
|
||||
</div>
|
||||
<div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6;
|
||||
position: fixed;bottom: 1px;margin-left:-20px;">
|
||||
<div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">
|
||||
|
||||
<button class="layui-btn layui-btn-normal" lay-filter="add" lay-submit>
|
||||
申请
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-primary" data-type="close">
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['form', 'layer'], function () {
|
||||
$ = layui.jquery;
|
||||
var form = layui.form
|
||||
, layer = layui.layer
|
||||
, laydate = layui.laydate;
|
||||
var d = new Date();
|
||||
var day = d.getFullYear() + "-" + (parseInt(d.getMonth()) + 1) + '-' + d.getDate();
|
||||
console.log(day);
|
||||
var $ = layui.$, active = {
|
||||
close: function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
}
|
||||
}
|
||||
$('.layui-form-item .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
form.render('select');
|
||||
|
||||
form.on('select(customerFilter)', function(data){
|
||||
$('#customerId').val(data.value);
|
||||
$("#customerName").val($(data.elem).find("option:selected").text());
|
||||
});
|
||||
|
||||
form.on('select(productFilter)', function(data){
|
||||
$('#productId').val(data.value);
|
||||
$("#productName").val($(data.elem).find("option:selected").text());
|
||||
});
|
||||
//自定义验证规则
|
||||
form.verify({
|
||||
reason: function (value) {
|
||||
if (value.trim() == "") {
|
||||
return "请填写请假原因";
|
||||
}
|
||||
}
|
||||
});
|
||||
form.on('submit(close)', function (data) {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
})
|
||||
//监听提交
|
||||
form.on('submit(add)', function (data) {
|
||||
$.ajax({
|
||||
url: 'addDeclare',
|
||||
type: 'post',
|
||||
data: data.field,
|
||||
async: false, traditional: true,
|
||||
success: function (d) {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
if (d.flag) {
|
||||
parent.layer.close(index);
|
||||
window.parent.layui.table.reload('delcareList');
|
||||
window.top.layer.msg(d.msg, {icon: 6, offset: 'rb', area: ['120px', '80px'], anim: 2});
|
||||
} else {
|
||||
layer.msg(d.msg, {icon: 5});
|
||||
}
|
||||
}, error: function () {
|
||||
layer.alert("请求失败", {icon: 6}, function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,256 +0,0 @@
|
|||
<#-- Created by IntelliJ IDEA.
|
||||
User: zxm
|
||||
Date: 2018/1/15
|
||||
Time: 16:53
|
||||
To change this template use File | Settings | File Templates.
|
||||
流程部署-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>业绩申报流程</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport"
|
||||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/lenos/main.css"/>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="lenos-search">
|
||||
<div class="select">
|
||||
<#--开始时间:-->
|
||||
<#--<div class="layui-inline">-->
|
||||
<#--<input class="layui-input" placeholder="yyyy-MM-dd" height="20px" id="beginTime" autocomplete="off">-->
|
||||
<#--</div>-->
|
||||
<#--结束时间:-->
|
||||
<#--<div class="layui-inline">-->
|
||||
<#--<input class="layui-input" placeholder="yyyy-MM-dd" height="20px" id="endTime" autocomplete="off">-->
|
||||
<#--</div>-->
|
||||
<#--<button class="select-on layui-btn layui-btn-sm" data-type="select"><i class="layui-icon"></i>-->
|
||||
<#--</button>-->
|
||||
<button class="layui-btn layui-btn-sm icon-position-button" id="refresh" style="float: right;"
|
||||
data-type="reload">
|
||||
<i class="layui-icon">ဂ</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-btn-group">
|
||||
<button class="layui-btn layui-btn-normal" data-type="createDeclare">
|
||||
<i class="layui-icon"></i>新建业绩申报
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="delcareList" class="layui-hide" lay-filter="delcare"></table>
|
||||
<script type="text/html" id="toolBar">
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="getProcImage"><i class="layui-icon"></i>查看流程图</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delcareDetail"><i class="layui-icon"></i>查看审批详情</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delcareBillDetail"><i class="layui-icon"></i>查看单据详情</a>
|
||||
</script>
|
||||
<script type="text/html" id="status">
|
||||
{{#if(typeof(d.taskName)!='undefined'){}}
|
||||
<div>${d.taskName}</div>
|
||||
{{# }else{}}
|
||||
结束
|
||||
{{# }}}
|
||||
</script>
|
||||
<script>
|
||||
layui.laytpl.toDateString = function (d, format) {
|
||||
var date = new Date(d || new Date())
|
||||
, ymd = [
|
||||
this.digit(date.getFullYear(), 4)
|
||||
, this.digit(date.getMonth() + 1)
|
||||
, this.digit(date.getDate())
|
||||
]
|
||||
, hms = [
|
||||
this.digit(date.getHours())
|
||||
, this.digit(date.getMinutes())
|
||||
, this.digit(date.getSeconds())
|
||||
];
|
||||
|
||||
format = format || 'yyyy-MM-dd HH:mm:ss';
|
||||
|
||||
return format.replace(/yyyy/g, ymd[0])
|
||||
.replace(/MM/g, ymd[1])
|
||||
.replace(/dd/g, ymd[2])
|
||||
.replace(/HH/g, hms[0])
|
||||
.replace(/mm/g, hms[1])
|
||||
.replace(/ss/g, hms[2]);
|
||||
};
|
||||
|
||||
//数字前置补零
|
||||
layui.laytpl.digit = function (num, length, end) {
|
||||
var str = '';
|
||||
num = String(num);
|
||||
length = length || 2;
|
||||
for (var i = num.length; i < length; i++) {
|
||||
str += '0';
|
||||
}
|
||||
return num < Math.pow(10, length) ? str + (num | 0) : num;
|
||||
};
|
||||
|
||||
document.onkeydown = function (e) { // 回车提交表单
|
||||
var theEvent = window.event || e;
|
||||
var code = theEvent.keyCode || theEvent.which;
|
||||
if (code == 13) {
|
||||
$(".select .select-on").click();
|
||||
}
|
||||
}
|
||||
|
||||
layui.use('table', function () {
|
||||
var table = layui.table, laydate = layui.laydate;
|
||||
// var a = laydate.render({
|
||||
// elem: '#beginTime',
|
||||
// done: function(value, date, endDate) {
|
||||
// b.config.min = {
|
||||
// year: date.year,
|
||||
// month: date.month - 1,
|
||||
// date: date.date,
|
||||
// hours: date.hours,
|
||||
// minutes: date.minutes,
|
||||
// seconds: date.seconds
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// var b = laydate.render({
|
||||
// elem: '#endTime'
|
||||
// });
|
||||
//方法级渲染
|
||||
table.render({
|
||||
id: 'delcareList',
|
||||
elem: '#delcareList',
|
||||
url: 'showDeclareList',
|
||||
cols: [[
|
||||
{checkbox: true, fixed: true, width: '5%'},
|
||||
{field: 'userName', title: '申请人', width: '10%', sort: true},
|
||||
{
|
||||
field: 'createDate',
|
||||
title: '创建时间',
|
||||
width: '10%',
|
||||
sort: true,
|
||||
templet: '<div>{{ layui.laytpl.toDateString(d.beginTime,"yyyy-MM-dd") }}</div>'
|
||||
},
|
||||
{field: 'taskName', title: '状态', width: '10%', templet: '#status'},
|
||||
{field: 'reason', title: '原因', width: '10%', sort: true},
|
||||
{field: 'processInstanceId', title: '流程定义id', width: '10%', sort: true},
|
||||
{field: 'text', title: '操作', width: '35%', toolbar: '#toolBar'}
|
||||
|
||||
]],
|
||||
page: true,
|
||||
height: 'full-84'
|
||||
});
|
||||
|
||||
var $ = layui.$, active = {
|
||||
// select: function () {
|
||||
// var beginTime = $('#beginTime').val();
|
||||
// var endTime = $('#endTime').val();
|
||||
// table.reload('leaveList', {
|
||||
// where: {
|
||||
// beginTime: beginTime,
|
||||
// endTime: endTime
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
createDeclare: function () {
|
||||
add("申请业绩申报", 'addDeclare', 700, 450);
|
||||
},
|
||||
reload: function () {
|
||||
table.reload('delcareList', {
|
||||
where: {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//监听工具条
|
||||
table.on('tool(delcare)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'start') {
|
||||
start(data.key);
|
||||
} else if (obj.event === 'getProcImage') {
|
||||
// var url = '${re.contextPath}/leave/getShineProcImage?processInstanceId=' + data.processInstanceId + '';
|
||||
layer.open({
|
||||
id: 'delcare-image',
|
||||
type: 2,
|
||||
area: ['880px', '400px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '流程图',
|
||||
content: '${re.contextPath}/leave/shinePics/' + data.processInstanceId
|
||||
});
|
||||
} else if (obj.event === 'delcareDetail') {
|
||||
layer.open({
|
||||
id: 'delcare-detail',
|
||||
type: 2,
|
||||
area: ['880px', '400px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '审核详情',
|
||||
content: "${re.contextPath}/leave/leaveDetail?processId=" + data.processInstanceId
|
||||
});
|
||||
}else if(obj.event ==='delcareBillDetail')
|
||||
{
|
||||
layer.open({
|
||||
id: 'delcare-infodetail',
|
||||
type: 2,
|
||||
area: ['880px', '400px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '单据详情',
|
||||
content: "readOnlyLeave/"+data.id
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
eleClick(active, '.layui-col-md12 .layui-btn');
|
||||
eleClick(active, '.select .layui-btn');
|
||||
|
||||
});
|
||||
|
||||
function add(title, url, w, h) {
|
||||
if (title == null || title == '') {
|
||||
title = false;
|
||||
}
|
||||
;
|
||||
if (url == null || url == '') {
|
||||
url = "404.html";
|
||||
}
|
||||
;
|
||||
if (w == null || w == '') {
|
||||
w = ($(window).width() * 0.9);
|
||||
}
|
||||
;
|
||||
if (h == null || h == '') {
|
||||
h = ($(window).height() - 50);
|
||||
}
|
||||
;
|
||||
layer.open({
|
||||
id: 'delcare-add',
|
||||
type: 2,
|
||||
area: [w + 'px', h + 'px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: title,
|
||||
content: url
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,165 +0,0 @@
|
|||
<#--Created by IntelliJ IDEA.
|
||||
User: zxm
|
||||
Date: 2017/12/20
|
||||
Time: 10:00
|
||||
To change this template use File | Settings | File Templates.-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>业绩申报查看</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport"
|
||||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="x-body">
|
||||
<form class="layui-form layui-form-pane" style="margin-left: 20px;">
|
||||
<div style="width:100%;height:400px;overflow: auto;">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">业绩申报信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="customer" class="layui-form-label">
|
||||
选择客户
|
||||
</label>
|
||||
<div class="layui-input-block layui-form">
|
||||
<input type="hidden" name="customerId" id="customerId">
|
||||
<input type="hidden" name="customerName" id="customerName">
|
||||
<select disabled readonly="readonly" id="customer" name="customer" lay-verify="required" lay-filter="customerFilter">
|
||||
<option value="">未选择客户</option>
|
||||
<#list customerList as cl>
|
||||
<option value="${cl.id}" <#if cl.id == declare.customerId>selected = selected"</#if> >${cl.customerName}</option>
|
||||
</#list>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="product" class="layui-form-label">
|
||||
选择产品
|
||||
</label>
|
||||
<div class="layui-input-block layui-form">
|
||||
<input type="hidden" name="productId" id="productId">
|
||||
<input type="hidden" name="productName" id="productName">
|
||||
<select disabled readonly="readonly" id="product" name="product" lay-verify="required" lay-filter="productFilter">
|
||||
<option value="">未选择产品</option>
|
||||
<#list productList as cl>
|
||||
|
||||
<option value="${cl.id}" <#if cl.id == declare.productId>selected = selected"</#if> >${cl.productName} </option>
|
||||
|
||||
</#list>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="endTime" class="layui-form-label">
|
||||
<span class="x-red">*</span>结束时间
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" disabled readonly="readonly" id="endTime" name="endTime" lay-verify="endTime" placeholder="yyyy-MM-dd"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">申报原因</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="reason" class="layui-form-label">
|
||||
<span class="x-red">*</span>申报原因
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="reason" disabled readonly="readonly" style="width: 300px;" name="reason" lay-verify="reason" value="${declare.reason}"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 60px"></div>
|
||||
</div>
|
||||
<#--<div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6;-->
|
||||
<#--position: fixed;bottom: 1px;margin-left:-20px;">-->
|
||||
<#--<div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">-->
|
||||
<#--<button class="layui-btn layui-btn-normal" lay-filter="add" lay-submit>-->
|
||||
<#--重新提交-->
|
||||
<#--</button>-->
|
||||
<#--<button class="layui-btn layui-btn-normal" lay-filter="closeDeclare" lay-submit>-->
|
||||
<#--取消请假-->
|
||||
<#--</button>-->
|
||||
<#--<button class="layui-btn layui-btn-primary" data-type="close">-->
|
||||
<#--取消-->
|
||||
<#--</button>-->
|
||||
<#--</div>-->
|
||||
<#--</div>-->
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['form', 'layer'], function () {
|
||||
$ = layui.jquery;
|
||||
var form = layui.form
|
||||
, layer = layui.layer
|
||||
, laydate = layui.laydate;
|
||||
var d = new Date();
|
||||
var day = d.getFullYear() + "-" + (parseInt(d.getMonth()) + 1) + '-' + d.getDate();
|
||||
console.log(day);
|
||||
var $ = layui.$, active = {
|
||||
close: function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
}
|
||||
}
|
||||
$('.layui-form-item .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
form.render('select');
|
||||
//自定义验证规则
|
||||
form.verify({
|
||||
reason: function (value) {
|
||||
if (value.trim() == "") {
|
||||
return "请填写原因";
|
||||
}
|
||||
}
|
||||
});
|
||||
form.on('submit(close)', function (data) {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
})
|
||||
//监听提交
|
||||
form.on('submit(add)', function (data) {
|
||||
layerAjax('updateDeclare/${taskId}/${declare.id}/true', data.field, 'taskList');
|
||||
return false;
|
||||
});
|
||||
|
||||
form.on('submit(closeDeclare)', function (data) {
|
||||
layerAjax('updateDeclare/${taskId}/${leave.id}/false', data.field, 'taskList');
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,165 +0,0 @@
|
|||
<#--Created by IntelliJ IDEA.
|
||||
User: zxm
|
||||
Date: 2017/12/20
|
||||
Time: 10:00
|
||||
To change this template use File | Settings | File Templates.-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>业绩申报查看</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport"
|
||||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="x-body">
|
||||
<form class="layui-form layui-form-pane" style="margin-left: 20px;">
|
||||
<div style="width:100%;height:400px;overflow: auto;">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">业绩申报信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="customer" class="layui-form-label">
|
||||
选择客户
|
||||
</label>
|
||||
<div class="layui-input-block layui-form">
|
||||
<input type="hidden" name="customerId" id="customerId">
|
||||
<input type="hidden" name="customerName" id="customerName">
|
||||
<select id="customer" name="customer" lay-verify="required" lay-filter="customerFilter">
|
||||
<option value="">未选择客户</option>
|
||||
<#list customerList as cl>
|
||||
<option value="${cl.id}" <#if cl.id == declare.customerId>selected = selected"</#if> >${cl.customerName}</option>
|
||||
</#list>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="product" class="layui-form-label">
|
||||
选择产品
|
||||
</label>
|
||||
<div class="layui-input-block layui-form">
|
||||
<input type="hidden" name="productId" id="productId">
|
||||
<input type="hidden" name="productName" id="productName">
|
||||
<select id="product" name="product" lay-verify="required" lay-filter="productFilter">
|
||||
<option value="">未选择产品</option>
|
||||
<#list productList as cl>
|
||||
|
||||
<option value="${cl.id}" <#if cl.id == declare.productId>selected = selected"</#if> >${cl.productName} </option>
|
||||
|
||||
</#list>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="endTime" class="layui-form-label">
|
||||
<span class="x-red">*</span>结束时间
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="endTime" name="endTime" lay-verify="endTime" placeholder="yyyy-MM-dd"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">申报原因</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="reason" class="layui-form-label">
|
||||
<span class="x-red">*</span>申报原因
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="reason" style="width: 300px;" name="reason" lay-verify="reason" value="${declare.reason}"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 60px"></div>
|
||||
</div>
|
||||
<div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6;
|
||||
position: fixed;bottom: 1px;margin-left:-20px;">
|
||||
<div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">
|
||||
<button class="layui-btn layui-btn-normal" lay-filter="add" lay-submit>
|
||||
重新提交
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-normal" lay-filter="closeDeclare" lay-submit>
|
||||
取消请假
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-primary" data-type="close">
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['form', 'layer'], function () {
|
||||
$ = layui.jquery;
|
||||
var form = layui.form
|
||||
, layer = layui.layer
|
||||
, laydate = layui.laydate;
|
||||
var d = new Date();
|
||||
var day = d.getFullYear() + "-" + (parseInt(d.getMonth()) + 1) + '-' + d.getDate();
|
||||
console.log(day);
|
||||
var $ = layui.$, active = {
|
||||
close: function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
}
|
||||
}
|
||||
$('.layui-form-item .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
form.render('select');
|
||||
//自定义验证规则
|
||||
form.verify({
|
||||
reason: function (value) {
|
||||
if (value.trim() == "") {
|
||||
return "请填写原因";
|
||||
}
|
||||
}
|
||||
});
|
||||
form.on('submit(close)', function (data) {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
})
|
||||
//监听提交
|
||||
form.on('submit(add)', function (data) {
|
||||
layerAjax('updateDeclare/${taskId}/${declare.id}/true', data.field, 'taskList');
|
||||
return false;
|
||||
});
|
||||
|
||||
form.on('submit(closeDeclare)', function (data) {
|
||||
layerAjax('updateDeclare/${taskId}/${leave.id}/false', data.field, 'taskList');
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -8,163 +8,146 @@ To change this template use File | Settings | File Templates.-->
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>新建请假</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<meta charset="UTF-8">
|
||||
<title>新建请假</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport"
|
||||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="x-body">
|
||||
<form class="layui-form layui-form-pane" style="margin-left: 20px;">
|
||||
<div style="width:100%;height:400px;overflow: auto;">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">请假信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="beginTime" class="layui-form-label">
|
||||
<span class="x-red">*</span>开始时间
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="beginTime" name="beginTime" lay-verify="beginTime" placeholder="yyyy-MM-dd"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="endTime" class="layui-form-label">
|
||||
<span class="x-red">*</span>结束时间
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="endTime" name="endTime" lay-verify="endTime" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">原因</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="reason" class="layui-form-label">
|
||||
<span class="x-red">*</span>请假原因
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="reason" style="width: 300px;" name="reason" lay-verify="reason" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 60px"></div>
|
||||
</div>
|
||||
<div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6;
|
||||
<form class="layui-form layui-form-pane" style="margin-left: 20px;">
|
||||
<div style="width:100%;height:400px;overflow: auto;">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">请假信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="beginTime" class="layui-form-label">
|
||||
<span class="x-red">*</span>开始时间
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="beginTime" name="beginTime" lay-verify="beginTime" placeholder="yyyy-MM-dd"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="endTime" class="layui-form-label">
|
||||
<span class="x-red">*</span>结束时间
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="endTime" name="endTime" lay-verify="endTime" placeholder="yyyy-MM-dd"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">原因</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label for="reason" class="layui-form-label">
|
||||
<span class="x-red">*</span>请假原因
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="reason" style="width: 300px;" name="reason" lay-verify="reason"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 60px"></div>
|
||||
</div>
|
||||
<div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6;
|
||||
position: fixed;bottom: 1px;margin-left:-20px;">
|
||||
<div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">
|
||||
<div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">
|
||||
|
||||
<button class="layui-btn layui-btn-normal" lay-filter="add" lay-submit>
|
||||
申请
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-primary" data-type="close">
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<button class="layui-btn layui-btn-normal" lay-filter="add" lay-submit>
|
||||
申请
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-primary" data-type="close">
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['form','layer'], function(){
|
||||
$ = layui.jquery;
|
||||
var form = layui.form
|
||||
,layer = layui.layer
|
||||
,laydate = layui.laydate;
|
||||
var d = new Date();
|
||||
var day=d.getFullYear()+"-"+(parseInt(d.getMonth())+1)+'-'+d.getDate();
|
||||
console.log(day);
|
||||
var $ = layui.$, active = {
|
||||
close: function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
}
|
||||
}
|
||||
$('.layui-form-item .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
var a = laydate.render({
|
||||
elem: '#beginTime',
|
||||
min:day,
|
||||
done: function(value, date, endDate) {
|
||||
b.config.min = {
|
||||
year: date.year,
|
||||
month: date.month - 1,
|
||||
date: date.date,
|
||||
hours: date.hours,
|
||||
minutes: date.minutes,
|
||||
seconds: date.seconds
|
||||
}
|
||||
}
|
||||
});
|
||||
var b = laydate.render({
|
||||
elem: '#endTime',
|
||||
min: '2018-01-20'
|
||||
});
|
||||
|
||||
//自定义验证规则
|
||||
form.verify({
|
||||
beginTime: function(value){
|
||||
if(value.trim()==""){
|
||||
return "开始时间不能为空";
|
||||
}
|
||||
},
|
||||
endTime:function(value) {
|
||||
if (value.trim() == "") {
|
||||
return "结束时间不能为空";
|
||||
}
|
||||
},
|
||||
reason:function(value){
|
||||
if(value.trim()==""){
|
||||
return "请填写请假原因";
|
||||
}
|
||||
}
|
||||
});
|
||||
form.on('submit(close)',function (data) {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
})
|
||||
//监听提交
|
||||
form.on('submit(add)', function(data){
|
||||
$.ajax({
|
||||
url:'addLeave',
|
||||
type:'post',
|
||||
data:data.field,
|
||||
async:false, traditional: true,
|
||||
success:function(d){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
if(d.flag){
|
||||
parent.layer.close(index);
|
||||
window.parent.layui.table.reload('leaveList');
|
||||
window.top.layer.msg(d.msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
}else{
|
||||
layer.msg(d.msg,{icon:5});
|
||||
layui.use(['form', 'layer'], function () {
|
||||
$ = layui.jquery;
|
||||
var form = layui.form
|
||||
, layer = layui.layer
|
||||
, laydate = layui.laydate;
|
||||
var d = new Date();
|
||||
var day = d.getFullYear() + "-" + (parseInt(d.getMonth()) + 1) + '-' + d.getDate();
|
||||
console.log(day);
|
||||
var $ = layui.$, active = {
|
||||
close: function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
}
|
||||
},error:function(){
|
||||
layer.alert("请求失败", {icon: 6},function () {
|
||||
}
|
||||
$('.layui-form-item .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
var a = laydate.render({
|
||||
elem: '#beginTime',
|
||||
min: day,
|
||||
done: function (value, date, endDate) {
|
||||
b.config.min = {
|
||||
year: date.year,
|
||||
month: date.month - 1,
|
||||
date: date.date,
|
||||
hours: date.hours,
|
||||
minutes: date.minutes,
|
||||
seconds: date.seconds
|
||||
}
|
||||
}
|
||||
});
|
||||
var b = laydate.render({
|
||||
elem: '#endTime',
|
||||
min: '2018-01-20'
|
||||
});
|
||||
|
||||
//自定义验证规则
|
||||
form.verify({
|
||||
beginTime: function (value) {
|
||||
if (value.trim() == "") {
|
||||
return "开始时间不能为空";
|
||||
}
|
||||
},
|
||||
endTime: function (value) {
|
||||
if (value.trim() == "") {
|
||||
return "结束时间不能为空";
|
||||
}
|
||||
},
|
||||
reason: function (value) {
|
||||
if (value.trim() == "") {
|
||||
return "请填写请假原因";
|
||||
}
|
||||
}
|
||||
});
|
||||
form.on('submit(close)', function (data) {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
})
|
||||
//监听提交
|
||||
form.on('submit(add)', function (data) {
|
||||
layerAjax('addLeave', data.field, 'leaveList');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
|
@ -78,10 +78,14 @@
|
|||
layui.use('table', function () {
|
||||
var table = layui.table;
|
||||
//方法级渲染
|
||||
var arr=[];
|
||||
if(${leaveDetail}){
|
||||
arr=${leaveDetail};
|
||||
}
|
||||
table.render({
|
||||
id: 'leaveDetail',
|
||||
elem: '#leaveDetail'
|
||||
, data: ${leaveDetail}
|
||||
, data:arr
|
||||
, cols: [[
|
||||
{field: 'taskId', title: '任务编码', width: '20%'}
|
||||
,{field: 'opName', title: '审批人', width: '20%'}
|
||||
|
|
|
@ -7,234 +7,214 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>请假流程示例</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport"
|
||||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/lenos/main.css"/>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
<meta charset="UTF-8">
|
||||
<title>请假流程示例</title>
|
||||
<#include "/system/base/header.ftl">
|
||||
<script src="${re.contextPath}/plugin/activiti.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="lenos-search">
|
||||
<div class="select">
|
||||
开始时间:
|
||||
<div class="layui-inline">
|
||||
<input class="layui-input" placeholder="yyyy-MM-dd" height="20px" id="beginTime" autocomplete="off">
|
||||
<div class="select">
|
||||
开始时间:
|
||||
<span class="layui-inline">
|
||||
<input class="layui-input" placeholder="yyyy-MM-dd" height="20px" id="beginTime" autocomplete="off">
|
||||
</span>
|
||||
结束时间:
|
||||
<span class="layui-inline">
|
||||
<input class="layui-input" placeholder="yyyy-MM-dd" height="20px" id="endTime" autocomplete="off">
|
||||
</span>
|
||||
</div>
|
||||
结束时间:
|
||||
<div class="layui-inline">
|
||||
<input class="layui-input" placeholder="yyyy-MM-dd" height="20px" id="endTime" autocomplete="off">
|
||||
<div class="len-form-item">
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn layui-btn-sm" data-type="select">查询</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn layui-btn-sm" data-type="reload">重置</button>
|
||||
</div>
|
||||
<button class="select-on layui-btn layui-btn-sm" data-type="select"><i class="layui-icon"></i>
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-sm icon-position-button" id="refresh" style="float: right;"
|
||||
data-type="reload">
|
||||
<i class="layui-icon">ဂ</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-btn-group">
|
||||
<button class="layui-btn layui-btn-normal" data-type="createLeave">
|
||||
<button class="layui-btn layui-btn-normal layui-btn-sm" data-type="createLeave">
|
||||
<i class="layui-icon"></i>新建请假
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="leaveList" class="layui-hide" lay-filter="leave"></table>
|
||||
<table id="leaveList" width="100%" lay-filter="leave"></table>
|
||||
<script type="text/html" id="toolBar">
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="getProcImage"><i class="layui-icon"></i>查看流程图</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="leaveDetail"><i class="layui-icon"></i>查看详情</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="getProcImage"><i class="layui-icon"></i>查看流程图</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="leaveDetail"><i
|
||||
class="layui-icon"></i>查看详情</a>
|
||||
</script>
|
||||
<script type="text/html" id="status">
|
||||
{{#if(typeof(d.taskName)!='undefined'){}}
|
||||
{{#if(typeof(d.taskName)!='undefined'){}}
|
||||
<div>${d.taskName}</div>
|
||||
{{# }else{}}
|
||||
结束
|
||||
{{# }}}
|
||||
{{# }else{}}
|
||||
结束
|
||||
{{# }}}
|
||||
</script>
|
||||
<script>
|
||||
layui.laytpl.toDateString = function(d, format){
|
||||
var date = new Date(d || new Date())
|
||||
,ymd = [
|
||||
this.digit(date.getFullYear(), 4)
|
||||
,this.digit(date.getMonth() + 1)
|
||||
,this.digit(date.getDate())
|
||||
]
|
||||
,hms = [
|
||||
this.digit(date.getHours())
|
||||
,this.digit(date.getMinutes())
|
||||
,this.digit(date.getSeconds())
|
||||
];
|
||||
layui.laytpl.toDateString = function (d, format) {
|
||||
var date = new Date(d || new Date())
|
||||
, ymd = [
|
||||
this.digit(date.getFullYear(), 4)
|
||||
, this.digit(date.getMonth() + 1)
|
||||
, this.digit(date.getDate())
|
||||
]
|
||||
, hms = [
|
||||
this.digit(date.getHours())
|
||||
, this.digit(date.getMinutes())
|
||||
, this.digit(date.getSeconds())
|
||||
];
|
||||
|
||||
format = format || 'yyyy-MM-dd HH:mm:ss';
|
||||
format = format || 'yyyy-MM-dd HH:mm:ss';
|
||||
|
||||
return format.replace(/yyyy/g, ymd[0])
|
||||
.replace(/MM/g, ymd[1])
|
||||
.replace(/dd/g, ymd[2])
|
||||
.replace(/HH/g, hms[0])
|
||||
.replace(/mm/g, hms[1])
|
||||
.replace(/ss/g, hms[2]);
|
||||
};
|
||||
|
||||
//数字前置补零
|
||||
layui.laytpl.digit = function(num, length, end){
|
||||
var str = '';
|
||||
num = String(num);
|
||||
length = length || 2;
|
||||
for(var i = num.length; i < length; i++){
|
||||
str += '0';
|
||||
}
|
||||
return num < Math.pow(10, length) ? str + (num|0) : num;
|
||||
};
|
||||
|
||||
document.onkeydown = function (e) { // 回车提交表单
|
||||
var theEvent = window.event || e;
|
||||
var code = theEvent.keyCode || theEvent.which;
|
||||
if (code == 13) {
|
||||
$(".select .select-on").click();
|
||||
}
|
||||
}
|
||||
|
||||
layui.use('table', function () {
|
||||
var table = layui.table,laydate = layui.laydate;
|
||||
var a = laydate.render({
|
||||
elem: '#beginTime',
|
||||
done: function(value, date, endDate) {
|
||||
b.config.min = {
|
||||
year: date.year,
|
||||
month: date.month - 1,
|
||||
date: date.date,
|
||||
hours: date.hours,
|
||||
minutes: date.minutes,
|
||||
seconds: date.seconds
|
||||
}
|
||||
}
|
||||
});
|
||||
var b = laydate.render({
|
||||
elem: '#endTime'
|
||||
});
|
||||
//方法级渲染
|
||||
table.render({
|
||||
id: 'leaveList',
|
||||
elem: '#leaveList'
|
||||
, url: 'showLeaveList'
|
||||
, cols: [[
|
||||
{checkbox: true, fixed: true, width: '5%'}
|
||||
, {field: 'userName', title: '申请人', width: '10%', sort: true}
|
||||
, {field: 'beginTime', title: '开始时间', width: '10%', sort: true,templet: '<div>{{ layui.laytpl.toDateString(d.beginTime,"yyyy-MM-dd") }}</div>'}
|
||||
, {field: 'endTime', title: '结束时间', width: '10%', sort: true,templet: '<div>{{ layui.laytpl.toDateString(d.endTime,"yyyy-MM-dd") }}</div>'}
|
||||
/* , {field: 'text', title: '审批', width: '10%', sort: true,templet: '#titleTpl'}*/
|
||||
, {field: 'taskName', title: '状态', width: '10%',templet:'#status'}
|
||||
, {field: 'reason', title: '原因', width: '10%', sort: true}
|
||||
, {field: 'days', title: '天数', width: '10%', sort: true}
|
||||
, {field: 'processInstanceId', title: '流程定义id', width: '10%', sort: true}
|
||||
, {field: 'text', title: '操作', width: '20%', toolbar:'#toolBar'}
|
||||
|
||||
]]
|
||||
, page: true
|
||||
, height: 'full-84'
|
||||
});
|
||||
|
||||
var $ = layui.$, active = {
|
||||
select: function () {
|
||||
var beginTime = $('#beginTime').val();
|
||||
var endTime = $('#endTime').val();
|
||||
table.reload('leaveList', {
|
||||
where: {
|
||||
beginTime: beginTime,
|
||||
endTime:endTime
|
||||
}
|
||||
});
|
||||
}
|
||||
,createLeave:function(){
|
||||
add("申请请假",'addLeave',700,450);
|
||||
}
|
||||
,reload:function(){
|
||||
$('#beginTime').val('');
|
||||
$('#endTime').val('');
|
||||
table.reload('leaveList', {
|
||||
where: {
|
||||
beginTime: null,
|
||||
endTime: null
|
||||
}
|
||||
});
|
||||
}
|
||||
return format.replace(/yyyy/g, ymd[0])
|
||||
.replace(/MM/g, ymd[1])
|
||||
.replace(/dd/g, ymd[2])
|
||||
.replace(/HH/g, hms[0])
|
||||
.replace(/mm/g, hms[1])
|
||||
.replace(/ss/g, hms[2]);
|
||||
};
|
||||
//监听工具条
|
||||
table.on('tool(leave)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'start') {
|
||||
start(data.key);
|
||||
}else if(obj.event === 'getProcImage'){
|
||||
// var url='getProcImage?processInstanceId='+data.processInstanceId+'';
|
||||
layer.open({
|
||||
id: 'leave-image',
|
||||
type: 2,
|
||||
area: [ '880px', '400px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '流程图',
|
||||
content: '/leave/shinePics/' + data.processInstanceId
|
||||
|
||||
//数字前置补零
|
||||
layui.laytpl.digit = function (num, length, end) {
|
||||
var str = '';
|
||||
num = String(num);
|
||||
length = length || 2;
|
||||
for (var i = num.length; i < length; i++) {
|
||||
str += '0';
|
||||
}
|
||||
return num < Math.pow(10, length) ? str + (num | 0) : num;
|
||||
};
|
||||
|
||||
document.onkeydown = function (e) { // 回车提交表单
|
||||
var theEvent = window.event || e;
|
||||
var code = theEvent.keyCode || theEvent.which;
|
||||
if (code == 13) {
|
||||
$(".select .select-on").click();
|
||||
}
|
||||
}
|
||||
|
||||
layui.use('table', function () {
|
||||
table = layui.table, laydate = layui.laydate;
|
||||
var a = laydate.render({
|
||||
elem: '#beginTime',
|
||||
done: function (value, date, endDate) {
|
||||
b.config.min = {
|
||||
year: date.year,
|
||||
month: date.month - 1,
|
||||
date: date.date,
|
||||
hours: date.hours,
|
||||
minutes: date.minutes,
|
||||
seconds: date.seconds
|
||||
}
|
||||
}
|
||||
});
|
||||
}else if(obj.event==='leaveDetail'){
|
||||
layer.open({
|
||||
id: 'leave-detail',
|
||||
type: 2,
|
||||
area: [ '880px', '400px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '审核详情',
|
||||
content: "leaveDetail?processId="+data.processInstanceId
|
||||
var b = laydate.render({
|
||||
elem: '#endTime'
|
||||
});
|
||||
}
|
||||
//方法级渲染
|
||||
table.render({
|
||||
id: 'leaveList',
|
||||
elem: '#leaveList'
|
||||
, url: 'showLeaveList'
|
||||
, parseData: function (res) {
|
||||
return {
|
||||
"code": res.code,
|
||||
"msg": res.msg,
|
||||
"count": res.count,
|
||||
"data": res.data
|
||||
};
|
||||
}
|
||||
, cols: [[
|
||||
{checkbox: true, fixed: true, width: '5%'}
|
||||
, {field: 'userName', title: '申请人', width: '10%', sort: true}
|
||||
, {
|
||||
field: 'beginTime',
|
||||
title: '开始时间',
|
||||
width: '10%',
|
||||
sort: true,
|
||||
templet: '<div>{{ layui.laytpl.toDateString(d.beginTime,"yyyy-MM-dd") }}</div>'
|
||||
}
|
||||
, {
|
||||
field: 'endTime',
|
||||
title: '结束时间',
|
||||
width: '10%',
|
||||
sort: true,
|
||||
templet: '<div>{{ layui.laytpl.toDateString(d.endTime,"yyyy-MM-dd") }}</div>'
|
||||
}
|
||||
, {field: 'taskName', title: '状态', width: '10%', templet: '#status'}
|
||||
, {field: 'reason', title: '原因', width: '10%', sort: true}
|
||||
, {field: 'days', title: '天数', width: '10%', sort: true}
|
||||
, {field: 'processInstanceId', title: '流程定义id', width: '10%', sort: true}
|
||||
, {field: 'text', title: '操作', width: '20%', toolbar: '#toolBar'}
|
||||
|
||||
]]
|
||||
, page: true
|
||||
, height: 'full-100'
|
||||
});
|
||||
|
||||
var $ = layui.$, active = {
|
||||
select: function () {
|
||||
var beginTime = $('#beginTime').val();
|
||||
var endTime = $('#endTime').val();
|
||||
table.reload('leaveList', {
|
||||
where: {
|
||||
beginTime: beginTime,
|
||||
endTime: endTime
|
||||
}
|
||||
});
|
||||
}
|
||||
, createLeave: function () {
|
||||
add("申请请假", '/leave/addLeave', 700, 450);
|
||||
}
|
||||
, reload: function () {
|
||||
$('#beginTime').val('');
|
||||
$('#endTime').val('');
|
||||
table.reload('leaveList', {
|
||||
where: {
|
||||
beginTime: null,
|
||||
endTime: null
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//监听工具条
|
||||
table.on('tool(leave)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'start') {
|
||||
start(data.key);
|
||||
} else if (obj.event === 'getProcImage') {
|
||||
activiti.img(data.processInstanceId);
|
||||
} else if (obj.event === 'leaveDetail') {
|
||||
window.top.layer.open({
|
||||
id: 'leave-detail',
|
||||
type: 2,
|
||||
area: ['880px', '400px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '审核详情',
|
||||
content: "/leave/leaveDetail?processId=" + data.processInstanceId
|
||||
});
|
||||
}
|
||||
});
|
||||
eleClick(active, '.len-form-item .layui-btn,.layui-col-md12 .layui-btn');
|
||||
});
|
||||
|
||||
eleClick(active,'.layui-col-md12 .layui-btn');
|
||||
eleClick(active,'.select .layui-btn');
|
||||
|
||||
});
|
||||
|
||||
function add(title, url, w, h) {
|
||||
if (title == null || title == '') {
|
||||
title = false;
|
||||
function add(title, url, w, h) {
|
||||
window.top.layer.open({
|
||||
id: 'leave-add',
|
||||
type: 2,
|
||||
area: [w + 'px', h + 'px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: title,
|
||||
content: url
|
||||
});
|
||||
}
|
||||
;
|
||||
if (url == null || url == '') {
|
||||
url = "404.html";
|
||||
}
|
||||
;
|
||||
if (w == null || w == '') {
|
||||
w = ($(window).width() * 0.9);
|
||||
}
|
||||
;
|
||||
if (h == null || h == '') {
|
||||
h = ($(window).height() - 50);
|
||||
}
|
||||
;
|
||||
layer.open({
|
||||
id: 'leave-add',
|
||||
type: 2,
|
||||
area: [w + 'px', h + 'px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: title,
|
||||
content: url
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
<#--Created by IntelliJ IDEA.
|
||||
User: zxm
|
||||
Date: 2017/12/20
|
||||
Time: 10:00
|
||||
To change this template use File | Settings | File Templates.-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>流程图</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/ztree/css/metroStyle/metroStyle.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="x-body">
|
||||
<form class="layui-form layui-form-pane" style="margin-left: 20px;">
|
||||
<div id="image" style="width:100%;height:100%;overflow: auto;">
|
||||
<div class="layui-form-item">
|
||||
<image id="showImages1" style="display: none;"></image>
|
||||
<image id="showImages2"></image>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
var countNum = 0;
|
||||
// $('#image').css('height',document.body.offsetHeight);
|
||||
layui.use(['form','layer'], function(){
|
||||
$ = layui.jquery;
|
||||
//执行AJAX 获取数据
|
||||
$.getJSON('${re.contextPath}/leave/getShineProcImage?processInstanceId=${processInstanceId}', function(json){
|
||||
var result = json.images;
|
||||
var imgObj1 = document.getElementById("showImages1")
|
||||
imgObj1.src = "data:image/png;base64,"+result[0] ;
|
||||
var imgObj2 = document.getElementById("showImages2")
|
||||
imgObj2.src = "data:image/png;base64,"+result[1] ;
|
||||
// $("#showImages1").show();
|
||||
window.setInterval(function () {
|
||||
//获取网页中id=myImg的图片对象元素
|
||||
// var imgObj = document.getElementById("showImages")
|
||||
// imgObj.src = "data:image/png;base64,"+result[countNum] ;
|
||||
if(countNum==0)
|
||||
{
|
||||
$("#showImages1").show();
|
||||
$("#showImages2").hide();
|
||||
}else
|
||||
{
|
||||
$("#showImages1").hide();
|
||||
$("#showImages2").show();
|
||||
}
|
||||
countNum++;
|
||||
if (countNum==2)
|
||||
{
|
||||
countNum = 0;//回到了原点
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -9,39 +9,28 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>我的任务</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport"
|
||||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/lenos/main.css">
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
<#include "/system/base/header.ftl">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="lenos-search">
|
||||
<div class="select">
|
||||
操作用户:
|
||||
<div class="layui-inline">
|
||||
<span class="layui-inline">
|
||||
<input class="layui-input" height="20px" id="userName" autocomplete="off">
|
||||
</div>
|
||||
</span>
|
||||
操作类型:
|
||||
<div class="layui-inline">
|
||||
<span class="layui-inline">
|
||||
<input class="layui-input" height="20px" id="type" autocomplete="off">
|
||||
</div>
|
||||
<button class="select-on layui-btn layui-btn-sm" data-type="select"><i class="layui-icon"></i>
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-sm icon-position-button" id="refresh" style="float: right;"
|
||||
data-type="reload">
|
||||
<i class="layui-icon">ဂ</i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
<div class="len-form-item">
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn layui-btn-sm" data-type="select">查询</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn layui-btn-sm" data-type="reload">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="taskList" class="layui-hide" lay-filter="task"></table>
|
||||
<table id="taskList" width="100%" lay-filter="task"></table>
|
||||
<script type="text/html" id="toolBar">
|
||||
{{# if(d.flag){ }}
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="update"><i class="layui-icon"></i>编辑</a>
|
||||
|
@ -94,12 +83,20 @@
|
|||
}
|
||||
|
||||
layui.use('table', function () {
|
||||
var table = layui.table;
|
||||
table = layui.table;
|
||||
//方法级渲染
|
||||
table.render({
|
||||
id: 'taskList',
|
||||
elem: '#taskList'
|
||||
, url: 'showTaskList'
|
||||
,parseData: function(res){
|
||||
return {
|
||||
"code": res.code,
|
||||
"msg": res.msg,
|
||||
"count": res.count,
|
||||
"data": res.data
|
||||
};
|
||||
}
|
||||
, cols: [[
|
||||
{checkbox: true, fixed: true, width: '5%'}
|
||||
, {field: 'id', title: '任务编码', width: '10%', sort: true}
|
||||
|
@ -154,11 +151,11 @@
|
|||
table.on('tool(task)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'handle') {
|
||||
popup('办理','agent/'+data.id,700,500,'task-agent');
|
||||
popup('办理','/leave/agent/'+data.id,700,500,'task-agent');
|
||||
}else if(obj.event === 'update'){
|
||||
popup('编辑','${re.contextPath}/leave/updateLeave/'+data.id,700,500,'task-update');
|
||||
}else if(obj.event==='leaveDetail'){
|
||||
layer.open({
|
||||
window.top.layer.open({
|
||||
id: 'leave-detail',
|
||||
type: 2,
|
||||
area: [ '880px', '400px'],
|
||||
|
@ -167,43 +164,17 @@
|
|||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '审核详情',
|
||||
content: "leaveDetail?processId="+data.processInstanceId
|
||||
content: "/leave/leaveDetail?processId="+data.processInstanceId
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('.select .layui-btn').on('click', function () {
|
||||
$('.len-form-item .layui-btn,.select .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
});
|
||||
/**批量删除id*/
|
||||
/*function del(ids) {
|
||||
$.ajax({
|
||||
url: "del",
|
||||
type: "post",
|
||||
data: {ids: ids},
|
||||
dataType: "json", traditional: true,
|
||||
success: function (data) {
|
||||
layer.msg(data.msg, {icon: 6});
|
||||
layui.table.reload('actList');
|
||||
}
|
||||
});
|
||||
}*/
|
||||
/*function start(id) {
|
||||
$.ajax({
|
||||
url: "start",
|
||||
type: "post",
|
||||
data: {key: id},
|
||||
dataType: "json", traditional: true,
|
||||
success: function (data) {
|
||||
layer.msg(data.msg, {icon: 6});
|
||||
layui.table.reload('actList');
|
||||
}
|
||||
});
|
||||
}*/
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
|
@ -7,208 +7,163 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>流程部署</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport"
|
||||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/lenos/main.css">
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
<meta charset="UTF-8">
|
||||
<title>流程部署</title>
|
||||
<#include "/system/base/header.ftl">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="lenos-search">
|
||||
<div class="select">
|
||||
部署id:
|
||||
<div class="layui-inline">
|
||||
<div class="select">
|
||||
部署id:
|
||||
<span class="layui-inline">
|
||||
<input class="layui-input" height="20px" id="deploymentId" autocomplete="off">
|
||||
</div>
|
||||
流程名称:
|
||||
<div class="layui-inline">
|
||||
</span>
|
||||
流程名称:
|
||||
<span class="layui-inline">
|
||||
<input class="layui-input" height="20px" id="name" autocomplete="off">
|
||||
</span>
|
||||
</div>
|
||||
<div class="len-form-item">
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn layui-btn-sm" data-type="select">查询</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn layui-btn-sm" data-type="reload">重置</button>
|
||||
</div>
|
||||
<button class="select-on layui-btn layui-btn-sm" data-type="select"><i class="layui-icon"></i>
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-sm icon-position-button" id="refresh" style="float: right;"
|
||||
data-type="reload">
|
||||
<i class="layui-icon">ဂ</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-btn-group">
|
||||
<@shiro.hasPermission name="control:del">
|
||||
<#-- <button class="layui-btn layui-btn-normal" id="processGroup" data-type="assignee">
|
||||
<i class="layui-icon"></i>节点处理人设置
|
||||
</button>-->
|
||||
</@shiro.hasPermission>
|
||||
<@shiro.hasPermission name="control:del">
|
||||
</@shiro.hasPermission>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="actList" class="layui-hide" lay-filter="act"></table>
|
||||
<table id="actList" width="100%" lay-filter="act"></table>
|
||||
<script type="text/html" id="toolBar">
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon"></i>删除</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon"></i>删除</a>
|
||||
</script>
|
||||
<script>
|
||||
layui.laytpl.toDateString = function(d, format){
|
||||
var date = new Date(d || new Date())
|
||||
,ymd = [
|
||||
this.digit(date.getFullYear(), 4)
|
||||
,this.digit(date.getMonth() + 1)
|
||||
,this.digit(date.getDate())
|
||||
]
|
||||
,hms = [
|
||||
this.digit(date.getHours())
|
||||
,this.digit(date.getMinutes())
|
||||
,this.digit(date.getSeconds())
|
||||
];
|
||||
layui.laytpl.toDateString = function (d, format) {
|
||||
var date = new Date(d || new Date())
|
||||
, ymd = [
|
||||
this.digit(date.getFullYear(), 4)
|
||||
, this.digit(date.getMonth() + 1)
|
||||
, this.digit(date.getDate())
|
||||
]
|
||||
, hms = [
|
||||
this.digit(date.getHours())
|
||||
, this.digit(date.getMinutes())
|
||||
, this.digit(date.getSeconds())
|
||||
];
|
||||
|
||||
format = format || 'yyyy-MM-dd HH:mm:ss';
|
||||
format = format || 'yyyy-MM-dd HH:mm:ss';
|
||||
|
||||
return format.replace(/yyyy/g, ymd[0])
|
||||
.replace(/MM/g, ymd[1])
|
||||
.replace(/dd/g, ymd[2])
|
||||
.replace(/HH/g, hms[0])
|
||||
.replace(/mm/g, hms[1])
|
||||
.replace(/ss/g, hms[2]);
|
||||
};
|
||||
|
||||
//数字前置补零
|
||||
layui.laytpl.digit = function(num, length, end){
|
||||
var str = '';
|
||||
num = String(num);
|
||||
length = length || 2;
|
||||
for(var i = num.length; i < length; i++){
|
||||
str += '0';
|
||||
}
|
||||
return num < Math.pow(10, length) ? str + (num|0) : num;
|
||||
};
|
||||
|
||||
document.onkeydown = function (e) { // 回车提交表单
|
||||
var theEvent = window.event || e;
|
||||
var code = theEvent.keyCode || theEvent.which;
|
||||
if (code == 13) {
|
||||
$(".select .select-on").click();
|
||||
}
|
||||
}
|
||||
|
||||
layui.use('table', function () {
|
||||
var table = layui.table;
|
||||
//方法级渲染
|
||||
table.render({
|
||||
id: 'actList',
|
||||
elem: '#actList'
|
||||
, url: 'showAct'
|
||||
, cols: [[
|
||||
{checkbox: true, fixed: true, width: '5%'}
|
||||
, {field: 'id', title: '编号', width: '15%', sort: true}
|
||||
, {field: 'name', title: '流程名称', width: '10%', sort: true}
|
||||
, {field: 'key', title: 'key', width: '12%', sort: true}
|
||||
, {field: 'deploymentId', title: '部署id', width: '5%', sort: true}
|
||||
, {field: 'diagramResourceName', title: '流程图资源', width: '15%', sort: true}
|
||||
, {field: 'category', title: '版本', width: '15%', sort: true}
|
||||
, {field: 'resourceName', title: '资源名称', width: '10%', sort: true}
|
||||
, {field: 'text', title: '操作', width: '10%', toolbar:'#toolBar'}
|
||||
|
||||
]]
|
||||
, page: true
|
||||
, height: 'full-85'
|
||||
});
|
||||
|
||||
var $ = layui.$, active = {
|
||||
select: function () {
|
||||
var deploymentId = $('#deploymentId').val();
|
||||
var name = $('#name').val();
|
||||
table.reload('actList', {
|
||||
where: {
|
||||
deploymentId: deploymentId,
|
||||
name: name
|
||||
}
|
||||
});
|
||||
}
|
||||
/*,assignee:function(){
|
||||
var checkStatus = table.checkStatus('actList')
|
||||
, data = checkStatus.data;
|
||||
if (data.length !=1) {
|
||||
layer.msg('请选择一个流程', {icon: 5});
|
||||
return false;
|
||||
}
|
||||
assignee(data[0].id,data[0].deploymentId);
|
||||
}*/
|
||||
,reload:function(){
|
||||
$('#deploymentId').val('');
|
||||
$('#name').val('');
|
||||
table.reload('actList', {
|
||||
where: {
|
||||
deploymentId: null,
|
||||
name: null
|
||||
}
|
||||
});
|
||||
}
|
||||
return format.replace(/yyyy/g, ymd[0])
|
||||
.replace(/MM/g, ymd[1])
|
||||
.replace(/dd/g, ymd[2])
|
||||
.replace(/HH/g, hms[0])
|
||||
.replace(/mm/g, hms[1])
|
||||
.replace(/ss/g, hms[2]);
|
||||
};
|
||||
//监听工具条
|
||||
table.on('tool(act)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('将会删除正在执行的流程,确定删除?', {
|
||||
btn: ['确定','取消'] //按钮
|
||||
}, function(){
|
||||
del(data.deploymentId);
|
||||
}, function(){
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('.layui-col-md12 .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
$('.select .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
});
|
||||
function del(id) {
|
||||
$.ajax({
|
||||
url: "delDeploy",
|
||||
type: "post",
|
||||
data: {id: id},
|
||||
dataType: "json", traditional: true,
|
||||
success: function (d) {
|
||||
if(d.flag){
|
||||
layer.msg(d.msg, {icon: 6});
|
||||
layui.table.reload('actList');
|
||||
}else{
|
||||
layer.msg(d.msg, {icon: 5});
|
||||
//数字前置补零
|
||||
layui.laytpl.digit = function (num, length, end) {
|
||||
var str = '';
|
||||
num = String(num);
|
||||
length = length || 2;
|
||||
for (var i = num.length; i < length; i++) {
|
||||
str += '0';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 流程绑定节点
|
||||
* @param id
|
||||
*/
|
||||
/* function assignee(id,deploymentId){
|
||||
var index =
|
||||
layer.open({
|
||||
id: 'assignee',
|
||||
type: 2,
|
||||
area: ['600px', '350px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '设置流程节点',
|
||||
content: 'goAssignee/'+deploymentId
|
||||
return num < Math.pow(10, length) ? str + (num | 0) : num;
|
||||
};
|
||||
|
||||
document.onkeydown = function (e) { // 回车提交表单
|
||||
var theEvent = window.event || e;
|
||||
var code = theEvent.keyCode || theEvent.which;
|
||||
if (code == 13) {
|
||||
$(".select .select-on").click();
|
||||
}
|
||||
}
|
||||
|
||||
layui.use('table', function () {
|
||||
table = layui.table;
|
||||
//方法级渲染
|
||||
table.render({
|
||||
id: 'actList',
|
||||
elem: '#actList'
|
||||
, url: 'showAct'
|
||||
, cols: [[
|
||||
{checkbox: true, fixed: true, width: '5%'}
|
||||
, {field: 'id', title: '编号', width: '15%', sort: true}
|
||||
, {field: 'name', title: '流程名称', width: '10%', sort: true}
|
||||
, {field: 'key', title: 'key', width: '12%', sort: true}
|
||||
, {field: 'deploymentId', title: '部署id', width: '5%', sort: true}
|
||||
, {field: 'diagramResourceName', title: '流程图资源', width: '15%', sort: true}
|
||||
, {field: 'category', title: '版本', width: '15%', sort: true}
|
||||
, {field: 'resourceName', title: '资源名称', width: '10%', sort: true}
|
||||
, {field: 'text', title: '操作', width: '10%', toolbar: '#toolBar'}
|
||||
|
||||
]]
|
||||
, page: true
|
||||
, height: 'full-100'
|
||||
});
|
||||
layer.full(index);
|
||||
}*/
|
||||
|
||||
var $ = layui.$, active = {
|
||||
select: function () {
|
||||
var deploymentId = $('#deploymentId').val();
|
||||
var name = $('#name').val();
|
||||
table.reload('actList', {
|
||||
where: {
|
||||
deploymentId: deploymentId,
|
||||
name: name
|
||||
}
|
||||
});
|
||||
}
|
||||
, reload: function () {
|
||||
$('#deploymentId').val('');
|
||||
$('#name').val('');
|
||||
table.reload('actList', {
|
||||
where: {
|
||||
deploymentId: null,
|
||||
name: null
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//监听工具条
|
||||
table.on('tool(act)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('将会删除正在执行的流程,确定删除?', {
|
||||
btn: ['确定', '取消'] //按钮
|
||||
}, function () {
|
||||
del(data.deploymentId);
|
||||
}, function () {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('.len-form-item .layui-btn,.layui-col-md12 .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function del(id) {
|
||||
$.ajax({
|
||||
url: "delDeploy",
|
||||
type: "post",
|
||||
data: {id: id},
|
||||
dataType: "json", traditional: true,
|
||||
success: function (d) {
|
||||
if (d.flag) {
|
||||
layer.msg(d.msg, {icon: 6});
|
||||
layui.table.reload('actList');
|
||||
} else {
|
||||
layer.msg(d.msg, {icon: 5});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -7,242 +7,234 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>模型列表</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport"
|
||||
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="${re.contextPath}/plugin/lenos/main.css"/>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js" charset="utf-8"></script>
|
||||
<meta charset="UTF-8">
|
||||
<title>模型列表</title>
|
||||
<#include "/system/base/header.ftl">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="lenos-search">
|
||||
<div class="select">
|
||||
模型名称:
|
||||
<div class="layui-inline">
|
||||
<div class="select">
|
||||
模型名称:
|
||||
<span class="layui-inline">
|
||||
<input class="layui-input" height="20px" id="name" autocomplete="off">
|
||||
</div>
|
||||
key:
|
||||
<div class="layui-inline">
|
||||
</span>
|
||||
key:
|
||||
<span class="layui-inline">
|
||||
<input class="layui-input" height="20px" id="key" autocomplete="off">
|
||||
</span>
|
||||
</div>
|
||||
<div class="len-form-item">
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn layui-btn-sm" data-type="select">查询</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn layui-btn-sm" data-type="reload">重置</button>
|
||||
</div>
|
||||
<button class="select-on layui-btn layui-btn-sm" data-type="select"><i class="layui-icon"></i>
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-sm icon-position-button" id="refresh" style="float: right;"
|
||||
data-type="reload">
|
||||
<i class="layui-icon">ဂ</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-btn-group">
|
||||
<@shiro.hasPermission name="control:del">
|
||||
<button class="layui-btn layui-btn-normal" data-type="syncdata">
|
||||
<i class="layui-icon"></i>同步数据
|
||||
<@shiro.hasPermission name="control:del">
|
||||
<button class="layui-btn layui-btn-normal layui-btn-sm" data-type="syncdata">
|
||||
<i class="layui-icon"></i>同步数据
|
||||
</button>
|
||||
</@shiro.hasPermission>
|
||||
<button class="layui-btn layui-btn-normal layui-btn-sm" id="processGroup" data-type="add">
|
||||
<i class="layui-icon"></i>新建流程
|
||||
</button>
|
||||
</@shiro.hasPermission>
|
||||
<button class="layui-btn layui-btn-normal" id="processGroup" data-type="add">
|
||||
<i class="layui-icon"></i>新建流程
|
||||
</button>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<table id="actModelList" class="layui-hide" lay-filter="act"></table>
|
||||
<table id="actModelList" width="100%" lay-filter="act"></table>
|
||||
<script type="text/html" id="toolBar">
|
||||
<shiro.hasPermission name="control:del">
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="update"><i class="layui-icon"></i>编辑</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="open"><i class="layui-icon"></i>发布</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon"></i>删除</a>
|
||||
</shiro.hasPermission>
|
||||
<shiro.hasPermission name="control:del">
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="update"><i class="layui-icon"></i>编辑</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="open"><i class="layui-icon"></i>发布</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon"></i>删除</a>
|
||||
</shiro.hasPermission>
|
||||
</script>
|
||||
<script>
|
||||
layui.laytpl.toDateString = function(d, format){
|
||||
var date = new Date(d || new Date())
|
||||
,ymd = [
|
||||
this.digit(date.getFullYear(), 4)
|
||||
,this.digit(date.getMonth() + 1)
|
||||
,this.digit(date.getDate())
|
||||
]
|
||||
,hms = [
|
||||
this.digit(date.getHours())
|
||||
,this.digit(date.getMinutes())
|
||||
,this.digit(date.getSeconds())
|
||||
];
|
||||
layui.laytpl.toDateString = function (d, format) {
|
||||
var date = new Date(d || new Date())
|
||||
, ymd = [
|
||||
this.digit(date.getFullYear(), 4)
|
||||
, this.digit(date.getMonth() + 1)
|
||||
, this.digit(date.getDate())
|
||||
]
|
||||
, hms = [
|
||||
this.digit(date.getHours())
|
||||
, this.digit(date.getMinutes())
|
||||
, this.digit(date.getSeconds())
|
||||
];
|
||||
|
||||
format = format || 'yyyy-MM-dd HH:mm:ss';
|
||||
format = format || 'yyyy-MM-dd HH:mm:ss';
|
||||
|
||||
return format.replace(/yyyy/g, ymd[0])
|
||||
.replace(/MM/g, ymd[1])
|
||||
.replace(/dd/g, ymd[2])
|
||||
.replace(/HH/g, hms[0])
|
||||
.replace(/mm/g, hms[1])
|
||||
.replace(/ss/g, hms[2]);
|
||||
};
|
||||
$('#processGroup').on('mouseover',function(){
|
||||
layer.tips('设置流程节点的代办人/候选人/候选组,目前只开发到组', this,{time:2000});
|
||||
});
|
||||
//数字前置补零
|
||||
layui.laytpl.digit = function(num, length, end){
|
||||
var str = '';
|
||||
num = String(num);
|
||||
length = length || 2;
|
||||
for(var i = num.length; i < length; i++){
|
||||
str += '0';
|
||||
}
|
||||
return num < Math.pow(10, length) ? str + (num|0) : num;
|
||||
};
|
||||
|
||||
document.onkeydown = function (e) { // 回车提交表单
|
||||
var theEvent = window.event || e;
|
||||
var code = theEvent.keyCode || theEvent.which;
|
||||
if (code == 13) {
|
||||
$(".select .select-on").click();
|
||||
}
|
||||
}
|
||||
|
||||
layui.use('table', function () {
|
||||
var table = layui.table;
|
||||
//方法级渲染
|
||||
table.render({
|
||||
id: 'actModelList',
|
||||
elem: '#actModelList'
|
||||
, url: 'showAm'
|
||||
, cols: [[
|
||||
{checkbox: true, fixed: true, width: '5%'}
|
||||
, {field: 'id', title: '编号', width: '10%', sort: true}
|
||||
, {field: 'name', title: '流程名称', width: '10%', sort: true}
|
||||
, {field: 'key', title: 'key', width: '10%', sort: true}
|
||||
, {field: 'version', title: '版本', width: '10%', sort: true}
|
||||
, {field: 'createTime', title: '创建时间', width: '20%',templet: '<div>{{ layui.laytpl.toDateString(d.createTime,"yyyy-MM-dd HH:mm:ss") }}</div>'}
|
||||
, {field: 'text', title: '操作', width: '20%', toolbar:'#toolBar'}
|
||||
|
||||
]]
|
||||
, page: true
|
||||
, height: 'full-85'
|
||||
});
|
||||
|
||||
var $ = layui.$, active = {
|
||||
select: function () {
|
||||
var name = $('#name').val();
|
||||
var key = $('#key').val();
|
||||
table.reload('actModelList', {
|
||||
where: {
|
||||
name: name,
|
||||
key: key
|
||||
}
|
||||
});
|
||||
},
|
||||
syncdata:function () {
|
||||
syncdata();
|
||||
}
|
||||
,reload:function(){
|
||||
$('#name').val('');
|
||||
$('#key').val('');
|
||||
table.reload('actModelList', {
|
||||
where: {
|
||||
name: null,
|
||||
key: null
|
||||
}
|
||||
});
|
||||
},add:function(){
|
||||
var index =layer.open({
|
||||
id: 'act-add',
|
||||
type: 2,
|
||||
area: ['600px','350px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '添加流程',
|
||||
content: 'goActiviti'
|
||||
});
|
||||
layer.full(index);
|
||||
}
|
||||
return format.replace(/yyyy/g, ymd[0])
|
||||
.replace(/MM/g, ymd[1])
|
||||
.replace(/dd/g, ymd[2])
|
||||
.replace(/HH/g, hms[0])
|
||||
.replace(/mm/g, hms[1])
|
||||
.replace(/ss/g, hms[2]);
|
||||
};
|
||||
//监听工具条
|
||||
table.on('tool(act)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'open') {
|
||||
open(data.id);
|
||||
}else if(obj.event === 'update'){
|
||||
var index =layer.open({
|
||||
id: 'act-update',
|
||||
type: 2,
|
||||
area: ['600px','350px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '编辑流程',
|
||||
content: 'actUpdate/'+data.id
|
||||
});
|
||||
layer.full(index);
|
||||
}else if(obj.event === 'del') {
|
||||
layer.confirm('确定删除[' + data.name + ']?', {
|
||||
btn: ['确定', '取消'] //按钮
|
||||
}, function () {
|
||||
del(data.id);
|
||||
}, function () {
|
||||
});
|
||||
}
|
||||
$('#processGroup').on('mouseover', function () {
|
||||
layer.tips('设置流程节点的代办人/候选人/候选组,目前只开发到组', this, {time: 2000});
|
||||
});
|
||||
|
||||
$('.layui-col-md12 .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
$('.select .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
});
|
||||
function del(id) {
|
||||
$.ajax({
|
||||
url: "delModel",
|
||||
type: "post",
|
||||
data: {id: id},
|
||||
dataType: "json", traditional: true,
|
||||
success: function (d) {
|
||||
if(d.flag){
|
||||
layer.msg(d.msg, {icon: 6});
|
||||
layui.table.reload('actModelList');
|
||||
}else{
|
||||
layer.msg(d.msg, {icon: 5});
|
||||
//数字前置补零
|
||||
layui.laytpl.digit = function (num, length, end) {
|
||||
var str = '';
|
||||
num = String(num);
|
||||
length = length || 2;
|
||||
for (var i = num.length; i < length; i++) {
|
||||
str += '0';
|
||||
}
|
||||
}
|
||||
return num < Math.pow(10, length) ? str + (num | 0) : num;
|
||||
};
|
||||
|
||||
document.onkeydown = function (e) { // 回车提交表单
|
||||
var theEvent = window.event || e;
|
||||
var code = theEvent.keyCode || theEvent.which;
|
||||
if (code == 13) {
|
||||
$(".select .select-on").click();
|
||||
}
|
||||
}
|
||||
|
||||
layui.use('table', function () {
|
||||
table = layui.table;
|
||||
//方法级渲染
|
||||
table.render({
|
||||
id: 'actModelList',
|
||||
elem: '#actModelList'
|
||||
, url: 'showAm'
|
||||
, cols: [[
|
||||
{checkbox: true, fixed: true, width: '5%'}
|
||||
, {field: 'id', title: '编号', width: '10%', sort: true}
|
||||
, {field: 'name', title: '流程名称', width: '10%', sort: true}
|
||||
, {field: 'key', title: 'key', width: '10%', sort: true}
|
||||
, {field: 'version', title: '版本', width: '10%', sort: true}
|
||||
, {
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
width: '20%',
|
||||
templet: '<div>{{ layui.laytpl.toDateString(d.createTime,"yyyy-MM-dd HH:mm:ss") }}</div>'
|
||||
}
|
||||
, {field: 'text', title: '操作', width: '20%', toolbar: '#toolBar'}
|
||||
|
||||
]]
|
||||
, page: true
|
||||
, height: 'full-100'
|
||||
});
|
||||
|
||||
var $ = layui.$, active = {
|
||||
select: function () {
|
||||
var name = $('#name').val();
|
||||
var key = $('#key').val();
|
||||
table.reload('actModelList', {
|
||||
where: {
|
||||
name: name,
|
||||
key: key
|
||||
}
|
||||
});
|
||||
},
|
||||
syncdata: function () {
|
||||
syncdata();
|
||||
}
|
||||
, reload: function () {
|
||||
$('#name').val('');
|
||||
$('#key').val('');
|
||||
table.reload('actModelList', {
|
||||
where: {
|
||||
name: null,
|
||||
key: null
|
||||
}
|
||||
});
|
||||
}, add: function () {
|
||||
var index = window.top.layer.open({
|
||||
id: 'act-add',
|
||||
type: 2,
|
||||
area: [$(window).width()+'px',$(window).height()+'px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '添加流程',
|
||||
content: '/act/goActiviti'
|
||||
});
|
||||
layer.full(index);
|
||||
}
|
||||
};
|
||||
//监听工具条
|
||||
table.on('tool(act)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'open') {
|
||||
open(data.id);
|
||||
} else if (obj.event === 'update') {
|
||||
var index = window.top.layer.open({
|
||||
id: 'act-update',
|
||||
type: 2,
|
||||
area: [$(window).width()+'px',$(window).height()+'px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '编辑流程',
|
||||
content: '/act/actUpdate/' + data.id
|
||||
});
|
||||
} else if (obj.event === 'del') {
|
||||
layer.confirm('确定删除[' + data.name + ']?', {
|
||||
btn: ['确定', '取消'] //按钮
|
||||
}, function () {
|
||||
del(data.id);
|
||||
}, function () {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('.len-form-item .layui-btn,.layui-col-md12 .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
function syncdata() {
|
||||
$.ajax({
|
||||
url: "syncdata",
|
||||
type: "post",
|
||||
dataType: "json", traditional: true,
|
||||
success: function (data) {
|
||||
layer.msg(data.msg, {icon: 6});
|
||||
//layui.table.reload('actModeltList');
|
||||
}
|
||||
});
|
||||
}
|
||||
function open(id) {
|
||||
$.ajax({
|
||||
url: "open",
|
||||
type: "post",
|
||||
data: {id: id},
|
||||
dataType: "json", traditional: true,
|
||||
success: function d(data) {
|
||||
layer.msg(data.msg, {icon: 6});
|
||||
layui.table.reload('actModelList');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function del(id) {
|
||||
$.ajax({
|
||||
url: "delModel",
|
||||
type: "post",
|
||||
data: {id: id},
|
||||
dataType: "json", traditional: true,
|
||||
success: function (d) {
|
||||
if (d.flag) {
|
||||
layer.msg(d.msg, {icon: 6});
|
||||
layui.table.reload('actModelList');
|
||||
} else {
|
||||
layer.msg(d.msg, {icon: 5});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function syncdata() {
|
||||
var index= layer.load(2);
|
||||
$.ajax({
|
||||
url: "syncdata",
|
||||
type: "post",
|
||||
dataType: "json", traditional: true,
|
||||
success: function (data) {
|
||||
layer.close(index)
|
||||
layer.msg(data.msg, {icon: 6});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function open(id) {
|
||||
$.ajax({
|
||||
url: "open",
|
||||
type: "post",
|
||||
data: {id: id},
|
||||
dataType: "json", traditional: true,
|
||||
success: function d(data) {
|
||||
layer.msg(data.msg, {icon: 6});
|
||||
layui.table.reload('actModelList');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -32,5 +32,6 @@
|
|||
<![CDATA[ and DATE_FORMAT(end_time, '%Y-%m-%d') <= DATE_FORMAT(#{endTime}, '%Y-%m-%d') ]]>
|
||||
</if>
|
||||
</where>
|
||||
order by create_date desc
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,29 @@
|
|||
var activiti = {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param processInstanceId 流程实例ID
|
||||
* @param w 宽
|
||||
* @param h 高
|
||||
*/
|
||||
img: function (processInstanceId, w, h) {
|
||||
if (typeof w==='undefined') {
|
||||
w = $(window).width();
|
||||
}
|
||||
if (typeof h==='undefined') {
|
||||
h = $(window).height();
|
||||
}
|
||||
window.parent.layer.open({
|
||||
id: Math.floor(Math.random() * 1000),
|
||||
type: 2,
|
||||
area: [w + 'px', h + 'px'],
|
||||
fix: false,
|
||||
maxmin: true,
|
||||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '流程图',
|
||||
content: '/act/shinePics/' + processInstanceId
|
||||
});
|
||||
}
|
||||
|
||||
};
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Activiti Modeler component part of the Activiti project
|
||||
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
|
@ -33,11 +33,11 @@ var KisBpmAssignmentCtrl = [ '$scope', '$modal','$http', function($scope, $modal
|
|||
}];
|
||||
|
||||
var KisBpmAssignmentPopupCtrl = [ '$scope','$modal', function($scope, $modal) {
|
||||
|
||||
|
||||
// Put json representing assignment on scope
|
||||
if ($scope.property.value !== undefined && $scope.property.value !== null
|
||||
&& $scope.property.value.assignment !== undefined
|
||||
&& $scope.property.value.assignment !== null)
|
||||
&& $scope.property.value.assignment !== null)
|
||||
{
|
||||
$scope.assignment = $scope.property.value.assignment;
|
||||
} else {
|
||||
|
@ -46,7 +46,7 @@ var KisBpmAssignmentPopupCtrl = [ '$scope','$modal', function($scope, $modal) {
|
|||
|
||||
if ($scope.assignment.candidateUsers == undefined || $scope.assignment.candidateUsers.length == 0)
|
||||
{
|
||||
$scope.assignment.candidateUsers = [{value: ''}];
|
||||
$scope.assignment.candidateUsers = [{value: ''}];
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ var KisBpmAssignmentPopupCtrl = [ '$scope','$modal', function($scope, $modal) {
|
|||
{
|
||||
$scope.assignment.assignee = '';
|
||||
}
|
||||
|
||||
|
||||
// Click handler for + button after enum value
|
||||
var userValueIndex = 1;
|
||||
$scope.addCandidateUserValue = function(index) {
|
||||
|
@ -65,12 +65,12 @@ var KisBpmAssignmentPopupCtrl = [ '$scope','$modal', function($scope, $modal) {
|
|||
$scope.removeCandidateUserValue = function(index) {
|
||||
$scope.assignment.candidateUsers.splice(index, 1);
|
||||
};
|
||||
|
||||
|
||||
if ($scope.assignment.candidateGroups == undefined || $scope.assignment.candidateGroups.length == 0)
|
||||
{
|
||||
$scope.assignment.candidateGroups = [{value: ''}];
|
||||
$scope.assignment.candidateGroups = [{value: ''}];
|
||||
}
|
||||
|
||||
|
||||
var groupValueIndex = 1;
|
||||
$scope.addCandidateGroupValue = function(index) {
|
||||
$scope.assignment.candidateGroups.splice(index + 1, 0, {value: 'value ' + groupValueIndex++});
|
||||
|
@ -108,72 +108,72 @@ var KisBpmAssignmentPopupCtrl = [ '$scope','$modal', function($scope, $modal) {
|
|||
$scope.property.value = {};
|
||||
handleAssignmentInput($scope);
|
||||
$scope.property.value.assignment = $scope.assignment;
|
||||
|
||||
|
||||
$scope.updatePropertyInModel($scope.property);
|
||||
$scope.close();
|
||||
};
|
||||
|
||||
// Close button handler
|
||||
$scope.close = function() {
|
||||
handleAssignmentInput($scope);
|
||||
$scope.property.mode = 'read';
|
||||
$scope.$hide();
|
||||
handleAssignmentInput($scope);
|
||||
$scope.property.mode = 'read';
|
||||
$scope.$hide();
|
||||
};
|
||||
|
||||
|
||||
var handleAssignmentInput = function($scope) {
|
||||
if ($scope.assignment.candidateUsers)
|
||||
{
|
||||
var emptyUsers = true;
|
||||
var toRemoveIndexes = [];
|
||||
for (var i = 0; i < $scope.assignment.candidateUsers.length; i++)
|
||||
{
|
||||
if ($scope.assignment.candidateUsers[i].value != '')
|
||||
{
|
||||
emptyUsers = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
toRemoveIndexes[toRemoveIndexes.length] = i;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < toRemoveIndexes.length; i++)
|
||||
{
|
||||
$scope.assignment.candidateUsers.splice(toRemoveIndexes[i], 1);
|
||||
}
|
||||
|
||||
if (emptyUsers)
|
||||
{
|
||||
$scope.assignment.candidateUsers = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
if ($scope.assignment.candidateGroups)
|
||||
{
|
||||
var emptyGroups = true;
|
||||
var toRemoveIndexes = [];
|
||||
for (var i = 0; i < $scope.assignment.candidateGroups.length; i++)
|
||||
{
|
||||
if ($scope.assignment.candidateGroups[i].value != '')
|
||||
{
|
||||
emptyGroups = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
toRemoveIndexes[toRemoveIndexes.length] = i;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < toRemoveIndexes.length; i++)
|
||||
{
|
||||
$scope.assignment.candidateGroups.splice(toRemoveIndexes[i], 1);
|
||||
}
|
||||
|
||||
if (emptyGroups)
|
||||
{
|
||||
$scope.assignment.candidateGroups = undefined;
|
||||
}
|
||||
}
|
||||
if ($scope.assignment.candidateUsers)
|
||||
{
|
||||
var emptyUsers = true;
|
||||
var toRemoveIndexes = [];
|
||||
for (var i = 0; i < $scope.assignment.candidateUsers.length; i++)
|
||||
{
|
||||
if ($scope.assignment.candidateUsers[i].value != '')
|
||||
{
|
||||
emptyUsers = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
toRemoveIndexes[toRemoveIndexes.length] = i;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < toRemoveIndexes.length; i++)
|
||||
{
|
||||
$scope.assignment.candidateUsers.splice(toRemoveIndexes[i], 1);
|
||||
}
|
||||
|
||||
if (emptyUsers)
|
||||
{
|
||||
$scope.assignment.candidateUsers = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
if ($scope.assignment.candidateGroups)
|
||||
{
|
||||
var emptyGroups = true;
|
||||
var toRemoveIndexes = [];
|
||||
for (var i = 0; i < $scope.assignment.candidateGroups.length; i++)
|
||||
{
|
||||
if ($scope.assignment.candidateGroups[i].value != '')
|
||||
{
|
||||
emptyGroups = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
toRemoveIndexes[toRemoveIndexes.length] = i;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < toRemoveIndexes.length; i++)
|
||||
{
|
||||
$scope.assignment.candidateGroups.splice(toRemoveIndexes[i], 1);
|
||||
}
|
||||
|
||||
if (emptyGroups)
|
||||
{
|
||||
$scope.assignment.candidateGroups = undefined;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//因新打开的界面上选定的数据要传输到当前modal中,所以使用此方式,这是angular.js中不同控制器之间传输数据的方式
|
||||
|
@ -181,11 +181,24 @@ var KisBpmAssignmentPopupCtrl = [ '$scope','$modal', function($scope, $modal) {
|
|||
var infos = data.split(",");
|
||||
var nameInfos =nameData.split(",");
|
||||
// $scope.assignment.candidateUsers= [];
|
||||
for(var i=0;i<infos.length;i++)
|
||||
{
|
||||
$scope.assignment.candidateUsers.push({value:infos[i],nameValue:nameInfos[i]});
|
||||
// $scope.assignment.candidateUsers[i].value = infos[i];
|
||||
var currentArr=$scope.assignment.candidateUsers;
|
||||
for(var i=0;i<infos.length;i++){
|
||||
var flag=false;
|
||||
for(var j=0;j<currentArr.length;j++){
|
||||
if(currentArr[j].value===infos[i]){
|
||||
flag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!flag){
|
||||
currentArr.push({value:infos[i],nameValue:nameInfos[i]})
|
||||
}
|
||||
}
|
||||
/*for(var i=0;i<nam.length;i++)
|
||||
{
|
||||
$scope.assignment.candidateUsers.push({value:inf[i],nameValue:nam[i]});
|
||||
// $scope.assignment.candidateUsers[i].value = infos[i];
|
||||
}*/
|
||||
//清空第一个
|
||||
if( (!$scope.assignment.candidateUsers[0].value )||$scope.assignment.candidateUsers[0]=='' )
|
||||
{
|
||||
|
@ -205,11 +218,18 @@ var KisBpmAssignmentPopupCtrl = [ '$scope','$modal', function($scope, $modal) {
|
|||
// $scope.assignment.candidateGroups[0].value = data;
|
||||
var infos = data.split(",");
|
||||
var nameInfos =nameData.split(",");
|
||||
|
||||
for(var i=0;i<infos.length;i++)
|
||||
{
|
||||
// $scope.assignment.candidateGroups[i].value = infos[i];
|
||||
$scope.assignment.candidateGroups.push({value:infos[i],nameValue:nameInfos[i]});
|
||||
var currentArr=$scope.assignment.candidateGroups;
|
||||
for(var i=0;i<infos.length;i++){
|
||||
var flag=false;
|
||||
for(var j=0;j<currentArr.length;j++){
|
||||
if(currentArr[j].value===infos[i]){
|
||||
flag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!flag){
|
||||
currentArr.push({value:infos[i],nameValue:nameInfos[i]})
|
||||
}
|
||||
}
|
||||
|
||||
//清空第一个
|
||||
|
@ -355,7 +375,16 @@ var KisBpmChoseAssignmentCtrl = ['$scope', '$http', function($scope, $http) {
|
|||
}
|
||||
}
|
||||
$scope.accounts = choseAssignees;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.selectThis=function($event,account){
|
||||
if($scope.choseAssignmentFlag == "assignee"){
|
||||
account.checked=!account.checked;
|
||||
}else{
|
||||
account.selected=!account.selected;
|
||||
}
|
||||
|
||||
};
|
||||
}];
|
||||
|
||||
var KisBpmChoseCandidateGroupsCtrl = ['$scope', '$http', function($scope, $http) {
|
||||
|
@ -413,4 +442,9 @@ var KisBpmChoseCandidateGroupsCtrl = ['$scope', '$http', function($scope, $http)
|
|||
}
|
||||
$scope.candidateGroups = candidateGroups;
|
||||
}
|
||||
|
||||
$scope.selectThis=function($event,candidateGroup){
|
||||
candidateGroup.selected=!candidateGroup.selected;
|
||||
}
|
||||
|
||||
}];
|
||||
|
|
|
@ -1,40 +1,38 @@
|
|||
<div class="modal" ng-controller="KisBpmChoseCandidateGroupsCtrl">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="close()">×</button>
|
||||
<h2 translate>PROPERTY.ASSIGNMENT.TITLE</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row row-no-gutter">
|
||||
<div class="col-xs-2"></div>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="close()">×</button>
|
||||
<h2 translate>PROPERTY.ASSIGNMENT.TITLE</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row row-no-gutter">
|
||||
<div class="col-xs-2"></div>
|
||||
<div class="col-xs-8">
|
||||
<table class="table table-bordered table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" ng-click="selectAll($event)"></th>
|
||||
<th>组名</th>
|
||||
<th>描述</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="candidateGroup in candidateGroups">
|
||||
<td>
|
||||
<input type="checkbox" ng-model="candidateGroup.selected" ne-true-value="{{candidateGroup.id}}" ng-false-value="false">
|
||||
</td>
|
||||
<td>{{candidateGroup.name}}</td>
|
||||
<td>{{candidateGroup.description}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-bordered table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" ng-click="selectAll($event)"></th>
|
||||
<th>角色</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-click="selectThis($event,candidateGroup)" ng-repeat="candidateGroup in candidateGroups">
|
||||
<td>
|
||||
<input type="checkbox" ng-click="$event.stopPropagation();" ng-model="candidateGroup.selected" ne-true-value="{{candidateGroup.id}}" ng-false-value="false">
|
||||
</td>
|
||||
<td>{{candidateGroup.description}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-xs-2"></div>
|
||||
<div class="col-xs-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button ng-click="close()" translate>ACTION.CANCEL</button>
|
||||
<button ng-click="save()" translate>ACTION.SAVE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button ng-click="close()" class="btn btn-inverse" translate>ACTION.CANCEL</button>
|
||||
<button ng-click="save()" class="btn btn-primary" translate>ACTION.SAVE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -29,22 +29,22 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th><input ng-if="choseAssignmentFlag=='assignees'" type="checkbox" ng-click="selectAll($event)"></th>
|
||||
<th>工号</th>
|
||||
<th>用户名</th>
|
||||
<th>姓名</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="account in accounts">
|
||||
<tr ng-click="selectThis($event,account)" ng-repeat="account in accounts">
|
||||
<td>
|
||||
<!--<input ng-if="choseAssignmentFlag=='assignee'" type="radio" name="accountIdinfo" ng-value="{{account.id}}"-->
|
||||
<!--ng-model="cardRadio" ng-model="$parent.cardRadio" value="{{account.id}}" ng-checked="$index==0?true:false">-->
|
||||
<!--ng-model="cardRadio" ng-model="$parent.cardRadio" value="{{account.id}}" ng-checked="$index==0?true:false">-->
|
||||
|
||||
<!--<input type="radio" ng-model="$parent.kk" name="accountIds" ne-true-value="1" ng-false-value="false">-->
|
||||
<!--<input type="radio" ng-model="$parent.kk" name="accountIds" ne-true-value="0" ng-false-value="false">-->
|
||||
<input ng-if="choseAssignmentFlag=='assignee'" type="radio" ng-model="account.checked" name="accountsIds" value="{{account.id}}"
|
||||
>
|
||||
<input ng-if="choseAssignmentFlag=='assignee'" ng-click="$event.stopPropagation();" type="radio" ng-model="account.checked" name="accountsIds" value="{{account.id}}"
|
||||
>
|
||||
|
||||
<input ng-if="choseAssignmentFlag=='assignees'" type="checkbox" ng-model="account.selected" ne-true-value="{{account.id}}"
|
||||
<input ng-if="choseAssignmentFlag=='assignees'" ng-click="$event.stopPropagation();" type="checkbox" ng-model="account.selected" ne-true-value="{{account.id}}"
|
||||
ng-false-value="false">
|
||||
</td>
|
||||
<td>{{account.code}}</td>
|
||||
|
|
|
@ -77,8 +77,8 @@ body {
|
|||
}
|
||||
|
||||
.simple-list li >.actions a {
|
||||
padding: 4px 4px 0 4px;
|
||||
}
|
||||
padding: 4px 4px 0 4px;
|
||||
}
|
||||
|
||||
.simple-list li >.actions a:hover {
|
||||
background-color: #ffffff;
|
||||
|
@ -164,7 +164,8 @@ label {
|
|||
|
||||
/** Buttons **/
|
||||
button.btn, a.btn {
|
||||
background-color: #36a7c4;
|
||||
/*background-color: #36a7c4;*/
|
||||
background-color: #6dc469;
|
||||
color: #ffffff;
|
||||
border-color: #ffffff;
|
||||
font-size: 15px;
|
||||
|
@ -266,7 +267,8 @@ button.btn.btn-danger {
|
|||
}
|
||||
|
||||
.dropdown-menu > li > a:hover, .dropdown-menu > ul > li > a:hover {
|
||||
background: #36a7c4;
|
||||
/*background: #36a7c4;*/
|
||||
background: #6dc469;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
|
@ -298,7 +300,8 @@ a.dropdown-toggle {
|
|||
}
|
||||
|
||||
.open a.dropdown-toggle, a.dropdown-toggle:hover {
|
||||
color: #36a7c4;
|
||||
/*color: #36a7c4;*/
|
||||
color: #6dc469;
|
||||
}
|
||||
|
||||
.btn-group.open .dropdown-toggle {
|
||||
|
@ -310,35 +313,35 @@ a.dropdown-toggle {
|
|||
/** Subtle dropdown (eg. sort) */
|
||||
|
||||
.dropdown-subtle {
|
||||
margin-right: 5px;
|
||||
color: #606b7d;
|
||||
margin-right: 5px;
|
||||
color: #606b7d;
|
||||
}
|
||||
|
||||
.dropdown-subtle .btn {
|
||||
background: transparent;
|
||||
line-height: 36px;
|
||||
color: #606b7d;
|
||||
padding: 0;
|
||||
font-size: 14px;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
background: transparent;
|
||||
line-height: 36px;
|
||||
color: #606b7d;
|
||||
padding: 0;
|
||||
font-size: 14px;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
}
|
||||
|
||||
.dropdown-subtle .btn-group.open .dropdown-toggle {
|
||||
box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
}
|
||||
|
||||
.dropdown-subtle .btn:hover, .dropdown-subtle .btn:focus {
|
||||
background: transparent;
|
||||
color: #333333;
|
||||
background: transparent;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.dropdown-subtle a {
|
||||
cursor: pointer;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/** Popovers */
|
||||
|
@ -354,7 +357,7 @@ a.dropdown-toggle {
|
|||
.popover.bottom-left, .popover.bottom-right {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.popover>.arrow, .popover>.arrow {
|
||||
.popover>.arrow, .popover>.arrow {
|
||||
margin-left: -11px;
|
||||
border-top-width: 0;
|
||||
border-bottom-color: #999;
|
||||
|
@ -526,13 +529,15 @@ a.dropdown-toggle {
|
|||
|
||||
|
||||
.navbar-nav > li.active > a {
|
||||
color: #36a7c4;
|
||||
/*color: #36a7c4;*/
|
||||
color: #6dc469;
|
||||
}
|
||||
|
||||
/* Sub header */
|
||||
.subheader {
|
||||
background-color: #e8edf1;
|
||||
min-height: 60px;
|
||||
background-color: #ffffff;
|
||||
/*background-color: #e8edf1;*/
|
||||
min-height: 50px;
|
||||
border-bottom: 1px solid #a4acb9;
|
||||
}
|
||||
|
||||
|
@ -551,7 +556,8 @@ a.dropdown-toggle {
|
|||
|
||||
.subheader .version {
|
||||
font-weight: bold;
|
||||
color: #36a7c4;
|
||||
/*color: #36a7c4;*/
|
||||
color: #6dc469;
|
||||
font-size: 110%;
|
||||
padding-left: 5px;
|
||||
line-height: 1;
|
||||
|
@ -690,7 +696,7 @@ a.dropdown-toggle {
|
|||
}
|
||||
|
||||
.icon-pencil:before {
|
||||
content: "\270f";
|
||||
content: "\270f";
|
||||
}
|
||||
|
||||
.icon-caret-up:before {
|
||||
|
@ -885,7 +891,7 @@ a.dropdown-toggle {
|
|||
.alert.ng-hide-remove {
|
||||
opacity: 1;
|
||||
display:block!important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.alert.ng-hide {
|
||||
|
@ -937,7 +943,7 @@ a.dropdown-toggle {
|
|||
}
|
||||
|
||||
.wrapper.full {
|
||||
padding: 40px 0px 0px 0px;
|
||||
/*padding: 40px 0px 0px 0px;*/
|
||||
overflow: hidden;
|
||||
max-width: 100%;
|
||||
min-width: 100%;
|
||||
|
@ -1198,7 +1204,7 @@ button.selection:active, button.selection:focus {
|
|||
}
|
||||
|
||||
.list-wrapper {
|
||||
overflow: auto;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1220,7 +1226,8 @@ button.selection:active, button.selection:focus {
|
|||
}
|
||||
|
||||
.list-header .summary .filter-action:hover {
|
||||
color: #36a7c4;
|
||||
/*color: #36a7c4;*/
|
||||
color: #6dc469;
|
||||
}
|
||||
|
||||
.main-list .list-subheader {
|
||||
|
@ -1265,7 +1272,8 @@ button.selection:active, button.selection:focus {
|
|||
padding-right: 0;
|
||||
border-radius: 3px;
|
||||
background-color: #e8edf1;
|
||||
color: #36a7c4;
|
||||
/*color: #36a7c4;*/
|
||||
color: #6dc469;
|
||||
background-color: transparent;
|
||||
font-weight: normal;
|
||||
|
||||
|
@ -1292,7 +1300,8 @@ button.selection:active, button.selection:focus {
|
|||
}
|
||||
|
||||
.full-list li.active > div {
|
||||
border-left-color: #36a7c4;
|
||||
/*border-left-color: #36a7c4;*/
|
||||
border-left-color: #6dc469;
|
||||
}
|
||||
|
||||
.full-list li .title {
|
||||
|
@ -1361,7 +1370,7 @@ button.selection:active, button.selection:focus {
|
|||
color: #ffffff;
|
||||
}
|
||||
|
||||
.modal-header .label, .header .label {
|
||||
.modal-header .label, .header .label {
|
||||
padding: 0 3px 0 15px;
|
||||
color: #1a1a1a;
|
||||
font-weight: normal;
|
||||
|
@ -1378,7 +1387,8 @@ button.selection:active, button.selection:focus {
|
|||
}
|
||||
|
||||
.header .detail a:hover {
|
||||
color: #36a7c4;
|
||||
/*color: #36a7c4;*/
|
||||
color: #6dc469;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
@ -1410,7 +1420,8 @@ button.selection:active, button.selection:focus {
|
|||
|
||||
.jumpers li.selected {
|
||||
color: white;
|
||||
background-color: #36a7c4;
|
||||
/*background-color: #36a7c4;*/
|
||||
background-color: #6dc469;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
Colors:
|
||||
|
||||
|
||||
- Header: #333333
|
||||
- Subheader: #e8edf1
|
||||
- Subheader border: #a4acb9
|
||||
|
@ -17,12 +17,12 @@
|
|||
}
|
||||
|
||||
.subtle-select .glyphicon {
|
||||
visibility: hidden;
|
||||
padding-left: 5px;
|
||||
visibility: hidden;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
a.subtle-select:hover .glyphicon {
|
||||
visibility: visible;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.full {
|
||||
|
@ -31,30 +31,30 @@ a.subtle-select:hover .glyphicon {
|
|||
}
|
||||
|
||||
.inline {
|
||||
display: inline;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.greyish {
|
||||
color: #afafaf;
|
||||
color: #afafaf;
|
||||
}
|
||||
|
||||
.roweditor-canvas {
|
||||
margin-top: 50px;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.no-pad {
|
||||
margin: 0;
|
||||
max-width: 1300px;
|
||||
min-width: 1100px;
|
||||
min-width: 1100px;
|
||||
}
|
||||
|
||||
.content.no-pad {
|
||||
max-width: 100%;
|
||||
min-width: 100%;
|
||||
max-width: 100%;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.inset .col-sm-3 {
|
||||
margin-left: -15px;
|
||||
margin-left: -15px;
|
||||
}
|
||||
.no-pad > div{
|
||||
padding: 0;
|
||||
|
@ -73,14 +73,14 @@ h1 {
|
|||
line-height: 40px;
|
||||
border: none;
|
||||
color: #ffffff;
|
||||
font-family: 'Lato', sans-serif;
|
||||
font-family: 'Lato', sans-serif;
|
||||
}
|
||||
|
||||
.truncate, .truncate > span {
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.subheader .details .counter {
|
||||
|
@ -99,7 +99,7 @@ h1 {
|
|||
|
||||
.btn .icon-and-label {
|
||||
padding-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-menu .title {
|
||||
margin: 5px 10px 0px 10px;
|
||||
|
@ -121,7 +121,7 @@ h1 {
|
|||
.filter-wrapper {
|
||||
min-height: 400px;
|
||||
margin-top: 10px;
|
||||
margin-left: -15px;
|
||||
margin-left: -15px;
|
||||
}
|
||||
|
||||
ul.filter-list {
|
||||
|
@ -140,9 +140,11 @@ ul.filter-list li a {
|
|||
}
|
||||
|
||||
ul.filter-list li.current a {
|
||||
color: #36a7c4;
|
||||
/*color: #36a7c4;*/
|
||||
color: #6dc469;
|
||||
padding-left: 5px;
|
||||
border-left: 4px solid #36a7c4;
|
||||
/*border-left: 4px solid #36a7c4;*/
|
||||
border-left: 4px solid #6dc469;
|
||||
}
|
||||
|
||||
ul.filter-list li a:hover, ul.filter-list li a:focus {
|
||||
|
@ -152,7 +154,8 @@ ul.filter-list li a:hover, ul.filter-list li a:focus {
|
|||
|
||||
ul.filter-list li.current a:hover, ul.filter-list li.current a:focus {
|
||||
background-color: transparent;
|
||||
color: #36a7c4;
|
||||
/*color: #36a7c4;*/
|
||||
color: #6dc469;
|
||||
cursor: default;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
@ -173,7 +176,7 @@ ul.filter-list li.current a:hover, ul.filter-list li.current a:focus {
|
|||
color: #606b7d;
|
||||
}
|
||||
.item-wrapper .message span {
|
||||
font-size: 14px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.item-wrapper .item {
|
||||
|
@ -183,12 +186,12 @@ ul.filter-list li.current a:hover, ul.filter-list li.current a:focus {
|
|||
float: left;
|
||||
}
|
||||
|
||||
.item-wrapper .item .btn-default.disabled,
|
||||
.item-wrapper .item .btn-default.disabled,
|
||||
.item-wrapper .item .btn-default[disabled],
|
||||
.item-wrapper .item .btn-default[disabled]:active,
|
||||
.item-wrapper .item .btn-default[disabled]:hover {
|
||||
border-color: #ffffff;
|
||||
cursor: default;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.item-wrapper .item .item-box {
|
||||
|
@ -200,18 +203,18 @@ ul.filter-list li.current a:hover, ul.filter-list li.current a:focus {
|
|||
background-repeat: no-repeat;
|
||||
background-position: center 20px;
|
||||
background-size: auto;
|
||||
position: relative;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.item-box .details {
|
||||
position: relative;
|
||||
position: relative;
|
||||
background-color: #e8edf1;
|
||||
height: 160px;
|
||||
margin-top: 120px;
|
||||
padding: 5px;
|
||||
color: #373e48;
|
||||
font-size: 13px;
|
||||
|
||||
|
||||
transition: margin-top .5s ease;
|
||||
-moz-transition: margin-top .5s ease;
|
||||
-webkit-transition: margin-top .5s ease;
|
||||
|
@ -274,7 +277,7 @@ ul.filter-list li.current a:hover, ul.filter-list li.current a:focus {
|
|||
color: #1a1a1a;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.create-inline .glyphicon {
|
||||
margin-right: 10px;
|
||||
|
@ -303,36 +306,36 @@ ul.filter-list li.current a:hover, ul.filter-list li.current a:focus {
|
|||
}
|
||||
|
||||
.content-canvas-wrapper {
|
||||
-moz-box-shadow: inset 0 3px 3px -4px #ababab;
|
||||
-webkit-box-shadow: inset 0 3px 3px -4px #ababab;
|
||||
box-shadow: inset 0 3px 3px -4px #ababab;
|
||||
margin: 15px 7px 0 7px;
|
||||
z-index: 0;
|
||||
-moz-box-shadow: inset 0 3px 3px -4px #ababab;
|
||||
-webkit-box-shadow: inset 0 3px 3px -4px #ababab;
|
||||
box-shadow: inset 0 3px 3px -4px #ababab;
|
||||
margin: 15px 7px 0 7px;
|
||||
z-index: 0;
|
||||
}
|
||||
.content-canvas {
|
||||
background-color: #f9f9f9;
|
||||
margin: 0 3px 0 3px;
|
||||
background-color: #f9f9f9;
|
||||
margin: 0 3px 0 3px;
|
||||
|
||||
-moz-box-shadow: inset 0 3px 3px -4px #ababab;
|
||||
-webkit-box-shadow: inset 0 3px 3px -4px #ababab;
|
||||
box-shadow: inset 0 3px 3px -4px #ababab;
|
||||
-moz-box-shadow: inset 0 3px 3px -4px #ababab;
|
||||
-webkit-box-shadow: inset 0 3px 3px -4px #ababab;
|
||||
box-shadow: inset 0 3px 3px -4px #ababab;
|
||||
|
||||
padding: 20px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
|
||||
.content-canvas h3 {
|
||||
margin-bottom: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.content-canvas .no-results{
|
||||
color: #999999;
|
||||
font-size: 16px;
|
||||
margin: 10px 0px;
|
||||
color: #999999;
|
||||
font-size: 16px;
|
||||
margin: 10px 0px;
|
||||
}
|
||||
|
||||
.content-canvas .item-wrapper {
|
||||
margin: 5px 10px;
|
||||
margin: 5px 10px;
|
||||
}
|
||||
|
||||
/* History */
|
||||
|
@ -342,11 +345,11 @@ table.history {
|
|||
}
|
||||
|
||||
.subheader table.history {
|
||||
min-width: 250px;
|
||||
min-width: 250px;
|
||||
}
|
||||
|
||||
table.history td {
|
||||
vertical-align: middle;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
table.history tr td:last-child {
|
||||
|
@ -365,16 +368,17 @@ table.history tr.current:hover {
|
|||
|
||||
table.history a:hover {
|
||||
text-decoration: none;
|
||||
|
||||
|
||||
}
|
||||
|
||||
table.history .version {
|
||||
font-size: 30px;
|
||||
display: inline-block;
|
||||
color: #36a7c4;
|
||||
/*color: #36a7c4;*/
|
||||
color: #6dc469;
|
||||
padding: 5px 10px;
|
||||
vertical-align:middle;
|
||||
color: #36a7c4;
|
||||
/*color: #36a7c4;*/
|
||||
}
|
||||
|
||||
table.history .detail {
|
||||
|
@ -398,11 +402,11 @@ table.history tr.current td {
|
|||
border-top: 1px solid #eeeeee;
|
||||
margin-top: 5px;
|
||||
max-height: 350px;
|
||||
overflow: auto;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.comment {
|
||||
margin: 10px 0px 20px 0px;
|
||||
margin: 10px 0px 20px 0px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
|
@ -412,20 +416,21 @@ table.history tr.current td {
|
|||
}
|
||||
|
||||
.comment .author {
|
||||
color: #36a7c4;
|
||||
/*color: #36a7c4;*/
|
||||
color: #6dc469;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.comment p {
|
||||
word-wrap: break-word;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.modal.modal-wide .modal-dialog {
|
||||
width: 1000px;
|
||||
width: 1000px;
|
||||
}
|
||||
|
||||
.modal-dialog.modal-wide {
|
||||
width: 1000px;
|
||||
width: 1000px;
|
||||
}
|
||||
|
||||
.modal-body p {
|
||||
|
@ -438,202 +443,202 @@ table.history tr.current td {
|
|||
}
|
||||
|
||||
.form-group .inline-help {
|
||||
font-size: 11px;
|
||||
color: #666666;
|
||||
margin-top: 5px;
|
||||
font-size: 11px;
|
||||
color: #666666;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.form-group .message {
|
||||
color: #1a1a1a;
|
||||
font-size: 14px;
|
||||
color: #1a1a1a;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.people-select > .selection {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
.popup-wrapper .people-select {
|
||||
max-height: 160px;
|
||||
max-height: 160px;
|
||||
}
|
||||
|
||||
.people-select .nothing-to-see {
|
||||
padding: 5px 0;
|
||||
padding: 5px 0;
|
||||
|
||||
color: #999999;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.inline-people-select {
|
||||
max-height: 120px;
|
||||
overflow: auto;
|
||||
max-height: 120px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/** Center tabbed pane */
|
||||
.center-pane {
|
||||
overflow: auto;
|
||||
padding-bottom: 20px;
|
||||
overflow: auto;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.center-pane .content {
|
||||
overflow: hidden;
|
||||
overflow: hidden;
|
||||
}
|
||||
.center-pane .tab-actions {
|
||||
padding: 8px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.center-pane .tabs-wrapper > .pull-right {
|
||||
margin-right: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.center-pane .content {
|
||||
padding: 10px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.center-pane.content {
|
||||
padding: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.center-pane .content .tabs, .center-pane.content .tabs {
|
||||
padding-left: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.center-pane .content .tabs > li a, .center-pane.content .tabs > li a {
|
||||
padding: 8px 30px;
|
||||
padding: 8px 30px;
|
||||
}
|
||||
|
||||
.center-pane .header h1 {
|
||||
font-size: 30px;
|
||||
margin: 0;
|
||||
padding:0;
|
||||
font-size: 30px;
|
||||
margin: 0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.center-pane .header h2 {
|
||||
font-size: 24px;
|
||||
margin: 0 0 5px 0;
|
||||
padding:0;
|
||||
font-size: 24px;
|
||||
margin: 0 0 5px 0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.center-pane .header {
|
||||
padding: 5px 10px 25px 10px;
|
||||
padding: 5px 10px 25px 10px;
|
||||
}
|
||||
|
||||
|
||||
.center-pane .header.compact {
|
||||
padding-bottom: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.center-pane .well {
|
||||
-moz-border-radius: 0px;
|
||||
-webkit-border-radius: px;
|
||||
border-radius: 0px;
|
||||
background-color: #f9f9f9;
|
||||
padding: 12px 10px;
|
||||
margin: 15px 0 0 0;
|
||||
border: 1px solid #eeeeee;
|
||||
-moz-border-radius: 0px;
|
||||
-webkit-border-radius: px;
|
||||
border-radius: 0px;
|
||||
background-color: #f9f9f9;
|
||||
padding: 12px 10px;
|
||||
margin: 15px 0 0 0;
|
||||
border: 1px solid #eeeeee;
|
||||
}
|
||||
|
||||
/** General button styling */
|
||||
.btn.btn-clean {
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
font-size: 24px;
|
||||
padding: 2px 6px;
|
||||
color: #444444;
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
font-size: 24px;
|
||||
padding: 2px 6px;
|
||||
color: #444444;
|
||||
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.btn-clean:hover .icon-remove {
|
||||
color: #a02828;
|
||||
color: #a02828;
|
||||
}
|
||||
|
||||
.btn-clean:focus, .btn-clean:hover {
|
||||
color: #5f8dd3;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
color: #5f8dd3;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
|
||||
.btn-clean:active {
|
||||
color: #2c5aa0;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
color: #2c5aa0;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* Show list in popup */
|
||||
|
||||
ul.list {
|
||||
list-style: none inside;
|
||||
padding: 0px;
|
||||
margin-bottom: 3px;
|
||||
list-style: none inside;
|
||||
padding: 0px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
ul.list>li {
|
||||
line-height: 30px;
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
cursor: pointer;
|
||||
line-height: 30px;
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.popup-wrapper ul.list>li {
|
||||
border-top: 1px solid #eeeeee;
|
||||
border-top: 1px solid #eeeeee;
|
||||
}
|
||||
|
||||
.popup-wrapper ul.list>li:last-child {
|
||||
border-bottom: 1px solid #eeeeee;
|
||||
border-bottom: 1px solid #eeeeee;
|
||||
}
|
||||
|
||||
ul.list>li:hover, ul.list>li.active {
|
||||
background-color: #f2f2f2;
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
ul.list >li .actions {
|
||||
float:right;
|
||||
margin: 0px 0px 0px 5px;
|
||||
visibility: hidden;
|
||||
float:right;
|
||||
margin: 0px 0px 0px 5px;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
ul.list>li:hover .actions {
|
||||
visibility: inherit;
|
||||
visibility: inherit;
|
||||
}
|
||||
|
||||
/** Animations **/
|
||||
.fadein.ng-enter,
|
||||
.fadein.ng-enter,
|
||||
.fadein.ng-move {
|
||||
-webkit-transition: 0.5s linear opacity;
|
||||
transition: 0.5s linear all;
|
||||
-webkit-transition: 0.5s linear opacity;
|
||||
transition: 0.5s linear all;
|
||||
}
|
||||
|
||||
.fadein.ng-enter {
|
||||
opacity:0;
|
||||
opacity:0;
|
||||
}
|
||||
.fadein.ng-enter.ng-enter-active {
|
||||
opacity:1;
|
||||
opacity:1;
|
||||
}
|
||||
|
||||
.fadein.ng-move {
|
||||
opacity:0.5;
|
||||
opacity:0.5;
|
||||
}
|
||||
.fadein.ng-move.ng-move-active {
|
||||
opacity:1;
|
||||
opacity:1;
|
||||
}
|
||||
|
||||
.popup-error {
|
||||
color: red;
|
||||
padding: 0 5px 8px 0;
|
||||
color: red;
|
||||
padding: 0 5px 8px 0;
|
||||
}
|
||||
|
||||
/** Passwords */
|
||||
|
||||
.password-field {
|
||||
width: 320px;
|
||||
width: 320px;
|
||||
}
|
||||
|
||||
/** LOADING */
|
||||
|
||||
.message .loading {
|
||||
line-height: 40px;
|
||||
margin-left: 0px;
|
||||
margin-left: 0px;
|
||||
}
|
|
@ -14,15 +14,6 @@
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group pull-right" ng-show="!secondaryItems.length">
|
||||
<div class="btn-toolbar pull-right" ng-controller="ToolbarController">
|
||||
<button title="{{item.title | translate}}" ng-repeat="item in secondaryItems" ng-switch on="item.type" class="btn btn-inverse" ng-class="{'separator': item.type == 'separator'}"
|
||||
ng-disabled="item.type == 'separator'" ng-click="toolbarSecondaryButtonClicked($index)" id="{{item.id}}">
|
||||
<i ng-switch-when="button" ng-class="item.cssClass" class="toolbar-button" data-toggle="tooltip" title="{{item.title | translate}}"></i>
|
||||
<div ng-switch-when="separator" ng-class="item.cssClass"></div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="full">
|
||||
<div class="row row-no-gutter">
|
||||
|
@ -48,7 +39,7 @@
|
|||
data-drag="true"
|
||||
jqyoui-draggable="{onStart:'startDragCallback', onDrag:'dragCallback'}"
|
||||
data-jqyoui-options="{revert: 'invalid', helper: 'clone', opacity : 0.5}">
|
||||
|
||||
|
||||
<img ng-src="editor-app/stencilsets/bpmn2.0/icons/{{item.icon}}" width="16px;" height="16px;"/>
|
||||
{{item.name}}
|
||||
</li>
|
||||
|
@ -57,21 +48,21 @@
|
|||
</div>
|
||||
</div>
|
||||
<div id="canvasHelpWrapper" class="col-xs-9">
|
||||
<div class="canvas-wrapper" id="canvasSection"
|
||||
<div class="canvas-wrapper" id="canvasSection"
|
||||
ng-model="droppedElement"
|
||||
ng-model="droppedElement"
|
||||
data-drop="true"
|
||||
data-jqyoui-options
|
||||
jqyoui-droppable="{onDrop:'dropCallback',onOver: 'overCallback', onOut: 'outCallback'}">
|
||||
jqyoui-droppable="{onDrop:'dropCallback',onOver: 'overCallback', onOut: 'outCallback'}">
|
||||
<div class="canvas-message" id="model-modified-date"></div>
|
||||
<div class="Oryx_button"
|
||||
id="delete-button"
|
||||
<div class="Oryx_button"
|
||||
id="delete-button"
|
||||
title="{{'BUTTON.ACTION.DELETE.TOOLTIP' | translate}}"
|
||||
ng-click="deleteShape()"
|
||||
style="display:none">
|
||||
<img src="editor-app/images/delete.png"/>
|
||||
</div>
|
||||
<div class="Oryx_button"
|
||||
<div class="Oryx_button"
|
||||
id="morph-button"
|
||||
title="{{'BUTTON.ACTION.MORPH.TOOLTIP' | translate}}"
|
||||
ng-click="morphShape()"
|
||||
|
@ -104,9 +95,9 @@
|
|||
<strong>{{'ELEMENT.AUTHOR' | translate}}: </strong> {{selectedItem.auditData.author}}
|
||||
</div>
|
||||
<div class="selected-item-title">
|
||||
<a ng-click="propertyWindowState.toggle()">
|
||||
<a ng-click="propertyWindowState.toggle()">
|
||||
<i class="glyphicon" ng-class="{'glyphicon-chevron-right': propertyWindowState.collapsed, 'glyphicon-chevron-down': !propertyWindowState.collapsed}"></i>
|
||||
<span ng-show="selectedItem.title != undefined && selectedItem.title != null && selectedItem.title.length > 0">{{selectedItem.title}}</span>
|
||||
<span ng-show="selectedItem.title != undefined && selectedItem.title != null && selectedItem.title.length > 0">{{selectedItem.title}}</span>
|
||||
<span ng-show="!selectedItem || selectedItem.title == undefined || selectedItem.title == null || selectedItem.title.length == 0">{{modelData.name}}</span>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -117,7 +108,7 @@
|
|||
ng-click="propertyClicked($index)" ng-class="{'clear' : $index%2 == 0}">
|
||||
<span class="title" ng-if="!property.hidden">{{ property.title }} :</span>
|
||||
<span class="title-removed" ng-if="property.hidden"><i>{{ property.title }} ({{'PROPERTY.REMOVED' | translate}}) :</i></span>
|
||||
<span class="value">
|
||||
<span class="value">
|
||||
<ng-include
|
||||
src="getPropertyTemplateUrl($index)" ng-if="!property.hasReadWriteMode"></ng-include>
|
||||
<ng-include src="getPropertyReadModeTemplateUrl($index)"
|
||||
|
@ -128,8 +119,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5499,7 +5499,7 @@ button.close {
|
|||
.carousel-control .glyphicon-chevron-left,
|
||||
.carousel-control .glyphicon-chevron-right {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
top: 0%;
|
||||
z-index: 5;
|
||||
display: inline-block;
|
||||
}
|
||||
|
|
|
@ -8,22 +8,22 @@
|
|||
<!--[if gt IE 8]><!-->
|
||||
<html class="no-js"> <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Activiti Editor</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport"
|
||||
content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, width=device-width">
|
||||
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Activiti Editor</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport"
|
||||
content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, width=device-width">
|
||||
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
|
||||
|
||||
<link rel="Stylesheet" media="screen" href="editor-app/libs/ng-grid-2.0.7.min.css" type="text/css"/>
|
||||
<link rel="stylesheet" href="editor-app/libs/bootstrap_3.1.1/css/bootstrap.min.css"/>
|
||||
<link rel="Stylesheet" media="screen" href="editor-app/libs/ng-grid-2.0.7.min.css" type="text/css"/>
|
||||
<link rel="stylesheet" href="editor-app/libs/bootstrap_3.1.1/css/bootstrap.min.css"/>
|
||||
|
||||
<link rel="Stylesheet" media="screen" href="editor-app/editor/css/editor.css" type="text/css"/>
|
||||
<link rel="stylesheet" href="editor-app/css/style.css" type="text/css"/>
|
||||
<link rel="Stylesheet" media="screen" href="editor-app/editor/css/editor.css" type="text/css"/>
|
||||
<link rel="stylesheet" href="editor-app/css/style.css" type="text/css"/>
|
||||
|
||||
<link rel="stylesheet" href="editor-app/css/style-common.css">
|
||||
<link rel="stylesheet" href="editor-app/css/style-editor.css">
|
||||
<link rel="stylesheet" href="editor-app/css/style-editor.css">
|
||||
|
||||
<style>
|
||||
.page-list{
|
||||
|
@ -48,114 +48,114 @@
|
|||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-fixed-top navbar-inverse" role="navigation" id="main-header">
|
||||
<div class="navbar-header">
|
||||
<a href="" ng-click="backToLanding()" class="navbar-brand"
|
||||
title="{{'GENERAL.MAIN-TITLE' | translate}}"><span
|
||||
class="sr-only">{{'GENERAL.MAIN-TITLE' | translate}}</span></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<div class="unsupported-browser">
|
||||
<p class="alert error">You are using an unsupported browser. Please upgrade your browser in order to use the
|
||||
editor.</p>
|
||||
</div>
|
||||
<![endif]-->
|
||||
|
||||
<div class="alert-wrapper" ng-cloak>
|
||||
<div class="alert fadein {{alerts.current.type}}" ng-show="alerts.current" ng-click="dismissAlert()">
|
||||
<i class="glyphicon"
|
||||
ng-class="{'glyphicon-ok': alerts.current.type == 'info', 'glyphicon-remove': alerts.current.type == 'error'}"></i>
|
||||
<span>{{alerts.current.message}}</span>
|
||||
|
||||
<div class="pull-right" ng-show="alerts.queue.length > 0">
|
||||
<span class="badge">{{alerts.queue.length + 1}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="main" class="wrapper full clearfix" ng-style="{height: window.height + 'px'}" ng-app="activitiModeler" ng-include="'editor-app/editor.html'">
|
||||
</div>
|
||||
<!--<div class="navbar navbar-fixed-top navbar-inverse" role="navigation" id="main-header">
|
||||
<div class="navbar-header">
|
||||
<a href="" ng-click="backToLanding()" class="navbar-brand"
|
||||
title="{{'GENERAL.MAIN-TITLE' | translate}}"><span
|
||||
class="sr-only">{{'GENERAL.MAIN-TITLE' | translate}}</span></a>
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<script src="editor-app/libs/es5-shim-15.3.4.5/es5-shim.js"></script>
|
||||
<script src="editor-app/libs/json3_3.2.6/lib/json3.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<script src="editor-app/libs/jquery_1.11.0/jquery.min.js"></script>
|
||||
<script src="editor-app/libs/jquery-ui-1.10.3.custom.min.js"></script>
|
||||
|
||||
<script src="editor-app/libs/angular_1.2.13/angular.min.js"></script>
|
||||
<script src="editor-app/libs/angular_1.2.13/angular-animate.min.js"></script>
|
||||
<script src="editor-app/libs/bootstrap_3.1.1/js/bootstrap.min.js"></script>
|
||||
<script src="editor-app/libs/angular-resource_1.2.13/angular-resource.min.js"></script>
|
||||
<script src="editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js"></script>
|
||||
<script src="editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js"></script>
|
||||
<script src="editor-app/libs/angular-route_1.2.13/angular-route.min.js"></script>
|
||||
<script src="editor-app/libs/angular-translate_2.4.2/angular-translate.min.js"></script>
|
||||
<script src="editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.js"></script>
|
||||
<script src="editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.js"></script>
|
||||
<script src="editor-app/libs/angular-strap_2.0.5/angular-strap.min.js"></script>
|
||||
<script src="editor-app/libs/angular-strap_2.0.5/angular-strap.tpl.min.js"></script>
|
||||
<script src="editor-app/libs/momentjs_2.5.1/momentjs.min.js"></script>
|
||||
|
||||
<script src="editor-app/libs/ui-utils.min-0.0.4.js" type="text/javascript"></script>
|
||||
<script src="editor-app/libs/ng-grid-2.0.7-min.js" type="text/javascript"></script>
|
||||
<script src="editor-app/libs/angular-dragdrop.min-1.0.3.js" type="text/javascript"></script>
|
||||
<script src="editor-app/libs/mousetrap-1.4.5.min.js" type="text/javascript"></script>
|
||||
<script src="editor-app/libs/jquery.autogrow-textarea.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/libs/prototype-1.5.1.js" type="text/javascript"></script>
|
||||
<script src="editor-app/libs/path_parser.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/libs/angular-scroll_0.5.7/angular-scroll.min.js" type="text/javascript"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<div class="unsupported-browser">
|
||||
<p class="alert error">You are using an unsupported browser. Please upgrade your browser in order to use the
|
||||
editor.</p>
|
||||
</div>
|
||||
<![endif]-->
|
||||
|
||||
<script src="editor-app/libs/pagination/tm.pagination.js" type="text/javascript"></script>
|
||||
<!-- Configuration -->
|
||||
<script src="editor-app/app-cfg.js?v=1"></script>
|
||||
<script src="editor-app/editor-config.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/url-config.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/editor/i18n/translation_en_us.js" type="text/javascript"></script>
|
||||
<script src="editor-app/editor/i18n/translation_signavio_en_us.js" type="text/javascript"></script>
|
||||
<script src="editor-app/editor/oryx.debug.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/app.js"></script>
|
||||
|
||||
<script src="editor-app/eventbus.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/editor-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/stencil-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/toolbar-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/header-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/select-shape-controller.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/editor-utils.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/toolbar-default-actions.js" type="text/javascript"></script>
|
||||
<div class="alert-wrapper" ng-cloak>
|
||||
<div class="alert fadein {{alerts.current.type}}" ng-show="alerts.current" ng-click="dismissAlert()">
|
||||
<i class="glyphicon"
|
||||
ng-class="{'glyphicon-ok': alerts.current.type == 'info', 'glyphicon-remove': alerts.current.type == 'error'}"></i>
|
||||
<span>{{alerts.current.message}}</span>
|
||||
|
||||
<script src="editor-app/configuration/properties-default-controllers.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-execution-listeners-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-event-listeners-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-assignment-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-fields-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-form-properties-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-in-parameters-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-multiinstance-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-out-parameters-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-task-listeners-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-sequenceflow-order-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-condition-expression-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-signal-definitions-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-signal-scope-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-message-definitions-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-message-scope-controller.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/configuration/toolbar.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/toolbar-custom-actions.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/configuration/properties.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-custom-controllers.js" type="text/javascript"></script>
|
||||
<div class="pull-right" ng-show="alerts.queue.length > 0">
|
||||
<span class="badge">{{alerts.queue.length + 1}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="main" class="wrapper full clearfix" ng-style="{height: window.height + 'px'}" ng-app="activitiModeler" ng-include="'editor-app/editor.html'">
|
||||
</div>
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<script src="editor-app/libs/es5-shim-15.3.4.5/es5-shim.js"></script>
|
||||
<script src="editor-app/libs/json3_3.2.6/lib/json3.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<script src="editor-app/libs/jquery_1.11.0/jquery.min.js"></script>
|
||||
<script src="editor-app/libs/jquery-ui-1.10.3.custom.min.js"></script>
|
||||
|
||||
<script src="editor-app/libs/angular_1.2.13/angular.min.js"></script>
|
||||
<script src="editor-app/libs/angular_1.2.13/angular-animate.min.js"></script>
|
||||
<script src="editor-app/libs/bootstrap_3.1.1/js/bootstrap.min.js"></script>
|
||||
<script src="editor-app/libs/angular-resource_1.2.13/angular-resource.min.js"></script>
|
||||
<script src="editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js"></script>
|
||||
<script src="editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js"></script>
|
||||
<script src="editor-app/libs/angular-route_1.2.13/angular-route.min.js"></script>
|
||||
<script src="editor-app/libs/angular-translate_2.4.2/angular-translate.min.js"></script>
|
||||
<script src="editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.js"></script>
|
||||
<script src="editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.js"></script>
|
||||
<script src="editor-app/libs/angular-strap_2.0.5/angular-strap.min.js"></script>
|
||||
<script src="editor-app/libs/angular-strap_2.0.5/angular-strap.tpl.min.js"></script>
|
||||
<script src="editor-app/libs/momentjs_2.5.1/momentjs.min.js"></script>
|
||||
|
||||
<script src="editor-app/libs/ui-utils.min-0.0.4.js" type="text/javascript"></script>
|
||||
<script src="editor-app/libs/ng-grid-2.0.7-min.js" type="text/javascript"></script>
|
||||
<script src="editor-app/libs/angular-dragdrop.min-1.0.3.js" type="text/javascript"></script>
|
||||
<script src="editor-app/libs/mousetrap-1.4.5.min.js" type="text/javascript"></script>
|
||||
<script src="editor-app/libs/jquery.autogrow-textarea.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/libs/prototype-1.5.1.js" type="text/javascript"></script>
|
||||
<script src="editor-app/libs/path_parser.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/libs/angular-scroll_0.5.7/angular-scroll.min.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/libs/pagination/tm.pagination.js" type="text/javascript"></script>
|
||||
<!-- Configuration -->
|
||||
<script src="editor-app/app-cfg.js?v=1"></script>
|
||||
<script src="editor-app/editor-config.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/url-config.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/editor/i18n/translation_en_us.js" type="text/javascript"></script>
|
||||
<script src="editor-app/editor/i18n/translation_signavio_en_us.js" type="text/javascript"></script>
|
||||
<script src="editor-app/editor/oryx.debug.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/app.js"></script>
|
||||
|
||||
<script src="editor-app/eventbus.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/editor-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/stencil-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/toolbar-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/header-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/select-shape-controller.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/editor-utils.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/toolbar-default-actions.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/configuration/properties-default-controllers.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-execution-listeners-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-event-listeners-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-assignment-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-fields-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-form-properties-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-in-parameters-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-multiinstance-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-out-parameters-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-task-listeners-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-sequenceflow-order-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-condition-expression-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-signal-definitions-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-signal-scope-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-message-definitions-controller.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-message-scope-controller.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/configuration/toolbar.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/toolbar-custom-actions.js" type="text/javascript"></script>
|
||||
|
||||
<script src="editor-app/configuration/properties.js" type="text/javascript"></script>
|
||||
<script src="editor-app/configuration/properties-custom-controllers.js" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,6 @@
|
|||
package com.len.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.len.entity.BlogArticle;
|
||||
|
@ -8,16 +9,14 @@ import com.len.service.ArticleCategoryService;
|
|||
import com.len.service.BlogArticleService;
|
||||
import com.len.service.BlogCategoryService;
|
||||
import com.len.util.IpUtil;
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.LenResponse;
|
||||
import com.len.util.ReType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tk.mybatis.mapper.entity.Condition;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -80,7 +79,7 @@ public class ArticleController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping("/article/getDetail/{code}")
|
||||
public JsonUtil detail(@PathVariable("code") String code, HttpServletRequest request) {
|
||||
public LenResponse detail(@PathVariable("code") String code, HttpServletRequest request) {
|
||||
String ip = IpUtil.getIp(request);
|
||||
return articleService.detail(code, ip);
|
||||
}
|
||||
|
@ -104,11 +103,10 @@ public class ArticleController {
|
|||
|
||||
@GetMapping("/article/list/order/read")
|
||||
public ReType getArticleByReadNumber() {
|
||||
Condition condition = new Condition(BlogArticle.class);
|
||||
QueryWrapper<BlogArticle> articleQueryWrapper = new QueryWrapper<>();
|
||||
articleQueryWrapper.orderByDesc("read_number");
|
||||
PageHelper.startPage(1, 5);
|
||||
condition.createCriteria();
|
||||
condition.orderBy("readNumber").desc();
|
||||
List<BlogArticle> articles = articleService.selectByExample(condition);
|
||||
List<BlogArticle> articles = articleService.list(articleQueryWrapper);
|
||||
articles.forEach(s -> {
|
||||
s.setContent(null);
|
||||
String title = s.getTitle();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.len.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.len.entity.SysRole;
|
||||
import com.len.entity.SysRoleUser;
|
||||
import com.len.entity.SysUser;
|
||||
|
@ -7,7 +8,7 @@ import com.len.service.RoleService;
|
|||
import com.len.service.RoleUserService;
|
||||
import com.len.service.SysUserService;
|
||||
import com.len.util.JWTUtil;
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.LenResponse;
|
||||
import com.len.util.Md5Util;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -19,7 +20,6 @@ import org.springframework.web.bind.annotation.CrossOrigin;
|
|||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import tk.mybatis.mapper.entity.Condition;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -33,7 +33,7 @@ import java.util.stream.Collectors;
|
|||
@RestController
|
||||
@RequestMapping("/")
|
||||
@Slf4j
|
||||
public class SignController {
|
||||
public class AuthController {
|
||||
|
||||
private static final String INIT_BLOG_ROLE = "blogAdmin";
|
||||
|
||||
|
@ -52,13 +52,14 @@ public class SignController {
|
|||
|
||||
@ApiOperation(value = "/blogLogin", httpMethod = "POST", notes = "登录method")
|
||||
@PostMapping(value = "/blogLogin")
|
||||
public JsonUtil blogLogin(SysUser user) {
|
||||
public LenResponse blogLogin(SysUser user) {
|
||||
if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) {
|
||||
throw new UnknownAccountException("用户名或密码不能为空");
|
||||
}
|
||||
String pass = user.getPassword();
|
||||
user.setPassword(null);
|
||||
SysUser sysUser = sysUserService.selectOne(user);
|
||||
QueryWrapper<SysUser> userQueryWrapper = new QueryWrapper<>(user);
|
||||
SysUser sysUser = sysUserService.getOne(userQueryWrapper);
|
||||
if (sysUser == null) {
|
||||
throw new UnknownAccountException("用户名或密码错误");
|
||||
}
|
||||
|
@ -67,9 +68,9 @@ public class SignController {
|
|||
throw new UnknownAccountException("用户名或密码错误");
|
||||
}
|
||||
|
||||
Condition condition = new Condition(SysRoleUser.class);
|
||||
condition.createCriteria().andEqualTo("userId", sysUser.getId());
|
||||
List<SysRoleUser> sysRoleUsers = roleUserService.selectByExample(condition);
|
||||
QueryWrapper<SysRoleUser> roleUserQueryWrapper = new QueryWrapper<>();
|
||||
roleUserQueryWrapper.eq("user_id", sysUser.getId());
|
||||
List<SysRoleUser> sysRoleUsers = roleUserService.list(roleUserQueryWrapper);
|
||||
|
||||
if (sysRoleUsers.isEmpty()) {
|
||||
throw new UnknownAccountException("权限不足");
|
||||
|
@ -79,9 +80,9 @@ public class SignController {
|
|||
.map(SysRoleUser::getRoleId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
condition = new Condition(SysRole.class);
|
||||
condition.createCriteria().andIn("id", roleList);
|
||||
List<SysRole> sysRoles = roleService.selectByExample(condition);
|
||||
QueryWrapper<SysRole> roleQueryWrapper = new QueryWrapper<>();
|
||||
roleQueryWrapper.in("id", roleList);
|
||||
List<SysRole> sysRoles = roleService.list(roleQueryWrapper);
|
||||
if (roles == null || roles.isEmpty()) {
|
||||
log.error("not init blog roles!");
|
||||
roles.add(INIT_BLOG_ROLE);
|
||||
|
@ -95,6 +96,6 @@ public class SignController {
|
|||
.map(SysRole::getRoleName)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return new JsonUtil(true, JWTUtil.sign(sysUser.getUsername(), sysUser.getId(), roleNames, sysUser.getPassword()), 200);
|
||||
return new LenResponse(true, JWTUtil.sign(sysUser.getUsername(), sysUser.getId(), roleNames, sysUser.getPassword()), 200);
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ import com.len.entity.BlogArticle;
|
|||
import com.len.entity.BlogCategory;
|
||||
import com.len.model.Article;
|
||||
import com.len.service.*;
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.LenResponse;
|
||||
import com.len.util.ReType;
|
||||
import com.len.util.UploadUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -18,7 +18,6 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
|
@ -58,36 +57,36 @@ public class BlogAdminController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping("/article/getDetail/{code}")
|
||||
public JsonUtil getDetail(@PathVariable("code") String code) {
|
||||
public LenResponse getDetail(@PathVariable("code") String code) {
|
||||
return articleService.getDetail(code);
|
||||
}
|
||||
|
||||
@GetMapping("/article/getCategory")
|
||||
public JsonUtil getCategory() {
|
||||
JsonUtil json = new JsonUtil();
|
||||
List<BlogCategory> categories = categoryService.selectAll();
|
||||
public LenResponse getCategory() {
|
||||
LenResponse json = new LenResponse();
|
||||
List<BlogCategory> categories = categoryService.list();
|
||||
categories.sort(Comparator.comparing(BlogCategory::getSequence));
|
||||
json.setData(categories);
|
||||
return json;
|
||||
}
|
||||
|
||||
@PostMapping("/article/addImage")
|
||||
public JsonUtil addImage(MultipartHttpServletRequest request) {
|
||||
public LenResponse addImage(MultipartHttpServletRequest request) {
|
||||
MultipartFile multipartFile = request.getFile("file");
|
||||
String path = uploadUtil.upload(multipartFile);
|
||||
JsonUtil json = new JsonUtil();
|
||||
LenResponse json = new LenResponse();
|
||||
StringBuffer requestURL = request.getRequestURL();
|
||||
int serverPort = request.getServerPort();
|
||||
int i = requestURL.indexOf(String.valueOf(serverPort));
|
||||
String url = requestURL.substring(0, i);
|
||||
json.setData(url + String.valueOf(serverPort) + "/img/" + path);
|
||||
json.setData(url + serverPort + "/img/" + path);
|
||||
json.setFlag(true);
|
||||
return json;
|
||||
}
|
||||
|
||||
@PostMapping("/article/add")
|
||||
public JsonUtil addArticle(@RequestBody ArticleDetail detail) {
|
||||
JsonUtil json = new JsonUtil();
|
||||
public LenResponse addArticle(@RequestBody ArticleDetail detail) {
|
||||
LenResponse json = new LenResponse();
|
||||
json.setStatus(400);
|
||||
Article article = detail.getArticle();
|
||||
if (article == null) {
|
||||
|
@ -118,8 +117,8 @@ public class BlogAdminController {
|
|||
}
|
||||
|
||||
@PostMapping("/article/update")
|
||||
public JsonUtil updateArticle(@RequestBody ArticleDetail detail) {
|
||||
JsonUtil json = new JsonUtil();
|
||||
public LenResponse updateArticle(@RequestBody ArticleDetail detail) {
|
||||
LenResponse json = new LenResponse();
|
||||
Article article = detail.getArticle();
|
||||
json.setFlag(false);
|
||||
json.setStatus(400);
|
||||
|
|
|
@ -28,7 +28,7 @@ public class BlogCategoryController {
|
|||
|
||||
@GetMapping("/menu")
|
||||
public List<Map> menuList() {
|
||||
List<BlogCategory> categories = categoryService.selectAll();
|
||||
List<BlogCategory> categories = categoryService.list();
|
||||
categories.sort(Comparator.comparing(BlogCategory::getSequence));
|
||||
List<Map> cates = new ArrayList<>();
|
||||
for (BlogCategory category : categories) {
|
||||
|
|
|
@ -42,7 +42,7 @@ public class TagController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/getTag")
|
||||
public JSONArray label() {
|
||||
List<BlogTag> blogLabels = blogLabelService.selectAll();
|
||||
List<BlogTag> blogLabels = blogLabelService.list();
|
||||
JSONArray array = JSONArray.parseArray(JSON.toJSONString(blogLabels));
|
||||
int i = 0;
|
||||
JSONObject object;
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package com.len.core;
|
||||
|
||||
import com.len.core.exception.UnauthorizedException;
|
||||
import com.len.menu.LoginType;
|
||||
import com.len.util.JwtToken;
|
||||
import org.apache.shiro.util.StringUtils;
|
||||
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
|
||||
import org.apache.shiro.web.util.WebUtils;
|
||||
|
||||
import javax.security.auth.Subject;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -35,7 +33,7 @@ public class MyBasicHttpAuthenticationFilter extends BasicHttpAuthenticationFilt
|
|||
protected boolean executeLogin(ServletRequest request, ServletResponse response) throws Exception {
|
||||
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
|
||||
String token = httpServletRequest.getHeader("Authorization");
|
||||
JwtToken jwtToken = new JwtToken(token, "BlogLogin");
|
||||
JwtToken jwtToken = new JwtToken(token, LoginType.BLOG);
|
||||
getSubject(request, response).login(jwtToken);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.len.core.exception;
|
||||
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.LenResponse;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.UnknownAccountException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
@ -19,19 +19,19 @@ public class CustomException {
|
|||
|
||||
@ResponseStatus(HttpStatus.UNAUTHORIZED)
|
||||
@ExceptionHandler(AuthenticationException.class)
|
||||
public JsonUtil getAuthenticationException(AuthenticationException e) {
|
||||
return new JsonUtil(false, e.getMessage(), 401);
|
||||
public LenResponse getAuthenticationException(AuthenticationException e) {
|
||||
return new LenResponse(false, e.getMessage(), 401);
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ExceptionHandler(UnknownAccountException.class)
|
||||
public JsonUtil getUnknownAccountException(UnknownAccountException e) {
|
||||
return new JsonUtil(false, e.getMessage(), 401);
|
||||
public LenResponse getUnknownAccountException(UnknownAccountException e) {
|
||||
return new LenResponse(false, e.getMessage(), 401);
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ExceptionHandler(UnauthorizedException.class)
|
||||
public JsonUtil getUnauthorizedException(UnauthorizedException e) {
|
||||
return new JsonUtil(false, e.getMessage(), 401);
|
||||
public LenResponse getUnauthorizedException(UnauthorizedException e) {
|
||||
return new LenResponse(false, e.getMessage(), 401);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
package com.len.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Table(name = "blog_article_category")
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
@TableName(value = "blog_article_category")
|
||||
public class ArticleCategory {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@TableId(value = "id", type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 文章id
|
||||
*/
|
||||
@Column(name = "article_id")
|
||||
@TableField(value = "article_id")
|
||||
private String articleId;
|
||||
|
||||
/**
|
||||
* 标签id
|
||||
*/
|
||||
@Column(name = "category_id")
|
||||
@TableField(value = "category_id")
|
||||
private String categoryId;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package com.len.entity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
@Table(name = "blog_article_tag")
|
||||
@TableName(value = "blog_article_tag")
|
||||
public class ArticleTag {
|
||||
@Id
|
||||
@Column(name = "article_id")
|
||||
|
||||
@TableId(value = "article_id", type = IdType.UUID)
|
||||
private String articleId;
|
||||
|
||||
@Column(name = "tag_id")
|
||||
@TableId(value = "tag_id", type = IdType.UUID)
|
||||
private String tagId;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,64 +1,70 @@
|
|||
package com.len.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
|
||||
@Table(name = "blog_article")
|
||||
@TableName(value = "blog_article")
|
||||
@Data
|
||||
public class BlogArticle {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
|
||||
@TableId(value = "id", type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* code
|
||||
*/
|
||||
@TableField(value = "code")
|
||||
private String code;
|
||||
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@TableField(value = "title")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 列表缩略图
|
||||
*/
|
||||
@Column(name="first_img")
|
||||
@TableField(value="first_img")
|
||||
private String firstImg;
|
||||
|
||||
/**
|
||||
* 阅读次数
|
||||
*/
|
||||
@Column(name = "read_number")
|
||||
@TableField(value = "read_number")
|
||||
private Integer readNumber;
|
||||
|
||||
/**
|
||||
* 次序(置顶功能)
|
||||
*/
|
||||
@Column(name = "top_num")
|
||||
@TableField(value = "top_num")
|
||||
private Integer topNum;
|
||||
|
||||
@Column(name = "create_by")
|
||||
@TableField(value = "create_by")
|
||||
private String createBy;
|
||||
|
||||
@Column(name = "update_by")
|
||||
@TableField(value = "update_by")
|
||||
private String updateBy;
|
||||
|
||||
@Column(name = "create_date")
|
||||
@TableField(value = "create_date")
|
||||
private Date createDate;
|
||||
|
||||
@Column(name = "update_date")
|
||||
@TableField(value = "update_date")
|
||||
private Date updateDate;
|
||||
|
||||
/**
|
||||
* 文章内容
|
||||
*/
|
||||
@TableField(value = "content")
|
||||
private String content;
|
||||
|
||||
@Column(name = "del_flag")
|
||||
@TableField(value = "del_flag")
|
||||
private Byte delFlag;
|
||||
|
||||
|
||||
|
|
|
@ -1,43 +1,48 @@
|
|||
package com.len.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
@Table(name = "blog_category")
|
||||
import java.util.Date;
|
||||
|
||||
@TableName(value = "blog_category")
|
||||
public class BlogCategory {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@TableId(value = "id", type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
@Column(name="sequence")
|
||||
@TableField(value="sequence")
|
||||
private Byte sequence;
|
||||
|
||||
/**
|
||||
* 搜索code
|
||||
*/
|
||||
@TableField(value="code")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 类别名称
|
||||
*/
|
||||
@TableField(value="name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 上层id(目前最多两次层)
|
||||
*/
|
||||
@Column(name = "parent_id")
|
||||
@TableField(value = "parent_id")
|
||||
private String parentId;
|
||||
|
||||
@Column(name = "create_by")
|
||||
@TableField(value = "create_by")
|
||||
private String createBy;
|
||||
|
||||
@Column(name = "update_by")
|
||||
@TableField(value = "update_by")
|
||||
private String updateBy;
|
||||
|
||||
@Column(name = "create_date")
|
||||
@TableField(value = "create_date")
|
||||
private Date createDate;
|
||||
|
||||
@Column(name = "update_date")
|
||||
@TableField(value = "update_date")
|
||||
private Date updateDate;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,27 +1,25 @@
|
|||
package com.len.entity;
|
||||
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import tk.mybatis.mapper.annotation.ColumnType;
|
||||
import tk.mybatis.mapper.annotation.KeySql;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Table(name = "blog_tag")
|
||||
@TableName(value = "blog_tag")
|
||||
public class BlogTag {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@TableId(value = "id", type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 标签code
|
||||
*/
|
||||
@Column(name = "tag_code")
|
||||
@TableField(value = "tag_code")
|
||||
private String tagCode;
|
||||
|
||||
/**
|
||||
* 标签name
|
||||
*/
|
||||
@Column(name = "tag_name")
|
||||
@TableField(value = "tag_name")
|
||||
private String tagName;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Param;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public interface ArticleCategoryMapper extends BaseMapper<ArticleCategory, String> {
|
||||
public interface ArticleCategoryMapper extends BaseMapper<ArticleCategory> {
|
||||
|
||||
void delByIds(@Param("ids") List<String> ids);
|
||||
}
|
|
@ -2,7 +2,6 @@ package com.len.mapper;
|
|||
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.entity.ArticleTag;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface ArticleTagMapper extends BaseMapper<ArticleTag,String> {
|
||||
public interface ArticleTagMapper extends BaseMapper<ArticleTag> {
|
||||
}
|
|
@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Param;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface BlogArticleMapper extends BaseMapper<BlogArticle, String> {
|
||||
public interface BlogArticleMapper extends BaseMapper<BlogArticle> {
|
||||
|
||||
List<Article> indexSelect();
|
||||
|
||||
|
|
|
@ -3,5 +3,5 @@ package com.len.mapper;
|
|||
import com.len.base.BaseMapper;
|
||||
import com.len.entity.BlogCategory;
|
||||
|
||||
public interface BlogCategoryMapper extends BaseMapper<BlogCategory, String> {
|
||||
public interface BlogCategoryMapper extends BaseMapper<BlogCategory> {
|
||||
}
|
|
@ -3,5 +3,5 @@ package com.len.mapper;
|
|||
import com.len.base.BaseMapper;
|
||||
import com.len.entity.BlogTag;
|
||||
|
||||
public interface BlogTagMapper extends BaseMapper<BlogTag, String> {
|
||||
public interface BlogTagMapper extends BaseMapper<BlogTag> {
|
||||
}
|
|
@ -4,8 +4,7 @@ import com.len.base.BaseService;
|
|||
import com.len.entity.ArticleDetail;
|
||||
import com.len.entity.BlogArticle;
|
||||
import com.len.model.Article;
|
||||
import com.len.util.JsonUtil;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.len.util.LenResponse;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -19,9 +18,9 @@ public interface BlogArticleService extends BaseService<BlogArticle, String> {
|
|||
|
||||
List<Article> indexSelect();
|
||||
|
||||
public JsonUtil getDetail(String code);
|
||||
public LenResponse getDetail(String code);
|
||||
|
||||
public JsonUtil detail(String code,String ip);
|
||||
public LenResponse detail(String code, String ip);
|
||||
|
||||
List<Article> selectArticle(String code);
|
||||
|
||||
|
|
|
@ -22,11 +22,6 @@ public class ArticleCategoryServiceImpl extends BaseServiceImpl<ArticleCategory,
|
|||
@Autowired
|
||||
private ArticleCategoryMapper articleCategoryMapper;
|
||||
|
||||
@Override
|
||||
public BaseMapper<ArticleCategory, String> getMappser() {
|
||||
return articleCategoryMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delByIds(List<String> ids) {
|
||||
articleCategoryMapper.delByIds(ids);
|
||||
|
|
|
@ -18,9 +18,4 @@ public class ArticleTagServiceImpl extends BaseServiceImpl<ArticleTag, String> i
|
|||
|
||||
@Autowired
|
||||
private ArticleTagMapper articleTagMapper;
|
||||
|
||||
@Override
|
||||
public BaseMapper<ArticleTag, String> getMappser() {
|
||||
return articleTagMapper;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.len.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.base.impl.BaseServiceImpl;
|
||||
import com.len.core.LenUser;
|
||||
import com.len.entity.*;
|
||||
|
@ -11,12 +11,11 @@ import com.len.model.SimpleArticle;
|
|||
import com.len.redis.RedisService;
|
||||
import com.len.service.*;
|
||||
import com.len.util.BeanUtil;
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.LenResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.mapper.entity.Condition;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -54,16 +53,13 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
private static final Pattern SRC = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)");
|
||||
|
||||
|
||||
@Override
|
||||
public BaseMapper<BlogArticle, String> getMappser() {
|
||||
return blogArticleMapper;
|
||||
}
|
||||
|
||||
private ArticleDetail getArticleByCode(String code) {
|
||||
Condition condition = new Condition(BlogArticle.class);
|
||||
condition.createCriteria().andEqualTo("code", code)
|
||||
.andEqualTo("delFlag", 0);
|
||||
List<BlogArticle> articles = selectByExample(condition);
|
||||
|
||||
QueryWrapper<BlogArticle> blogArticleQueryWrapper = new QueryWrapper<>();
|
||||
blogArticleQueryWrapper.eq("code", code).eq("del_flag", 0);
|
||||
blogArticleMapper.selectList(blogArticleQueryWrapper);
|
||||
List<BlogArticle> articles = blogArticleMapper.selectList(blogArticleQueryWrapper);
|
||||
;
|
||||
if (articles.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
@ -77,7 +73,7 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
|
||||
String createBy = blogArticle.getCreateBy();
|
||||
if (!StringUtils.isEmpty(createBy)) {
|
||||
SysUser sysUser = sysUserService.selectByPrimaryKey(createBy);
|
||||
SysUser sysUser = sysUserService.getById(createBy);
|
||||
if (sysUser != null) {
|
||||
article.setCreateName(sysUser.getUsername());
|
||||
}
|
||||
|
@ -87,18 +83,20 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
|
||||
ArticleTag articleTag = new ArticleTag();
|
||||
articleTag.setArticleId(blogArticle.getId());
|
||||
List<ArticleTag> articleTags = articleTagService.select(articleTag);
|
||||
QueryWrapper<ArticleTag> tagQueryWrapper = new QueryWrapper<>(articleTag);
|
||||
List<ArticleTag> articleTags = articleTagService.list(tagQueryWrapper);
|
||||
if (!articleTags.isEmpty()) {
|
||||
condition = new Condition(BlogTag.class);
|
||||
condition.createCriteria().andIn("id", articleTags.stream()
|
||||
QueryWrapper<BlogTag> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("id", articleTags.stream()
|
||||
.map(ArticleTag::getTagId).collect(Collectors.toList()));
|
||||
List<BlogTag> blogTags = tagService.selectByExample(condition);
|
||||
List<BlogTag> blogTags = tagService.list(queryWrapper);
|
||||
|
||||
detail.setTags(blogTags.stream().map(BlogTag::getTagCode).collect(Collectors.toList()));
|
||||
}
|
||||
ArticleCategory articleCategory = new ArticleCategory();
|
||||
articleCategory.setArticleId(blogArticle.getId());
|
||||
List<ArticleCategory> articleCategories = articleCategoryService.select(articleCategory);
|
||||
QueryWrapper<ArticleCategory> blogTagQueryWrapper = new QueryWrapper<>(articleCategory);
|
||||
List<ArticleCategory> articleCategories = articleCategoryService.list(blogTagQueryWrapper);
|
||||
if (!articleCategories.isEmpty()) {
|
||||
detail.setCategory(articleCategories.stream().map(ArticleCategory::getCategoryId)
|
||||
.collect(Collectors.toList()));
|
||||
|
@ -112,8 +110,8 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
}
|
||||
|
||||
@Override
|
||||
public JsonUtil getDetail(String code) {
|
||||
JsonUtil json = new JsonUtil();
|
||||
public LenResponse getDetail(String code) {
|
||||
LenResponse json = new LenResponse();
|
||||
ArticleDetail detail = getArticleByCode(code);
|
||||
if (detail == null) {
|
||||
json.setStatus(404);
|
||||
|
@ -127,8 +125,8 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
}
|
||||
|
||||
@Override
|
||||
public JsonUtil detail(String code, String ip) {
|
||||
JsonUtil json = new JsonUtil();
|
||||
public LenResponse detail(String code, String ip) {
|
||||
LenResponse json = new LenResponse();
|
||||
ArticleDetail detail = getArticleByCode(code);
|
||||
if (detail == null) {
|
||||
json.setStatus(404);
|
||||
|
@ -192,7 +190,8 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
}
|
||||
BlogArticle article = new BlogArticle();
|
||||
article.setCode(result.toString());
|
||||
BlogArticle blogArticle = selectOne(article);
|
||||
QueryWrapper<BlogArticle> articleQueryWrapper = new QueryWrapper<>(article);
|
||||
BlogArticle blogArticle = blogArticleMapper.selectOne(articleQueryWrapper);
|
||||
if (blogArticle == null) {
|
||||
return result.toString();
|
||||
} else {
|
||||
|
@ -227,7 +226,7 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
BlogArticle blogArticle = new BlogArticle();
|
||||
BeanUtil.copyNotNullBean(article, blogArticle);
|
||||
|
||||
int result = insert(blogArticle);
|
||||
int result = blogArticleMapper.insert(blogArticle);
|
||||
|
||||
List<ArticleCategory> categories = new ArrayList<>();
|
||||
for (String cateId : articleDetail.getCategory()) {
|
||||
|
@ -237,7 +236,7 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
articleCategory.setCategoryId(cateId);
|
||||
categories.add(articleCategory);
|
||||
}
|
||||
int insertResult = articleCategoryService.insertList(categories);
|
||||
boolean insertResult = articleCategoryService.saveBatch(categories);
|
||||
|
||||
List<ArticleTag> articleTags = new ArrayList<>();
|
||||
List<BlogTag> blogTags = new ArrayList<>();
|
||||
|
@ -252,7 +251,8 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
|
||||
blogTag = new BlogTag();
|
||||
blogTag.setTagCode(tag);
|
||||
oldTag = tagService.selectOne(blogTag);
|
||||
QueryWrapper<BlogTag> blogTagQueryWrapper = new QueryWrapper<>(blogTag);
|
||||
oldTag = tagService.getOne(blogTagQueryWrapper);
|
||||
|
||||
if (oldTag != null) {
|
||||
articleTag.setTagId(oldTag.getId());
|
||||
|
@ -264,12 +264,12 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
articleTag.setTagId(id);
|
||||
}
|
||||
}
|
||||
articleTagService.insertList(articleTags);
|
||||
articleTagService.saveBatch(articleTags);
|
||||
if (!blogTags.isEmpty()) {
|
||||
tagService.insertList(blogTags);
|
||||
tagService.saveBatch(blogTags);
|
||||
}
|
||||
|
||||
return result > 0 && insertResult > 0;
|
||||
return result > 0 && insertResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -292,11 +292,11 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
}
|
||||
BlogArticle blogArticle = new BlogArticle();
|
||||
BeanUtil.copyNotNullBean(article, blogArticle);
|
||||
updateByPrimaryKey(blogArticle);
|
||||
blogArticleMapper.updateById(blogArticle);
|
||||
|
||||
ArticleTag articleTag = new ArticleTag();
|
||||
articleTag.setArticleId(article.getId());
|
||||
articleTagService.delete(articleTag);
|
||||
articleTagService.removeById(article.getId());
|
||||
|
||||
List<ArticleTag> articleTags = new ArrayList<>();
|
||||
List<BlogTag> blogTags = new ArrayList<>();
|
||||
|
@ -307,7 +307,8 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
articleTag.setArticleId(article.getId());
|
||||
BlogTag blogTag = new BlogTag();
|
||||
blogTag.setTagCode(tag);
|
||||
BlogTag tag1 = tagService.selectOne(blogTag);
|
||||
QueryWrapper<BlogTag> blogTagQueryWrapper = new QueryWrapper<>(blogTag);
|
||||
BlogTag tag1 = tagService.getOne(blogTagQueryWrapper);
|
||||
if (tag1 != null) {
|
||||
articleTag.setTagId(tag1.getId());
|
||||
} else {
|
||||
|
@ -322,13 +323,14 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
}
|
||||
}
|
||||
if (!blogTags.isEmpty()) {
|
||||
tagService.insertList(blogTags);
|
||||
tagService.saveBatch(blogTags);
|
||||
}
|
||||
|
||||
articleTagService.insertList(articleTags);
|
||||
articleTagService.saveBatch(articleTags);
|
||||
ArticleCategory articleCategory = new ArticleCategory();
|
||||
articleCategory.setArticleId(article.getId());
|
||||
List<ArticleCategory> categories = articleCategoryService.select(articleCategory);
|
||||
QueryWrapper<ArticleCategory> categoryQueryWrapper = new QueryWrapper<>(articleCategory);
|
||||
List<ArticleCategory> categories = articleCategoryService.list(categoryQueryWrapper);
|
||||
if (!categories.isEmpty()) {
|
||||
List<String> cateIds = categories.stream().map(ArticleCategory::getCategoryId)
|
||||
.collect(Collectors.toList());
|
||||
|
@ -353,7 +355,7 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
category.setArticleId(article.getId());
|
||||
category.setCategoryId(ca);
|
||||
}
|
||||
articleCategoryService.insertList(articleCategories);
|
||||
articleCategoryService.saveBatch(articleCategories);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -369,9 +371,9 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
|
|||
if (!StringUtils.isBlank(str)) {
|
||||
if (StringUtils.isEmpty(redisService.get(str))) {
|
||||
redisService.set(str, "true", 60 * 30L);
|
||||
BlogArticle article = selectByPrimaryKey(articleId);
|
||||
BlogArticle article = blogArticleMapper.selectById(articleId);
|
||||
article.setReadNumber(article.getReadNumber() + 1);
|
||||
updateByPrimaryKey(article);
|
||||
blogArticleMapper.updateById(article);
|
||||
return article.getReadNumber();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,4 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class BlogCategoryServiceImpl extends BaseServiceImpl<BlogCategory, String> implements BlogCategoryService {
|
||||
|
||||
@Autowired
|
||||
private BlogCategoryMapper blogCategoryMapper;
|
||||
|
||||
@Override
|
||||
public BaseMapper<BlogCategory, String> getMappser() {
|
||||
return blogCategoryMapper;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package com.len.service.impl;
|
||||
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.base.impl.BaseServiceImpl;
|
||||
import com.len.entity.BlogTag;
|
||||
import com.len.mapper.BlogTagMapper;
|
||||
import com.len.service.BlogTagService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
|
@ -15,12 +12,4 @@ import org.springframework.stereotype.Service;
|
|||
*/
|
||||
@Service
|
||||
public class BlogTagServiceImpl extends BaseServiceImpl<BlogTag, String> implements BlogTagService {
|
||||
|
||||
@Autowired
|
||||
private BlogTagMapper blogTagMapper;
|
||||
|
||||
@Override
|
||||
public BaseMapper<BlogTag, String> getMappser() {
|
||||
return blogTagMapper;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.len.base;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zxm
|
||||
* @date 2019-11-12.
|
||||
*/
|
||||
@Data
|
||||
public class AbstractEntity implements Serializable {
|
||||
|
||||
@TableId(type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date createDate;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private Date updateDate;
|
||||
}
|
|
@ -1,62 +1,99 @@
|
|||
package com.len.base;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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 javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/19.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Slf4j
|
||||
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", "403");
|
||||
map.put("message", "无权限");
|
||||
return JSON.toJSONString(map);
|
||||
} else {
|
||||
String message = "权限不足";
|
||||
try {
|
||||
message = URLEncoder.encode(message, "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error("BaseController:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "redirect:/error/403?message=" + message;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isAjaxRequest(HttpServletRequest request) {
|
||||
String requestedWith = request.getHeader("x-requested-with");
|
||||
return requestedWith != null && requestedWith.equalsIgnoreCase("XMLHttpRequest");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package com.len.base;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.len.util.LenResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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 javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/19.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Slf4j
|
||||
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", "403");
|
||||
map.put("message", "无权限");
|
||||
return JSON.toJSONString(map);
|
||||
} else {
|
||||
String message = "权限不足";
|
||||
try {
|
||||
message = URLEncoder.encode(message, "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error("BaseController:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "redirect:/error/403?message=" + message;
|
||||
}
|
||||
}
|
||||
|
||||
@ExceptionHandler( {Exception.class})
|
||||
public void runTimeException(HttpServletRequest request, HttpServletResponse response) {
|
||||
response.setContentType("application/json");
|
||||
try {
|
||||
LenResponse lenResponse = new LenResponse(false, "处理错误");
|
||||
response.getWriter().write(JSON.toJSONString(lenResponse));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isAjaxRequest(HttpServletRequest request) {
|
||||
String requestedWith = request.getHeader("x-requested-with");
|
||||
return requestedWith != null && requestedWith.equalsIgnoreCase("XMLHttpRequest");
|
||||
}
|
||||
|
||||
public LenResponse resp(boolean flag, String msg) {
|
||||
return new LenResponse(flag, msg);
|
||||
}
|
||||
|
||||
public LenResponse resp(boolean flag) {
|
||||
return resp(flag, null);
|
||||
}
|
||||
|
||||
public LenResponse succ(String msg) {
|
||||
return resp(true, msg);
|
||||
}
|
||||
|
||||
public LenResponse succ() {
|
||||
return succ(null);
|
||||
}
|
||||
|
||||
public LenResponse error(String msg) {
|
||||
return resp(false, msg);
|
||||
}
|
||||
|
||||
public LenResponse error() {
|
||||
return error(null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.len.base;
|
||||
|
||||
import tk.mybatis.mapper.common.IdsMapper;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.len.util.ReType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -11,59 +11,13 @@ import java.util.List;
|
|||
* @email 154040976@qq.com
|
||||
* mapper封装 crud
|
||||
*/
|
||||
public interface BaseMapper<T, E extends Serializable> extends tk.mybatis.mapper.common.Mapper<T>, LenInsertListAndinsertUseGeneratedKeysMapper<T>, IdsMapper<T> {
|
||||
/*
|
||||
*//**
|
||||
* 根据id删除
|
||||
* @param id
|
||||
* @return
|
||||
*//*
|
||||
int deleteByPrimaryKey(E id);
|
||||
public interface BaseMapper<T> extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T> {
|
||||
|
||||
*//**
|
||||
* 插入
|
||||
* @param record
|
||||
* @return
|
||||
*//*
|
||||
int insert(T record);
|
||||
public List<T> selectListByPage(T record);
|
||||
|
||||
*//**
|
||||
*插入非空字段
|
||||
* @param record
|
||||
* @return
|
||||
*//*
|
||||
int insertSelective(T record);
|
||||
public ReType show(T t, int page, int limit);
|
||||
|
||||
*//**
|
||||
* 根据id查询
|
||||
* @param id
|
||||
* @return
|
||||
*//*
|
||||
T selectByPrimaryKey(E id);
|
||||
public ReType getList(T t, int page, int limit);
|
||||
|
||||
*//**
|
||||
* 更新非空数据
|
||||
* @param record
|
||||
* @return
|
||||
*//*
|
||||
int updateByPrimaryKeySelective(T record);
|
||||
|
||||
*//**
|
||||
* 更新
|
||||
* @param record
|
||||
* @return
|
||||
*//*
|
||||
int updateByPrimaryKey(T record);
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
List<T> selectListByPage(T record);
|
||||
public String showAll(T t);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.len.base;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.len.util.ReType;
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
@ -12,64 +12,12 @@ import java.util.List;
|
|||
* @email 154040976@qq.com
|
||||
* 通用service层
|
||||
*/
|
||||
public interface BaseService<T, E extends Serializable> {
|
||||
|
||||
public List<T> select(T t);
|
||||
|
||||
public List<T> selectAll();
|
||||
|
||||
public List<T> selectByIds(String ids);
|
||||
|
||||
public int selectCount(T t);
|
||||
|
||||
public int deleteByPrimaryKey(E id);
|
||||
|
||||
public int insert(T record);
|
||||
|
||||
public int insertSelective(T record);
|
||||
|
||||
public int updateByPrimaryKeySelective(T record);
|
||||
|
||||
public int updateByPrimaryKey(T record);
|
||||
|
||||
public List<T> selectListByPage(T record);
|
||||
|
||||
public int deleteByPrimaryKey(Object o);
|
||||
|
||||
public int delete(T t);
|
||||
|
||||
public boolean existsWithPrimaryKey(Object o);
|
||||
|
||||
public T selectByPrimaryKey(Object o);
|
||||
|
||||
public T selectOne(T t);
|
||||
|
||||
public int deleteByIds(String s);
|
||||
|
||||
public int insertList(List<T> list);
|
||||
|
||||
public int insertUseGeneratedKeys(T t);
|
||||
|
||||
public int deleteByExample(Object o);
|
||||
|
||||
public List<T> selectByExample(Object o);
|
||||
|
||||
public int selectCountByExample(Object o);
|
||||
|
||||
public T selectOneByExample(Object o);
|
||||
|
||||
public int updateByExample(T t, Object o);
|
||||
|
||||
public int updateByExampleSelective(T t, Object o);
|
||||
|
||||
public List<T> selectByExampleAndRowBounds(Object o, RowBounds rowBounds);
|
||||
|
||||
public List<T> selectByRowBounds(T t, RowBounds rowBounds);
|
||||
public interface BaseService<T,E extends Serializable> extends IService<T> {
|
||||
|
||||
|
||||
public ReType show(T t, int page, int limit);
|
||||
|
||||
public ReType getList(T t, int page, int limit);
|
||||
|
||||
public String showAll(T t);
|
||||
public List<T> showAll(T t);
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
package com.len.base;
|
||||
|
||||
import org.apache.ibatis.annotations.InsertProvider;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/10/12.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@tk.mybatis.mapper.annotation.RegisterMapper
|
||||
public interface LenInsertListAndinsertUseGeneratedKeysMapper<T> {
|
||||
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||
@InsertProvider(type = MySpecialProvider.class, method = "dynamicSQL")
|
||||
int insertList(List<T> recordList);
|
||||
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||
@InsertProvider(type = MySpecialProvider.class, method = "dynamicSQL")
|
||||
int insertUseGeneratedKeys(T record);
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
package com.len.base;
|
||||
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import tk.mybatis.mapper.entity.EntityColumn;
|
||||
import tk.mybatis.mapper.entity.EntityTable;
|
||||
import tk.mybatis.mapper.mapperhelper.EntityHelper;
|
||||
import tk.mybatis.mapper.mapperhelper.MapperHelper;
|
||||
import tk.mybatis.mapper.mapperhelper.MapperTemplate;
|
||||
import tk.mybatis.mapper.mapperhelper.SqlHelper;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/10/12
|
||||
* @email 154040976@qq.com
|
||||
* 重写 SpecialProvider 使得批量方法支持主键自增和自定义自增 (仅测试了mysql)
|
||||
*/
|
||||
public class MySpecialProvider extends MapperTemplate {
|
||||
public MySpecialProvider(Class<?> mapperClass, MapperHelper mapperHelper) {
|
||||
super(mapperClass, mapperHelper);
|
||||
}
|
||||
|
||||
|
||||
public String insertList(MappedStatement ms) {
|
||||
final Class<?> entityClass = getEntityClass(ms);
|
||||
//开始拼sql
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append(SqlHelper.insertIntoTable(entityClass, tableName(entityClass)));
|
||||
boolean keyIsAuto = keyIsAuto(entityClass);
|
||||
sql.append(SqlHelper.insertColumns(entityClass, keyIsAuto, false, false));
|
||||
sql.append(" VALUES ");
|
||||
sql.append("<foreach collection=\"list\" item=\"record\" separator=\",\" >");
|
||||
sql.append("<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">");
|
||||
//获取全部列
|
||||
Set<EntityColumn> columnList = EntityHelper.getColumns(entityClass);
|
||||
|
||||
for (EntityColumn column : columnList) {
|
||||
if (column.isId() && column.isInsertable()) {
|
||||
if (!keyIsAuto) {
|
||||
sql.append(column.getColumnHolder("record")).append(",");
|
||||
}
|
||||
} else if (column.isInsertable()) {
|
||||
sql.append(column.getColumnHolder("record")).append(",");
|
||||
}
|
||||
}
|
||||
sql.append("</trim>");
|
||||
sql.append("</foreach>");
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用insertList insertUseGeneratedKeys
|
||||
* 判断是否为 自增主键 当@GeneratedValue(generator = "JDBC") 为主键自增 删除此注解为自定义
|
||||
*
|
||||
* @param entityClass 当前实体
|
||||
* @return 是否为自增主键 true 是 false 否
|
||||
*/
|
||||
private boolean keyIsAuto(Class<?> entityClass) {
|
||||
EntityTable entityTable = EntityHelper.getEntityTable(entityClass);
|
||||
entityTable.getEntityClassColumns();
|
||||
Set<EntityColumn> entityClassPKColumns = entityTable.getEntityClassPKColumns();
|
||||
for (EntityColumn entityColumn : entityClassPKColumns) {
|
||||
String generator = entityColumn.getGenerator();
|
||||
if ("JDBC".equals(generator)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String insertUseGeneratedKeys(MappedStatement ms) {
|
||||
final Class<?> entityClass = getEntityClass(ms);
|
||||
//开始拼sql
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append(SqlHelper.insertIntoTable(entityClass, tableName(entityClass)));
|
||||
boolean keyIsAuto = keyIsAuto(entityClass);
|
||||
sql.append(SqlHelper.insertColumns(entityClass, keyIsAuto, false, false));
|
||||
sql.append(SqlHelper.insertValuesColumns(entityClass, keyIsAuto, false, false));
|
||||
return sql.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.len.base.handler;
|
||||
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
|
||||
/**
|
||||
* @author zxm
|
||||
* @date 2020/8/11 21:57
|
||||
*/
|
||||
|
||||
|
||||
public interface ExecuteContext {
|
||||
|
||||
void execute(ContextRefreshedEvent event);
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package com.len.base.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.base.BaseService;
|
||||
import com.len.exception.MyException;
|
||||
import com.len.util.ReType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/13.
|
||||
* @email 154040976@qq.com
|
||||
* update by 2019/11/12 mybatisplus
|
||||
*/
|
||||
@Slf4j
|
||||
public class AbstractServiceImpl<T, E extends Serializable> extends ServiceImpl<BaseMapper<T>, T> implements BaseService<T, E> {
|
||||
|
||||
|
||||
/**
|
||||
* 公共展示类
|
||||
*
|
||||
* @param t 实体
|
||||
* @param page 页
|
||||
* @param limit 行
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ReType show(T t, int page, int limit) {
|
||||
List<T> tList = null;
|
||||
Page<T> tPage = PageHelper.startPage(page, limit);
|
||||
try {
|
||||
tList = getBaseMapper().selectListByPage(t);
|
||||
} catch (MyException e) {
|
||||
log.error("class:BaseServiceImpl ->method:show->message:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new ReType(tPage.getTotal(), tList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> showAll(T t) {
|
||||
List<T> tList = null;
|
||||
try {
|
||||
tList = getBaseMapper().selectListByPage(t);
|
||||
} catch (MyException e) {
|
||||
log.error("class:BaseServiceImpl ->method:show->message:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return tList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReType getList(T t, int page, int limit) {
|
||||
List<T> tList = null;
|
||||
Page<T> tPage = PageHelper.startPage(page, limit);
|
||||
try {
|
||||
tList = getBaseMapper().selectListByPage(t);
|
||||
} catch (MyException e) {
|
||||
log.error("class:BaseServiceImpl ->method:getList->message:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new ReType(tPage.getTotal(), tPage.getPageNum(), tList);
|
||||
}
|
||||
}
|
|
@ -1,301 +1,16 @@
|
|||
package com.len.base.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.base.BaseService;
|
||||
import com.len.base.CurrentUser;
|
||||
import com.len.exception.MyException;
|
||||
import com.len.util.ReType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/13.
|
||||
* @email 154040976@qq.com
|
||||
* update by 2019/11/12 tkmapper替换成mybatisplus
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class BaseServiceImpl<T, E extends Serializable> implements BaseService<T, E> {
|
||||
public class BaseServiceImpl<T, E extends Serializable> extends AbstractServiceImpl<T, E> {
|
||||
|
||||
/**
|
||||
* general field(通用字段)
|
||||
*/
|
||||
private static final String CREATE_BY = "createBy";
|
||||
|
||||
private static final String CREATE_DATE = "createDate";
|
||||
|
||||
private static final String UPDATE_BY = "updateBy";
|
||||
|
||||
private static final String UPDATE_DATE = "updateDate";
|
||||
|
||||
//系统默认 id 如果主键为其他字段 则需要自己手动 生成 写入 id
|
||||
private static final String ID = "id";
|
||||
|
||||
private static final String STR = "java.lang.String";
|
||||
|
||||
|
||||
public abstract BaseMapper<T, E> getMappser();
|
||||
|
||||
|
||||
@Override
|
||||
public List<T> select(T t) {
|
||||
return getMappser().select(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> selectAll() {
|
||||
return getMappser().selectAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> selectByIds(String ids) {
|
||||
return getMappser().selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectCount(T t) {
|
||||
return getMappser().selectCount(t);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(E id) {
|
||||
return getMappser().deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(T record) {
|
||||
try {
|
||||
record = addValue(record, true);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return getMappser().insert(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用注入创建 更新信息 可通过super调用
|
||||
*
|
||||
* @param record
|
||||
* @param flag
|
||||
* @return
|
||||
*/
|
||||
public T addValue(T record, boolean flag) {
|
||||
CurrentUser currentUser = (CurrentUser) SecurityUtils.getSubject().getSession().getAttribute("currentPrincipal");
|
||||
//统一处理公共字段
|
||||
Class<?> clazz = record.getClass();
|
||||
String operator, operateDate;
|
||||
try {
|
||||
if (flag) {
|
||||
//添加 id uuid支持
|
||||
Field idField = clazz.getDeclaredField(ID);
|
||||
idField.setAccessible(true);
|
||||
Object o = idField.get(record);
|
||||
Class<?> type = idField.getType();
|
||||
String name = type.getName();
|
||||
if ((o == null) && STR.equals(name)) {
|
||||
//已经有值的情况下 不覆盖
|
||||
idField.set(record, UUID.randomUUID().toString().replace("-", "").toLowerCase());
|
||||
}
|
||||
operator = CREATE_BY;
|
||||
operateDate = CREATE_DATE;
|
||||
} else {
|
||||
operator = UPDATE_BY;
|
||||
operateDate = UPDATE_DATE;
|
||||
}
|
||||
Field field = clazz.getDeclaredField(operator);
|
||||
field.setAccessible(true);
|
||||
field.set(record, currentUser.getId());
|
||||
Field fieldDate = clazz.getDeclaredField(operateDate);
|
||||
fieldDate.setAccessible(true);
|
||||
fieldDate.set(record, new Date());
|
||||
|
||||
} catch (NoSuchFieldException e) {
|
||||
//无此字段
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertSelective(T record) {
|
||||
try {
|
||||
record = addValue(record, true);
|
||||
}catch (Exception e){
|
||||
}
|
||||
return getMappser().insertSelective(record);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKeySelective(T record) {
|
||||
try {
|
||||
record = addValue(record, false);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return getMappser().updateByPrimaryKeySelective(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKey(T record) {
|
||||
try {
|
||||
record = addValue(record, false);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return getMappser().updateByPrimaryKey(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> selectListByPage(T record) {
|
||||
return getMappser().selectListByPage(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(Object o) {
|
||||
return getMappser().deleteByPrimaryKey(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(T t) {
|
||||
return getMappser().delete(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existsWithPrimaryKey(Object o) {
|
||||
return getMappser().existsWithPrimaryKey(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T selectByPrimaryKey(Object o) {
|
||||
return getMappser().selectByPrimaryKey(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T selectOne(T t) {
|
||||
return getMappser().selectOne(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByIds(String s) {
|
||||
return getMappser().deleteByIds(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertList(List<T> list) {
|
||||
return getMappser().insertList(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertUseGeneratedKeys(T t) {
|
||||
return getMappser().insertUseGeneratedKeys(t);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共展示类
|
||||
*
|
||||
* @param t 实体
|
||||
* @param page 页
|
||||
* @param limit 行
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ReType show(T t, int page, int limit) {
|
||||
List<T> tList = null;
|
||||
Page<T> tPage = PageHelper.startPage(page, limit);
|
||||
try {
|
||||
tList = getMappser().selectListByPage(t);
|
||||
} catch (MyException e) {
|
||||
log.error("class:BaseServiceImpl ->method:show->message:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new ReType(tPage.getTotal(), tList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String showAll(T t)
|
||||
{
|
||||
List<T> tList = null;
|
||||
try {
|
||||
tList = getMappser().selectListByPage(t);
|
||||
} catch (MyException e) {
|
||||
// logger.error("class:BaseServiceImpl ->method:show->message:" + e.getMessage());
|
||||
log.error("class:BaseServiceImpl ->method:show->message:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
// ReType reType = new ReType( tList);
|
||||
return JSON.toJSONString(tList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReType getList(T t, int page, int limit) {
|
||||
List<T> tList = null;
|
||||
Page<T> tPage = PageHelper.startPage(page, limit);
|
||||
try {
|
||||
tList = getMappser().selectListByPage(t);
|
||||
} catch (MyException e) {
|
||||
log.error("class:BaseServiceImpl ->method:getList->message:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new ReType(tPage.getTotal(),tPage.getPageNum(), tList);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteByExample(Object o) {
|
||||
return getMappser().deleteByExample(o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<T> selectByExample(Object o) {
|
||||
return getMappser().selectByExample(o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int selectCountByExample(Object o) {
|
||||
return getMappser().selectCountByExample(o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public T selectOneByExample(Object o) {
|
||||
return getMappser().selectOneByExample(o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int updateByExample(T t, Object o) {
|
||||
return getMappser().updateByExample(t,o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int updateByExampleSelective(T t, Object o) {
|
||||
return getMappser().updateByExampleSelective(t,o);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<T> selectByExampleAndRowBounds(Object o, RowBounds rowBounds) {
|
||||
return getMappser().selectByExampleAndRowBounds(o,rowBounds);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<T> selectByRowBounds(T t, RowBounds rowBounds) {
|
||||
return getMappser().selectByRowBounds(t,rowBounds);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.len.menu;
|
||||
|
||||
/**
|
||||
* @author zxm
|
||||
* @date 2020/8/11 23:05
|
||||
*/
|
||||
|
||||
|
||||
public enum LoginType {
|
||||
|
||||
BLOG("BlogLogin"),
|
||||
SYS("UserLogin");
|
||||
|
||||
private String type;
|
||||
|
||||
private LoginType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.type;
|
||||
}
|
||||
}
|
|
@ -16,19 +16,19 @@ import java.util.concurrent.TimeUnit;
|
|||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Service
|
||||
public class RedisService {
|
||||
public class RedisService<T> {
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<Object, Object> redisTemplate;
|
||||
private RedisTemplate<Object, T> redisTemplate;
|
||||
|
||||
@Resource(name = "stringRedisTemplate")
|
||||
private ValueOperations<String, String> valueOps;
|
||||
|
||||
@Resource(name = "redisTemplate")
|
||||
private ValueOperations<Object, Object> valOpsObj;
|
||||
private ValueOperations<Object, T> valOpsObj;
|
||||
|
||||
@Value("${redis.prefix}")
|
||||
private String prefix;
|
||||
|
@ -62,7 +62,7 @@ public class RedisService {
|
|||
* @param key obj key
|
||||
* @return obj value
|
||||
*/
|
||||
public Object getObj(Object key) {
|
||||
public T getObj(Object key) {
|
||||
key = prefix + key.toString();
|
||||
return valOpsObj.get(key);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class RedisService {
|
|||
* @param value obj value
|
||||
* @param second 过期时间 单位户 秒
|
||||
*/
|
||||
public void setObj(Object key, Object value, Long second) {
|
||||
public void setObj(Object key, T value, Long second) {
|
||||
key = prefix + key.toString();
|
||||
valOpsObj.set(key, value, second,TimeUnit.SECONDS);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
package com.len.socket;
|
||||
|
||||
import com.len.util.LenResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.server.PathParam;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@ServerEndpoint(value = "/webSocket/{userId}")
|
||||
public class WebSocketService {
|
||||
|
||||
private static ConcurrentHashMap<String, WebSocketService> socketClient = new ConcurrentHashMap<>();
|
||||
|
||||
private Session session;
|
||||
|
||||
public static ConcurrentHashMap<String, WebSocketService> getClients() {
|
||||
return socketClient;
|
||||
}
|
||||
|
||||
@OnOpen
|
||||
public void onOpen(@PathParam("userId") String userId, Session session) {
|
||||
this.session = session;
|
||||
socketClient.put(userId, this);
|
||||
log.info("【websocket消息】有新的连接, 总数:{}", socketClient.size());
|
||||
}
|
||||
|
||||
@OnClose
|
||||
public void onClose(Session session) {
|
||||
socketClient.remove(session.getId());
|
||||
log.info("【websocket消息】连接断开, 总数:{}", socketClient.size());
|
||||
}
|
||||
|
||||
@OnMessage
|
||||
public void onMessage(String message) {
|
||||
log.info("【websocket消息】收到客户端发来的消息:{}", message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推消息给个人
|
||||
*
|
||||
* @param response
|
||||
* @param userId
|
||||
* @throws IOException
|
||||
*/
|
||||
public void sendMessage(LenResponse response, String userId) throws IOException {
|
||||
WebSocketService webSocketService = socketClient.get(userId);
|
||||
if (webSocketService != null) {
|
||||
try {
|
||||
webSocketService.session.getBasicRemote().sendObject(response);
|
||||
} catch (EncodeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 广播消息
|
||||
*
|
||||
* @param response
|
||||
*/
|
||||
public void sendMessageBroad(LenResponse response) {
|
||||
for (Entry<String, WebSocketService> webSocket : socketClient.entrySet()) {
|
||||
log.info("【websocket消息】广播消息, message={}", response);
|
||||
try {
|
||||
webSocket.getValue().session.getBasicRemote().sendObject(response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.len.util;
|
||||
|
||||
import com.len.menu.LoginType;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
|
||||
/**
|
||||
|
@ -9,21 +10,21 @@ import org.apache.shiro.authc.UsernamePasswordToken;
|
|||
*/
|
||||
public class CustomUsernamePasswordToken extends UsernamePasswordToken {
|
||||
|
||||
private String type;
|
||||
private LoginType type;
|
||||
|
||||
|
||||
|
||||
public CustomUsernamePasswordToken(final String username, final String password, String loginType) {
|
||||
public CustomUsernamePasswordToken(final String username, final String password, LoginType loginType) {
|
||||
super(username,password);
|
||||
this.type = loginType;
|
||||
}
|
||||
|
||||
|
||||
public String getType() {
|
||||
public LoginType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
public void setType(LoginType type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.len.util;
|
||||
|
||||
import com.len.menu.LoginType;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
|
||||
/**
|
||||
|
@ -10,9 +11,9 @@ import org.apache.shiro.authc.AuthenticationToken;
|
|||
public class JwtToken implements AuthenticationToken {
|
||||
|
||||
private String token;
|
||||
private String type;
|
||||
private LoginType type;
|
||||
|
||||
public JwtToken(String token,String type) {
|
||||
public JwtToken(String token,LoginType type) {
|
||||
this.token = token;
|
||||
this.type=type;
|
||||
}
|
||||
|
@ -35,11 +36,11 @@ public class JwtToken implements AuthenticationToken {
|
|||
this.token = token;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
public LoginType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
public void setType(LoginType type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.len.util;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/15.
|
||||
* @email 154040976@qq.com
|
||||
* ajax 回执
|
||||
*/
|
||||
@Data
|
||||
public class LenResponse {
|
||||
|
||||
//默认成功
|
||||
private boolean flag = true;
|
||||
private String msg;
|
||||
private JSONObject josnObj;
|
||||
private Integer status;
|
||||
private Object data;
|
||||
|
||||
public boolean isFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(boolean flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public LenResponse() {
|
||||
}
|
||||
|
||||
public LenResponse(boolean flag, String msg) {
|
||||
this.flag = flag;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public LenResponse(boolean flag, String msg, Integer status) {
|
||||
this.flag = flag;
|
||||
this.msg = msg;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* restful 返回
|
||||
*/
|
||||
public static LenResponse error(String msg) {
|
||||
return new LenResponse(false, msg);
|
||||
}
|
||||
|
||||
public static LenResponse sucess(String msg) {
|
||||
return new LenResponse(true, msg);
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ public class Md5Util {
|
|||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
String str= getMD5("123456","tom");
|
||||
String str= getMD5("111111","manager");
|
||||
System.out.println(str);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.len.util;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author zxm
|
||||
* @date 2019-11-15.
|
||||
*/
|
||||
public class UuidUtil {
|
||||
|
||||
public static String getUuid() {
|
||||
return UUID.randomUUID().toString().replace("-", "").toLowerCase();
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "/error")
|
||||
@Api(value = "异常", description = "异常业务类")
|
||||
@Api(value = "异常", tags = "异常业务类")
|
||||
public class ErrorController {
|
||||
|
||||
@GetMapping(value = "404")
|
||||
|
|
|
@ -5,9 +5,8 @@ import com.len.core.annotation.Log;
|
|||
import com.len.core.annotation.Log.LOG_TYPE;
|
||||
import com.len.core.quartz.JobTask;
|
||||
import com.len.entity.SysJob;
|
||||
import com.len.exception.MyException;
|
||||
import com.len.service.JobService;
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.LenResponse;
|
||||
import com.len.util.ReType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -30,7 +29,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
*/
|
||||
@Controller
|
||||
@RequestMapping("/job")
|
||||
@Api(value = "定时任务",description="定时任务")
|
||||
@Api(value = "定时任务", tags = "定时任务")
|
||||
public class JobController extends BaseController<SysJob> {
|
||||
|
||||
@Autowired
|
||||
|
@ -48,12 +47,12 @@ public class JobController extends BaseController<SysJob> {
|
|||
@GetMapping(value = "showJobList")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("job:show")
|
||||
public ReType showUser(Model model, SysJob job, String page, String limit) {
|
||||
public ReType showUser( SysJob job, String page, String limit) {
|
||||
return jobService.show(job, Integer.valueOf(page), Integer.valueOf(limit));
|
||||
}
|
||||
|
||||
@GetMapping(value = "showAddJob")
|
||||
public String addJob(Model model) {
|
||||
public String addJob() {
|
||||
return "/system/job/add-job";
|
||||
}
|
||||
|
||||
|
@ -61,25 +60,16 @@ public class JobController extends BaseController<SysJob> {
|
|||
@Log(desc = "添加任务")
|
||||
@PostMapping(value = "addJob")
|
||||
@ResponseBody
|
||||
public JsonUtil addJob(SysJob job) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
String msg = "保存成功";
|
||||
public LenResponse addJob(SysJob job) {
|
||||
job.setStatus(false);
|
||||
try {
|
||||
jobService.insertSelective(job);
|
||||
} catch (MyException e) {
|
||||
msg = "保存失败";
|
||||
j.setFlag(false);
|
||||
e.printStackTrace();
|
||||
}
|
||||
j.setMsg(msg);
|
||||
return j;
|
||||
jobService.save(job);
|
||||
return succ("保存成功");
|
||||
}
|
||||
|
||||
@GetMapping(value = "updateJob")
|
||||
public String updateJob(String id, Model model, boolean detail) {
|
||||
if (StringUtils.isNotEmpty(id)) {
|
||||
SysJob job = jobService.selectByPrimaryKey(id);
|
||||
SysJob job = jobService.getById(id);
|
||||
model.addAttribute("job", job);
|
||||
}
|
||||
model.addAttribute("detail", detail);
|
||||
|
@ -91,24 +81,18 @@ public class JobController extends BaseController<SysJob> {
|
|||
@Log(desc = "更新任务", type = LOG_TYPE.UPDATE)
|
||||
@PostMapping(value = "updateJob")
|
||||
@ResponseBody
|
||||
public JsonUtil updateJob(SysJob job) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
j.setFlag(false);
|
||||
public LenResponse updateJob(SysJob job) {
|
||||
if (job == null) {
|
||||
j.setMsg("获取数据失败");
|
||||
return j;
|
||||
return error("获取数据失败");
|
||||
}
|
||||
if (jobTask.checkJob(job)) {
|
||||
j.setMsg("已经启动任务无法更新,请停止后更新");
|
||||
return j;
|
||||
return error("已经启动任务无法更新,请停止后更新");
|
||||
}
|
||||
if (jobService.updateJob(job)) {
|
||||
j.setFlag(true);
|
||||
j.setData("更新成功");
|
||||
return succ("更新成功");
|
||||
} else {
|
||||
j.setData("更新失败");
|
||||
return error("更新失败");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
@Log(desc = "删除任务", type = LOG_TYPE.DEL)
|
||||
|
@ -116,7 +100,7 @@ public class JobController extends BaseController<SysJob> {
|
|||
@PostMapping(value = "del")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("job:del")
|
||||
public JsonUtil del(String id) {
|
||||
public LenResponse del(String id) {
|
||||
return jobService.del(id);
|
||||
}
|
||||
|
||||
|
@ -125,42 +109,34 @@ public class JobController extends BaseController<SysJob> {
|
|||
@PostMapping(value = "startJob")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("job:start")
|
||||
public JsonUtil startJob(String id) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
String msg = null;
|
||||
public LenResponse startJob(String id) {
|
||||
String msg;
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
j.setMsg("获取数据失败");
|
||||
j.setFlag(false);
|
||||
return j;
|
||||
return error("获取数据失败");
|
||||
}
|
||||
if (jobService.startJob(id)) {
|
||||
msg = "启动成功";
|
||||
} else {
|
||||
msg = "启动失败";
|
||||
}
|
||||
j.setMsg(msg);
|
||||
return j;
|
||||
return succ(msg);
|
||||
}
|
||||
|
||||
@Log(desc = "停止任务")
|
||||
@PostMapping(value = "endJob")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("job:end")
|
||||
public JsonUtil endJob(String id) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
public LenResponse endJob(String id) {
|
||||
String msg;
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
j.setMsg("获取数据失败");
|
||||
j.setFlag(false);
|
||||
return j;
|
||||
return error("获取数据失败");
|
||||
}
|
||||
if (jobService.stopJob(id)) {
|
||||
msg = "停止成功";
|
||||
} else {
|
||||
msg = "停止失败";
|
||||
}
|
||||
j.setMsg(msg);
|
||||
return j;
|
||||
return succ(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
package com.len.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.len.base.BaseController;
|
||||
import com.len.entity.SysLog;
|
||||
import com.len.exception.MyException;
|
||||
import com.len.mapper.SysLogMapper;
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.LenResponse;
|
||||
import com.len.util.ReType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
|
@ -23,6 +18,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/29.
|
||||
|
@ -33,7 +30,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
@Controller
|
||||
@RequestMapping(value = "/log")
|
||||
@Slf4j
|
||||
@Api(value = "日志管理",description="操作日志记录")
|
||||
@Api(value = "日志管理", tags = "操作日志记录")
|
||||
public class LogController extends BaseController {
|
||||
@Autowired
|
||||
private SysLogMapper logMapper;
|
||||
|
@ -73,19 +70,11 @@ public class LogController extends BaseController {
|
|||
*/
|
||||
@PostMapping(value = "del")
|
||||
@ResponseBody
|
||||
public JsonUtil del(String[] ids) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
String msg = "删除成功";
|
||||
try {
|
||||
for (String id : ids) {
|
||||
logMapper.deleteByPrimaryKey(Integer.valueOf(id));
|
||||
}
|
||||
} catch (MyException e) {
|
||||
msg = "删除失败";
|
||||
log.error(msg + e.getMessage());
|
||||
public LenResponse del(String[] ids) {
|
||||
for (String id : ids) {
|
||||
logMapper.deleteById(Integer.valueOf(id));
|
||||
}
|
||||
j.setMsg(msg);
|
||||
return j;
|
||||
return succ("删除成功");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,12 +3,14 @@ package com.len.controller;
|
|||
import com.len.core.annotation.Log;
|
||||
import com.len.core.shiro.Principal;
|
||||
import com.len.entity.SysUser;
|
||||
import com.len.menu.LoginType;
|
||||
import com.len.service.SysUserService;
|
||||
import com.len.util.CustomUsernamePasswordToken;
|
||||
import com.len.util.VerifyCodeUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.ExcessiveAttemptsException;
|
||||
import org.apache.shiro.authc.IncorrectCredentialsException;
|
||||
|
@ -32,16 +34,17 @@ import javax.servlet.http.HttpSession;
|
|||
*/
|
||||
@Controller
|
||||
@Slf4j
|
||||
@Api(value = "登录业务",description="登录校验处理")
|
||||
@Api(value = "登录业务", tags = "登录校验处理")
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
SysUserService userService;
|
||||
private static final String CODE_ERROR = "code.error";
|
||||
private static final Long TWO_WEEK = 1000 * 60 * 60 * 24 * 14L;
|
||||
|
||||
@GetMapping(value = "")
|
||||
public String loginInit() {
|
||||
return loginCheck();
|
||||
public String login() {
|
||||
return toLogin();
|
||||
}
|
||||
|
||||
@GetMapping(value = "goLogin")
|
||||
|
@ -51,19 +54,17 @@ public class LoginController {
|
|||
return "/main/main";
|
||||
} else {
|
||||
model.addAttribute("message", "请重新登录");
|
||||
return "/login";
|
||||
return "/login2";
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping(value = "/login")
|
||||
public String loginCheck() {
|
||||
public String toLogin() {
|
||||
Subject sub = SecurityUtils.getSubject();
|
||||
Boolean flag2 = sub.isRemembered();
|
||||
boolean flag = sub.isAuthenticated() || flag2;
|
||||
if (flag) {
|
||||
if (sub.isAuthenticated() || sub.isRemembered()) {
|
||||
return "/main/main";
|
||||
}
|
||||
return "/login";
|
||||
return "/login2";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,21 +76,27 @@ public class LoginController {
|
|||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "/login", httpMethod = "POST", notes = "登录method")
|
||||
@PostMapping(value = "/login")
|
||||
@PostMapping("/login")
|
||||
public String login(SysUser user, Model model, String rememberMe, HttpServletRequest request) {
|
||||
String codeMsg = (String) request.getAttribute("shiroLoginFailure");
|
||||
if (CODE_ERROR.equals(codeMsg)) {
|
||||
model.addAttribute("message", "验证码错误");
|
||||
return "/login";
|
||||
return "/login2";
|
||||
}
|
||||
CustomUsernamePasswordToken token = new CustomUsernamePasswordToken(user.getUsername().trim(),
|
||||
user.getPassword(), "UserLogin");
|
||||
user.getPassword(), LoginType.SYS);
|
||||
Subject subject = Principal.getSubject();
|
||||
String msg = null;
|
||||
try {
|
||||
subject.login(token);
|
||||
if (subject.isAuthenticated()) {
|
||||
token.getUsername();
|
||||
String isRemember = request.getParameter("isRemember");
|
||||
if (!StringUtils.isEmpty(isRemember)) {
|
||||
if ("true".equals(isRemember)) {
|
||||
subject.getSession().setTimeout(TWO_WEEK);
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:/main";
|
||||
}
|
||||
} catch (UnknownAccountException | IncorrectCredentialsException e) {
|
||||
|
@ -100,7 +107,7 @@ public class LoginController {
|
|||
if (msg != null) {
|
||||
model.addAttribute("message", msg);
|
||||
}
|
||||
return "/login";
|
||||
return "/login2";
|
||||
}
|
||||
|
||||
@GetMapping("/main")
|
||||
|
@ -113,7 +120,7 @@ public class LoginController {
|
|||
public String logout() {
|
||||
Subject sub = SecurityUtils.getSubject();
|
||||
sub.logout();
|
||||
return "/login";
|
||||
return "/login2";
|
||||
}
|
||||
|
||||
|
||||
|
@ -132,7 +139,7 @@ public class LoginController {
|
|||
HttpSession session = request.getSession(true);
|
||||
session.setAttribute("_code", verifyCode.toLowerCase());
|
||||
//生成图片
|
||||
int w = 146, h = 33;
|
||||
int w = 100, h = 35;
|
||||
VerifyCodeUtils.outputImage(w, h, response.getOutputStream(), verifyCode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -5,10 +5,9 @@ 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 com.len.util.LenResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -29,7 +28,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
*/
|
||||
@RequestMapping("/menu")
|
||||
@Controller
|
||||
@Api(value = "菜单管理",description="菜单业务处理")
|
||||
@Api(value = "菜单管理", tags = "菜单业务处理")
|
||||
public class MenuController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
|
@ -61,12 +60,9 @@ public class MenuController extends BaseController {
|
|||
@ApiOperation(value = "/addMenu", httpMethod = "POST", notes = "添加菜单")
|
||||
@PostMapping(value = "addMenu")
|
||||
@ResponseBody
|
||||
public JsonUtil addMenu(SysMenu sysMenu, Model model) {
|
||||
JsonUtil jsonUtil = new JsonUtil();
|
||||
jsonUtil.setFlag(false);
|
||||
public LenResponse addMenu(SysMenu sysMenu) {
|
||||
if (sysMenu == null) {
|
||||
jsonUtil.setMsg("获取数据失败");
|
||||
return jsonUtil;
|
||||
return error("获取数据失败");
|
||||
}
|
||||
if (StringUtils.isEmpty(sysMenu.getPId())) {
|
||||
sysMenu.setPId(null);
|
||||
|
@ -77,28 +73,21 @@ public class MenuController extends BaseController {
|
|||
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("添加失败");
|
||||
if (sysMenu.getMenuType() == 2) {
|
||||
sysMenu.setMenuType((byte) 0);
|
||||
}
|
||||
return jsonUtil;
|
||||
menuService.save(sysMenu);
|
||||
return succ("添加成功");
|
||||
}
|
||||
|
||||
@GetMapping(value = "showUpdateMenu")
|
||||
public String showUpdateMenu(Model model, String id) {
|
||||
SysMenu sysMenu = menuService.selectByPrimaryKey(id);
|
||||
SysMenu sysMenu = menuService.getById(id);
|
||||
JSONArray ja = menuService.getMenuJsonList();
|
||||
model.addAttribute("menus", ja.toJSONString());
|
||||
model.addAttribute("sysMenu", sysMenu);
|
||||
if (null != sysMenu.getPId()) {
|
||||
SysMenu pSysMenu = menuService.selectByPrimaryKey(sysMenu.getPId());
|
||||
SysMenu pSysMenu = menuService.getById(sysMenu.getPId());
|
||||
model.addAttribute("pName", pSysMenu.getName());
|
||||
}
|
||||
return "/system/menu/update-menu";
|
||||
|
@ -108,17 +97,17 @@ public class MenuController extends BaseController {
|
|||
@Log(desc = "更新菜单", type = LOG_TYPE.ADD)
|
||||
@PostMapping(value = "updateMenu")
|
||||
@ResponseBody
|
||||
public JsonUtil updateMenu(SysMenu sysMenu) {
|
||||
SysMenu oldMenu = menuService.selectByPrimaryKey(sysMenu.getId());
|
||||
public LenResponse updateMenu(SysMenu sysMenu) {
|
||||
SysMenu oldMenu = menuService.getById(sysMenu.getId());
|
||||
BeanUtil.copyNotNullBean(sysMenu, oldMenu);
|
||||
menuService.updateByPrimaryKeySelective(oldMenu);
|
||||
return JsonUtil.sucess("保存成功");
|
||||
menuService.updateById(oldMenu);
|
||||
return succ("保存成功");
|
||||
}
|
||||
|
||||
@Log(desc = "删除菜单", type = LOG_TYPE.DEL)
|
||||
@PostMapping("/menu-del")
|
||||
@ResponseBody
|
||||
public JsonUtil del(String id) {
|
||||
public LenResponse del(String id) {
|
||||
return menuService.del(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.len.controller;
|
||||
|
||||
import com.len.base.BaseController;
|
||||
import com.len.base.CurrentUser;
|
||||
import com.len.core.annotation.Log;
|
||||
import com.len.core.shiro.Principal;
|
||||
import com.len.entity.SysUser;
|
||||
import com.len.service.SysUserService;
|
||||
import com.len.util.BeanUtil;
|
||||
import com.len.util.Checkbox;
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.LenResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -27,12 +27,17 @@ import java.util.List;
|
|||
*/
|
||||
@Controller
|
||||
@RequestMapping("/person")
|
||||
@Api(value = "个人业务",description="个人业务处理")
|
||||
public class PersonController {
|
||||
@Api(value = "个人业务", tags = "个人业务处理")
|
||||
public class PersonController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
SysUserService userService;
|
||||
|
||||
@GetMapping("/index")
|
||||
public String main() {
|
||||
return "/main/index";
|
||||
}
|
||||
|
||||
@GetMapping()
|
||||
public String toPerson(Model model) {
|
||||
CurrentUser principal = Principal.getPrincipal();
|
||||
|
@ -41,8 +46,8 @@ public class PersonController {
|
|||
}
|
||||
String id = principal.getId();
|
||||
|
||||
List<Checkbox> checkboxList = userService.getUserRoleByJson(id);
|
||||
SysUser user = userService.selectByPrimaryKey(id);
|
||||
//List<Checkbox> checkboxList = userService.getUserRoleByJson(id);
|
||||
SysUser user = userService.getById(id);
|
||||
model.addAttribute("user", user);
|
||||
return "/system/person/me";
|
||||
}
|
||||
|
@ -51,19 +56,11 @@ public class PersonController {
|
|||
@Log(desc = "更新用户", type = Log.LOG_TYPE.UPDATE)
|
||||
@PostMapping(value = "updateUser")
|
||||
@ResponseBody
|
||||
public JsonUtil updatePerson(SysUser user) {
|
||||
JsonUtil jsonUtil = new JsonUtil();
|
||||
jsonUtil.setFlag(false);
|
||||
public LenResponse updatePerson(SysUser user) {
|
||||
if (user == null) {
|
||||
jsonUtil.setMsg("获取数据失败");
|
||||
return jsonUtil;
|
||||
return error("获取数据失败");
|
||||
}
|
||||
SysUser oldUser = userService.selectByPrimaryKey(user.getId());
|
||||
BeanUtil.copyNotNullBean(user, oldUser);
|
||||
userService.updateByPrimaryKeySelective(oldUser);
|
||||
jsonUtil.setFlag(true);
|
||||
jsonUtil.setMsg("修改成功");
|
||||
userService.updateCurrent(user);
|
||||
return jsonUtil;
|
||||
userService.updatePerson(user);
|
||||
return succ("修改成功");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.len.entity.SysRole;
|
|||
import com.len.service.MenuService;
|
||||
import com.len.service.RoleMenuService;
|
||||
import com.len.service.RoleService;
|
||||
import com.len.util.JsonUtil;
|
||||
import com.len.util.LenResponse;
|
||||
import com.len.util.ReType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -22,6 +22,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2017/12/19.
|
||||
|
@ -30,7 +32,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "/role")
|
||||
@Api(value = "用户角色管理",description="角色业务处理")
|
||||
@Api(value = "用户角色管理", tags = "角色业务处理")
|
||||
public class RoleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
|
@ -44,7 +46,7 @@ public class RoleController extends BaseController {
|
|||
|
||||
@GetMapping(value = "showRole")
|
||||
@RequiresPermissions(value = "role:show")
|
||||
public String showRole(Model model) {
|
||||
public String showRole() {
|
||||
return "/system/role/roleList";
|
||||
}
|
||||
|
||||
|
@ -52,7 +54,7 @@ public class RoleController extends BaseController {
|
|||
@GetMapping(value = "showRoleList")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("role:show")
|
||||
public ReType showRoleList(SysRole role, Model model, String page, String limit) {
|
||||
public ReType showRoleList(SysRole role, String page, String limit) {
|
||||
return roleService.show(role, Integer.valueOf(page), Integer.valueOf(limit));
|
||||
}
|
||||
|
||||
|
@ -60,7 +62,7 @@ public class RoleController extends BaseController {
|
|||
@GetMapping(value = "showaLLRoleList")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("role:show")
|
||||
public String showRoleList(SysRole role, Model model) {
|
||||
public List<SysRole> showRoleList(SysRole role) {
|
||||
return roleService.showAll(role);
|
||||
}
|
||||
|
||||
|
@ -76,9 +78,9 @@ public class RoleController extends BaseController {
|
|||
@Log(desc = "添加角色")
|
||||
@PostMapping(value = "addRole")
|
||||
@ResponseBody
|
||||
public JsonUtil addRole(SysRole sysRole, String[] menus) {
|
||||
public LenResponse addRole(SysRole sysRole, String[] menus) {
|
||||
if (StringUtils.isEmpty(sysRole.getRoleName())) {
|
||||
JsonUtil.error("角色名称不能为空");
|
||||
return error("角色名称不能为空");
|
||||
}
|
||||
return roleService.addRole(sysRole, menus);
|
||||
}
|
||||
|
@ -86,7 +88,7 @@ public class RoleController extends BaseController {
|
|||
@GetMapping(value = "updateRole")
|
||||
public String updateRole(String id, Model model, boolean detail) {
|
||||
if (StringUtils.isNotEmpty(id)) {
|
||||
SysRole role = roleService.selectByPrimaryKey(id);
|
||||
SysRole role = roleService.getById(id);
|
||||
model.addAttribute("role", role);
|
||||
JSONArray jsonArray = menuService.getTreeUtil(id);
|
||||
model.addAttribute("menus", jsonArray.toJSONString());
|
||||
|
@ -99,9 +101,9 @@ public class RoleController extends BaseController {
|
|||
@Log(desc = "更新角色")
|
||||
@PostMapping(value = "updateRole")
|
||||
@ResponseBody
|
||||
public JsonUtil updateUser(SysRole role, String[] menus) {
|
||||
public LenResponse updateUser(SysRole role, String[] menus) {
|
||||
if (role == null) {
|
||||
return JsonUtil.error("获取数据失败");
|
||||
return error("获取数据失败");
|
||||
}
|
||||
return roleService.updateUser(role, menus);
|
||||
}
|
||||
|
@ -111,9 +113,9 @@ public class RoleController extends BaseController {
|
|||
@PostMapping(value = "del")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("role:del")
|
||||
public JsonUtil del(String id) {
|
||||
public LenResponse del(String id) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JsonUtil.error("获取数据失败");
|
||||
return error("获取数据失败");
|
||||
}
|
||||
return roleService.del(id);
|
||||
}
|
||||
|
|
|
@ -8,12 +8,14 @@ import com.len.base.BaseController;
|
|||
import com.len.core.annotation.Log;
|
||||
import com.len.core.annotation.Log.LOG_TYPE;
|
||||
import com.len.core.quartz.JobTask;
|
||||
import com.len.entity.SysRoleUser;
|
||||
import com.len.entity.SysUser;
|
||||
import com.len.exception.MyException;
|
||||
import com.len.service.RoleUserService;
|
||||
import com.len.service.SysUserService;
|
||||
import com.len.util.*;
|
||||
import com.len.util.Checkbox;
|
||||
import com.len.util.LenResponse;
|
||||
import com.len.util.Md5Util;
|
||||
import com.len.util.ReType;
|
||||
import com.len.util.UploadUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -21,11 +23,16 @@ 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.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -37,7 +44,7 @@ import java.util.List;
|
|||
//@Api(value="user")
|
||||
@Controller
|
||||
@RequestMapping(value = "/user")
|
||||
@Api(value = "用户管理",description="用户管理业务")
|
||||
@Api(value = "用户管理", tags = "用户管理业务")
|
||||
public class UserController extends BaseController {
|
||||
|
||||
//private static final Logger
|
||||
|
@ -59,14 +66,14 @@ public class UserController extends BaseController {
|
|||
|
||||
@GetMapping(value = "showUser")
|
||||
@RequiresPermissions("user:show")
|
||||
public String showUser(Model model) {
|
||||
public String showUser() {
|
||||
return "/system/user/userList";
|
||||
}
|
||||
|
||||
@GetMapping(value = "showUserList")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("user:show")
|
||||
public ReType showUser(Model model, SysUser user, String page, String limit) {
|
||||
public ReType showUser(SysUser user, String page, String limit) {
|
||||
return userService.show(user, Integer.valueOf(page), Integer.valueOf(limit));
|
||||
}
|
||||
|
||||
|
@ -74,7 +81,7 @@ public class UserController extends BaseController {
|
|||
@GetMapping(value = "listByRoleId")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("user:show")
|
||||
public String showUser(Model model, String roleId, int page, int limit) {
|
||||
public String showUser(String roleId, int page, int limit) {
|
||||
JSONObject returnValue = new JSONObject();
|
||||
Page<Object> startPage = PageHelper.startPage(page, limit);
|
||||
List<SysUser> users = userService.getUserByRoleId(roleId);
|
||||
|
@ -95,39 +102,26 @@ public class UserController extends BaseController {
|
|||
@Log(desc = "添加用户")
|
||||
@PostMapping(value = "addUser")
|
||||
@ResponseBody
|
||||
public JsonUtil addUser(SysUser user, String[] role) {
|
||||
public LenResponse addUser(SysUser user, String[] role) {
|
||||
if (user == null) {
|
||||
return JsonUtil.error("获取数据失败");
|
||||
return error("获取数据失败");
|
||||
}
|
||||
if (StringUtils.isBlank(user.getUsername())) {
|
||||
return JsonUtil.error("用户名不能为空");
|
||||
return error("用户名不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(user.getPassword())) {
|
||||
return JsonUtil.error("密码不能为空");
|
||||
return error("密码不能为空");
|
||||
}
|
||||
if (role == null) {
|
||||
return JsonUtil.error("请选择角色");
|
||||
return error("请选择角色");
|
||||
}
|
||||
int result = userService.checkUser(user.getUsername());
|
||||
if (result > 0) {
|
||||
return JsonUtil.error("用户名已存在");
|
||||
return error("用户名已存在");
|
||||
}
|
||||
JsonUtil j = new JsonUtil();
|
||||
try {
|
||||
userService.insertSelective(user);
|
||||
SysRoleUser sysRoleUser = new SysRoleUser();
|
||||
sysRoleUser.setUserId(user.getId());
|
||||
for (String r : role) {
|
||||
sysRoleUser.setRoleId(r);
|
||||
roleUserService.insertSelective(sysRoleUser);
|
||||
}
|
||||
j.setMsg("保存成功");
|
||||
} catch (MyException e) {
|
||||
j.setMsg("保存失败");
|
||||
j.setFlag(false);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
userService.add(user, Arrays.asList(role));
|
||||
|
||||
return succ();
|
||||
}
|
||||
|
||||
@GetMapping(value = "updateUser")
|
||||
|
@ -135,7 +129,7 @@ public class UserController extends BaseController {
|
|||
if (StringUtils.isNotEmpty(id)) {
|
||||
//用户-角色
|
||||
List<Checkbox> checkboxList = userService.getUserRoleByJson(id);
|
||||
SysUser user = userService.selectByPrimaryKey(id);
|
||||
SysUser user = userService.getById(id);
|
||||
model.addAttribute("user", user);
|
||||
model.addAttribute("boxJson", checkboxList);
|
||||
}
|
||||
|
@ -143,41 +137,21 @@ public class UserController extends BaseController {
|
|||
return "system/user/update-user";
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "/updateUser", httpMethod = "POST", notes = "更新用户")
|
||||
@Log(desc = "更新用户", type = LOG_TYPE.UPDATE)
|
||||
@PostMapping(value = "updateUser")
|
||||
@ResponseBody
|
||||
public JsonUtil updateUser(SysUser user, String role[]) {
|
||||
JsonUtil jsonUtil = new JsonUtil();
|
||||
jsonUtil.setFlag(false);
|
||||
public LenResponse updateUser(SysUser user, String[] role) {
|
||||
if (user == null) {
|
||||
jsonUtil.setMsg("获取数据失败");
|
||||
return jsonUtil;
|
||||
return error("获取数据失败");
|
||||
}
|
||||
try {
|
||||
SysUser oldUser = userService.selectByPrimaryKey(user.getId());
|
||||
BeanUtil.copyNotNullBean(user, oldUser);
|
||||
userService.updateByPrimaryKeySelective(oldUser);
|
||||
|
||||
SysRoleUser sysRoleUser = new SysRoleUser();
|
||||
sysRoleUser.setUserId(oldUser.getId());
|
||||
List<SysRoleUser> keyList = userService.selectByCondition(sysRoleUser);
|
||||
for (SysRoleUser sysRoleUser1 : keyList) {
|
||||
roleUserService.deleteByPrimaryKey(sysRoleUser1);
|
||||
}
|
||||
if (role != null) {
|
||||
for (String r : role) {
|
||||
sysRoleUser.setRoleId(r);
|
||||
roleUserService.insert(sysRoleUser);
|
||||
}
|
||||
}
|
||||
jsonUtil.setFlag(true);
|
||||
jsonUtil.setMsg("修改成功");
|
||||
userService.updateCurrent(user);
|
||||
} catch (MyException e) {
|
||||
e.printStackTrace();
|
||||
List<String> roles = new ArrayList<>();
|
||||
if (role != null) {
|
||||
roles = Arrays.asList(role);
|
||||
}
|
||||
return jsonUtil;
|
||||
userService.updateUser(user, roles);
|
||||
return succ("修改成功");
|
||||
}
|
||||
|
||||
@Log(desc = "删除用户", type = LOG_TYPE.DEL)
|
||||
|
@ -185,7 +159,7 @@ public class UserController extends BaseController {
|
|||
@PostMapping(value = "/del")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("user:del")
|
||||
public JsonUtil del(String id, boolean flag) {
|
||||
public LenResponse del(String id, boolean flag) {
|
||||
return userService.delById(id, flag);
|
||||
}
|
||||
|
||||
|
@ -194,7 +168,7 @@ public class UserController extends BaseController {
|
|||
if (StringUtils.isEmpty(id)) {
|
||||
return "获取账户信息失败";
|
||||
}
|
||||
SysUser user = userService.selectByPrimaryKey(id);
|
||||
SysUser user = userService.getById(id);
|
||||
model.addAttribute("user", user);
|
||||
return "/system/user/re-pass";
|
||||
}
|
||||
|
@ -203,7 +177,6 @@ public class UserController extends BaseController {
|
|||
* 修改密码
|
||||
*
|
||||
* @param id
|
||||
* @param pass
|
||||
* @param newPwd
|
||||
* @return
|
||||
*/
|
||||
|
@ -211,35 +184,20 @@ public class UserController extends BaseController {
|
|||
@PostMapping(value = "rePass")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("user:repass")
|
||||
public JsonUtil rePass(String id, String pass, String newPwd) {
|
||||
boolean flag = StringUtils.isEmpty(id) || StringUtils.isEmpty(pass) || StringUtils.isEmpty(newPwd);
|
||||
JsonUtil j = new JsonUtil();
|
||||
j.setFlag(false);
|
||||
public LenResponse rePass(String id, String newPwd) {
|
||||
boolean flag = StringUtils.isEmpty(id) || StringUtils.isEmpty(newPwd);
|
||||
if (flag) {
|
||||
j.setMsg("获取数据失败,修改失败");
|
||||
return j;
|
||||
return error("获取数据失败,修改失败");
|
||||
}
|
||||
SysUser user = userService.selectByPrimaryKey(id);
|
||||
SysUser user = userService.getById(id);
|
||||
newPwd = Md5Util.getMD5(newPwd, user.getUsername());
|
||||
pass = Md5Util.getMD5(pass, user.getUsername());
|
||||
if (!pass.equals(user.getPassword())) {
|
||||
j.setMsg("密码不正确");
|
||||
return j;
|
||||
}
|
||||
if (newPwd.equals(user.getPassword())) {
|
||||
j.setMsg("新密码不能与旧密码相同");
|
||||
|
||||
return j;
|
||||
return resp(false, "新密码不能与旧密码相同");
|
||||
}
|
||||
user.setPassword(newPwd);
|
||||
try {
|
||||
userService.rePass(user);
|
||||
j.setMsg("修改成功");
|
||||
j.setFlag(true);
|
||||
} catch (MyException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
userService.rePass(user);
|
||||
|
||||
return succ("修改成功");
|
||||
}
|
||||
|
||||
@Autowired
|
||||
|
@ -250,10 +208,9 @@ public class UserController extends BaseController {
|
|||
*/
|
||||
@PostMapping(value = "upload")
|
||||
@ResponseBody
|
||||
public JsonUtil imgUpload(HttpServletRequest req, @RequestParam("file") MultipartFile file,
|
||||
ModelMap model) {
|
||||
public LenResponse imgUpload(HttpServletRequest req, @RequestParam("file") MultipartFile file) {
|
||||
String fileName = uploadUtil.upload(file);
|
||||
JsonUtil j = new JsonUtil();
|
||||
LenResponse j = new LenResponse();
|
||||
j.setMsg(fileName);
|
||||
return j;
|
||||
}
|
||||
|
@ -263,21 +220,15 @@ public class UserController extends BaseController {
|
|||
*/
|
||||
@GetMapping(value = "checkUser")
|
||||
@ResponseBody
|
||||
public JsonUtil checkUser(String uname, HttpServletRequest req) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
j.setFlag(Boolean.FALSE);
|
||||
public LenResponse checkUser(String uname) {
|
||||
if (StringUtils.isEmpty(uname)) {
|
||||
j.setMsg("获取数据失败");
|
||||
return j;
|
||||
return error("获取数据失败");
|
||||
}
|
||||
int result = userService.checkUser(uname);
|
||||
if (result > 0) {
|
||||
j.setMsg("用户名已存在");
|
||||
return j;
|
||||
return error("用户名已存在");
|
||||
}
|
||||
j.setFlag(true);
|
||||
return j;
|
||||
|
||||
return succ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
package com.len.core.BootListener;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/1/6.
|
||||
* @email 154040976@qq.com
|
||||
* <p>
|
||||
* 通过监听,开辟线程,执行定时任务 当然 也可以执行其他
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class MyApplicationListener implements ApplicationListener<ContextRefreshedEvent> {
|
||||
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
log.info("-------------bean初始化完毕-------------");
|
||||
/**
|
||||
* 通过线程开启数据库中已经开启的定时任务 灵感来自spring
|
||||
* spring boot继续执行 mythread开辟线程,延迟后执行
|
||||
*/
|
||||
DataSourceJobThread myThread = (DataSourceJobThread) event.getApplicationContext().getBean(
|
||||
"dataSourceJobThread");
|
||||
myThread.start();
|
||||
}
|
||||
|
||||
}
|
|
@ -9,6 +9,7 @@ import com.len.util.IpUtil;
|
|||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.UnavailableSecurityManagerException;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.len.core.BootListener;
|
||||
package com.len.core.init.job;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.len.core.quartz.JobTask;
|
||||
import com.len.entity.SysJob;
|
||||
import com.len.service.JobService;
|
||||
|
@ -9,8 +10,6 @@ import com.len.service.RoleService;
|
|||
import java.util.List;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
@ -39,7 +38,8 @@ public class DataSourceJobThread extends Thread {
|
|||
JobTask jobTask = SpringUtil.getBean("jobTask");
|
||||
SysJob job = new SysJob();
|
||||
job.setStatus(true);
|
||||
List<SysJob> jobList = jobService.selectListByPage(job);
|
||||
QueryWrapper<SysJob> jobQueryWrapper=new QueryWrapper<>(job);
|
||||
List<SysJob> jobList = jobService.list(jobQueryWrapper);
|
||||
//开启任务
|
||||
jobList.forEach(jobs -> {
|
||||
log.info("---任务[" + jobs.getId() + "]系统 init--开始启动---------");
|
||||
|
@ -48,8 +48,9 @@ public class DataSourceJobThread extends Thread {
|
|||
);
|
||||
if (jobList.size() == 0) {
|
||||
log.info("---数据库暂无启动的任务---------");
|
||||
} else
|
||||
} else {
|
||||
System.out.println("---任务启动完毕---------");
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.len.core.init.job;
|
||||
|
||||
import com.len.base.handler.ExecuteContext;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
|
||||
/**
|
||||
* @author zxm
|
||||
* @date 2020/8/11 22:02
|
||||
*/
|
||||
|
||||
|
||||
public class JobExecuteImpl implements ExecuteContext {
|
||||
|
||||
@Override
|
||||
public void execute(ContextRefreshedEvent event) {
|
||||
/*
|
||||
* 通过线程开启数据库中已经开启的定时任务
|
||||
*/
|
||||
DataSourceJobThread myThread = event.getApplicationContext().getBean(
|
||||
DataSourceJobThread.class);
|
||||
myThread.start();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.len.core.BootListener;
|
||||
package com.len.core.listener;
|
||||
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
|
|||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Component
|
||||
public class MyServletContextListener implements ServletContextListener {
|
||||
public class CustomServletContextListener implements ServletContextListener {
|
||||
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent sce) {
|
|
@ -0,0 +1,34 @@
|
|||
package com.len.core.listener;
|
||||
|
||||
import com.len.base.handler.ExecuteContext;
|
||||
import com.len.core.init.job.JobExecuteImpl;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/1/6.
|
||||
* @email 154040976@qq.com
|
||||
* <p>
|
||||
* lenosp 初始化类
|
||||
*/
|
||||
@Component
|
||||
public class LenospInit implements ApplicationListener<ContextRefreshedEvent> {
|
||||
|
||||
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
init(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* spring 加载后初始化操作
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void init(ContextRefreshedEvent event) {
|
||||
ExecuteContext context = new JobExecuteImpl();
|
||||
context.execute(event);
|
||||
}
|
||||
|
||||
}
|
|
@ -36,7 +36,7 @@ public class JobDemo1 implements Job{
|
|||
ApplicationContext applicationContext=SpringUtil.getApplicationContext();
|
||||
//可以 获取
|
||||
//SysUserService sys=SpringUtil.getBean(SysUserServiceImpl.class);
|
||||
List<SysUser> userList=sys.selectListByPage(new SysUser());
|
||||
List<SysUser> userList=sys.list();
|
||||
System.out.println(userList.get(0).getUsername());;
|
||||
System.out.println("JobDemo1:执行完毕=======================");
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public class JobDemo2 implements Job{
|
|||
public void run(){
|
||||
ApplicationContext applicationContext=SpringUtil.getApplicationContext();
|
||||
SysUserService sys=SpringUtil.getBean(SysUserServiceImpl.class);
|
||||
List<SysUser> userList=sys.selectListByPage(new SysUser());
|
||||
List<SysUser> userList=sys.list();
|
||||
log.info(userList.get(0).getUsername());
|
||||
log.info("JobDemo2:执行完毕=======================");
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public class JobDemo3 implements Job{
|
|||
public void run(){
|
||||
ApplicationContext applicationContext=SpringUtil.getApplicationContext();
|
||||
SysUserService sys=SpringUtil.getBean(SysUserServiceImpl.class);
|
||||
List<SysUser> userList=sys.selectListByPage(new SysUser());
|
||||
List<SysUser> userList=sys.list();
|
||||
System.out.println(userList.get(0).getUsername());;
|
||||
System.out.println("JobDemo3:执行完毕=======================");
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue