审计、时区
This commit is contained in:
parent
2198654c13
commit
d51b387712
@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Pope
|
* @author Pope
|
||||||
@ -28,8 +30,13 @@ public class AuditController {
|
|||||||
@RequestParam(value = "uri",required = false) String uri,
|
@RequestParam(value = "uri",required = false) String uri,
|
||||||
@RequestParam(value = "currentPage", defaultValue = "0") int currentPage,
|
@RequestParam(value = "currentPage", defaultValue = "0") int currentPage,
|
||||||
@RequestParam(value = "pageSize", defaultValue = "30") int pageSize) {
|
@RequestParam(value = "pageSize", defaultValue = "30") int pageSize) {
|
||||||
|
Map<String, Object> resultMap = new HashMap<>(16,0.75F);
|
||||||
|
resultMap.put("totalCount", 100);
|
||||||
|
resultMap.put("currentPage", currentPage);
|
||||||
|
resultMap.put("pageSize", pageSize);
|
||||||
|
resultMap.put("data",auditService.listAuditLimit(beginTime, endTime, uri, currentPage, pageSize));
|
||||||
ResultVO resultVO = new ResultVO(ResultEnum.SUCCESS);
|
ResultVO resultVO = new ResultVO(ResultEnum.SUCCESS);
|
||||||
resultVO.setData(auditService.listAuditLimit(beginTime, endTime, uri, currentPage, pageSize));
|
resultVO.setData(resultMap);
|
||||||
return resultVO;
|
return resultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,12 +53,16 @@ public class ProjectDaoImpl implements ProjectDao {
|
|||||||
if (name != null) {
|
if (name != null) {
|
||||||
criteria.and("name").regex(name);
|
criteria.and("name").regex(name);
|
||||||
}
|
}
|
||||||
if (date_gt != 0) {
|
if (date_gt != 0 && date_lt != 0) {
|
||||||
criteria.and("date").gt(date_gt);
|
// criteria.and("date").gt(date_gt).lt(date_lt);
|
||||||
|
criteria.andOperator(Criteria.where("date").gt(date_gt), Criteria.where("date").lt(date_lt));
|
||||||
}
|
}
|
||||||
if(date_lt != 0) {
|
else if(date_lt != 0) {
|
||||||
criteria.and("date").lt(date_lt);
|
criteria.and("date").lt(date_lt);
|
||||||
}
|
}
|
||||||
|
else if (date_gt != 0) {
|
||||||
|
criteria.and("date").gt(date_gt);
|
||||||
|
}
|
||||||
Query query = new Query(criteria).skip(offset).limit(pageSize);
|
Query query = new Query(criteria).skip(offset).limit(pageSize);
|
||||||
return mongoTemplate.find(query, Project.class);
|
return mongoTemplate.find(query, Project.class);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public enum AuthEnum {
|
|||||||
add("/record/recordValues : GET");
|
add("/record/recordValues : GET");
|
||||||
add("/record/record : PUT");
|
add("/record/record : PUT");
|
||||||
add("/record/record : DELETE");
|
add("/record/record : DELETE");
|
||||||
add("/record/underReviewRecord : PUT");
|
add("/record/review : PUT");
|
||||||
add("/record/file : POST");
|
add("/record/file : POST");
|
||||||
|
|
||||||
add("/user/userList : GET");
|
add("/user/userList : GET");
|
||||||
@ -55,6 +55,8 @@ public enum AuthEnum {
|
|||||||
add("/metaData/metaData : PUT");
|
add("/metaData/metaData : PUT");
|
||||||
add("/metaData/metaData : POST");
|
add("/metaData/metaData : POST");
|
||||||
add("/metaData/wordTemplate : POST");
|
add("/metaData/wordTemplate : POST");
|
||||||
|
|
||||||
|
add("/audit/audit : GET");
|
||||||
}}),
|
}}),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,7 +111,7 @@ public enum AuthEnum {
|
|||||||
add("/record/record : DELETE");
|
add("/record/record : DELETE");
|
||||||
}}),
|
}}),
|
||||||
EXAMINE_RECORD("审核流调记录的权限", new HashSet<String>() {{
|
EXAMINE_RECORD("审核流调记录的权限", new HashSet<String>() {{
|
||||||
add("/record/underReviewRecord : PUT");
|
add("/record/review : PUT");
|
||||||
}}),
|
}}),
|
||||||
UPLOAD_RECORD_FILE("上传流调记录相关文件的权限", new HashSet<String>() {{
|
UPLOAD_RECORD_FILE("上传流调记录相关文件的权限", new HashSet<String>() {{
|
||||||
add("/record/file : POST");
|
add("/record/file : POST");
|
||||||
@ -164,7 +166,7 @@ public enum AuthEnum {
|
|||||||
add("/metadata/metadata : PUT");
|
add("/metadata/metadata : PUT");
|
||||||
}}),
|
}}),
|
||||||
DELETE_METADATA("删除元数据的权限", new HashSet<String>() {{
|
DELETE_METADATA("删除元数据的权限", new HashSet<String>() {{
|
||||||
|
add("/metadata/metadata : DELETE");
|
||||||
}}),
|
}}),
|
||||||
CREATE_METADATA("添加元数据的权限", new HashSet<String>() {{
|
CREATE_METADATA("添加元数据的权限", new HashSet<String>() {{
|
||||||
add("/metadata/metadata : POST");
|
add("/metadata/metadata : POST");
|
||||||
@ -177,7 +179,7 @@ public enum AuthEnum {
|
|||||||
* 审计
|
* 审计
|
||||||
*/
|
*/
|
||||||
QUERY_AUDIT("查询审计记录", new HashSet<String>() {{
|
QUERY_AUDIT("查询审计记录", new HashSet<String>() {{
|
||||||
|
add("/audit/audit : GET");
|
||||||
}});
|
}});
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.example.survey.service;
|
package com.example.survey.service;
|
||||||
|
|
||||||
import com.example.survey.dto.record.*;
|
import com.example.survey.dto.record.*;
|
||||||
|
import com.example.survey.vo.RecordDetailVO;
|
||||||
import com.example.survey.vo.RecordVO;
|
import com.example.survey.vo.RecordVO;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ public interface RecordService {
|
|||||||
* @param version 版本号
|
* @param version 版本号
|
||||||
* @return 流调记录的values
|
* @return 流调记录的values
|
||||||
*/
|
*/
|
||||||
Map<String,Object> getRecordValues(String uuid);
|
RecordDetailVO getRecordValues(String uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传文件
|
* 上传文件
|
||||||
|
@ -10,6 +10,7 @@ import com.example.survey.enumeration.ResultEnum;
|
|||||||
import com.example.survey.exception.*;
|
import com.example.survey.exception.*;
|
||||||
import com.example.survey.service.RecordService;
|
import com.example.survey.service.RecordService;
|
||||||
import com.example.survey.util.WordUtil;
|
import com.example.survey.util.WordUtil;
|
||||||
|
import com.example.survey.vo.RecordDetailVO;
|
||||||
import com.example.survey.vo.RecordVO;
|
import com.example.survey.vo.RecordVO;
|
||||||
import com.example.survey.vo.inner.OperationInfo;
|
import com.example.survey.vo.inner.OperationInfo;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
@ -51,20 +52,20 @@ public class RecordServiceImpl implements RecordService {
|
|||||||
@Value("${file.url}")
|
@Value("${file.url}")
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reviewRecord(ReviewRecordDTO reviewRecordDTO) {
|
public void reviewRecord(ReviewRecordDTO reviewRecordDTO) {
|
||||||
if (!userDao.existUser(reviewRecordDTO.getReviewerPhone())) {
|
if (!userDao.existUser(reviewRecordDTO.getReviewerPhone())) {
|
||||||
throw new UserException(ResultEnum.NOT_EXIST_USER);
|
throw new UserException(ResultEnum.NOT_EXIST_USER);
|
||||||
}
|
}
|
||||||
User user = userDao.selectUser(reviewRecordDTO.getReviewerPhone());
|
User user = userDao.selectUser(reviewRecordDTO.getReviewerPhone());
|
||||||
|
|
||||||
if (!recordDao.existRecord(reviewRecordDTO.getUuid())) {
|
if (!recordDao.existRecord(reviewRecordDTO.getUuid())) {
|
||||||
throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
|
throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
|
||||||
}
|
}
|
||||||
Record record = recordDao.getRecord( reviewRecordDTO.getUuid());
|
Record record = recordDao.getRecord(reviewRecordDTO.getUuid());
|
||||||
|
|
||||||
record.setState(reviewRecordDTO.getPass() ? RecordStateEnum.REVIEWED.getValue() : RecordStateEnum.NOT_PASS.getValue());
|
record.setState(
|
||||||
|
reviewRecordDTO.getPass() ? RecordStateEnum.REVIEWED.getValue() : RecordStateEnum.NOT_PASS.getValue());
|
||||||
// record.setVersion(UUID.randomUUID().toString());
|
// record.setVersion(UUID.randomUUID().toString());
|
||||||
Operation reviewOp = Operation.reviewOp(user, reviewRecordDTO.getMsg(), reviewRecordDTO.getPass());
|
Operation reviewOp = Operation.reviewOp(user, reviewRecordDTO.getMsg(), reviewRecordDTO.getPass());
|
||||||
List<Operation> opList = record.getOperationList();
|
List<Operation> opList = record.getOperationList();
|
||||||
@ -80,7 +81,7 @@ public class RecordServiceImpl implements RecordService {
|
|||||||
throw new UserException(ResultEnum.NOT_EXIST_USER);
|
throw new UserException(ResultEnum.NOT_EXIST_USER);
|
||||||
}
|
}
|
||||||
User user = userDao.selectUser(modifyRecordDTO.getUserPhone());
|
User user = userDao.selectUser(modifyRecordDTO.getUserPhone());
|
||||||
|
|
||||||
Record record = recordDao.getRecord(modifyRecordDTO.getUuid());
|
Record record = recordDao.getRecord(modifyRecordDTO.getUuid());
|
||||||
if (record == null) {
|
if (record == null) {
|
||||||
throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
|
throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
|
||||||
@ -106,7 +107,7 @@ public class RecordServiceImpl implements RecordService {
|
|||||||
}
|
}
|
||||||
MetaData metaData = metaDataDao.selectMetaData(submitRecordDTO.getMetaDataName());
|
MetaData metaData = metaDataDao.selectMetaData(submitRecordDTO.getMetaDataName());
|
||||||
Record record = new Record();
|
Record record = new Record();
|
||||||
|
|
||||||
record.setUser(user);
|
record.setUser(user);
|
||||||
record.setValues(submitRecordDTO.getValues());
|
record.setValues(submitRecordDTO.getValues());
|
||||||
Operation submitOp = Operation.submitOp(user, submitRecordDTO.getMsg());
|
Operation submitOp = Operation.submitOp(user, submitRecordDTO.getMsg());
|
||||||
@ -123,24 +124,30 @@ public class RecordServiceImpl implements RecordService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long countRecord(String idNumber, String state, String uuid,
|
public long countRecord(String idNumber, String state, String uuid, String templateName, String templateType,
|
||||||
String templateName, String templateType,
|
long submitTimeGt, long submitTimeLt, String projectName) {
|
||||||
long submitTimeGt, long submitTimeLt, String projectName) {
|
|
||||||
|
return recordDao.countRecord(idNumber, state, uuid, templateName, templateType, submitTimeGt, submitTimeLt,
|
||||||
return recordDao.countRecord(idNumber, state, uuid, templateName, templateType, submitTimeGt, submitTimeLt, projectName);
|
projectName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RecordVO> listRecordLimit(String idNumber, String state, String uuid,
|
public List<RecordVO> listRecordLimit(String idNumber, String state, String uuid, String templateName,
|
||||||
String templateName, String templateType,
|
String templateType, long submitTimeGt, long submitTimeLt, String projectName, int currentPage,
|
||||||
long submitTimeGt, long submitTimeLt, String projectName, int currentPage, int pageSize) {
|
int pageSize) {
|
||||||
|
|
||||||
List<Record> recordList = recordDao.listRecordLimit(idNumber, state, uuid, templateName, templateType, submitTimeGt, submitTimeLt, projectName, currentPage * pageSize, pageSize);
|
List<Record> recordList = recordDao.listRecordLimit(idNumber, state, uuid, templateName, templateType,
|
||||||
|
submitTimeGt, submitTimeLt, projectName, currentPage * pageSize, pageSize);
|
||||||
return recordList.stream().map(record -> {
|
return recordList.stream().map(record -> {
|
||||||
RecordVO recordVO = new RecordVO();
|
RecordVO recordVO = new RecordVO();
|
||||||
recordVO.setIdNumber(record.getIdNumber());
|
recordVO.setIdNumber(record.getIdNumber());
|
||||||
recordVO.setUuid(record.getUuid());
|
recordVO.setUuid(record.getUuid());
|
||||||
recordVO.setTemplate(record.getMetaData().getName());
|
if (record.getMetaData() == null) {
|
||||||
|
recordVO.setTemplate(null);
|
||||||
|
} else {
|
||||||
|
recordVO.setTemplate(record.getMetaData().getName());
|
||||||
|
|
||||||
|
}
|
||||||
recordVO.setOperationInfoList(record.getOperationList().stream().map(op -> {
|
recordVO.setOperationInfoList(record.getOperationList().stream().map(op -> {
|
||||||
OperationInfo operationInfo = new OperationInfo();
|
OperationInfo operationInfo = new OperationInfo();
|
||||||
operationInfo.setType(op.getType());
|
operationInfo.setType(op.getType());
|
||||||
@ -151,6 +158,7 @@ public class RecordServiceImpl implements RecordService {
|
|||||||
operationInfo.setResult(op.getResult());
|
operationInfo.setResult(op.getResult());
|
||||||
return operationInfo;
|
return operationInfo;
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
|
recordVO.setProjectList(record.getProjectList());
|
||||||
recordVO.setState(record.getState());
|
recordVO.setState(record.getState());
|
||||||
recordVO.setSubmitTime(record.getSubmitTime());
|
recordVO.setSubmitTime(record.getSubmitTime());
|
||||||
return recordVO;
|
return recordVO;
|
||||||
@ -158,13 +166,36 @@ public class RecordServiceImpl implements RecordService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getRecordValues(String uuid) {
|
public RecordDetailVO getRecordValues(String uuid) {
|
||||||
|
|
||||||
Record record = recordDao.getRecord(uuid);
|
Record record = recordDao.getRecord(uuid);
|
||||||
if (record == null) {
|
if (record == null) {
|
||||||
throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
|
throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
|
||||||
}
|
}
|
||||||
return record.getValues();
|
RecordDetailVO recordVO = new RecordDetailVO();
|
||||||
|
recordVO.setIdNumber(record.getIdNumber());
|
||||||
|
recordVO.setUuid(record.getUuid());
|
||||||
|
if (record.getMetaData() == null) {
|
||||||
|
recordVO.setTemplate(null);
|
||||||
|
} else {
|
||||||
|
recordVO.setTemplate(record.getMetaData().getName());
|
||||||
|
|
||||||
|
}
|
||||||
|
recordVO.setOperationInfoList(record.getOperationList().stream().map(op -> {
|
||||||
|
OperationInfo operationInfo = new OperationInfo();
|
||||||
|
operationInfo.setType(op.getType());
|
||||||
|
operationInfo.setTime(op.getTime());
|
||||||
|
operationInfo.setPersonId(op.getUser().getPhone());
|
||||||
|
operationInfo.setPersonName(op.getUser().getUsername());
|
||||||
|
operationInfo.setMsg(op.getMsg());
|
||||||
|
operationInfo.setResult(op.getResult());
|
||||||
|
return operationInfo;
|
||||||
|
}).collect(Collectors.toList()));
|
||||||
|
recordVO.setProjectList(record.getProjectList());
|
||||||
|
recordVO.setState(record.getState());
|
||||||
|
recordVO.setSubmitTime(record.getSubmitTime());
|
||||||
|
recordVO.setValues(record.getValues());
|
||||||
|
return recordVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -210,7 +241,7 @@ public class RecordServiceImpl implements RecordService {
|
|||||||
throw new UserException(ResultEnum.NOT_EXIST_USER);
|
throw new UserException(ResultEnum.NOT_EXIST_USER);
|
||||||
}
|
}
|
||||||
User user = userDao.selectUser(deleteRecordDTO.getPhone());
|
User user = userDao.selectUser(deleteRecordDTO.getPhone());
|
||||||
|
|
||||||
Record record = recordDao.getRecord(deleteRecordDTO.getUuid());
|
Record record = recordDao.getRecord(deleteRecordDTO.getUuid());
|
||||||
if (record == null) {
|
if (record == null) {
|
||||||
throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
|
throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
|
||||||
@ -226,19 +257,19 @@ public class RecordServiceImpl implements RecordService {
|
|||||||
@Override
|
@Override
|
||||||
public void record2word(String uuid, HttpServletResponse response) {
|
public void record2word(String uuid, HttpServletResponse response) {
|
||||||
Record record = recordDao.getRecord(uuid);
|
Record record = recordDao.getRecord(uuid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void modifyMetaData(ModifyMetaDataDTO modifyMetaDataDTO) {
|
public void modifyMetaData(ModifyMetaDataDTO modifyMetaDataDTO) {
|
||||||
|
|
||||||
if (!metaDataDao.existMetaData(modifyMetaDataDTO.getMetaDataName())) {
|
if (!metaDataDao.existMetaData(modifyMetaDataDTO.getMetaDataName())) {
|
||||||
throw new MetaDataException(ResultEnum.NOT_EXIST_METADATA);
|
throw new MetaDataException(ResultEnum.NOT_EXIST_METADATA);
|
||||||
}
|
}
|
||||||
MetaData metaData = metaDataDao.selectMetaData(modifyMetaDataDTO.getMetaDataName());
|
MetaData metaData = metaDataDao.selectMetaData(modifyMetaDataDTO.getMetaDataName());
|
||||||
|
|
||||||
Record record = recordDao.getRecord(modifyMetaDataDTO.getUuid());
|
Record record = recordDao.getRecord(modifyMetaDataDTO.getUuid());
|
||||||
if(record == null) {
|
if (record == null) {
|
||||||
throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
|
throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +279,7 @@ public class RecordServiceImpl implements RecordService {
|
|||||||
User user = userDao.selectUser(modifyMetaDataDTO.getPhone());
|
User user = userDao.selectUser(modifyMetaDataDTO.getPhone());
|
||||||
|
|
||||||
List<Operation> operationList = record.getOperationList();
|
List<Operation> operationList = record.getOperationList();
|
||||||
String msg = record.getMetaData().getName() +"->" + modifyMetaDataDTO.getMetaDataName();
|
String msg = record.getMetaData().getName() + "->" + modifyMetaDataDTO.getMetaDataName();
|
||||||
Operation modifyMetaOp = Operation.modifyMetaOp(user, msg);
|
Operation modifyMetaOp = Operation.modifyMetaOp(user, msg);
|
||||||
// modifyMetaOp.setMsg();
|
// modifyMetaOp.setMsg();
|
||||||
operationList.add(modifyMetaOp);
|
operationList.add(modifyMetaOp);
|
||||||
|
30
src/main/java/com/example/survey/vo/RecordDetailVO.java
Normal file
30
src/main/java/com/example/survey/vo/RecordDetailVO.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package com.example.survey.vo;
|
||||||
|
|
||||||
|
import com.example.survey.vo.inner.OperationInfo;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Pope
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RecordDetailVO {
|
||||||
|
|
||||||
|
private String idNumber;
|
||||||
|
|
||||||
|
private List<String> projectList;
|
||||||
|
|
||||||
|
private String template;
|
||||||
|
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
private long submitTime;
|
||||||
|
|
||||||
|
private List<OperationInfo> operationInfoList;
|
||||||
|
|
||||||
|
private Map<String, Object> values;
|
||||||
|
|
||||||
|
private String state;
|
||||||
|
}
|
@ -14,7 +14,7 @@ public class RecordVO {
|
|||||||
|
|
||||||
private String idNumber;
|
private String idNumber;
|
||||||
|
|
||||||
// private List<String> projectList;
|
private List<String> projectList;
|
||||||
|
|
||||||
private String template;
|
private String template;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public class OperationInfo {
|
|||||||
/**
|
/**
|
||||||
* 时间
|
* 时间
|
||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
private Date time;
|
private Date time;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user