Commit 367302b4 by chenweisong

更新

parent d28f3f12
...@@ -15,7 +15,6 @@ import org.activiti.engine.repository.Deployment; ...@@ -15,7 +15,6 @@ import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition; import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task; import org.activiti.engine.task.Task;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
...@@ -102,6 +101,7 @@ public class IndexCtrl { ...@@ -102,6 +101,7 @@ public class IndexCtrl {
TwinkleValidator.notEmpty(form.getName(), "名称不能为空"); TwinkleValidator.notEmpty(form.getName(), "名称不能为空");
TwinkleValidator.notNull(form.getType(), "类型不能为空"); TwinkleValidator.notNull(form.getType(), "类型不能为空");
TwinkleValidator.notLessThan(form.getExcels().size(), 1, "补录模板不能为空"); TwinkleValidator.notLessThan(form.getExcels().size(), 1, "补录模板不能为空");
TwinkleValidator.notEmpty(form.getUserIds(), "补录人不能为空");
// 创建人 // 创建人
User manager = userService.getManager(); User manager = userService.getManager();
form.setUser(manager); form.setUser(manager);
...@@ -112,14 +112,40 @@ public class IndexCtrl { ...@@ -112,14 +112,40 @@ public class IndexCtrl {
excelForm.setJob(job); excelForm.setJob(job);
Excel excel = excelService.save(excelForm); Excel excel = excelService.save(excelForm);
// 新建补录人员任务关联 // 新建补录人员任务关联
if (StringUtils.isNotEmpty(form.getUserIds())) {
String[] userIds = form.getUserIds().split(","); String[] userIds = form.getUserIds().split(",");
List<Long> userIdList = Arrays.asList(userIds).stream().map(Long::parseLong).collect(Collectors.toList()); List<Long> userIdList = Arrays.asList(userIds).stream().map(Long::parseLong).collect(Collectors.toList());
List<User> userList = userService.findAllByIdIn(userIdList); List<User> userList = userService.findAllByIdIn(userIdList);
TwinkleValidator.notLessThan(userList.size(), 1, "补录人员不存在");
userList.forEach(user -> { userList.forEach(user -> {
recordInfoService.save(user, excel); recordInfoService.save(user, excel);
}); });
});
return ApiResponse.ok(job.getId());
} }
@ApiOperation(value = "修改收数")
@PostMapping(value = "/task/update")
public ApiResponse updateTask(@RequestBody JobForm form) {
TwinkleValidator.notEmpty(form.getName(), "名称不能为空");
TwinkleValidator.notNull(form.getType(), "类型不能为空");
TwinkleValidator.notLessThan(form.getExcels().size(), 1, "补录模板不能为空");
TwinkleValidator.notNull(form.getId(), "收数id不能为空");
Job job = jobService.get(form.getId());
TwinkleValidator.notNull(job, "收数不存在");
job.setType(form.getType());
job.setRemark(form.getRemark());
job.setName(form.getName());
jobService.update(job);
// 新建excel实例
List<ExcelForm> excelFormList = form.getExcels();
excelFormList.forEach(excelForm -> {
Excel excel = excelService.get(excelForm.getId());
TwinkleValidator.notNull(excel, "模板不存在");
excel.setName(excelForm.getName());
excel.setConfig(excelForm.getConfig());
excel.setRemark(excelForm.getRemark());
excel.setDataAt(excelForm.getDataAt());
recordInfoService.deleteAllByExcelId(excel.getId());
}); });
return ApiResponse.ok(job.getId()); return ApiResponse.ok(job.getId());
} }
......
...@@ -10,4 +10,7 @@ public interface RecordInfoDao extends JpaRepository<RecordInfo, Long> { ...@@ -10,4 +10,7 @@ public interface RecordInfoDao extends JpaRepository<RecordInfo, Long> {
List<RecordInfo> findAllByExcelId(long eid); List<RecordInfo> findAllByExcelId(long eid);
List<RecordInfo> findAllByUserId(long uid); List<RecordInfo> findAllByUserId(long uid);
void deleteAllByExcelId(long eid);
} }
...@@ -27,8 +27,14 @@ public class Excel implements Serializable { ...@@ -27,8 +27,14 @@ public class Excel implements Serializable {
private long id; private long id;
@Column(nullable = false) @Column(nullable = false)
private String name;
@Column(nullable = false)
private String config; private String config;
@Column(nullable = false, name = "data_at")
private Integer dataAt;
@Column @Column
private String remark; private String remark;
......
...@@ -50,9 +50,14 @@ public class Job implements Serializable { ...@@ -50,9 +50,14 @@ public class Job implements Serializable {
@Column @Column
private int judge = 2; private int judge = 2;
@Column
private String remark;
@Column(name = "process_id") @Column(name = "process_id")
private String processId; private String processId;
// 报送频度 按年 按年 按周 按月 按日 自动推送
@Column(name = "start_at") @Column(name = "start_at")
private Timestamp startAt; private Timestamp startAt;
...@@ -60,7 +65,8 @@ public class Job implements Serializable { ...@@ -60,7 +65,8 @@ public class Job implements Serializable {
@CreationTimestamp @CreationTimestamp
private Timestamp createAt; private Timestamp createAt;
@OneToMany @OneToMany(fetch = FetchType.EAGER)
@JoinTable(name = "excel", joinColumns = {@JoinColumn(name = "job_id")}, inverseJoinColumns = {@JoinColumn(name = "id")})
private List<Excel> excelList; private List<Excel> excelList;
@ManyToOne @ManyToOne
......
...@@ -28,8 +28,6 @@ public class RecordData implements Serializable { ...@@ -28,8 +28,6 @@ public class RecordData implements Serializable {
@CreationTimestamp @CreationTimestamp
private Timestamp createAt; private Timestamp createAt;
@ManyToOne @ManyToOne
private RecordInfo recordInfo; private RecordInfo recordInfo;
......
...@@ -32,5 +32,4 @@ public class User implements Serializable { ...@@ -32,5 +32,4 @@ public class User implements Serializable {
@Column @Column
private int role; private int role;
} }
...@@ -18,6 +18,8 @@ public class ExcelService { ...@@ -18,6 +18,8 @@ public class ExcelService {
public Excel save(ExcelForm form) { public Excel save(ExcelForm form) {
Excel excel = new Excel(); Excel excel = new Excel();
excel.setName(form.getName());
excel.setDataAt(form.getDataAt());
excel.setConfig(form.getConfig()); excel.setConfig(form.getConfig());
excel.setRemark(form.getRemark()); excel.setRemark(form.getRemark());
excel.setJob(form.getJob()); excel.setJob(form.getJob());
......
...@@ -34,4 +34,8 @@ public class RecordInfoService { ...@@ -34,4 +34,8 @@ public class RecordInfoService {
public List<RecordInfo> findByUserId(long uid) { public List<RecordInfo> findByUserId(long uid) {
return recordInfoDao.findAllByUserId(uid); return recordInfoDao.findAllByUserId(uid);
} }
public void deleteAllByExcelId(long eid) {
recordInfoDao.deleteAllByExcelId(eid);
}
} }
...@@ -16,12 +16,21 @@ import java.sql.Timestamp; ...@@ -16,12 +16,21 @@ import java.sql.Timestamp;
@ApiModel @ApiModel
public class ExcelForm { public class ExcelForm {
@ApiModelProperty(name = "id", value = "表格id,修改的时候需要用到")
private Long id;
@ApiModelProperty(name = "remark", value = "表格名称", required = true)
private String name;
@ApiModelProperty(name = "config", value = "表格配置", required = true) @ApiModelProperty(name = "config", value = "表格配置", required = true)
private String config; private String config;
@ApiModelProperty(name = "remark", value = "表格描述") @ApiModelProperty(name = "remark", value = "表格描述")
private String remark; private String remark;
@ApiModelProperty(name = "dataAt", value = "数据开始", required = true)
private Integer dataAt;
@JsonIgnore @JsonIgnore
private Job job; private Job job;
} }
...@@ -12,19 +12,27 @@ import java.util.List; ...@@ -12,19 +12,27 @@ import java.util.List;
@ApiModel @ApiModel
public class JobForm { public class JobForm {
@ApiModelProperty(name = "id", value = "收数id,修改的时候需要用到")
private Long id;
@ApiModelProperty(required = true, name = "name", value = "收数名称") @ApiModelProperty(required = true, name = "name", value = "收数名称")
private String name; private String name;
@ApiModelProperty(name = "remark", value = "收数描述")
private String remark;
@ApiModelProperty(required = true, name = "type", value = "收数类型 1手动 2自动") @ApiModelProperty(required = true, name = "type", value = "收数类型 1手动 2自动")
private int type = 1; private int type = 1;
@ApiModelProperty(name = "startAt", value = "自动发起需要提写的时间") // @ApiModelProperty(name = "startAt", value = "自动发起需要提写的时间")
@JsonIgnore
private String startAt; private String startAt;
@ApiModelProperty(name = "excels", value = "新建的模板配置数组") @ApiModelProperty(required = true, name = "excels", value = "新建的模板配置数组")
private List<ExcelForm> excels; private List<ExcelForm> excels;
@ApiModelProperty(name = "userIds", value = "补录人员ids, 用逗号隔开") @ApiModelProperty(required = true, name = "userIds", value = "补录人员ids, 用逗号隔开")
private String userIds; private String userIds;
@JsonIgnore @JsonIgnore
......
...@@ -11,8 +11,8 @@ spring: ...@@ -11,8 +11,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/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8 url: jdbc:mysql://47.105.193.165:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
username: root username: root
...@@ -52,7 +52,7 @@ app: ...@@ -52,7 +52,7 @@ app:
active-process: RecordStandardProcess.bpmn active-process: RecordStandardProcess.bpmn
swagger2: swagger2:
# host: localhost:8110 host: localhost:8110
host: 47.105.236.43/activiti host: 47.105.236.43/activiti
......
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