Commit d8026ea9 by chenweisong

更新

parent 3cf5519e
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<build> <build>
<finalName>record-demo</finalName> <finalName>admin</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
......
...@@ -24,7 +24,6 @@ import org.springframework.web.bind.annotation.*; ...@@ -24,7 +24,6 @@ import org.springframework.web.bind.annotation.*;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Api(description = "活动 控制器") @Api(description = "活动 控制器")
@RestController @RestController
...@@ -91,59 +90,42 @@ public class TaskController { ...@@ -91,59 +90,42 @@ public class TaskController {
@ApiOperation(value = "我的任务", notes = "补录任务列表及审核任务列表") @ApiOperation(value = "我的任务", notes = "补录任务列表及审核任务列表")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", paramType = "query", required = true, dataType = "long") @ApiImplicitParam(name = "userId", value = "用户id", paramType = "query", required = false, 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 = "我的任务", notes = "补录任务列表及审核任务列表")
@PostMapping(value = "/getMyTasks") @PostMapping(value = "/getMyTasks")
public ApiResponse getMyTasks() { public ApiResponse getMyMissions(Long userId) {
List<Activity> activityList = new ArrayList<>(); // User user = userService.findById(userId);
// TwinkleValidator.notNull(user, "用户不存在");
List<Map> missions = new ArrayList<>();
List<User> userList = userService.findAll();
StringBuilder assigneesBuilder = new StringBuilder();
assigneesBuilder.append("(");
userList.forEach(user -> {
assigneesBuilder.append("'" + user.getUsername() + "'").append(",");
});
String assignees = assigneesBuilder.substring(0, assigneesBuilder.length() - 1) + ")";
// 获取任务 // 获取任务
// List<Task> tasks = taskService.createNativeTaskQuery() String sql = "SELECT * FROM " + managementService.getTableName(Task.class) + " T WHERE T.ASSIGNEE_ in " + assignees;
// .sql("SELECT * FROM " + managementService.getTableName(Task.class) + " T WHERE T.ASSIGNEE_ = #{assignee1} OR T.ASSIGNEE_ = #{assignee2}") List<Task> tasks = taskService.createNativeTaskQuery()
// .parameter("assignee1", user.getUsername()).parameter("assignee2", audit.getUsername()) .sql(sql)
// .list(); .list();
// for (Task task : tasks) { for (Task task : tasks) {
// String processId = task.getProcessInstanceId(); String processId = task.getProcessInstanceId();
// Activity activity = assignmentService.findByProcessId(processId); List<Process> processList = processService.findAllByProcessId(processId);
// if (assignment != null && assignment.getStatus() != Assignment.STATUS_COMPLETED) { // Process process = processService.findByProcessIdAndStatus(processId, Process.STATUS_RECORDING);
// if (task.getTaskDefinitionKey().equals("addData")) { if (processList.size() != 0) {
// assignment.setKind(Assignment.KIND_RECORD); Map mission = new HashMap();
// } else { mission.put("1", 1);
// assignment.setKind(Assignment.KIND_AUDIT); if (task.getTaskDefinitionKey().equals("addData")) {
// }
// activityList.add(activity); } else {
// }
}
// } missions.add(mission);
}
}
return ApiResponse.ok(); return ApiResponse.ok();
} }
...@@ -153,6 +135,7 @@ public class TaskController { ...@@ -153,6 +135,7 @@ public class TaskController {
public ApiResponse createTask(@RequestBody TaskForm form) { public ApiResponse createTask(@RequestBody TaskForm form) {
TwinkleValidator.notEmpty(form.getName(), "名称不能为空"); TwinkleValidator.notEmpty(form.getName(), "名称不能为空");
TwinkleValidator.notNull(form.getType(), "类型不能为空"); TwinkleValidator.notNull(form.getType(), "类型不能为空");
TwinkleValidator.isTrue(form.getExcels() != null && form.getExcels().size() != 0, "补录模板不能为空"); TwinkleValidator.isTrue(form.getExcels() != null && form.getExcels().size() != 0, "补录模板不能为空");
// 创建人 为 manager // 创建人 为 manager
User admin = getAdmin(); User admin = getAdmin();
...@@ -167,6 +150,7 @@ public class TaskController { ...@@ -167,6 +150,7 @@ public class TaskController {
// 新建excel实例 // 新建excel实例
List<ExcelForm> excelFormList = form.getExcels(); List<ExcelForm> excelFormList = form.getExcels();
excelFormList.forEach(excelForm -> { excelFormList.forEach(excelForm -> {
TwinkleValidator.isNotNULL(excelForm.getScopeId(), "模板scopeId不能为空");
RecordScope scope = recordScopeService.findById(excelForm.getScopeId()); RecordScope scope = recordScopeService.findById(excelForm.getScopeId());
TwinkleValidator.isNotNULL(scope, "补录范围不能为空"); TwinkleValidator.isNotNULL(scope, "补录范围不能为空");
TwinkleValidator.isFalse((StringUtils.isEmpty(excelForm.getUpStreamAddr()) && StringUtils.isNotEmpty(excelForm.getBackStreamAddr()) TwinkleValidator.isFalse((StringUtils.isEmpty(excelForm.getUpStreamAddr()) && StringUtils.isNotEmpty(excelForm.getBackStreamAddr())
...@@ -178,7 +162,7 @@ public class TaskController { ...@@ -178,7 +162,7 @@ public class TaskController {
// 查找当前补录范围所有的用户 // 查找当前补录范围所有的用户
List<User> userList = scope.getUserList(); List<User> userList = scope.getUserList();
TwinkleValidator.notLessThan(userList.size(), 1, "补录人员不存在"); TwinkleValidator.notLessThan(userList.size(), 1, "补录人员不存在,所选补录范围需要先绑定用户");
userList.forEach(user -> { userList.forEach(user -> {
// 创建了一些空白任务 // 创建了一些空白任务
......
...@@ -36,7 +36,19 @@ public class UserController { ...@@ -36,7 +36,19 @@ public class UserController {
@ApiOperation(value = "获取补录人员列表") @ApiOperation(value = "获取补录人员列表")
@PostMapping(value = "/user/list") @PostMapping(value = "/user/list")
public ApiResponse getUserList() { public ApiResponse getUserList() {
List<User> userList = userService.findAll(); List<Map> userList = new ArrayList<>();
List<RecordScope> recordScopeList = recordScopeService.findAll();
recordScopeList.forEach(recordScope -> {
Map map = new HashMap();
map.put("id", recordScope.getId());
map.put("desc", recordScope.getDesc());
map.put("groupId", recordScope.getGroup().getId());
map.put("groupName", recordScope.getGroup().getId());
List<User> users = userService.findAllByGroupId(recordScope.getGroup().getId());
map.put("userList", users);
userList.add(map);
});
// List<User> userList = userService.findAll();
return ApiResponse.ok(userList); return ApiResponse.ok(userList);
} }
...@@ -44,7 +56,22 @@ public class UserController { ...@@ -44,7 +56,22 @@ public class UserController {
@PostMapping(value = "/scope/list") @PostMapping(value = "/scope/list")
public ApiResponse getScopeList() { public ApiResponse getScopeList() {
List<RecordScope> recordScopeList = recordScopeService.findAll(); List<RecordScope> recordScopeList = recordScopeService.findAll();
return ApiResponse.ok(recordScopeList); List<Map> result = new ArrayList<>();
recordScopeList.forEach(recordScope -> {
Map map = new HashMap();
map.put("id", recordScope.getId());
map.put("desc", recordScope.getDesc());
map.put("groupId", recordScope.getGroup().getId());
map.put("groupName", recordScope.getGroup().getId());
List<User> users = recordScope.getUserList();
User user = null;
if (users.size() >= 1) {
user = users.get(0);
}
map.put("user", user);
result.add(map);
});
return ApiResponse.ok(result);
} }
@ApiOperation(value = "补录范围绑定人员") @ApiOperation(value = "补录范围绑定人员")
...@@ -59,10 +86,10 @@ public class UserController { ...@@ -59,10 +86,10 @@ public class UserController {
User user = userService.findById(userId); User user = userService.findById(userId);
TwinkleValidator.notNull(user, "所选用户不存在"); TwinkleValidator.notNull(user, "所选用户不存在");
TwinkleValidator.isTrue(scope.getGroup().getId() == user.getGroup().getId(), "所选用户与所选范围不属于同一机构"); TwinkleValidator.isTrue(scope.getGroup().getId() == user.getGroup().getId(), "所选用户与所选范围不属于同一机构");
List<User> userList = scope.getUserList(); List<User> userList = new ArrayList<>();
userList.add(user); userList.add(user);
scope.setUserList(userList); scope.setUserList(userList);
recordScopeService.update(scope); recordScopeService.save(scope);
return ApiResponse.ok(); return ApiResponse.ok();
} }
......
...@@ -3,6 +3,11 @@ package com.keymobile.rest.dao; ...@@ -3,6 +3,11 @@ package com.keymobile.rest.dao;
import com.keymobile.rest.model.Process; import com.keymobile.rest.model.Process;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProcessDao extends JpaRepository<Process, Long> { public interface ProcessDao extends JpaRepository<Process, Long> {
List<Process> findAllByProcessId(String processId);
Process findByProcessIdAndStatus(String processId, int status);
} }
...@@ -3,7 +3,6 @@ package com.keymobile.rest.model; ...@@ -3,7 +3,6 @@ package com.keymobile.rest.model;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonSetter;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -25,10 +24,16 @@ public class RecordScope implements Serializable { ...@@ -25,10 +24,16 @@ public class RecordScope implements Serializable {
public static int ROLE_RECORD = 1; public static int ROLE_RECORD = 1;
public static int ROLE_AUDIT = 2; public static int ROLE_AUDIT = 2;
public static String ROLE_RECORD_DESC = "补录人员";
public static String ROLE_AUDIT_DESC = "审核人员";
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private long id; private long id;
@Column(name = "`desc`", nullable = false, columnDefinition = ("varchar(100) comment '补录角色描述'"))
private String desc;
@Column(nullable = false, columnDefinition = ("integer(2) comment '补录角色'")) @Column(nullable = false, columnDefinition = ("integer(2) comment '补录角色'"))
private int role; private int role;
...@@ -37,11 +42,12 @@ public class RecordScope implements Serializable { ...@@ -37,11 +42,12 @@ public class RecordScope implements Serializable {
private Group group; private Group group;
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JsonIgnore
@JoinTable(name = "t_user_record_scope", // 用来指定中间表的名称 @JoinTable(name = "t_user_record_scope", // 用来指定中间表的名称
//用于指定本表在中间表的字段名称,以及中间表依赖的是本表的哪个字段 //用于指定本表在中间表的字段名称,以及中间表依赖的是本表的哪个字段
joinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id")}, joinColumns = {@JoinColumn(name = "record_scope_id", referencedColumnName = "id")},
//用于指定对方表在中间表的字段名称,以及中间表依赖的是它的哪个字段 //用于指定对方表在中间表的字段名称,以及中间表依赖的是它的哪个字段
inverseJoinColumns = {@JoinColumn(name = "record_scope", referencedColumnName = "id")} inverseJoinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id")}
) )
private List<User> userList; private List<User> userList;
} }
...@@ -32,7 +32,7 @@ public class Template implements Serializable { ...@@ -32,7 +32,7 @@ public class Template implements Serializable {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private long id; private Long id;
@Column(nullable = false, columnDefinition = ("varchar(20) comment '模板名称'")) @Column(nullable = false, columnDefinition = ("varchar(20) comment '模板名称'"))
private String name; private String name;
...@@ -41,16 +41,16 @@ public class Template implements Serializable { ...@@ -41,16 +41,16 @@ public class Template implements Serializable {
private String config; private String config;
@Column(name = "data_at", columnDefinition = ("integer(20) default 1 comment '数据开始行数'")) @Column(name = "data_at", columnDefinition = ("integer(20) default 1 comment '数据开始行数'"))
private int dataAt; private Integer dataAt;
@Column(name = "need_audit", columnDefinition = ("integer(2) default 0 comment '需要审核'")) @Column(name = "need_audit", columnDefinition = ("integer(2) default 0 comment '需要审核'"))
private int needAudit; private Integer needAudit;
@Column(name = "need_confirm", columnDefinition = ("integer(2) default 0 comment '需要负责人确认'")) @Column(name = "need_confirm", columnDefinition = ("integer(2) default 0 comment '需要负责人确认'"))
private int needConfirm; private Integer needConfirm;
@Column(name = "need_merge", columnDefinition = ("integer(2) default 0 comment '需要数据合并'")) @Column(name = "need_merge", columnDefinition = ("integer(2) default 0 comment '需要数据合并'"))
private int needMerge; private Integer needMerge;
@Column(name = "up_stream_addr", columnDefinition = ("varchar(100) comment '上游地址'")) @Column(name = "up_stream_addr", columnDefinition = ("varchar(100) comment '上游地址'"))
private String upStreamAddr; private String upStreamAddr;
......
...@@ -7,7 +7,6 @@ import lombok.NoArgsConstructor; ...@@ -7,7 +7,6 @@ import lombok.NoArgsConstructor;
import javax.persistence.*; import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"}) @JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"})
@NoArgsConstructor @NoArgsConstructor
...@@ -30,5 +29,6 @@ public class User implements Serializable { ...@@ -30,5 +29,6 @@ public class User implements Serializable {
* 所属结构id * 所属结构id
*/ */
@ManyToOne(fetch = FetchType.EAGER) @ManyToOne(fetch = FetchType.EAGER)
@JsonIgnore
private Group group; private Group group;
} }
...@@ -31,10 +31,6 @@ public class ActivityService { ...@@ -31,10 +31,6 @@ public class ActivityService {
return activityDao.save(activity); return activityDao.save(activity);
} }
public Activity findByProcessId(String pid) {
return null;
}
public Page<Activity> findAll(int pageNo, int pageSize) { public Page<Activity> findAll(int pageNo, int pageSize) {
Pageable pageable = convert(pageNo, pageSize); Pageable pageable = convert(pageNo, pageSize);
return activityDao.findAll(pageable); return activityDao.findAll(pageable);
......
...@@ -5,6 +5,8 @@ import com.keymobile.rest.model.Process; ...@@ -5,6 +5,8 @@ import com.keymobile.rest.model.Process;
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;
@Service @Service
public class ProcessService { public class ProcessService {
...@@ -16,4 +18,14 @@ public class ProcessService { ...@@ -16,4 +18,14 @@ public class ProcessService {
processDao.save(process); processDao.save(process);
return process; return process;
} }
public List<Process> findAllByProcessId(String processId) {
return processDao.findAllByProcessId(processId);
}
public Process findByProcessIdAndStatus(String processId, int status) {
return processDao.findByProcessIdAndStatus(processId, status);
}
} }
...@@ -29,10 +29,12 @@ public class RecordScopeService { ...@@ -29,10 +29,12 @@ public class RecordScopeService {
RecordScope scope = new RecordScope(); RecordScope scope = new RecordScope();
scope.setGroup(group); scope.setGroup(group);
scope.setRole(RecordScope.ROLE_RECORD); scope.setRole(RecordScope.ROLE_RECORD);
scope.setDesc(group.getName() + RecordScope.ROLE_RECORD_DESC);
recordScopeDao.save(scope); recordScopeDao.save(scope);
scope = new RecordScope(); scope = new RecordScope();
scope.setGroup(group); scope.setGroup(group);
scope.setRole(RecordScope.ROLE_AUDIT); scope.setRole(RecordScope.ROLE_AUDIT);
scope.setDesc(group.getName() + RecordScope.ROLE_AUDIT_DESC);
recordScopeDao.save(scope); recordScopeDao.save(scope);
} }
}); });
...@@ -46,7 +48,7 @@ public class RecordScopeService { ...@@ -46,7 +48,7 @@ public class RecordScopeService {
return recordScopeDao.findAll(); return recordScopeDao.findAll();
} }
public void update(RecordScope recordScope) { public void save(RecordScope recordScope) {
recordScopeDao.save(recordScope); recordScopeDao.save(recordScope);
} }
} }
...@@ -30,8 +30,8 @@ spring: ...@@ -30,8 +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 host: 127.0.0.1
port: 6379 port: 6379
session: session:
store-type: redis store-type: redis
...@@ -46,8 +46,8 @@ app: ...@@ -46,8 +46,8 @@ app:
active-process: MoreSubProcessTest.bpmn active-process: MoreSubProcessTest.bpmn
swagger2: swagger2:
host: localhost:8110 # host: localhost:8110
# host: 47.105.236.43/activiti host: 47.105.236.43/activiti
security: security:
permit: true permit: true
\ No newline at end of file
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