Compare commits

...

27 Commits

Author SHA1 Message Date
meng ead0c57521 去掉url中带有sessionid,记录免登录两周 2020-08-29 17:06:49 +08:00
meng 7b3fe06d64 解决取消弹框请求问题 2020-08-25 21:11:50 +08:00
meng d7f86df58c 代码优化 2020-08-24 21:15:58 +08:00
meng ea7cfde410 realm优化,修复一些查询bug,类命名优化 2020-08-11 23:30:55 +08:00
meng fcb6b30981 优化初始化封装 2020-08-11 22:18:33 +08:00
meng cfbabe672e redis 缓存session 可实现集群 2020-04-19 22:02:14 +08:00
zhuxiaomeng 764c798abb 代码优化 事务调整,返回信息调整 2020-04-07 19:18:03 +08:00
zhuxiaomeng a24c16d78a swagger description过时替换 2020-04-07 11:20:42 +08:00
zhuxiaomeng 6dca8e8d3c 去掉多余信息 2020-03-27 20:53:47 +08:00
zhuxiaomeng d58577eab4 工作流查看图片报错,换成mybatisplus 用户保存密码未设置 2020-03-27 19:10:16 +08:00
zhuxiaomeng eb17c4d9f8 update 2020-03-09 18:14:59 +08:00
meng defaf1c3f8 1、修改tkmapper 为mybatis plus
2、升级layui到最新
3、登录页修改UI
4、activiti 修改UI
5、封装优化前端请求
6、优化工作流
7、添加仪表盘
8、新增/更新弹框不限于当前iframe内
2019-11-19 23:05:44 +08:00
meng bc093aeec3 弹框脱离 iframe,全屏弹出,优化我的待办加载bug 2019-10-24 22:51:53 +08:00
meng d25ca4da7d 登录页面调整更新 2019-10-24 21:43:39 +08:00
meng 6d07d3213b 工作流UI、样式调整,优化结构,优化展示,添加一些业务 2019-10-24 21:34:24 +08:00
meng ddea82f23a 添加部门 2019-10-24 19:51:03 +08:00
art aee27eb132 简化js 2019-10-24 16:33:49 +08:00
art 6cd94d2f3f 菜单业务ui修改 2019-10-24 16:19:41 +08:00
art a34f686180 修改前端布局 2019-10-24 14:25:22 +08:00
art 034054d6f9 修改前端布局 2019-10-24 13:35:22 +08:00
art f8eede541c 升级layui,修改前端样式 2019-10-24 10:35:11 +08:00
art a536b8dea2 te 2019-10-24 10:29:57 +08:00
art 5f137656f8 js 2019-10-24 10:07:20 +08:00
art edf40286ff socket 2019-10-24 10:00:54 +08:00
art df401ca7bf 修改样式 2019-10-24 09:53:40 +08:00
meng 010a180a27 修改数据连接池为spring boot 默认HikariCP 连接池 2019-10-17 23:52:54 +08:00
meng 789e4cbb1a spring boot升级到2.1.9 2019-10-17 23:15:37 +08:00
240 changed files with 10648 additions and 10140 deletions

View File

@ -52,6 +52,7 @@
- 19/4/30 **升级admin监控** - 19/4/30 **升级admin监控**
**博客采用vue前后分离基于jwt鉴权博客单独分离出一个项目地址:[len-blog-ui](https://gitee.com/bweird/len-blog-ui)** **博客采用vue前后分离基于jwt鉴权博客单独分离出一个项目地址:[len-blog-ui](https://gitee.com/bweird/len-blog-ui)**
## 头像说明 ## 头像说明
``` ```
修改 application.yml imagePath 路径 把image文件夹图片赋值进路径即可正常展示头像 修改 application.yml imagePath 路径 把image文件夹图片赋值进路径即可正常展示头像
``` ```
@ -74,7 +75,7 @@ java -jar len-web.jar
## 技术 ## 技术
* jdk1.8 * jdk1.8
* 核心框架spring boot 2.0.1.RELEASE * 核心框架spring boot 2.1.9.RELEASE
* 安全框架Apache Shiro * 安全框架Apache Shiro
* 工作流引擎Activiti * 工作流引擎Activiti
* 数据库连接池druid * 数据库连接池druid

View File

@ -15,6 +15,7 @@
*/ */
package com.len.actlistener; package com.len.actlistener;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.len.entity.ActAssignee; import com.len.entity.ActAssignee;
import com.len.service.ActAssigneeService; import com.len.service.ActAssigneeService;
import com.len.service.impl.ActAssigneeServiceImpl; import com.len.service.impl.ActAssigneeServiceImpl;
@ -40,7 +41,7 @@ public class ActNodeListener implements TaskListener {
//KEY //KEY
String nodeId = delegateTask.getTaskDefinitionKey(); String nodeId = delegateTask.getTaskDefinitionKey();
ActAssigneeService actAssigneeService = SpringUtil.getBean(ActAssigneeServiceImpl.class); 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) { for (ActAssignee assignee : assigneeList) {
switch (assignee.getAssigneeType()) { switch (assignee.getAssigneeType()) {
case AssigneeType.GROUP_TYPE: case AssigneeType.GROUP_TYPE:

View File

@ -15,17 +15,10 @@
*/ */
package com.len.actlistener; package com.len.actlistener;
import com.len.entity.ActAssignee;
import com.len.entity.BaseTask; 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.DelegateTask;
import org.activiti.engine.delegate.TaskListener; import org.activiti.engine.delegate.TaskListener;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**

View File

@ -16,11 +16,10 @@
package com.len.actlistener; package com.len.actlistener;
import com.len.entity.UserLeave; import com.len.entity.UserLeave;
import org.activiti.engine.delegate.DelegateTask;
import java.util.Map; import java.util.Map;
import org.activiti.engine.delegate.DelegateTask;
/** /**
* @author zhuxiaomeng * @author zhuxiaomeng
* @date 2018/1/25. * @date 2018/1/25.

View File

@ -18,27 +18,23 @@ package com.len.actlistener;
import com.len.entity.SysRole; import com.len.entity.SysRole;
import com.len.entity.SysRoleUser; import com.len.entity.SysRoleUser;
import com.len.entity.SysUser; import com.len.entity.SysUser;
import com.len.service.ActAssigneeService;
import com.len.service.SysUserService; import com.len.service.SysUserService;
import com.len.util.JsonUtil; import com.len.util.LenResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.activiti.engine.IdentityService; import org.activiti.engine.IdentityService;
import org.activiti.engine.identity.Group; import org.activiti.engine.identity.Group;
import org.activiti.engine.identity.User; import org.activiti.engine.identity.User;
import org.activiti.engine.impl.persistence.entity.GroupEntity; import org.activiti.engine.impl.persistence.entity.GroupEntity;
import org.activiti.engine.impl.persistence.entity.UserEntity; import org.activiti.engine.impl.persistence.entity.UserEntity;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/** /**
* @author zhuxiaomeng * @author zhuxiaomeng
* @date 2018/1/25. * @date 2018/1/25.
@ -62,7 +58,7 @@ public class ListenUserRole {
* *
* @param joinPoint * @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 { public Object listenerUserUpdate(ProceedingJoinPoint joinPoint) throws Throwable {
Object o = new Object(); Object o = new Object();
//更新前拿到用户-角色数据 //更新前拿到用户-角色数据
@ -73,7 +69,7 @@ public class ListenUserRole {
List<String> strings = new ArrayList<>(); List<String> strings = new ArrayList<>();
keyList.forEach(sysRoleUser1 -> strings.add(sysRoleUser1.getRoleId())); keyList.forEach(sysRoleUser1 -> strings.add(sysRoleUser1.getRoleId()));
o = joinPoint.proceed(joinPoint.getArgs()); o = joinPoint.proceed(joinPoint.getArgs());
JsonUtil jsonUtil = (JsonUtil) o; LenResponse jsonUtil = (LenResponse) o;
if (jsonUtil.isFlag()) { if (jsonUtil.isFlag()) {
changeUser(args, strings); changeUser(args, strings);
} }
@ -85,12 +81,12 @@ public class ListenUserRole {
* *
* @param joinPoint * @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 { public Object listenerUserInsert(ProceedingJoinPoint joinPoint) throws Throwable {
Object o = joinPoint.proceed(joinPoint.getArgs()); Object o = joinPoint.proceed(joinPoint.getArgs());
Object[] args = joinPoint.getArgs(); Object[] args = joinPoint.getArgs();
if (args.length == 2) { if (args.length == 2) {
JsonUtil jsonUtil = (JsonUtil) o; LenResponse jsonUtil = (LenResponse) o;
if (jsonUtil.isFlag()) { if (jsonUtil.isFlag()) {
changeUser(args, Arrays.asList((String[]) args[1])); changeUser(args, Arrays.asList((String[]) args[1]));
} }
@ -98,10 +94,10 @@ public class ListenUserRole {
return o; 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 { public Object listenDelUser(ProceedingJoinPoint point) throws Throwable {
Object o = point.proceed(point.getArgs()); Object o = point.proceed(point.getArgs());
JsonUtil util = (JsonUtil) o; LenResponse util = (LenResponse) o;
if (util.isFlag()) { if (util.isFlag()) {
Object[] args = point.getArgs(); Object[] args = point.getArgs();
identityService.deleteUser((String) args[0]); identityService.deleteUser((String) args[0]);
@ -140,10 +136,10 @@ public class ListenUserRole {
/**********************角色处理begin***************************/ /**********************角色处理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 { public Object listenRoleInsert(ProceedingJoinPoint joinPoint) throws Throwable {
Object o = joinPoint.proceed(joinPoint.getArgs()); Object o = joinPoint.proceed(joinPoint.getArgs());
JsonUtil j = (JsonUtil) o; LenResponse j = (LenResponse) o;
if (j.isFlag()) { if (j.isFlag()) {
Object[] args = joinPoint.getArgs(); Object[] args = joinPoint.getArgs();
if (args.length == 2) { if (args.length == 2) {
@ -153,12 +149,12 @@ public class ListenUserRole {
return o; 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 { public Object listenRoleUpdate(ProceedingJoinPoint joinPoint) throws Throwable {
Object o = joinPoint.proceed(joinPoint.getArgs()); Object o = joinPoint.proceed(joinPoint.getArgs());
Object[] args = joinPoint.getArgs(); Object[] args = joinPoint.getArgs();
if (args.length == 2) { if (args.length == 2) {
if (((JsonUtil) o).isFlag()) { if (((LenResponse) o).isFlag()) {
changeRole(args); changeRole(args);
} }
} }
@ -166,10 +162,10 @@ public class ListenUserRole {
return o; 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 { public Object listenDelRole(ProceedingJoinPoint point) throws Throwable {
Object o = point.proceed(point.getArgs()); Object o = point.proceed(point.getArgs());
JsonUtil util = (JsonUtil) o; LenResponse util = (LenResponse) o;
if (util.isFlag()) { if (util.isFlag()) {
Object[] args = point.getArgs(); Object[] args = point.getArgs();
identityService.deleteGroup((String) args[0]); identityService.deleteGroup((String) args[0]);

View File

@ -15,7 +15,9 @@
*/ */
package com.len.controller; 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.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode; 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.RoleService;
import com.len.service.RoleUserService; import com.len.service.RoleUserService;
import com.len.service.SysUserService; import com.len.service.SysUserService;
import com.len.util.Base64Utils;
import com.len.util.Checkbox; import com.len.util.Checkbox;
import com.len.util.JsonUtil; import com.len.util.LenResponse;
import com.len.util.ReType; import com.len.util.ReType;
import org.activiti.bpmn.converter.BpmnXMLConverter; import org.activiti.bpmn.converter.BpmnXMLConverter;
import org.activiti.bpmn.model.BpmnModel; 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.IdentityService;
import org.activiti.engine.RepositoryService; import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService; import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.identity.Group; import org.activiti.engine.identity.Group;
import org.activiti.engine.identity.User; import org.activiti.engine.identity.User;
import org.activiti.engine.impl.persistence.entity.GroupEntity; 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.Model;
import org.activiti.engine.repository.ModelQuery; import org.activiti.engine.repository.ModelQuery;
import org.activiti.engine.repository.ProcessDefinitionQuery; 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.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author zhuxiaomeng * @author zhuxiaomeng
@ -97,7 +100,7 @@ public class ActivitiController extends BaseController {
private ActAssigneeService actAssigneeService; private ActAssigneeService actAssigneeService;
@Autowired @Autowired
private TaskService taskService; ActivitiService activitiService;
/** /**
@ -105,11 +108,11 @@ public class ActivitiController extends BaseController {
*/ */
@PostMapping(value = "syncdata") @PostMapping(value = "syncdata")
@ResponseBody @ResponseBody
public JsonUtil syncdata() { public LenResponse syncdata() {
JsonUtil j = new JsonUtil(); LenResponse j = new LenResponse();
try { try {
List<SysUser> userList = userService.selectListByPage(new SysUser()); List<SysUser> userList = userService.list();
User au = null; User au;
for (SysUser user : userList) { for (SysUser user : userList) {
au = new UserEntity(); au = new UserEntity();
au.setId(user.getId()); au.setId(user.getId());
@ -118,8 +121,8 @@ public class ActivitiController extends BaseController {
identityService.deleteUser(au.getId()); identityService.deleteUser(au.getId());
identityService.saveUser(au); identityService.saveUser(au);
} }
List<SysRole> sysRoleList = roleService.selectListByPage(new SysRole()); List<SysRole> sysRoleList = roleService.list();
Group group = null; Group group;
for (SysRole role : sysRoleList) { for (SysRole role : sysRoleList) {
group = new GroupEntity(); group = new GroupEntity();
group.setId(role.getId()); group.setId(role.getId());
@ -127,7 +130,7 @@ public class ActivitiController extends BaseController {
identityService.deleteGroup(group.getId()); identityService.deleteGroup(group.getId());
identityService.saveGroup(group); identityService.saveGroup(group);
} }
List<SysRoleUser> roleUserList = roleUserService.selectByCondition(new SysRoleUser()); List<SysRoleUser> roleUserList = roleUserService.list();
for (SysRoleUser sysRoleUser : roleUserList) { for (SysRoleUser sysRoleUser : roleUserList) {
identityService.deleteMembership(sysRoleUser.getUserId(), sysRoleUser.getRoleId()); identityService.deleteMembership(sysRoleUser.getUserId(), sysRoleUser.getRoleId());
@ -251,21 +254,21 @@ public class ActivitiController extends BaseController {
*/ */
@PostMapping(value = "open") @PostMapping(value = "open")
@ResponseBody @ResponseBody
public JsonUtil open(String id) { public LenResponse open(String id) {
String msg = "发布成功"; String msg = "发布成功";
JsonUtil j = new JsonUtil(); LenResponse j = new LenResponse();
try { try {
Model modelData = repositoryService.getModel(id); Model modelData = repositoryService.getModel(id);
byte[] bytes = repositoryService.getModelEditorSource(modelData.getId()); byte[] bytes = repositoryService.getModelEditorSource(modelData.getId());
if (bytes == null) { if (bytes == null) {
return JsonUtil.error("模型为空"); return LenResponse.error("模型为空");
} }
JsonNode modelNode = null; JsonNode modelNode = null;
modelNode = new ObjectMapper().readTree(bytes); modelNode = new ObjectMapper().readTree(bytes);
BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode); BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode);
if (model.getProcesses().size() == 0) { if (model.getProcesses().size() == 0) {
return JsonUtil.error("数据不符合要求"); return LenResponse.error("数据不符合要求");
} }
byte[] bpmnBytes = new BpmnXMLConverter().convertToXML(model); byte[] bpmnBytes = new BpmnXMLConverter().convertToXML(model);
//发布流程 //发布流程
@ -303,7 +306,7 @@ public class ActivitiController extends BaseController {
/**根据流程实例id查询出所有流程节点*/ /**根据流程实例id查询出所有流程节点*/
List<ActivityImpl> activityList = actAssigneeService.getActivityList(deploymentId); List<ActivityImpl> activityList = actAssigneeService.getActivityList(deploymentId);
/**角色和节点关系封装成list*/ /**角色和节点关系封装成list*/
List<SysRole> roleList = roleService.selectListByPage(new SysRole()); List<SysRole> roleList = roleService.list();
Checkbox checkbox = null; Checkbox checkbox = null;
Map<String, Object> map = null; Map<String, Object> map = null;
List<Map<String, Object>> mapList = new ArrayList<>(); List<Map<String, Object>> mapList = new ArrayList<>();
@ -317,7 +320,7 @@ public class ActivitiController extends BaseController {
} }
//节点id name节点目前关联的角色 封装成进map //节点id name节点目前关联的角色 封装成进map
String nodeId = activiti.getId(); String nodeId = activiti.getId();
assigneeList = actAssigneeService.select(new ActAssignee(nodeId)); assigneeList = actAssigneeService.list(new QueryWrapper<>(new ActAssignee(nodeId)));
List<String> strings = new ArrayList<>(); List<String> strings = new ArrayList<>();
assigneeList.forEach(actAssignee1 -> strings.add(actAssignee1.getRoleId())); assigneeList.forEach(actAssignee1 -> strings.add(actAssignee1.getRoleId()));
map.put("id", nodeId); map.put("id", nodeId);
@ -348,8 +351,8 @@ public class ActivitiController extends BaseController {
*/ */
@PostMapping("goAssignee/updateNode") @PostMapping("goAssignee/updateNode")
@ResponseBody @ResponseBody
public JsonUtil updateNode(HttpServletRequest request) { public LenResponse updateNode(HttpServletRequest request) {
JsonUtil j = new JsonUtil(); LenResponse j = new LenResponse();
Map<String, String[]> map = request.getParameterMap(); Map<String, String[]> map = request.getParameterMap();
List<ActAssignee> assigneeList = new ArrayList<>(); List<ActAssignee> assigneeList = new ArrayList<>();
@ -371,7 +374,7 @@ public class ActivitiController extends BaseController {
} }
//后添加 在map循环里添加 多角色会导致添加了的再次被删除 so 要拿出来 //后添加 在map循环里添加 多角色会导致添加了的再次被删除 so 要拿出来
for (ActAssignee actAssignee : assigneeList) { for (ActAssignee actAssignee : assigneeList) {
actAssigneeService.insertSelective(actAssignee); actAssigneeService.save(actAssignee);
} }
j.setMsg("更新成功"); j.setMsg("更新成功");
return j; return j;
@ -386,8 +389,8 @@ public class ActivitiController extends BaseController {
*/ */
@PostMapping("delDeploy") @PostMapping("delDeploy")
@ResponseBody @ResponseBody
public JsonUtil delDeploy(org.springframework.ui.Model model, String id) { public LenResponse delDeploy(org.springframework.ui.Model model, String id) {
JsonUtil j = new JsonUtil(); LenResponse j = new LenResponse();
try { try {
List<ActivityImpl> activityList = actAssigneeService.getActivityList(id); List<ActivityImpl> activityList = actAssigneeService.getActivityList(id);
for (ActivityImpl activity : activityList) { for (ActivityImpl activity : activityList) {
@ -411,15 +414,51 @@ public class ActivitiController extends BaseController {
@Autowired @Autowired
ActPropertiesConfig actPropertiesConfig; 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") @PostMapping("delModel")
@ResponseBody @ResponseBody
public JsonUtil delModel(org.springframework.ui.Model model, String id) { public LenResponse delModel(String id) {
FileInputStream inputStream = null;
String modelId = actPropertiesConfig.getModelId(); String modelId = actPropertiesConfig.getModelId();
if (id.equals(modelId)) { if (id.equals(modelId)) {
return JsonUtil.error("演示禁止删除"); return LenResponse.error("演示禁止删除");
} }
JsonUtil j = new JsonUtil(); LenResponse j = new LenResponse();
try { try {
repositoryService.deleteModel(id); repositoryService.deleteModel(id);
j.setMsg("删除成功"); j.setMsg("删除成功");

View File

@ -18,6 +18,7 @@ package com.len.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.len.base.BaseController; import com.len.base.BaseController;
@ -119,7 +120,7 @@ public class UserLeaveController extends BaseController {
@GetMapping(value = "showLeaveList") @GetMapping(value = "showLeaveList")
@ResponseBody @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(); String userId = CommonUtil.getUser().getId();
userLeave.setUserId(userId); userLeave.setUserId(userId);
List<UserLeave> tList = null; List<UserLeave> tList = null;
@ -154,7 +155,6 @@ public class UserLeaveController extends BaseController {
.processInstanceId(processId).singleResult(); .processInstanceId(processId).singleResult();
//保证运行ing //保证运行ing
List<LeaveOpinion> leaveList = null; List<LeaveOpinion> leaveList = null;
List<HistoricActivityInstance> historicActivityInstanceList = new ArrayList<>();
if (instance != null) { if (instance != null) {
Task task = this.taskService.createTaskQuery().processInstanceId(processId).singleResult(); Task task = this.taskService.createTaskQuery().processInstanceId(processId).singleResult();
Map<String, Object> variables = taskService.getVariables(task.getId()); Map<String, Object> variables = taskService.getVariables(task.getId());
@ -170,7 +170,6 @@ public class UserLeaveController extends BaseController {
HistoricVariableUpdate variable = null; HistoricVariableUpdate variable = null;
for (HistoricDetail historicDetail : list) { for (HistoricDetail historicDetail : list) {
variable = (HistoricVariableUpdate) historicDetail; variable = (HistoricVariableUpdate) historicDetail;
String variableName = variable.getVariableName();
if (leaveOpinionList.equals(variable.getVariableName())) { if (leaveOpinionList.equals(variable.getVariableName())) {
leaveList.clear(); leaveList.clear();
leaveList.addAll((List<LeaveOpinion>) variable.getValue()); leaveList.addAll((List<LeaveOpinion>) variable.getValue());
@ -190,7 +189,7 @@ public class UserLeaveController extends BaseController {
public String updateLeave(Model model, @PathVariable String taskId) { public String updateLeave(Model model, @PathVariable String taskId) {
Map<String, Object> variables = taskService.getVariables(taskId); Map<String, Object> variables = taskService.getVariables(taskId);
BaseTask baseTask = (BaseTask) variables.get("baseTask"); BaseTask baseTask = (BaseTask) variables.get("baseTask");
UserLeave leave = leaveService.selectByPrimaryKey(baseTask.getId()); UserLeave leave = leaveService.getById(baseTask.getId());
model.addAttribute("leave", leave); model.addAttribute("leave", leave);
model.addAttribute("taskId", taskId); model.addAttribute("taskId", taskId);
return "/act/leave/update-leave"; return "/act/leave/update-leave";
@ -198,15 +197,15 @@ public class UserLeaveController extends BaseController {
@PostMapping("updateLeave/updateLeave/{taskId}/{id}/{flag}") @PostMapping("updateLeave/updateLeave/{taskId}/{id}/{flag}")
@ResponseBody @ResponseBody
public JsonUtil updateLeave(UserLeave leave, @PathVariable String taskId, @PathVariable String id, @PathVariable boolean flag) { public LenResponse updateLeave(UserLeave leave, @PathVariable String taskId, @PathVariable String id, @PathVariable boolean flag) {
JsonUtil j = new JsonUtil(); LenResponse j = new LenResponse();
try { try {
UserLeave oldLeave = leaveService.selectByPrimaryKey(leave.getId()); UserLeave oldLeave = leaveService.getById(leave.getId());
BeanUtil.copyNotNullBean(leave, oldLeave); BeanUtil.copyNotNullBean(leave, oldLeave);
leaveService.updateByPrimaryKeySelective(oldLeave); QueryWrapper<UserLeave> userLeaveQueryWrapper = new QueryWrapper<>(oldLeave);
leaveService.update(userLeaveQueryWrapper);
Map<String, Object> variables = taskService.getVariables(taskId); Map<String, Object> variables = taskService.getVariables(taskId);
// UserLeave userLeave = (UserLeave) variables.get("userLeave");
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if (flag) { if (flag) {
map.put("flag", true); map.put("flag", true);
@ -226,33 +225,42 @@ public class UserLeaveController extends BaseController {
@PostMapping("addLeave") @PostMapping("addLeave")
@ResponseBody @ResponseBody
public JsonUtil addLeave(Model model, UserLeave userLeave) { public LenResponse addLeave(UserLeave userLeave) {
JsonUtil j = new JsonUtil(); LenResponse j = new LenResponse();
if (userLeave == null) { 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(); CurrentUser user = CommonUtil.getUser();
userLeave.setUserId(user.getId()); userLeave.setUserId(user.getId());
userLeave.setUserName(user.getUsername()); userLeave.setUserName(user.getUsername());
userLeave.setProcessInstanceId("2018");//模拟数据 userLeave.setProcessInstanceId("2018");
leaveService.insertSelective(userLeave); leaveService.save(userLeave);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
userLeave.setUrlpath("/leave/readOnlyLeave/" + userLeave.getId()); userLeave.setUrlpath("/leave/readOnlyLeave/" + userLeave.getId());
map.put("baseTask", userLeave); map.put("baseTask", userLeave);
map.put("day", days);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process_leave", map); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process_leave", map);
userLeave.setProcessInstanceId(processInstance.getId()); userLeave.setProcessInstanceId(processInstance.getId());
UserLeave userLeave1 = leaveService.selectByPrimaryKey(userLeave.getId()); userLeave.setUrlpath("/leave/readOnlyLeave/" + userLeave.getId());
BeanUtil.copyNotNullBean(userLeave, userLeave1); leaveService.updateById(userLeave);
userLeave1.setUrlpath("/leave/readOnlyLeave/" + userLeave.getId());
leaveService.updateByPrimaryKeySelective(userLeave1);
j.setMsg("请假申请成功"); j.setMsg("请假申请成功");
return j; return j;
} }
@GetMapping("readOnlyLeave/{billId}") @GetMapping("readOnlyLeave/{billId}")
public String readOnlyLeave(Model model, @PathVariable String billId) { public String readOnlyLeave(Model model, @PathVariable String billId) {
UserLeave leave = leaveService.selectByPrimaryKey(billId); UserLeave leave = leaveService.getById(billId);
model.addAttribute("leave", leave); model.addAttribute("leave", leave);
return "/act/leave/update-leave-readonly"; return "/act/leave/update-leave-readonly";
} }
@ -271,8 +279,9 @@ public class UserLeaveController extends BaseController {
CurrentUser user = CommonUtil.getUser(); CurrentUser user = CommonUtil.getUser();
SysRoleUser sysRoleUser = new SysRoleUser(); SysRoleUser sysRoleUser = new SysRoleUser();
sysRoleUser.setUserId(user.getId()); sysRoleUser.setUserId(user.getId());
List<SysRoleUser> userRoles = roleUserService.selectByCondition(sysRoleUser); QueryWrapper<SysRoleUser> queryWrapper = new QueryWrapper<>(sysRoleUser);
List<String> roleString = new ArrayList<String>(); List<SysRoleUser> userRoles = roleUserService.list(queryWrapper);
List<String> roleString = new ArrayList<>();
for (SysRoleUser sru : userRoles) { for (SysRoleUser sru : userRoles) {
roleString.add(sru.getRoleId()); roleString.add(sru.getRoleId());
} }
@ -281,12 +290,16 @@ public class UserLeaveController extends BaseController {
List<Task> candidateGroup = taskService.createTaskQuery().taskCandidateGroupIn(roleString).list(); List<Task> candidateGroup = taskService.createTaskQuery().taskCandidateGroupIn(roleString).list();
taskList.addAll(assigneeList); taskList.addAll(assigneeList);
taskList.addAll(candidateGroup); 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<>(); List<com.len.entity.Task> tasks = new ArrayList<>();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map;
com.len.entity.Task taskEntity = null; com.len.entity.Task taskEntity;
Map<String, Map<String, Object>> mapMap = new HashMap<>(); Map<String, Map<String, Object>> mapMap = new HashMap<>();
Map<String, Object> objectMap = null; Map<String, Object> objectMap;
Set<String> taskSet = new HashSet<String>(); Set<String> taskSet = new HashSet<String>();
for (Task task1 : taskList) { for (Task task1 : taskList) {
objectMap = new HashMap<>(); objectMap = new HashMap<>();
@ -302,7 +315,7 @@ public class UserLeaveController extends BaseController {
taskEntity.setUserName(userLeave.getUserName()); taskEntity.setUserName(userLeave.getUserName());
taskEntity.setReason(userLeave.getReason()); taskEntity.setReason(userLeave.getReason());
taskEntity.setUrlpath(userLeave.getUrlpath()); taskEntity.setUrlpath(userLeave.getUrlpath());
/**如果是自己*/ /*如果是自己*/
if (user.getId().equals(userLeave.getUserId())) { if (user.getId().equals(userLeave.getUserId())) {
if (map.get("flag") != null) { if (map.get("flag") != null) {
if (!(boolean) map.get("flag")) { if (!(boolean) map.get("flag")) {
@ -320,7 +333,7 @@ public class UserLeaveController extends BaseController {
tasks.add(taskEntity); tasks.add(taskEntity);
taskSet.add(taskId); taskSet.add(taskId);
} }
return ReType.jsonStrng(taskList.size(), tasks, mapMap, "id"); return ReType.jsonStrng(count, tasks, mapMap, "id");
} }
@GetMapping("agent/{id}") @GetMapping("agent/{id}")
@ -335,14 +348,14 @@ public class UserLeaveController extends BaseController {
@PostMapping("agent/complete") @PostMapping("agent/complete")
@ResponseBody @ResponseBody
public JsonUtil complete(LeaveOpinion op, HttpServletRequest request) { public LenResponse complete(LeaveOpinion op, HttpServletRequest request) {
Map<String, Object> variables = taskService.getVariables(op.getTaskId()); Map<String, Object> variables = taskService.getVariables(op.getTaskId());
CurrentUser user = Principal.getCurrentUse(); CurrentUser user = Principal.getCurrentUse();
op.setCreateTime(new Date()); op.setCreateTime(new Date());
op.setOpId(user.getId()); op.setOpId(user.getId());
op.setOpName(user.getRealName()); op.setOpName(user.getRealName());
JsonUtil j = new JsonUtil(); LenResponse j = new LenResponse();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("flag", op.isFlag()); map.put("flag", op.isFlag());
@ -364,6 +377,8 @@ public class UserLeaveController extends BaseController {
leaveList = (List<LeaveOpinion>) o; leaveList = (List<LeaveOpinion>) o;
} }
leaveList.add(op); leaveList.add(op);
UserLeave userLeave=(UserLeave)variables.get("baseTask");
map.put("day",userLeave.getDays());
map.put(leaveOpinionList, leaveList); map.put(leaveOpinionList, leaveList);
j.setMsg("审核成功" + (op.isFlag() ? "<font style='color:green'>[通过]</font>" : "<font style='color:red'>[未通过]</font>")); j.setMsg("审核成功" + (op.isFlag() ? "<font style='color:green'>[通过]</font>" : "<font style='color:red'>[未通过]</font>"));
taskService.complete(op.getTaskId(), map); taskService.complete(op.getTaskId(), map);

View File

@ -1,39 +1,44 @@
package com.len.entity; 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 { public class ActAssignee {
@Id @TableId(value = "id", type = IdType.UUID)
@Column(name = "id")
private String id; private String id;
/** /**
* 节点id * 节点id
*/ */
@TableField(value = "sid")
private String sid; private String sid;
/** /**
* 办理人 * 办理人
*/ */
@TableField(value = "assignee")
private String assignee; private String assignee;
/** /**
* 候选组(角色) * 候选组(角色)
*/ */
@Column(name = "role_id") @TableField(value = "role_id")
private String roleId; private String roleId;
/** /**
* 办理人类型1办理人2候选人3组 * 办理人类型1办理人2候选人3组
*/ */
@Column(name = "assignee_type") @TableField(value = "assignee_type")
private Integer assigneeType; private Integer assigneeType;
/** /**
* 节点名称 * 节点名称
*/ */
@Column(name = "activti_name") @TableField(value = "activti_name")
private String activtiName; private String activtiName;
/** /**

View File

@ -16,6 +16,8 @@
package com.len.entity; package com.len.entity;
import java.util.Date; import java.util.Date;
import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString; import lombok.ToString;
@ -27,8 +29,7 @@ import org.activiti.engine.repository.Model;
* @email 154040976@qq.com * @email 154040976@qq.com
* 模型列表 * 模型列表
*/ */
@Getter @Data
@Setter
public class ActModel { public class ActModel {
private String id; private String id;

View File

@ -1,17 +1,13 @@
package com.len.entity; package com.len.entity;
import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* Created by kingdee-001 on 2018/6/30. * 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; protected String id;
/** /**
@ -28,29 +24,22 @@ public abstract class BaseTask implements Serializable{
this.id = id == null ? null : id.trim(); this.id = id == null ? null : id.trim();
} }
@Column(name = "user_id")
protected String userId; protected String userId;
@Column(name = "user_name")
protected String userName; protected String userName;
@Column(name = "process_instance_Id")
protected String processInstanceId; protected String processInstanceId;
protected String status; protected String status;
@Column(name = "create_date")
protected Date createDate; protected Date createDate;
@Column(name = "create_by")
protected String createBy; protected String createBy;
@Column(name = "update_date")
protected Date updateDate; protected Date updateDate;
@Column(name = "update_by")
protected String updateBy; protected String updateBy;
@ -67,8 +56,6 @@ public abstract class BaseTask implements Serializable{
private Integer submittimes; private Integer submittimes;
/** /**
* @return user_id * @return user_id
*/ */

View File

@ -1,16 +1,18 @@
package com.len.entity; 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.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.persistence.*;
@Table(name = "user_leave") @TableName(value = "user_leave")
public class UserLeave extends BaseTask { public class UserLeave extends BaseTask {
@Id @TableId(value = "id", type = IdType.UUID)
@GeneratedValue(strategy = GenerationType.AUTO,generator = "JDBC")
protected String id; protected String id;
/** /**
@ -31,36 +33,37 @@ public class UserLeave extends BaseTask {
private Integer days; private Integer days;
@Column(name = "begin_time") @TableField(value = "begin_time")
private Date beginTime; private Date beginTime;
@Column(name = "end_time") @TableField(value = "end_time")
private Date endTime; private Date endTime;
@Column(name = "process_instance_Id") @TableField(value = "process_instance_Id")
private String processInstanceId; private String processInstanceId;
private String status; private String status;
@Column(name = "create_date") @TableField(value = "create_date")
private Date createDate; private Date createDate;
@Column(name = "create_by") @TableField(value = "create_by")
private String createBy; private String createBy;
@Column(name = "update_date") @TableField(value = "update_date")
private Date updateDate; private Date updateDate;
@Column(name = "update_by") @TableField(value = "update_by")
private String updateBy; private String updateBy;
//***实时节点信息 //***实时节点信息
@Transient @TableField(exist = false)
private String taskName; private String taskName;
//请假单审核信息 //请假单审核信息
@TableField(exist = false)
private List<LeaveOpinion> opinionList=new ArrayList<>(); private List<LeaveOpinion> opinionList=new ArrayList<>();
public void leaveOpAdd(LeaveOpinion leaveOpinion){ public void leaveOpAdd(LeaveOpinion leaveOpinion){

View File

@ -2,8 +2,7 @@ package com.len.mapper;
import com.len.base.BaseMapper; import com.len.base.BaseMapper;
import com.len.entity.ActAssignee; 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); int deleteByNodeId(String nodeId);
} }

View File

@ -2,7 +2,6 @@ package com.len.mapper;
import com.len.base.BaseMapper; import com.len.base.BaseMapper;
import com.len.entity.UserLeave; import com.len.entity.UserLeave;
import tk.mybatis.mapper.common.Mapper;
public interface UserLeaveMapper extends BaseMapper<UserLeave,String> { public interface UserLeaveMapper extends BaseMapper<UserLeave> {
} }

View File

@ -3,6 +3,8 @@ package com.len.service;
import com.len.base.BaseService; import com.len.base.BaseService;
import com.len.entity.UserLeave; import com.len.entity.UserLeave;
import java.util.List;
/** /**
* @author zhuxiaomeng * @author zhuxiaomeng
* @date 2018/1/21. * @date 2018/1/21.
@ -10,4 +12,5 @@ import com.len.entity.UserLeave;
*/ */
public interface UserLeaveService extends BaseService<UserLeave,String> { public interface UserLeaveService extends BaseService<UserLeave,String> {
public List<UserLeave> selectListByPage(UserLeave record);
} }

View File

@ -1,6 +1,5 @@
package com.len.service.impl; package com.len.service.impl;
import com.len.base.BaseMapper;
import com.len.base.impl.BaseServiceImpl; import com.len.base.impl.BaseServiceImpl;
import com.len.entity.ActAssignee; import com.len.entity.ActAssignee;
import com.len.mapper.ActAssigneeMapper; import com.len.mapper.ActAssigneeMapper;
@ -34,11 +33,6 @@ public class ActAssigneeServiceImpl extends BaseServiceImpl<ActAssignee, String>
@Autowired @Autowired
private RepositoryService repositoryService; private RepositoryService repositoryService;
@Override
public BaseMapper<ActAssignee, String> getMappser() {
return actAssigneeMapper;
}
@Override @Override
public int deleteByNodeId(String nodeId) { public int deleteByNodeId(String nodeId) {
return actAssigneeMapper.deleteByNodeId(nodeId); return actAssigneeMapper.deleteByNodeId(nodeId);

View File

@ -1,6 +1,5 @@
package com.len.service.impl; package com.len.service.impl;
import com.len.base.BaseMapper;
import com.len.base.impl.BaseServiceImpl; import com.len.base.impl.BaseServiceImpl;
import com.len.entity.UserLeave; import com.len.entity.UserLeave;
import com.len.mapper.UserLeaveMapper; import com.len.mapper.UserLeaveMapper;
@ -8,20 +7,22 @@ import com.len.service.UserLeaveService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @author zhuxiaomeng * @author zhuxiaomeng
* @date 2018/1/21. * @date 2018/1/21.
* @email 154040976@qq.com * @email 154040976@qq.com
*/ */
@Service @Service
public class UserLeaveServiceImpl extends BaseServiceImpl<UserLeave,String> implements public class UserLeaveServiceImpl extends BaseServiceImpl<UserLeave, String> implements
UserLeaveService { UserLeaveService {
@Autowired @Autowired
UserLeaveMapper userLeaveMapper; UserLeaveMapper userLeaveMapper;
@Override @Override
public BaseMapper<UserLeave,String> getMappser() { public List<UserLeave> selectListByPage(UserLeave record) {
return userLeaveMapper; return userLeaveMapper.selectListByPage(record);
} }
} }

View File

@ -1,9 +1,9 @@
/* Licensed under the Apache License, Version 2.0 (the "License"); /* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 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. * 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 * Some of the icons used are licensed under a Creative Commons Attribution 2.5
* License, see http://www.famfamfam.com/lab/icons/silk/ * License, see http://www.famfamfam.com/lab/icons/silk/
* *
* @see org.activiti.engine.impl.bpmn.diagram.DefaultProcessDiagramGenerator * @see org.activiti.engine.impl.bpmn.diagram.DefaultProcessDiagramGenerator
* @author Joram Barrez * @author Joram Barrez
*/ */
@ -79,7 +79,7 @@ public class DefaultProcessDiagramCanvas {
protected static final int TEXT_PADDING = 3; protected static final int TEXT_PADDING = 3;
protected static final int ANNOTATION_TEXT_PADDING = 7; protected static final int ANNOTATION_TEXT_PADDING = 7;
protected static final int LINE_HEIGHT = FONT_SIZE + FONT_SPACING; protected static final int LINE_HEIGHT = FONT_SIZE + FONT_SPACING;
// Colors // Colors
protected static Color TASK_BOX_COLOR = new Color(249, 249, 249); 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 TASK_BORDER_COLOR = new Color(187, 187, 187);
protected static Color EVENT_BORDER_COLOR = new Color(88, 88, 88); protected static Color EVENT_BORDER_COLOR = new Color(88, 88, 88);
protected static Color SUBPROCESS_BORDER_COLOR = new Color(0, 0, 0); protected static Color SUBPROCESS_BORDER_COLOR = new Color(0, 0, 0);
// Fonts // Fonts
protected static Font LABEL_FONT = null; protected static Font LABEL_FONT = null;
protected static Font ANNOTATION_FONT = null; protected static Font ANNOTATION_FONT = null;
@ -120,7 +120,7 @@ public class DefaultProcessDiagramCanvas {
protected static BufferedImage SHELL_TASK_IMAGE; protected static BufferedImage SHELL_TASK_IMAGE;
protected static BufferedImage MULE_TASK_IMAGE; protected static BufferedImage MULE_TASK_IMAGE;
protected static BufferedImage CAMEL_TASK_IMAGE; protected static BufferedImage CAMEL_TASK_IMAGE;
protected static BufferedImage TIMER_IMAGE; protected static BufferedImage TIMER_IMAGE;
protected static BufferedImage COMPENSATE_THROW_IMAGE; protected static BufferedImage COMPENSATE_THROW_IMAGE;
protected static BufferedImage COMPENSATE_CATCH_IMAGE; protected static BufferedImage COMPENSATE_CATCH_IMAGE;
@ -143,19 +143,19 @@ public class DefaultProcessDiagramCanvas {
protected String activityFontName = "Arial"; protected String activityFontName = "Arial";
protected String labelFontName = "Arial"; protected String labelFontName = "Arial";
protected String annotationFontName = "Arial"; protected String annotationFontName = "Arial";
/** /**
* Creates an empty canvas with given width and height. * Creates an empty canvas with given width and height.
* *
* Allows to specify minimal boundaries on the left and upper side of the * Allows to specify minimal boundaries on the left and upper side of the
* canvas. This is useful for diagrams that have white space there. * 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. * 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) { String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) {
this.canvasWidth = width; this.canvasWidth = width;
this.canvasHeight = height; this.canvasHeight = height;
this.minX = minX; this.minX = minX;
@ -170,17 +170,17 @@ public class DefaultProcessDiagramCanvas {
this.annotationFontName = annotationFontName; this.annotationFontName = annotationFontName;
} }
this.customClassLoader = customClassLoader; this.customClassLoader = customClassLoader;
initialize(imageType); initialize(imageType);
} }
/** /**
* Creates an empty canvas with given width and height. * Creates an empty canvas with given width and height.
* *
* Allows to specify minimal boundaries on the left and upper side of the * 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 * canvas. This is useful for diagrams that have white space there (eg
* Signavio). Everything beneath these minimum values will be cropped. * Signavio). Everything beneath these minimum values will be cropped.
* *
* @param minX * @param minX
* Hint that will be used when generating the image. Parts that fall * Hint that will be used when generating the image. Parts that fall
* below minX on the horizontal scale will be cropped. * below minX on the horizontal scale will be cropped.
@ -193,17 +193,17 @@ public class DefaultProcessDiagramCanvas {
this.canvasHeight = height; this.canvasHeight = height;
this.minX = minX; this.minX = minX;
this.minY = minY; this.minY = minY;
initialize(imageType); initialize(imageType);
} }
public void initialize(String imageType) { public void initialize(String imageType) {
if ("png".equalsIgnoreCase(imageType)) { if ("png".equalsIgnoreCase(imageType)) {
this.processDiagram = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_ARGB); this.processDiagram = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_ARGB);
} else { } else {
this.processDiagram = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB); this.processDiagram = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB);
} }
this.g = processDiagram.createGraphics(); this.g = processDiagram.createGraphics();
if ("png".equalsIgnoreCase(imageType) == false) { if ("png".equalsIgnoreCase(imageType) == false) {
this.g.setBackground(new Color(255, 255, 255, 0)); 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.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setPaint(Color.black); g.setPaint(Color.black);
Font font = new Font(activityFontName, Font.BOLD, FONT_SIZE); Font font = new Font(activityFontName, Font.BOLD, FONT_SIZE);
g.setFont(font); g.setFont(font);
this.fontMetrics = g.getFontMetrics(); this.fontMetrics = g.getFontMetrics();
LABEL_FONT = new Font(labelFontName, Font.BOLD, 14); LABEL_FONT = new Font(labelFontName, Font.BOLD, 14);
ANNOTATION_FONT = new Font(annotationFontName, Font.PLAIN, FONT_SIZE); ANNOTATION_FONT = new Font(annotationFontName, Font.PLAIN, FONT_SIZE);
try { try {
USERTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/userTask.png", customClassLoader)); USERTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/userTask.png", customClassLoader));
SCRIPTTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/scriptTask.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)); 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)); 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)); 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)); 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_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)); 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. * Generates an image of what currently is drawn on the canvas.
* *
* Throws an {@link ActivitiException} when {@link #close()} is already * Throws an {@link ActivitiException} when {@link #close()} is already
* called. * called.
*/ */
@ -260,7 +260,7 @@ public class DefaultProcessDiagramCanvas {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
try { try {
ImageIO.write(processDiagram, imageType, out); ImageIO.write(processDiagram, imageType, out);
} catch (IOException e) { } catch (IOException e) {
throw new ActivitiImageException("Error while generating process image", e); throw new ActivitiImageException("Error while generating process image", e);
} finally { } finally {
@ -274,10 +274,10 @@ public class DefaultProcessDiagramCanvas {
} }
return new ByteArrayInputStream(out.toByteArray()); return new ByteArrayInputStream(out.toByteArray());
} }
/** /**
* Generates an image of what currently is drawn on the canvas. * Generates an image of what currently is drawn on the canvas.
* *
* Throws an {@link ActivitiException} when {@link #close()} is already * Throws an {@link ActivitiException} when {@link #close()} is already
* called. * called.
*/ */
@ -312,11 +312,11 @@ public class DefaultProcessDiagramCanvas {
public void drawTimerStartEvent(GraphicInfo graphicInfo, double scaleFactor) { public void drawTimerStartEvent(GraphicInfo graphicInfo, double scaleFactor) {
drawStartEvent(graphicInfo, TIMER_IMAGE, scaleFactor); drawStartEvent(graphicInfo, TIMER_IMAGE, scaleFactor);
} }
public void drawSignalStartEvent(GraphicInfo graphicInfo, double scaleFactor) { public void drawSignalStartEvent(GraphicInfo graphicInfo, double scaleFactor) {
drawStartEvent(graphicInfo, SIGNAL_CATCH_IMAGE, scaleFactor); drawStartEvent(graphicInfo, SIGNAL_CATCH_IMAGE, scaleFactor);
} }
public void drawMessageStartEvent(GraphicInfo graphicInfo, double scaleFactor) { public void drawMessageStartEvent(GraphicInfo graphicInfo, double scaleFactor) {
drawStartEvent(graphicInfo, MESSAGE_CATCH_IMAGE, scaleFactor); drawStartEvent(graphicInfo, MESSAGE_CATCH_IMAGE, scaleFactor);
} }
@ -325,7 +325,7 @@ public class DefaultProcessDiagramCanvas {
Paint originalPaint = g.getPaint(); Paint originalPaint = g.getPaint();
g.setPaint(EVENT_COLOR); g.setPaint(EVENT_COLOR);
// g.setPaint(new Color(36,202,88)); // 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()); graphicInfo.getWidth(), graphicInfo.getHeight());
g.fill(circle); g.fill(circle);
g.setPaint(EVENT_BORDER_COLOR); g.setPaint(EVENT_BORDER_COLOR);
@ -334,7 +334,7 @@ public class DefaultProcessDiagramCanvas {
if (image != null) { if (image != null) {
// calculate coordinates to center image // calculate coordinates to center image
int imageX = (int) Math.round(graphicInfo.getX() + (graphicInfo.getWidth() / 2) - (image.getWidth() / 2 * scaleFactor)); 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, g.drawImage(image, imageX, imageY,
(int) (image.getWidth() / scaleFactor), (int) (image.getHeight() / scaleFactor), null); (int) (image.getWidth() / scaleFactor), (int) (image.getHeight() / scaleFactor), null);
} }
@ -344,9 +344,8 @@ public class DefaultProcessDiagramCanvas {
public void drawNoneEndEvent(GraphicInfo graphicInfo, double scaleFactor) { public void drawNoneEndEvent(GraphicInfo graphicInfo, double scaleFactor) {
Paint originalPaint = g.getPaint(); Paint originalPaint = g.getPaint();
Stroke originalStroke = g.getStroke(); Stroke originalStroke = g.getStroke();
// g.setPaint(EVENT_COLOR); g.setPaint(new Color(255,255,255));
g.setPaint(new Color(255,0,0)); Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(),
Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(),
graphicInfo.getWidth(), graphicInfo.getHeight()); graphicInfo.getWidth(), graphicInfo.getHeight());
g.fill(circle); g.fill(circle);
g.setPaint(EVENT_BORDER_COLOR); g.setPaint(EVENT_BORDER_COLOR);
@ -366,28 +365,28 @@ public class DefaultProcessDiagramCanvas {
drawLabel(name, graphicInfo); drawLabel(name, graphicInfo);
} }
} }
public void drawErrorEndEvent(GraphicInfo graphicInfo, double scaleFactor) { public void drawErrorEndEvent(GraphicInfo graphicInfo, double scaleFactor) {
drawNoneEndEvent(graphicInfo, scaleFactor); drawNoneEndEvent(graphicInfo, scaleFactor);
g.drawImage(ERROR_THROW_IMAGE, (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 4)), g.drawImage(ERROR_THROW_IMAGE, (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 4)),
(int) (graphicInfo.getY() + (graphicInfo.getHeight() / 4)), (int) (graphicInfo.getY() + (graphicInfo.getHeight() / 4)),
(int) (ERROR_THROW_IMAGE.getWidth() / scaleFactor), (int) (ERROR_THROW_IMAGE.getWidth() / scaleFactor),
(int) (ERROR_THROW_IMAGE.getHeight() / scaleFactor), null); (int) (ERROR_THROW_IMAGE.getHeight() / scaleFactor), null);
} }
public void drawErrorStartEvent(GraphicInfo graphicInfo, double scaleFactor) { public void drawErrorStartEvent(GraphicInfo graphicInfo, double scaleFactor) {
drawNoneStartEvent(graphicInfo); drawNoneStartEvent(graphicInfo);
g.drawImage(ERROR_CATCH_IMAGE, (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 4)), g.drawImage(ERROR_CATCH_IMAGE, (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 4)),
(int) (graphicInfo.getY() + (graphicInfo.getHeight() / 4)), (int) (graphicInfo.getY() + (graphicInfo.getHeight() / 4)),
(int) (ERROR_CATCH_IMAGE.getWidth() / scaleFactor), (int) (ERROR_CATCH_IMAGE.getWidth() / scaleFactor),
(int) (ERROR_CATCH_IMAGE.getHeight() / scaleFactor), null); (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) { BufferedImage image, String eventType, double scaleFactor) {
// event circles // event circles
Ellipse2D outerCircle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(), Ellipse2D outerCircle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(),
graphicInfo.getWidth(), graphicInfo.getHeight()); graphicInfo.getWidth(), graphicInfo.getHeight());
int innerCircleSize = (int) (4 / scaleFactor); int innerCircleSize = (int) (4 / scaleFactor);
if (innerCircleSize == 0) { if (innerCircleSize == 0) {
@ -405,7 +404,7 @@ public class DefaultProcessDiagramCanvas {
g.fill(outerCircle); g.fill(outerCircle);
g.setPaint(EVENT_BORDER_COLOR); g.setPaint(EVENT_BORDER_COLOR);
if (isInterrupting == false) if (isInterrupting == false)
g.setStroke(NON_INTERRUPTING_EVENT_STROKE); g.setStroke(NON_INTERRUPTING_EVENT_STROKE);
g.draw(outerCircle); g.draw(outerCircle);
g.setStroke(originalStroke); g.setStroke(originalStroke);
@ -415,13 +414,13 @@ public class DefaultProcessDiagramCanvas {
if (image != null) { if (image != null) {
// calculate coordinates to center image // calculate coordinates to center image
int imageX = (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 2) - (image.getWidth() / 2 * scaleFactor)); 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)) { if (scaleFactor == 1.0 && "timer".equals(eventType)) {
// move image one pixel to center timer image // move image one pixel to center timer image
imageX++; imageX++;
imageY++; imageY++;
} }
g.drawImage(image, imageX, imageY, (int) (image.getWidth() / scaleFactor), g.drawImage(image, imageX, imageY, (int) (image.getWidth() / scaleFactor),
(int) (image.getHeight() / scaleFactor), null); (int) (image.getHeight() / scaleFactor), null);
} }
} }
@ -461,7 +460,7 @@ public class DefaultProcessDiagramCanvas {
public void drawCatchingSignalEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor) { public void drawCatchingSignalEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor) {
drawCatchingEvent(graphicInfo, isInterrupting, SIGNAL_CATCH_IMAGE, "signal", scaleFactor); drawCatchingEvent(graphicInfo, isInterrupting, SIGNAL_CATCH_IMAGE, "signal", scaleFactor);
} }
public void drawCatchingMessageEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor) { public void drawCatchingMessageEvent(GraphicInfo graphicInfo, boolean isInterrupting, double scaleFactor) {
drawCatchingEvent(graphicInfo, isInterrupting, MESSAGE_CATCH_IMAGE, "message", scaleFactor); drawCatchingEvent(graphicInfo, isInterrupting, MESSAGE_CATCH_IMAGE, "message", scaleFactor);
} }
@ -470,7 +469,7 @@ public class DefaultProcessDiagramCanvas {
drawCatchingEvent(graphicInfo, isInterrupting, MESSAGE_CATCH_IMAGE, "message", scaleFactor); drawCatchingEvent(graphicInfo, isInterrupting, MESSAGE_CATCH_IMAGE, "message", scaleFactor);
drawLabel(name, graphicInfo); drawLabel(name, graphicInfo);
} }
public void drawThrowingCompensateEvent(GraphicInfo graphicInfo, double scaleFactor) { public void drawThrowingCompensateEvent(GraphicInfo graphicInfo, double scaleFactor) {
drawCatchingEvent(graphicInfo, true, COMPENSATE_THROW_IMAGE, "compensate", scaleFactor); drawCatchingEvent(graphicInfo, true, COMPENSATE_THROW_IMAGE, "compensate", scaleFactor);
} }
@ -478,7 +477,7 @@ public class DefaultProcessDiagramCanvas {
public void drawThrowingSignalEvent(GraphicInfo graphicInfo, double scaleFactor) { public void drawThrowingSignalEvent(GraphicInfo graphicInfo, double scaleFactor) {
drawCatchingEvent(graphicInfo, true, SIGNAL_THROW_IMAGE, "signal", scaleFactor); drawCatchingEvent(graphicInfo, true, SIGNAL_THROW_IMAGE, "signal", scaleFactor);
} }
public void drawThrowingNoneEvent(GraphicInfo graphicInfo, double scaleFactor) { public void drawThrowingNoneEvent(GraphicInfo graphicInfo, double scaleFactor) {
drawCatchingEvent(graphicInfo, true, null, "none", 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) { public void drawSequenceflow(int srcX, int srcY, int targetX, int targetY, boolean conditional, double scaleFactor) {
drawSequenceflow(srcX, srcY, targetX, targetY, conditional, false, 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) { public void drawSequenceflow(int srcX, int srcY, int targetX, int targetY, boolean conditional, boolean highLighted, double scaleFactor) {
Paint originalPaint = g.getPaint(); Paint originalPaint = g.getPaint();
if (highLighted) if (highLighted)
@ -512,10 +511,10 @@ public class DefaultProcessDiagramCanvas {
public void drawSequenceflow(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, boolean highLighted, double scaleFactor) { 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); 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) { AssociationDirection associationDirection, boolean highLighted, double scaleFactor) {
Paint originalPaint = g.getPaint(); Paint originalPaint = g.getPaint();
Stroke originalStroke = g.getStroke(); Stroke originalStroke = g.getStroke();
@ -535,7 +534,7 @@ public class DefaultProcessDiagramCanvas {
Line2D.Double line = new Line2D.Double(sourceX, sourceY, targetX, targetY); Line2D.Double line = new Line2D.Double(sourceX, sourceY, targetX, targetY);
g.draw(line); g.draw(line);
} }
if (isDefault){ if (isDefault){
Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]); Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
drawDefaultSequenceFlowIndicator(line, scaleFactor); drawDefaultSequenceFlowIndicator(line, scaleFactor);
@ -545,7 +544,7 @@ public class DefaultProcessDiagramCanvas {
Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]); Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
drawConditionalSequenceFlowIndicator(line, scaleFactor); drawConditionalSequenceFlowIndicator(line, scaleFactor);
} }
if (associationDirection.equals(AssociationDirection.ONE) || associationDirection.equals(AssociationDirection.BOTH)) { 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]); 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); drawArrowHead(line, scaleFactor);
@ -660,22 +659,22 @@ public class DefaultProcessDiagramCanvas {
public void drawTask(BufferedImage icon, String name, GraphicInfo graphicInfo, double scaleFactor) { public void drawTask(BufferedImage icon, String name, GraphicInfo graphicInfo, double scaleFactor) {
drawTask(name, graphicInfo); drawTask(name, graphicInfo);
g.drawImage(icon, (int) (graphicInfo.getX() + ICON_PADDING / scaleFactor), g.drawImage(icon, (int) (graphicInfo.getX() + ICON_PADDING / scaleFactor),
(int) (graphicInfo.getY() + ICON_PADDING / scaleFactor), (int) (graphicInfo.getY() + ICON_PADDING / scaleFactor),
(int) (icon.getWidth() / scaleFactor), (int) (icon.getHeight() / scaleFactor), null); (int) (icon.getWidth() / scaleFactor), (int) (icon.getHeight() / scaleFactor), null);
} }
public void drawTask(String name, GraphicInfo graphicInfo) { public void drawTask(String name, GraphicInfo graphicInfo) {
drawTask(name, graphicInfo, false); drawTask(name, graphicInfo, false);
} }
public void drawPoolOrLane(String name, GraphicInfo graphicInfo) { public void drawPoolOrLane(String name, GraphicInfo graphicInfo) {
int x = (int) graphicInfo.getX(); int x = (int) graphicInfo.getX();
int y = (int) graphicInfo.getY(); int y = (int) graphicInfo.getY();
int width = (int) graphicInfo.getWidth(); int width = (int) graphicInfo.getWidth();
int height = (int) graphicInfo.getHeight(); int height = (int) graphicInfo.getHeight();
g.drawRect(x, y, width, height); g.drawRect(x, y, width, height);
// Add the name as text, vertical // Add the name as text, vertical
if(name != null && name.length() > 0) { if(name != null && name.length() > 0) {
// Include some padding // Include some padding
@ -689,10 +688,10 @@ public class DefaultProcessDiagramCanvas {
Font currentFont = g.getFont(); Font currentFont = g.getFont();
Font theDerivedFont = currentFont.deriveFont(transformation); Font theDerivedFont = currentFont.deriveFont(transformation);
g.setFont(theDerivedFont); g.setFont(theDerivedFont);
String truncated = fitTextToWidth(name, availableTextSpace); String truncated = fitTextToWidth(name, availableTextSpace);
int realWidth = fontMetrics.stringWidth(truncated); int realWidth = fontMetrics.stringWidth(truncated);
g.drawString(truncated, x + 2 + fontMetrics.getHeight(), 3 + y + availableTextSpace - (availableTextSpace - realWidth) / 2); g.drawString(truncated, x + 2 + fontMetrics.getHeight(), 3 + y + availableTextSpace - (availableTextSpace - realWidth) / 2);
g.setFont(currentFont); g.setFont(currentFont);
} }
@ -704,14 +703,14 @@ public class DefaultProcessDiagramCanvas {
int y = (int) graphicInfo.getY(); int y = (int) graphicInfo.getY();
int width = (int) graphicInfo.getWidth(); int width = (int) graphicInfo.getWidth();
int height = (int) graphicInfo.getHeight(); int height = (int) graphicInfo.getHeight();
// Create a new gradient paint for every task box, gradient depends on x and y and is not relative // 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(TASK_BOX_COLOR);
g.setPaint(new Color(255,255,0)); g.setPaint(new Color(144,238,144));
int arcR = 6; int arcR = 6;
if (thickBorder) if (thickBorder)
arcR = 3; arcR = 3;
// shape // shape
RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, arcR, arcR); RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, arcR, arcR);
g.fill(rect); g.fill(rect);
@ -733,11 +732,11 @@ public class DefaultProcessDiagramCanvas {
int boxHeight = height - 16 - ICON_PADDING - ICON_PADDING - MARKER_WIDTH - 2 - 2; int boxHeight = height - 16 - ICON_PADDING - ICON_PADDING - MARKER_WIDTH - 2 - 2;
int boxX = x + width/2 - boxWidth/2; int boxX = x + width/2 - boxWidth/2;
int boxY = y + height/2 - boxHeight/2 + ICON_PADDING + ICON_PADDING - 2 - 2; int boxY = y + height/2 - boxHeight/2 + ICON_PADDING + ICON_PADDING - 2 - 2;
drawMultilineCentredText(name, boxX, boxY, boxWidth, boxHeight); drawMultilineCentredText(name, boxX, boxY, boxWidth, boxHeight);
} }
} }
protected void drawMultilineCentredText(String text, int x, int y, int boxWidth, int boxHeight) { protected void drawMultilineCentredText(String text, int x, int y, int boxWidth, int boxHeight) {
drawMultilineText(text, x, y, boxWidth, boxHeight, true); 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) { protected void drawMultilineAnnotationText(String text, int x, int y, int boxWidth, int boxHeight) {
drawMultilineText(text, x, y, boxWidth, boxHeight, false); drawMultilineText(text, x, y, boxWidth, boxHeight, false);
} }
protected void drawMultilineText(String text, int x, int y, int boxWidth, int boxHeight, boolean centered) { protected void drawMultilineText(String text, int x, int y, int boxWidth, int boxHeight, boolean centered) {
// Create an attributed string based in input text // Create an attributed string based in input text
AttributedString attributedString = new AttributedString(text); AttributedString attributedString = new AttributedString(text);
attributedString.addAttribute(TextAttribute.FONT, g.getFont()); attributedString.addAttribute(TextAttribute.FONT, g.getFont());
attributedString.addAttribute(TextAttribute.FOREGROUND, Color.black); attributedString.addAttribute(TextAttribute.FOREGROUND, Color.black);
AttributedCharacterIterator characterIterator = attributedString.getIterator(); AttributedCharacterIterator characterIterator = attributedString.getIterator();
int currentHeight = 0; int currentHeight = 0;
// Prepare a list of lines of text we'll be drawing // Prepare a list of lines of text we'll be drawing
List<TextLayout> layouts = new ArrayList<TextLayout>(); List<TextLayout> layouts = new ArrayList<TextLayout>();
String lastLine = null; String lastLine = null;
LineBreakMeasurer measurer = new LineBreakMeasurer(characterIterator, g.getFontRenderContext()); LineBreakMeasurer measurer = new LineBreakMeasurer(characterIterator, g.getFontRenderContext());
TextLayout layout = null; TextLayout layout = null;
while (measurer.getPosition() < characterIterator.getEndIndex() && currentHeight <= boxHeight) { while (measurer.getPosition() < characterIterator.getEndIndex() && currentHeight <= boxHeight) {
int previousPosition = measurer.getPosition(); int previousPosition = measurer.getPosition();
// Request next layout // Request next layout
layout = measurer.nextLayout(boxWidth); layout = measurer.nextLayout(boxWidth);
int height = ((Float)(layout.getDescent() + layout.getAscent() + layout.getLeading())).intValue(); int height = ((Float)(layout.getDescent() + layout.getAscent() + layout.getLeading())).intValue();
if(currentHeight + height > boxHeight) { if(currentHeight + height > boxHeight) {
// The line we're about to add should NOT be added anymore, append three dots to previous one instead // 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 // to indicate more text is truncated
if (!layouts.isEmpty()) { if (!layouts.isEmpty()) {
layouts.remove(layouts.size() - 1); layouts.remove(layouts.size() - 1);
if(lastLine.length() >= 4) { if(lastLine.length() >= 4) {
lastLine = lastLine.substring(0, lastLine.length() - 4) + "..."; lastLine = lastLine.substring(0, lastLine.length() - 4) + "...";
} }
@ -789,23 +788,23 @@ public class DefaultProcessDiagramCanvas {
currentHeight += height; currentHeight += height;
} }
} }
int currentY = y + (centered ? ((boxHeight - currentHeight) /2) : 0); int currentY = y + (centered ? ((boxHeight - currentHeight) /2) : 0);
int currentX = 0; int currentX = 0;
// Actually draw the lines // Actually draw the lines
for(TextLayout textLayout : layouts) { for(TextLayout textLayout : layouts) {
currentY += textLayout.getAscent(); currentY += textLayout.getAscent();
currentX = x + (centered ? ((boxWidth - ((Double)textLayout.getBounds().getWidth()).intValue()) /2) : 0); currentX = x + (centered ? ((boxWidth - ((Double)textLayout.getBounds().getWidth()).intValue()) /2) : 0);
textLayout.draw(g, currentX, currentY); textLayout.draw(g, currentX, currentY);
currentY += textLayout.getDescent() + textLayout.getLeading(); currentY += textLayout.getDescent() + textLayout.getLeading();
} }
} }
protected String fitTextToWidth(String original, int width) { protected String fitTextToWidth(String original, int width) {
String text = original; String text = original;
@ -847,23 +846,23 @@ public class DefaultProcessDiagramCanvas {
public void drawManualTask(String name, GraphicInfo graphicInfo, double scaleFactor) { public void drawManualTask(String name, GraphicInfo graphicInfo, double scaleFactor) {
drawTask(MANUALTASK_IMAGE, name, graphicInfo, scaleFactor); drawTask(MANUALTASK_IMAGE, name, graphicInfo, scaleFactor);
} }
public void drawBusinessRuleTask(String name, GraphicInfo graphicInfo, double scaleFactor) { public void drawBusinessRuleTask(String name, GraphicInfo graphicInfo, double scaleFactor) {
drawTask(BUSINESS_RULE_TASK_IMAGE, name, graphicInfo, scaleFactor); drawTask(BUSINESS_RULE_TASK_IMAGE, name, graphicInfo, scaleFactor);
} }
public void drawCamelTask(String name, GraphicInfo graphicInfo, double scaleFactor) { public void drawCamelTask(String name, GraphicInfo graphicInfo, double scaleFactor) {
drawTask(CAMEL_TASK_IMAGE, name, graphicInfo, scaleFactor); drawTask(CAMEL_TASK_IMAGE, name, graphicInfo, scaleFactor);
} }
public void drawMuleTask(String name, GraphicInfo graphicInfo, double scaleFactor) { public void drawMuleTask(String name, GraphicInfo graphicInfo, double scaleFactor) {
drawTask(MULE_TASK_IMAGE, name, graphicInfo, scaleFactor); drawTask(MULE_TASK_IMAGE, name, graphicInfo, scaleFactor);
} }
public void drawExpandedSubProcess(String name, GraphicInfo graphicInfo, Boolean isTriggeredByEvent, double 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); graphicInfo.getWidth(), graphicInfo.getHeight(), 8, 8);
// Use different stroke (dashed) // Use different stroke (dashed)
if (isTriggeredByEvent) { if (isTriggeredByEvent) {
Stroke originalStroke = g.getStroke(); Stroke originalStroke = g.getStroke();
@ -939,7 +938,7 @@ public class DefaultProcessDiagramCanvas {
int y = (int) graphicInfo.getY(); int y = (int) graphicInfo.getY();
int width = (int) graphicInfo.getWidth(); int width = (int) graphicInfo.getWidth();
int height = (int) graphicInfo.getHeight(); int height = (int) graphicInfo.getHeight();
rhombus.addPoint(x, y + (height / 2)); rhombus.addPoint(x, y + (height / 2));
rhombus.addPoint(x + (width / 2), y + height); rhombus.addPoint(x + (width / 2), y + height);
rhombus.addPoint(x + width, y + (height / 2)); rhombus.addPoint(x + width, y + (height / 2));
@ -1009,39 +1008,39 @@ public class DefaultProcessDiagramCanvas {
g.setStroke(orginalStroke); g.setStroke(orginalStroke);
} }
} }
public void drawEventBasedGateway(GraphicInfo graphicInfo, double scaleFactor) { public void drawEventBasedGateway(GraphicInfo graphicInfo, double scaleFactor) {
// rhombus // rhombus
drawGateway(graphicInfo); drawGateway(graphicInfo);
if (scaleFactor == 1.0) { if (scaleFactor == 1.0) {
int x = (int) graphicInfo.getX(); int x = (int) graphicInfo.getX();
int y = (int) graphicInfo.getY(); int y = (int) graphicInfo.getY();
int width = (int) graphicInfo.getWidth(); int width = (int) graphicInfo.getWidth();
int height = (int) graphicInfo.getHeight(); int height = (int) graphicInfo.getHeight();
double scale = .6; double scale = .6;
GraphicInfo eventInfo = new GraphicInfo(); GraphicInfo eventInfo = new GraphicInfo();
eventInfo.setX(x + width*(1-scale)/2); eventInfo.setX(x + width*(1-scale)/2);
eventInfo.setY(y + height*(1-scale)/2); eventInfo.setY(y + height*(1-scale)/2);
eventInfo.setWidth(width*scale); eventInfo.setWidth(width*scale);
eventInfo.setHeight(height*scale); eventInfo.setHeight(height*scale);
drawCatchingEvent(eventInfo, true, null, "eventGateway", scaleFactor); drawCatchingEvent(eventInfo, true, null, "eventGateway", scaleFactor);
double r = width / 6.; double r = width / 6.;
// create pentagon (coords with respect to center) // create pentagon (coords with respect to center)
int topX = (int)(.95 * r); // top right corner int topX = (int)(.95 * r); // top right corner
int topY = (int)(-.31 * r); int topY = (int)(-.31 * r);
int bottomX = (int)(.59 * r); // bottom right corner int bottomX = (int)(.59 * r); // bottom right corner
int bottomY = (int)(.81 * r); int bottomY = (int)(.81 * r);
int[] xPoints = new int[]{ 0, topX, bottomX, -bottomX, -topX }; int[] xPoints = new int[]{ 0, topX, bottomX, -bottomX, -topX };
int[] yPoints = new int[]{ -(int)r, topY, bottomY, bottomY, topY }; int[] yPoints = new int[]{ -(int)r, topY, bottomY, bottomY, topY };
Polygon pentagon = new Polygon(xPoints, yPoints, 5); Polygon pentagon = new Polygon(xPoints, yPoints, 5);
pentagon.translate(x+width/2, y+width/2); pentagon.translate(x+width/2, y+width/2);
// draw // draw
g.drawPolygon(pentagon); g.drawPolygon(pentagon);
} }
@ -1105,12 +1104,12 @@ public class DefaultProcessDiagramCanvas {
int y = (int) graphicInfo.getY(); int y = (int) graphicInfo.getY();
int width = (int) graphicInfo.getWidth(); int width = (int) graphicInfo.getWidth();
int height = (int) graphicInfo.getHeight(); int height = (int) graphicInfo.getHeight();
Font originalFont = g.getFont(); Font originalFont = g.getFont();
Stroke originalStroke = g.getStroke(); Stroke originalStroke = g.getStroke();
g.setFont(ANNOTATION_FONT); g.setFont(ANNOTATION_FONT);
Path2D path = new Path2D.Double(); Path2D path = new Path2D.Double();
x += .5; x += .5;
int lineLength = 18; int lineLength = 18;
@ -1118,35 +1117,35 @@ public class DefaultProcessDiagramCanvas {
path.lineTo(x, y); path.lineTo(x, y);
path.lineTo(x, y + height); path.lineTo(x, y + height);
path.lineTo(x + lineLength, y + height); path.lineTo(x + lineLength, y + height);
path.lineTo(x + lineLength, y + height -1); path.lineTo(x + lineLength, y + height -1);
path.lineTo(x + 1, y + height -1); path.lineTo(x + 1, y + height -1);
path.lineTo(x + 1, y + 1); path.lineTo(x + 1, y + 1);
path.lineTo(x + lineLength, y + 1); path.lineTo(x + lineLength, y + 1);
path.closePath(); path.closePath();
g.draw(path); g.draw(path);
int boxWidth = width - (2 * ANNOTATION_TEXT_PADDING); int boxWidth = width - (2 * ANNOTATION_TEXT_PADDING);
int boxHeight = height - (2 * ANNOTATION_TEXT_PADDING); int boxHeight = height - (2 * ANNOTATION_TEXT_PADDING);
int boxX = x + width/2 - boxWidth/2; int boxX = x + width/2 - boxWidth/2;
int boxY = y + height/2 - boxHeight/2; int boxY = y + height/2 - boxHeight/2;
if (text != null && text.isEmpty() == false) { if (text != null && text.isEmpty() == false) {
drawMultilineAnnotationText(text, boxX, boxY, boxWidth, boxHeight); drawMultilineAnnotationText(text, boxX, boxY, boxWidth, boxHeight);
} }
// restore originals // restore originals
g.setFont(originalFont); g.setFont(originalFont);
g.setStroke(originalStroke); g.setStroke(originalStroke);
} }
public void drawLabel(String text, GraphicInfo graphicInfo){ public void drawLabel(String text, GraphicInfo graphicInfo){
drawLabel(text, graphicInfo, true); drawLabel(text, graphicInfo, true);
} }
public void drawLabel(String text, GraphicInfo graphicInfo, boolean centered){ public void drawLabel(String text, GraphicInfo graphicInfo, boolean centered){
float interline = 1.0f; float interline = 1.0f;
// text // text
if (text != null && text.length()>0) { if (text != null && text.length()>0) {
Paint originalPaint = g.getPaint(); Paint originalPaint = g.getPaint();
@ -1157,7 +1156,7 @@ public class DefaultProcessDiagramCanvas {
int wrapWidth = 100; int wrapWidth = 100;
int textY = (int) graphicInfo.getY(); int textY = (int) graphicInfo.getY();
// TODO: use drawMultilineText() // TODO: use drawMultilineText()
AttributedString as = new AttributedString(text); AttributedString as = new AttributedString(text);
as.addAttribute(TextAttribute.FOREGROUND, g.getPaint()); as.addAttribute(TextAttribute.FOREGROUND, g.getPaint());
@ -1165,7 +1164,7 @@ public class DefaultProcessDiagramCanvas {
AttributedCharacterIterator aci = as.getIterator(); AttributedCharacterIterator aci = as.getIterator();
FontRenderContext frc = new FontRenderContext(null, true, false); FontRenderContext frc = new FontRenderContext(null, true, false);
LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc); LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc);
while (lbm.getPosition() < text.length()) { while (lbm.getPosition() < text.length()) {
TextLayout tl = lbm.nextLayout(wrapWidth); TextLayout tl = lbm.nextLayout(wrapWidth);
textY += tl.getAscent(); textY += tl.getAscent();
@ -1177,7 +1176,7 @@ public class DefaultProcessDiagramCanvas {
tl.draw(g, (float) tX, textY); tl.draw(g, (float) tX, textY);
textY += tl.getDescent() + tl.getLeading() + (interline - 1.0f) * tl.getAscent(); textY += tl.getDescent() + tl.getLeading() + (interline - 1.0f) * tl.getAscent();
} }
// restore originals // restore originals
g.setFont(originalFont); g.setFont(originalFont);
g.setPaint(originalPaint); g.setPaint(originalPaint);
@ -1191,7 +1190,7 @@ public class DefaultProcessDiagramCanvas {
* @param sourceGraphicInfo * @param sourceGraphicInfo
* @param targetGraphicInfo * @param targetGraphicInfo
* @param graphicInfoList * @param graphicInfoList
* *
*/ */
public List<GraphicInfo> connectionPerfectionizer(SHAPE_TYPE sourceShapeType, SHAPE_TYPE targetShapeType, GraphicInfo sourceGraphicInfo, GraphicInfo targetGraphicInfo, List<GraphicInfo> graphicInfoList) { public List<GraphicInfo> connectionPerfectionizer(SHAPE_TYPE sourceShapeType, SHAPE_TYPE targetShapeType, GraphicInfo sourceGraphicInfo, GraphicInfo targetGraphicInfo, List<GraphicInfo> graphicInfoList) {
Shape shapeFirst = createShape(sourceShapeType, sourceGraphicInfo); Shape shapeFirst = createShape(sourceShapeType, sourceGraphicInfo);
@ -1208,9 +1207,9 @@ public class DefaultProcessDiagramCanvas {
graphicInfoLast.setX(shapeLast.getBounds2D().getCenterX()); graphicInfoLast.setX(shapeLast.getBounds2D().getCenterX());
graphicInfoLast.setY(shapeLast.getBounds2D().getCenterY()); graphicInfoLast.setY(shapeLast.getBounds2D().getCenterY());
} }
Point p = null; Point p = null;
if (shapeFirst != null) { if (shapeFirst != null) {
Line2D.Double lineFirst = new Line2D.Double(graphicInfoFirst.getX(), graphicInfoFirst.getY(), graphicInfoList.get(1).getX(), graphicInfoList.get(1).getY()); Line2D.Double lineFirst = new Line2D.Double(graphicInfoFirst.getX(), graphicInfoFirst.getY(), graphicInfoList.get(1).getX(), graphicInfoList.get(1).getY());
p = getIntersection(shapeFirst, lineFirst); p = getIntersection(shapeFirst, lineFirst);
@ -1219,7 +1218,7 @@ public class DefaultProcessDiagramCanvas {
graphicInfoFirst.setY(p.getY()); graphicInfoFirst.setY(p.getY());
} }
} }
if (shapeLast != null) { 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()); 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); p = getIntersection(shapeLast, lineLast);
@ -1242,7 +1241,7 @@ public class DefaultProcessDiagramCanvas {
private static Shape createShape(SHAPE_TYPE shapeType, GraphicInfo graphicInfo) { private static Shape createShape(SHAPE_TYPE shapeType, GraphicInfo graphicInfo) {
if (SHAPE_TYPE.Rectangle.equals(shapeType)) { if (SHAPE_TYPE.Rectangle.equals(shapeType)) {
// source is rectangle // 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)) { } else if (SHAPE_TYPE.Rhombus.equals(shapeType)) {
// source is rhombus // source is rhombus
Path2D.Double rhombus = new Path2D.Double(); Path2D.Double rhombus = new Path2D.Double();
@ -1264,7 +1263,7 @@ public class DefaultProcessDiagramCanvas {
/** /**
* This method returns intersection point of shape border and line. * This method returns intersection point of shape border and line.
* *
* @param shape * @param shape
* @param line * @param line
* @return Point * @return Point
@ -1298,7 +1297,7 @@ public class DefaultProcessDiagramCanvas {
/** /**
* This method calculates shape intersection with line. * This method calculates shape intersection with line.
* *
* @param shape * @param shape
* @param line * @param line
* @return Intersection point * @return Intersection point

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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">&#xe63f;</i>
<br/>
<i class="layui-icon layui-timeline-axis">&#xe61a;</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>

View File

@ -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>

View File

@ -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">&#xe640;</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">&#xe640;</i>查看流程图</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delcareDetail"><i class="layui-icon">&#xe640;</i>查看审批详情</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delcareBillDetail"><i class="layui-icon">&#xe640;</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>

View File

@ -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>

View File

@ -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>

View File

@ -8,163 +8,146 @@ To change this template use File | Settings | File Templates.-->
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>新建请假</title> <title>新建请假</title>
<meta name="renderer" content="webkit"> <meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" /> <meta name="viewport"
<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css"> 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/ztree/css/metroStyle/metroStyle.css"> <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/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/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/tools/tool.js" charset="utf-8"></script>
</head> </head>
<body> <body>
<div class="x-body"> <div class="x-body">
<form class="layui-form layui-form-pane" style="margin-left: 20px;"> <form class="layui-form layui-form-pane" style="margin-left: 20px;">
<div style="width:100%;height:400px;overflow: auto;"> <div style="width:100%;height:400px;overflow: auto;">
<div class="layui-form-item"> <div class="layui-form-item">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;"> <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
<legend style="font-size:16px;">请假信息</legend> <legend style="font-size:16px;">请假信息</legend>
</fieldset> </fieldset>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label for="beginTime" class="layui-form-label"> <label for="beginTime" class="layui-form-label">
<span class="x-red">*</span>开始时间 <span class="x-red">*</span>开始时间
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" id="beginTime" name="beginTime" lay-verify="beginTime" placeholder="yyyy-MM-dd" <input type="text" id="beginTime" name="beginTime" lay-verify="beginTime" placeholder="yyyy-MM-dd"
autocomplete="off" class="layui-input"> autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline"> <div class="layui-inline">
<label for="endTime" class="layui-form-label"> <label for="endTime" class="layui-form-label">
<span class="x-red">*</span>结束时间 <span class="x-red">*</span>结束时间
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" id="endTime" name="endTime" lay-verify="endTime" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input"> <input type="text" id="endTime" name="endTime" lay-verify="endTime" placeholder="yyyy-MM-dd"
</div> autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item"> </div>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;"> <div class="layui-form-item">
<legend style="font-size:16px;">原因</legend> <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
</fieldset> <legend style="font-size:16px;">原因</legend>
</div> </fieldset>
<div class="layui-form-item"> </div>
<div class="layui-inline"> <div class="layui-form-item">
<label for="reason" class="layui-form-label"> <div class="layui-inline">
<span class="x-red">*</span>请假原因 <label for="reason" class="layui-form-label">
</label> <span class="x-red">*</span>请假原因
<div class="layui-input-inline"> </label>
<input type="text" id="reason" style="width: 300px;" name="reason" lay-verify="reason" autocomplete="off" class="layui-input"> <div class="layui-input-inline">
</div> <input type="text" id="reason" style="width: 300px;" name="reason" lay-verify="reason"
</div> autocomplete="off" class="layui-input">
</div> </div>
<div style="height: 60px"></div> </div>
</div> </div>
<div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6; <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;"> 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 class="layui-btn layui-btn-normal" lay-filter="add" lay-submit>
申请 申请
</button> </button>
<button class="layui-btn layui-btn-primary" data-type="close"> <button class="layui-btn layui-btn-primary" data-type="close">
取消 取消
</button> </button>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<script> <script>
layui.use(['form','layer'], function(){ layui.use(['form', 'layer'], function () {
$ = layui.jquery; $ = layui.jquery;
var form = layui.form var form = layui.form
,layer = layui.layer , layer = layui.layer
,laydate = layui.laydate; , laydate = layui.laydate;
var d = new Date(); var d = new Date();
var day=d.getFullYear()+"-"+(parseInt(d.getMonth())+1)+'-'+d.getDate(); var day = d.getFullYear() + "-" + (parseInt(d.getMonth()) + 1) + '-' + d.getDate();
console.log(day); console.log(day);
var $ = layui.$, active = { var $ = layui.$, active = {
close: function () { close: function () {
var index = parent.layer.getFrameIndex(window.name); var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index); 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});
} }
},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); var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index); parent.layer.close(index);
}); })
} //监听提交
}); form.on('submit(add)', function (data) {
return false; layerAjax('addLeave', data.field, 'leaveList');
return false;
});
}); });
});
</script> </script>
</body> </body>

View File

@ -78,10 +78,14 @@
layui.use('table', function () { layui.use('table', function () {
var table = layui.table; var table = layui.table;
//方法级渲染 //方法级渲染
var arr=[];
if(${leaveDetail}){
arr=${leaveDetail};
}
table.render({ table.render({
id: 'leaveDetail', id: 'leaveDetail',
elem: '#leaveDetail' elem: '#leaveDetail'
, data: ${leaveDetail} , data:arr
, cols: [[ , cols: [[
{field: 'taskId', title: '任务编码', width: '20%'} {field: 'taskId', title: '任务编码', width: '20%'}
,{field: 'opName', title: '审批人', width: '20%'} ,{field: 'opName', title: '审批人', width: '20%'}

View File

@ -7,234 +7,214 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>请假流程示例</title> <title>请假流程示例</title>
<meta name="renderer" content="webkit"> <#include "/system/base/header.ftl">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <script src="${re.contextPath}/plugin/activiti.js"></script>
<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> </head>
<body> <body>
<div class="lenos-search"> <div class="lenos-search">
<div class="select"> <div class="select">
开始时间: 开始时间:
<div class="layui-inline"> <span class="layui-inline">
<input class="layui-input" placeholder="yyyy-MM-dd" height="20px" id="beginTime" autocomplete="off"> <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>
结束时间: <div class="len-form-item">
<div class="layui-inline"> <button type="button" class="layui-btn layui-btn-normal layui-btn layui-btn-sm" data-type="select">查询</button>
<input class="layui-input" placeholder="yyyy-MM-dd" height="20px" id="endTime" autocomplete="off"> <button type="button" class="layui-btn layui-btn-normal layui-btn layui-btn-sm" data-type="reload">重置</button>
</div> </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>
<div class="layui-col-md12"> <div class="layui-col-md12">
<div class="layui-btn-group"> <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">&#xe640;</i>新建请假 <i class="layui-icon">&#xe640;</i>新建请假
</button> </button>
</div> </div>
</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"> <script type="text/html" id="toolBar">
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="getProcImage"><i class="layui-icon">&#xe640;</i>查看流程图</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="getProcImage"><i class="layui-icon">&#xe640;</i>查看流程图</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="leaveDetail"><i class="layui-icon">&#xe640;</i>查看详情</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="leaveDetail"><i
class="layui-icon">&#xe640;</i>查看详情</a>
</script> </script>
<script type="text/html" id="status"> <script type="text/html" id="status">
{{#if(typeof(d.taskName)!='undefined'){}} {{#if(typeof(d.taskName)!='undefined'){}}
<div>${d.taskName}</div> <div>${d.taskName}</div>
{{# }else{}} {{# }else{}}
结束 结束
{{# }}} {{# }}}
</script> </script>
<script> <script>
layui.laytpl.toDateString = function(d, format){ layui.laytpl.toDateString = function (d, format) {
var date = new Date(d || new Date()) var date = new Date(d || new Date())
,ymd = [ , ymd = [
this.digit(date.getFullYear(), 4) this.digit(date.getFullYear(), 4)
,this.digit(date.getMonth() + 1) , this.digit(date.getMonth() + 1)
,this.digit(date.getDate()) , this.digit(date.getDate())
] ]
,hms = [ , hms = [
this.digit(date.getHours()) this.digit(date.getHours())
,this.digit(date.getMinutes()) , this.digit(date.getMinutes())
,this.digit(date.getSeconds()) , 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]) return format.replace(/yyyy/g, ymd[0])
.replace(/MM/g, ymd[1]) .replace(/MM/g, ymd[1])
.replace(/dd/g, ymd[2]) .replace(/dd/g, ymd[2])
.replace(/HH/g, hms[0]) .replace(/HH/g, hms[0])
.replace(/mm/g, hms[1]) .replace(/mm/g, hms[1])
.replace(/ss/g, hms[2]); .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
}
});
}
}; };
//监听工具条
table.on('tool(leave)', function (obj) { //数字前置补零
var data = obj.data; layui.laytpl.digit = function (num, length, end) {
if (obj.event === 'start') { var str = '';
start(data.key); num = String(num);
}else if(obj.event === 'getProcImage'){ length = length || 2;
// var url='getProcImage?processInstanceId='+data.processInstanceId+''; for (var i = num.length; i < length; i++) {
layer.open({ str += '0';
id: 'leave-image', }
type: 2, return num < Math.pow(10, length) ? str + (num | 0) : num;
area: [ '880px', '400px'], };
fix: false,
maxmin: true, document.onkeydown = function (e) { // 回车提交表单
shadeClose: false, var theEvent = window.event || e;
shade: 0.4, var code = theEvent.keyCode || theEvent.which;
title: '流程图', if (code == 13) {
content: '/leave/shinePics/' + data.processInstanceId $(".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'){ var b = laydate.render({
layer.open({ elem: '#endTime'
id: 'leave-detail',
type: 2,
area: [ '880px', '400px'],
fix: false,
maxmin: true,
shadeClose: false,
shade: 0.4,
title: '审核详情',
content: "leaveDetail?processId="+data.processInstanceId
}); });
} //方法级渲染
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'); function add(title, url, w, h) {
eleClick(active,'.select .layui-btn'); window.top.layer.open({
id: 'leave-add',
}); type: 2,
area: [w + 'px', h + 'px'],
function add(title, url, w, h) { fix: false,
if (title == null || title == '') { maxmin: true,
title = false; 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> </script>
</body> </body>

View File

@ -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>

View File

@ -9,39 +9,28 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>我的任务</title> <title>我的任务</title>
<meta name="renderer" content="webkit"> <#include "/system/base/header.ftl">
<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>
</head> </head>
<body> <body>
<div class="lenos-search"> <div class="lenos-search">
<div class="select"> <div class="select">
操作用户: 操作用户:
<div class="layui-inline"> <span class="layui-inline">
<input class="layui-input" height="20px" id="userName" autocomplete="off"> <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"> <input class="layui-input" height="20px" id="type" autocomplete="off">
</div> </span>
<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="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> </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"> <script type="text/html" id="toolBar">
{{# if(d.flag){ }} {{# if(d.flag){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="update"><i class="layui-icon">&#xe640;</i>编辑</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="update"><i class="layui-icon">&#xe640;</i>编辑</a>
@ -94,12 +83,20 @@
} }
layui.use('table', function () { layui.use('table', function () {
var table = layui.table; table = layui.table;
//方法级渲染 //方法级渲染
table.render({ table.render({
id: 'taskList', id: 'taskList',
elem: '#taskList' elem: '#taskList'
, url: 'showTaskList' , url: 'showTaskList'
,parseData: function(res){
return {
"code": res.code,
"msg": res.msg,
"count": res.count,
"data": res.data
};
}
, cols: [[ , cols: [[
{checkbox: true, fixed: true, width: '5%'} {checkbox: true, fixed: true, width: '5%'}
, {field: 'id', title: '任务编码', width: '10%', sort: true} , {field: 'id', title: '任务编码', width: '10%', sort: true}
@ -154,11 +151,11 @@
table.on('tool(task)', function (obj) { table.on('tool(task)', function (obj) {
var data = obj.data; var data = obj.data;
if (obj.event === 'handle') { 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'){ }else if(obj.event === 'update'){
popup('编辑','${re.contextPath}/leave/updateLeave/'+data.id,700,500,'task-update'); popup('编辑','${re.contextPath}/leave/updateLeave/'+data.id,700,500,'task-update');
}else if(obj.event==='leaveDetail'){ }else if(obj.event==='leaveDetail'){
layer.open({ window.top.layer.open({
id: 'leave-detail', id: 'leave-detail',
type: 2, type: 2,
area: [ '880px', '400px'], area: [ '880px', '400px'],
@ -167,43 +164,17 @@
shadeClose: false, shadeClose: false,
shade: 0.4, shade: 0.4,
title: '审核详情', 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'); var type = $(this).data('type');
active[type] ? active[type].call(this) : ''; 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> </script>
</body> </body>

View File

@ -7,208 +7,163 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>流程部署</title> <title>流程部署</title>
<meta name="renderer" content="webkit"> <#include "/system/base/header.ftl">
<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> </head>
<body> <body>
<div class="lenos-search"> <div class="lenos-search">
<div class="select"> <div class="select">
部署id 部署id
<div class="layui-inline"> <span class="layui-inline">
<input class="layui-input" height="20px" id="deploymentId" autocomplete="off"> <input class="layui-input" height="20px" id="deploymentId" autocomplete="off">
</div> </span>
流程名称: 流程名称:
<div class="layui-inline"> <span class="layui-inline">
<input class="layui-input" height="20px" id="name" autocomplete="off"> <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> </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>
<div class="layui-col-md12"> <div class="layui-col-md12">
<div class="layui-btn-group"> <div class="layui-btn-group">
<@shiro.hasPermission name="control:del"> <@shiro.hasPermission name="control:del">
<#-- <button class="layui-btn layui-btn-normal" id="processGroup" data-type="assignee"> </@shiro.hasPermission>
<i class="layui-icon">&#xe642;</i>节点处理人设置
</button>-->
</@shiro.hasPermission>
</div> </div>
</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"> <script type="text/html" id="toolBar">
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon">&#xe640;</i>删除</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon">&#xe640;</i>删除</a>
</script> </script>
<script> <script>
layui.laytpl.toDateString = function(d, format){ layui.laytpl.toDateString = function (d, format) {
var date = new Date(d || new Date()) var date = new Date(d || new Date())
,ymd = [ , ymd = [
this.digit(date.getFullYear(), 4) this.digit(date.getFullYear(), 4)
,this.digit(date.getMonth() + 1) , this.digit(date.getMonth() + 1)
,this.digit(date.getDate()) , this.digit(date.getDate())
] ]
,hms = [ , hms = [
this.digit(date.getHours()) this.digit(date.getHours())
,this.digit(date.getMinutes()) , this.digit(date.getMinutes())
,this.digit(date.getSeconds()) , 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]) return format.replace(/yyyy/g, ymd[0])
.replace(/MM/g, ymd[1]) .replace(/MM/g, ymd[1])
.replace(/dd/g, ymd[2]) .replace(/dd/g, ymd[2])
.replace(/HH/g, hms[0]) .replace(/HH/g, hms[0])
.replace(/mm/g, hms[1]) .replace(/mm/g, hms[1])
.replace(/ss/g, hms[2]); .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
}
});
}
}; };
//监听工具条
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'); layui.laytpl.digit = function (num, length, end) {
active[type] ? active[type].call(this) : ''; var str = '';
}); num = String(num);
$('.select .layui-btn').on('click', function () { length = length || 2;
var type = $(this).data('type'); for (var i = num.length; i < length; i++) {
active[type] ? active[type].call(this) : ''; str += '0';
});
});
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});
} }
} return num < Math.pow(10, length) ? str + (num | 0) : num;
}); };
}
/** document.onkeydown = function (e) { // 回车提交表单
* 流程绑定节点 var theEvent = window.event || e;
* @param id var code = theEvent.keyCode || theEvent.which;
*/ if (code == 13) {
/* function assignee(id,deploymentId){ $(".select .select-on").click();
var index = }
layer.open({ }
id: 'assignee',
type: 2, layui.use('table', function () {
area: ['600px', '350px'], table = layui.table;
fix: false, //方法级渲染
maxmin: true, table.render({
shadeClose: false, id: 'actList',
shade: 0.4, elem: '#actList'
title: '设置流程节点', , url: 'showAct'
content: 'goAssignee/'+deploymentId , 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> </script>

View File

@ -7,242 +7,234 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>模型列表</title> <title>模型列表</title>
<meta name="renderer" content="webkit"> <#include "/system/base/header.ftl">
<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> </head>
<body> <body>
<div class="lenos-search"> <div class="lenos-search">
<div class="select"> <div class="select">
模型名称: 模型名称:
<div class="layui-inline"> <span class="layui-inline">
<input class="layui-input" height="20px" id="name" autocomplete="off"> <input class="layui-input" height="20px" id="name" autocomplete="off">
</div> </span>
key key
<div class="layui-inline"> <span class="layui-inline">
<input class="layui-input" height="20px" id="key" autocomplete="off"> <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> </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>
<div class="layui-col-md12"> <div class="layui-col-md12">
<div class="layui-btn-group"> <div class="layui-btn-group">
<@shiro.hasPermission name="control:del"> <@shiro.hasPermission name="control:del">
<button class="layui-btn layui-btn-normal" data-type="syncdata"> <button class="layui-btn layui-btn-normal layui-btn-sm" data-type="syncdata">
<i class="layui-icon">&#xe618;</i>同步数据 <i class="layui-icon">&#xe618;</i>同步数据
</button>
</@shiro.hasPermission>
<button class="layui-btn layui-btn-normal layui-btn-sm" id="processGroup" data-type="add">
<i class="layui-icon">&#xe642;</i>新建流程
</button> </button>
</@shiro.hasPermission>
<button class="layui-btn layui-btn-normal" id="processGroup" data-type="add">
<i class="layui-icon">&#xe642;</i>新建流程
</button>
</div> </div>
</button>
</div> </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"> <script type="text/html" id="toolBar">
<shiro.hasPermission name="control:del"> <shiro.hasPermission name="control:del">
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="update"><i class="layui-icon">&#xe640;</i>编辑</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="update"><i class="layui-icon">&#xe640;</i>编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="open"><i class="layui-icon">&#xe640;</i>发布</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="open"><i class="layui-icon">&#xe640;</i>发布</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon">&#xe640;</i>删除</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon">&#xe640;</i>删除</a>
</shiro.hasPermission> </shiro.hasPermission>
</script> </script>
<script> <script>
layui.laytpl.toDateString = function(d, format){ layui.laytpl.toDateString = function (d, format) {
var date = new Date(d || new Date()) var date = new Date(d || new Date())
,ymd = [ , ymd = [
this.digit(date.getFullYear(), 4) this.digit(date.getFullYear(), 4)
,this.digit(date.getMonth() + 1) , this.digit(date.getMonth() + 1)
,this.digit(date.getDate()) , this.digit(date.getDate())
] ]
,hms = [ , hms = [
this.digit(date.getHours()) this.digit(date.getHours())
,this.digit(date.getMinutes()) , this.digit(date.getMinutes())
,this.digit(date.getSeconds()) , 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]) return format.replace(/yyyy/g, ymd[0])
.replace(/MM/g, ymd[1]) .replace(/MM/g, ymd[1])
.replace(/dd/g, ymd[2]) .replace(/dd/g, ymd[2])
.replace(/HH/g, hms[0]) .replace(/HH/g, hms[0])
.replace(/mm/g, hms[1]) .replace(/mm/g, hms[1])
.replace(/ss/g, hms[2]); .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);
}
}; };
//监听工具条 $('#processGroup').on('mouseover', function () {
table.on('tool(act)', function (obj) { layer.tips('设置流程节点的代办人/候选人/候选组,目前只开发到组', this, {time: 2000});
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 () {
});
}
}); });
//数字前置补零
$('.layui-col-md12 .layui-btn').on('click', function () { layui.laytpl.digit = function (num, length, end) {
var type = $(this).data('type'); var str = '';
active[type] ? active[type].call(this) : ''; num = String(num);
}); length = length || 2;
$('.select .layui-btn').on('click', function () { for (var i = num.length; i < length; i++) {
var type = $(this).data('type'); str += '0';
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});
} }
} 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() { function del(id) {
$.ajax({ $.ajax({
url: "syncdata", url: "delModel",
type: "post", type: "post",
dataType: "json", traditional: true, data: {id: id},
success: function (data) { dataType: "json", traditional: true,
layer.msg(data.msg, {icon: 6}); success: function (d) {
//layui.table.reload('actModeltList'); if (d.flag) {
} layer.msg(d.msg, {icon: 6});
}); layui.table.reload('actModelList');
} } else {
function open(id) { layer.msg(d.msg, {icon: 5});
$.ajax({ }
url: "open", }
type: "post", });
data: {id: id}, }
dataType: "json", traditional: true,
success: function d(data) { function syncdata() {
layer.msg(data.msg, {icon: 6}); var index= layer.load(2);
layui.table.reload('actModelList'); $.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> </script>
</body> </body>

View File

@ -32,5 +32,6 @@
<![CDATA[ and DATE_FORMAT(end_time, '%Y-%m-%d') <= DATE_FORMAT(#{endTime}, '%Y-%m-%d') ]]> <![CDATA[ and DATE_FORMAT(end_time, '%Y-%m-%d') <= DATE_FORMAT(#{endTime}, '%Y-%m-%d') ]]>
</if> </if>
</where> </where>
order by create_date desc
</select> </select>
</mapper> </mapper>

View File

@ -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
});
}
};

View File

@ -1,7 +1,7 @@
/* /*
* Activiti Modeler component part of the Activiti project * Activiti Modeler component part of the Activiti project
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved. * Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * 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) { var KisBpmAssignmentPopupCtrl = [ '$scope','$modal', function($scope, $modal) {
// Put json representing assignment on scope // Put json representing assignment on scope
if ($scope.property.value !== undefined && $scope.property.value !== null if ($scope.property.value !== undefined && $scope.property.value !== null
&& $scope.property.value.assignment !== undefined && $scope.property.value.assignment !== undefined
&& $scope.property.value.assignment !== null) && $scope.property.value.assignment !== null)
{ {
$scope.assignment = $scope.property.value.assignment; $scope.assignment = $scope.property.value.assignment;
} else { } else {
@ -46,7 +46,7 @@ var KisBpmAssignmentPopupCtrl = [ '$scope','$modal', function($scope, $modal) {
if ($scope.assignment.candidateUsers == undefined || $scope.assignment.candidateUsers.length == 0) 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 = ''; $scope.assignment.assignee = '';
} }
// Click handler for + button after enum value // Click handler for + button after enum value
var userValueIndex = 1; var userValueIndex = 1;
$scope.addCandidateUserValue = function(index) { $scope.addCandidateUserValue = function(index) {
@ -65,12 +65,12 @@ var KisBpmAssignmentPopupCtrl = [ '$scope','$modal', function($scope, $modal) {
$scope.removeCandidateUserValue = function(index) { $scope.removeCandidateUserValue = function(index) {
$scope.assignment.candidateUsers.splice(index, 1); $scope.assignment.candidateUsers.splice(index, 1);
}; };
if ($scope.assignment.candidateGroups == undefined || $scope.assignment.candidateGroups.length == 0) if ($scope.assignment.candidateGroups == undefined || $scope.assignment.candidateGroups.length == 0)
{ {
$scope.assignment.candidateGroups = [{value: ''}]; $scope.assignment.candidateGroups = [{value: ''}];
} }
var groupValueIndex = 1; var groupValueIndex = 1;
$scope.addCandidateGroupValue = function(index) { $scope.addCandidateGroupValue = function(index) {
$scope.assignment.candidateGroups.splice(index + 1, 0, {value: 'value ' + groupValueIndex++}); $scope.assignment.candidateGroups.splice(index + 1, 0, {value: 'value ' + groupValueIndex++});
@ -108,72 +108,72 @@ var KisBpmAssignmentPopupCtrl = [ '$scope','$modal', function($scope, $modal) {
$scope.property.value = {}; $scope.property.value = {};
handleAssignmentInput($scope); handleAssignmentInput($scope);
$scope.property.value.assignment = $scope.assignment; $scope.property.value.assignment = $scope.assignment;
$scope.updatePropertyInModel($scope.property); $scope.updatePropertyInModel($scope.property);
$scope.close(); $scope.close();
}; };
// Close button handler // Close button handler
$scope.close = function() { $scope.close = function() {
handleAssignmentInput($scope); handleAssignmentInput($scope);
$scope.property.mode = 'read'; $scope.property.mode = 'read';
$scope.$hide(); $scope.$hide();
}; };
var handleAssignmentInput = function($scope) { var handleAssignmentInput = function($scope) {
if ($scope.assignment.candidateUsers) if ($scope.assignment.candidateUsers)
{ {
var emptyUsers = true; var emptyUsers = true;
var toRemoveIndexes = []; var toRemoveIndexes = [];
for (var i = 0; i < $scope.assignment.candidateUsers.length; i++) for (var i = 0; i < $scope.assignment.candidateUsers.length; i++)
{ {
if ($scope.assignment.candidateUsers[i].value != '') if ($scope.assignment.candidateUsers[i].value != '')
{ {
emptyUsers = false; emptyUsers = false;
} }
else else
{ {
toRemoveIndexes[toRemoveIndexes.length] = i; toRemoveIndexes[toRemoveIndexes.length] = i;
} }
} }
for (var i = 0; i < toRemoveIndexes.length; i++) for (var i = 0; i < toRemoveIndexes.length; i++)
{ {
$scope.assignment.candidateUsers.splice(toRemoveIndexes[i], 1); $scope.assignment.candidateUsers.splice(toRemoveIndexes[i], 1);
} }
if (emptyUsers) if (emptyUsers)
{ {
$scope.assignment.candidateUsers = undefined; $scope.assignment.candidateUsers = undefined;
} }
} }
if ($scope.assignment.candidateGroups) if ($scope.assignment.candidateGroups)
{ {
var emptyGroups = true; var emptyGroups = true;
var toRemoveIndexes = []; var toRemoveIndexes = [];
for (var i = 0; i < $scope.assignment.candidateGroups.length; i++) for (var i = 0; i < $scope.assignment.candidateGroups.length; i++)
{ {
if ($scope.assignment.candidateGroups[i].value != '') if ($scope.assignment.candidateGroups[i].value != '')
{ {
emptyGroups = false; emptyGroups = false;
} }
else else
{ {
toRemoveIndexes[toRemoveIndexes.length] = i; toRemoveIndexes[toRemoveIndexes.length] = i;
} }
} }
for (var i = 0; i < toRemoveIndexes.length; i++) for (var i = 0; i < toRemoveIndexes.length; i++)
{ {
$scope.assignment.candidateGroups.splice(toRemoveIndexes[i], 1); $scope.assignment.candidateGroups.splice(toRemoveIndexes[i], 1);
} }
if (emptyGroups) if (emptyGroups)
{ {
$scope.assignment.candidateGroups = undefined; $scope.assignment.candidateGroups = undefined;
} }
} }
}; };
//因新打开的界面上选定的数据要传输到当前modal中所以使用此方式这是angular.js中不同控制器之间传输数据的方式 //因新打开的界面上选定的数据要传输到当前modal中所以使用此方式这是angular.js中不同控制器之间传输数据的方式
@ -181,11 +181,24 @@ var KisBpmAssignmentPopupCtrl = [ '$scope','$modal', function($scope, $modal) {
var infos = data.split(","); var infos = data.split(",");
var nameInfos =nameData.split(","); var nameInfos =nameData.split(",");
// $scope.assignment.candidateUsers= []; // $scope.assignment.candidateUsers= [];
for(var i=0;i<infos.length;i++) var currentArr=$scope.assignment.candidateUsers;
{ for(var i=0;i<infos.length;i++){
$scope.assignment.candidateUsers.push({value:infos[i],nameValue:nameInfos[i]}); var flag=false;
// $scope.assignment.candidateUsers[i].value = infos[i]; 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]=='' ) 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; // $scope.assignment.candidateGroups[0].value = data;
var infos = data.split(","); var infos = data.split(",");
var nameInfos =nameData.split(","); var nameInfos =nameData.split(",");
var currentArr=$scope.assignment.candidateGroups;
for(var i=0;i<infos.length;i++) for(var i=0;i<infos.length;i++){
{ var flag=false;
// $scope.assignment.candidateGroups[i].value = infos[i]; for(var j=0;j<currentArr.length;j++){
$scope.assignment.candidateGroups.push({value:infos[i],nameValue:nameInfos[i]}); 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.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) { var KisBpmChoseCandidateGroupsCtrl = ['$scope', '$http', function($scope, $http) {
@ -413,4 +442,9 @@ var KisBpmChoseCandidateGroupsCtrl = ['$scope', '$http', function($scope, $http)
} }
$scope.candidateGroups = candidateGroups; $scope.candidateGroups = candidateGroups;
} }
$scope.selectThis=function($event,candidateGroup){
candidateGroup.selected=!candidateGroup.selected;
}
}]; }];

View File

@ -1,40 +1,38 @@
<div class="modal" ng-controller="KisBpmChoseCandidateGroupsCtrl"> <div class="modal" ng-controller="KisBpmChoseCandidateGroupsCtrl">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="close()">&times;</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="close()">&times;</button>
<h2 translate>PROPERTY.ASSIGNMENT.TITLE</h2> <h2 translate>PROPERTY.ASSIGNMENT.TITLE</h2>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="row row-no-gutter"> <div class="row row-no-gutter">
<div class="col-xs-2"></div> <div class="col-xs-2"></div>
<div class="col-xs-8"> <div class="col-xs-8">
<table class="table table-bordered table-condensed"> <table class="table table-bordered table-condensed">
<thead> <thead>
<tr> <tr>
<th><input type="checkbox" ng-click="selectAll($event)"></th> <th><input type="checkbox" ng-click="selectAll($event)"></th>
<th>组名</th> <th>角色</th>
<th>描述</th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> <tr ng-click="selectThis($event,candidateGroup)" ng-repeat="candidateGroup in candidateGroups">
<tr ng-repeat="candidateGroup in candidateGroups"> <td>
<td> <input type="checkbox" ng-click="$event.stopPropagation();" ng-model="candidateGroup.selected" ne-true-value="{{candidateGroup.id}}" ng-false-value="false">
<input type="checkbox" ng-model="candidateGroup.selected" ne-true-value="{{candidateGroup.id}}" ng-false-value="false"> </td>
</td> <td>{{candidateGroup.description}}</td>
<td>{{candidateGroup.name}}</td> </tr>
<td>{{candidateGroup.description}}</td> </tbody>
</tr> </table>
</tbody>
</table>
</div> </div>
<div class="col-xs-2"></div> <div class="col-xs-2"></div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button ng-click="close()" translate>ACTION.CANCEL</button> <button ng-click="close()" class="btn btn-inverse" translate>ACTION.CANCEL</button>
<button ng-click="save()" translate>ACTION.SAVE</button> <button ng-click="save()" class="btn btn-primary" translate>ACTION.SAVE</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -29,22 +29,22 @@
<thead> <thead>
<tr> <tr>
<th><input ng-if="choseAssignmentFlag=='assignees'" type="checkbox" ng-click="selectAll($event)"></th> <th><input ng-if="choseAssignmentFlag=='assignees'" type="checkbox" ng-click="selectAll($event)"></th>
<th>工号</th> <th>用户名</th>
<th>姓名</th> <th>姓名</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="account in accounts"> <tr ng-click="selectThis($event,account)" ng-repeat="account in accounts">
<td> <td>
<!--<input ng-if="choseAssignmentFlag=='assignee'" type="radio" name="accountIdinfo" ng-value="{{account.id}}"--> <!--<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="1" ng-false-value="false">-->
<!--<input type="radio" ng-model="$parent.kk" name="accountIds" ne-true-value="0" 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"> ng-false-value="false">
</td> </td>
<td>{{account.code}}</td> <td>{{account.code}}</td>

View File

@ -77,8 +77,8 @@ body {
} }
.simple-list li >.actions a { .simple-list li >.actions a {
padding: 4px 4px 0 4px; padding: 4px 4px 0 4px;
} }
.simple-list li >.actions a:hover { .simple-list li >.actions a:hover {
background-color: #ffffff; background-color: #ffffff;
@ -164,7 +164,8 @@ label {
/** Buttons **/ /** Buttons **/
button.btn, a.btn { button.btn, a.btn {
background-color: #36a7c4; /*background-color: #36a7c4;*/
background-color: #6dc469;
color: #ffffff; color: #ffffff;
border-color: #ffffff; border-color: #ffffff;
font-size: 15px; font-size: 15px;
@ -266,7 +267,8 @@ button.btn.btn-danger {
} }
.dropdown-menu > li > a:hover, .dropdown-menu > ul > li > a:hover { .dropdown-menu > li > a:hover, .dropdown-menu > ul > li > a:hover {
background: #36a7c4; /*background: #36a7c4;*/
background: #6dc469;
color: #ffffff; color: #ffffff;
} }
@ -298,7 +300,8 @@ a.dropdown-toggle {
} }
.open a.dropdown-toggle, a.dropdown-toggle:hover { .open a.dropdown-toggle, a.dropdown-toggle:hover {
color: #36a7c4; /*color: #36a7c4;*/
color: #6dc469;
} }
.btn-group.open .dropdown-toggle { .btn-group.open .dropdown-toggle {
@ -310,35 +313,35 @@ a.dropdown-toggle {
/** Subtle dropdown (eg. sort) */ /** Subtle dropdown (eg. sort) */
.dropdown-subtle { .dropdown-subtle {
margin-right: 5px; margin-right: 5px;
color: #606b7d; color: #606b7d;
} }
.dropdown-subtle .btn { .dropdown-subtle .btn {
background: transparent; background: transparent;
line-height: 36px; line-height: 36px;
color: #606b7d; color: #606b7d;
padding: 0; padding: 0;
font-size: 14px; font-size: 14px;
border: none; border: none;
box-shadow: none; box-shadow: none;
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
} }
.dropdown-subtle .btn-group.open .dropdown-toggle { .dropdown-subtle .btn-group.open .dropdown-toggle {
box-shadow: none; box-shadow: none;
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
} }
.dropdown-subtle .btn:hover, .dropdown-subtle .btn:focus { .dropdown-subtle .btn:hover, .dropdown-subtle .btn:focus {
background: transparent; background: transparent;
color: #333333; color: #333333;
} }
.dropdown-subtle a { .dropdown-subtle a {
cursor: pointer; cursor: pointer;
} }
/** Popovers */ /** Popovers */
@ -354,7 +357,7 @@ a.dropdown-toggle {
.popover.bottom-left, .popover.bottom-right { .popover.bottom-left, .popover.bottom-right {
margin-top: 10px; margin-top: 10px;
} }
.popover>.arrow, .popover>.arrow { .popover>.arrow, .popover>.arrow {
margin-left: -11px; margin-left: -11px;
border-top-width: 0; border-top-width: 0;
border-bottom-color: #999; border-bottom-color: #999;
@ -526,13 +529,15 @@ a.dropdown-toggle {
.navbar-nav > li.active > a { .navbar-nav > li.active > a {
color: #36a7c4; /*color: #36a7c4;*/
color: #6dc469;
} }
/* Sub header */ /* Sub header */
.subheader { .subheader {
background-color: #e8edf1; background-color: #ffffff;
min-height: 60px; /*background-color: #e8edf1;*/
min-height: 50px;
border-bottom: 1px solid #a4acb9; border-bottom: 1px solid #a4acb9;
} }
@ -551,7 +556,8 @@ a.dropdown-toggle {
.subheader .version { .subheader .version {
font-weight: bold; font-weight: bold;
color: #36a7c4; /*color: #36a7c4;*/
color: #6dc469;
font-size: 110%; font-size: 110%;
padding-left: 5px; padding-left: 5px;
line-height: 1; line-height: 1;
@ -690,7 +696,7 @@ a.dropdown-toggle {
} }
.icon-pencil:before { .icon-pencil:before {
content: "\270f"; content: "\270f";
} }
.icon-caret-up:before { .icon-caret-up:before {
@ -885,7 +891,7 @@ a.dropdown-toggle {
.alert.ng-hide-remove { .alert.ng-hide-remove {
opacity: 1; opacity: 1;
display:block!important; display:block!important;
} }
.alert.ng-hide { .alert.ng-hide {
@ -937,7 +943,7 @@ a.dropdown-toggle {
} }
.wrapper.full { .wrapper.full {
padding: 40px 0px 0px 0px; /*padding: 40px 0px 0px 0px;*/
overflow: hidden; overflow: hidden;
max-width: 100%; max-width: 100%;
min-width: 100%; min-width: 100%;
@ -1198,7 +1204,7 @@ button.selection:active, button.selection:focus {
} }
.list-wrapper { .list-wrapper {
overflow: auto; overflow: auto;
} }
@ -1220,7 +1226,8 @@ button.selection:active, button.selection:focus {
} }
.list-header .summary .filter-action:hover { .list-header .summary .filter-action:hover {
color: #36a7c4; /*color: #36a7c4;*/
color: #6dc469;
} }
.main-list .list-subheader { .main-list .list-subheader {
@ -1265,7 +1272,8 @@ button.selection:active, button.selection:focus {
padding-right: 0; padding-right: 0;
border-radius: 3px; border-radius: 3px;
background-color: #e8edf1; background-color: #e8edf1;
color: #36a7c4; /*color: #36a7c4;*/
color: #6dc469;
background-color: transparent; background-color: transparent;
font-weight: normal; font-weight: normal;
@ -1292,7 +1300,8 @@ button.selection:active, button.selection:focus {
} }
.full-list li.active > div { .full-list li.active > div {
border-left-color: #36a7c4; /*border-left-color: #36a7c4;*/
border-left-color: #6dc469;
} }
.full-list li .title { .full-list li .title {
@ -1361,7 +1370,7 @@ button.selection:active, button.selection:focus {
color: #ffffff; color: #ffffff;
} }
.modal-header .label, .header .label { .modal-header .label, .header .label {
padding: 0 3px 0 15px; padding: 0 3px 0 15px;
color: #1a1a1a; color: #1a1a1a;
font-weight: normal; font-weight: normal;
@ -1378,7 +1387,8 @@ button.selection:active, button.selection:focus {
} }
.header .detail a:hover { .header .detail a:hover {
color: #36a7c4; /*color: #36a7c4;*/
color: #6dc469;
text-decoration: underline; text-decoration: underline;
} }
@ -1410,7 +1420,8 @@ button.selection:active, button.selection:focus {
.jumpers li.selected { .jumpers li.selected {
color: white; color: white;
background-color: #36a7c4; /*background-color: #36a7c4;*/
background-color: #6dc469;
} }

View File

@ -1,6 +1,6 @@
/** /**
Colors: Colors:
- Header: #333333 - Header: #333333
- Subheader: #e8edf1 - Subheader: #e8edf1
- Subheader border: #a4acb9 - Subheader border: #a4acb9
@ -17,12 +17,12 @@
} }
.subtle-select .glyphicon { .subtle-select .glyphicon {
visibility: hidden; visibility: hidden;
padding-left: 5px; padding-left: 5px;
} }
a.subtle-select:hover .glyphicon { a.subtle-select:hover .glyphicon {
visibility: visible; visibility: visible;
} }
.full { .full {
@ -31,30 +31,30 @@ a.subtle-select:hover .glyphicon {
} }
.inline { .inline {
display: inline; display: inline;
} }
.greyish { .greyish {
color: #afafaf; color: #afafaf;
} }
.roweditor-canvas { .roweditor-canvas {
margin-top: 50px; margin-top: 50px;
} }
.no-pad { .no-pad {
margin: 0; margin: 0;
max-width: 1300px; max-width: 1300px;
min-width: 1100px; min-width: 1100px;
} }
.content.no-pad { .content.no-pad {
max-width: 100%; max-width: 100%;
min-width: 100%; min-width: 100%;
} }
.inset .col-sm-3 { .inset .col-sm-3 {
margin-left: -15px; margin-left: -15px;
} }
.no-pad > div{ .no-pad > div{
padding: 0; padding: 0;
@ -73,14 +73,14 @@ h1 {
line-height: 40px; line-height: 40px;
border: none; border: none;
color: #ffffff; color: #ffffff;
font-family: 'Lato', sans-serif; font-family: 'Lato', sans-serif;
} }
.truncate, .truncate > span { .truncate, .truncate > span {
white-space: nowrap; white-space: nowrap;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.subheader .details .counter { .subheader .details .counter {
@ -99,7 +99,7 @@ h1 {
.btn .icon-and-label { .btn .icon-and-label {
padding-right: 5px; padding-right: 5px;
} }
.dropdown-menu .title { .dropdown-menu .title {
margin: 5px 10px 0px 10px; margin: 5px 10px 0px 10px;
@ -121,7 +121,7 @@ h1 {
.filter-wrapper { .filter-wrapper {
min-height: 400px; min-height: 400px;
margin-top: 10px; margin-top: 10px;
margin-left: -15px; margin-left: -15px;
} }
ul.filter-list { ul.filter-list {
@ -140,9 +140,11 @@ ul.filter-list li a {
} }
ul.filter-list li.current a { ul.filter-list li.current a {
color: #36a7c4; /*color: #36a7c4;*/
color: #6dc469;
padding-left: 5px; 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 { 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 { ul.filter-list li.current a:hover, ul.filter-list li.current a:focus {
background-color: transparent; background-color: transparent;
color: #36a7c4; /*color: #36a7c4;*/
color: #6dc469;
cursor: default; cursor: default;
text-decoration: none; text-decoration: none;
} }
@ -173,7 +176,7 @@ ul.filter-list li.current a:hover, ul.filter-list li.current a:focus {
color: #606b7d; color: #606b7d;
} }
.item-wrapper .message span { .item-wrapper .message span {
font-size: 14px; font-size: 14px;
} }
.item-wrapper .item { .item-wrapper .item {
@ -183,12 +186,12 @@ ul.filter-list li.current a:hover, ul.filter-list li.current a:focus {
float: left; 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],
.item-wrapper .item .btn-default[disabled]:active, .item-wrapper .item .btn-default[disabled]:active,
.item-wrapper .item .btn-default[disabled]:hover { .item-wrapper .item .btn-default[disabled]:hover {
border-color: #ffffff; border-color: #ffffff;
cursor: default; cursor: default;
} }
.item-wrapper .item .item-box { .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-repeat: no-repeat;
background-position: center 20px; background-position: center 20px;
background-size: auto; background-size: auto;
position: relative; position: relative;
} }
.item-box .details { .item-box .details {
position: relative; position: relative;
background-color: #e8edf1; background-color: #e8edf1;
height: 160px; height: 160px;
margin-top: 120px; margin-top: 120px;
padding: 5px; padding: 5px;
color: #373e48; color: #373e48;
font-size: 13px; font-size: 13px;
transition: margin-top .5s ease; transition: margin-top .5s ease;
-moz-transition: margin-top .5s ease; -moz-transition: margin-top .5s ease;
-webkit-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; color: #1a1a1a;
text-align: center; text-align: center;
margin-bottom: 20px; margin-bottom: 20px;
} }
.create-inline .glyphicon { .create-inline .glyphicon {
margin-right: 10px; margin-right: 10px;
@ -303,36 +306,36 @@ ul.filter-list li.current a:hover, ul.filter-list li.current a:focus {
} }
.content-canvas-wrapper { .content-canvas-wrapper {
-moz-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; -webkit-box-shadow: inset 0 3px 3px -4px #ababab;
box-shadow: inset 0 3px 3px -4px #ababab; box-shadow: inset 0 3px 3px -4px #ababab;
margin: 15px 7px 0 7px; margin: 15px 7px 0 7px;
z-index: 0; z-index: 0;
} }
.content-canvas { .content-canvas {
background-color: #f9f9f9; background-color: #f9f9f9;
margin: 0 3px 0 3px; margin: 0 3px 0 3px;
-moz-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; -webkit-box-shadow: inset 0 3px 3px -4px #ababab;
box-shadow: inset 0 3px 3px -4px #ababab; box-shadow: inset 0 3px 3px -4px #ababab;
padding: 20px; padding: 20px;
} }
.content-canvas h3 { .content-canvas h3 {
margin-bottom: 5px; margin-bottom: 5px;
} }
.content-canvas .no-results{ .content-canvas .no-results{
color: #999999; color: #999999;
font-size: 16px; font-size: 16px;
margin: 10px 0px; margin: 10px 0px;
} }
.content-canvas .item-wrapper { .content-canvas .item-wrapper {
margin: 5px 10px; margin: 5px 10px;
} }
/* History */ /* History */
@ -342,11 +345,11 @@ table.history {
} }
.subheader table.history { .subheader table.history {
min-width: 250px; min-width: 250px;
} }
table.history td { table.history td {
vertical-align: middle; vertical-align: middle;
} }
table.history tr td:last-child { table.history tr td:last-child {
@ -365,16 +368,17 @@ table.history tr.current:hover {
table.history a:hover { table.history a:hover {
text-decoration: none; text-decoration: none;
} }
table.history .version { table.history .version {
font-size: 30px; font-size: 30px;
display: inline-block; display: inline-block;
color: #36a7c4; /*color: #36a7c4;*/
color: #6dc469;
padding: 5px 10px; padding: 5px 10px;
vertical-align:middle; vertical-align:middle;
color: #36a7c4; /*color: #36a7c4;*/
} }
table.history .detail { table.history .detail {
@ -398,11 +402,11 @@ table.history tr.current td {
border-top: 1px solid #eeeeee; border-top: 1px solid #eeeeee;
margin-top: 5px; margin-top: 5px;
max-height: 350px; max-height: 350px;
overflow: auto; overflow: auto;
} }
.comment { .comment {
margin: 10px 0px 20px 0px; margin: 10px 0px 20px 0px;
font-size: 12px; font-size: 12px;
} }
@ -412,20 +416,21 @@ table.history tr.current td {
} }
.comment .author { .comment .author {
color: #36a7c4; /*color: #36a7c4;*/
color: #6dc469;
font-size: 18px; font-size: 18px;
} }
.comment p { .comment p {
word-wrap: break-word; word-wrap: break-word;
} }
.modal.modal-wide .modal-dialog { .modal.modal-wide .modal-dialog {
width: 1000px; width: 1000px;
} }
.modal-dialog.modal-wide { .modal-dialog.modal-wide {
width: 1000px; width: 1000px;
} }
.modal-body p { .modal-body p {
@ -438,202 +443,202 @@ table.history tr.current td {
} }
.form-group .inline-help { .form-group .inline-help {
font-size: 11px; font-size: 11px;
color: #666666; color: #666666;
margin-top: 5px; margin-top: 5px;
} }
.form-group .message { .form-group .message {
color: #1a1a1a; color: #1a1a1a;
font-size: 14px; font-size: 14px;
} }
.people-select > .selection { .people-select > .selection {
width: 100%; width: 100%;
text-align: left; text-align: left;
} }
.popup-wrapper .people-select { .popup-wrapper .people-select {
max-height: 160px; max-height: 160px;
} }
.people-select .nothing-to-see { .people-select .nothing-to-see {
padding: 5px 0; padding: 5px 0;
color: #999999; color: #999999;
} }
.inline-people-select { .inline-people-select {
max-height: 120px; max-height: 120px;
overflow: auto; overflow: auto;
} }
/** Center tabbed pane */ /** Center tabbed pane */
.center-pane { .center-pane {
overflow: auto; overflow: auto;
padding-bottom: 20px; padding-bottom: 20px;
} }
.center-pane .content { .center-pane .content {
overflow: hidden; overflow: hidden;
} }
.center-pane .tab-actions { .center-pane .tab-actions {
padding: 8px; padding: 8px;
} }
.center-pane .tabs-wrapper > .pull-right { .center-pane .tabs-wrapper > .pull-right {
margin-right: 5px; margin-right: 5px;
} }
.center-pane .content { .center-pane .content {
padding: 10px; padding: 10px;
} }
.center-pane.content { .center-pane.content {
padding: 0; padding: 0;
} }
.center-pane .content .tabs, .center-pane.content .tabs { .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 { .center-pane .content .tabs > li a, .center-pane.content .tabs > li a {
padding: 8px 30px; padding: 8px 30px;
} }
.center-pane .header h1 { .center-pane .header h1 {
font-size: 30px; font-size: 30px;
margin: 0; margin: 0;
padding:0; padding:0;
} }
.center-pane .header h2 { .center-pane .header h2 {
font-size: 24px; font-size: 24px;
margin: 0 0 5px 0; margin: 0 0 5px 0;
padding:0; padding:0;
} }
.center-pane .header { .center-pane .header {
padding: 5px 10px 25px 10px; padding: 5px 10px 25px 10px;
} }
.center-pane .header.compact { .center-pane .header.compact {
padding-bottom: 5px; padding-bottom: 5px;
} }
.center-pane .well { .center-pane .well {
-moz-border-radius: 0px; -moz-border-radius: 0px;
-webkit-border-radius: px; -webkit-border-radius: px;
border-radius: 0px; border-radius: 0px;
background-color: #f9f9f9; background-color: #f9f9f9;
padding: 12px 10px; padding: 12px 10px;
margin: 15px 0 0 0; margin: 15px 0 0 0;
border: 1px solid #eeeeee; border: 1px solid #eeeeee;
} }
/** General button styling */ /** General button styling */
.btn.btn-clean { .btn.btn-clean {
border: none; border: none;
background-color: transparent; background-color: transparent;
font-size: 24px; font-size: 24px;
padding: 2px 6px; padding: 2px 6px;
color: #444444; color: #444444;
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
} }
.btn-clean:hover .icon-remove { .btn-clean:hover .icon-remove {
color: #a02828; color: #a02828;
} }
.btn-clean:focus, .btn-clean:hover { .btn-clean:focus, .btn-clean:hover {
color: #5f8dd3; color: #5f8dd3;
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
} }
.btn-clean:active { .btn-clean:active {
color: #2c5aa0; color: #2c5aa0;
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
} }
/* Show list in popup */ /* Show list in popup */
ul.list { ul.list {
list-style: none inside; list-style: none inside;
padding: 0px; padding: 0px;
margin-bottom: 3px; margin-bottom: 3px;
} }
ul.list>li { ul.list>li {
line-height: 30px; line-height: 30px;
margin: 0; margin: 0;
padding: 4px; padding: 4px;
cursor: pointer; cursor: pointer;
} }
.popup-wrapper ul.list>li { .popup-wrapper ul.list>li {
border-top: 1px solid #eeeeee; border-top: 1px solid #eeeeee;
} }
.popup-wrapper ul.list>li:last-child { .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 { ul.list>li:hover, ul.list>li.active {
background-color: #f2f2f2; background-color: #f2f2f2;
} }
ul.list >li .actions { ul.list >li .actions {
float:right; float:right;
margin: 0px 0px 0px 5px; margin: 0px 0px 0px 5px;
visibility: hidden; visibility: hidden;
} }
ul.list>li:hover .actions { ul.list>li:hover .actions {
visibility: inherit; visibility: inherit;
} }
/** Animations **/ /** Animations **/
.fadein.ng-enter, .fadein.ng-enter,
.fadein.ng-move { .fadein.ng-move {
-webkit-transition: 0.5s linear opacity; -webkit-transition: 0.5s linear opacity;
transition: 0.5s linear all; transition: 0.5s linear all;
} }
.fadein.ng-enter { .fadein.ng-enter {
opacity:0; opacity:0;
} }
.fadein.ng-enter.ng-enter-active { .fadein.ng-enter.ng-enter-active {
opacity:1; opacity:1;
} }
.fadein.ng-move { .fadein.ng-move {
opacity:0.5; opacity:0.5;
} }
.fadein.ng-move.ng-move-active { .fadein.ng-move.ng-move-active {
opacity:1; opacity:1;
} }
.popup-error { .popup-error {
color: red; color: red;
padding: 0 5px 8px 0; padding: 0 5px 8px 0;
} }
/** Passwords */ /** Passwords */
.password-field { .password-field {
width: 320px; width: 320px;
} }
/** LOADING */ /** LOADING */
.message .loading { .message .loading {
line-height: 40px; line-height: 40px;
margin-left: 0px; margin-left: 0px;
} }

View File

@ -14,15 +14,6 @@
</button> </button>
</div> </div>
</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>
<div class="full"> <div class="full">
<div class="row row-no-gutter"> <div class="row row-no-gutter">
@ -48,7 +39,7 @@
data-drag="true" data-drag="true"
jqyoui-draggable="{onStart:'startDragCallback', onDrag:'dragCallback'}" jqyoui-draggable="{onStart:'startDragCallback', onDrag:'dragCallback'}"
data-jqyoui-options="{revert: 'invalid', helper: 'clone', opacity : 0.5}"> 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;"/> <img ng-src="editor-app/stencilsets/bpmn2.0/icons/{{item.icon}}" width="16px;" height="16px;"/>
{{item.name}} {{item.name}}
</li> </li>
@ -57,21 +48,21 @@
</div> </div>
</div> </div>
<div id="canvasHelpWrapper" class="col-xs-9"> <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"
ng-model="droppedElement" ng-model="droppedElement"
data-drop="true" data-drop="true"
data-jqyoui-options 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="canvas-message" id="model-modified-date"></div>
<div class="Oryx_button" <div class="Oryx_button"
id="delete-button" id="delete-button"
title="{{'BUTTON.ACTION.DELETE.TOOLTIP' | translate}}" title="{{'BUTTON.ACTION.DELETE.TOOLTIP' | translate}}"
ng-click="deleteShape()" ng-click="deleteShape()"
style="display:none"> style="display:none">
<img src="editor-app/images/delete.png"/> <img src="editor-app/images/delete.png"/>
</div> </div>
<div class="Oryx_button" <div class="Oryx_button"
id="morph-button" id="morph-button"
title="{{'BUTTON.ACTION.MORPH.TOOLTIP' | translate}}" title="{{'BUTTON.ACTION.MORPH.TOOLTIP' | translate}}"
ng-click="morphShape()" ng-click="morphShape()"
@ -104,9 +95,9 @@
<strong>{{'ELEMENT.AUTHOR' | translate}}: </strong> {{selectedItem.auditData.author}} <strong>{{'ELEMENT.AUTHOR' | translate}}: </strong> {{selectedItem.auditData.author}}
</div> </div>
<div class="selected-item-title"> <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> <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> <span ng-show="!selectedItem || selectedItem.title == undefined || selectedItem.title == null || selectedItem.title.length == 0">{{modelData.name}}</span>
</a> </a>
</div> </div>
@ -117,7 +108,7 @@
ng-click="propertyClicked($index)" ng-class="{'clear' : $index%2 == 0}"> ng-click="propertyClicked($index)" ng-class="{'clear' : $index%2 == 0}">
<span class="title" ng-if="!property.hidden">{{ property.title }}&nbsp;:</span> <span class="title" ng-if="!property.hidden">{{ property.title }}&nbsp;:</span>
<span class="title-removed" ng-if="property.hidden"><i>{{ property.title }}&nbsp;({{'PROPERTY.REMOVED' | translate}})&nbsp;:</i></span> <span class="title-removed" ng-if="property.hidden"><i>{{ property.title }}&nbsp;({{'PROPERTY.REMOVED' | translate}})&nbsp;:</i></span>
<span class="value"> <span class="value">
<ng-include <ng-include
src="getPropertyTemplateUrl($index)" ng-if="!property.hasReadWriteMode"></ng-include> src="getPropertyTemplateUrl($index)" ng-if="!property.hasReadWriteMode"></ng-include>
<ng-include src="getPropertyReadModeTemplateUrl($index)" <ng-include src="getPropertyReadModeTemplateUrl($index)"
@ -128,8 +119,8 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -5499,7 +5499,7 @@ button.close {
.carousel-control .glyphicon-chevron-left, .carousel-control .glyphicon-chevron-left,
.carousel-control .glyphicon-chevron-right { .carousel-control .glyphicon-chevron-right {
position: absolute; position: absolute;
top: 50%; top: 0%;
z-index: 5; z-index: 5;
display: inline-block; display: inline-block;
} }

View File

@ -8,22 +8,22 @@
<!--[if gt IE 8]><!--> <!--[if gt IE 8]><!-->
<html class="no-js"> <!--<![endif]--> <html class="no-js"> <!--<![endif]-->
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Activiti Editor</title> <title>Activiti Editor</title>
<meta name="description" content=""> <meta name="description" content="">
<meta name="viewport" <meta name="viewport"
content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, width=device-width"> 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 --> <!-- 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" 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" 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" 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.css" type="text/css"/>
<link rel="stylesheet" href="editor-app/css/style-common.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> <style>
.page-list{ .page-list{
@ -48,114 +48,114 @@
</head> </head>
<body> <body>
<div class="navbar navbar-fixed-top navbar-inverse" role="navigation" id="main-header"> <!--<div class="navbar navbar-fixed-top navbar-inverse" role="navigation" id="main-header">
<div class="navbar-header"> <div class="navbar-header">
<a href="" ng-click="backToLanding()" class="navbar-brand" <a href="" ng-click="backToLanding()" class="navbar-brand"
title="{{'GENERAL.MAIN-TITLE' | translate}}"><span title="{{'GENERAL.MAIN-TITLE' | translate}}"><span
class="sr-only">{{'GENERAL.MAIN-TITLE' | translate}}</span></a> class="sr-only">{{'GENERAL.MAIN-TITLE' | translate}}</span></a>
</div> </div>
</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>
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="editor-app/libs/es5-shim-15.3.4.5/es5-shim.js"></script> <div class="unsupported-browser">
<script src="editor-app/libs/json3_3.2.6/lib/json3.min.js"></script> <p class="alert error">You are using an unsupported browser. Please upgrade your browser in order to use the
<![endif]--> editor.</p>
</div>
<script src="editor-app/libs/jquery_1.11.0/jquery.min.js"></script> <![endif]-->
<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> <div class="alert-wrapper" ng-cloak>
<!-- Configuration --> <div class="alert fadein {{alerts.current.type}}" ng-show="alerts.current" ng-click="dismissAlert()">
<script src="editor-app/app-cfg.js?v=1"></script> <i class="glyphicon"
<script src="editor-app/editor-config.js" type="text/javascript"></script> ng-class="{'glyphicon-ok': alerts.current.type == 'info', 'glyphicon-remove': alerts.current.type == 'error'}"></i>
<script src="editor-app/configuration/url-config.js" type="text/javascript"></script> <span>{{alerts.current.message}}</span>
<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> <div class="pull-right" ng-show="alerts.queue.length > 0">
<script src="editor-app/configuration/properties-execution-listeners-controller.js" type="text/javascript"></script> <span class="badge">{{alerts.queue.length + 1}}</span>
<script src="editor-app/configuration/properties-event-listeners-controller.js" type="text/javascript"></script> </div>
<script src="editor-app/configuration/properties-assignment-controller.js" type="text/javascript"></script> </div>
<script src="editor-app/configuration/properties-fields-controller.js" type="text/javascript"></script> </div>
<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> <div id="main" class="wrapper full clearfix" ng-style="{height: window.height + 'px'}" ng-app="activitiModeler" ng-include="'editor-app/editor.html'">
<script src="editor-app/configuration/properties-multiinstance-controller.js" type="text/javascript"></script> </div>
<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> <!--[if lt IE 9]>
<script src="editor-app/configuration/properties-sequenceflow-order-controller.js" type="text/javascript"></script> <script src="editor-app/libs/es5-shim-15.3.4.5/es5-shim.js"></script>
<script src="editor-app/configuration/properties-condition-expression-controller.js" type="text/javascript"></script> <script src="editor-app/libs/json3_3.2.6/lib/json3.min.js"></script>
<script src="editor-app/configuration/properties-signal-definitions-controller.js" type="text/javascript"></script> <![endif]-->
<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/libs/jquery_1.11.0/jquery.min.js"></script>
<script src="editor-app/configuration/properties-message-scope-controller.js" type="text/javascript"></script> <script src="editor-app/libs/jquery-ui-1.10.3.custom.min.js"></script>
<script src="editor-app/configuration/toolbar.js" type="text/javascript"></script> <script src="editor-app/libs/angular_1.2.13/angular.min.js"></script>
<script src="editor-app/configuration/toolbar-custom-actions.js" type="text/javascript"></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/configuration/properties.js" type="text/javascript"></script> <script src="editor-app/libs/angular-resource_1.2.13/angular-resource.min.js"></script>
<script src="editor-app/configuration/properties-custom-controllers.js" type="text/javascript"></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> </body>
</html> </html>

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
package com.len.controller; package com.len.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.len.entity.BlogArticle; import com.len.entity.BlogArticle;
@ -8,16 +9,14 @@ import com.len.service.ArticleCategoryService;
import com.len.service.BlogArticleService; import com.len.service.BlogArticleService;
import com.len.service.BlogCategoryService; import com.len.service.BlogCategoryService;
import com.len.util.IpUtil; import com.len.util.IpUtil;
import com.len.util.JsonUtil; import com.len.util.LenResponse;
import com.len.util.ReType; import com.len.util.ReType;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.entity.Condition;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -80,7 +79,7 @@ public class ArticleController {
* @return * @return
*/ */
@GetMapping("/article/getDetail/{code}") @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); String ip = IpUtil.getIp(request);
return articleService.detail(code, ip); return articleService.detail(code, ip);
} }
@ -104,11 +103,10 @@ public class ArticleController {
@GetMapping("/article/list/order/read") @GetMapping("/article/list/order/read")
public ReType getArticleByReadNumber() { public ReType getArticleByReadNumber() {
Condition condition = new Condition(BlogArticle.class); QueryWrapper<BlogArticle> articleQueryWrapper = new QueryWrapper<>();
articleQueryWrapper.orderByDesc("read_number");
PageHelper.startPage(1, 5); PageHelper.startPage(1, 5);
condition.createCriteria(); List<BlogArticle> articles = articleService.list(articleQueryWrapper);
condition.orderBy("readNumber").desc();
List<BlogArticle> articles = articleService.selectByExample(condition);
articles.forEach(s -> { articles.forEach(s -> {
s.setContent(null); s.setContent(null);
String title = s.getTitle(); String title = s.getTitle();

View File

@ -1,5 +1,6 @@
package com.len.controller; package com.len.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.len.entity.SysRole; import com.len.entity.SysRole;
import com.len.entity.SysRoleUser; import com.len.entity.SysRoleUser;
import com.len.entity.SysUser; import com.len.entity.SysUser;
@ -7,7 +8,7 @@ import com.len.service.RoleService;
import com.len.service.RoleUserService; import com.len.service.RoleUserService;
import com.len.service.SysUserService; import com.len.service.SysUserService;
import com.len.util.JWTUtil; import com.len.util.JWTUtil;
import com.len.util.JsonUtil; import com.len.util.LenResponse;
import com.len.util.Md5Util; import com.len.util.Md5Util;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; 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.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import tk.mybatis.mapper.entity.Condition;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -33,7 +33,7 @@ import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/") @RequestMapping("/")
@Slf4j @Slf4j
public class SignController { public class AuthController {
private static final String INIT_BLOG_ROLE = "blogAdmin"; private static final String INIT_BLOG_ROLE = "blogAdmin";
@ -52,13 +52,14 @@ public class SignController {
@ApiOperation(value = "/blogLogin", httpMethod = "POST", notes = "登录method") @ApiOperation(value = "/blogLogin", httpMethod = "POST", notes = "登录method")
@PostMapping(value = "/blogLogin") @PostMapping(value = "/blogLogin")
public JsonUtil blogLogin(SysUser user) { public LenResponse blogLogin(SysUser user) {
if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) { if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) {
throw new UnknownAccountException("用户名或密码不能为空"); throw new UnknownAccountException("用户名或密码不能为空");
} }
String pass = user.getPassword(); String pass = user.getPassword();
user.setPassword(null); user.setPassword(null);
SysUser sysUser = sysUserService.selectOne(user); QueryWrapper<SysUser> userQueryWrapper = new QueryWrapper<>(user);
SysUser sysUser = sysUserService.getOne(userQueryWrapper);
if (sysUser == null) { if (sysUser == null) {
throw new UnknownAccountException("用户名或密码错误"); throw new UnknownAccountException("用户名或密码错误");
} }
@ -67,9 +68,9 @@ public class SignController {
throw new UnknownAccountException("用户名或密码错误"); throw new UnknownAccountException("用户名或密码错误");
} }
Condition condition = new Condition(SysRoleUser.class); QueryWrapper<SysRoleUser> roleUserQueryWrapper = new QueryWrapper<>();
condition.createCriteria().andEqualTo("userId", sysUser.getId()); roleUserQueryWrapper.eq("user_id", sysUser.getId());
List<SysRoleUser> sysRoleUsers = roleUserService.selectByExample(condition); List<SysRoleUser> sysRoleUsers = roleUserService.list(roleUserQueryWrapper);
if (sysRoleUsers.isEmpty()) { if (sysRoleUsers.isEmpty()) {
throw new UnknownAccountException("权限不足"); throw new UnknownAccountException("权限不足");
@ -79,9 +80,9 @@ public class SignController {
.map(SysRoleUser::getRoleId) .map(SysRoleUser::getRoleId)
.collect(Collectors.toList()); .collect(Collectors.toList());
condition = new Condition(SysRole.class); QueryWrapper<SysRole> roleQueryWrapper = new QueryWrapper<>();
condition.createCriteria().andIn("id", roleList); roleQueryWrapper.in("id", roleList);
List<SysRole> sysRoles = roleService.selectByExample(condition); List<SysRole> sysRoles = roleService.list(roleQueryWrapper);
if (roles == null || roles.isEmpty()) { if (roles == null || roles.isEmpty()) {
log.error("not init blog roles!"); log.error("not init blog roles!");
roles.add(INIT_BLOG_ROLE); roles.add(INIT_BLOG_ROLE);
@ -95,6 +96,6 @@ public class SignController {
.map(SysRole::getRoleName) .map(SysRole::getRoleName)
.collect(Collectors.toList()); .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);
} }
} }

View File

@ -5,7 +5,7 @@ import com.len.entity.BlogArticle;
import com.len.entity.BlogCategory; import com.len.entity.BlogCategory;
import com.len.model.Article; import com.len.model.Article;
import com.len.service.*; import com.len.service.*;
import com.len.util.JsonUtil; import com.len.util.LenResponse;
import com.len.util.ReType; import com.len.util.ReType;
import com.len.util.UploadUtil; import com.len.util.UploadUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -18,7 +18,6 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.regex.Pattern;
/** /**
* @author zhuxiaomeng * @author zhuxiaomeng
@ -58,36 +57,36 @@ public class BlogAdminController {
* @return * @return
*/ */
@GetMapping("/article/getDetail/{code}") @GetMapping("/article/getDetail/{code}")
public JsonUtil getDetail(@PathVariable("code") String code) { public LenResponse getDetail(@PathVariable("code") String code) {
return articleService.getDetail(code); return articleService.getDetail(code);
} }
@GetMapping("/article/getCategory") @GetMapping("/article/getCategory")
public JsonUtil getCategory() { public LenResponse getCategory() {
JsonUtil json = new JsonUtil(); LenResponse json = new LenResponse();
List<BlogCategory> categories = categoryService.selectAll(); List<BlogCategory> categories = categoryService.list();
categories.sort(Comparator.comparing(BlogCategory::getSequence)); categories.sort(Comparator.comparing(BlogCategory::getSequence));
json.setData(categories); json.setData(categories);
return json; return json;
} }
@PostMapping("/article/addImage") @PostMapping("/article/addImage")
public JsonUtil addImage(MultipartHttpServletRequest request) { public LenResponse addImage(MultipartHttpServletRequest request) {
MultipartFile multipartFile = request.getFile("file"); MultipartFile multipartFile = request.getFile("file");
String path = uploadUtil.upload(multipartFile); String path = uploadUtil.upload(multipartFile);
JsonUtil json = new JsonUtil(); LenResponse json = new LenResponse();
StringBuffer requestURL = request.getRequestURL(); StringBuffer requestURL = request.getRequestURL();
int serverPort = request.getServerPort(); int serverPort = request.getServerPort();
int i = requestURL.indexOf(String.valueOf(serverPort)); int i = requestURL.indexOf(String.valueOf(serverPort));
String url = requestURL.substring(0, i); String url = requestURL.substring(0, i);
json.setData(url + String.valueOf(serverPort) + "/img/" + path); json.setData(url + serverPort + "/img/" + path);
json.setFlag(true); json.setFlag(true);
return json; return json;
} }
@PostMapping("/article/add") @PostMapping("/article/add")
public JsonUtil addArticle(@RequestBody ArticleDetail detail) { public LenResponse addArticle(@RequestBody ArticleDetail detail) {
JsonUtil json = new JsonUtil(); LenResponse json = new LenResponse();
json.setStatus(400); json.setStatus(400);
Article article = detail.getArticle(); Article article = detail.getArticle();
if (article == null) { if (article == null) {
@ -118,8 +117,8 @@ public class BlogAdminController {
} }
@PostMapping("/article/update") @PostMapping("/article/update")
public JsonUtil updateArticle(@RequestBody ArticleDetail detail) { public LenResponse updateArticle(@RequestBody ArticleDetail detail) {
JsonUtil json = new JsonUtil(); LenResponse json = new LenResponse();
Article article = detail.getArticle(); Article article = detail.getArticle();
json.setFlag(false); json.setFlag(false);
json.setStatus(400); json.setStatus(400);

View File

@ -28,7 +28,7 @@ public class BlogCategoryController {
@GetMapping("/menu") @GetMapping("/menu")
public List<Map> menuList() { public List<Map> menuList() {
List<BlogCategory> categories = categoryService.selectAll(); List<BlogCategory> categories = categoryService.list();
categories.sort(Comparator.comparing(BlogCategory::getSequence)); categories.sort(Comparator.comparing(BlogCategory::getSequence));
List<Map> cates = new ArrayList<>(); List<Map> cates = new ArrayList<>();
for (BlogCategory category : categories) { for (BlogCategory category : categories) {

View File

@ -42,7 +42,7 @@ public class TagController extends BaseController {
*/ */
@GetMapping("/getTag") @GetMapping("/getTag")
public JSONArray label() { public JSONArray label() {
List<BlogTag> blogLabels = blogLabelService.selectAll(); List<BlogTag> blogLabels = blogLabelService.list();
JSONArray array = JSONArray.parseArray(JSON.toJSONString(blogLabels)); JSONArray array = JSONArray.parseArray(JSON.toJSONString(blogLabels));
int i = 0; int i = 0;
JSONObject object; JSONObject object;

View File

@ -1,12 +1,10 @@
package com.len.core; package com.len.core;
import com.len.core.exception.UnauthorizedException; import com.len.menu.LoginType;
import com.len.util.JwtToken; import com.len.util.JwtToken;
import org.apache.shiro.util.StringUtils;
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter; import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
import org.apache.shiro.web.util.WebUtils; import org.apache.shiro.web.util.WebUtils;
import javax.security.auth.Subject;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -35,7 +33,7 @@ public class MyBasicHttpAuthenticationFilter extends BasicHttpAuthenticationFilt
protected boolean executeLogin(ServletRequest request, ServletResponse response) throws Exception { protected boolean executeLogin(ServletRequest request, ServletResponse response) throws Exception {
HttpServletRequest httpServletRequest = (HttpServletRequest) request; HttpServletRequest httpServletRequest = (HttpServletRequest) request;
String token = httpServletRequest.getHeader("Authorization"); String token = httpServletRequest.getHeader("Authorization");
JwtToken jwtToken = new JwtToken(token, "BlogLogin"); JwtToken jwtToken = new JwtToken(token, LoginType.BLOG);
getSubject(request, response).login(jwtToken); getSubject(request, response).login(jwtToken);
return true; return true;
} }

View File

@ -1,6 +1,6 @@
package com.len.core.exception; 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.AuthenticationException;
import org.apache.shiro.authc.UnknownAccountException; import org.apache.shiro.authc.UnknownAccountException;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@ -19,19 +19,19 @@ public class CustomException {
@ResponseStatus(HttpStatus.UNAUTHORIZED) @ResponseStatus(HttpStatus.UNAUTHORIZED)
@ExceptionHandler(AuthenticationException.class) @ExceptionHandler(AuthenticationException.class)
public JsonUtil getAuthenticationException(AuthenticationException e) { public LenResponse getAuthenticationException(AuthenticationException e) {
return new JsonUtil(false, e.getMessage(), 401); return new LenResponse(false, e.getMessage(), 401);
} }
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(UnknownAccountException.class) @ExceptionHandler(UnknownAccountException.class)
public JsonUtil getUnknownAccountException(UnknownAccountException e) { public LenResponse getUnknownAccountException(UnknownAccountException e) {
return new JsonUtil(false, e.getMessage(), 401); return new LenResponse(false, e.getMessage(), 401);
} }
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(UnauthorizedException.class) @ExceptionHandler(UnauthorizedException.class)
public JsonUtil getUnauthorizedException(UnauthorizedException e) { public LenResponse getUnauthorizedException(UnauthorizedException e) {
return new JsonUtil(false, e.getMessage(), 401); return new LenResponse(false, e.getMessage(), 401);
} }
} }

View File

@ -1,25 +1,26 @@
package com.len.entity; 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 { public class ArticleCategory {
@Id @TableId(value = "id", type = IdType.UUID)
@Column(name = "id")
private String id; private String id;
/** /**
* 文章id * 文章id
*/ */
@Column(name = "article_id") @TableField(value = "article_id")
private String articleId; private String articleId;
/** /**
* 标签id * 标签id
*/ */
@Column(name = "category_id") @TableField(value = "category_id")
private String categoryId; private String categoryId;
/** /**

View File

@ -1,14 +1,16 @@
package com.len.entity; 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 { public class ArticleTag {
@Id
@Column(name = "article_id") @TableId(value = "article_id", type = IdType.UUID)
private String articleId; private String articleId;
@Column(name = "tag_id") @TableId(value = "tag_id", type = IdType.UUID)
private String tagId; private String tagId;
/** /**

View File

@ -1,64 +1,70 @@
package com.len.entity; 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 lombok.Data;
import java.util.Date; import java.util.Date;
import javax.persistence.*;
@Table(name = "blog_article") @TableName(value = "blog_article")
@Data @Data
public class BlogArticle { public class BlogArticle {
@Id
@Column(name = "id") @TableId(value = "id", type = IdType.UUID)
private String id; private String id;
/** /**
* code * code
*/ */
@TableField(value = "code")
private String code; private String code;
/** /**
* 标题 * 标题
*/ */
@TableField(value = "title")
private String title; private String title;
/** /**
* 列表缩略图 * 列表缩略图
*/ */
@Column(name="first_img") @TableField(value="first_img")
private String firstImg; private String firstImg;
/** /**
* 阅读次数 * 阅读次数
*/ */
@Column(name = "read_number") @TableField(value = "read_number")
private Integer readNumber; private Integer readNumber;
/** /**
* 次序(置顶功能) * 次序(置顶功能)
*/ */
@Column(name = "top_num") @TableField(value = "top_num")
private Integer topNum; private Integer topNum;
@Column(name = "create_by") @TableField(value = "create_by")
private String createBy; private String createBy;
@Column(name = "update_by") @TableField(value = "update_by")
private String updateBy; private String updateBy;
@Column(name = "create_date") @TableField(value = "create_date")
private Date createDate; private Date createDate;
@Column(name = "update_date") @TableField(value = "update_date")
private Date updateDate; private Date updateDate;
/** /**
* 文章内容 * 文章内容
*/ */
@TableField(value = "content")
private String content; private String content;
@Column(name = "del_flag") @TableField(value = "del_flag")
private Byte delFlag; private Byte delFlag;

View File

@ -1,43 +1,48 @@
package com.len.entity; package com.len.entity;
import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType;
import javax.persistence.*; 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 { public class BlogCategory {
@Id @TableId(value = "id", type = IdType.UUID)
@Column(name = "id")
private String id; private String id;
@Column(name="sequence") @TableField(value="sequence")
private Byte sequence; private Byte sequence;
/** /**
* 搜索code * 搜索code
*/ */
@TableField(value="code")
private String code; private String code;
/** /**
* 类别名称 * 类别名称
*/ */
@TableField(value="name")
private String name; private String name;
/** /**
* 上层id(目前最多两次层) * 上层id(目前最多两次层)
*/ */
@Column(name = "parent_id") @TableField(value = "parent_id")
private String parentId; private String parentId;
@Column(name = "create_by") @TableField(value = "create_by")
private String createBy; private String createBy;
@Column(name = "update_by") @TableField(value = "update_by")
private String updateBy; private String updateBy;
@Column(name = "create_date") @TableField(value = "create_date")
private Date createDate; private Date createDate;
@Column(name = "update_date") @TableField(value = "update_date")
private Date updateDate; private Date updateDate;
/** /**

View File

@ -1,27 +1,25 @@
package com.len.entity; package com.len.entity;
import org.apache.ibatis.type.JdbcType; import com.baomidou.mybatisplus.annotation.IdType;
import tk.mybatis.mapper.annotation.ColumnType; import com.baomidou.mybatisplus.annotation.TableField;
import tk.mybatis.mapper.annotation.KeySql; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import javax.persistence.*; @TableName(value = "blog_tag")
@Table(name = "blog_tag")
public class BlogTag { public class BlogTag {
@Id @TableId(value = "id", type = IdType.UUID)
@Column(name = "id")
private String id; private String id;
/** /**
* 标签code * 标签code
*/ */
@Column(name = "tag_code") @TableField(value = "tag_code")
private String tagCode; private String tagCode;
/** /**
* 标签name * 标签name
*/ */
@Column(name = "tag_name") @TableField(value = "tag_name")
private String tagName; private String tagName;
/** /**

View File

@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface ArticleCategoryMapper extends BaseMapper<ArticleCategory, String> { public interface ArticleCategoryMapper extends BaseMapper<ArticleCategory> {
void delByIds(@Param("ids") List<String> ids); void delByIds(@Param("ids") List<String> ids);
} }

View File

@ -2,7 +2,6 @@ package com.len.mapper;
import com.len.base.BaseMapper; import com.len.base.BaseMapper;
import com.len.entity.ArticleTag; import com.len.entity.ArticleTag;
import tk.mybatis.mapper.common.Mapper;
public interface ArticleTagMapper extends BaseMapper<ArticleTag,String> { public interface ArticleTagMapper extends BaseMapper<ArticleTag> {
} }

View File

@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
public interface BlogArticleMapper extends BaseMapper<BlogArticle, String> { public interface BlogArticleMapper extends BaseMapper<BlogArticle> {
List<Article> indexSelect(); List<Article> indexSelect();

View File

@ -3,5 +3,5 @@ package com.len.mapper;
import com.len.base.BaseMapper; import com.len.base.BaseMapper;
import com.len.entity.BlogCategory; import com.len.entity.BlogCategory;
public interface BlogCategoryMapper extends BaseMapper<BlogCategory, String> { public interface BlogCategoryMapper extends BaseMapper<BlogCategory> {
} }

View File

@ -3,5 +3,5 @@ package com.len.mapper;
import com.len.base.BaseMapper; import com.len.base.BaseMapper;
import com.len.entity.BlogTag; import com.len.entity.BlogTag;
public interface BlogTagMapper extends BaseMapper<BlogTag, String> { public interface BlogTagMapper extends BaseMapper<BlogTag> {
} }

View File

@ -4,8 +4,7 @@ import com.len.base.BaseService;
import com.len.entity.ArticleDetail; import com.len.entity.ArticleDetail;
import com.len.entity.BlogArticle; import com.len.entity.BlogArticle;
import com.len.model.Article; import com.len.model.Article;
import com.len.util.JsonUtil; import com.len.util.LenResponse;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -19,9 +18,9 @@ public interface BlogArticleService extends BaseService<BlogArticle, String> {
List<Article> indexSelect(); 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); List<Article> selectArticle(String code);

View File

@ -22,11 +22,6 @@ public class ArticleCategoryServiceImpl extends BaseServiceImpl<ArticleCategory,
@Autowired @Autowired
private ArticleCategoryMapper articleCategoryMapper; private ArticleCategoryMapper articleCategoryMapper;
@Override
public BaseMapper<ArticleCategory, String> getMappser() {
return articleCategoryMapper;
}
@Override @Override
public void delByIds(List<String> ids) { public void delByIds(List<String> ids) {
articleCategoryMapper.delByIds(ids); articleCategoryMapper.delByIds(ids);

View File

@ -18,9 +18,4 @@ public class ArticleTagServiceImpl extends BaseServiceImpl<ArticleTag, String> i
@Autowired @Autowired
private ArticleTagMapper articleTagMapper; private ArticleTagMapper articleTagMapper;
@Override
public BaseMapper<ArticleTag, String> getMappser() {
return articleTagMapper;
}
} }

View File

@ -1,7 +1,7 @@
package com.len.service.impl; package com.len.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.len.base.BaseMapper;
import com.len.base.impl.BaseServiceImpl; import com.len.base.impl.BaseServiceImpl;
import com.len.core.LenUser; import com.len.core.LenUser;
import com.len.entity.*; import com.len.entity.*;
@ -11,12 +11,11 @@ import com.len.model.SimpleArticle;
import com.len.redis.RedisService; import com.len.redis.RedisService;
import com.len.service.*; import com.len.service.*;
import com.len.util.BeanUtil; import com.len.util.BeanUtil;
import com.len.util.JsonUtil; import com.len.util.LenResponse;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Condition;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; 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+)"); private static final Pattern SRC = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)");
@Override
public BaseMapper<BlogArticle, String> getMappser() {
return blogArticleMapper;
}
private ArticleDetail getArticleByCode(String code) { private ArticleDetail getArticleByCode(String code) {
Condition condition = new Condition(BlogArticle.class);
condition.createCriteria().andEqualTo("code", code) QueryWrapper<BlogArticle> blogArticleQueryWrapper = new QueryWrapper<>();
.andEqualTo("delFlag", 0); blogArticleQueryWrapper.eq("code", code).eq("del_flag", 0);
List<BlogArticle> articles = selectByExample(condition); blogArticleMapper.selectList(blogArticleQueryWrapper);
List<BlogArticle> articles = blogArticleMapper.selectList(blogArticleQueryWrapper);
;
if (articles.isEmpty()) { if (articles.isEmpty()) {
return null; return null;
} }
@ -77,7 +73,7 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
String createBy = blogArticle.getCreateBy(); String createBy = blogArticle.getCreateBy();
if (!StringUtils.isEmpty(createBy)) { if (!StringUtils.isEmpty(createBy)) {
SysUser sysUser = sysUserService.selectByPrimaryKey(createBy); SysUser sysUser = sysUserService.getById(createBy);
if (sysUser != null) { if (sysUser != null) {
article.setCreateName(sysUser.getUsername()); article.setCreateName(sysUser.getUsername());
} }
@ -87,18 +83,20 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
ArticleTag articleTag = new ArticleTag(); ArticleTag articleTag = new ArticleTag();
articleTag.setArticleId(blogArticle.getId()); 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()) { if (!articleTags.isEmpty()) {
condition = new Condition(BlogTag.class); QueryWrapper<BlogTag> queryWrapper = new QueryWrapper<>();
condition.createCriteria().andIn("id", articleTags.stream() queryWrapper.in("id", articleTags.stream()
.map(ArticleTag::getTagId).collect(Collectors.toList())); .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())); detail.setTags(blogTags.stream().map(BlogTag::getTagCode).collect(Collectors.toList()));
} }
ArticleCategory articleCategory = new ArticleCategory(); ArticleCategory articleCategory = new ArticleCategory();
articleCategory.setArticleId(blogArticle.getId()); 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()) { if (!articleCategories.isEmpty()) {
detail.setCategory(articleCategories.stream().map(ArticleCategory::getCategoryId) detail.setCategory(articleCategories.stream().map(ArticleCategory::getCategoryId)
.collect(Collectors.toList())); .collect(Collectors.toList()));
@ -112,8 +110,8 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
} }
@Override @Override
public JsonUtil getDetail(String code) { public LenResponse getDetail(String code) {
JsonUtil json = new JsonUtil(); LenResponse json = new LenResponse();
ArticleDetail detail = getArticleByCode(code); ArticleDetail detail = getArticleByCode(code);
if (detail == null) { if (detail == null) {
json.setStatus(404); json.setStatus(404);
@ -127,8 +125,8 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
} }
@Override @Override
public JsonUtil detail(String code, String ip) { public LenResponse detail(String code, String ip) {
JsonUtil json = new JsonUtil(); LenResponse json = new LenResponse();
ArticleDetail detail = getArticleByCode(code); ArticleDetail detail = getArticleByCode(code);
if (detail == null) { if (detail == null) {
json.setStatus(404); json.setStatus(404);
@ -192,7 +190,8 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
} }
BlogArticle article = new BlogArticle(); BlogArticle article = new BlogArticle();
article.setCode(result.toString()); article.setCode(result.toString());
BlogArticle blogArticle = selectOne(article); QueryWrapper<BlogArticle> articleQueryWrapper = new QueryWrapper<>(article);
BlogArticle blogArticle = blogArticleMapper.selectOne(articleQueryWrapper);
if (blogArticle == null) { if (blogArticle == null) {
return result.toString(); return result.toString();
} else { } else {
@ -227,7 +226,7 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
BlogArticle blogArticle = new BlogArticle(); BlogArticle blogArticle = new BlogArticle();
BeanUtil.copyNotNullBean(article, blogArticle); BeanUtil.copyNotNullBean(article, blogArticle);
int result = insert(blogArticle); int result = blogArticleMapper.insert(blogArticle);
List<ArticleCategory> categories = new ArrayList<>(); List<ArticleCategory> categories = new ArrayList<>();
for (String cateId : articleDetail.getCategory()) { for (String cateId : articleDetail.getCategory()) {
@ -237,7 +236,7 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
articleCategory.setCategoryId(cateId); articleCategory.setCategoryId(cateId);
categories.add(articleCategory); categories.add(articleCategory);
} }
int insertResult = articleCategoryService.insertList(categories); boolean insertResult = articleCategoryService.saveBatch(categories);
List<ArticleTag> articleTags = new ArrayList<>(); List<ArticleTag> articleTags = new ArrayList<>();
List<BlogTag> blogTags = new ArrayList<>(); List<BlogTag> blogTags = new ArrayList<>();
@ -252,7 +251,8 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
blogTag = new BlogTag(); blogTag = new BlogTag();
blogTag.setTagCode(tag); blogTag.setTagCode(tag);
oldTag = tagService.selectOne(blogTag); QueryWrapper<BlogTag> blogTagQueryWrapper = new QueryWrapper<>(blogTag);
oldTag = tagService.getOne(blogTagQueryWrapper);
if (oldTag != null) { if (oldTag != null) {
articleTag.setTagId(oldTag.getId()); articleTag.setTagId(oldTag.getId());
@ -264,12 +264,12 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
articleTag.setTagId(id); articleTag.setTagId(id);
} }
} }
articleTagService.insertList(articleTags); articleTagService.saveBatch(articleTags);
if (!blogTags.isEmpty()) { if (!blogTags.isEmpty()) {
tagService.insertList(blogTags); tagService.saveBatch(blogTags);
} }
return result > 0 && insertResult > 0; return result > 0 && insertResult;
} }
@Override @Override
@ -292,11 +292,11 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
} }
BlogArticle blogArticle = new BlogArticle(); BlogArticle blogArticle = new BlogArticle();
BeanUtil.copyNotNullBean(article, blogArticle); BeanUtil.copyNotNullBean(article, blogArticle);
updateByPrimaryKey(blogArticle); blogArticleMapper.updateById(blogArticle);
ArticleTag articleTag = new ArticleTag(); ArticleTag articleTag = new ArticleTag();
articleTag.setArticleId(article.getId()); articleTag.setArticleId(article.getId());
articleTagService.delete(articleTag); articleTagService.removeById(article.getId());
List<ArticleTag> articleTags = new ArrayList<>(); List<ArticleTag> articleTags = new ArrayList<>();
List<BlogTag> blogTags = new ArrayList<>(); List<BlogTag> blogTags = new ArrayList<>();
@ -307,7 +307,8 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
articleTag.setArticleId(article.getId()); articleTag.setArticleId(article.getId());
BlogTag blogTag = new BlogTag(); BlogTag blogTag = new BlogTag();
blogTag.setTagCode(tag); blogTag.setTagCode(tag);
BlogTag tag1 = tagService.selectOne(blogTag); QueryWrapper<BlogTag> blogTagQueryWrapper = new QueryWrapper<>(blogTag);
BlogTag tag1 = tagService.getOne(blogTagQueryWrapper);
if (tag1 != null) { if (tag1 != null) {
articleTag.setTagId(tag1.getId()); articleTag.setTagId(tag1.getId());
} else { } else {
@ -322,13 +323,14 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
} }
} }
if (!blogTags.isEmpty()) { if (!blogTags.isEmpty()) {
tagService.insertList(blogTags); tagService.saveBatch(blogTags);
} }
articleTagService.insertList(articleTags); articleTagService.saveBatch(articleTags);
ArticleCategory articleCategory = new ArticleCategory(); ArticleCategory articleCategory = new ArticleCategory();
articleCategory.setArticleId(article.getId()); 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()) { if (!categories.isEmpty()) {
List<String> cateIds = categories.stream().map(ArticleCategory::getCategoryId) List<String> cateIds = categories.stream().map(ArticleCategory::getCategoryId)
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -353,7 +355,7 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
category.setArticleId(article.getId()); category.setArticleId(article.getId());
category.setCategoryId(ca); category.setCategoryId(ca);
} }
articleCategoryService.insertList(articleCategories); articleCategoryService.saveBatch(articleCategories);
} }
return true; return true;
} }
@ -369,9 +371,9 @@ public class BlogArticleServiceImpl extends BaseServiceImpl<BlogArticle, String>
if (!StringUtils.isBlank(str)) { if (!StringUtils.isBlank(str)) {
if (StringUtils.isEmpty(redisService.get(str))) { if (StringUtils.isEmpty(redisService.get(str))) {
redisService.set(str, "true", 60 * 30L); redisService.set(str, "true", 60 * 30L);
BlogArticle article = selectByPrimaryKey(articleId); BlogArticle article = blogArticleMapper.selectById(articleId);
article.setReadNumber(article.getReadNumber() + 1); article.setReadNumber(article.getReadNumber() + 1);
updateByPrimaryKey(article); blogArticleMapper.updateById(article);
return article.getReadNumber(); return article.getReadNumber();
} }
} }

View File

@ -16,11 +16,4 @@ import org.springframework.stereotype.Service;
@Service @Service
public class BlogCategoryServiceImpl extends BaseServiceImpl<BlogCategory, String> implements BlogCategoryService { public class BlogCategoryServiceImpl extends BaseServiceImpl<BlogCategory, String> implements BlogCategoryService {
@Autowired
private BlogCategoryMapper blogCategoryMapper;
@Override
public BaseMapper<BlogCategory, String> getMappser() {
return blogCategoryMapper;
}
} }

View File

@ -1,11 +1,8 @@
package com.len.service.impl; package com.len.service.impl;
import com.len.base.BaseMapper;
import com.len.base.impl.BaseServiceImpl; import com.len.base.impl.BaseServiceImpl;
import com.len.entity.BlogTag; import com.len.entity.BlogTag;
import com.len.mapper.BlogTagMapper;
import com.len.service.BlogTagService; import com.len.service.BlogTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@ -15,12 +12,4 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class BlogTagServiceImpl extends BaseServiceImpl<BlogTag, String> implements BlogTagService { public class BlogTagServiceImpl extends BaseServiceImpl<BlogTag, String> implements BlogTagService {
@Autowired
private BlogTagMapper blogTagMapper;
@Override
public BaseMapper<BlogTag, String> getMappser() {
return blogTagMapper;
}
} }

View File

@ -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;
}

View File

@ -1,62 +1,99 @@
package com.len.base; package com.len.base;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j; import com.len.util.LenResponse;
import org.apache.shiro.authz.AuthorizationException; import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.UnauthorizedException; import org.apache.shiro.authz.AuthorizationException;
import org.springframework.beans.propertyeditors.CustomDateEditor; import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.WebDataBinder; import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder; 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 javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException; import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder; import java.io.IOException;
import java.text.SimpleDateFormat; import java.io.UnsupportedEncodingException;
import java.util.Date; import java.net.URLEncoder;
import java.util.Map; import java.text.SimpleDateFormat;
import java.util.Date;
/** import java.util.Map;
* @author zhuxiaomeng
* @date 2017/12/19. /**
* @email 154040976@qq.com * @author zhuxiaomeng
*/ * @date 2017/12/19.
@Slf4j * @email 154040976@qq.com
public abstract class BaseController<T> { */
@Slf4j
@InitBinder public abstract class BaseController<T> {
protected void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(Date.class, new CustomDateEditor( @InitBinder
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), true)); protected void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(Date.class, new CustomDateEditor( binder.registerCustomEditor(Date.class, new CustomDateEditor(
new SimpleDateFormat("yyyy-MM-dd"), true)); 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)) { @ExceptionHandler( {UnauthorizedException.class, AuthorizationException.class})
Map<String, Object> map = Maps.newHashMap(); public String authorizationException(HttpServletRequest request, HttpServletResponse response) {
map.put("code", "403"); if (isAjaxRequest(request)) {
map.put("message", "无权限"); Map<String, Object> map = Maps.newHashMap();
return JSON.toJSONString(map); map.put("code", "403");
} else { map.put("message", "无权限");
String message = "权限不足"; return JSON.toJSONString(map);
try { } else {
message = URLEncoder.encode(message, "utf-8"); String message = "权限不足";
} catch (UnsupportedEncodingException e) { try {
log.error("BaseController" + e.getMessage()); message = URLEncoder.encode(message, "utf-8");
e.printStackTrace(); } catch (UnsupportedEncodingException e) {
} log.error("BaseController" + e.getMessage());
return "redirect:/error/403?message=" + message; 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"); @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);
}
}

View File

@ -1,8 +1,8 @@
package com.len.base; package com.len.base;
import tk.mybatis.mapper.common.IdsMapper;
import java.io.Serializable; import com.len.util.ReType;
import java.util.List; import java.util.List;
/** /**
@ -11,59 +11,13 @@ import java.util.List;
* @email 154040976@qq.com * @email 154040976@qq.com
* mapper封装 crud * mapper封装 crud
*/ */
public interface BaseMapper<T, E extends Serializable> extends tk.mybatis.mapper.common.Mapper<T>, LenInsertListAndinsertUseGeneratedKeysMapper<T>, IdsMapper<T> { public interface BaseMapper<T> extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T> {
/*
*//**
* 根据id删除
* @param id
* @return
*//*
int deleteByPrimaryKey(E id);
*//** public List<T> selectListByPage(T record);
* 插入
* @param record
* @return
*//*
int insert(T record);
*//** public ReType show(T t, int page, int limit);
*插入非空字段
* @param record
* @return
*//*
int insertSelective(T record);
*//** public ReType getList(T t, int page, int limit);
* 根据id查询
* @param id
* @return
*//*
T selectByPrimaryKey(E id);
*//** public String showAll(T t);
* 更新非空数据
* @param record
* @return
*//*
int updateByPrimaryKeySelective(T record);
*//**
* 更新
* @param record
* @return
*//*
int updateByPrimaryKey(T record);
*/
/**
* 查询
*
* @param record
* @return
*/
List<T> selectListByPage(T record);
} }

View File

@ -1,7 +1,7 @@
package com.len.base; package com.len.base;
import com.baomidou.mybatisplus.extension.service.IService;
import com.len.util.ReType; import com.len.util.ReType;
import org.apache.ibatis.session.RowBounds;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@ -12,64 +12,12 @@ import java.util.List;
* @email 154040976@qq.com * @email 154040976@qq.com
* 通用service层 * 通用service层
*/ */
public interface BaseService<T, E extends Serializable> { public interface BaseService<T,E extends Serializable> extends IService<T> {
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 ReType show(T t, int page, int limit); public ReType show(T t, int page, int limit);
public ReType getList(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);
} }

View File

@ -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);
}

View File

@ -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();
}
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -1,301 +1,16 @@
package com.len.base.impl; 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 lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.RowBounds;
import org.apache.shiro.SecurityUtils;
import java.io.Serializable; import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/** /**
* @author zhuxiaomeng * @author zhuxiaomeng
* @date 2017/12/13. * @date 2017/12/13.
* @email 154040976@qq.com * @email 154040976@qq.com
* update by 2019/11/12 tkmapper替换成mybatisplus
*/ */
@Slf4j @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);
}
} }

View File

@ -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;
}
}

View File

@ -16,19 +16,19 @@ import java.util.concurrent.TimeUnit;
* @email 154040976@qq.com * @email 154040976@qq.com
*/ */
@Service @Service
public class RedisService { public class RedisService<T> {
@Autowired @Autowired
private StringRedisTemplate stringRedisTemplate; private StringRedisTemplate stringRedisTemplate;
@Autowired @Autowired
private RedisTemplate<Object, Object> redisTemplate; private RedisTemplate<Object, T> redisTemplate;
@Resource(name = "stringRedisTemplate") @Resource(name = "stringRedisTemplate")
private ValueOperations<String, String> valueOps; private ValueOperations<String, String> valueOps;
@Resource(name = "redisTemplate") @Resource(name = "redisTemplate")
private ValueOperations<Object, Object> valOpsObj; private ValueOperations<Object, T> valOpsObj;
@Value("${redis.prefix}") @Value("${redis.prefix}")
private String prefix; private String prefix;
@ -62,7 +62,7 @@ public class RedisService {
* @param key obj key * @param key obj key
* @return obj value * @return obj value
*/ */
public Object getObj(Object key) { public T getObj(Object key) {
key = prefix + key.toString(); key = prefix + key.toString();
return valOpsObj.get(key); return valOpsObj.get(key);
} }
@ -74,7 +74,7 @@ public class RedisService {
* @param value obj value * @param value obj value
* @param second 过期时间 单位户 * @param second 过期时间 单位户
*/ */
public void setObj(Object key, Object value, Long second) { public void setObj(Object key, T value, Long second) {
key = prefix + key.toString(); key = prefix + key.toString();
valOpsObj.set(key, value, second,TimeUnit.SECONDS); valOpsObj.set(key, value, second,TimeUnit.SECONDS);
} }

View File

@ -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();
}
}
}
}

View File

@ -1,5 +1,6 @@
package com.len.util; package com.len.util;
import com.len.menu.LoginType;
import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.authc.UsernamePasswordToken;
/** /**
@ -9,21 +10,21 @@ import org.apache.shiro.authc.UsernamePasswordToken;
*/ */
public class CustomUsernamePasswordToken extends 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); super(username,password);
this.type = loginType; this.type = loginType;
} }
public String getType() { public LoginType getType() {
return type; return type;
} }
public void setType(String type) { public void setType(LoginType type) {
this.type = type; this.type = type;
} }
} }

View File

@ -1,5 +1,6 @@
package com.len.util; package com.len.util;
import com.len.menu.LoginType;
import org.apache.shiro.authc.AuthenticationToken; import org.apache.shiro.authc.AuthenticationToken;
/** /**
@ -10,9 +11,9 @@ import org.apache.shiro.authc.AuthenticationToken;
public class JwtToken implements AuthenticationToken { public class JwtToken implements AuthenticationToken {
private String token; 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.token = token;
this.type=type; this.type=type;
} }
@ -35,11 +36,11 @@ public class JwtToken implements AuthenticationToken {
this.token = token; this.token = token;
} }
public String getType() { public LoginType getType() {
return type; return type;
} }
public void setType(String type) { public void setType(LoginType type) {
this.type = type; this.type = type;
} }
} }

View File

@ -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);
}
}

View File

@ -18,7 +18,7 @@ public class Md5Util {
* @param args * @param args
*/ */
public static void main(String[] args) { public static void main(String[] args) {
String str= getMD5("123456","tom"); String str= getMD5("111111","manager");
System.out.println(str); System.out.println(str);
} }
} }

View File

@ -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();
}
}

View File

@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
*/ */
@Controller @Controller
@RequestMapping(value = "/error") @RequestMapping(value = "/error")
@Api(value = "异常", description = "异常业务类") @Api(value = "异常", tags = "异常业务类")
public class ErrorController { public class ErrorController {
@GetMapping(value = "404") @GetMapping(value = "404")

View File

@ -5,9 +5,8 @@ import com.len.core.annotation.Log;
import com.len.core.annotation.Log.LOG_TYPE; import com.len.core.annotation.Log.LOG_TYPE;
import com.len.core.quartz.JobTask; import com.len.core.quartz.JobTask;
import com.len.entity.SysJob; import com.len.entity.SysJob;
import com.len.exception.MyException;
import com.len.service.JobService; import com.len.service.JobService;
import com.len.util.JsonUtil; import com.len.util.LenResponse;
import com.len.util.ReType; import com.len.util.ReType;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -30,7 +29,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
*/ */
@Controller @Controller
@RequestMapping("/job") @RequestMapping("/job")
@Api(value = "定时任务",description="定时任务") @Api(value = "定时任务", tags = "定时任务")
public class JobController extends BaseController<SysJob> { public class JobController extends BaseController<SysJob> {
@Autowired @Autowired
@ -48,12 +47,12 @@ public class JobController extends BaseController<SysJob> {
@GetMapping(value = "showJobList") @GetMapping(value = "showJobList")
@ResponseBody @ResponseBody
@RequiresPermissions("job:show") @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)); return jobService.show(job, Integer.valueOf(page), Integer.valueOf(limit));
} }
@GetMapping(value = "showAddJob") @GetMapping(value = "showAddJob")
public String addJob(Model model) { public String addJob() {
return "/system/job/add-job"; return "/system/job/add-job";
} }
@ -61,25 +60,16 @@ public class JobController extends BaseController<SysJob> {
@Log(desc = "添加任务") @Log(desc = "添加任务")
@PostMapping(value = "addJob") @PostMapping(value = "addJob")
@ResponseBody @ResponseBody
public JsonUtil addJob(SysJob job) { public LenResponse addJob(SysJob job) {
JsonUtil j = new JsonUtil();
String msg = "保存成功";
job.setStatus(false); job.setStatus(false);
try { jobService.save(job);
jobService.insertSelective(job); return succ("保存成功");
} catch (MyException e) {
msg = "保存失败";
j.setFlag(false);
e.printStackTrace();
}
j.setMsg(msg);
return j;
} }
@GetMapping(value = "updateJob") @GetMapping(value = "updateJob")
public String updateJob(String id, Model model, boolean detail) { public String updateJob(String id, Model model, boolean detail) {
if (StringUtils.isNotEmpty(id)) { if (StringUtils.isNotEmpty(id)) {
SysJob job = jobService.selectByPrimaryKey(id); SysJob job = jobService.getById(id);
model.addAttribute("job", job); model.addAttribute("job", job);
} }
model.addAttribute("detail", detail); model.addAttribute("detail", detail);
@ -91,24 +81,18 @@ public class JobController extends BaseController<SysJob> {
@Log(desc = "更新任务", type = LOG_TYPE.UPDATE) @Log(desc = "更新任务", type = LOG_TYPE.UPDATE)
@PostMapping(value = "updateJob") @PostMapping(value = "updateJob")
@ResponseBody @ResponseBody
public JsonUtil updateJob(SysJob job) { public LenResponse updateJob(SysJob job) {
JsonUtil j = new JsonUtil();
j.setFlag(false);
if (job == null) { if (job == null) {
j.setMsg("获取数据失败"); return error("获取数据失败");
return j;
} }
if (jobTask.checkJob(job)) { if (jobTask.checkJob(job)) {
j.setMsg("已经启动任务无法更新,请停止后更新"); return error("已经启动任务无法更新,请停止后更新");
return j;
} }
if (jobService.updateJob(job)) { if (jobService.updateJob(job)) {
j.setFlag(true); return succ("更新成功");
j.setData("更新成功");
} else { } else {
j.setData("更新失败"); return error("更新失败");
} }
return j;
} }
@Log(desc = "删除任务", type = LOG_TYPE.DEL) @Log(desc = "删除任务", type = LOG_TYPE.DEL)
@ -116,7 +100,7 @@ public class JobController extends BaseController<SysJob> {
@PostMapping(value = "del") @PostMapping(value = "del")
@ResponseBody @ResponseBody
@RequiresPermissions("job:del") @RequiresPermissions("job:del")
public JsonUtil del(String id) { public LenResponse del(String id) {
return jobService.del(id); return jobService.del(id);
} }
@ -125,42 +109,34 @@ public class JobController extends BaseController<SysJob> {
@PostMapping(value = "startJob") @PostMapping(value = "startJob")
@ResponseBody @ResponseBody
@RequiresPermissions("job:start") @RequiresPermissions("job:start")
public JsonUtil startJob(String id) { public LenResponse startJob(String id) {
JsonUtil j = new JsonUtil(); String msg;
String msg = null;
if (StringUtils.isEmpty(id)) { if (StringUtils.isEmpty(id)) {
j.setMsg("获取数据失败"); return error("获取数据失败");
j.setFlag(false);
return j;
} }
if (jobService.startJob(id)) { if (jobService.startJob(id)) {
msg = "启动成功"; msg = "启动成功";
} else { } else {
msg = "启动失败"; msg = "启动失败";
} }
j.setMsg(msg); return succ(msg);
return j;
} }
@Log(desc = "停止任务") @Log(desc = "停止任务")
@PostMapping(value = "endJob") @PostMapping(value = "endJob")
@ResponseBody @ResponseBody
@RequiresPermissions("job:end") @RequiresPermissions("job:end")
public JsonUtil endJob(String id) { public LenResponse endJob(String id) {
JsonUtil j = new JsonUtil();
String msg; String msg;
if (StringUtils.isEmpty(id)) { if (StringUtils.isEmpty(id)) {
j.setMsg("获取数据失败"); return error("获取数据失败");
j.setFlag(false);
return j;
} }
if (jobService.stopJob(id)) { if (jobService.stopJob(id)) {
msg = "停止成功"; msg = "停止成功";
} else { } else {
msg = "停止失败"; msg = "停止失败";
} }
j.setMsg(msg); return succ(msg);
return j;
} }
} }

View File

@ -1,20 +1,15 @@
package com.len.controller; package com.len.controller;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.len.base.BaseController; import com.len.base.BaseController;
import com.len.entity.SysLog; import com.len.entity.SysLog;
import com.len.exception.MyException; import com.len.exception.MyException;
import com.len.mapper.SysLogMapper; import com.len.mapper.SysLogMapper;
import com.len.util.JsonUtil; import com.len.util.LenResponse;
import com.len.util.ReType; import com.len.util.ReType;
import java.util.List;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; 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.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/** /**
* @author zhuxiaomeng * @author zhuxiaomeng
* @date 2017/12/29. * @date 2017/12/29.
@ -33,7 +30,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
@Controller @Controller
@RequestMapping(value = "/log") @RequestMapping(value = "/log")
@Slf4j @Slf4j
@Api(value = "日志管理",description="操作日志记录") @Api(value = "日志管理", tags = "操作日志记录")
public class LogController extends BaseController { public class LogController extends BaseController {
@Autowired @Autowired
private SysLogMapper logMapper; private SysLogMapper logMapper;
@ -73,19 +70,11 @@ public class LogController extends BaseController {
*/ */
@PostMapping(value = "del") @PostMapping(value = "del")
@ResponseBody @ResponseBody
public JsonUtil del(String[] ids) { public LenResponse del(String[] ids) {
JsonUtil j = new JsonUtil(); for (String id : ids) {
String msg = "删除成功"; logMapper.deleteById(Integer.valueOf(id));
try {
for (String id : ids) {
logMapper.deleteByPrimaryKey(Integer.valueOf(id));
}
} catch (MyException e) {
msg = "删除失败";
log.error(msg + e.getMessage());
} }
j.setMsg(msg); return succ("删除成功");
return j;
} }

View File

@ -3,12 +3,14 @@ package com.len.controller;
import com.len.core.annotation.Log; import com.len.core.annotation.Log;
import com.len.core.shiro.Principal; import com.len.core.shiro.Principal;
import com.len.entity.SysUser; import com.len.entity.SysUser;
import com.len.menu.LoginType;
import com.len.service.SysUserService; import com.len.service.SysUserService;
import com.len.util.CustomUsernamePasswordToken; import com.len.util.CustomUsernamePasswordToken;
import com.len.util.VerifyCodeUtils; import com.len.util.VerifyCodeUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.ExcessiveAttemptsException; import org.apache.shiro.authc.ExcessiveAttemptsException;
import org.apache.shiro.authc.IncorrectCredentialsException; import org.apache.shiro.authc.IncorrectCredentialsException;
@ -32,16 +34,17 @@ import javax.servlet.http.HttpSession;
*/ */
@Controller @Controller
@Slf4j @Slf4j
@Api(value = "登录业务",description="登录校验处理") @Api(value = "登录业务", tags = "登录校验处理")
public class LoginController { public class LoginController {
@Autowired @Autowired
SysUserService userService; SysUserService userService;
private static final String CODE_ERROR = "code.error"; private static final String CODE_ERROR = "code.error";
private static final Long TWO_WEEK = 1000 * 60 * 60 * 24 * 14L;
@GetMapping(value = "") @GetMapping(value = "")
public String loginInit() { public String login() {
return loginCheck(); return toLogin();
} }
@GetMapping(value = "goLogin") @GetMapping(value = "goLogin")
@ -51,19 +54,17 @@ public class LoginController {
return "/main/main"; return "/main/main";
} else { } else {
model.addAttribute("message", "请重新登录"); model.addAttribute("message", "请重新登录");
return "/login"; return "/login2";
} }
} }
@GetMapping(value = "/login") @GetMapping(value = "/login")
public String loginCheck() { public String toLogin() {
Subject sub = SecurityUtils.getSubject(); Subject sub = SecurityUtils.getSubject();
Boolean flag2 = sub.isRemembered(); if (sub.isAuthenticated() || sub.isRemembered()) {
boolean flag = sub.isAuthenticated() || flag2;
if (flag) {
return "/main/main"; return "/main/main";
} }
return "/login"; return "/login2";
} }
/** /**
@ -75,21 +76,27 @@ public class LoginController {
* @return * @return
*/ */
@ApiOperation(value = "/login", httpMethod = "POST", notes = "登录method") @ApiOperation(value = "/login", httpMethod = "POST", notes = "登录method")
@PostMapping(value = "/login") @PostMapping("/login")
public String login(SysUser user, Model model, String rememberMe, HttpServletRequest request) { public String login(SysUser user, Model model, String rememberMe, HttpServletRequest request) {
String codeMsg = (String) request.getAttribute("shiroLoginFailure"); String codeMsg = (String) request.getAttribute("shiroLoginFailure");
if (CODE_ERROR.equals(codeMsg)) { if (CODE_ERROR.equals(codeMsg)) {
model.addAttribute("message", "验证码错误"); model.addAttribute("message", "验证码错误");
return "/login"; return "/login2";
} }
CustomUsernamePasswordToken token = new CustomUsernamePasswordToken(user.getUsername().trim(), CustomUsernamePasswordToken token = new CustomUsernamePasswordToken(user.getUsername().trim(),
user.getPassword(), "UserLogin"); user.getPassword(), LoginType.SYS);
Subject subject = Principal.getSubject(); Subject subject = Principal.getSubject();
String msg = null; String msg = null;
try { try {
subject.login(token); subject.login(token);
if (subject.isAuthenticated()) { 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"; return "redirect:/main";
} }
} catch (UnknownAccountException | IncorrectCredentialsException e) { } catch (UnknownAccountException | IncorrectCredentialsException e) {
@ -100,7 +107,7 @@ public class LoginController {
if (msg != null) { if (msg != null) {
model.addAttribute("message", msg); model.addAttribute("message", msg);
} }
return "/login"; return "/login2";
} }
@GetMapping("/main") @GetMapping("/main")
@ -113,7 +120,7 @@ public class LoginController {
public String logout() { public String logout() {
Subject sub = SecurityUtils.getSubject(); Subject sub = SecurityUtils.getSubject();
sub.logout(); sub.logout();
return "/login"; return "/login2";
} }
@ -132,7 +139,7 @@ public class LoginController {
HttpSession session = request.getSession(true); HttpSession session = request.getSession(true);
session.setAttribute("_code", verifyCode.toLowerCase()); session.setAttribute("_code", verifyCode.toLowerCase());
//生成图片 //生成图片
int w = 146, h = 33; int w = 100, h = 35;
VerifyCodeUtils.outputImage(w, h, response.getOutputStream(), verifyCode); VerifyCodeUtils.outputImage(w, h, response.getOutputStream(), verifyCode);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -5,10 +5,9 @@ import com.len.base.BaseController;
import com.len.core.annotation.Log; import com.len.core.annotation.Log;
import com.len.core.annotation.Log.LOG_TYPE; import com.len.core.annotation.Log.LOG_TYPE;
import com.len.entity.SysMenu; import com.len.entity.SysMenu;
import com.len.exception.MyException;
import com.len.service.MenuService; import com.len.service.MenuService;
import com.len.util.BeanUtil; import com.len.util.BeanUtil;
import com.len.util.JsonUtil; import com.len.util.LenResponse;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -29,7 +28,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
*/ */
@RequestMapping("/menu") @RequestMapping("/menu")
@Controller @Controller
@Api(value = "菜单管理",description="菜单业务处理") @Api(value = "菜单管理", tags = "菜单业务处理")
public class MenuController extends BaseController { public class MenuController extends BaseController {
@Autowired @Autowired
@ -61,12 +60,9 @@ public class MenuController extends BaseController {
@ApiOperation(value = "/addMenu", httpMethod = "POST", notes = "添加菜单") @ApiOperation(value = "/addMenu", httpMethod = "POST", notes = "添加菜单")
@PostMapping(value = "addMenu") @PostMapping(value = "addMenu")
@ResponseBody @ResponseBody
public JsonUtil addMenu(SysMenu sysMenu, Model model) { public LenResponse addMenu(SysMenu sysMenu) {
JsonUtil jsonUtil = new JsonUtil();
jsonUtil.setFlag(false);
if (sysMenu == null) { if (sysMenu == null) {
jsonUtil.setMsg("获取数据失败"); return error("获取数据失败");
return jsonUtil;
} }
if (StringUtils.isEmpty(sysMenu.getPId())) { if (StringUtils.isEmpty(sysMenu.getPId())) {
sysMenu.setPId(null); sysMenu.setPId(null);
@ -77,28 +73,21 @@ public class MenuController extends BaseController {
if (StringUtils.isEmpty(sysMenu.getPermission())) { if (StringUtils.isEmpty(sysMenu.getPermission())) {
sysMenu.setPermission(null); sysMenu.setPermission(null);
} }
if (sysMenu.getMenuType() == 2) {
try { sysMenu.setMenuType((byte) 0);
if (sysMenu.getMenuType() == 2) {
sysMenu.setMenuType((byte) 0);
}
menuService.insertSelective(sysMenu);
jsonUtil.setMsg("添加成功");
} catch (MyException e) {
e.printStackTrace();
jsonUtil.setMsg("添加失败");
} }
return jsonUtil; menuService.save(sysMenu);
return succ("添加成功");
} }
@GetMapping(value = "showUpdateMenu") @GetMapping(value = "showUpdateMenu")
public String showUpdateMenu(Model model, String id) { public String showUpdateMenu(Model model, String id) {
SysMenu sysMenu = menuService.selectByPrimaryKey(id); SysMenu sysMenu = menuService.getById(id);
JSONArray ja = menuService.getMenuJsonList(); JSONArray ja = menuService.getMenuJsonList();
model.addAttribute("menus", ja.toJSONString()); model.addAttribute("menus", ja.toJSONString());
model.addAttribute("sysMenu", sysMenu); model.addAttribute("sysMenu", sysMenu);
if (null != sysMenu.getPId()) { if (null != sysMenu.getPId()) {
SysMenu pSysMenu = menuService.selectByPrimaryKey(sysMenu.getPId()); SysMenu pSysMenu = menuService.getById(sysMenu.getPId());
model.addAttribute("pName", pSysMenu.getName()); model.addAttribute("pName", pSysMenu.getName());
} }
return "/system/menu/update-menu"; return "/system/menu/update-menu";
@ -108,17 +97,17 @@ public class MenuController extends BaseController {
@Log(desc = "更新菜单", type = LOG_TYPE.ADD) @Log(desc = "更新菜单", type = LOG_TYPE.ADD)
@PostMapping(value = "updateMenu") @PostMapping(value = "updateMenu")
@ResponseBody @ResponseBody
public JsonUtil updateMenu(SysMenu sysMenu) { public LenResponse updateMenu(SysMenu sysMenu) {
SysMenu oldMenu = menuService.selectByPrimaryKey(sysMenu.getId()); SysMenu oldMenu = menuService.getById(sysMenu.getId());
BeanUtil.copyNotNullBean(sysMenu, oldMenu); BeanUtil.copyNotNullBean(sysMenu, oldMenu);
menuService.updateByPrimaryKeySelective(oldMenu); menuService.updateById(oldMenu);
return JsonUtil.sucess("保存成功"); return succ("保存成功");
} }
@Log(desc = "删除菜单", type = LOG_TYPE.DEL) @Log(desc = "删除菜单", type = LOG_TYPE.DEL)
@PostMapping("/menu-del") @PostMapping("/menu-del")
@ResponseBody @ResponseBody
public JsonUtil del(String id) { public LenResponse del(String id) {
return menuService.del(id); return menuService.del(id);
} }

View File

@ -1,13 +1,13 @@
package com.len.controller; package com.len.controller;
import com.len.base.BaseController;
import com.len.base.CurrentUser; import com.len.base.CurrentUser;
import com.len.core.annotation.Log; import com.len.core.annotation.Log;
import com.len.core.shiro.Principal; import com.len.core.shiro.Principal;
import com.len.entity.SysUser; import com.len.entity.SysUser;
import com.len.service.SysUserService; import com.len.service.SysUserService;
import com.len.util.BeanUtil;
import com.len.util.Checkbox; import com.len.util.Checkbox;
import com.len.util.JsonUtil; import com.len.util.LenResponse;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -27,12 +27,17 @@ import java.util.List;
*/ */
@Controller @Controller
@RequestMapping("/person") @RequestMapping("/person")
@Api(value = "个人业务",description="个人业务处理") @Api(value = "个人业务", tags = "个人业务处理")
public class PersonController { public class PersonController extends BaseController {
@Autowired @Autowired
SysUserService userService; SysUserService userService;
@GetMapping("/index")
public String main() {
return "/main/index";
}
@GetMapping() @GetMapping()
public String toPerson(Model model) { public String toPerson(Model model) {
CurrentUser principal = Principal.getPrincipal(); CurrentUser principal = Principal.getPrincipal();
@ -41,8 +46,8 @@ public class PersonController {
} }
String id = principal.getId(); String id = principal.getId();
List<Checkbox> checkboxList = userService.getUserRoleByJson(id); //List<Checkbox> checkboxList = userService.getUserRoleByJson(id);
SysUser user = userService.selectByPrimaryKey(id); SysUser user = userService.getById(id);
model.addAttribute("user", user); model.addAttribute("user", user);
return "/system/person/me"; return "/system/person/me";
} }
@ -51,19 +56,11 @@ public class PersonController {
@Log(desc = "更新用户", type = Log.LOG_TYPE.UPDATE) @Log(desc = "更新用户", type = Log.LOG_TYPE.UPDATE)
@PostMapping(value = "updateUser") @PostMapping(value = "updateUser")
@ResponseBody @ResponseBody
public JsonUtil updatePerson(SysUser user) { public LenResponse updatePerson(SysUser user) {
JsonUtil jsonUtil = new JsonUtil();
jsonUtil.setFlag(false);
if (user == null) { if (user == null) {
jsonUtil.setMsg("获取数据失败"); return error("获取数据失败");
return jsonUtil;
} }
SysUser oldUser = userService.selectByPrimaryKey(user.getId()); userService.updatePerson(user);
BeanUtil.copyNotNullBean(user, oldUser); return succ("修改成功");
userService.updateByPrimaryKeySelective(oldUser);
jsonUtil.setFlag(true);
jsonUtil.setMsg("修改成功");
userService.updateCurrent(user);
return jsonUtil;
} }
} }

View File

@ -8,7 +8,7 @@ import com.len.entity.SysRole;
import com.len.service.MenuService; import com.len.service.MenuService;
import com.len.service.RoleMenuService; import com.len.service.RoleMenuService;
import com.len.service.RoleService; import com.len.service.RoleService;
import com.len.util.JsonUtil; import com.len.util.LenResponse;
import com.len.util.ReType; import com.len.util.ReType;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; 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.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/** /**
* @author zhuxiaomeng * @author zhuxiaomeng
* @date 2017/12/19. * @date 2017/12/19.
@ -30,7 +32,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
*/ */
@Controller @Controller
@RequestMapping(value = "/role") @RequestMapping(value = "/role")
@Api(value = "用户角色管理",description="角色业务处理") @Api(value = "用户角色管理", tags = "角色业务处理")
public class RoleController extends BaseController { public class RoleController extends BaseController {
@Autowired @Autowired
@ -44,7 +46,7 @@ public class RoleController extends BaseController {
@GetMapping(value = "showRole") @GetMapping(value = "showRole")
@RequiresPermissions(value = "role:show") @RequiresPermissions(value = "role:show")
public String showRole(Model model) { public String showRole() {
return "/system/role/roleList"; return "/system/role/roleList";
} }
@ -52,7 +54,7 @@ public class RoleController extends BaseController {
@GetMapping(value = "showRoleList") @GetMapping(value = "showRoleList")
@ResponseBody @ResponseBody
@RequiresPermissions("role:show") @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)); return roleService.show(role, Integer.valueOf(page), Integer.valueOf(limit));
} }
@ -60,7 +62,7 @@ public class RoleController extends BaseController {
@GetMapping(value = "showaLLRoleList") @GetMapping(value = "showaLLRoleList")
@ResponseBody @ResponseBody
@RequiresPermissions("role:show") @RequiresPermissions("role:show")
public String showRoleList(SysRole role, Model model) { public List<SysRole> showRoleList(SysRole role) {
return roleService.showAll(role); return roleService.showAll(role);
} }
@ -76,9 +78,9 @@ public class RoleController extends BaseController {
@Log(desc = "添加角色") @Log(desc = "添加角色")
@PostMapping(value = "addRole") @PostMapping(value = "addRole")
@ResponseBody @ResponseBody
public JsonUtil addRole(SysRole sysRole, String[] menus) { public LenResponse addRole(SysRole sysRole, String[] menus) {
if (StringUtils.isEmpty(sysRole.getRoleName())) { if (StringUtils.isEmpty(sysRole.getRoleName())) {
JsonUtil.error("角色名称不能为空"); return error("角色名称不能为空");
} }
return roleService.addRole(sysRole, menus); return roleService.addRole(sysRole, menus);
} }
@ -86,7 +88,7 @@ public class RoleController extends BaseController {
@GetMapping(value = "updateRole") @GetMapping(value = "updateRole")
public String updateRole(String id, Model model, boolean detail) { public String updateRole(String id, Model model, boolean detail) {
if (StringUtils.isNotEmpty(id)) { if (StringUtils.isNotEmpty(id)) {
SysRole role = roleService.selectByPrimaryKey(id); SysRole role = roleService.getById(id);
model.addAttribute("role", role); model.addAttribute("role", role);
JSONArray jsonArray = menuService.getTreeUtil(id); JSONArray jsonArray = menuService.getTreeUtil(id);
model.addAttribute("menus", jsonArray.toJSONString()); model.addAttribute("menus", jsonArray.toJSONString());
@ -99,9 +101,9 @@ public class RoleController extends BaseController {
@Log(desc = "更新角色") @Log(desc = "更新角色")
@PostMapping(value = "updateRole") @PostMapping(value = "updateRole")
@ResponseBody @ResponseBody
public JsonUtil updateUser(SysRole role, String[] menus) { public LenResponse updateUser(SysRole role, String[] menus) {
if (role == null) { if (role == null) {
return JsonUtil.error("获取数据失败"); return error("获取数据失败");
} }
return roleService.updateUser(role, menus); return roleService.updateUser(role, menus);
} }
@ -111,9 +113,9 @@ public class RoleController extends BaseController {
@PostMapping(value = "del") @PostMapping(value = "del")
@ResponseBody @ResponseBody
@RequiresPermissions("role:del") @RequiresPermissions("role:del")
public JsonUtil del(String id) { public LenResponse del(String id) {
if (StringUtils.isEmpty(id)) { if (StringUtils.isEmpty(id)) {
return JsonUtil.error("获取数据失败"); return error("获取数据失败");
} }
return roleService.del(id); return roleService.del(id);
} }

View File

@ -8,12 +8,14 @@ import com.len.base.BaseController;
import com.len.core.annotation.Log; import com.len.core.annotation.Log;
import com.len.core.annotation.Log.LOG_TYPE; import com.len.core.annotation.Log.LOG_TYPE;
import com.len.core.quartz.JobTask; import com.len.core.quartz.JobTask;
import com.len.entity.SysRoleUser;
import com.len.entity.SysUser; import com.len.entity.SysUser;
import com.len.exception.MyException;
import com.len.service.RoleUserService; import com.len.service.RoleUserService;
import com.len.service.SysUserService; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.*; 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 org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
@ -37,7 +44,7 @@ import java.util.List;
//@Api(value="user") //@Api(value="user")
@Controller @Controller
@RequestMapping(value = "/user") @RequestMapping(value = "/user")
@Api(value = "用户管理",description="用户管理业务") @Api(value = "用户管理", tags = "用户管理业务")
public class UserController extends BaseController { public class UserController extends BaseController {
//private static final Logger //private static final Logger
@ -59,14 +66,14 @@ public class UserController extends BaseController {
@GetMapping(value = "showUser") @GetMapping(value = "showUser")
@RequiresPermissions("user:show") @RequiresPermissions("user:show")
public String showUser(Model model) { public String showUser() {
return "/system/user/userList"; return "/system/user/userList";
} }
@GetMapping(value = "showUserList") @GetMapping(value = "showUserList")
@ResponseBody @ResponseBody
@RequiresPermissions("user:show") @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)); return userService.show(user, Integer.valueOf(page), Integer.valueOf(limit));
} }
@ -74,7 +81,7 @@ public class UserController extends BaseController {
@GetMapping(value = "listByRoleId") @GetMapping(value = "listByRoleId")
@ResponseBody @ResponseBody
@RequiresPermissions("user:show") @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(); JSONObject returnValue = new JSONObject();
Page<Object> startPage = PageHelper.startPage(page, limit); Page<Object> startPage = PageHelper.startPage(page, limit);
List<SysUser> users = userService.getUserByRoleId(roleId); List<SysUser> users = userService.getUserByRoleId(roleId);
@ -95,39 +102,26 @@ public class UserController extends BaseController {
@Log(desc = "添加用户") @Log(desc = "添加用户")
@PostMapping(value = "addUser") @PostMapping(value = "addUser")
@ResponseBody @ResponseBody
public JsonUtil addUser(SysUser user, String[] role) { public LenResponse addUser(SysUser user, String[] role) {
if (user == null) { if (user == null) {
return JsonUtil.error("获取数据失败"); return error("获取数据失败");
} }
if (StringUtils.isBlank(user.getUsername())) { if (StringUtils.isBlank(user.getUsername())) {
return JsonUtil.error("用户名不能为空"); return error("用户名不能为空");
} }
if (StringUtils.isBlank(user.getPassword())) { if (StringUtils.isBlank(user.getPassword())) {
return JsonUtil.error("密码不能为空"); return error("密码不能为空");
} }
if (role == null) { if (role == null) {
return JsonUtil.error("请选择角色"); return error("请选择角色");
} }
int result = userService.checkUser(user.getUsername()); int result = userService.checkUser(user.getUsername());
if (result > 0) { if (result > 0) {
return JsonUtil.error("用户名已存在"); return error("用户名已存在");
} }
JsonUtil j = new JsonUtil(); userService.add(user, Arrays.asList(role));
try {
userService.insertSelective(user); return succ();
SysRoleUser sysRoleUser = new SysRoleUser();
sysRoleUser.setUserId(user.getId());
for (String r : role) {
sysRoleUser.setRoleId(r);
roleUserService.insertSelective(sysRoleUser);
}
j.setMsg("保存成功");
} catch (MyException e) {
j.setMsg("保存失败");
j.setFlag(false);
e.printStackTrace();
}
return j;
} }
@GetMapping(value = "updateUser") @GetMapping(value = "updateUser")
@ -135,7 +129,7 @@ public class UserController extends BaseController {
if (StringUtils.isNotEmpty(id)) { if (StringUtils.isNotEmpty(id)) {
//用户-角色 //用户-角色
List<Checkbox> checkboxList = userService.getUserRoleByJson(id); List<Checkbox> checkboxList = userService.getUserRoleByJson(id);
SysUser user = userService.selectByPrimaryKey(id); SysUser user = userService.getById(id);
model.addAttribute("user", user); model.addAttribute("user", user);
model.addAttribute("boxJson", checkboxList); model.addAttribute("boxJson", checkboxList);
} }
@ -143,41 +137,21 @@ public class UserController extends BaseController {
return "system/user/update-user"; return "system/user/update-user";
} }
@ApiOperation(value = "/updateUser", httpMethod = "POST", notes = "更新用户") @ApiOperation(value = "/updateUser", httpMethod = "POST", notes = "更新用户")
@Log(desc = "更新用户", type = LOG_TYPE.UPDATE) @Log(desc = "更新用户", type = LOG_TYPE.UPDATE)
@PostMapping(value = "updateUser") @PostMapping(value = "updateUser")
@ResponseBody @ResponseBody
public JsonUtil updateUser(SysUser user, String role[]) { public LenResponse updateUser(SysUser user, String[] role) {
JsonUtil jsonUtil = new JsonUtil();
jsonUtil.setFlag(false);
if (user == null) { if (user == null) {
jsonUtil.setMsg("获取数据失败"); return error("获取数据失败");
return jsonUtil;
} }
try { List<String> roles = new ArrayList<>();
SysUser oldUser = userService.selectByPrimaryKey(user.getId()); if (role != null) {
BeanUtil.copyNotNullBean(user, oldUser); roles = Arrays.asList(role);
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();
} }
return jsonUtil; userService.updateUser(user, roles);
return succ("修改成功");
} }
@Log(desc = "删除用户", type = LOG_TYPE.DEL) @Log(desc = "删除用户", type = LOG_TYPE.DEL)
@ -185,7 +159,7 @@ public class UserController extends BaseController {
@PostMapping(value = "/del") @PostMapping(value = "/del")
@ResponseBody @ResponseBody
@RequiresPermissions("user:del") @RequiresPermissions("user:del")
public JsonUtil del(String id, boolean flag) { public LenResponse del(String id, boolean flag) {
return userService.delById(id, flag); return userService.delById(id, flag);
} }
@ -194,7 +168,7 @@ public class UserController extends BaseController {
if (StringUtils.isEmpty(id)) { if (StringUtils.isEmpty(id)) {
return "获取账户信息失败"; return "获取账户信息失败";
} }
SysUser user = userService.selectByPrimaryKey(id); SysUser user = userService.getById(id);
model.addAttribute("user", user); model.addAttribute("user", user);
return "/system/user/re-pass"; return "/system/user/re-pass";
} }
@ -203,7 +177,6 @@ public class UserController extends BaseController {
* 修改密码 * 修改密码
* *
* @param id * @param id
* @param pass
* @param newPwd * @param newPwd
* @return * @return
*/ */
@ -211,35 +184,20 @@ public class UserController extends BaseController {
@PostMapping(value = "rePass") @PostMapping(value = "rePass")
@ResponseBody @ResponseBody
@RequiresPermissions("user:repass") @RequiresPermissions("user:repass")
public JsonUtil rePass(String id, String pass, String newPwd) { public LenResponse rePass(String id, String newPwd) {
boolean flag = StringUtils.isEmpty(id) || StringUtils.isEmpty(pass) || StringUtils.isEmpty(newPwd); boolean flag = StringUtils.isEmpty(id) || StringUtils.isEmpty(newPwd);
JsonUtil j = new JsonUtil();
j.setFlag(false);
if (flag) { if (flag) {
j.setMsg("获取数据失败,修改失败"); return error("获取数据失败,修改失败");
return j;
} }
SysUser user = userService.selectByPrimaryKey(id); SysUser user = userService.getById(id);
newPwd = Md5Util.getMD5(newPwd, user.getUsername()); 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())) { if (newPwd.equals(user.getPassword())) {
j.setMsg("新密码不能与旧密码相同"); return resp(false, "新密码不能与旧密码相同");
return j;
} }
user.setPassword(newPwd); user.setPassword(newPwd);
try { userService.rePass(user);
userService.rePass(user);
j.setMsg("修改成功"); return succ("修改成功");
j.setFlag(true);
} catch (MyException e) {
e.printStackTrace();
}
return j;
} }
@Autowired @Autowired
@ -250,10 +208,9 @@ public class UserController extends BaseController {
*/ */
@PostMapping(value = "upload") @PostMapping(value = "upload")
@ResponseBody @ResponseBody
public JsonUtil imgUpload(HttpServletRequest req, @RequestParam("file") MultipartFile file, public LenResponse imgUpload(HttpServletRequest req, @RequestParam("file") MultipartFile file) {
ModelMap model) {
String fileName = uploadUtil.upload(file); String fileName = uploadUtil.upload(file);
JsonUtil j = new JsonUtil(); LenResponse j = new LenResponse();
j.setMsg(fileName); j.setMsg(fileName);
return j; return j;
} }
@ -263,21 +220,15 @@ public class UserController extends BaseController {
*/ */
@GetMapping(value = "checkUser") @GetMapping(value = "checkUser")
@ResponseBody @ResponseBody
public JsonUtil checkUser(String uname, HttpServletRequest req) { public LenResponse checkUser(String uname) {
JsonUtil j = new JsonUtil();
j.setFlag(Boolean.FALSE);
if (StringUtils.isEmpty(uname)) { if (StringUtils.isEmpty(uname)) {
j.setMsg("获取数据失败"); return error("获取数据失败");
return j;
} }
int result = userService.checkUser(uname); int result = userService.checkUser(uname);
if (result > 0) { if (result > 0) {
j.setMsg("用户名已存在"); return error("用户名已存在");
return j;
} }
j.setFlag(true); return succ();
return j;
} }

View File

@ -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();
}
}

View File

@ -9,6 +9,7 @@ import com.len.util.IpUtil;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Date; import java.util.Date;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.UnavailableSecurityManagerException; import org.apache.shiro.UnavailableSecurityManagerException;

View File

@ -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.core.quartz.JobTask;
import com.len.entity.SysJob; import com.len.entity.SysJob;
import com.len.service.JobService; import com.len.service.JobService;
@ -9,8 +10,6 @@ import com.len.service.RoleService;
import java.util.List; import java.util.List;
import lombok.extern.slf4j.Slf4j; 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.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -39,7 +38,8 @@ public class DataSourceJobThread extends Thread {
JobTask jobTask = SpringUtil.getBean("jobTask"); JobTask jobTask = SpringUtil.getBean("jobTask");
SysJob job = new SysJob(); SysJob job = new SysJob();
job.setStatus(true); job.setStatus(true);
List<SysJob> jobList = jobService.selectListByPage(job); QueryWrapper<SysJob> jobQueryWrapper=new QueryWrapper<>(job);
List<SysJob> jobList = jobService.list(jobQueryWrapper);
//开启任务 //开启任务
jobList.forEach(jobs -> { jobList.forEach(jobs -> {
log.info("---任务[" + jobs.getId() + "]系统 init--开始启动---------"); log.info("---任务[" + jobs.getId() + "]系统 init--开始启动---------");
@ -48,8 +48,9 @@ public class DataSourceJobThread extends Thread {
); );
if (jobList.size() == 0) { if (jobList.size() == 0) {
log.info("---数据库暂无启动的任务---------"); log.info("---数据库暂无启动的任务---------");
} else } else {
System.out.println("---任务启动完毕---------"); System.out.println("---任务启动完毕---------");
}
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -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();
}
}

View File

@ -1,4 +1,4 @@
package com.len.core.BootListener; package com.len.core.listener;
import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener; import javax.servlet.ServletContextListener;
@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
* @email 154040976@qq.com * @email 154040976@qq.com
*/ */
@Component @Component
public class MyServletContextListener implements ServletContextListener { public class CustomServletContextListener implements ServletContextListener {
@Override @Override
public void contextInitialized(ServletContextEvent sce) { public void contextInitialized(ServletContextEvent sce) {

View File

@ -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);
}
}

View File

@ -36,7 +36,7 @@ public class JobDemo1 implements Job{
ApplicationContext applicationContext=SpringUtil.getApplicationContext(); ApplicationContext applicationContext=SpringUtil.getApplicationContext();
//可以 获取 //可以 获取
//SysUserService sys=SpringUtil.getBean(SysUserServiceImpl.class); //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(userList.get(0).getUsername());;
System.out.println("JobDemo1执行完毕======================="); System.out.println("JobDemo1执行完毕=======================");

View File

@ -38,7 +38,7 @@ public class JobDemo2 implements Job{
public void run(){ public void run(){
ApplicationContext applicationContext=SpringUtil.getApplicationContext(); ApplicationContext applicationContext=SpringUtil.getApplicationContext();
SysUserService sys=SpringUtil.getBean(SysUserServiceImpl.class); 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(userList.get(0).getUsername());
log.info("JobDemo2执行完毕======================="); log.info("JobDemo2执行完毕=======================");
} }

View File

@ -33,7 +33,7 @@ public class JobDemo3 implements Job{
public void run(){ public void run(){
ApplicationContext applicationContext=SpringUtil.getApplicationContext(); ApplicationContext applicationContext=SpringUtil.getApplicationContext();
SysUserService sys=SpringUtil.getBean(SysUserServiceImpl.class); 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(userList.get(0).getUsername());;
System.out.println("JobDemo3执行完毕======================="); System.out.println("JobDemo3执行完毕=======================");

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