Commit 170adf25 by chenweisong

更新

parent 9e2b5d10
...@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; ...@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
* @author :ws6049 * @author :ws6049
* @date :2019/1/13 0:26 * @date :2019/1/13 0:26
*/ */
@RestControllerAdvice //@RestControllerAdvice
public class ExceptionHandlerConfig { public class ExceptionHandlerConfig {
private static final Logger logger = LoggerFactory.getLogger(ExceptionHandlerConfig.class); private static final Logger logger = LoggerFactory.getLogger(ExceptionHandlerConfig.class);
......
package com.keymobile.rest.common.exception;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.springframework.http.HttpStatus;
@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME, property = "error", visible = true)
class ApiError {
private HttpStatus status;
private Long timestamp;
private String message;
private String cnMessage = "网络异常";
private ApiError() {
timestamp = System.currentTimeMillis();
}
ApiError(HttpStatus status) {
this();
this.status = status;
}
ApiError(HttpStatus status, Throwable ex) {
this();
this.status = status;
}
ApiError(HttpStatus status, String message, Throwable ex) {
this();
this.status = status;
this.message = message;
}
ApiError(HttpStatus status, String message, String cnMessage, Throwable ex) {
this();
this.status = status;
this.message = message;
this.cnMessage = cnMessage;
}
public HttpStatus getStatus() {
return status;
}
public Long getTimestamp() {
return timestamp;
}
public String getMessage() {
return message;
}
public String getCnMessage() {
return cnMessage;
}
}
\ No newline at end of file
package com.keymobile.rest.common.exception;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
@Order(Ordered.HIGHEST_PRECEDENCE)
@ControllerAdvice
public class RestExceptionHandler extends ResponseEntityExceptionHandler {
@ExceptionHandler(Exception.class)
protected ResponseEntity<Object> handlException(Exception ex, WebRequest request) {
ApiError apiError;
if (ex instanceof DataIntegrityViolationException) {
apiError = new ApiError(INTERNAL_SERVER_ERROR, ex.getMessage(), "重复值", ex);
} else {
apiError = new ApiError(INTERNAL_SERVER_ERROR, ex.getMessage(), ex);
}
return buildResponseEntity(apiError);
}
private ResponseEntity<Object> buildResponseEntity(ApiError apiError) {
return new ResponseEntity<>(apiError, apiError.getStatus());
}
}
\ No newline at end of file
...@@ -5,7 +5,6 @@ import com.keymobile.rest.common.utils.DateUtil; ...@@ -5,7 +5,6 @@ import com.keymobile.rest.common.utils.DateUtil;
import com.keymobile.rest.model.DataInfo; import com.keymobile.rest.model.DataInfo;
import com.keymobile.rest.model.Mission; import com.keymobile.rest.model.Mission;
import com.keymobile.rest.model.Template; import com.keymobile.rest.model.Template;
import com.keymobile.rest.model.User;
import com.keymobile.rest.service.DataInfoService; import com.keymobile.rest.service.DataInfoService;
import com.keymobile.rest.service.TemplateService; import com.keymobile.rest.service.TemplateService;
import com.keymobile.rest.service.MissionService; import com.keymobile.rest.service.MissionService;
...@@ -20,7 +19,6 @@ import java.sql.Timestamp; ...@@ -20,7 +19,6 @@ import java.sql.Timestamp;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@Api(tags = "模板 控制器", description = "Excel Info") @Api(tags = "模板 控制器", description = "Excel Info")
@RestController @RestController
......
package com.keymobile.rest.controller.constant;
public interface TaskConstant {
int TASK_TYPE_PERSONAL = 1;
int TASK_TYPE_GROUP = 2;
int MISSION_TYPE_DATA_ENTER = 1;
int MISSION_TYPE_DATA_AUDIT = 2;
int MISSION_TYPE_MANAGER_AUDIT = 3;
int MISSION_TYPE_DATA_BACK_FLOW = 4;
String MISSION_LOW_CASE_KEY_DATA_ENTER = "dataenter";
String MISSION_LOW_CASE_KEY__DATA_AUDIT = "dataaudit";
String MISSION_LOW_CASE_KEY__MANAGER_AUDIT = "managerconfirm";
String MISSION_LOW_CASE_KEY__DATA_BACK_FLOW = "databackflow";
String MISSION_TEXT_DATA_ENTER = "填写补录数据";
String MISSION_TEXT_DATA_AUDIT = "审核补录数据";
String MISSION_TEXT_MANAGER_AUDIT = "负责人审核";
String MISSION_TEXT_DATA_BACK_FLOW = "数据回流";
}
...@@ -51,7 +51,7 @@ public class Activity implements Serializable { ...@@ -51,7 +51,7 @@ public class Activity implements Serializable {
private Timestamp createAt; private Timestamp createAt;
@Column(columnDefinition = ("integer(2) comment '状态'")) @Column(columnDefinition = ("integer(2) comment '状态'"))
private Integer status; private Integer status = 1;
/** /**
* 发送人 * 发送人
......
...@@ -6,6 +6,7 @@ import lombok.Data; ...@@ -6,6 +6,7 @@ import lombok.Data;
import javax.persistence.*; import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List; import java.util.List;
/** /**
...@@ -17,10 +18,6 @@ import java.util.List; ...@@ -17,10 +18,6 @@ import java.util.List;
@Table(name = "t_process") @Table(name = "t_process")
public class Process implements Serializable { 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 @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
...@@ -32,8 +29,8 @@ public class Process implements Serializable { ...@@ -32,8 +29,8 @@ public class Process implements Serializable {
@Column(name = "process_id", unique = true, columnDefinition = ("varchar(100) comment '当前活动在跑进程 id'")) @Column(name = "process_id", unique = true, columnDefinition = ("varchar(100) comment '当前活动在跑进程 id'"))
private String processId; private String processId;
@Column(nullable = false, columnDefinition = ("integer(2) default 0 comment '进程状态'")) @Column(nullable = false, name = "start_at")
private int status = 0; private Timestamp startAt;
/** /**
* 该进程启动得所有子任务 * 该进程启动得所有子任务
......
...@@ -19,6 +19,8 @@ public class SimpleTask { ...@@ -19,6 +19,8 @@ public class SimpleTask {
private String remark; private String remark;
private Integer status;
private Integer type; private Integer type;
private Integer freq; private Integer freq;
......
...@@ -40,8 +40,8 @@ spring: ...@@ -40,8 +40,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
......
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