Commit 6917afe4 by chenweisong

更新

parent d7b1a8af
......@@ -58,7 +58,7 @@ public class ExcelController {
@ApiOperation(value = "传excelId过来,获取用户填写的数据")
@PostMapping(value = "/excel/getData")
public ApiResponse getRecordData(@RequestParam long excelId) {
User curUser = userService.getNormalUser();
// User curUser = userService.getNormalUser();
// ProcessInfo processInfo = processInfoService.findByExcelIdAndUserId(excelId, curUser.getId());
//
// List<DataInfo> dataInfoList = processInfo.getDataInfoList();
......
......@@ -5,7 +5,7 @@ import com.keymobile.rest.common.bean.ApiResponse;
import com.keymobile.rest.common.validator.TwinkleValidator;
import com.keymobile.rest.model.Activity;
import com.keymobile.rest.model.Template;
import com.keymobile.rest.model.ProcessInfo;
import com.keymobile.rest.model.Mission;
import com.keymobile.rest.model.User;
import com.keymobile.rest.service.TemplateService;
import com.keymobile.rest.service.ProcessInfoService;
......@@ -82,28 +82,28 @@ public class TaskController {
@ApiOperation(value = "补录任务列表及审核任务列表")
@PostMapping(value = "/getMyTasks")
public ApiResponse getMyTasks() {
User user = userService.getNormalUser();
User audit = userService.getAudit();
// User user = userService.getNormalUser();
// User audit = userService.getAudit();
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);
// 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")) {
// if (task.getTaskDefinitionKey().equals("addData")) {
// assignment.setKind(Assignment.KIND_RECORD);
} else {
// } else {
// assignment.setKind(Assignment.KIND_AUDIT);
}
activityList.add(activity);
// }
// activityList.add(activity);
// }
}
// }
return ApiResponse.ok();
}
......@@ -115,8 +115,8 @@ public class TaskController {
TwinkleValidator.notNull(form.getType(), "类型不能为空");
TwinkleValidator.isFalse((form.getExcels() == null || form.getExcels().size() == 0), "补录模板不能为空");
// 创建人
User manager = userService.getManager();
form.setUser(manager);
// User manager = userService.getManager();
// form.setUser(manager);
Activity activity = assignmentService.save(form);
// 新建excel实例
List<ExcelForm> excelFormList = form.getExcels();
......@@ -196,9 +196,9 @@ public class TaskController {
TwinkleValidator.notLessThan(templateList.size(), 1, "补录模板不存在");
Template template = templateList.get(0);
List<ProcessInfo> processInfoList = processInfoService.findAllByTemplateId(template.getId());
TwinkleValidator.notLessThan(processInfoList.size(), 1, "补录人员不存在");
taskService.complete(resultTask.getId(), ImmutableMap.of("userId", processInfoList.get(0).getUser().getUsername()));
List<Mission> missionList = processInfoService.findAllByTemplateId(template.getId());
TwinkleValidator.notLessThan(missionList.size(), 1, "补录人员不存在");
taskService.complete(resultTask.getId(), ImmutableMap.of("userId", missionList.get(0).getUser().getUsername()));
return ApiResponse.ok();
}
......@@ -208,7 +208,7 @@ public class TaskController {
public ApiResponse passTask(@RequestParam Long taskId) {
Activity activity = assignmentService.get(taskId);
// 完结活动, 流程跑完
User judge = userService.getAudit();
// User judge = userService.getAudit();
// List<Task> taskList = taskService.createTaskQuery().processInstanceId(assignment.getProcessId())
// .taskAssignee(judge.getUsername()).list();
// TwinkleValidator.notLessThan(taskList.size(), 1, "启动失败");
......@@ -225,7 +225,7 @@ public class TaskController {
public ApiResponse rejectTask(@RequestParam Long taskId) {
Activity activity = assignmentService.get(taskId);
// 完结活动, 流程跑完
User judge = userService.getAudit();
// User judge = userService.getAudit();
// List<Task> taskList = taskService.createTaskQuery().processInstanceId(assignment.getProcessId())
// .taskAssignee(judge.getUsername()).list();
// TwinkleValidator.notLessThan(taskList.size(), 1, "启动失败");
......
......@@ -16,9 +16,18 @@ import java.util.*;
public class UserController {
@Autowired
private UserService userService;
@Autowired
private GroupService groupService;
private Group root = new Group();
@ApiOperation(value = "获取补录人员列表")
{
root.setId(0L);
root.setName("招商银行");
}
@ApiOperation(value = "获取补录范围列表")
@PostMapping(value = "/user/list")
public ApiResponse getUserList() {
// List<User> userList = userService.findAllByRole(UserConstant.ROLE_NORMAL);
......@@ -26,4 +35,17 @@ public class UserController {
}
@ApiOperation(value = "获取机构数据")
@PostMapping(value = "/group/list")
public ApiResponse getGroupList() {
return ApiResponse.ok(getGroupTree());
}
public Group getGroupTree() {
List<Group> children = groupService.findAllByParentId(root.getId());
root.setChildren(children);
return root;
}
}
package com.keymobile.rest.dao;
import com.keymobile.rest.model.Group;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface GroupDao extends JpaRepository<Group, Long> {
List<Group> findAllByParentId(long parentId);
}
package com.keymobile.rest.dao;
import com.keymobile.rest.model.ProcessInfo;
import com.keymobile.rest.model.Mission;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProcessInfoDao extends JpaRepository<ProcessInfo, Long> {
public interface ProcessInfoDao extends JpaRepository<Mission, Long> {
List<ProcessInfo> findAllByTemplateId(long eid);
List<Mission> findAllByTemplateId(long eid);
List<ProcessInfo> findAllByUserId(long uid);
List<Mission> findAllByUserId(long uid);
void deleteAllByTemplateId(long eid);
ProcessInfo findByTemplateIdAndUserId(long eid, long uid);
Mission findByTemplateIdAndUserId(long eid, long uid);
}
......@@ -7,8 +7,6 @@ import java.util.List;
public interface UserDao extends JpaRepository<User, Long> {
List<User> findAllByRole(int role);
List<User> findAllByIdIn(List<Long> ids);
}
package com.keymobile.rest.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -19,40 +20,32 @@ import java.util.List;
@NoArgsConstructor
@Data
@Entity
@Table(name = "t_activity")
public class Activity implements Serializable {
public static int TYPE_AUTO = 2;
public static int TYPE_MANUAL = 1;
public static int NEED_AUDIT = 1;
public static int NO_NEED_AUDIT = 2;
public static int TYPE_AUTO = 2;
public static int TYPE_MANUAL = 1;
// 报送频度 按年 按年 按周 按月 按日 自动推送
public static int FREQ_YEAR = 1;
public static int FREQ_WEEK = 2;
public static int FREQ_MONTH = 3;
public static int FREQ_DAY = 4;
public static int FREQ_YEAR = 1;
public static int FREQ_WEEK = 2;
public static int FREQ_MONTH = 3;
public static int FREQ_DAY = 4;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(nullable = false)
@Column(nullable = false, columnDefinition = ("varchar(100) comment '活动名'"))
private String name;
@Column(nullable = false)
@Column(nullable = false, columnDefinition = ("integer(2) default 1 comment '下发方式'"))
private int type;
@Column(nullable = false)
private int needAudit;
@Column
@Column(columnDefinition = ("varchar(200) comment '备注'"))
private String remark;
/*
频度
*/
@Column
@Column(columnDefinition = ("integer(2) comment '频度'"))
private int freq;
@Column(nullable = false, name = "create_at")
......@@ -67,4 +60,12 @@ public class Activity implements Serializable {
*/
@ManyToOne
private User user;
/*
* 该活动跑过得所有流程
*/
@OneToMany(fetch = FetchType.LAZY, mappedBy = "activity")
@JsonIgnore
private List<Process> processList;
}
......@@ -17,20 +17,21 @@ import java.sql.Timestamp;
@NoArgsConstructor
@Data
@Entity
@Table(name = "t_data_info")
public class DataInfo implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(nullable = false)
private String datas;
@Column(nullable = false, columnDefinition = ("varchar(3000) comment '填写的数据'"))
private String data;
@Column(name = "create_at", nullable = false)
@Column(nullable = false, name = "create_at")
@CreationTimestamp
private Timestamp createAt;
@ManyToOne(fetch = FetchType.LAZY)
@OneToOne(fetch = FetchType.LAZY)
@JsonIgnore
private ProcessInfo processInfo;
private Mission mission;
}
......@@ -6,26 +6,32 @@ import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
/**
* @name 机构
* @desc 包含一些活动的定义以及绑定一些spreadJs生成的excel模板
* @desc
*/
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"})
@NoArgsConstructor
@Data
@Entity
@Table(name = "t_group")
public class Group implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column
@Column(nullable = false, columnDefinition = ("varchar(20) comment '机构名称'"))
private String name;
@Column(nullable = false, columnDefinition = ("integer(2) default 0 comment '机构层级'"))
private int level;
@Column(name = "parent_id", columnDefinition = ("bigint(22) default 0 comment '父机构id'"))
private long parentId;
@Column
private long pid;
@Transient
private List<Group> children;
}
package com.keymobile.rest.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -17,16 +18,31 @@ import java.util.List;
@NoArgsConstructor
@Data
@Entity
public class ProcessInfo implements Serializable {
@Table(name = "t_mission")
public class Mission implements Serializable {
public static int TYPE_RECORD = 1;
public static int TYPE_AUDIT = 2;
public static int STATUS_BEGIN = 1;
public static int STATUS_COMPLETED = 2;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(name = "create_at", nullable = false, columnDefinition = "DATETIME COMMENT '创建时间'")
@Column(name = "create_at", nullable = false, columnDefinition = ("DATETIME COMMENT '创建时间'"))
@CreationTimestamp
private Timestamp createAt;
@Column(nullable = false, columnDefinition = ("integer(2) default 1 COMMENT '类型'"))
private int type;
@Column(nullable = false, columnDefinition = ("integer(2) default 1 COMMENT '状态'"))
private int status;
/*
补录模板
*/
......@@ -34,7 +50,7 @@ public class ProcessInfo implements Serializable {
private Template template;
/*
补录人员
操作人员
*/
@OneToOne
private User user;
......@@ -42,7 +58,13 @@ public class ProcessInfo implements Serializable {
/*
补录数据
*/
@OneToMany(mappedBy = "processInfo", fetch = FetchType.EAGER)
List<DataInfo> dataInfoList;
@OneToOne(fetch = FetchType.EAGER)
private DataInfo dataInfo;
/*
补录数据
*/
@ManyToOne(fetch = FetchType.LAZY)
@JsonIgnore
private Process process;
}
......@@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
/**
* @name 进程
......@@ -17,18 +18,34 @@ import java.io.Serializable;
@NoArgsConstructor
@Data
@Entity
@Table(name = "t_process")
public class Process implements Serializable {
public static int STATUS_BEGIN = 0;
public static int STATUS_RECORDING = 1;
public static int STATUS_AUDIT = 2;
public static int STATUS_COMPLETED = 3;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
/*
activiti运行中的流程实例id
*/
@Column(name = "process_id")
*/
@Column(name = "process_id", columnDefinition = ("varchar(100) comment '当前活动在跑进程 id'"))
private String processId;
@Column(nullable = false, columnDefinition = ("integer(2) default 0 comment '进程状态'"))
private int status;
/*
* 该进程启动得所有子任务
*/
@OneToMany(fetch = FetchType.LAZY, mappedBy = "process")
@JsonIgnore
private List<Mission> missionList;
@ManyToOne(fetch = FetchType.LAZY)
@JsonIgnore
private Activity activity;
......
......@@ -17,22 +17,48 @@ import java.sql.Timestamp;
@NoArgsConstructor
@Data
@Entity
@Table(name = "t_template")
public class Template implements Serializable {
public static int NEED_AUDIT = 1;
public static int NO_NEED_AUDIT = 2;
public static int NEED_CONFIRM = 1;
public static int NO_NEED_CONFIRM = 2;
public static int NEED_MERGE = 1;
public static int NO_NEED_MERGE = 2;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(nullable = false)
@Column(nullable = false, columnDefinition = ("varchar(20) comment '模板名称'"))
private String name;
@Column(nullable = false)
@Column(nullable = false, columnDefinition = ("varchar(2000) comment '模板配置'"))
private String config;
@Column(nullable = false, name = "data_at")
private Integer dataAt;
@Column(name = "data_at", columnDefinition = ("integer(20) default 1 comment '数据开始行数'"))
private int dataAt;
@Column(name = "need_audit", columnDefinition = ("integer(2) default 0 comment '需要审核'"))
private int needAudit;
@Column(name = "need_confirm", columnDefinition = ("integer(2) default 0 comment '需要负责人确认'"))
private int needConfirm;
@Column(name = "need_merge", columnDefinition = ("integer(2) default 0 comment '需要数据合并'"))
private int needMerge;
@Column(name = "up_stream_addr", columnDefinition = ("varchar(100) comment '上游地址'"))
private int upStreamAddr;
@Column(name = "back_stream_addr", columnDefinition = ("varchar(100) comment '回流地址'"))
private int backStreamAddr;
@Column
@Column(columnDefinition = ("varchar(200) comment '备注'"))
private String remark;
@Column(nullable = false, name = "create_at")
......
......@@ -11,25 +11,22 @@ import java.io.Serializable;
@NoArgsConstructor
@Data
@Entity
@Table(name = "t_user")
public class User implements Serializable {
public static int ROLE_NORMAL = 1;
public static int ROLE_AUDIT = 2;
public static int ROLE_MANAGER = 3;
public static int ROLE_NORMAL = 1;
public static int ROLE_AUDIT = 2;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(nullable = false)
@Column(nullable = false, columnDefinition = ("varchar(100) comment '用户名'"))
private String username;
/**
* 1 补录人员 2 审核人员 3 发起人
* 所属结构id
*/
@Column
private int role;
@ManyToOne(fetch = FetchType.EAGER)
private Group group;
}
......@@ -35,7 +35,6 @@ public class AssignmentService {
Activity activity = new Activity();
Timestamp now = Timestamp.valueOf(DateUtil.getDateTime());
activity.setCreateAt(now);
activity.setNeedAudit(Activity.NEED_AUDIT);
activity.setName(form.getName());
activity.setType(form.getType());
if (form.getType() == Activity.TYPE_AUTO) {
......
......@@ -21,8 +21,7 @@ public class DataInfoService {
public DataInfo save(RecordDataForm form) {
DataInfo data = new DataInfo();
data.setDatas(form.getDataStr());
data.setProcessInfo(form.getProcessInfo());
data.setMission(form.getMission());
Timestamp now = Timestamp.valueOf(DateUtil.getDateTime());
data.setCreateAt(now);
data = dataInfoDao.save(data);
......
package com.keymobile.rest.service;
import com.keymobile.rest.dao.GroupDao;
import com.keymobile.rest.model.Group;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class GroupService {
@Autowired
private GroupDao groupDao;
public List<Group> findAllByParentId(long parentId) {
return groupDao.findAllByParentId(parentId);
}
}
......@@ -3,7 +3,7 @@ package com.keymobile.rest.service;
import com.keymobile.rest.common.utils.DateUtil;
import com.keymobile.rest.dao.*;
import com.keymobile.rest.model.Template;
import com.keymobile.rest.model.ProcessInfo;
import com.keymobile.rest.model.Mission;
import com.keymobile.rest.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -17,8 +17,8 @@ public class ProcessInfoService {
@Autowired
private ProcessInfoDao processInfoDao;
public ProcessInfo save(User user, Template template) {
ProcessInfo info = new ProcessInfo();
public Mission save(User user, Template template) {
Mission info = new Mission();
info.setTemplate(template);
info.setUser(user);
Timestamp now = Timestamp.valueOf(DateUtil.getDateTime());
......@@ -27,15 +27,15 @@ public class ProcessInfoService {
return info;
}
public List<ProcessInfo> findAllByTemplateId(long eid) {
public List<Mission> findAllByTemplateId(long eid) {
return processInfoDao.findAllByTemplateId(eid);
}
public ProcessInfo findByTemplateIdAndUserId(long eid, long uid) {
public Mission findByTemplateIdAndUserId(long eid, long uid) {
return processInfoDao.findByTemplateIdAndUserId(eid, uid);
}
public List<ProcessInfo> findByUserId(long uid) {
public List<Mission> findByUserId(long uid) {
return processInfoDao.findAllByUserId(uid);
}
......
......@@ -17,27 +17,4 @@ public class UserService {
return userDao.findAllByIdIn(ids);
}
public List<User> findAllByRole(int role) {
return userDao.findAllByRole(role);
}
public User getAudit() {
List<User> userList = userDao.findAllByRole(User.ROLE_AUDIT);
User user = userList.get(0);
return user;
}
public User getNormalUser() {
List<User> userList = userDao.findAllByRole(User.ROLE_NORMAL);
User user = userList.get(0);
return user;
}
public User getManager() {
List<User> userList = userDao.findAllByRole(User.ROLE_MANAGER);
User user = userList.get(0);
return user;
}
}
package com.keymobile.rest.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.keymobile.rest.model.ProcessInfo;
import com.keymobile.rest.model.Mission;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -27,7 +27,7 @@ public class RecordDataForm {
private List<Object> dataList;
@JsonIgnore
private ProcessInfo processInfo;
private Mission mission;
}
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