Commit 3bb57e2e by chenweisong

更新

parent f5f800cb
......@@ -28,10 +28,10 @@
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-mongodb</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......
......@@ -11,13 +11,11 @@ import org.activiti.engine.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Api(value = "模板控制器")
@Api(description = "模板 控制器")
@RestController
@RequestMapping(path = "/api")
public class ExcelController {
// @Autowired
// private RecordDataService recordDataService;
@Autowired
private TemplateService templateService;
@Autowired
......@@ -62,7 +60,7 @@ public class ExcelController {
// if (dataInfoList.size() > 0) {
// return ApiResponse.ok(dataInfoList.get(0));
// } else {
return ApiResponse.ok();
return ApiResponse.ok();
// }
}
......
......@@ -24,8 +24,8 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.*;
@RestController
@RequestMapping(path = "/rest/subprocess")
//@RestController
//@RequestMapping(path = "/rest/subprocess")
public class SubProcessCtrl {
private Logger logger = LoggerFactory.getLogger(SubProcessCtrl.class);
@Autowired
......
......@@ -13,9 +13,7 @@ import com.keymobile.rest.service.ActivityService;
import com.keymobile.rest.service.UserService;
import com.keymobile.rest.vo.ExcelForm;
import com.keymobile.rest.vo.JobForm;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.*;
import org.activiti.engine.*;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
......@@ -29,15 +27,14 @@ import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.stream.Collectors;
@Api(description = "活动 控制器")
@RestController
@RequestMapping(path = "/api/task")
@Api(value = "活动控制器")
public class TaskController {
// 默认启动的固化流程
@Value("${app.active-process}")
private String process;
@Autowired
private ManagementService managementService;
@Autowired
......@@ -57,8 +54,13 @@ public class TaskController {
@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")
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;
String orderBy = "descending"; //
String propBy = "id"; // groupBy
......@@ -70,20 +72,52 @@ public class TaskController {
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")
public ApiResponse get(@RequestParam @ApiParam(required = true, name = "taskId", value = "活动id") Long taskId) {
public ApiResponse get(long taskId) {
Activity activity = activityService.get(taskId);
TwinkleValidator.notNull(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")
public ApiResponse getMyTasks() {
// User user = userService.getNormalUser();
// User audit = userService.getAudit();
List<Activity> activityList = new ArrayList<>();
// 获取任务
// List<Task> tasks = taskService.createNativeTaskQuery()
......
package com.keymobile.rest.controller;
import com.keymobile.rest.common.bean.ApiResponse;
import com.keymobile.rest.common.validator.TwinkleValidator;
import com.keymobile.rest.model.*;
import com.keymobile.rest.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@Api(value = "用户/机构/补录范围 控制器")
@Api(description = "用户/机构/补录范围 控制器")
@RestController
@RequestMapping(path = "/api")
public class UserController {
......@@ -27,7 +30,7 @@ public class UserController {
root.setId(Group.ROOT_ID);
root.setName(Group.ROOT_NAME);
root.setParentId(Group.ROOT_PARENT_ID);
root.setParentId(Group.ROOT_LEVEL);
root.setLevel(Group.ROOT_LEVEL);
}
@ApiOperation(value = "获取补录人员列表")
......@@ -39,19 +42,29 @@ public class UserController {
@ApiOperation(value = "获取补录范围列表")
@PostMapping(value = "/scope/list")
public ApiResponse getExtentList() {
public ApiResponse getScopeList() {
List<RecordScope> recordScopeList = recordScopeService.findAll();
return ApiResponse.ok(recordScopeList);
}
// @ApiOperation(value = "补录范围绑定人员")
// @PostMapping(value = "/scope/bindUser")
// public ApiResponse getExtentList() {
// List<RecordScope> recordScopeList = recordScopeService.findAll();
// return ApiResponse.ok(recordScopeList);
// }
@ApiOperation(value = "补录范围绑定人员")
@ApiImplicitParams({
@ApiImplicitParam(name = "scopeId", value = "补录范围id", paramType = "query", required = true, dataType = "long"),
@ApiImplicitParam(name = "userId", value = "用户id", paramType = "query", required = true, dataType = "long")
})
@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")
public ApiResponse getGroupList() {
return ApiResponse.ok(getGroupTree());
......
......@@ -29,7 +29,7 @@ public class RecordScope implements Serializable {
@Column(nullable = false, columnDefinition = ("integer(2) comment '补录角色'"))
private int role;
@ManyToOne
@ManyToOne(fetch = FetchType.EAGER)
private Group group;
@ManyToOne
......
......@@ -19,7 +19,6 @@ public class RecordScopeService {
@Autowired
private GroupDao groupDao;
@PostConstruct
private void init() {
List<Group> groupList = groupDao.findAll();
......@@ -39,9 +38,15 @@ public class RecordScopeService {
});
}
public RecordScope findById(long id) {
return recordScopeDao.getOne(id);
}
public List<RecordScope> findAll() {
return recordScopeDao.findAll();
}
public void update(RecordScope recordScope) {
recordScopeDao.save(recordScope);
}
}
......@@ -21,4 +21,8 @@ public class UserService {
return userDao.findAll();
}
public User findById(long id) {
return userDao.getOne(id);
}
}
......@@ -17,8 +17,8 @@ spring:
jpa:
show-sql: true
database-platform: org.hibernate.dialect.MySQL5Dialect
# hibernate:
# ddl-auto: update
# hibernate:
# ddl-auto: update
datasource:
url: jdbc:mysql://47.105.193.165:3306/dev0?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
username: root
......@@ -30,7 +30,8 @@ spring:
max-file-size: 20Mb
max-request-size: 100Mb
redis:
host: 192.168.0.192
# host: 192.168.0.192
host: 127.0.0.1
port: 6379
session:
store-type: redis
......@@ -42,7 +43,7 @@ server:
port: 8110
app:
active-process: RecordStandardProcess.bpmn
active-process: MoreSubProcessTest.bpmn
swagger2:
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