Commit 3bb57e2e by chenweisong

更新

parent f5f800cb
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
<!-- <groupId>org.springframework.boot</groupId>--> <!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-mongodb</artifactId>--> <!-- <artifactId>spring-boot-starter-data-mongodb</artifactId>-->
<!-- </dependency>--> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>org.springframework.cloud</groupId> <!-- <groupId>org.springframework.cloud</groupId>-->
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> <!-- <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
......
...@@ -11,13 +11,11 @@ import org.activiti.engine.*; ...@@ -11,13 +11,11 @@ import org.activiti.engine.*;
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.*;
@Api(value = "模板控制器") @Api(description = "模板 控制器")
@RestController @RestController
@RequestMapping(path = "/api") @RequestMapping(path = "/api")
public class ExcelController { public class ExcelController {
// @Autowired
// private RecordDataService recordDataService;
@Autowired @Autowired
private TemplateService templateService; private TemplateService templateService;
@Autowired @Autowired
......
...@@ -24,8 +24,8 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -24,8 +24,8 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.*; import java.util.*;
@RestController //@RestController
@RequestMapping(path = "/rest/subprocess") //@RequestMapping(path = "/rest/subprocess")
public class SubProcessCtrl { public class SubProcessCtrl {
private Logger logger = LoggerFactory.getLogger(SubProcessCtrl.class); private Logger logger = LoggerFactory.getLogger(SubProcessCtrl.class);
@Autowired @Autowired
......
...@@ -13,9 +13,7 @@ import com.keymobile.rest.service.ActivityService; ...@@ -13,9 +13,7 @@ import com.keymobile.rest.service.ActivityService;
import com.keymobile.rest.service.UserService; import com.keymobile.rest.service.UserService;
import com.keymobile.rest.vo.ExcelForm; import com.keymobile.rest.vo.ExcelForm;
import com.keymobile.rest.vo.JobForm; import com.keymobile.rest.vo.JobForm;
import io.swagger.annotations.Api; import io.swagger.annotations.*;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.activiti.engine.*; import org.activiti.engine.*;
import org.activiti.engine.repository.Deployment; import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition; import org.activiti.engine.repository.ProcessDefinition;
...@@ -29,15 +27,14 @@ import org.springframework.web.bind.annotation.*; ...@@ -29,15 +27,14 @@ import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Api(description = "活动 控制器")
@RestController @RestController
@RequestMapping(path = "/api/task") @RequestMapping(path = "/api/task")
@Api(value = "活动控制器")
public class TaskController { public class TaskController {
// 默认启动的固化流程 // 默认启动的固化流程
@Value("${app.active-process}") @Value("${app.active-process}")
private String process; private String process;
@Autowired @Autowired
private ManagementService managementService; private ManagementService managementService;
@Autowired @Autowired
...@@ -57,8 +54,13 @@ public class TaskController { ...@@ -57,8 +54,13 @@ public class TaskController {
@ApiOperation(value = "获取首页活动列表") @ApiOperation(value = "获取首页活动列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", paramType = "query", required = true, dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "pageSize", value = "当前页条数", paramType = "query", required = true, dataType = "int", defaultValue = "10"),
@ApiImplicitParam(name = "name", value = "活动名称", paramType = "query", dataType = "string")
})
@PostMapping(value = "/list") @PostMapping(value = "/list")
public ApiResponse getTaskList(@RequestParam Integer pageNo, @RequestParam Integer pageSize, @RequestParam(required = false) @ApiParam(name = "name", value = "活动名称") String name) { public ApiResponse getTaskList(int pageNo, int pageSize, String name) {
Page<Activity> taskList; Page<Activity> taskList;
String orderBy = "descending"; // String orderBy = "descending"; //
String propBy = "id"; // groupBy String propBy = "id"; // groupBy
...@@ -70,20 +72,52 @@ public class TaskController { ...@@ -70,20 +72,52 @@ public class TaskController {
return ApiResponse.ok(ImmutableMap.of("list", taskList.getContent(), "total", taskList.getTotalElements())); return ApiResponse.ok(ImmutableMap.of("list", taskList.getContent(), "total", taskList.getTotalElements()));
} }
@ApiOperation(value = "查看活动") @ApiOperation(value = "单个活动详情")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "活动id", paramType = "query", required = true, dataType = "long")
})
@PostMapping(value = "/get") @PostMapping(value = "/get")
public ApiResponse get(@RequestParam @ApiParam(required = true, name = "taskId", value = "活动id") Long taskId) { public ApiResponse get(long taskId) {
Activity activity = activityService.get(taskId); Activity activity = activityService.get(taskId);
TwinkleValidator.notNull(activity, "活动不存在"); TwinkleValidator.notNull(activity, "活动不存在");
return ApiResponse.ok(activity); return ApiResponse.ok(activity);
} }
@ApiOperation(value = "我的任务", notes = "补录任务列表及审核任务列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", paramType = "query", required = true, dataType = "long")
})
@PostMapping(value = "/getMyMissions")
public ApiResponse getMyMissions(long userId) {
User user = userService.findById(userId);
TwinkleValidator.notNull(user, "用户不存在");
List<Activity> activityList = new ArrayList<>();
// 获取任务
// List<Task> tasks = taskService.createNativeTaskQuery()
// .sql("SELECT * FROM " + managementService.getTableName(Task.class) + " T WHERE T.ASSIGNEE_ = #{assignee1} OR T.ASSIGNEE_ = #{assignee2}")
// .parameter("assignee1", user.getUsername()).parameter("assignee2", audit.getUsername())
// .list();
// for (Task task : tasks) {
// String processId = task.getProcessInstanceId();
// Activity activity = assignmentService.findByProcessId(processId);
// if (assignment != null && assignment.getStatus() != Assignment.STATUS_COMPLETED) {
// if (task.getTaskDefinitionKey().equals("addData")) {
// assignment.setKind(Assignment.KIND_RECORD);
// } else {
// assignment.setKind(Assignment.KIND_AUDIT);
// }
// activityList.add(activity);
// }
// }
return ApiResponse.ok();
}
@ApiOperation(value = "补录任务列表及审核任务列表") @ApiOperation(value = "我的任务", notes = "补录任务列表及审核任务列表")
@PostMapping(value = "/getMyTasks") @PostMapping(value = "/getMyTasks")
public ApiResponse getMyTasks() { public ApiResponse getMyTasks() {
// User user = userService.getNormalUser();
// User audit = userService.getAudit();
List<Activity> activityList = new ArrayList<>(); List<Activity> activityList = new ArrayList<>();
// 获取任务 // 获取任务
// List<Task> tasks = taskService.createNativeTaskQuery() // List<Task> tasks = taskService.createNativeTaskQuery()
......
package com.keymobile.rest.controller; package com.keymobile.rest.controller;
import com.keymobile.rest.common.bean.ApiResponse; import com.keymobile.rest.common.bean.ApiResponse;
import com.keymobile.rest.common.validator.TwinkleValidator;
import com.keymobile.rest.model.*; import com.keymobile.rest.model.*;
import com.keymobile.rest.service.*; import com.keymobile.rest.service.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
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 java.util.*; import java.util.*;
@Api(value = "用户/机构/补录范围 控制器") @Api(description = "用户/机构/补录范围 控制器")
@RestController @RestController
@RequestMapping(path = "/api") @RequestMapping(path = "/api")
public class UserController { public class UserController {
...@@ -27,7 +30,7 @@ public class UserController { ...@@ -27,7 +30,7 @@ public class UserController {
root.setId(Group.ROOT_ID); root.setId(Group.ROOT_ID);
root.setName(Group.ROOT_NAME); root.setName(Group.ROOT_NAME);
root.setParentId(Group.ROOT_PARENT_ID); root.setParentId(Group.ROOT_PARENT_ID);
root.setParentId(Group.ROOT_LEVEL); root.setLevel(Group.ROOT_LEVEL);
} }
@ApiOperation(value = "获取补录人员列表") @ApiOperation(value = "获取补录人员列表")
...@@ -39,19 +42,29 @@ public class UserController { ...@@ -39,19 +42,29 @@ public class UserController {
@ApiOperation(value = "获取补录范围列表") @ApiOperation(value = "获取补录范围列表")
@PostMapping(value = "/scope/list") @PostMapping(value = "/scope/list")
public ApiResponse getExtentList() { public ApiResponse getScopeList() {
List<RecordScope> recordScopeList = recordScopeService.findAll(); List<RecordScope> recordScopeList = recordScopeService.findAll();
return ApiResponse.ok(recordScopeList); return ApiResponse.ok(recordScopeList);
} }
// @ApiOperation(value = "补录范围绑定人员") @ApiOperation(value = "补录范围绑定人员")
// @PostMapping(value = "/scope/bindUser") @ApiImplicitParams({
// public ApiResponse getExtentList() { @ApiImplicitParam(name = "scopeId", value = "补录范围id", paramType = "query", required = true, dataType = "long"),
// List<RecordScope> recordScopeList = recordScopeService.findAll(); @ApiImplicitParam(name = "userId", value = "用户id", paramType = "query", required = true, dataType = "long")
// return ApiResponse.ok(recordScopeList); })
// } @PostMapping(value = "/scope/bindUser")
public ApiResponse bindUser(long scopeId, long userId) {
RecordScope scope = recordScopeService.findById(scopeId);
TwinkleValidator.notNull(scope, "所选范围不存在");
User user = userService.findById(userId);
TwinkleValidator.notNull(user, "所选用户不存在");
TwinkleValidator.isTrue(scope.getGroup().getId() == user.getGroup().getId(), "所选用户与所选范围不属于统一机构");
scope.setUser(user);
recordScopeService.update(scope);
return ApiResponse.ok();
}
@ApiOperation(value = "获取机构数据") @ApiOperation(value = "获取机构列表")
@PostMapping(value = "/group/list") @PostMapping(value = "/group/list")
public ApiResponse getGroupList() { public ApiResponse getGroupList() {
return ApiResponse.ok(getGroupTree()); return ApiResponse.ok(getGroupTree());
......
...@@ -29,7 +29,7 @@ public class RecordScope implements Serializable { ...@@ -29,7 +29,7 @@ public class RecordScope implements Serializable {
@Column(nullable = false, columnDefinition = ("integer(2) comment '补录角色'")) @Column(nullable = false, columnDefinition = ("integer(2) comment '补录角色'"))
private int role; private int role;
@ManyToOne @ManyToOne(fetch = FetchType.EAGER)
private Group group; private Group group;
@ManyToOne @ManyToOne
......
...@@ -19,7 +19,6 @@ public class RecordScopeService { ...@@ -19,7 +19,6 @@ public class RecordScopeService {
@Autowired @Autowired
private GroupDao groupDao; private GroupDao groupDao;
@PostConstruct @PostConstruct
private void init() { private void init() {
List<Group> groupList = groupDao.findAll(); List<Group> groupList = groupDao.findAll();
...@@ -39,9 +38,15 @@ public class RecordScopeService { ...@@ -39,9 +38,15 @@ public class RecordScopeService {
}); });
} }
public RecordScope findById(long id) {
return recordScopeDao.getOne(id);
}
public List<RecordScope> findAll() { public List<RecordScope> findAll() {
return recordScopeDao.findAll(); return recordScopeDao.findAll();
} }
public void update(RecordScope recordScope) {
recordScopeDao.save(recordScope);
}
} }
...@@ -21,4 +21,8 @@ public class UserService { ...@@ -21,4 +21,8 @@ public class UserService {
return userDao.findAll(); return userDao.findAll();
} }
public User findById(long id) {
return userDao.getOne(id);
}
} }
...@@ -17,8 +17,8 @@ spring: ...@@ -17,8 +17,8 @@ spring:
jpa: jpa:
show-sql: true show-sql: true
database-platform: org.hibernate.dialect.MySQL5Dialect database-platform: org.hibernate.dialect.MySQL5Dialect
# hibernate: # hibernate:
# ddl-auto: update # ddl-auto: update
datasource: datasource:
url: jdbc:mysql://47.105.193.165:3306/dev0?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8 url: jdbc:mysql://47.105.193.165:3306/dev0?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
username: root username: root
...@@ -30,7 +30,8 @@ spring: ...@@ -30,7 +30,8 @@ spring:
max-file-size: 20Mb max-file-size: 20Mb
max-request-size: 100Mb max-request-size: 100Mb
redis: redis:
host: 192.168.0.192 # host: 192.168.0.192
host: 127.0.0.1
port: 6379 port: 6379
session: session:
store-type: redis store-type: redis
...@@ -42,7 +43,7 @@ server: ...@@ -42,7 +43,7 @@ server:
port: 8110 port: 8110
app: app:
active-process: RecordStandardProcess.bpmn active-process: MoreSubProcessTest.bpmn
swagger2: swagger2:
host: localhost:8110 host: localhost:8110
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment